-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Diagnostic suggests adding : ?Sized
in an incorrect place if a type parameter default is present
#120878
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
D-invalid-suggestion
Diagnostics: A structured suggestion resulting in incorrect code.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
OdenShirataki
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
Feb 10, 2024
Another variant of this error I came up with using stable struct S<A, B = A>(std::marker::PhantomData<(A, B)>);
struct T<A, B: ?Sized>(S<A, B>);
Edit Just tested on stable |
@rustbot claim |
fmease
changed the title
the size for values of type
Diagnostic suggests adding Feb 10, 2024
[u8]
cannot be known at compilation time (with default type parameter in struct): ?Sized
in an incorrect place if a type parameter default is present
fmease
added
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
D-invalid-suggestion
Diagnostics: A structured suggestion resulting in incorrect code.
labels
Feb 10, 2024
This is only tangentially related but just to give more context to anyone stumbling upon this issue: The diagnostic highlighting the entire path |
OdenShirataki
added a commit
to OdenShirataki/rust
that referenced
this issue
Feb 11, 2024
change span.hi if exists default. Diagnostic suggests adding : ?Sized in an incorrect place if a type parameter default is present
OdenShirataki
added a commit
to OdenShirataki/rust
that referenced
this issue
Feb 11, 2024
…default exists. change span.hi if exists default. Diagnostic suggests adding : ?Sized in an incorrect place if a type parameter default is present
OdenShirataki
added a commit
to OdenShirataki/rust
that referenced
this issue
Feb 11, 2024
fix it, Diagnostic suggests adding : ?Sized in an incorrect place if a type parameter default is present fix: rust-lang#120878 Use param.name.indent().span if type parameter default exists. change span.hi if exists default. Diagnostic suggests adding : ?Sized in an incorrect place if a type parameter default is present If there are no bounds, you should always use param.name, so there is no need to branch. add test add test
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
Feb 14, 2024
Rollup merge of rust-lang#120915 - OdenShirataki:master, r=fmease Fix suggestion span for `?Sized` when param type has default Fixes rust-lang#120878 Diagnostic suggests adding `: ?Sized` in an incorrect place if a type parameter default is present r? `@fmease`
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
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
D-invalid-suggestion
Diagnostics: A structured suggestion resulting in incorrect code.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Code
Current output
Desired output
Rationale and extra context
No response
Other cases
No response
Rust Version
Anything else?
No response
The text was updated successfully, but these errors were encountered: