Rollup merge of #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 #137824, only second commit is relevant for review. r? ````````@compiler-errors````````
This commit is contained in:
commit
484d8dd5b4
7 changed files with 123 additions and 17 deletions
|
@ -928,7 +928,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
|||
if let Some(first_char) = constraint.ident.as_str().chars().next()
|
||||
&& first_char.is_ascii_lowercase()
|
||||
{
|
||||
tracing::info!(?data, ?data.inputs);
|
||||
let err = match (&data.inputs[..], &data.output) {
|
||||
([_, ..], FnRetTy::Default(_)) => {
|
||||
errors::BadReturnTypeNotation::Inputs { span: data.inputs_span }
|
||||
|
|
|
@ -268,7 +268,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
|||
}
|
||||
GenericArgs::Parenthesized(data) => match generic_args_mode {
|
||||
GenericArgsMode::ReturnTypeNotation => {
|
||||
tracing::info!(?data, ?data.inputs);
|
||||
let err = match (&data.inputs[..], &data.output) {
|
||||
([_, ..], FnRetTy::Default(_)) => {
|
||||
BadReturnTypeNotation::Inputs { span: data.inputs_span }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue