-
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
Diagnostics: help text for missing left-hand side in arbitrary self type #64252
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
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
The output with: impl Foo for Baz {
pub fn hello(Box<Self>) {}
} is:
|
Centril
added
A-diagnostics
Area: Messages for errors, warnings, and lints
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
labels
Sep 7, 2019
Centril
added a commit
to Centril/rust
that referenced
this issue
Oct 1, 2019
syntax: cleanup param, method, and misc parsing Do some misc cleanup of the parser: - Method and parameter parsing is refactored. - A parser for `const | mut` is introduced that rust-lang#64588 can reuse. - Some other misc parsing. Next up in a different PR: - ~Implementing rust-lang#64252 -- maybe some other time... - Heavily restructuring up `item.rs` which is a mess (hopefully, no promises ^^). r? @petrochenkov
Centril
added a commit
to Centril/rust
that referenced
this issue
Oct 1, 2019
syntax: cleanup param, method, and misc parsing Do some misc cleanup of the parser: - Method and parameter parsing is refactored. - A parser for `const | mut` is introduced that rust-lang#64588 can reuse. - Some other misc parsing. Next up in a different PR: - ~Implementing rust-lang#64252 -- maybe some other time... - Heavily restructuring up `item.rs` which is a mess (hopefully, no promises ^^). r? @petrochenkov
Centril
added a commit
to Centril/rust
that referenced
this issue
Oct 1, 2019
syntax: cleanup param, method, and misc parsing Do some misc cleanup of the parser: - Method and parameter parsing is refactored. - A parser for `const | mut` is introduced that rust-lang#64588 can reuse. - Some other misc parsing. Next up in a different PR: - ~Implementing rust-lang#64252 -- maybe some other time... - Heavily restructuring up `item.rs` which is a mess (hopefully, no promises ^^). r? @petrochenkov
Centril
added a commit
to Centril/rust
that referenced
this issue
Oct 1, 2019
syntax: cleanup param, method, and misc parsing Do some misc cleanup of the parser: - Method and parameter parsing is refactored. - A parser for `const | mut` is introduced that rust-lang#64588 can reuse. - Some other misc parsing. Next up in a different PR: - ~Implementing rust-lang#64252 -- maybe some other time... - Heavily restructuring up `item.rs` which is a mess (hopefully, no promises ^^). r? @petrochenkov
tmandry
added a commit
to tmandry/rust
that referenced
this issue
Oct 1, 2019
syntax: cleanup param, method, and misc parsing Do some misc cleanup of the parser: - Method and parameter parsing is refactored. - A parser for `const | mut` is introduced that rust-lang#64588 can reuse. - Some other misc parsing. Next up in a different PR: - ~Implementing rust-lang#64252 -- maybe some other time... - Heavily restructuring up `item.rs` which is a mess (hopefully, no promises ^^). r? @petrochenkov
tmandry
added a commit
to tmandry/rust
that referenced
this issue
Oct 1, 2019
syntax: cleanup param, method, and misc parsing Do some misc cleanup of the parser: - Method and parameter parsing is refactored. - A parser for `const | mut` is introduced that rust-lang#64588 can reuse. - Some other misc parsing. Next up in a different PR: - ~Implementing rust-lang#64252 -- maybe some other time... - Heavily restructuring up `item.rs` which is a mess (hopefully, no promises ^^). r? @petrochenkov
Centril
added a commit
to Centril/rust
that referenced
this issue
Oct 1, 2019
syntax: cleanup param, method, and misc parsing Do some misc cleanup of the parser: - Method and parameter parsing is refactored. - A parser for `const | mut` is introduced that rust-lang#64588 can reuse. - Some other misc parsing. Next up in a different PR: - ~Implementing rust-lang#64252 -- maybe some other time... - Heavily restructuring up `item.rs` which is a mess (hopefully, no promises ^^). r? @petrochenkov
Centril
added a commit
to Centril/rust
that referenced
this issue
Oct 1, 2019
syntax: cleanup param, method, and misc parsing Do some misc cleanup of the parser: - Method and parameter parsing is refactored. - A parser for `const | mut` is introduced that rust-lang#64588 can reuse. - Some other misc parsing. Next up in a different PR: - ~Implementing rust-lang#64252 -- maybe some other time... - Heavily restructuring up `item.rs` which is a mess (hopefully, no promises ^^). r? @petrochenkov
Manishearth
added a commit
to Manishearth/rust
that referenced
this issue
Oct 2, 2019
…p, r=Centril,estebank syntax: improve parameter without type suggestions Fixes rust-lang#64252. This PR improves the suggestions provided when function parameters do not have types: - A new suggestion is added for arbitrary self types, which suggests adding `self: ` before the type. - Existing suggestions are now provided when a `<` is found where a `:` was expected (previously only `,` and `)` or trait items), this gives suggestions in the case where the unnamed parameter type is generic in a free function. - The suggestion that a type name be provided (e.g. `fn foo(HashMap<u32>)` -> `fn foo(HashMap: TypeName<u32>)`) will no longer occur when a `<` was found instead of `:`. - The ident will not be used for recovery when a `<` was found instead of `:`. r? @Centril cc @estebank @yoshuawuyts
Centril
added a commit
to Centril/rust
that referenced
this issue
Oct 2, 2019
…p, r=Centril,estebank syntax: improve parameter without type suggestions Fixes rust-lang#64252. This PR improves the suggestions provided when function parameters do not have types: - A new suggestion is added for arbitrary self types, which suggests adding `self: ` before the type. - Existing suggestions are now provided when a `<` is found where a `:` was expected (previously only `,` and `)` or trait items), this gives suggestions in the case where the unnamed parameter type is generic in a free function. - The suggestion that a type name be provided (e.g. `fn foo(HashMap<u32>)` -> `fn foo(HashMap: TypeName<u32>)`) will no longer occur when a `<` was found instead of `:`. - The ident will not be used for recovery when a `<` was found instead of `:`. r? @Centril cc @estebank @yoshuawuyts
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`
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.
Forgetting to include the left-hand side of an arbitrary self type can give some confusing errors. This was reported by someone trying to implement a future manually, and the diagnostics threw them off.
I realize diagnostics for arbitrary self types are an open issue, but figured I'd include this variant as to not overlook it. Thanks!
Link to playground
Code
Expected
Current
The text was updated successfully, but these errors were encountered: