Commit graph

45 commits

Author SHA1 Message Date
Lukas Wirth
70d43c3faf Add validation for mutable const items 2021-01-24 02:17:41 +01:00
bors[bot]
5231f4b270
Merge #7341
7341: Fix warnings when running `cargo doc --document-private-items` r=Veykril a=jyn514

These were the warnings previously:

<details>

```
warning: could not parse code block as Rust code
   --> crates/stdx/src/lib.rs:137:9
    |
137 |   ///     ∀ x in slice[..idx]:  pred(x)
    |  _________^
138 | | ///  && ∀ x in slice[idx..]: !pred(x)
    | |____^
    |
    = note: error from rustc: unknown start of token: \u{2200}

warning: 1 warning emitted

warning: unresolved link to `package`
   --> crates/base_db/src/input.rs:181:15
    |
181 |     /// it's [package].name, can be different for other project types or even
    |               ^^^^^^^ no item named `package` in scope
    |
    = note: `#[warn(broken_intra_doc_links)]` on by default
    = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

warning: unresolved link to `package`
   --> crates/base_db/src/input.rs:181:15
    |
181 |     /// it's [package].name, can be different for other project types or even
    |               ^^^^^^^ no item named `package` in scope
    |
    = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

warning: 2 warnings emitted

warning: unresolved link to `package`
   --> crates/base_db/src/input.rs:181:15
    |
181 |     /// it's [package].name, can be different for other project types or even
    |               ^^^^^^^ no item named `package` in scope
    |
    = note: `#[warn(broken_intra_doc_links)]` on by default
    = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

warning: unresolved link to `package`
   --> crates/base_db/src/input.rs:181:15
    |
181 |     /// it's [package].name, can be different for other project types or even
    |               ^^^^^^^ no item named `package` in scope
    |
    = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

warning: 2 warnings emitted
```

</details>

This does *not* fix the following warning, because it is actually rust
code and rustdoc is being over eager:

```
warning: Rust code block is empty
  --> crates/parser/src/grammar.rs:16:5
   |
16 |   //! ```
   |  _____^
17 | | //! // test function_with_zero_parameters
18 | | //! // fn foo() {}
19 | | //! ```
   | |_______^
   |
help: mark blocks that do not contain Rust code as text
   |
16 | //! ```text
   |     ^^^^^^^
```

https://github.com/rust-lang/rust/pull/79816 should make this
configurable so the warning can be `allow`ed.

Co-authored-by: Joshua Nelson <jyn514@gmail.com>
2021-01-18 23:19:53 +00:00
Joshua Nelson
e7d1f30cb3 Fix warnings when running cargo doc --document-private-items
These were the warnings previously:

```
warning: could not parse code block as Rust code
   --> crates/stdx/src/lib.rs:137:9
    |
137 |   ///     ∀ x in slice[..idx]:  pred(x)
    |  _________^
138 | | ///  && ∀ x in slice[idx..]: !pred(x)
    | |____^
    |
    = note: error from rustc: unknown start of token: \u{2200}

warning: 1 warning emitted

warning: unresolved link to `package`
   --> crates/base_db/src/input.rs:181:15
    |
181 |     /// it's [package].name, can be different for other project types or even
    |               ^^^^^^^ no item named `package` in scope
    |
    = note: `#[warn(broken_intra_doc_links)]` on by default
    = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

warning: unresolved link to `package`
   --> crates/base_db/src/input.rs:181:15
    |
181 |     /// it's [package].name, can be different for other project types or even
    |               ^^^^^^^ no item named `package` in scope
    |
    = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

warning: 2 warnings emitted

warning: unresolved link to `package`
   --> crates/base_db/src/input.rs:181:15
    |
181 |     /// it's [package].name, can be different for other project types or even
    |               ^^^^^^^ no item named `package` in scope
    |
    = note: `#[warn(broken_intra_doc_links)]` on by default
    = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

warning: unresolved link to `package`
   --> crates/base_db/src/input.rs:181:15
    |
181 |     /// it's [package].name, can be different for other project types or even
    |               ^^^^^^^ no item named `package` in scope
    |
    = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

warning: 2 warnings emitted
```

This does *not* fix the following warning, because it is actually rust
code and rustdoc is being over eager:

```
warning: Rust code block is empty
  --> crates/parser/src/grammar.rs:16:5
   |
16 |   //! ```
   |  _____^
17 | | //! // test function_with_zero_parameters
18 | | //! // fn foo() {}
19 | | //! ```
   | |_______^
   |
help: mark blocks that do not contain Rust code as text
   |
16 | //! ```text
   |     ^^^^^^^
```

https://github.com/rust-lang/rust/pull/79816 should make this
configurable so the warning can be `allow`ed.
2021-01-18 16:44:40 -05:00
Lukas Wirth
b26002410b Parse impl const Trait 2021-01-18 20:18:02 +01:00
Jonas Schievink
872bf09381 Add MacroType syntax 2021-01-18 17:56:35 +01:00
bors[bot]
9daba961f2
Merge #7291
7291: Wrap remaining self/super/crate in Name{Ref} r=matklad a=Veykril

That should be the remaining special casing for `self` 🎉 

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-18 16:13:06 +00:00
Aleksey Kladov
b97447b125 Add missing inlines 2021-01-17 16:50:03 +03:00
Lukas Wirth
98718e0544 Wrap remaining self/super/crate in Name{Ref} 2021-01-15 22:18:43 +01:00
Lukas Wirth
cb863390f2 Handle self/super/crate in PathSegment as NameRef 2021-01-15 19:21:23 +01:00
Daiki Ihara
85cd3524e2 Add support for yiled keyword 2021-01-15 23:35:17 +09:00
bors[bot]
d76143da19
Merge #7211
7211: Fixed expr meta var after path colons in mbe r=matklad a=edwin0cheng

Fixes #7207

Added `L_DOLLAR` in `ITEM_RECOVERY_SET` , but I don't know whether it is a good idea.

r? @matklad 

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-01-14 10:52:12 +00:00
bors[bot]
607b9ea160
Merge #7218
7218: Fix typos r=Veykril a=regexident

Apart from the very last commit on this PR (which fixes a public type's name) all changes are non-breaking.

Co-authored-by: Vincent Esche <regexident@gmail.com>
2021-01-10 18:16:29 +00:00
Lukas Wirth
e618d12903 Replace SyntaxKind usage with T! macro where applicable 2021-01-10 17:14:01 +01:00
Laurențiu Nicola
a7db8abab7 Use T! for bool keywords 2021-01-10 17:47:12 +02:00
Callym
dcb4c0ada6 Allow true and false keywords in const generics 2021-01-10 13:58:09 +00:00
Edwin Cheng
8d62576a9b Fixed expr meta var after path colons in mbe 2021-01-10 20:52:46 +08:00
Vincent Esche
21f8239ac8 Fixed typos in code comments 2021-01-09 15:41:29 +01:00
Marijn Suijten
42da26e959 parser,syntax: Add separate parser for stmt with optional semicolon
Adjusting `grammar::fragments::stmt` to Optional or Yes will break
original functionality and tests.
2021-01-03 12:05:52 +01:00
Edwin Cheng
710407b11d Fix mbe fail to pass expr with attr 2020-12-28 19:53:00 +08:00
Lukas Wirth
3e0bb89541 Fix macro_rules not accepting brackets or parentheses 2020-12-24 09:36:47 +01:00
Lukas Wirth
bdd8c0b68f Remove local ungrammar dependency 2020-12-23 11:22:36 +01:00
Lukas Wirth
2c94c4964a Parse const effect block 2020-12-23 02:15:44 +01:00
Lukas Wirth
03a9bbacf2 Parse ConstBlockPat 2020-12-23 01:49:43 +01:00
Lukas Wirth
be7260485e Update ungrammar for const block patterns 2020-12-23 01:26:31 +01:00
bors[bot]
9bb9fbab3a
Merge #6965
6965: Properly attach attributes to Param instead of parent ParamList r=matklad a=Veykril

Fixes #2783, fixes #2781

The problem with `let _a = [0,#[cfg(feature = "L")]0];` has already been fixed some time ago it seems:
<details>
  <summary>Syntax Tree for the const item</summary>

```
  LET_STMT@200..236
    LET_KW@200..203 "let"
    WHITESPACE@203..204 " "
    IDENT_PAT@204..206
      NAME@204..206
        IDENT@204..206 "_a"
    WHITESPACE@206..207 " "
    EQ@207..208 "="
    WHITESPACE@208..209 " "
    ARRAY_EXPR@209..235
      L_BRACK@209..210 "["
      LITERAL@210..211
        INT_NUMBER@210..211 "0"
      COMMA@211..212 ","
      LITERAL@212..234
        ATTR@212..233
          POUND@212..213 "#"
          L_BRACK@213..214 "["
          PATH@214..217
            PATH_SEGMENT@214..217
              NAME_REF@214..217
                IDENT@214..217 "cfg"
          TOKEN_TREE@217..232
            L_PAREN@217..218 "("
            IDENT@218..225 "feature"
            WHITESPACE@225..226 " "
            EQ@226..227 "="
            WHITESPACE@227..228 " "
            STRING@228..231 "\"L\""
            R_PAREN@231..232 ")"
          R_BRACK@232..233 "]"
        INT_NUMBER@233..234 "0"
      R_BRACK@234..235 "]"
    SEMICOLON@235..236 ";"
```
</details>

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-12-21 08:54:31 +00:00
bors[bot]
fa75e11eb6
Merge #6967
6967: Correctly parse legacy trait objects with leading ForType r=matklad a=Veykril

Fixes #1422

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-12-21 08:46:42 +00:00
Lukas Wirth
3ea4d43850 Properly parse legacy trait objects with leading ForType 2020-12-20 21:53:55 +01:00
Lukas Wirth
64caa027b8 Parse attributes in tuple expressions 2020-12-20 21:01:36 +01:00
Lukas Wirth
4be9ed675e Properly attach attributes to Param instead of parent ParamList 2020-12-20 20:30:18 +01:00
Edwin Cheng
f942d10e80 Use pattern_single instead of pattern in mbe pat 2020-12-20 17:13:40 +08:00
Jonas Schievink
08de1b4fa5 Implement RawAttr::filter 2020-12-18 18:58:42 +01:00
Lukas Wirth
dd496223f5 Node-ify lifetimes 2020-12-16 14:16:09 +01:00
Jonas Schievink
c1cb595382 Move to upstream macro_rules! model 2020-12-15 15:37:37 +01:00
David Tolnay
8a11da40a7
Parse unsafe extern block 2020-11-22 20:44:56 -08:00
Aleksey Kladov
5ba4f949c2 Kill RAW_ literals
Syntactically, they are indistinguishable from non-raw versions, so it
doesn't make sense to separate then *at the syntax* level.
2020-11-06 22:23:14 +01:00
Arif Roktim
0a9ff04270 Don't interpret type path as part of visibility. 2020-10-24 02:20:45 -04:00
Pavan Kumar Sunkara
4d97f5f037 Rename record_field_pat to record_pat_field 2020-09-10 18:56:04 +02:00
kjeremy
11758d518a Up proc-macro2 to 1.20
This changes the way Display is implemented
2020-09-03 17:40:12 -04:00
Aleksey Kladov
4b989009e3 CONST LOOPS ARE HERE 2020-08-27 18:12:01 +02:00
Aleksey Kladov
18b667cfcb Complete pub in fields 2020-08-25 17:22:23 +02:00
Pavan Kumar Sunkara
335add49db Add description for crates that will be published 2020-08-24 13:07:22 +02:00
Aleksey Kladov
ef462ed6af Better recovery in use foo::; 2020-08-13 18:50:21 +02:00
Aleksey Kladov
6bc2633c90 Align parser names with grammar 2020-08-13 17:59:27 +02:00
Aleksey Kladov
a1c187eef3 Rename ra_syntax -> syntax 2020-08-12 18:30:53 +02:00
Aleksey Kladov
50a02eb359 Rename ra_parser -> parser 2020-08-12 17:14:23 +02:00