-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Tweak invalid RTN errors #137824
Tweak invalid RTN errors #137824
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 {} | ```
help: remove the input types | ||
| | ||
LL - let foo: i32::from_be(num); | ||
LL + let foo: i32::from_be(..); | ||
| |
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.
This suggestion is unfortunate, but the error itself shouldn't be emitted in this case, as the previous E0573 should preclude it.
|
||
error: argument types not allowed with return type notation | ||
--> $DIR/bad-inputs-and-output.rs:18:40 | ||
| | ||
LL | fn foo_path<T: Trait>() where T::method(i32): Send {} | ||
| ^^^^^ help: remove the input types: `()` |
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.
I do not know why we were suggesting ()
before. That wasn't correct.
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.
Probably because I forgot to change it when ()
changed to (..)
. Lots of different places needed to get modified, so I just forgot one.
@bors r+ rollup |
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`
…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
…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
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``
…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`
…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``
…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```
…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````
…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`````
…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``````
…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```````
…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````````
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````````
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