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

Error for calling non-existant enum constructor regression. #37992

Closed
tbelaire opened this issue Nov 25, 2016 · 0 comments
Closed

Error for calling non-existant enum constructor regression. #37992

tbelaire opened this issue Nov 25, 2016 · 0 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@tbelaire
Copy link
Contributor

https://is.gd/Z7Xp3U
This code is giving much worse error message on nightly than on stable.

#[derive(Debug)]
enum Shape {
  Square { size: i32 },
  Circle { radius: i32 },
}


fn main() {
    println!("My shapre is {:?}", Shape::Squareee{ size: 5});
}

Nightly error message:

rustc 1.15.0-nightly (3bf2be9ce 2016-11-22)
error[E0223]: ambiguous associated type
  --> <anon>:10:35
   |
10 |     println!("My shapre is {:?}", Shape::Squareee{ size: 5});
   |                                   ^^^^^^^^^^^^^^ ambiguous associated type
   |
   = note: specify the type using the syntax `<Shape as Trait>::Squareee`

error: aborting due to previous error

Stable error message:

rustc 1.13.0 (2c6933acc 2016-11-07)
error[E0422]: `Shape::Squaree` does not name a structure
  --> <anon>:10:35
   |
10 |     println!("My shapre is {:?}", Shape::Squaree{ size: 5});
   |                                   ^^^^^^^^^^^^^^ not a structure

error: aborting due to previous error

The new error message is much less helpful

@sfackler sfackler added the A-diagnostics Area: Messages for errors, warnings, and lints label Nov 25, 2016
@steveklabnik steveklabnik added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Mar 9, 2017
@Mark-Simulacrum Mark-Simulacrum added the C-enhancement Category: An issue proposing an enhancement or a PR with one. label Jul 26, 2017
pietroalbini added a commit to pietroalbini/rust that referenced this issue Nov 25, 2018
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-enhancement Category: An issue proposing an enhancement or a PR with one. 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

4 participants