summaryrefslogtreecommitdiffstats
path: root/tests/ui/traits
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/traits')
-rw-r--r--tests/ui/traits/alias/object-fail.stderr2
-rw-r--r--tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.rs43
-rw-r--r--tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr109
-rw-r--r--tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.rs2
-rw-r--r--tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.stderr4
-rw-r--r--tests/ui/traits/associated_type_bound/impl-is-shadowed.rs21
-rw-r--r--tests/ui/traits/bound/assoc-fn-bound-root-obligation.rs4
-rw-r--r--tests/ui/traits/bound/assoc-fn-bound-root-obligation.stderr4
-rw-r--r--tests/ui/traits/bound/on-structs-and-enums-static.rs2
-rw-r--r--tests/ui/traits/bound/on-structs-and-enums-static.stderr19
-rw-r--r--tests/ui/traits/coercion-generic-bad.stderr1
-rw-r--r--tests/ui/traits/copy-guessing.stderr2
-rw-r--r--tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.rs4
-rw-r--r--tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.stderr16
-rw-r--r--tests/ui/traits/issue-33140-hack-boundaries.stderr2
-rw-r--r--tests/ui/traits/issue-38404.stderr1
-rw-r--r--tests/ui/traits/issue-38604.stderr2
-rw-r--r--tests/ui/traits/issue-52893.stderr2
-rw-r--r--tests/ui/traits/issue-59029-1.stderr6
-rw-r--r--tests/ui/traits/issue-77982.rs1
-rw-r--r--tests/ui/traits/issue-77982.stderr32
-rw-r--r--tests/ui/traits/item-privacy.stderr26
-rw-r--r--tests/ui/traits/multidispatch-convert-ambig-dest.rs1
-rw-r--r--tests/ui/traits/multidispatch-convert-ambig-dest.stderr16
-rw-r--r--tests/ui/traits/new-solver/alias-bound-unsound.rs1
-rw-r--r--tests/ui/traits/new-solver/alias-bound-unsound.stderr40
-rw-r--r--tests/ui/traits/new-solver/assembly/runaway-impl-candidate-selection.stderr11
-rw-r--r--tests/ui/traits/new-solver/coherence/issue-102048.stderr12
-rw-r--r--tests/ui/traits/new-solver/coroutine.fail.stderr64
-rw-r--r--tests/ui/traits/new-solver/coroutine.rs32
-rw-r--r--tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.rs3
-rw-r--r--tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr11
-rw-r--r--tests/ui/traits/new-solver/deduce-closure-signature-after-normalization.rs10
-rw-r--r--tests/ui/traits/new-solver/dont-ice-on-assoc-projection.stderr2
-rw-r--r--tests/ui/traits/new-solver/fn-trait.rs8
-rw-r--r--tests/ui/traits/new-solver/fn-trait.stderr14
-rw-r--r--tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-2.stderr15
-rw-r--r--tests/ui/traits/new-solver/generator.fail.stderr64
-rw-r--r--tests/ui/traits/new-solver/generator.rs32
-rw-r--r--tests/ui/traits/new-solver/normalize-async-closure-in-trait.rs9
-rw-r--r--tests/ui/traits/new-solver/normalizes_to_ignores_unnormalizable_candidate.self_infer.stderr14
-rw-r--r--tests/ui/traits/new-solver/object-unsafety.stderr2
-rw-r--r--tests/ui/traits/new-solver/overflow/exponential-trait-goals.rs3
-rw-r--r--tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr11
-rw-r--r--tests/ui/traits/new-solver/specialization-transmute.rs2
-rw-r--r--tests/ui/traits/new-solver/specialization-transmute.stderr11
-rw-r--r--tests/ui/traits/new-solver/specialization-unconstrained.stderr12
-rw-r--r--tests/ui/traits/non-lifetime-via-dyn-builtin.current.stderr11
-rw-r--r--tests/ui/traits/non-lifetime-via-dyn-builtin.next.stderr11
-rw-r--r--tests/ui/traits/non-lifetime-via-dyn-builtin.rs16
-rw-r--r--tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr12
-rw-r--r--tests/ui/traits/non_lifetime_binders/disqualifying-object-candidates.rs19
-rw-r--r--tests/ui/traits/non_lifetime_binders/on-rpit.rs16
-rw-r--r--tests/ui/traits/non_lifetime_binders/on-rpit.stderr11
-rw-r--r--tests/ui/traits/non_lifetime_binders/supertrait-object-safety.stderr3
-rw-r--r--tests/ui/traits/not-suggest-non-existing-fully-qualified-path.rs4
-rw-r--r--tests/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr16
-rw-r--r--tests/ui/traits/object/object-unsafe-missing-assoc-type.rs7
-rw-r--r--tests/ui/traits/object/object-unsafe-missing-assoc-type.stderr18
-rw-r--r--tests/ui/traits/object/print_vtable_sizes.stdout22
-rw-r--r--tests/ui/traits/object/safety.stderr2
-rw-r--r--tests/ui/traits/object/with-self-in-projection-output-bad.rs4
-rw-r--r--tests/ui/traits/object/with-self-in-projection-output-bad.stderr4
-rw-r--r--tests/ui/traits/suggest-dereferences/root-obligation.fixed2
-rw-r--r--tests/ui/traits/suggest-dereferences/root-obligation.rs2
-rw-r--r--tests/ui/traits/suggest-dereferences/root-obligation.stderr4
-rw-r--r--tests/ui/traits/suggest-fully-qualified-closure.stderr16
-rw-r--r--tests/ui/traits/suggest-fully-qualified-path-with-adjustment.rs4
-rw-r--r--tests/ui/traits/suggest-fully-qualified-path-with-adjustment.stderr32
-rw-r--r--tests/ui/traits/suggest-fully-qualified-path-without-adjustment.rs4
-rw-r--r--tests/ui/traits/suggest-fully-qualified-path-without-adjustment.stderr36
-rw-r--r--tests/ui/traits/test-2.stderr9
72 files changed, 631 insertions, 359 deletions
diff --git a/tests/ui/traits/alias/object-fail.stderr b/tests/ui/traits/alias/object-fail.stderr
index 048a150df..a27a3ea0e 100644
--- a/tests/ui/traits/alias/object-fail.stderr
+++ b/tests/ui/traits/alias/object-fail.stderr
@@ -9,7 +9,7 @@ note: for a trait to be "object safe" it needs to allow building a vtable to all
|
= note: the trait cannot be made into an object because it uses `Self` as a type parameter
-error[E0191]: the value of the associated type `Item` (from trait `Iterator`) must be specified
+error[E0191]: the value of the associated type `Item` in `Iterator` must be specified
--> $DIR/object-fail.rs:9:17
|
LL | let _: &dyn IteratorAlias = &vec![123].into_iter();
diff --git a/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.rs b/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.rs
new file mode 100644
index 000000000..e0edd5224
--- /dev/null
+++ b/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.rs
@@ -0,0 +1,43 @@
+// Regression test for #116464
+// Checks that we do not suggest Trait<..., Assoc=arg> when the trait
+// is referred to from one of its impls but do so at all other places
+
+pub trait Trait<T> {
+ type Assoc;
+}
+
+impl<T, S> Trait<T> for i32 {
+ type Assoc = String;
+}
+
+// Should not not trigger suggestion here...
+impl<T, S> Trait<T, S> for () {}
+//~^ ERROR trait takes 1 generic argument but 2 generic arguments were supplied
+
+//... but should do so in all of the below cases except the last one
+fn func<T: Trait<u32, String>>(t: T) -> impl Trait<(), i32> {
+//~^ ERROR trait takes 1 generic argument but 2 generic arguments were supplied
+//~| ERROR trait takes 1 generic argument but 2 generic arguments were supplied
+ 3
+}
+
+struct Struct<T: Trait<u32, String>> {
+//~^ ERROR trait takes 1 generic argument but 2 generic arguments were supplied
+ a: T
+}
+
+trait AnotherTrait<T: Trait<T, i32>> {}
+//~^ ERROR trait takes 1 generic argument but 2 generic arguments were supplied
+
+impl<T: Trait<u32, String>> Struct<T> {}
+//~^ ERROR trait takes 1 generic argument but 2 generic arguments were supplied
+
+// Test for self type. Should not trigger suggestion as it doesn't have an
+// associated type
+trait YetAnotherTrait {}
+impl<T: Trait<u32, Assoc=String>, U> YetAnotherTrait for Struct<T, U> {}
+//~^ ERROR struct takes 1 generic argument but 2 generic arguments were supplied
+
+
+fn main() {
+}
diff --git a/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr b/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr
new file mode 100644
index 000000000..711ccf1b6
--- /dev/null
+++ b/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr
@@ -0,0 +1,109 @@
+error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:14:12
+ |
+LL | impl<T, S> Trait<T, S> for () {}
+ | ^^^^^ expected 1 generic argument
+ |
+note: trait defined here, with 1 generic parameter: `T`
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:5:11
+ |
+LL | pub trait Trait<T> {
+ | ^^^^^ -
+
+error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:18:12
+ |
+LL | fn func<T: Trait<u32, String>>(t: T) -> impl Trait<(), i32> {
+ | ^^^^^ expected 1 generic argument
+ |
+note: trait defined here, with 1 generic parameter: `T`
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:5:11
+ |
+LL | pub trait Trait<T> {
+ | ^^^^^ -
+help: replace the generic bound with the associated type
+ |
+LL | fn func<T: Trait<u32, Assoc = String>>(t: T) -> impl Trait<(), i32> {
+ | +++++++
+
+error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:18:46
+ |
+LL | fn func<T: Trait<u32, String>>(t: T) -> impl Trait<(), i32> {
+ | ^^^^^ expected 1 generic argument
+ |
+note: trait defined here, with 1 generic parameter: `T`
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:5:11
+ |
+LL | pub trait Trait<T> {
+ | ^^^^^ -
+help: replace the generic bound with the associated type
+ |
+LL | fn func<T: Trait<u32, String>>(t: T) -> impl Trait<(), Assoc = i32> {
+ | +++++++
+
+error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:24:18
+ |
+LL | struct Struct<T: Trait<u32, String>> {
+ | ^^^^^ expected 1 generic argument
+ |
+note: trait defined here, with 1 generic parameter: `T`
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:5:11
+ |
+LL | pub trait Trait<T> {
+ | ^^^^^ -
+help: replace the generic bound with the associated type
+ |
+LL | struct Struct<T: Trait<u32, Assoc = String>> {
+ | +++++++
+
+error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:29:23
+ |
+LL | trait AnotherTrait<T: Trait<T, i32>> {}
+ | ^^^^^ expected 1 generic argument
+ |
+note: trait defined here, with 1 generic parameter: `T`
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:5:11
+ |
+LL | pub trait Trait<T> {
+ | ^^^^^ -
+help: replace the generic bound with the associated type
+ |
+LL | trait AnotherTrait<T: Trait<T, Assoc = i32>> {}
+ | +++++++
+
+error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:32:9
+ |
+LL | impl<T: Trait<u32, String>> Struct<T> {}
+ | ^^^^^ expected 1 generic argument
+ |
+note: trait defined here, with 1 generic parameter: `T`
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:5:11
+ |
+LL | pub trait Trait<T> {
+ | ^^^^^ -
+help: replace the generic bound with the associated type
+ |
+LL | impl<T: Trait<u32, Assoc = String>> Struct<T> {}
+ | +++++++
+
+error[E0107]: struct takes 1 generic argument but 2 generic arguments were supplied
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:38:58
+ |
+LL | impl<T: Trait<u32, Assoc=String>, U> YetAnotherTrait for Struct<T, U> {}
+ | ^^^^^^ - help: remove this generic argument
+ | |
+ | expected 1 generic argument
+ |
+note: struct defined here, with 1 generic parameter: `T`
+ --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:24:8
+ |
+LL | struct Struct<T: Trait<u32, String>> {
+ | ^^^^^^ -
+
+error: aborting due to 7 previous errors
+
+For more information about this error, try `rustc --explain E0107`.
diff --git a/tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.rs b/tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.rs
index eb2fb6e84..1359eb6cb 100644
--- a/tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.rs
+++ b/tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.rs
@@ -11,5 +11,5 @@ fn f<T: for<'r> X<'r> + ?Sized>() {
fn main() {
f::<dyn for<'x> X<'x, F = i32>>();
- //~^ expected a `FnOnce<(&i32,)>` closure, found `i32`
+ //~^ expected a `FnOnce(&i32)` closure, found `i32`
}
diff --git a/tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.stderr b/tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.stderr
index 10e82c54e..68b9319d6 100644
--- a/tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.stderr
+++ b/tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `FnOnce<(&i32,)>` closure, found `i32`
+error[E0277]: expected a `FnOnce(&i32)` closure, found `i32`
--> $DIR/check-trait-object-bounds-2.rs:13:9
|
LL | f::<dyn for<'x> X<'x, F = i32>>();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `FnOnce<(&i32,)>` closure, found `i32`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `FnOnce(&i32)` closure, found `i32`
|
= help: the trait `for<'a> FnOnce<(&'a i32,)>` is not implemented for `i32`
note: required by a bound in `f`
diff --git a/tests/ui/traits/associated_type_bound/impl-is-shadowed.rs b/tests/ui/traits/associated_type_bound/impl-is-shadowed.rs
new file mode 100644
index 000000000..6c3125a9f
--- /dev/null
+++ b/tests/ui/traits/associated_type_bound/impl-is-shadowed.rs
@@ -0,0 +1,21 @@
+// check-pass
+trait Bar<'a> {
+ type Assoc: 'static;
+}
+
+impl<'a> Bar<'a> for () {
+ type Assoc = ();
+}
+
+struct ImplsStatic<CG: Bar<'static>> {
+ d: &'static <CG as Bar<'static>>::Assoc,
+}
+
+fn caller(b: ImplsStatic<()>)
+where
+ for<'a> (): Bar<'a>
+{
+ let _: &<() as Bar<'static>>::Assoc = b.d;
+}
+
+fn main() {}
diff --git a/tests/ui/traits/bound/assoc-fn-bound-root-obligation.rs b/tests/ui/traits/bound/assoc-fn-bound-root-obligation.rs
index f9a934764..f8e3f8e96 100644
--- a/tests/ui/traits/bound/assoc-fn-bound-root-obligation.rs
+++ b/tests/ui/traits/bound/assoc-fn-bound-root-obligation.rs
@@ -1,7 +1,7 @@
fn strip_lf(s: &str) -> &str {
s.strip_suffix(b'\n').unwrap_or(s)
- //~^ ERROR expected a `FnMut<(char,)>` closure, found `u8`
- //~| NOTE expected an `FnMut<(char,)>` closure, found `u8`
+ //~^ ERROR expected a `FnMut(char)` closure, found `u8`
+ //~| NOTE expected an `FnMut(char)` closure, found `u8`
//~| HELP the trait `FnMut<(char,)>` is not implemented for `u8`
//~| HELP the following other types implement trait `Pattern<'a>`:
//~| NOTE required for `u8` to implement `Pattern<'_>`
diff --git a/tests/ui/traits/bound/assoc-fn-bound-root-obligation.stderr b/tests/ui/traits/bound/assoc-fn-bound-root-obligation.stderr
index b1c683e47..f30fe12b2 100644
--- a/tests/ui/traits/bound/assoc-fn-bound-root-obligation.stderr
+++ b/tests/ui/traits/bound/assoc-fn-bound-root-obligation.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `FnMut<(char,)>` closure, found `u8`
+error[E0277]: expected a `FnMut(char)` closure, found `u8`
--> $DIR/assoc-fn-bound-root-obligation.rs:2:7
|
LL | s.strip_suffix(b'\n').unwrap_or(s)
- | ^^^^^^^^^^^^ expected an `FnMut<(char,)>` closure, found `u8`
+ | ^^^^^^^^^^^^ expected an `FnMut(char)` closure, found `u8`
|
= help: the trait `FnMut<(char,)>` is not implemented for `u8`
= help: the following other types implement trait `Pattern<'a>`:
diff --git a/tests/ui/traits/bound/on-structs-and-enums-static.rs b/tests/ui/traits/bound/on-structs-and-enums-static.rs
index df3f8b8a5..066416cb3 100644
--- a/tests/ui/traits/bound/on-structs-and-enums-static.rs
+++ b/tests/ui/traits/bound/on-structs-and-enums-static.rs
@@ -8,7 +8,7 @@ struct Foo<T:Trait> {
static X: Foo<usize> = Foo {
//~^ ERROR E0277
- x: 1,
+ x: 1, //~ ERROR: E0277
};
fn main() {
diff --git a/tests/ui/traits/bound/on-structs-and-enums-static.stderr b/tests/ui/traits/bound/on-structs-and-enums-static.stderr
index fa14aff68..28bbe00c5 100644
--- a/tests/ui/traits/bound/on-structs-and-enums-static.stderr
+++ b/tests/ui/traits/bound/on-structs-and-enums-static.stderr
@@ -15,6 +15,23 @@ note: required by a bound in `Foo`
LL | struct Foo<T:Trait> {
| ^^^^^ required by this bound in `Foo`
-error: aborting due to previous error
+error[E0277]: the trait bound `usize: Trait` is not satisfied
+ --> $DIR/on-structs-and-enums-static.rs:11:8
+ |
+LL | x: 1,
+ | ^ the trait `Trait` is not implemented for `usize`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/on-structs-and-enums-static.rs:1:1
+ |
+LL | trait Trait {
+ | ^^^^^^^^^^^
+note: required by a bound in `Foo`
+ --> $DIR/on-structs-and-enums-static.rs:5:14
+ |
+LL | struct Foo<T:Trait> {
+ | ^^^^^ required by this bound in `Foo`
+
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/traits/coercion-generic-bad.stderr b/tests/ui/traits/coercion-generic-bad.stderr
index e7e8a7967..30a3c40db 100644
--- a/tests/ui/traits/coercion-generic-bad.stderr
+++ b/tests/ui/traits/coercion-generic-bad.stderr
@@ -5,6 +5,7 @@ LL | let s: Box<dyn Trait<isize>> = Box::new(Struct { person: "Fred" });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait<isize>` is not implemented for `Struct`
|
= help: the trait `Trait<&'static str>` is implemented for `Struct`
+ = help: for that trait implementation, expected `&'static str`, found `isize`
= note: required for the cast from `Box<Struct>` to `Box<dyn Trait<isize>>`
error: aborting due to previous error
diff --git a/tests/ui/traits/copy-guessing.stderr b/tests/ui/traits/copy-guessing.stderr
index 568b7e5a6..7e676c9da 100644
--- a/tests/ui/traits/copy-guessing.stderr
+++ b/tests/ui/traits/copy-guessing.stderr
@@ -2,7 +2,7 @@ error[E0282]: type annotations needed for `Option<T>`
--> $DIR/copy-guessing.rs:20:9
|
LL | let n = None;
- | ^
+ | ^ ---- type must be known at this point
|
help: consider giving `n` an explicit type, where the type for type parameter `T` is specified
|
diff --git a/tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.rs b/tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.rs
index 9a444be50..205b1173e 100644
--- a/tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.rs
+++ b/tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.rs
@@ -14,7 +14,5 @@ impl<X> Method<u32> for Thing<X> {
fn main() {
let thing = Thing(true);
- thing.method(42);
- //~^ ERROR type annotations needed
- //~| ERROR type annotations needed
+ thing.method(42); //~ ERROR type annotations needed
}
diff --git a/tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.stderr b/tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.stderr
index 57b2587ae..2185c51e5 100644
--- a/tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.stderr
+++ b/tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.stderr
@@ -1,14 +1,3 @@
-error[E0282]: type annotations needed
- --> $DIR/do-not-mention-type-params-by-name-in-suggestion-issue-96292.rs:17:11
- |
-LL | thing.method(42);
- | ^^^^^^
- |
-help: try using a fully qualified path to specify the expected types
- |
-LL | <Thing<bool> as Method<T>>::method(thing, 42);
- | +++++++++++++++++++++++++++++++++++ ~
-
error[E0283]: type annotations needed
--> $DIR/do-not-mention-type-params-by-name-in-suggestion-issue-96292.rs:17:11
|
@@ -28,7 +17,6 @@ help: try using a fully qualified path to specify the expected types
LL | <Thing<bool> as Method<T>>::method(thing, 42);
| +++++++++++++++++++++++++++++++++++ ~
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0282, E0283.
-For more information about an error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/traits/issue-33140-hack-boundaries.stderr b/tests/ui/traits/issue-33140-hack-boundaries.stderr
index 80a502c63..06e1dfd37 100644
--- a/tests/ui/traits/issue-33140-hack-boundaries.stderr
+++ b/tests/ui/traits/issue-33140-hack-boundaries.stderr
@@ -60,7 +60,7 @@ error[E0119]: conflicting implementations of trait `Trait5` for type `(dyn Send
LL | impl Trait5 for dyn Send {}
| ------------------------ first implementation here
LL | impl Trait5 for dyn Send where u32: Copy {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn Send + 'static)`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn Send + 'static)`
error: aborting due to 8 previous errors
diff --git a/tests/ui/traits/issue-38404.stderr b/tests/ui/traits/issue-38404.stderr
index f8625f53b..a5c258eb3 100644
--- a/tests/ui/traits/issue-38404.stderr
+++ b/tests/ui/traits/issue-38404.stderr
@@ -25,6 +25,7 @@ LL | trait A<T>: std::ops::Add<Self> + Sized {}
| ^^^^^^^^^^^^^^^^^^^ ...because it uses `Self` as a type parameter
LL | trait B<T>: A<T> {}
| - this trait cannot be made into an object...
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/traits/issue-38604.stderr b/tests/ui/traits/issue-38604.stderr
index d53276024..3ab9af21b 100644
--- a/tests/ui/traits/issue-38604.stderr
+++ b/tests/ui/traits/issue-38604.stderr
@@ -11,6 +11,7 @@ LL | trait Foo where u32: Q<Self> {
| --- ^^^^^^^ ...because it uses `Self` as a type parameter
| |
| this trait cannot be made into an object...
+ = help: only type `()` implements the trait, consider using it directly instead
error[E0038]: the trait `Foo` cannot be made into an object
--> $DIR/issue-38604.rs:15:9
@@ -25,6 +26,7 @@ LL | trait Foo where u32: Q<Self> {
| --- ^^^^^^^ ...because it uses `Self` as a type parameter
| |
| this trait cannot be made into an object...
+ = help: only type `()` implements the trait, consider using it directly instead
= note: required for the cast from `Box<()>` to `Box<dyn Foo>`
error: aborting due to 2 previous errors
diff --git a/tests/ui/traits/issue-52893.stderr b/tests/ui/traits/issue-52893.stderr
index db807a388..c57921a08 100644
--- a/tests/ui/traits/issue-52893.stderr
+++ b/tests/ui/traits/issue-52893.stderr
@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/issue-52893.rs:53:22
|
LL | impl<F, Name, P> AddClass<Name, F> for Class<P>
- | - this type parameter
+ | - expected this type parameter
...
LL | builder.push(output);
| ---- ^^^^^^ expected type parameter `F`, found `Class<P>`
diff --git a/tests/ui/traits/issue-59029-1.stderr b/tests/ui/traits/issue-59029-1.stderr
index 203a89285..5c47eefcd 100644
--- a/tests/ui/traits/issue-59029-1.stderr
+++ b/tests/ui/traits/issue-59029-1.stderr
@@ -2,13 +2,15 @@ error[E0220]: associated type `Res` not found for `Self`
--> $DIR/issue-59029-1.rs:5:52
|
LL | trait MkSvc<Target, Req> = Svc<Target> where Self::Res: Svc<Req>;
- | ^^^ there is a similarly named associated type `Res` in the trait `Svc`
+ | ^^^ there is an associated type `Res` in the trait `Svc`
error[E0220]: associated type `Res` not found for `Self`
--> $DIR/issue-59029-1.rs:5:52
|
LL | trait MkSvc<Target, Req> = Svc<Target> where Self::Res: Svc<Req>;
- | ^^^ there is a similarly named associated type `Res` in the trait `Svc`
+ | ^^^ there is an associated type `Res` in the trait `Svc`
+ |
+ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors
diff --git a/tests/ui/traits/issue-77982.rs b/tests/ui/traits/issue-77982.rs
index f5be6cf21..2331dda91 100644
--- a/tests/ui/traits/issue-77982.rs
+++ b/tests/ui/traits/issue-77982.rs
@@ -1,3 +1,4 @@
+// ignore-windows different list of satisfying impls
use std::collections::HashMap;
fn what() {
diff --git a/tests/ui/traits/issue-77982.stderr b/tests/ui/traits/issue-77982.stderr
index 33cc186ac..592cfd970 100644
--- a/tests/ui/traits/issue-77982.stderr
+++ b/tests/ui/traits/issue-77982.stderr
@@ -1,5 +1,5 @@
error[E0283]: type annotations needed
- --> $DIR/issue-77982.rs:8:10
+ --> $DIR/issue-77982.rs:9:10
|
LL | opts.get(opt.as_ref());
| ^^^ ------------ type must be known at this point
@@ -18,7 +18,7 @@ LL | opts.get::<Q>(opt.as_ref());
| +++++
error[E0283]: type annotations needed
- --> $DIR/issue-77982.rs:8:10
+ --> $DIR/issue-77982.rs:9:10
|
LL | opts.get(opt.as_ref());
| ^^^ ------ type must be known at this point
@@ -35,25 +35,34 @@ help: consider specifying the generic argument
LL | opts.get::<Q>(opt.as_ref());
| +++++
-error[E0282]: type annotations needed
- --> $DIR/issue-77982.rs:13:59
+error[E0283]: type annotations needed
+ --> $DIR/issue-77982.rs:14:59
|
LL | let ips: Vec<_> = (0..100_000).map(|_| u32::from(0u32.into())).collect();
- | ^^^^
- |
+ | --- ^^^^
+ | |
+ | type must be known at this point
+ |
+ = note: multiple `impl`s satisfying `u32: From<_>` found in the `core` crate:
+ - impl From<Ipv4Addr> for u32;
+ - impl From<NonZeroU32> for u32;
+ - impl From<bool> for u32;
+ - impl From<char> for u32;
+ - impl From<u16> for u32;
+ - impl From<u8> for u32;
help: try using a fully qualified path to specify the expected types
|
LL | let ips: Vec<_> = (0..100_000).map(|_| u32::from(<u32 as Into<T>>::into(0u32))).collect();
| +++++++++++++++++++++++ ~
error[E0283]: type annotations needed for `Box<T>`
- --> $DIR/issue-77982.rs:36:9
+ --> $DIR/issue-77982.rs:37:9
|
LL | let _ = ().foo();
| ^ --- type must be known at this point
|
note: multiple `impl`s satisfying `(): Foo<'_, _>` found
- --> $DIR/issue-77982.rs:29:1
+ --> $DIR/issue-77982.rs:30:1
|
LL | impl Foo<'static, u32> for () {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -65,13 +74,13 @@ LL | let _: Box<T> = ().foo();
| ++++++++
error[E0283]: type annotations needed for `Box<T>`
- --> $DIR/issue-77982.rs:40:9
+ --> $DIR/issue-77982.rs:41:9
|
LL | let _ = (&()).bar();
| ^ --- type must be known at this point
|
note: multiple `impl`s satisfying `&(): Bar<'_, _>` found
- --> $DIR/issue-77982.rs:32:1
+ --> $DIR/issue-77982.rs:33:1
|
LL | impl<'a> Bar<'static, u32> for &'a () {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -84,5 +93,4 @@ LL | let _: Box<T> = (&()).bar();
error: aborting due to 5 previous errors
-Some errors have detailed explanations: E0282, E0283.
-For more information about an error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/traits/item-privacy.stderr b/tests/ui/traits/item-privacy.stderr
index f53813189..244cc2fc5 100644
--- a/tests/ui/traits/item-privacy.stderr
+++ b/tests/ui/traits/item-privacy.stderr
@@ -8,11 +8,10 @@ LL | S.a();
| ^ method not found in `S`
|
= help: items from traits can only be used if the trait is implemented and in scope
-note: `method::A` defines an item `a`, perhaps you need to implement it
- --> $DIR/item-privacy.rs:6:5
+help: the following trait is implemented but not in scope; perhaps add a `use` for it:
+ |
+LL + use method::A;
|
-LL | trait A {
- | ^^^^^^^
error[E0599]: no method named `b` found for struct `S` in the current scope
--> $DIR/item-privacy.rs:68:7
@@ -51,11 +50,10 @@ LL | S::a(&S);
| ^ function or associated item not found in `S`
|
= help: items from traits can only be used if the trait is implemented and in scope
-note: `method::A` defines an item `a`, perhaps you need to implement it
- --> $DIR/item-privacy.rs:6:5
+help: the following trait is implemented but not in scope; perhaps add a `use` for it:
+ |
+LL + use method::A;
|
-LL | trait A {
- | ^^^^^^^
error[E0599]: no function or associated item named `b` found for struct `S` in the current scope
--> $DIR/item-privacy.rs:80:8
@@ -91,11 +89,10 @@ LL | S::A;
| ^ associated item not found in `S`
|
= help: items from traits can only be used if the trait is implemented and in scope
-note: `assoc_const::A` defines an item `A`, perhaps you need to implement it
- --> $DIR/item-privacy.rs:24:5
+help: the following trait is implemented but not in scope; perhaps add a `use` for it:
+ |
+LL + use assoc_const::A;
|
-LL | trait A {
- | ^^^^^^^
error[E0599]: no associated item named `B` found for struct `S` in the current scope
--> $DIR/item-privacy.rs:98:8
@@ -143,6 +140,7 @@ LL | const C: u8 = 0;
= help: consider moving `C` to another trait
= help: consider moving `A` to another trait
= help: consider moving `B` to another trait
+ = help: only type `S` implements the trait, consider using it directly instead
error[E0223]: ambiguous associated type
--> $DIR/item-privacy.rs:115:12
@@ -159,13 +157,13 @@ error[E0223]: ambiguous associated type
--> $DIR/item-privacy.rs:116:12
|
LL | let _: S::B;
- | ^^^^ help: use the fully-qualified path: `<S as assoc_ty::B>::B`
+ | ^^^^ help: use fully-qualified syntax: `<S as assoc_ty::B>::B`
error[E0223]: ambiguous associated type
--> $DIR/item-privacy.rs:117:12
|
LL | let _: S::C;
- | ^^^^ help: use the fully-qualified path: `<S as assoc_ty::C>::C`
+ | ^^^^ help: use fully-qualified syntax: `<S as assoc_ty::C>::C`
error[E0624]: associated type `A` is private
--> $DIR/item-privacy.rs:119:12
diff --git a/tests/ui/traits/multidispatch-convert-ambig-dest.rs b/tests/ui/traits/multidispatch-convert-ambig-dest.rs
index aa74e11c3..36e1e868f 100644
--- a/tests/ui/traits/multidispatch-convert-ambig-dest.rs
+++ b/tests/ui/traits/multidispatch-convert-ambig-dest.rs
@@ -25,7 +25,6 @@ where T : Convert<U>
fn a() {
test(22, std::default::Default::default());
//~^ ERROR type annotations needed
- //~| ERROR type annotations needed
}
fn main() {}
diff --git a/tests/ui/traits/multidispatch-convert-ambig-dest.stderr b/tests/ui/traits/multidispatch-convert-ambig-dest.stderr
index e927f26e9..e3bfc78bb 100644
--- a/tests/ui/traits/multidispatch-convert-ambig-dest.stderr
+++ b/tests/ui/traits/multidispatch-convert-ambig-dest.stderr
@@ -1,14 +1,3 @@
-error[E0282]: type annotations needed
- --> $DIR/multidispatch-convert-ambig-dest.rs:26:5
- |
-LL | test(22, std::default::Default::default());
- | ^^^^ cannot infer type of the type parameter `U` declared on the function `test`
- |
-help: consider specifying the generic arguments
- |
-LL | test::<i32, U>(22, std::default::Default::default());
- | ++++++++++
-
error[E0283]: type annotations needed
--> $DIR/multidispatch-convert-ambig-dest.rs:26:5
|
@@ -37,7 +26,6 @@ help: consider specifying the generic arguments
LL | test::<i32, U>(22, std::default::Default::default());
| ++++++++++
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0282, E0283.
-For more information about an error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/traits/new-solver/alias-bound-unsound.rs b/tests/ui/traits/new-solver/alias-bound-unsound.rs
index 38d83d289..825e874d7 100644
--- a/tests/ui/traits/new-solver/alias-bound-unsound.rs
+++ b/tests/ui/traits/new-solver/alias-bound-unsound.rs
@@ -27,6 +27,5 @@ fn main() {
//~| ERROR overflow evaluating the requirement `<() as Foo>::Item well-formed`
//~| ERROR overflow evaluating the requirement `String <: <() as Foo>::Item`
//~| ERROR overflow evaluating the requirement `&<() as Foo>::Item well-formed`
- //~| ERROR type annotations needed
println!("{x}");
}
diff --git a/tests/ui/traits/new-solver/alias-bound-unsound.stderr b/tests/ui/traits/new-solver/alias-bound-unsound.stderr
index abc6677c1..ca4b5c90f 100644
--- a/tests/ui/traits/new-solver/alias-bound-unsound.stderr
+++ b/tests/ui/traits/new-solver/alias-bound-unsound.stderr
@@ -11,18 +11,7 @@ note: required by a bound in `Foo::Item`
LL | type Item: Copy
| ^^^^ required by this bound in `Foo::Item`
-error[E0282]: type annotations needed
- --> $DIR/alias-bound-unsound.rs:24:5
- |
-LL | drop(<() as Foo>::copy_me(&x));
- | ^^^^ cannot infer type of the type parameter `T` declared on the function `drop`
- |
-help: consider specifying the generic argument
- |
-LL | drop::<T>(<() as Foo>::copy_me(&x));
- | +++++
-
-error[E0275]: overflow evaluating the requirement `&<() as Foo>::Item well-formed`
+error[E0275]: overflow evaluating the requirement `String <: <() as Foo>::Item`
--> $DIR/alias-bound-unsound.rs:24:31
|
LL | drop(<() as Foo>::copy_me(&x));
@@ -30,40 +19,39 @@ LL | drop(<() as Foo>::copy_me(&x));
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`alias_bound_unsound`)
-error[E0275]: overflow evaluating the requirement `String <: <() as Foo>::Item`
- --> $DIR/alias-bound-unsound.rs:24:31
+error[E0275]: overflow evaluating the requirement `<() as Foo>::Item == _`
+ --> $DIR/alias-bound-unsound.rs:24:10
|
LL | drop(<() as Foo>::copy_me(&x));
- | ^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`alias_bound_unsound`)
-error[E0275]: overflow evaluating the requirement `<() as Foo>::Item well-formed`
+error[E0275]: overflow evaluating the requirement `<() as Foo>::Item: Sized`
--> $DIR/alias-bound-unsound.rs:24:10
|
LL | drop(<() as Foo>::copy_me(&x));
- | ^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`alias_bound_unsound`)
+ = note: the return type of a function must have a statically known size
-error[E0275]: overflow evaluating the requirement `<() as Foo>::Item == _`
- --> $DIR/alias-bound-unsound.rs:24:10
+error[E0275]: overflow evaluating the requirement `&<() as Foo>::Item well-formed`
+ --> $DIR/alias-bound-unsound.rs:24:31
|
LL | drop(<() as Foo>::copy_me(&x));
- | ^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`alias_bound_unsound`)
-error[E0275]: overflow evaluating the requirement `<() as Foo>::Item: Sized`
+error[E0275]: overflow evaluating the requirement `<() as Foo>::Item well-formed`
--> $DIR/alias-bound-unsound.rs:24:10
|
LL | drop(<() as Foo>::copy_me(&x));
- | ^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`alias_bound_unsound`)
- = note: the return type of a function must have a statically known size
-error: aborting due to 7 previous errors
+error: aborting due to 6 previous errors
-Some errors have detailed explanations: E0275, E0282.
-For more information about an error, try `rustc --explain E0275`.
+For more information about this error, try `rustc --explain E0275`.
diff --git a/tests/ui/traits/new-solver/assembly/runaway-impl-candidate-selection.stderr b/tests/ui/traits/new-solver/assembly/runaway-impl-candidate-selection.stderr
index 47004821a..414deb477 100644
--- a/tests/ui/traits/new-solver/assembly/runaway-impl-candidate-selection.stderr
+++ b/tests/ui/traits/new-solver/assembly/runaway-impl-candidate-selection.stderr
@@ -1,9 +1,16 @@
-error[E0282]: type annotations needed
+error[E0283]: type annotations needed
--> $DIR/runaway-impl-candidate-selection.rs:13:22
|
LL | println!("{:?}", iter::<_>());
| ^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `iter`
+ |
+ = note: cannot satisfy `_: Iterator`
+note: required by a bound in `iter`
+ --> $DIR/runaway-impl-candidate-selection.rs:8:12
+ |
+LL | fn iter<T: Iterator>() -> <T as Iterator>::Item {
+ | ^^^^^^^^ required by this bound in `iter`
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/traits/new-solver/coherence/issue-102048.stderr b/tests/ui/traits/new-solver/coherence/issue-102048.stderr
index 17a43838f..41bf68a1d 100644
--- a/tests/ui/traits/new-solver/coherence/issue-102048.stderr
+++ b/tests/ui/traits/new-solver/coherence/issue-102048.stderr
@@ -1,11 +1,15 @@
error[E0119]: conflicting implementations of trait `Trait<for<'a> fn(<_ as WithAssoc1<'a>>::Assoc, <_ as WithAssoc2<'a>>::Assoc)>` for type `(_, _)`
--> $DIR/issue-102048.rs:39:1
|
-LL | impl<T, U> Trait<for<'a> fn(<T as WithAssoc1<'a>>::Assoc, <U as WithAssoc2<'a>>::Assoc)> for (T, U)
- | --------------------------------------------------------------------------------------------------- first implementation here
+LL | / impl<T, U> Trait<for<'a> fn(<T as WithAssoc1<'a>>::Assoc, <U as WithAssoc2<'a>>::Assoc)> for (T, U)
+LL | | where
+LL | | T: for<'a> WithAssoc1<'a> + for<'a> WithAssoc2<'a, Assoc = i32>,
+LL | | U: for<'a> WithAssoc2<'a>,
+ | |______________________________- first implementation here
...
-LL | impl<T, U> Trait<for<'a> fn(<U as WithAssoc1<'a>>::Assoc, u32)> for (T, U) where
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(_, _)`
+LL | / impl<T, U> Trait<for<'a> fn(<U as WithAssoc1<'a>>::Assoc, u32)> for (T, U) where
+LL | | U: for<'a> WithAssoc1<'a>
+ | |_____________________________^ conflicting implementation for `(_, _)`
error: aborting due to previous error
diff --git a/tests/ui/traits/new-solver/coroutine.fail.stderr b/tests/ui/traits/new-solver/coroutine.fail.stderr
new file mode 100644
index 000000000..14e67727d
--- /dev/null
+++ b/tests/ui/traits/new-solver/coroutine.fail.stderr
@@ -0,0 +1,64 @@
+error[E0277]: the trait bound `{coroutine@$DIR/coroutine.rs:18:21: 18:23}: Coroutine<A>` is not satisfied
+ --> $DIR/coroutine.rs:18:21
+ |
+LL | needs_coroutine(|| {
+ | _____---------------_^
+ | | |
+ | | required by a bound introduced by this call
+LL | |
+LL | |
+LL | |
+LL | | yield ();
+LL | | });
+ | |_____^ the trait `Coroutine<A>` is not implemented for `{coroutine@$DIR/coroutine.rs:18:21: 18:23}`
+ |
+note: required by a bound in `needs_coroutine`
+ --> $DIR/coroutine.rs:14:28
+ |
+LL | fn needs_coroutine(_: impl Coroutine<A, Yield = B, Return = C>) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `needs_coroutine`
+
+error[E0271]: type mismatch resolving `<{coroutine@$DIR/coroutine.rs:18:21: 18:23} as Coroutine<A>>::Yield == B`
+ --> $DIR/coroutine.rs:18:21
+ |
+LL | needs_coroutine(|| {
+ | _____---------------_^
+ | | |
+ | | required by a bound introduced by this call
+LL | |
+LL | |
+LL | |
+LL | | yield ();
+LL | | });
+ | |_____^ types differ
+ |
+note: required by a bound in `needs_coroutine`
+ --> $DIR/coroutine.rs:14:41
+ |
+LL | fn needs_coroutine(_: impl Coroutine<A, Yield = B, Return = C>) {}
+ | ^^^^^^^^^ required by this bound in `needs_coroutine`
+
+error[E0271]: type mismatch resolving `<{coroutine@$DIR/coroutine.rs:18:21: 18:23} as Coroutine<A>>::Return == C`
+ --> $DIR/coroutine.rs:18:21
+ |
+LL | needs_coroutine(|| {
+ | _____---------------_^
+ | | |
+ | | required by a bound introduced by this call
+LL | |
+LL | |
+LL | |
+LL | | yield ();
+LL | | });
+ | |_____^ types differ
+ |
+note: required by a bound in `needs_coroutine`
+ --> $DIR/coroutine.rs:14:52
+ |
+LL | fn needs_coroutine(_: impl Coroutine<A, Yield = B, Return = C>) {}
+ | ^^^^^^^^^^ required by this bound in `needs_coroutine`
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0271, E0277.
+For more information about an error, try `rustc --explain E0271`.
diff --git a/tests/ui/traits/new-solver/coroutine.rs b/tests/ui/traits/new-solver/coroutine.rs
new file mode 100644
index 000000000..af16f70fb
--- /dev/null
+++ b/tests/ui/traits/new-solver/coroutine.rs
@@ -0,0 +1,32 @@
+// compile-flags: -Ztrait-solver=next
+// edition: 2021
+// revisions: pass fail
+//[pass] check-pass
+
+#![feature(coroutine_trait, coroutines)]
+
+use std::ops::Coroutine;
+
+struct A;
+struct B;
+struct C;
+
+fn needs_coroutine(_: impl Coroutine<A, Yield = B, Return = C>) {}
+
+#[cfg(fail)]
+fn main() {
+ needs_coroutine(|| {
+ //[fail]~^ ERROR Coroutine<A>` is not satisfied
+ //[fail]~| ERROR as Coroutine<A>>::Yield == B`
+ //[fail]~| ERROR as Coroutine<A>>::Return == C`
+ yield ();
+ });
+}
+
+#[cfg(pass)]
+fn main() {
+ needs_coroutine(|_: A| {
+ let _: A = yield B;
+ C
+ })
+}
diff --git a/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.rs b/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.rs
index fcafdcf63..44e763ef9 100644
--- a/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.rs
+++ b/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.rs
@@ -27,6 +27,5 @@ fn impls<T: Trait>() {}
fn main() {
impls::<W<_>>();
- //~^ ERROR type annotations needed
- //~| ERROR overflow evaluating the requirement
+ //~^ ERROR overflow evaluating the requirement
}
diff --git a/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr b/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr
index a86115671..1ac0e2977 100644
--- a/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr
+++ b/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr
@@ -1,9 +1,3 @@
-error[E0282]: type annotations needed
- --> $DIR/fixpoint-exponential-growth.rs:29:5
- |
-LL | impls::<W<_>>();
- | ^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `impls`
-
error[E0275]: overflow evaluating the requirement `W<_>: Trait`
--> $DIR/fixpoint-exponential-growth.rs:29:13
|
@@ -17,7 +11,6 @@ note: required by a bound in `impls`
LL | fn impls<T: Trait>() {}
| ^^^^^ required by this bound in `impls`
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0275, E0282.
-For more information about an error, try `rustc --explain E0275`.
+For more information about this error, try `rustc --explain E0275`.
diff --git a/tests/ui/traits/new-solver/deduce-closure-signature-after-normalization.rs b/tests/ui/traits/new-solver/deduce-closure-signature-after-normalization.rs
new file mode 100644
index 000000000..51f62bc23
--- /dev/null
+++ b/tests/ui/traits/new-solver/deduce-closure-signature-after-normalization.rs
@@ -0,0 +1,10 @@
+// compile-flags: -Ztrait-solver=next
+// check-pass
+
+trait Foo {
+ fn test() -> impl Fn(u32) -> u32 {
+ |x| x.count_ones()
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/traits/new-solver/dont-ice-on-assoc-projection.stderr b/tests/ui/traits/new-solver/dont-ice-on-assoc-projection.stderr
index 7ad495a35..368f5cd0c 100644
--- a/tests/ui/traits/new-solver/dont-ice-on-assoc-projection.stderr
+++ b/tests/ui/traits/new-solver/dont-ice-on-assoc-projection.stderr
@@ -13,7 +13,7 @@ error[E0119]: conflicting implementations of trait `Foo` for type `()`
LL | impl Foo for () {}
| --------------- first implementation here
LL | impl<T> Foo for T where T: Bar<ASSOC = 0> {}
- | ^^^^^^^^^^^^^^^^^ conflicting implementation for `()`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()`
error: aborting due to 2 previous errors
diff --git a/tests/ui/traits/new-solver/fn-trait.rs b/tests/ui/traits/new-solver/fn-trait.rs
index 0599e51d7..0a19e6265 100644
--- a/tests/ui/traits/new-solver/fn-trait.rs
+++ b/tests/ui/traits/new-solver/fn-trait.rs
@@ -18,15 +18,15 @@ fn main() {
require_fn(f);
require_fn(f as fn() -> i32);
require_fn(f as unsafe fn() -> i32);
- //~^ ERROR: expected a `Fn<()>` closure, found `unsafe fn() -> i32`
+ //~^ ERROR: expected a `Fn()` closure, found `unsafe fn() -> i32`
//~| ERROR: type mismatch resolving `<unsafe fn() -> i32 as FnOnce<()>>::Output == i32`
require_fn(g);
- //~^ ERROR: expected a `Fn<()>` closure, found `extern "C" fn() -> i32 {g}`
+ //~^ ERROR: expected a `Fn()` closure, found `extern "C" fn() -> i32 {g}`
//~| ERROR: type mismatch resolving `<extern "C" fn() -> i32 {g} as FnOnce<()>>::Output == i32`
require_fn(g as extern "C" fn() -> i32);
- //~^ ERROR: expected a `Fn<()>` closure, found `extern "C" fn() -> i32`
+ //~^ ERROR: expected a `Fn()` closure, found `extern "C" fn() -> i32`
//~| ERROR: type mismatch resolving `<extern "C" fn() -> i32 as FnOnce<()>>::Output == i32`
require_fn(h);
- //~^ ERROR: expected a `Fn<()>` closure, found `unsafe fn() -> i32 {h}`
+ //~^ ERROR: expected a `Fn()` closure, found `unsafe fn() -> i32 {h}`
//~| ERROR: type mismatch resolving `<unsafe fn() -> i32 {h} as FnOnce<()>>::Output == i32`
}
diff --git a/tests/ui/traits/new-solver/fn-trait.stderr b/tests/ui/traits/new-solver/fn-trait.stderr
index d52bcaf25..e33487235 100644
--- a/tests/ui/traits/new-solver/fn-trait.stderr
+++ b/tests/ui/traits/new-solver/fn-trait.stderr
@@ -1,4 +1,4 @@
-error[E0277]: expected a `Fn<()>` closure, found `unsafe fn() -> i32`
+error[E0277]: expected a `Fn()` closure, found `unsafe fn() -> i32`
--> $DIR/fn-trait.rs:20:16
|
LL | require_fn(f as unsafe fn() -> i32);
@@ -7,6 +7,7 @@ LL | require_fn(f as unsafe fn() -> i32);
| required by a bound introduced by this call
|
= help: the trait `Fn<()>` is not implemented for `unsafe fn() -> i32`
+ = note: unsafe function cannot be called generically without an unsafe block
= note: wrap the `unsafe fn() -> i32` in a closure with no arguments: `|| { /* code */ }`
note: required by a bound in `require_fn`
--> $DIR/fn-trait.rs:3:23
@@ -28,11 +29,11 @@ note: required by a bound in `require_fn`
LL | fn require_fn(_: impl Fn() -> i32) {}
| ^^^ required by this bound in `require_fn`
-error[E0277]: expected a `Fn<()>` closure, found `extern "C" fn() -> i32 {g}`
+error[E0277]: expected a `Fn()` closure, found `extern "C" fn() -> i32 {g}`
--> $DIR/fn-trait.rs:23:16
|
LL | require_fn(g);
- | ---------- ^ expected an `Fn<()>` closure, found `extern "C" fn() -> i32 {g}`
+ | ---------- ^ expected an `Fn()` closure, found `extern "C" fn() -> i32 {g}`
| |
| required by a bound introduced by this call
|
@@ -58,11 +59,11 @@ note: required by a bound in `require_fn`
LL | fn require_fn(_: impl Fn() -> i32) {}
| ^^^ required by this bound in `require_fn`
-error[E0277]: expected a `Fn<()>` closure, found `extern "C" fn() -> i32`
+error[E0277]: expected a `Fn()` closure, found `extern "C" fn() -> i32`
--> $DIR/fn-trait.rs:26:16
|
LL | require_fn(g as extern "C" fn() -> i32);
- | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `Fn<()>` closure, found `extern "C" fn() -> i32`
+ | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `Fn()` closure, found `extern "C" fn() -> i32`
| |
| required by a bound introduced by this call
|
@@ -88,7 +89,7 @@ note: required by a bound in `require_fn`
LL | fn require_fn(_: impl Fn() -> i32) {}
| ^^^ required by this bound in `require_fn`
-error[E0277]: expected a `Fn<()>` closure, found `unsafe fn() -> i32 {h}`
+error[E0277]: expected a `Fn()` closure, found `unsafe fn() -> i32 {h}`
--> $DIR/fn-trait.rs:29:16
|
LL | require_fn(h);
@@ -97,6 +98,7 @@ LL | require_fn(h);
| required by a bound introduced by this call
|
= help: the trait `Fn<()>` is not implemented for fn item `unsafe fn() -> i32 {h}`
+ = note: unsafe function cannot be called generically without an unsafe block
= note: wrap the `unsafe fn() -> i32 {h}` in a closure with no arguments: `|| { /* code */ }`
note: required by a bound in `require_fn`
--> $DIR/fn-trait.rs:3:23
diff --git a/tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-2.stderr b/tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-2.stderr
index 9a8060133..9aa4f4531 100644
--- a/tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-2.stderr
+++ b/tests/ui/traits/new-solver/generalize/generalize-proj-new-universe-index-2.stderr
@@ -1,9 +1,18 @@
-error[E0282]: type annotations needed
+error[E0284]: type annotations needed: cannot satisfy `<<Leaf as WithAssoc<_>>::Assoc as Id>::Assoc == <<Leaf as WithAssoc<_>>::Assoc as Id>::Assoc`
--> $DIR/generalize-proj-new-universe-index-2.rs:74:5
|
LL | bound::<<Rigid as IdHigherRankedBound>::Assoc, <Wrapper<Leaf> as Id>::Assoc, _>()
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `V` declared on the function `bound`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot satisfy `<<Leaf as WithAssoc<_>>::Assoc as Id>::Assoc == <<Leaf as WithAssoc<_>>::Assoc as Id>::Assoc`
+ |
+note: required by a bound in `bound`
+ --> $DIR/generalize-proj-new-universe-index-2.rs:69:21
+ |
+LL | fn bound<T: ?Sized, U: ?Sized, V: ?Sized>()
+ | ----- required by a bound in this function
+LL | where
+LL | T: WithAssoc<U, Assoc = V>,
+ | ^^^^^^^^^ required by this bound in `bound`
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0284`.
diff --git a/tests/ui/traits/new-solver/generator.fail.stderr b/tests/ui/traits/new-solver/generator.fail.stderr
deleted file mode 100644
index e3fe4bf5a..000000000
--- a/tests/ui/traits/new-solver/generator.fail.stderr
+++ /dev/null
@@ -1,64 +0,0 @@
-error[E0277]: the trait bound `{generator@$DIR/generator.rs:18:21: 18:23}: Generator<A>` is not satisfied
- --> $DIR/generator.rs:18:21
- |
-LL | needs_generator(|| {
- | _____---------------_^
- | | |
- | | required by a bound introduced by this call
-LL | |
-LL | |
-LL | |
-LL | | yield ();
-LL | | });
- | |_____^ the trait `Generator<A>` is not implemented for `{generator@$DIR/generator.rs:18:21: 18:23}`
- |
-note: required by a bound in `needs_generator`
- --> $DIR/generator.rs:14:28
- |
-LL | fn needs_generator(_: impl Generator<A, Yield = B, Return = C>) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `needs_generator`
-
-error[E0271]: type mismatch resolving `<{generator@$DIR/generator.rs:18:21: 18:23} as Generator<A>>::Yield == B`
- --> $DIR/generator.rs:18:21
- |
-LL | needs_generator(|| {
- | _____---------------_^
- | | |
- | | required by a bound introduced by this call
-LL | |
-LL | |
-LL | |
-LL | | yield ();
-LL | | });
- | |_____^ types differ
- |
-note: required by a bound in `needs_generator`
- --> $DIR/generator.rs:14:41
- |
-LL | fn needs_generator(_: impl Generator<A, Yield = B, Return = C>) {}
- | ^^^^^^^^^ required by this bound in `needs_generator`
-
-error[E0271]: type mismatch resolving `<{generator@$DIR/generator.rs:18:21: 18:23} as Generator<A>>::Return == C`
- --> $DIR/generator.rs:18:21
- |
-LL | needs_generator(|| {
- | _____---------------_^
- | | |
- | | required by a bound introduced by this call
-LL | |
-LL | |
-LL | |
-LL | | yield ();
-LL | | });
- | |_____^ types differ
- |
-note: required by a bound in `needs_generator`
- --> $DIR/generator.rs:14:52
- |
-LL | fn needs_generator(_: impl Generator<A, Yield = B, Return = C>) {}
- | ^^^^^^^^^^ required by this bound in `needs_generator`
-
-error: aborting due to 3 previous errors
-
-Some errors have detailed explanations: E0271, E0277.
-For more information about an error, try `rustc --explain E0271`.
diff --git a/tests/ui/traits/new-solver/generator.rs b/tests/ui/traits/new-solver/generator.rs
deleted file mode 100644
index 364373ca8..000000000
--- a/tests/ui/traits/new-solver/generator.rs
+++ /dev/null
@@ -1,32 +0,0 @@
-// compile-flags: -Ztrait-solver=next
-// edition: 2021
-// revisions: pass fail
-//[pass] check-pass
-
-#![feature(generator_trait, generators)]
-
-use std::ops::Generator;
-
-struct A;
-struct B;
-struct C;
-
-fn needs_generator(_: impl Generator<A, Yield = B, Return = C>) {}
-
-#[cfg(fail)]
-fn main() {
- needs_generator(|| {
- //[fail]~^ ERROR Generator<A>` is not satisfied
- //[fail]~| ERROR as Generator<A>>::Yield == B`
- //[fail]~| ERROR as Generator<A>>::Return == C`
- yield ();
- });
-}
-
-#[cfg(pass)]
-fn main() {
- needs_generator(|_: A| {
- let _: A = yield B;
- C
- })
-}
diff --git a/tests/ui/traits/new-solver/normalize-async-closure-in-trait.rs b/tests/ui/traits/new-solver/normalize-async-closure-in-trait.rs
new file mode 100644
index 000000000..cc16cc871
--- /dev/null
+++ b/tests/ui/traits/new-solver/normalize-async-closure-in-trait.rs
@@ -0,0 +1,9 @@
+// compile-flags: -Ztrait-solver=next
+// check-pass
+// edition:2021
+
+trait Foo {
+ async fn bar() {}
+}
+
+fn main() {}
diff --git a/tests/ui/traits/new-solver/normalizes_to_ignores_unnormalizable_candidate.self_infer.stderr b/tests/ui/traits/new-solver/normalizes_to_ignores_unnormalizable_candidate.self_infer.stderr
index 062832012..f482e8cfa 100644
--- a/tests/ui/traits/new-solver/normalizes_to_ignores_unnormalizable_candidate.self_infer.stderr
+++ b/tests/ui/traits/new-solver/normalizes_to_ignores_unnormalizable_candidate.self_infer.stderr
@@ -1,9 +1,17 @@
-error[E0282]: type annotations needed
+error[E0283]: type annotations needed
--> $DIR/normalizes_to_ignores_unnormalizable_candidate.rs:36:5
|
LL | foo(unconstrained())
- | ^^^ cannot infer type of the type parameter `T` declared on the function `foo`
+ | ^^^ --------------- type must be known at this point
+ | |
+ | cannot infer type of the type parameter `T` declared on the function `foo`
|
+ = note: cannot satisfy `_: Trait`
+note: required by a bound in `foo`
+ --> $DIR/normalizes_to_ignores_unnormalizable_candidate.rs:19:11
+ |
+LL | fn foo<T: Trait<Assoc = u8>>(x: T) {}
+ | ^^^^^^^^^^^^^^^^^ required by this bound in `foo`
help: consider specifying the generic argument
|
LL | foo::<T>(unconstrained())
@@ -11,4 +19,4 @@ LL | foo::<T>(unconstrained())
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/traits/new-solver/object-unsafety.stderr b/tests/ui/traits/new-solver/object-unsafety.stderr
index bb7c68b89..914a8f9d4 100644
--- a/tests/ui/traits/new-solver/object-unsafety.stderr
+++ b/tests/ui/traits/new-solver/object-unsafety.stderr
@@ -42,7 +42,7 @@ error[E0308]: mismatched types
LL | pub fn copy_any<T>(t: &T) -> T {
| - - expected `T` because of return type
| |
- | this type parameter
+ | expected this type parameter
LL | copy::<dyn Setup<From=T>>(t)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ
|
diff --git a/tests/ui/traits/new-solver/overflow/exponential-trait-goals.rs b/tests/ui/traits/new-solver/overflow/exponential-trait-goals.rs
index b37f09ee1..3d2e70a63 100644
--- a/tests/ui/traits/new-solver/overflow/exponential-trait-goals.rs
+++ b/tests/ui/traits/new-solver/overflow/exponential-trait-goals.rs
@@ -15,6 +15,5 @@ fn impls<T: Trait>() {}
fn main() {
impls::<W<_>>();
- //~^ ERROR type annotations needed
- //~| ERROR overflow evaluating the requirement `W<_>: Trait`
+ //~^ ERROR overflow evaluating the requirement `W<_>: Trait`
}
diff --git a/tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr b/tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr
index beed40f36..023efc41a 100644
--- a/tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr
+++ b/tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr
@@ -1,9 +1,3 @@
-error[E0282]: type annotations needed
- --> $DIR/exponential-trait-goals.rs:17:5
- |
-LL | impls::<W<_>>();
- | ^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `impls`
-
error[E0275]: overflow evaluating the requirement `W<_>: Trait`
--> $DIR/exponential-trait-goals.rs:17:13
|
@@ -17,7 +11,6 @@ note: required by a bound in `impls`
LL | fn impls<T: Trait>() {}
| ^^^^^ required by this bound in `impls`
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0275, E0282.
-For more information about an error, try `rustc --explain E0275`.
+For more information about this error, try `rustc --explain E0275`.
diff --git a/tests/ui/traits/new-solver/specialization-transmute.rs b/tests/ui/traits/new-solver/specialization-transmute.rs
index f6b19e7ad..fac7d76f8 100644
--- a/tests/ui/traits/new-solver/specialization-transmute.rs
+++ b/tests/ui/traits/new-solver/specialization-transmute.rs
@@ -10,7 +10,7 @@ trait Default {
}
impl<T> Default for T {
- default type Id = T;
+ default type Id = T; //~ ERROR type annotations needed
// This will be fixed by #111994
fn intu(&self) -> &Self::Id { //~ ERROR type annotations needed
self
diff --git a/tests/ui/traits/new-solver/specialization-transmute.stderr b/tests/ui/traits/new-solver/specialization-transmute.stderr
index 09b1405fe..18965a465 100644
--- a/tests/ui/traits/new-solver/specialization-transmute.stderr
+++ b/tests/ui/traits/new-solver/specialization-transmute.stderr
@@ -16,6 +16,13 @@ LL | fn intu(&self) -> &Self::Id {
|
= note: cannot satisfy `<T as Default>::Id == _`
-error: aborting due to previous error; 1 warning emitted
+error[E0282]: type annotations needed
+ --> $DIR/specialization-transmute.rs:13:23
+ |
+LL | default type Id = T;
+ | ^ cannot infer type for associated type `<T as Default>::Id`
+
+error: aborting due to 2 previous errors; 1 warning emitted
-For more information about this error, try `rustc --explain E0284`.
+Some errors have detailed explanations: E0282, E0284.
+For more information about an error, try `rustc --explain E0282`.
diff --git a/tests/ui/traits/new-solver/specialization-unconstrained.stderr b/tests/ui/traits/new-solver/specialization-unconstrained.stderr
index 9915da1a2..ed4dafa14 100644
--- a/tests/ui/traits/new-solver/specialization-unconstrained.stderr
+++ b/tests/ui/traits/new-solver/specialization-unconstrained.stderr
@@ -8,12 +8,6 @@ LL | #![feature(specialization)]
= help: consider using `min_specialization` instead, which is more stable and complete
= note: `#[warn(incomplete_features)]` on by default
-error[E0282]: type annotations needed
- --> $DIR/specialization-unconstrained.rs:14:22
- |
-LL | default type Id = T;
- | ^ cannot infer type for associated type `<T as Default>::Id`
-
error[E0284]: type annotations needed: cannot satisfy `<u32 as Default>::Id == ()`
--> $DIR/specialization-unconstrained.rs:20:5
|
@@ -26,6 +20,12 @@ note: required by a bound in `test`
LL | fn test<T: Default<Id = U>, U>() {}
| ^^^^^^ required by this bound in `test`
+error[E0282]: type annotations needed
+ --> $DIR/specialization-unconstrained.rs:14:22
+ |
+LL | default type Id = T;
+ | ^ cannot infer type for associated type `<T as Default>::Id`
+
error: aborting due to 2 previous errors; 1 warning emitted
Some errors have detailed explanations: E0282, E0284.
diff --git a/tests/ui/traits/non-lifetime-via-dyn-builtin.current.stderr b/tests/ui/traits/non-lifetime-via-dyn-builtin.current.stderr
new file mode 100644
index 000000000..9f373cc50
--- /dev/null
+++ b/tests/ui/traits/non-lifetime-via-dyn-builtin.current.stderr
@@ -0,0 +1,11 @@
+warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/non-lifetime-via-dyn-builtin.rs:5:12
+ |
+LL | #![feature(non_lifetime_binders)]
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/traits/non-lifetime-via-dyn-builtin.next.stderr b/tests/ui/traits/non-lifetime-via-dyn-builtin.next.stderr
new file mode 100644
index 000000000..9f373cc50
--- /dev/null
+++ b/tests/ui/traits/non-lifetime-via-dyn-builtin.next.stderr
@@ -0,0 +1,11 @@
+warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/non-lifetime-via-dyn-builtin.rs:5:12
+ |
+LL | #![feature(non_lifetime_binders)]
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/traits/non-lifetime-via-dyn-builtin.rs b/tests/ui/traits/non-lifetime-via-dyn-builtin.rs
new file mode 100644
index 000000000..9a8a5ced2
--- /dev/null
+++ b/tests/ui/traits/non-lifetime-via-dyn-builtin.rs
@@ -0,0 +1,16 @@
+// revisions: current next
+//[next] compile-flags: -Ztrait-solver=next
+// check-pass
+
+#![feature(non_lifetime_binders)]
+//~^ WARN the feature `non_lifetime_binders` is incomplete and may not be safe
+
+fn trivial<A>()
+where
+ for<B> dyn Fn(A, *const B): Fn(A, *const B),
+{
+}
+
+fn main() {
+ trivial::<u8>();
+}
diff --git a/tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr b/tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr
index ed9b57cb1..d8db07277 100644
--- a/tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr
+++ b/tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr
@@ -23,13 +23,13 @@ LL | where
LL | for<V> V: Sized,
| ^^^^^ required by this bound in `foo`
-error[E0277]: the size for values of type `V` cannot be known at compilation time
+error[E0277]: `V` is not an iterator
--> $DIR/bad-sized-cond.rs:20:5
|
LL | bar();
- | ^^^ doesn't have a size known at compile-time
+ | ^^^ `V` is not an iterator
|
- = help: the trait `Sized` is not implemented for `V`
+ = help: the trait `Iterator` is not implemented for `V`
= note: required for `V` to implement `IntoIterator`
note: required by a bound in `bar`
--> $DIR/bad-sized-cond.rs:12:15
@@ -40,13 +40,13 @@ LL | where
LL | for<V> V: IntoIterator,
| ^^^^^^^^^^^^ required by this bound in `bar`
-error[E0277]: `V` is not an iterator
+error[E0277]: the size for values of type `V` cannot be known at compilation time
--> $DIR/bad-sized-cond.rs:20:5
|
LL | bar();
- | ^^^ `V` is not an iterator
+ | ^^^ doesn't have a size known at compile-time
|
- = help: the trait `Iterator` is not implemented for `V`
+ = help: the trait `Sized` is not implemented for `V`
= note: required for `V` to implement `IntoIterator`
note: required by a bound in `bar`
--> $DIR/bad-sized-cond.rs:12:15
diff --git a/tests/ui/traits/non_lifetime_binders/disqualifying-object-candidates.rs b/tests/ui/traits/non_lifetime_binders/disqualifying-object-candidates.rs
new file mode 100644
index 000000000..b999f251d
--- /dev/null
+++ b/tests/ui/traits/non_lifetime_binders/disqualifying-object-candidates.rs
@@ -0,0 +1,19 @@
+// check-pass
+
+trait Foo {
+ type Bar<T>
+ where
+ dyn Send + 'static: Send;
+}
+
+impl Foo for () {
+ type Bar<T> = i32;
+ // We take `<() as Foo>::Bar<T>: Sized` and normalize it under the where clause
+ // of `for<S> <() as Foo>::Bar<S> = i32`. This gives us back `i32: Send` with
+ // the nested obligation `(dyn Send + 'static): Send`. However, during candidate
+ // assembly for object types, we disqualify any obligations that has non-region
+ // late-bound vars in the param env(!), rather than just the predicate. This causes
+ // the where clause to not hold even though it trivially should.
+}
+
+fn main() {}
diff --git a/tests/ui/traits/non_lifetime_binders/on-rpit.rs b/tests/ui/traits/non_lifetime_binders/on-rpit.rs
new file mode 100644
index 000000000..c501e057e
--- /dev/null
+++ b/tests/ui/traits/non_lifetime_binders/on-rpit.rs
@@ -0,0 +1,16 @@
+// check-pass
+
+#![feature(non_lifetime_binders)]
+//~^ WARN the feature `non_lifetime_binders` is incomplete
+
+trait Trait<T: ?Sized> {}
+
+impl<T: ?Sized> Trait<T> for i32 {}
+
+fn produce() -> impl for<T> Trait<T> {
+ 16
+}
+
+fn main() {
+ let _ = produce();
+}
diff --git a/tests/ui/traits/non_lifetime_binders/on-rpit.stderr b/tests/ui/traits/non_lifetime_binders/on-rpit.stderr
new file mode 100644
index 000000000..34c56068c
--- /dev/null
+++ b/tests/ui/traits/non_lifetime_binders/on-rpit.stderr
@@ -0,0 +1,11 @@
+warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
+ --> $DIR/on-rpit.rs:3:12
+ |
+LL | #![feature(non_lifetime_binders)]
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
+ = note: `#[warn(incomplete_features)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/traits/non_lifetime_binders/supertrait-object-safety.stderr b/tests/ui/traits/non_lifetime_binders/supertrait-object-safety.stderr
index d56519223..b6e540c5f 100644
--- a/tests/ui/traits/non_lifetime_binders/supertrait-object-safety.stderr
+++ b/tests/ui/traits/non_lifetime_binders/supertrait-object-safety.stderr
@@ -20,6 +20,7 @@ LL | trait Foo: for<T> Bar<T> {}
| --- ^^^^^^^^^^^^^ ...because where clause cannot reference non-lifetime `for<...>` variables
| |
| this trait cannot be made into an object...
+ = help: only type `()` implements the trait, consider using it directly instead
= note: required for the cast from `&()` to `&dyn Foo`
error[E0038]: the trait `Foo` cannot be made into an object
@@ -35,6 +36,7 @@ LL | trait Foo: for<T> Bar<T> {}
| --- ^^^^^^^^^^^^^ ...because where clause cannot reference non-lifetime `for<...>` variables
| |
| this trait cannot be made into an object...
+ = help: only type `()` implements the trait, consider using it directly instead
error[E0038]: the trait `Foo` cannot be made into an object
--> $DIR/supertrait-object-safety.rs:22:5
@@ -49,6 +51,7 @@ LL | trait Foo: for<T> Bar<T> {}
| --- ^^^^^^^^^^^^^ ...because where clause cannot reference non-lifetime `for<...>` variables
| |
| this trait cannot be made into an object...
+ = help: only type `()` implements the trait, consider using it directly instead
error: aborting due to 3 previous errors; 1 warning emitted
diff --git a/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.rs b/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.rs
index 538e74ee1..e9e2f6b12 100644
--- a/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.rs
+++ b/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.rs
@@ -18,7 +18,5 @@ where
fn main() {
let a = A(B);
- a.method();
- //~^ ERROR type annotations needed
- //~| ERROR type annotations needed
+ a.method(); //~ ERROR type annotations needed
}
diff --git a/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr b/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr
index 92d9d32cf..86ae49b32 100644
--- a/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr
+++ b/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr
@@ -1,14 +1,3 @@
-error[E0282]: type annotations needed
- --> $DIR/not-suggest-non-existing-fully-qualified-path.rs:21:7
- |
-LL | a.method();
- | ^^^^^^
- |
-help: try using a fully qualified path to specify the expected types
- |
-LL | <A<B> as V<U>>::method(a);
- | +++++++++++++++++++++++ ~
-
error[E0283]: type annotations needed
--> $DIR/not-suggest-non-existing-fully-qualified-path.rs:21:7
|
@@ -35,7 +24,6 @@ help: try using a fully qualified path to specify the expected types
LL | <A<B> as V<U>>::method(a);
| +++++++++++++++++++++++ ~
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0282, E0283.
-For more information about an error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/traits/object/object-unsafe-missing-assoc-type.rs b/tests/ui/traits/object/object-unsafe-missing-assoc-type.rs
new file mode 100644
index 000000000..21f7fd92e
--- /dev/null
+++ b/tests/ui/traits/object/object-unsafe-missing-assoc-type.rs
@@ -0,0 +1,7 @@
+trait Foo {
+ type Bar<T>;
+}
+
+fn bar(x: &dyn Foo) {} //~ ERROR the trait `Foo` cannot be made into an object
+
+fn main() {}
diff --git a/tests/ui/traits/object/object-unsafe-missing-assoc-type.stderr b/tests/ui/traits/object/object-unsafe-missing-assoc-type.stderr
new file mode 100644
index 000000000..fcaa583e2
--- /dev/null
+++ b/tests/ui/traits/object/object-unsafe-missing-assoc-type.stderr
@@ -0,0 +1,18 @@
+error[E0038]: the trait `Foo` cannot be made into an object
+ --> $DIR/object-unsafe-missing-assoc-type.rs:5:16
+ |
+LL | fn bar(x: &dyn Foo) {}
+ | ^^^ `Foo` cannot be made into an object
+ |
+note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
+ --> $DIR/object-unsafe-missing-assoc-type.rs:2:10
+ |
+LL | trait Foo {
+ | --- this trait cannot be made into an object...
+LL | type Bar<T>;
+ | ^^^ ...because it contains the generic associated type `Bar`
+ = help: consider moving `Bar` to another trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0038`.
diff --git a/tests/ui/traits/object/print_vtable_sizes.stdout b/tests/ui/traits/object/print_vtable_sizes.stdout
index ce90c7621..b43e168df 100644
--- a/tests/ui/traits/object/print_vtable_sizes.stdout
+++ b/tests/ui/traits/object/print_vtable_sizes.stdout
@@ -1,11 +1,11 @@
-print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "E", "entries": "6", "entries_ignoring_upcasting": "4", "entries_for_upcasting": "2", "upcasting_cost_percent": "50" }
-print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "G", "entries": "14", "entries_ignoring_upcasting": "11", "entries_for_upcasting": "3", "upcasting_cost_percent": "27.27272727272727" }
-print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "A", "entries": "6", "entries_ignoring_upcasting": "5", "entries_for_upcasting": "1", "upcasting_cost_percent": "20" }
-print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "B", "entries": "4", "entries_ignoring_upcasting": "4", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
-print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "D", "entries": "4", "entries_ignoring_upcasting": "4", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
-print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "F", "entries": "6", "entries_ignoring_upcasting": "6", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
-print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "_::S", "entries": "3", "entries_ignoring_upcasting": "3", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
-print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "_::S", "entries": "3", "entries_ignoring_upcasting": "3", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
-print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "help::MarkerWithSuper", "entries": "4", "entries_ignoring_upcasting": "4", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
-print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "help::Super", "entries": "4", "entries_ignoring_upcasting": "4", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
-print-vtable-sizes { "crate_name": "<UNKNOWN_CRATE>", "trait_name": "help::V", "entries": "3", "entries_ignoring_upcasting": "3", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
+print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "E", "entries": "6", "entries_ignoring_upcasting": "4", "entries_for_upcasting": "2", "upcasting_cost_percent": "50" }
+print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "G", "entries": "14", "entries_ignoring_upcasting": "11", "entries_for_upcasting": "3", "upcasting_cost_percent": "27.27272727272727" }
+print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "A", "entries": "6", "entries_ignoring_upcasting": "5", "entries_for_upcasting": "1", "upcasting_cost_percent": "20" }
+print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "B", "entries": "4", "entries_ignoring_upcasting": "4", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
+print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "D", "entries": "4", "entries_ignoring_upcasting": "4", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
+print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "F", "entries": "6", "entries_ignoring_upcasting": "6", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
+print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "_::S", "entries": "3", "entries_ignoring_upcasting": "3", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
+print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "_::S", "entries": "3", "entries_ignoring_upcasting": "3", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
+print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "help::MarkerWithSuper", "entries": "4", "entries_ignoring_upcasting": "4", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
+print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "help::Super", "entries": "4", "entries_ignoring_upcasting": "4", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
+print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "help::V", "entries": "3", "entries_ignoring_upcasting": "3", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" }
diff --git a/tests/ui/traits/object/safety.stderr b/tests/ui/traits/object/safety.stderr
index a51b69759..19a46a502 100644
--- a/tests/ui/traits/object/safety.stderr
+++ b/tests/ui/traits/object/safety.stderr
@@ -11,6 +11,7 @@ LL | trait Tr {
| -- this trait cannot be made into an object...
LL | fn foo();
| ^^^ ...because associated function `foo` has no `self` parameter
+ = help: only type `St` implements the trait, consider using it directly instead
= note: required for the cast from `&St` to `&dyn Tr`
help: consider turning `foo` into a method by giving it a `&self` argument
|
@@ -34,6 +35,7 @@ LL | trait Tr {
| -- this trait cannot be made into an object...
LL | fn foo();
| ^^^ ...because associated function `foo` has no `self` parameter
+ = help: only type `St` implements the trait, consider using it directly instead
help: consider turning `foo` into a method by giving it a `&self` argument
|
LL | fn foo(&self);
diff --git a/tests/ui/traits/object/with-self-in-projection-output-bad.rs b/tests/ui/traits/object/with-self-in-projection-output-bad.rs
index f34fa80a0..9515397fb 100644
--- a/tests/ui/traits/object/with-self-in-projection-output-bad.rs
+++ b/tests/ui/traits/object/with-self-in-projection-output-bad.rs
@@ -43,8 +43,8 @@ impl NormalizableHelper for u32
fn main() {
let _x: Box<dyn Helper<Target=i32>> = Box::new(2u32);
- //~^ ERROR the value of the associated type `Output` (from trait `Base`) must be specified
+ //~^ ERROR the value of the associated type `Output` in `Base` must be specified
let _y: Box<dyn NormalizableHelper<Target=i32>> = Box::new(2u32);
- //~^ ERROR the value of the associated type `Output` (from trait `Base`) must be specified
+ //~^ ERROR the value of the associated type `Output` in `Base` must be specified
}
diff --git a/tests/ui/traits/object/with-self-in-projection-output-bad.stderr b/tests/ui/traits/object/with-self-in-projection-output-bad.stderr
index 641bfe236..c9b36e8d2 100644
--- a/tests/ui/traits/object/with-self-in-projection-output-bad.stderr
+++ b/tests/ui/traits/object/with-self-in-projection-output-bad.stderr
@@ -1,4 +1,4 @@
-error[E0191]: the value of the associated type `Output` (from trait `Base`) must be specified
+error[E0191]: the value of the associated type `Output` in `Base` must be specified
--> $DIR/with-self-in-projection-output-bad.rs:45:21
|
LL | type Output;
@@ -7,7 +7,7 @@ LL | type Output;
LL | let _x: Box<dyn Helper<Target=i32>> = Box::new(2u32);
| ^^^^^^^^^^^^^^^^^^ help: specify the associated type: `Helper<Target=i32, Output = Type>`
-error[E0191]: the value of the associated type `Output` (from trait `Base`) must be specified
+error[E0191]: the value of the associated type `Output` in `Base` must be specified
--> $DIR/with-self-in-projection-output-bad.rs:48:21
|
LL | type Output;
diff --git a/tests/ui/traits/suggest-dereferences/root-obligation.fixed b/tests/ui/traits/suggest-dereferences/root-obligation.fixed
index 7a8433f90..d03d733c7 100644
--- a/tests/ui/traits/suggest-dereferences/root-obligation.fixed
+++ b/tests/ui/traits/suggest-dereferences/root-obligation.fixed
@@ -4,7 +4,7 @@ fn get_vowel_count(string: &str) -> usize {
string
.chars()
.filter(|c| "aeiou".contains(*c))
- //~^ ERROR expected a `Fn<(char,)>` closure, found `char`
+ //~^ ERROR expected a `Fn(char)` closure, found `char`
.count()
}
diff --git a/tests/ui/traits/suggest-dereferences/root-obligation.rs b/tests/ui/traits/suggest-dereferences/root-obligation.rs
index 51bac2107..9d9ffb3f5 100644
--- a/tests/ui/traits/suggest-dereferences/root-obligation.rs
+++ b/tests/ui/traits/suggest-dereferences/root-obligation.rs
@@ -4,7 +4,7 @@ fn get_vowel_count(string: &str) -> usize {
string
.chars()
.filter(|c| "aeiou".contains(c))
- //~^ ERROR expected a `Fn<(char,)>` closure, found `char`
+ //~^ ERROR expected a `Fn(char)` closure, found `char`
.count()
}
diff --git a/tests/ui/traits/suggest-dereferences/root-obligation.stderr b/tests/ui/traits/suggest-dereferences/root-obligation.stderr
index 1363fb8c4..a19708e46 100644
--- a/tests/ui/traits/suggest-dereferences/root-obligation.stderr
+++ b/tests/ui/traits/suggest-dereferences/root-obligation.stderr
@@ -1,8 +1,8 @@
-error[E0277]: expected a `Fn<(char,)>` closure, found `char`
+error[E0277]: expected a `Fn(char)` closure, found `char`
--> $DIR/root-obligation.rs:6:38
|
LL | .filter(|c| "aeiou".contains(c))
- | -------- ^ expected an `Fn<(char,)>` closure, found `char`
+ | -------- ^ expected an `Fn(char)` closure, found `char`
| |
| required by a bound introduced by this call
|
diff --git a/tests/ui/traits/suggest-fully-qualified-closure.stderr b/tests/ui/traits/suggest-fully-qualified-closure.stderr
index 2aea3783f..43cef7027 100644
--- a/tests/ui/traits/suggest-fully-qualified-closure.stderr
+++ b/tests/ui/traits/suggest-fully-qualified-closure.stderr
@@ -1,14 +1,3 @@
-error[E0282]: type annotations needed
- --> $DIR/suggest-fully-qualified-closure.rs:23:7
- |
-LL | q.lol(||());
- | ^^^
- |
-help: try using a fully qualified path to specify the expected types
- |
-LL | <Qqq as MyTrait<T>>::lol::<{closure@}>(&q, ||());
- | +++ ~
-
error[E0283]: type annotations needed
--> $DIR/suggest-fully-qualified-closure.rs:23:7
|
@@ -28,7 +17,6 @@ help: try using a fully qualified path to specify the expected types
LL | <Qqq as MyTrait<T>>::lol::<{closure@}>(&q, ||());
| +++ ~
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0282, E0283.
-For more information about an error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/traits/suggest-fully-qualified-path-with-adjustment.rs b/tests/ui/traits/suggest-fully-qualified-path-with-adjustment.rs
index 9a2cf469d..f0861857b 100644
--- a/tests/ui/traits/suggest-fully-qualified-path-with-adjustment.rs
+++ b/tests/ui/traits/suggest-fully-qualified-path-with-adjustment.rs
@@ -42,9 +42,7 @@ impl<T> DerefMut for DerefsTo<T> {
fn main() {
let mut thing = Thing;
- thing.method();
- //~^ ERROR type annotations needed
- //~| ERROR type annotations needed
+ thing.method(); //~ ERROR type annotations needed
thing.mut_method(); //~ ERROR type annotations needed
thing.by_self(); //~ ERROR type annotations needed
diff --git a/tests/ui/traits/suggest-fully-qualified-path-with-adjustment.stderr b/tests/ui/traits/suggest-fully-qualified-path-with-adjustment.stderr
index 68b31a1ca..841acb5ff 100644
--- a/tests/ui/traits/suggest-fully-qualified-path-with-adjustment.stderr
+++ b/tests/ui/traits/suggest-fully-qualified-path-with-adjustment.stderr
@@ -1,14 +1,3 @@
-error[E0282]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:45:11
- |
-LL | thing.method();
- | ^^^^^^
- |
-help: try using a fully qualified path to specify the expected types
- |
-LL | <Thing as Method<T>>::method(&thing);
- | ++++++++++++++++++++++++++++++ ~
-
error[E0283]: type annotations needed
--> $DIR/suggest-fully-qualified-path-with-adjustment.rs:45:11
|
@@ -29,7 +18,7 @@ LL | <Thing as Method<T>>::method(&thing);
| ++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:48:11
+ --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:46:11
|
LL | thing.mut_method();
| ^^^^^^^^^^
@@ -48,7 +37,7 @@ LL | <Thing as Method<T>>::mut_method(&mut thing);
| +++++++++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:49:11
+ --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:47:11
|
LL | thing.by_self();
| ^^^^^^^
@@ -67,7 +56,7 @@ LL | <&Thing as MethodRef<T>>::by_self(&thing);
| +++++++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:52:14
+ --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:50:14
|
LL | deref_to.method();
| ^^^^^^
@@ -86,7 +75,7 @@ LL | <Thing as Method<T>>::method(&deref_to);
| ++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:53:14
+ --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:51:14
|
LL | deref_to.mut_method();
| ^^^^^^^^^^
@@ -105,7 +94,7 @@ LL | <Thing as Method<T>>::mut_method(&mut deref_to);
| +++++++++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:54:14
+ --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:52:14
|
LL | deref_to.by_self();
| ^^^^^^^
@@ -124,7 +113,7 @@ LL | <&Thing as MethodRef<T>>::by_self(&deref_to);
| +++++++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:57:20
+ --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:55:20
|
LL | deref_deref_to.method();
| ^^^^^^
@@ -143,7 +132,7 @@ LL | <Thing as Method<T>>::method(&deref_deref_to);
| ++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:58:20
+ --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:56:20
|
LL | deref_deref_to.mut_method();
| ^^^^^^^^^^
@@ -162,7 +151,7 @@ LL | <Thing as Method<T>>::mut_method(&mut deref_deref_to);
| +++++++++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:59:20
+ --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:57:20
|
LL | deref_deref_to.by_self();
| ^^^^^^^
@@ -180,7 +169,6 @@ help: try using a fully qualified path to specify the expected types
LL | <&Thing as MethodRef<T>>::by_self(&deref_deref_to);
| +++++++++++++++++++++++++++++++++++ ~
-error: aborting due to 10 previous errors
+error: aborting due to 9 previous errors
-Some errors have detailed explanations: E0282, E0283.
-For more information about an error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/traits/suggest-fully-qualified-path-without-adjustment.rs b/tests/ui/traits/suggest-fully-qualified-path-without-adjustment.rs
index da640c8c8..6a63e27f7 100644
--- a/tests/ui/traits/suggest-fully-qualified-path-without-adjustment.rs
+++ b/tests/ui/traits/suggest-fully-qualified-path-without-adjustment.rs
@@ -42,9 +42,7 @@ impl<T> DerefMut for DerefsTo<T> {
fn main() {
let mut ref_thing = &Thing;
- ref_thing.method();
- //~^ ERROR type annotations needed
- //~| ERROR type annotations needed
+ ref_thing.method(); //~ ERROR type annotations needed
ref_thing.by_self(); //~ ERROR type annotations needed
let mut mut_thing = &mut Thing;
diff --git a/tests/ui/traits/suggest-fully-qualified-path-without-adjustment.stderr b/tests/ui/traits/suggest-fully-qualified-path-without-adjustment.stderr
index 27518a54e..1865d81ba 100644
--- a/tests/ui/traits/suggest-fully-qualified-path-without-adjustment.stderr
+++ b/tests/ui/traits/suggest-fully-qualified-path-without-adjustment.stderr
@@ -1,14 +1,3 @@
-error[E0282]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:45:15
- |
-LL | ref_thing.method();
- | ^^^^^^
- |
-help: try using a fully qualified path to specify the expected types
- |
-LL | <Thing as Method<T>>::method(ref_thing);
- | +++++++++++++++++++++++++++++ ~
-
error[E0283]: type annotations needed
--> $DIR/suggest-fully-qualified-path-without-adjustment.rs:45:15
|
@@ -29,7 +18,7 @@ LL | <Thing as Method<T>>::method(ref_thing);
| +++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:48:15
+ --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:46:15
|
LL | ref_thing.by_self();
| ^^^^^^^
@@ -48,7 +37,7 @@ LL | <&Thing as MethodRef<T>>::by_self(ref_thing);
| ++++++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:51:15
+ --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:49:15
|
LL | mut_thing.method();
| ^^^^^^
@@ -67,7 +56,7 @@ LL | <Thing as Method<T>>::method(mut_thing);
| +++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:52:15
+ --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:50:15
|
LL | mut_thing.mut_method();
| ^^^^^^^^^^
@@ -86,7 +75,7 @@ LL | <Thing as Method<T>>::mut_method(mut_thing);
| +++++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:53:15
+ --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:51:15
|
LL | mut_thing.by_self();
| ^^^^^^^
@@ -105,7 +94,7 @@ LL | <&Thing as MethodRef<T>>::by_self(mut_thing);
| ++++++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:56:14
+ --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:54:14
|
LL | deref_to.method();
| ^^^^^^
@@ -124,7 +113,7 @@ LL | <Thing as Method<T>>::method(deref_to);
| +++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:57:14
+ --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:55:14
|
LL | deref_to.mut_method();
| ^^^^^^^^^^
@@ -143,7 +132,7 @@ LL | <Thing as Method<T>>::mut_method(deref_to);
| +++++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:58:14
+ --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:56:14
|
LL | deref_to.by_self();
| ^^^^^^^
@@ -162,7 +151,7 @@ LL | <&Thing as MethodRef<T>>::by_self(deref_to);
| ++++++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:61:20
+ --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:59:20
|
LL | deref_deref_to.method();
| ^^^^^^
@@ -181,7 +170,7 @@ LL | <Thing as Method<T>>::method(deref_deref_to);
| +++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:62:20
+ --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:60:20
|
LL | deref_deref_to.mut_method();
| ^^^^^^^^^^
@@ -200,7 +189,7 @@ LL | <Thing as Method<T>>::mut_method(deref_deref_to);
| +++++++++++++++++++++++++++++++++ ~
error[E0283]: type annotations needed
- --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:63:20
+ --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:61:20
|
LL | deref_deref_to.by_self();
| ^^^^^^^
@@ -218,7 +207,6 @@ help: try using a fully qualified path to specify the expected types
LL | <&Thing as MethodRef<T>>::by_self(deref_deref_to);
| ++++++++++++++++++++++++++++++++++ ~
-error: aborting due to 12 previous errors
+error: aborting due to 11 previous errors
-Some errors have detailed explanations: E0282, E0283.
-For more information about an error, try `rustc --explain E0282`.
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/traits/test-2.stderr b/tests/ui/traits/test-2.stderr
index 74a0fc427..3972e5397 100644
--- a/tests/ui/traits/test-2.stderr
+++ b/tests/ui/traits/test-2.stderr
@@ -42,6 +42,9 @@ LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); }
| this trait cannot be made into an object...
= help: consider moving `dup` to another trait
= help: consider moving `blah` to another trait
+ = help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `bar` for this new enum and using it instead:
+ i32
+ u32
error[E0038]: the trait `bar` cannot be made into an object
--> $DIR/test-2.rs:13:5
@@ -59,6 +62,9 @@ LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); }
| this trait cannot be made into an object...
= help: consider moving `dup` to another trait
= help: consider moving `blah` to another trait
+ = help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `bar` for this new enum and using it instead:
+ i32
+ u32
error[E0038]: the trait `bar` cannot be made into an object
--> $DIR/test-2.rs:13:6
@@ -76,6 +82,9 @@ LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); }
| this trait cannot be made into an object...
= help: consider moving `dup` to another trait
= help: consider moving `blah` to another trait
+ = help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `bar` for this new enum and using it instead:
+ i32
+ u32
= note: required for the cast from `Box<{integer}>` to `Box<dyn bar>`
error: aborting due to 5 previous errors