revert workaround #73027
This commit is contained in:
parent
71ca239f80
commit
c146e8c54f
@ -91,17 +91,6 @@ fn visit_local(&mut self, local: &'tcx Local<'tcx>) {
|
||||
if let (None, Some(ty)) =
|
||||
(self.found_local_pattern, self.node_ty_contains_target(local.hir_id))
|
||||
{
|
||||
// FIXME: There's a trade-off here - we can either check that our target span
|
||||
// is contained in `local.span` or not. If we choose to check containment
|
||||
// we can avoid some spurious suggestions (see #72690), but we lose
|
||||
// the ability to report on things like:
|
||||
//
|
||||
// ```
|
||||
// let x = vec![];
|
||||
// ```
|
||||
//
|
||||
// because the target span will be in the macro expansion of `vec![]`.
|
||||
// At present we choose not to check containment.
|
||||
self.found_local_pattern = Some(&*local.pat);
|
||||
self.found_node_ty = Some(ty);
|
||||
}
|
||||
@ -113,10 +102,8 @@ fn visit_body(&mut self, body: &'tcx Body<'tcx>) {
|
||||
if let (None, Some(ty)) =
|
||||
(self.found_arg_pattern, self.node_ty_contains_target(param.hir_id))
|
||||
{
|
||||
if self.target_span.contains(param.pat.span) {
|
||||
self.found_arg_pattern = Some(&*param.pat);
|
||||
self.found_node_ty = Some(ty);
|
||||
}
|
||||
self.found_arg_pattern = Some(&*param.pat);
|
||||
self.found_node_ty = Some(ty);
|
||||
}
|
||||
}
|
||||
intravisit::walk_body(self, body);
|
||||
|
@ -1,8 +1,8 @@
|
||||
error[E0282]: type annotations needed
|
||||
--> $DIR/expect-two-infer-vars-supply-ty-with-bound-region.rs:8:5
|
||||
--> $DIR/expect-two-infer-vars-supply-ty-with-bound-region.rs:8:27
|
||||
|
|
||||
LL | with_closure(|x: u32, y| {});
|
||||
| ^^^^^^^^^^^^ cannot infer type for type parameter `B` declared on the function `with_closure`
|
||||
| ^ consider giving this closure parameter a type
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -14,7 +14,7 @@ pub fn let_<'var, VAR, F: for<'v> Fn(Expr<'v, VAR>) -> Expr<'v, VAR>>
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let ex = |x| {
|
||||
let_(add(x,x), |y| { //~ ERROR type annotations needed
|
||||
let ex = |x| { //~ ERROR type annotations needed
|
||||
let_(add(x,x), |y| {
|
||||
let_(add(x, x), |x|x)})};
|
||||
}
|
||||
|
@ -1,13 +1,8 @@
|
||||
error[E0282]: type annotations needed for the closure `fn(Expr<'_, _>) -> Expr<'_, _>`
|
||||
--> $DIR/issue-23046.rs:18:9
|
||||
error[E0282]: type annotations needed for `Expr<'_, VAR>`
|
||||
--> $DIR/issue-23046.rs:17:15
|
||||
|
|
||||
LL | let_(add(x,x), |y| {
|
||||
| ^^^^ cannot infer type for type parameter `VAR` declared on the function `let_`
|
||||
|
|
||||
help: give this closure an explicit return type without `_` placeholders
|
||||
|
|
||||
LL | let_(add(x, x), |x|-> Expr<'_, _> { x })})};
|
||||
| ^^^^^^^^^^^^^^^^ ^
|
||||
LL | let ex = |x| {
|
||||
| ^ consider giving this closure parameter the explicit type `Expr<'_, VAR>`, where the type parameter `VAR` is specified
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user