Skip to content

Commit ca0105b

Browse files
Show source of ambiguity in a few more places
1 parent f44ae98 commit ca0105b

15 files changed

+35
-20
lines changed

compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2020,7 +2020,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> {
20202020
subst,
20212021
impl_candidates,
20222022
ErrorCode::E0283,
2023-
false,
2023+
true,
20242024
);
20252025

20262026
let obligation = Obligation::new(
@@ -2132,7 +2132,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> {
21322132
a.into(),
21332133
vec![],
21342134
ErrorCode::E0282,
2135-
false,
2135+
true,
21362136
)
21372137
}
21382138
ty::PredicateKind::Projection(data) => {
@@ -2149,7 +2149,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> {
21492149
self_ty.into(),
21502150
vec![],
21512151
ErrorCode::E0284,
2152-
false,
2152+
true,
21532153
);
21542154
err.note(&format!("cannot satisfy `{}`", predicate));
21552155
err

src/test/ui/const-generics/generic_arg_infer/issue-91614.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0283]: type annotations needed for `Mask<_, LANES>`
22
--> $DIR/issue-91614.rs:6:9
33
|
44
LL | let y = Mask::<_, _>::splat(false);
5-
| ^
5+
| ^ ------------------- type must be known at this point
66
|
77
= note: cannot satisfy `_: MaskElement`
88
note: required by a bound in `Mask::<T, LANES>::splat`

src/test/ui/inference/cannot-infer-partial-try-return.stderr

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ error[E0282]: type annotations needed for `Result<(), QualifiedError<_>>`
33
|
44
LL | let x = || -> Result<_, QualifiedError<_>> {
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
LL |
7+
LL | infallible()?;
8+
| ------------- type must be known at this point
69
|
710
help: try giving this closure an explicit return type
811
|

src/test/ui/inference/erase-type-params-in-label.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0283]: type annotations needed for `Foo<i32, &str, W, Z>`
22
--> $DIR/erase-type-params-in-label.rs:2:9
33
|
44
LL | let foo = foo(1, "");
5-
| ^^^
5+
| ^^^ --- type must be known at this point
66
|
77
= note: cannot satisfy `_: Default`
88
note: required by a bound in `foo`
@@ -23,7 +23,7 @@ error[E0283]: type annotations needed for `Bar<i32, &str, Z>`
2323
--> $DIR/erase-type-params-in-label.rs:5:9
2424
|
2525
LL | let bar = bar(1, "");
26-
| ^^^
26+
| ^^^ --- type must be known at this point
2727
|
2828
= note: cannot satisfy `_: Default`
2929
note: required by a bound in `bar`

src/test/ui/inference/issue-72616.stderr

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ error[E0283]: type annotations needed
22
--> $DIR/issue-72616.rs:20:37
33
|
44
LL | if String::from("a") == "a".try_into().unwrap() {}
5-
| ^^^^^^^^
5+
| -- ^^^^^^^^
6+
| |
7+
| type must be known at this point
68
|
79
= note: multiple `impl`s satisfying `String: PartialEq<_>` found in the `alloc` crate:
810
- impl PartialEq for String;

src/test/ui/inference/issue-72690.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ error[E0283]: type annotations needed for `&T`
5555
--> $DIR/issue-72690.rs:17:9
5656
|
5757
LL | let _ = "x".as_ref();
58-
| ^
58+
| ^ ------ type must be known at this point
5959
|
6060
= note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`:
6161
- impl AsRef<OsStr> for str;

src/test/ui/inference/issue-86162-1.stderr

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ error[E0283]: type annotations needed
22
--> $DIR/issue-86162-1.rs:7:9
33
|
44
LL | foo(gen()); //<- Do not suggest `foo::<impl Clone>()`!
5-
| ^^^ cannot infer type of the type parameter `T` declared on the function `gen`
5+
| --- ^^^ cannot infer type of the type parameter `T` declared on the function `gen`
6+
| |
7+
| type must be known at this point
68
|
79
= note: cannot satisfy `_: Clone`
810
note: required by a bound in `foo`

src/test/ui/inference/issue-86162-2.stderr

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ error[E0283]: type annotations needed
22
--> $DIR/issue-86162-2.rs:12:14
33
|
44
LL | Foo::bar(gen()); //<- Do not suggest `Foo::bar::<impl Clone>()`!
5-
| ^^^ cannot infer type of the type parameter `T` declared on the function `gen`
5+
| -------- ^^^ cannot infer type of the type parameter `T` declared on the function `gen`
6+
| |
7+
| type must be known at this point
68
|
79
= note: cannot satisfy `_: Clone`
810
note: required by a bound in `Foo::bar`

src/test/ui/issues/issue-69455.stderr

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ error[E0283]: type annotations needed
1414
--> $DIR/issue-69455.rs:29:41
1515
|
1616
LL | println!("{}", 23u64.test(xs.iter().sum()));
17-
| ^^^ cannot infer type of the type parameter `S` declared on the associated function `sum`
17+
| ---- ^^^ cannot infer type of the type parameter `S` declared on the associated function `sum`
18+
| |
19+
| type must be known at this point
1820
|
1921
note: multiple `impl`s satisfying `u64: Test<_>` found
2022
--> $DIR/issue-69455.rs:11:1

src/test/ui/issues/issue-7813.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0282]: type annotations needed for `&[_; 0]`
22
--> $DIR/issue-7813.rs:2:9
33
|
44
LL | let v = &[];
5-
| ^
5+
| ^ --- type must be known at this point
66
|
77
help: consider giving `v` an explicit type, where the placeholders `_` are specified
88
|

0 commit comments

Comments
 (0)