diff --git a/compiler/rustc_infer/src/infer/mod.rs b/compiler/rustc_infer/src/infer/mod.rs index 9a83f34f63b8f..0cdfe53c1a446 100644 --- a/compiler/rustc_infer/src/infer/mod.rs +++ b/compiler/rustc_infer/src/infer/mod.rs @@ -1013,7 +1013,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { let r_b = self.shallow_resolve(predicate.skip_binder().b); match (r_a.kind(), r_b.kind()) { (&ty::Infer(ty::TyVar(a_vid)), &ty::Infer(ty::TyVar(b_vid))) => { - self.inner.borrow_mut().type_variables().sub(a_vid, b_vid); + //self.inner.borrow_mut().type_variables().sub(a_vid, b_vid); return None; } _ => {} diff --git a/src/test/ui/const-generics/occurs-check/unused-substs-5.stderr b/src/test/ui/const-generics/occurs-check/unused-substs-5.stderr index be289f44f1b65..2ed83b330067a 100644 --- a/src/test/ui/const-generics/occurs-check/unused-substs-5.stderr +++ b/src/test/ui/const-generics/occurs-check/unused-substs-5.stderr @@ -1,10 +1,8 @@ error[E0308]: mismatched types - --> $DIR/unused-substs-5.rs:15:9 + --> $DIR/unused-substs-5.rs:15:19 | LL | x = q::<_, N>(x); - | ^^^^^^^^^^^^- help: try using a conversion method: `.to_vec()` - | | - | cyclic type of infinite size + | ^ cyclic type of infinite size error: aborting due to previous error diff --git a/src/test/ui/inference/cannot-infer-closure-circular.stderr b/src/test/ui/inference/cannot-infer-closure-circular.stderr index a6ddb7ae908fc..26dce5a599ba8 100644 --- a/src/test/ui/inference/cannot-infer-closure-circular.stderr +++ b/src/test/ui/inference/cannot-infer-closure-circular.stderr @@ -1,8 +1,13 @@ -error[E0282]: type annotations needed for `Result<(), E>` - --> $DIR/cannot-infer-closure-circular.rs:7:14 +error[E0282]: type annotations needed for the closure `fn(Result<(), _>) -> Result<(), _>` + --> $DIR/cannot-infer-closure-circular.rs:10:9 | -LL | let x = |r| { - | ^ consider giving this closure parameter the explicit type `Result<(), E>`, where the type parameter `E` is specified +LL | Ok(v) + | ^^ cannot infer type for type parameter `E` declared on the enum `Result` + | +help: give this closure an explicit return type without `_` placeholders + | +LL | let x = |r| -> Result<(), _> { + | ++++++++++++++++ error: aborting due to previous error diff --git a/src/test/ui/inference/issue-71732.stderr b/src/test/ui/inference/issue-71732.stderr index 17fad571385dc..7cb3440f5c49e 100644 --- a/src/test/ui/inference/issue-71732.stderr +++ b/src/test/ui/inference/issue-71732.stderr @@ -2,9 +2,7 @@ error[E0283]: type annotations needed --> $DIR/issue-71732.rs:18:10 | LL | .get(&"key".into()) - | ^^^ ------------ this method call resolves to `T` - | | - | cannot infer type for type parameter `Q` declared on the associated function `get` + | ^^^ cannot infer type for type parameter `Q` declared on the associated function `get` | = note: cannot satisfy `String: Borrow<_>` diff --git a/src/test/ui/inference/issue-72616.stderr b/src/test/ui/inference/issue-72616.stderr index 3c9d864c42639..bbf1d852681f7 100644 --- a/src/test/ui/inference/issue-72616.stderr +++ b/src/test/ui/inference/issue-72616.stderr @@ -2,9 +2,7 @@ error[E0283]: type annotations needed --> $DIR/issue-72616.rs:20:30 | LL | if String::from("a") == "a".try_into().unwrap() {} - | ^^ -------------- this method call resolves to `Result>::Error>` - | | - | cannot infer type + | ^^ cannot infer type | = note: cannot satisfy `String: PartialEq<_>` diff --git a/src/test/ui/issues/issue-51116.stderr b/src/test/ui/issues/issue-51116.stderr index 8501ae6a1d029..f1bed60797bcd 100644 --- a/src/test/ui/issues/issue-51116.stderr +++ b/src/test/ui/issues/issue-51116.stderr @@ -2,7 +2,7 @@ error[E0282]: type annotations needed --> $DIR/issue-51116.rs:6:13 | LL | for tile in row { - | --- the element type for this iterator is not specified + | ---- consider giving `tile` a type LL | LL | *tile = 0; | ^^^^^ cannot infer type diff --git a/src/test/ui/issues/issue-57843.nll.stderr b/src/test/ui/issues/issue-57843.nll.stderr deleted file mode 100644 index 2ab49ec61cf59..0000000000000 --- a/src/test/ui/issues/issue-57843.nll.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: implementation of `FnOnce` is not general enough - --> $DIR/issue-57843.rs:25:9 - | -LL | Foo(Box::new(|_| ())); - | ^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough - | - = note: closure with signature `fn(&'2 bool)` must implement `FnOnce<(&'1 bool,)>`, for any lifetime `'1`... - = note: ...but it actually implements `FnOnce<(&'2 bool,)>`, for some specific lifetime `'2` - -error: aborting due to previous error - diff --git a/src/test/ui/issues/issue-59494.stderr b/src/test/ui/issues/issue-59494.stderr index 90af47dfa7911..02804c2b9eace 100644 --- a/src/test/ui/issues/issue-59494.stderr +++ b/src/test/ui/issues/issue-59494.stderr @@ -1,16 +1,9 @@ -error[E0277]: expected a `Fn<(_,)>` closure, found `impl Fn<(((_, _), _),)>` - --> $DIR/issue-59494.rs:21:22 +error[E0308]: mismatched types + --> $DIR/issue-59494.rs:20:40 | -LL | let t8 = t8n(t7, t7p(f, g)); - | ^^^^^^^^^ expected an `Fn<(_,)>` closure, found `impl Fn<(((_, _), _),)>` - | - = help: the trait `Fn<(_,)>` is not implemented for `impl Fn<(((_, _), _),)>` -note: required by a bound in `t8n` - --> $DIR/issue-59494.rs:5:45 - | -LL | fn t8n(f: impl Fn(A) -> B, g: impl Fn(A) -> C) -> impl Fn(A) -> (B, C) - | ^^^^^^^^^^ required by this bound in `t8n` +LL | let t7 = |env| |a| |b| t7p(f, g)(((env, a), b)); + | ^^^ cyclic type of infinite size error: aborting due to previous error -For more information about this error, try `rustc --explain E0277`. +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/occurs-check-2.stderr b/src/test/ui/occurs-check-2.stderr index c004043307899..71776b844d845 100644 --- a/src/test/ui/occurs-check-2.stderr +++ b/src/test/ui/occurs-check-2.stderr @@ -1,13 +1,8 @@ error[E0308]: mismatched types - --> $DIR/occurs-check-2.rs:7:9 + --> $DIR/occurs-check-2.rs:6:9 | -LL | f = box g; - | ^^^^^ cyclic type of infinite size - | -help: try using a conversion method - | -LL | f = (box g).to_string(); - | + +++++++++++++ +LL | g = f; + | ^ cyclic type of infinite size error: aborting due to previous error diff --git a/src/test/ui/occurs-check-3.stderr b/src/test/ui/occurs-check-3.stderr index 04c404d543a95..cdb5df099f219 100644 --- a/src/test/ui/occurs-check-3.stderr +++ b/src/test/ui/occurs-check-3.stderr @@ -1,8 +1,8 @@ error[E0308]: mismatched types - --> $DIR/occurs-check-3.rs:4:24 + --> $DIR/occurs-check-3.rs:4:32 | LL | fn main() { let c; c = Clam::A(c); match c { Clam::A::(_) => { } } } - | ^^^^^^^^^^ cyclic type of infinite size + | ^ cyclic type of infinite size error: aborting due to previous error diff --git a/src/test/ui/pattern/pat-tuple-bad-type.stderr b/src/test/ui/pattern/pat-tuple-bad-type.stderr index 598b6a3794ef7..5d44cea58c41b 100644 --- a/src/test/ui/pattern/pat-tuple-bad-type.stderr +++ b/src/test/ui/pattern/pat-tuple-bad-type.stderr @@ -1,9 +1,6 @@ error[E0282]: type annotations needed --> $DIR/pat-tuple-bad-type.rs:5:9 | -LL | let x; - | - consider giving `x` a type -... LL | (..) => {} | ^^^^ cannot infer type | diff --git a/src/test/ui/question-mark-type-infer.stderr b/src/test/ui/question-mark-type-infer.stderr index 86c533d7a59c9..6ce456da463dd 100644 --- a/src/test/ui/question-mark-type-infer.stderr +++ b/src/test/ui/question-mark-type-infer.stderr @@ -1,14 +1,10 @@ error[E0284]: type annotations needed - --> $DIR/question-mark-type-infer.rs:12:21 + --> $DIR/question-mark-type-infer.rs:12:5 | LL | l.iter().map(f).collect()? - | ^^^^^^^ cannot infer type + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type | = note: cannot satisfy `<_ as Try>::Residual == _` -help: consider specifying the type argument in the method call - | -LL | l.iter().map(f).collect::()? - | +++++ error: aborting due to previous error diff --git a/src/test/ui/span/issue-42234-unknown-receiver-type.full.stderr b/src/test/ui/span/issue-42234-unknown-receiver-type.full.stderr index 278d049224401..7c6d569b4942b 100644 --- a/src/test/ui/span/issue-42234-unknown-receiver-type.full.stderr +++ b/src/test/ui/span/issue-42234-unknown-receiver-type.full.stderr @@ -1,10 +1,11 @@ -error[E0282]: type annotations needed for `Option<_>` +error[E0282]: type annotations needed --> $DIR/issue-42234-unknown-receiver-type.rs:10:7 | -LL | let x: Option<_> = None; - | - consider giving `x` the explicit type `Option<_>`, where the type parameter `T` is specified LL | x.unwrap().method_that_could_exist_on_some_type(); - | ^^^^^^ cannot infer type for type parameter `T` + | --^^^^^^-- + | | | + | | cannot infer type for type parameter `T` + | this method call resolves to `T` | = note: type must be known at this point diff --git a/src/test/ui/span/issue-42234-unknown-receiver-type.generic_arg.stderr b/src/test/ui/span/issue-42234-unknown-receiver-type.generic_arg.stderr index 8d4ed4aea6a6c..3c41e949c385d 100644 --- a/src/test/ui/span/issue-42234-unknown-receiver-type.generic_arg.stderr +++ b/src/test/ui/span/issue-42234-unknown-receiver-type.generic_arg.stderr @@ -1,10 +1,11 @@ -error[E0282]: type annotations needed for `Option<_>` +error[E0282]: type annotations needed --> $DIR/issue-42234-unknown-receiver-type.rs:10:7 | -LL | let x: Option<_> = None; - | - consider giving `x` the explicit type `Option<_>`, where the type parameter `T` is specified LL | x.unwrap().method_that_could_exist_on_some_type(); - | ^^^^^^ cannot infer type for type parameter `T` + | --^^^^^^-- + | | | + | | cannot infer type for type parameter `T` + | this method call resolves to `T` | = note: type must be known at this point diff --git a/src/test/ui/traits/issue-77982.stderr b/src/test/ui/traits/issue-77982.stderr index 68347207bda45..faf2455053652 100644 --- a/src/test/ui/traits/issue-77982.stderr +++ b/src/test/ui/traits/issue-77982.stderr @@ -2,9 +2,7 @@ error[E0283]: type annotations needed --> $DIR/issue-77982.rs:8:10 | LL | opts.get(opt.as_ref()); - | ^^^ ------------ this method call resolves to `&T` - | | - | cannot infer type for type parameter `Q` declared on the associated function `get` + | ^^^ cannot infer type for type parameter `Q` declared on the associated function `get` | = note: cannot satisfy `String: Borrow<_>` @@ -12,9 +10,7 @@ error[E0283]: type annotations needed --> $DIR/issue-77982.rs:12:44 | LL | let ips: Vec<_> = (0..100_000).map(|_| u32::from(0u32.into())).collect(); - | ^^^^^^^^^ ----------- this method call resolves to `T` - | | - | cannot infer type for type parameter `T` declared on the trait `From` + | ^^^^^^^^^ cannot infer type for type parameter `T` declared on the trait `From` | = note: cannot satisfy `u32: From<_>` note: required by `from` diff --git a/src/test/ui/type-inference/sort_by_key.stderr b/src/test/ui/type-inference/sort_by_key.stderr index 78b7386c03e1f..14ce6dc22c8c2 100644 --- a/src/test/ui/type-inference/sort_by_key.stderr +++ b/src/test/ui/type-inference/sort_by_key.stderr @@ -3,11 +3,6 @@ error[E0282]: type annotations needed | LL | lst.sort_by_key(|&(v, _)| v.iter().sum()); | ^^^^^^^^^^^ cannot infer type for type parameter `K` declared on the associated function `sort_by_key` - | -help: consider specifying the type argument in the method call - | -LL | lst.sort_by_key(|&(v, _)| v.iter().sum::()); - | +++++ error: aborting due to previous error