Merged
Conversation
Make suggestions verbose.
When encountering `method(type)` bound, suggest `method(..)` instead of `method()`.
```
error: argument types not allowed with return type notation
--> $DIR/bad-inputs-and-output.rs:9:23
|
LL | fn foo<T: Trait<method(i32): Send>>() {}
| ^^^^^
|
help: remove the input types
|
LL - fn foo<T: Trait<method(i32): Send>>() {}
LL + fn foo<T: Trait<method(..): Send>>() {}
|
```
When encountering both return type and arg list that isn't `..`, suggest replacing both.
```
error: return type not allowed with return type notation
--> $DIR/bad-inputs-and-output.rs:12:25
|
LL | fn bar<T: Trait<method() -> (): Send>>() {}
| ^^^^^^
|
help: use the right argument notation and remove the return type
|
LL - fn bar<T: Trait<method() -> (): Send>>() {}
LL + fn bar<T: Trait<method(..): Send>>() {}
|
```
When encountering a return type, suggest removing it including the leading whitespace.
```
error: return type not allowed with return type notation
--> $DIR/bad-inputs-and-output.rs:24:45
|
LL | fn bay_path<T: Trait>() where T::method(..) -> (): Send {}
| ^^^^^
|
help: remove the return type
|
LL - fn bay_path<T: Trait>() where T::method(..) -> (): Send {}
LL + fn bay_path<T: Trait>() where T::method(..): Send {}
|
```
estebank
commented
Feb 28, 2025
Comment on lines
+18
to
+22
| help: remove the input types | ||
| | | ||
| LL - let foo: i32::from_be(num); | ||
| LL + let foo: i32::from_be(..); | ||
| | |
Contributor
Author
There was a problem hiding this comment.
This suggestion is unfortunate, but the error itself shouldn't be emitted in this case, as the previous E0573 should preclude it.
estebank
commented
Feb 28, 2025
| --> $DIR/bad-inputs-and-output.rs:18:40 | ||
| | | ||
| LL | fn foo_path<T: Trait>() where T::method(i32): Send {} | ||
| | ^^^^^ help: remove the input types: `()` |
Contributor
Author
There was a problem hiding this comment.
I do not know why we were suggesting () before. That wasn't correct.
Contributor
There was a problem hiding this comment.
Probably because I forgot to change it when () changed to (..). Lots of different places needed to get modified, so I just forgot one.
Contributor
|
@bors r+ rollup |
Collaborator
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Mar 1, 2025
Tweak invalid RTN errors
Make suggestions verbose.
When encountering `method(type)` bound, suggest `method(..)` instead of `method()`.
```
error: argument types not allowed with return type notation
--> $DIR/bad-inputs-and-output.rs:9:23
|
LL | fn foo<T: Trait<method(i32): Send>>() {}
| ^^^^^
|
help: remove the input types
|
LL - fn foo<T: Trait<method(i32): Send>>() {}
LL + fn foo<T: Trait<method(..): Send>>() {}
|
```
When encountering both return type and arg list that isn't `..`, suggest replacing both.
```
error: return type not allowed with return type notation
--> $DIR/bad-inputs-and-output.rs:12:25
|
LL | fn bar<T: Trait<method() -> (): Send>>() {}
| ^^^^^^
|
help: use the right argument notation and remove the return type
|
LL - fn bar<T: Trait<method() -> (): Send>>() {}
LL + fn bar<T: Trait<method(..): Send>>() {}
|
```
When encountering a return type, suggest removing it including the leading whitespace.
```
error: return type not allowed with return type notation
--> $DIR/bad-inputs-and-output.rs:24:45
|
LL | fn bay_path<T: Trait>() where T::method(..) -> (): Send {}
| ^^^^^
|
help: remove the return type
|
LL - fn bay_path<T: Trait>() where T::method(..) -> (): Send {}
LL + fn bay_path<T: Trait>() where T::method(..): Send {}
|
```
r? `@compiler-errors`
This was referenced Mar 1, 2025
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Mar 1, 2025
…iaskrgr Rollup of 10 pull requests Successful merges: - rust-lang#137804 (rename BackendRepr::Vector → SimdVector) - rust-lang#137807 (Fully qualify `Result` in generated doctest code) - rust-lang#137809 (Use correct error message casing for `io::const_error`s) - rust-lang#137818 (tests: adapt for LLVM 21 changes) - rust-lang#137822 (Update query normalizer docs to not position it as the greatest pioneer in the space of normalization) - rust-lang#137824 (Tweak invalid RTN errors) - rust-lang#137828 (Fix inaccurate `std::intrinsics::simd` documentation) - rust-lang#137830 (Fix link failure on AVR (incompatible ISA error)) - rust-lang#137837 (Update `const_conditions` and `explicit_implied_const_bounds` docs) - rust-lang#137840 (triagebot: only ping me for constck) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Mar 2, 2025
…iaskrgr Rollup of 10 pull requests Successful merges: - rust-lang#137804 (rename BackendRepr::Vector → SimdVector) - rust-lang#137807 (Fully qualify `Result` in generated doctest code) - rust-lang#137809 (Use correct error message casing for `io::const_error`s) - rust-lang#137818 (tests: adapt for LLVM 21 changes) - rust-lang#137822 (Update query normalizer docs to not position it as the greatest pioneer in the space of normalization) - rust-lang#137824 (Tweak invalid RTN errors) - rust-lang#137828 (Fix inaccurate `std::intrinsics::simd` documentation) - rust-lang#137830 (Fix link failure on AVR (incompatible ISA error)) - rust-lang#137837 (Update `const_conditions` and `explicit_implied_const_bounds` docs) - rust-lang#137840 (triagebot: only ping me for constck) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Mar 2, 2025
Rollup merge of rust-lang#137824 - estebank:rtn-sugg, r=compiler-errors Tweak invalid RTN errors Make suggestions verbose. When encountering `method(type)` bound, suggest `method(..)` instead of `method()`. ``` error: argument types not allowed with return type notation --> $DIR/bad-inputs-and-output.rs:9:23 | LL | fn foo<T: Trait<method(i32): Send>>() {} | ^^^^^ | help: remove the input types | LL - fn foo<T: Trait<method(i32): Send>>() {} LL + fn foo<T: Trait<method(..): Send>>() {} | ``` When encountering both return type and arg list that isn't `..`, suggest replacing both. ``` error: return type not allowed with return type notation --> $DIR/bad-inputs-and-output.rs:12:25 | LL | fn bar<T: Trait<method() -> (): Send>>() {} | ^^^^^^ | help: use the right argument notation and remove the return type | LL - fn bar<T: Trait<method() -> (): Send>>() {} LL + fn bar<T: Trait<method(..): Send>>() {} | ``` When encountering a return type, suggest removing it including the leading whitespace. ``` error: return type not allowed with return type notation --> $DIR/bad-inputs-and-output.rs:24:45 | LL | fn bay_path<T: Trait>() where T::method(..) -> (): Send {} | ^^^^^ | help: remove the return type | LL - fn bay_path<T: Trait>() where T::method(..) -> (): Send {} LL + fn bay_path<T: Trait>() where T::method(..): Send {} | ``` r? ``@compiler-errors``
workingjubilee
added a commit
to workingjubilee/rustc
that referenced
this pull request
Mar 4, 2025
…rors
Provide more context on resolve error caused from incorrect RTN
When encountering a resolve E0575 error for an associated method (when a type was expected), see if it could have been an intended return type notation bound.
```
error[E0575]: expected associated type, found associated function `Trait::method`
--> $DIR/bad-inputs-and-output.rs:31:36
|
LL | fn foo_qualified<T: Trait>() where <T as Trait>::method(i32): Send {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^ not a associated type
|
help: you might have meant to use the return type notation syntax
|
LL - fn foo_qualified<T: Trait>() where <T as Trait>::method(i32): Send {}
LL + fn foo_qualified<T: Trait>() where T::method(..): Send {}
|
```
Built on top of rust-lang#137824, only second commit is relevant for review.
r? `@compiler-errors`
workingjubilee
added a commit
to workingjubilee/rustc
that referenced
this pull request
Mar 5, 2025
…rors
Provide more context on resolve error caused from incorrect RTN
When encountering a resolve E0575 error for an associated method (when a type was expected), see if it could have been an intended return type notation bound.
```
error[E0575]: expected associated type, found associated function `Trait::method`
--> $DIR/bad-inputs-and-output.rs:31:36
|
LL | fn foo_qualified<T: Trait>() where <T as Trait>::method(i32): Send {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^ not a associated type
|
help: you might have meant to use the return type notation syntax
|
LL - fn foo_qualified<T: Trait>() where <T as Trait>::method(i32): Send {}
LL + fn foo_qualified<T: Trait>() where T::method(..): Send {}
|
```
Built on top of rust-lang#137824, only second commit is relevant for review.
r? ``@compiler-errors``
workingjubilee
added a commit
to workingjubilee/rustc
that referenced
this pull request
Mar 5, 2025
…rors
Provide more context on resolve error caused from incorrect RTN
When encountering a resolve E0575 error for an associated method (when a type was expected), see if it could have been an intended return type notation bound.
```
error[E0575]: expected associated type, found associated function `Trait::method`
--> $DIR/bad-inputs-and-output.rs:31:36
|
LL | fn foo_qualified<T: Trait>() where <T as Trait>::method(i32): Send {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^ not a associated type
|
help: you might have meant to use the return type notation syntax
|
LL - fn foo_qualified<T: Trait>() where <T as Trait>::method(i32): Send {}
LL + fn foo_qualified<T: Trait>() where T::method(..): Send {}
|
```
Built on top of rust-lang#137824, only second commit is relevant for review.
r? ```@compiler-errors```
jieyouxu
added a commit
to jieyouxu/rust
that referenced
this pull request
Mar 5, 2025
…rors
Provide more context on resolve error caused from incorrect RTN
When encountering a resolve E0575 error for an associated method (when a type was expected), see if it could have been an intended return type notation bound.
```
error[E0575]: expected associated type, found associated function `Trait::method`
--> $DIR/bad-inputs-and-output.rs:31:36
|
LL | fn foo_qualified<T: Trait>() where <T as Trait>::method(i32): Send {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^ not a associated type
|
help: you might have meant to use the return type notation syntax
|
LL - fn foo_qualified<T: Trait>() where <T as Trait>::method(i32): Send {}
LL + fn foo_qualified<T: Trait>() where T::method(..): Send {}
|
```
Built on top of rust-lang#137824, only second commit is relevant for review.
r? ````@compiler-errors````
jieyouxu
added a commit
to jieyouxu/rust
that referenced
this pull request
Mar 5, 2025
…rors
Provide more context on resolve error caused from incorrect RTN
When encountering a resolve E0575 error for an associated method (when a type was expected), see if it could have been an intended return type notation bound.
```
error[E0575]: expected associated type, found associated function `Trait::method`
--> $DIR/bad-inputs-and-output.rs:31:36
|
LL | fn foo_qualified<T: Trait>() where <T as Trait>::method(i32): Send {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^ not a associated type
|
help: you might have meant to use the return type notation syntax
|
LL - fn foo_qualified<T: Trait>() where <T as Trait>::method(i32): Send {}
LL + fn foo_qualified<T: Trait>() where T::method(..): Send {}
|
```
Built on top of rust-lang#137824, only second commit is relevant for review.
r? `````@compiler-errors`````
compiler-errors
added a commit
to compiler-errors/rust
that referenced
this pull request
Mar 6, 2025
…rors
Provide more context on resolve error caused from incorrect RTN
When encountering a resolve E0575 error for an associated method (when a type was expected), see if it could have been an intended return type notation bound.
```
error[E0575]: expected associated type, found associated function `Trait::method`
--> $DIR/bad-inputs-and-output.rs:31:36
|
LL | fn foo_qualified<T: Trait>() where <T as Trait>::method(i32): Send {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^ not a associated type
|
help: you might have meant to use the return type notation syntax
|
LL - fn foo_qualified<T: Trait>() where <T as Trait>::method(i32): Send {}
LL + fn foo_qualified<T: Trait>() where T::method(..): Send {}
|
```
Built on top of rust-lang#137824, only second commit is relevant for review.
r? ``````@compiler-errors``````
Noratrieb
added a commit
to Noratrieb/rust
that referenced
this pull request
Mar 6, 2025
…rors
Provide more context on resolve error caused from incorrect RTN
When encountering a resolve E0575 error for an associated method (when a type was expected), see if it could have been an intended return type notation bound.
```
error[E0575]: expected associated type, found associated function `Trait::method`
--> $DIR/bad-inputs-and-output.rs:31:36
|
LL | fn foo_qualified<T: Trait>() where <T as Trait>::method(i32): Send {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^ not a associated type
|
help: you might have meant to use the return type notation syntax
|
LL - fn foo_qualified<T: Trait>() where <T as Trait>::method(i32): Send {}
LL + fn foo_qualified<T: Trait>() where T::method(..): Send {}
|
```
Built on top of rust-lang#137824, only second commit is relevant for review.
r? ```````@compiler-errors```````
compiler-errors
added a commit
to compiler-errors/rust
that referenced
this pull request
Mar 6, 2025
…rors
Provide more context on resolve error caused from incorrect RTN
When encountering a resolve E0575 error for an associated method (when a type was expected), see if it could have been an intended return type notation bound.
```
error[E0575]: expected associated type, found associated function `Trait::method`
--> $DIR/bad-inputs-and-output.rs:31:36
|
LL | fn foo_qualified<T: Trait>() where <T as Trait>::method(i32): Send {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^ not a associated type
|
help: you might have meant to use the return type notation syntax
|
LL - fn foo_qualified<T: Trait>() where <T as Trait>::method(i32): Send {}
LL + fn foo_qualified<T: Trait>() where T::method(..): Send {}
|
```
Built on top of rust-lang#137824, only second commit is relevant for review.
r? ````````@compiler-errors````````
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Mar 7, 2025
Rollup merge of rust-lang#137825 - estebank:rtn-sugg-2, r=compiler-errors Provide more context on resolve error caused from incorrect RTN When encountering a resolve E0575 error for an associated method (when a type was expected), see if it could have been an intended return type notation bound. ``` error[E0575]: expected associated type, found associated function `Trait::method` --> $DIR/bad-inputs-and-output.rs:31:36 | LL | fn foo_qualified<T: Trait>() where <T as Trait>::method(i32): Send {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ not a associated type | help: you might have meant to use the return type notation syntax | LL - fn foo_qualified<T: Trait>() where <T as Trait>::method(i32): Send {} LL + fn foo_qualified<T: Trait>() where T::method(..): Send {} | ``` Built on top of rust-lang#137824, only second commit is relevant for review. r? ````````@compiler-errors````````
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Make suggestions verbose.
When encountering
method(type)bound, suggestmethod(..)instead ofmethod().When encountering both return type and arg list that isn't
.., suggest replacing both.When encountering a return type, suggest removing it including the leading whitespace.
r? @compiler-errors