-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
librustc: Check structure constructors against their types. #15938
librustc: Check structure constructors against their types. #15938
Conversation
/// parameters. | ||
/// | ||
/// If the path has no type parameters and the corresponding type has no | ||
/// type parameters, `None` is returned. If the path has type parameters and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First sentence here, I assume you mean "and the corresponding type has no type parameters".
@kballard Fixed. |
path.span, | ||
format!("structure constructor specifies a \ | ||
structure of type `{}`, but this \ | ||
structure has type `{}`: {}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we use the full word "structure" in other errors, instead of "struct"? Similarly, do we have precedent for the phrase "structure constructor"? My inclination is to call it a "struct literal".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we use "structure" in other errors.
I realized this doesn't handle some edge cases. Going to rework a bit. |
Just yesterday I was wondering if |
I assume this closes #9620 too. |
re-r? @huonw |
x: 3i, | ||
y: 4i, | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Travis says this line has trailing whitespace.
This breaks code like: struct Point<T> { x: T, y: T, } let pt = Point::<bool> { x: 1, y: 2, }; Change this code to not contain a type error. For example: let pt = Point::<int> { x: 1, y: 2, }; Closes rust-lang#9620. Closes rust-lang#15875. [breaking-change]
@huonw Fixed. |
…over, r=Veykril feat: add hover display for trait assoc items This PR enable preview assoc items when hover on `trait`  inspired by rust-lang/rust-analyzer#15847
This breaks code like:
Change this code to not contain a type error. For example:
Closes #15875.
[breaking-change]
r? @huonw