| Age | Commit message (Collapse) | Author | Lines |
|
Point at `:` when using it instead of `;`
When triggering type ascription in such a way that we can infer a
statement end was intended, add a suggestion for the change. Always
point out the reason for the expectation of a type is due to type
ascription.
Fix #42057, #41928.
|
|
Adjust new suggestions to the suggestion guidelines
Addresses https://github.com/rust-lang/rust/pull/42033#discussion_r127694915
guidelines are https://github.com/rust-lang/rust/blob/master//src/librustc_errors/diagnostic.rs#L212-L224
|
|
|
|
|
|
|
|
Now there's a way to add suggestions that hide the suggested code when
presented inline, to avoid weird wording when short code snippets are
added at the end.
|
|
|
|
When triggering type ascription in such a way that we can infer a
statement end was intended, add a suggestion for the change. Always
point out the reason for the expectation of a type is due to type
ascription.
|
|
No (intentional) changes to behavior. This is intended to avoid the
anti-pattern of having to import individual methods throughout code.
|
|
|
|
Fix spans, add some comments
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
remove variant `Token::SubstNt` in favor of `quoted::TokenTree::MetaVar`.
|
|
Replaced by adding extra imports, adding hidden code (`# ...`), modifying
examples to be runnable (sorry Homura), specifying non-Rust code, and
converting to should_panic, no_run, or compile_fail.
Remaining "```ignore"s received an explanation why they are being ignored.
|
|
Learn to parse `a as usize < b`
Parsing `a as usize > b` always works, but `a as usize < b` was a
parsing error because the parser would think the `<` started a generic
type argument for `usize`. The parser now attempts to parse as before,
and if a DiagnosticError is returned, try to parse again as a type with
no generic arguments. If this fails, return the original
`DiagnosticError`.
Fix #22644.
|
|
- generate error instead of warning
- remove `RewindPoint` and just keep a copy of `Parser` to rewind state.
- `dont_parse_generics: bool` -> `parse_generics: bool`
- remove `eat_lt`
- move error handling code to separate method
|
|
```
warning: `<` is interpreted as a start of generic arguments for `usize`, not a comparison
--> $DIR/issue-22644.rs:16:33
|
16 | println!("{}", a as usize < b);
| - ^ interpreted as generic argument
| |
| not interpreted as comparison
|
help: if you want to compare the casted value then write:
| println!("{}", (a as usize) < b);
```
|
|
|
|
```
warning: `<` is interpreted as a start of generic arguments for `usize`, not comparison
--> $DIR/issue-22644.rs:16:33
|
16 | println!("{}", a as usize < b);
| ^ expected one of `!`, `(`, `+`, `,`, `::`, or `>` here
|
help: if you want to compare the casted value then write
| println!("{}", (a as usize) < b);
```
|
|
Parsing `a as usize > b` always works, but `a as usize < b` was a
parsing error because the parser would think the `<` started a generic
type argument for `usize`. The parser now attempts to parse as before,
and if a DiagnosticError is returned, try to parse again as a type with
no generic arguments. If this fails, return the original
`DiagnosticError`.
|
|
|
|
Improve error message for const extern fn
It's currently ``error: unmatched visibility `pub` ``, which is a nonsensical error in this context.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This is useful if parsing from stdin or a String and don't want to try and read in a module from another file. Instead we just leave a stub in the AST.
|
|
|
|
This is mostly removing stray ampersands, needless returns and lifetimes.
|
|
|
|
Delete features which are easily removed, in libsyntax
|
|
|
|
|
|
|
|
Minimize single span suggestions into a label
changes
```
14 | println!("☃{}", tup[0]);
| ^^^^^^
|
help: to access tuple elements, use tuple indexing syntax as shown
| println!("☃{}", tup.0);
```
into
```
14 | println!("☃{}", tup[0]);
| ^^^^^^ to access tuple elements, use `tup.0`
```
Also makes suggestions explicit in the backend in preparation of adding multiple suggestions to a single diagnostic. Currently that's already possible, but results in a full help message + modified code snippet per suggestion, and has no rate limit (might show 100+ suggestions).
|
|
syntax: Parse trait object types starting with a lifetime bound
Fixes https://github.com/rust-lang/rust/issues/39085
This was originally implemented in https://github.com/rust-lang/rust/pull/40043, then reverted, then there was some [agreement](https://github.com/rust-lang/rust/issues/39318#issuecomment-289108720) that it should be supported.
(This is hopefully the last PR related to bound parsing.)
|
|
#37653 support `default impl` for specialization
this commit implements the first step of the `default impl` feature:
> all items in a `default impl` are (implicitly) `default` and hence
> specializable.
In order to test this feature I've copied all the tests provided for the
`default` method implementation (in run-pass/specialization and
compile-fail/specialization directories) and moved the `default` keyword
from the item to the impl.
See [referenced](https://github.com/rust-lang/rust/issues/37653) issue for further info
r? @aturon
|
|
`[default] [unsafe] impl` and typecheck
|
|
|
|
|
|
|
|
|