-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Underscore-named parameter makes hint point at invalid token #66802
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
Comments
Interesting enough: Before 1.15 |
@Patryk27 If you still want to look into this problem you may find this diff helpful: diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs
index 96d42dd73b1..0e021d658aa 100644
--- a/src/librustc/traits/error_reporting.rs
+++ b/src/librustc/traits/error_reporting.rs
@@ -1176,7 +1176,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
// `fn foo<T>(t: T) where T: Debug {}` →
// `fn foo<T>(t: T) where T: Debug, T: Trait {}`
err.span_suggestion(
- generics.where_clause.span().unwrap().shrink_to_hi(),
+ generics.where_clause.predicates, // TODO: fixme
&format!(
"consider further restricting type parameter `{}`",
param_name,
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs
index 9107e993311..83a90e64eb1 100644
--- a/src/librustc_typeck/check/mod.rs
+++ b/src/librustc_typeck/check/mod.rs
@@ -1229,7 +1229,7 @@ fn check_fn<'a, 'tcx>(
// for simple cases like `fn foo(x: Trait)`,
// where we would error once on the parameter as a whole, and once on the binding `x`.
if param.pat.simple_ident().is_none() && !fcx.tcx.features().unsized_locals {
- fcx.require_type_is_sized(param_ty, decl.output.span(), traits::SizedArgumentType);
+ fcx.require_type_is_sized(param_ty, param.pat.span, traits::SizedArgumentType);
}
fcx.write_ty(param.hir_id, param_ty); I've changed the
as far for the HELP message in I'm not sure if these changes don't break other tests so be sure to run whole suite. |
Great - thanks! :-) |
Hi,
I've got following code:
... that returns:
(playground)
In both cases the tip points at the very next token after the parameter list, instead of the underscore. Additionally, the
foo2
's help message (consider further restricting ...
) has broken formatting.I'd like to fix this myself, if only you'd give me a hint where to look :-)
Thanks;
The text was updated successfully, but these errors were encountered: