Skip to content

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

Closed
@tbelaire

Description

@tbelaire

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions