Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Placing lifetime specifier after &mut emits wall of unhelpful diagnostics #73568

Closed
SNCPlay42 opened this issue Jun 21, 2020 · 4 comments · Fixed by #73595
Closed

Placing lifetime specifier after &mut emits wall of unhelpful diagnostics #73568

SNCPlay42 opened this issue Jun 21, 2020 · 4 comments · Fixed by #73595
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. D-confusing Diagnostics: Confusing error or lint that should be reworked. D-incorrect Diagnostics: A diagnostic that is giving misleading or incorrect information. D-verbose Diagnostics: Too much output caused by a single piece of incorrect code. P-high High priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another.

Comments

@SNCPlay42
Copy link
Contributor

Playground

fn x<'a>(x: &mut 'a i32){}

Expected result: a diagnostic suggests placing 'a before mut

Actual diagnostic output:

   Compiling playground v0.0.1 (/playground)
error: lifetime in trait object type must be followed by `+`
 --> src/lib.rs:1:18
  |
1 | fn x<'a>(x: &mut 'a i32){}
  |                  ^^

error: expected one of `:`, `@`, or `|`, found `)`
 --> src/lib.rs:1:24
  |
1 | fn x<'a>(x: &mut 'a i32){}
  |                        ^ expected one of `:`, `@`, or `|`
  |
  = note: anonymous parameters are removed in the 2018 edition (see RFC 1685)
help: if this was a parameter name, give it a type
  |
1 | fn x<'a>(x: &mut 'a i32: TypeName){}
  |                     ^^^^^^^^^^^^^
help: if this is a type, explicitly ignore the parameter name
  |
1 | fn x<'a>(x: &mut 'a _: i32){}
  |                     ^^^^^^

error: expected one of `)` or `,`, found `i32`
 --> src/lib.rs:1:21
  |
1 | fn x<'a>(x: &mut 'a i32){}
  |                    -^^^ expected one of `)` or `,`
  |                    |
  |                    help: missing `,`

warning: trait objects without an explicit `dyn` are deprecated
 --> src/lib.rs:1:18
  |
1 | fn x<'a>(x: &mut 'a i32){}
  |                  ^^ help: use `dyn`: `dyn 'a`
  |
  = note: `#[warn(bare_trait_objects)]` on by default

error[E0224]: at least one trait is required for an object type
 --> src/lib.rs:1:18
  |
1 | fn x<'a>(x: &mut 'a i32){}
  |                  ^^

error: aborting due to 4 previous errors; 1 warning emitted

For more information about this error, try `rustc --explain E0224`.
error: could not compile `playground`.

To learn more, run the command again with --verbose.
@SNCPlay42 SNCPlay42 added the C-bug Category: This is a bug. label Jun 21, 2020
@SNCPlay42
Copy link
Contributor Author

SNCPlay42 commented Jun 21, 2020

Output from rustc 1.43 (godbolt):

error: expected type, found `'a`
 --> <source>:1:18
  |
1 | fn x<'a>(x: &mut 'a i32){}
  |                  ^^ expected type

error: aborting due to previous error

The size of the output appears to be a recent regression.

@SNCPlay42
Copy link
Contributor Author

cargo-bisect-rustc:

searched nightlies: from nightly-2020-03-09 to nightly-2020-06-21
regressed nightly: nightly-2020-03-12
searched commits: from 1581278 to c20d7ee
regressed commit: c20d7ee

bisected with cargo-bisect-rustc v0.5.2

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc --prompt --start 2020-03-09 

Looks like #69760?

@SNCPlay42
Copy link
Contributor Author

SNCPlay42 commented Jun 21, 2020

Further testing confirms #69760, specifically ba3ae46 introduced the large number of diagnostics.

@LeSeulArtichaut LeSeulArtichaut added A-diagnostics Area: Messages for errors, warnings, and lints I-prioritize Issue: Indicates that prioritization has been requested for this issue. regression-from-stable-to-stable Performance or correctness regression from one stable version to another. D-confusing Diagnostics: Confusing error or lint that should be reworked. D-incorrect Diagnostics: A diagnostic that is giving misleading or incorrect information. D-verbose Diagnostics: Too much output caused by a single piece of incorrect code. P-high High priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Jun 21, 2020
@LeSeulArtichaut
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. D-confusing Diagnostics: Confusing error or lint that should be reworked. D-incorrect Diagnostics: A diagnostic that is giving misleading or incorrect information. D-verbose Diagnostics: Too much output caused by a single piece of incorrect code. P-high High priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants