Point at type parameter in plain path expr
This commit is contained in:
parent
a2cdcb3fea
commit
3b3c7063c2
@ -1780,6 +1780,7 @@ fn adjust_fulfillment_error_for_expr_obligation(
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Notably, we only point to params that are local to the
|
// Notably, we only point to params that are local to the
|
||||||
// item we're checking, since those are the ones we are able
|
// item we're checking, since those are the ones we are able
|
||||||
// to look in the final `hir::PathSegment` for. Everything else
|
// to look in the final `hir::PathSegment` for. Everything else
|
||||||
@ -1791,7 +1792,6 @@ fn adjust_fulfillment_error_for_expr_obligation(
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
hir::ExprKind::MethodCall(segment, args, ..) => {
|
hir::ExprKind::MethodCall(segment, args, ..) => {
|
||||||
for param in [param_to_point_at, fallback_param_to_point_at, self_param_to_point_at]
|
for param in [param_to_point_at, fallback_param_to_point_at, self_param_to_point_at]
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
6
src/test/ui/typeck/point-at-type-param-in-path-expr.rs
Normal file
6
src/test/ui/typeck/point-at-type-param-in-path-expr.rs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
fn foo<T: std::fmt::Display>() {}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let x = foo::<()>;
|
||||||
|
//~^ ERROR `()` doesn't implement `std::fmt::Display`
|
||||||
|
}
|
17
src/test/ui/typeck/point-at-type-param-in-path-expr.stderr
Normal file
17
src/test/ui/typeck/point-at-type-param-in-path-expr.stderr
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
error[E0277]: `()` doesn't implement `std::fmt::Display`
|
||||||
|
--> $DIR/point-at-type-param-in-path-expr.rs:4:19
|
||||||
|
|
|
||||||
|
LL | let x = foo::<()>;
|
||||||
|
| ^^ `()` cannot be formatted with the default formatter
|
||||||
|
|
|
||||||
|
= help: the trait `std::fmt::Display` is not implemented for `()`
|
||||||
|
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||||
|
note: required by a bound in `foo`
|
||||||
|
--> $DIR/point-at-type-param-in-path-expr.rs:1:11
|
||||||
|
|
|
||||||
|
LL | fn foo<T: std::fmt::Display>() {}
|
||||||
|
| ^^^^^^^^^^^^^^^^^ required by this bound in `foo`
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0277`.
|
Loading…
Reference in New Issue
Block a user