Skip to content

Commit

Permalink
try comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-Simulacrum committed Aug 19, 2021
1 parent 01decf3 commit acd7444
Show file tree
Hide file tree
Showing 16 changed files with 39 additions and 77 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_infer/src/infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
_ => {}
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Expand Down
13 changes: 9 additions & 4 deletions src/test/ui/inference/cannot-infer-closure-circular.stderr
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 1 addition & 3 deletions src/test/ui/inference/issue-71732.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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<_>`

Expand Down
4 changes: 1 addition & 3 deletions src/test/ui/inference/issue-72616.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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<T, <Self as TryInto<T>>::Error>`
| |
| cannot infer type
| ^^ cannot infer type
|
= note: cannot satisfy `String: PartialEq<_>`

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/issues/issue-51116.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 0 additions & 11 deletions src/test/ui/issues/issue-57843.nll.stderr

This file was deleted.

17 changes: 5 additions & 12 deletions src/test/ui/issues/issue-59494.stderr
Original file line number Diff line number Diff line change
@@ -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<A, B, C>(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`.
11 changes: 3 additions & 8 deletions src/test/ui/occurs-check-2.stderr
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/occurs-check-3.stderr
Original file line number Diff line number Diff line change
@@ -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::<isize>(_) => { } } }
| ^^^^^^^^^^ cyclic type of infinite size
| ^ cyclic type of infinite size

error: aborting due to previous error

Expand Down
3 changes: 0 additions & 3 deletions src/test/ui/pattern/pat-tuple-bad-type.stderr
Original file line number Diff line number Diff line change
@@ -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
|
Expand Down
8 changes: 2 additions & 6 deletions src/test/ui/question-mark-type-infer.stderr
Original file line number Diff line number Diff line change
@@ -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::<B>()?
| +++++

error: aborting due to previous error

Expand Down
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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

Expand Down
8 changes: 2 additions & 6 deletions src/test/ui/traits/issue-77982.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,15 @@ 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<_>`

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`
Expand Down
5 changes: 0 additions & 5 deletions src/test/ui/type-inference/sort_by_key.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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::<S>());
| +++++

error: aborting due to previous error

Expand Down

0 comments on commit acd7444

Please sign in to comment.