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

Create better help text for impl A for B where B: A {} #105052

Open
HintringerFabian opened this issue Nov 29, 2022 · 1 comment
Open

Create better help text for impl A for B where B: A {} #105052

HintringerFabian opened this issue Nov 29, 2022 · 1 comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@HintringerFabian
Copy link
Contributor

Given the following code:

trait A {}
struct B;

//impl A for B where B: A {}
impl A for B where B: A {}

fn main() {
    let a: &dyn A = &B;
}

The stable (1.65.0) output is:

Compiling playground v0.0.1 (/playground)
error[[E0275]](https://doc.rust-lang.org/stable/error-index.html#E0275): overflow evaluating the requirement `B: A`
 --> src/main.rs:5:20
  |
5 | impl A for B where B: A {}
  |                    ^^^^
  |
  = help: see issue #48214

For more information about this error, try `rustc --explain E0275`.
error: could not compile `playground` due to previous error

The nightly (1.67.0 2022-11-28) output is:

Compiling playground v0.0.1 (/playground)
error[[E0275]](https://doc.rust-lang.org/nightly/error-index.html#E0275): overflow evaluating the requirement `B: A`
 --> src/main.rs:5:20
  |
5 | impl A for B where B: A {}
  |                    ^^^^
  |
  = help: see issue #48214
  = help: [add `#![feature(trivial_bounds)]`](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#) to the crate attributes to enable

For more information about this error, try `rustc --explain E0275`.
error: could not compile `playground` due to previous error

Ideally the output should look like:

  |
5 | impl A for B where B: A {}
  |                    ^^^^ Some helpful text here

I think there could be some sort of text explaining what can be done


I have found this when looking through the issue #105048

@HintringerFabian HintringerFabian added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 29, 2022
@lyming2007
Copy link

lyming2007 commented Dec 2, 2022

I'm still wondering what "Some helpful text here" should be in the suggestion

  |
5 | impl A for B where B: A {}
  |                    ^^^^ Some helpful text here

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 T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants