summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-08-16 11:16:44 +0000
committerbors <bors@rust-lang.org>2020-08-16 11:16:44 +0000
commit97ba0c7171c4d2d9b899a2bd8e40a8974c47b86d (patch)
tree22603fcd15f78b1044746a48b2b282b8983cb0c6
parentde32266a1780aa4ef748ce7f6200a1554fad0aca (diff)
parent0afb9c28bb80467cf2af8e9cd1f1b6af63744004 (diff)
downloadrust-97ba0c7171c4d2d9b899a2bd8e40a8974c47b86d.tar.gz
Auto merge of #75536 - estebank:e0255-suggestion, r=varkor
Tweak output of E0225 When encountering multiple non-auto trait bounds suggest creating a new trait and explain what auto-traits are. _Inspired by https://fasterthanli.me/articles/frustrated-its-not-you-its-rust_
-rw-r--r--src/librustc_trait_selection/traits/util.rs12
-rw-r--r--src/librustc_typeck/astconv.rs14
-rw-r--r--src/test/ui/associated-types/missing-associated-types.stderr40
-rw-r--r--src/test/ui/bad/bad-sized.stderr10
-rw-r--r--src/test/ui/error-codes/E0225.stderr13
-rw-r--r--src/test/ui/issues/issue-22560.stderr10
-rw-r--r--src/test/ui/issues/issue-32963.stderr20
-rw-r--r--src/test/ui/parser/trait-object-trait-parens.stderr30
-rw-r--r--src/test/ui/traits/trait-alias/trait-alias-no-duplicates.stderr109
-rw-r--r--src/test/ui/traits/trait-alias/trait-alias-no-extra-traits.stderr126
-rw-r--r--src/test/ui/traits/wf-trait-object-no-duplicates.stderr50
11 files changed, 295 insertions, 139 deletions
diff --git a/src/librustc_trait_selection/traits/util.rs b/src/librustc_trait_selection/traits/util.rs
index cc8997078e0..f626bb0b7e3 100644
--- a/src/librustc_trait_selection/traits/util.rs
+++ b/src/librustc_trait_selection/traits/util.rs
@@ -53,10 +53,14 @@ impl<'tcx> TraitAliasExpansionInfo<'tcx> {
diag.span_label(*sp, format!("referenced here ({})", use_desc));
}
}
- diag.span_label(
- self.bottom().1,
- format!("trait alias used in trait object type ({})", use_desc),
- );
+ if self.top().1 != self.bottom().1 {
+ // When the trait object is in a return type these two spans match, we don't want
+ // redundant labels.
+ diag.span_label(
+ self.bottom().1,
+ format!("trait alias used in trait object type ({})", use_desc),
+ );
+ }
}
pub fn trait_ref(&self) -> ty::PolyTraitRef<'tcx> {
diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs
index 05cbb0a9705..5170a060c5f 100644
--- a/src/librustc_typeck/astconv.rs
+++ b/src/librustc_typeck/astconv.rs
@@ -1666,6 +1666,20 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
"additional use",
);
first_trait.label_with_exp_info(&mut err, "first non-auto trait", "first use");
+ err.help(&format!(
+ "consider creating a new trait with all of these as super-traits and using that \
+ trait here instead: `trait NewTrait: {} {{}}`",
+ regular_traits
+ .iter()
+ .map(|t| t.trait_ref().print_only_trait_path().to_string())
+ .collect::<Vec<_>>()
+ .join(" + "),
+ ));
+ err.note(
+ "auto-traits like `Send` and `Sync` are traits that have special properties; \
+ for more information on them, visit \
+ <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>",
+ );
err.emit();
}
diff --git a/src/test/ui/associated-types/missing-associated-types.stderr b/src/test/ui/associated-types/missing-associated-types.stderr
index f9951170acd..49003c74450 100644
--- a/src/test/ui/associated-types/missing-associated-types.stderr
+++ b/src/test/ui/associated-types/missing-associated-types.stderr
@@ -2,12 +2,12 @@ error[E0225]: only auto traits can be used as additional traits in a trait objec
--> $DIR/missing-associated-types.rs:12:32
|
LL | type Foo<Rhs> = dyn Add<Rhs> + Sub<Rhs> + X<Rhs> + Y<Rhs>;
- | -------- ^^^^^^^^
- | | |
- | | additional non-auto trait
- | | trait alias used in trait object type (additional use)
+ | -------- ^^^^^^^^ additional non-auto trait
+ | |
| first non-auto trait
- | trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: std::ops::Add<Rhs> + std::ops::Sub<Rhs> + X<Rhs> + Y<Rhs> {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0191]: the value of the associated types `A` (from trait `Y`), `Output` (from trait `std::ops::Add`), `Output` (from trait `std::ops::Mul`), `Output` (from trait `std::ops::Sub`) must be specified
--> $DIR/missing-associated-types.rs:12:21
@@ -31,12 +31,12 @@ error[E0225]: only auto traits can be used as additional traits in a trait objec
--> $DIR/missing-associated-types.rs:15:32
|
LL | type Bar<Rhs> = dyn Add<Rhs> + Sub<Rhs> + X<Rhs> + Z<Rhs>;
- | -------- ^^^^^^^^
- | | |
- | | additional non-auto trait
- | | trait alias used in trait object type (additional use)
+ | -------- ^^^^^^^^ additional non-auto trait
+ | |
| first non-auto trait
- | trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: std::ops::Add<Rhs> + std::ops::Sub<Rhs> + X<Rhs> + Z<Rhs> {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0191]: the value of the associated types `A` (from trait `Z`), `B` (from trait `Z`), `Output` (from trait `std::ops::Add`), `Output` (from trait `std::ops::Div`), `Output` (from trait `std::ops::Div`), `Output` (from trait `std::ops::Mul`), `Output` (from trait `std::ops::Sub`) must be specified
--> $DIR/missing-associated-types.rs:15:21
@@ -67,12 +67,12 @@ error[E0225]: only auto traits can be used as additional traits in a trait objec
--> $DIR/missing-associated-types.rs:18:32
|
LL | type Baz<Rhs> = dyn Add<Rhs> + Sub<Rhs> + Y<Rhs>;
- | -------- ^^^^^^^^
- | | |
- | | additional non-auto trait
- | | trait alias used in trait object type (additional use)
+ | -------- ^^^^^^^^ additional non-auto trait
+ | |
| first non-auto trait
- | trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: std::ops::Add<Rhs> + std::ops::Sub<Rhs> + Y<Rhs> {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0191]: the value of the associated types `A` (from trait `Y`), `Output` (from trait `std::ops::Add`), `Output` (from trait `std::ops::Sub`) must be specified
--> $DIR/missing-associated-types.rs:18:21
@@ -95,12 +95,12 @@ error[E0225]: only auto traits can be used as additional traits in a trait objec
--> $DIR/missing-associated-types.rs:21:32
|
LL | type Bat<Rhs> = dyn Add<Rhs> + Sub<Rhs> + Fine<Rhs>;
- | -------- ^^^^^^^^
- | | |
- | | additional non-auto trait
- | | trait alias used in trait object type (additional use)
+ | -------- ^^^^^^^^ additional non-auto trait
+ | |
| first non-auto trait
- | trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: std::ops::Add<Rhs> + std::ops::Sub<Rhs> + Fine<Rhs> {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0191]: the value of the associated types `Output` (from trait `std::ops::Add`), `Output` (from trait `std::ops::Sub`) must be specified
--> $DIR/missing-associated-types.rs:21:21
diff --git a/src/test/ui/bad/bad-sized.stderr b/src/test/ui/bad/bad-sized.stderr
index 90edbe2de6b..93984f1c372 100644
--- a/src/test/ui/bad/bad-sized.stderr
+++ b/src/test/ui/bad/bad-sized.stderr
@@ -2,12 +2,12 @@ error[E0225]: only auto traits can be used as additional traits in a trait objec
--> $DIR/bad-sized.rs:4:28
|
LL | let x: Vec<dyn Trait + Sized> = Vec::new();
- | ----- ^^^^^
- | | |
- | | additional non-auto trait
- | | trait alias used in trait object type (additional use)
+ | ----- ^^^^^ additional non-auto trait
+ | |
| first non-auto trait
- | trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Trait + std::marker::Sized {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time
--> $DIR/bad-sized.rs:4:12
diff --git a/src/test/ui/error-codes/E0225.stderr b/src/test/ui/error-codes/E0225.stderr
index c7a66c327f1..435a2c93962 100644
--- a/src/test/ui/error-codes/E0225.stderr
+++ b/src/test/ui/error-codes/E0225.stderr
@@ -2,12 +2,12 @@ error[E0225]: only auto traits can be used as additional traits in a trait objec
--> $DIR/E0225.rs:6:36
|
LL | let _: Box<dyn std::io::Read + std::io::Write>;
- | ------------- ^^^^^^^^^^^^^^
- | | |
- | | additional non-auto trait
- | | trait alias used in trait object type (additional use)
+ | ------------- ^^^^^^^^^^^^^^ additional non-auto trait
+ | |
| first non-auto trait
- | trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: std::io::Read + std::io::Write {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/E0225.rs:8:20
@@ -22,6 +22,9 @@ LL | let _: Box<dyn Foo>;
| |
| trait alias used in trait object type (additional use)
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: std::io::Read + std::io::Write {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error: aborting due to 2 previous errors
diff --git a/src/test/ui/issues/issue-22560.stderr b/src/test/ui/issues/issue-22560.stderr
index e5e50ddd155..9dda99109fa 100644
--- a/src/test/ui/issues/issue-22560.stderr
+++ b/src/test/ui/issues/issue-22560.stderr
@@ -28,12 +28,12 @@ error[E0225]: only auto traits can be used as additional traits in a trait objec
--> $DIR/issue-22560.rs:9:23
|
LL | type Test = dyn Add + Sub;
- | --- ^^^
- | | |
- | | additional non-auto trait
- | | trait alias used in trait object type (additional use)
+ | --- ^^^ additional non-auto trait
+ | |
| first non-auto trait
- | trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Add<[type error]> + Sub<[type error]> {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0191]: the value of the associated types `Output` (from trait `Add`), `Output` (from trait `Sub`) must be specified
--> $DIR/issue-22560.rs:9:17
diff --git a/src/test/ui/issues/issue-32963.stderr b/src/test/ui/issues/issue-32963.stderr
index 34d5c894e36..f9628f2c2ec 100644
--- a/src/test/ui/issues/issue-32963.stderr
+++ b/src/test/ui/issues/issue-32963.stderr
@@ -2,23 +2,23 @@ error[E0225]: only auto traits can be used as additional traits in a trait objec
--> $DIR/issue-32963.rs:8:31
|
LL | size_of_copy::<dyn Misc + Copy>();
- | ---- ^^^^
- | | |
- | | additional non-auto trait
- | | trait alias used in trait object type (additional use)
+ | ---- ^^^^ additional non-auto trait
+ | |
| first non-auto trait
- | trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Misc + std::marker::Copy {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/issue-32963.rs:8:31
|
LL | size_of_copy::<dyn Misc + Copy>();
- | ---- ^^^^
- | | |
- | | additional non-auto trait
- | | trait alias used in trait object type (additional use)
+ | ---- ^^^^ additional non-auto trait
+ | |
| first non-auto trait
- | trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Misc + std::marker::Copy {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0277]: the trait bound `dyn Misc: std::marker::Copy` is not satisfied
--> $DIR/issue-32963.rs:8:5
diff --git a/src/test/ui/parser/trait-object-trait-parens.stderr b/src/test/ui/parser/trait-object-trait-parens.stderr
index 62da99bc47d..6efbfad8f38 100644
--- a/src/test/ui/parser/trait-object-trait-parens.stderr
+++ b/src/test/ui/parser/trait-object-trait-parens.stderr
@@ -40,34 +40,34 @@ error[E0225]: only auto traits can be used as additional traits in a trait objec
--> $DIR/trait-object-trait-parens.rs:8:35
|
LL | let _: Box<(Obj) + (?Sized) + (for<'a> Trait<'a>)>;
- | ----- ^^^^^^^^^^^^^^^^^^^
- | | |
- | | additional non-auto trait
- | | trait alias used in trait object type (additional use)
+ | ----- ^^^^^^^^^^^^^^^^^^^ additional non-auto trait
+ | |
| first non-auto trait
- | trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Obj + for<'a> Trait<'a> {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-object-trait-parens.rs:12:49
|
LL | let _: Box<(?Sized) + (for<'a> Trait<'a>) + (Obj)>;
- | ------------------- ^^^^^
- | | |
- | | additional non-auto trait
- | | trait alias used in trait object type (additional use)
+ | ------------------- ^^^^^ additional non-auto trait
+ | |
| first non-auto trait
- | trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: for<'a> Trait<'a> + Obj {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-object-trait-parens.rs:16:38
|
LL | let _: Box<(for<'a> Trait<'a>) + (Obj) + (?Sized)>;
- | ----------------- ^^^^^
- | | |
- | | additional non-auto trait
- | | trait alias used in trait object type (additional use)
+ | ----------------- ^^^^^ additional non-auto trait
+ | |
| first non-auto trait
- | trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: for<'a> Trait<'a> + Obj {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error: aborting due to 6 previous errors; 3 warnings emitted
diff --git a/src/test/ui/traits/trait-alias/trait-alias-no-duplicates.stderr b/src/test/ui/traits/trait-alias/trait-alias-no-duplicates.stderr
index 6df1df86508..b297d54375c 100644
--- a/src/test/ui/traits/trait-alias/trait-alias-no-duplicates.stderr
+++ b/src/test/ui/traits/trait-alias/trait-alias-no-duplicates.stderr
@@ -11,6 +11,9 @@ LL | type _T00 = dyn _0 + _0;
| -- ^^ trait alias used in trait object type (additional use)
| |
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Obj + Obj {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:19:22
@@ -27,6 +30,9 @@ LL | type _T01 = dyn _1 + _0;
| -- ^^ trait alias used in trait object type (additional use)
| |
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Obj + Obj {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:22:22
@@ -46,6 +52,9 @@ LL | type _T02 = dyn _1 + _1;
| -- ^^ trait alias used in trait object type (additional use)
| |
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Obj + Obj {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:25:23
@@ -59,7 +68,9 @@ LL | type _T03 = dyn Obj + _1;
| --- ^^ trait alias used in trait object type (additional use)
| |
| first non-auto trait
- | trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Obj + Obj {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:28:22
@@ -70,11 +81,12 @@ LL | trait _1 = _0;
| -- referenced here (first use)
...
LL | type _T04 = dyn _1 + Obj;
- | -- ^^^
- | | |
- | | additional non-auto trait
- | | trait alias used in trait object type (additional use)
+ | -- ^^^ additional non-auto trait
+ | |
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Obj + Obj {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:37:17
@@ -97,6 +109,9 @@ LL | type _T10 = dyn _2 + _3;
| |
| trait alias used in trait object type (additional use)
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Obj + Obj + Obj {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:40:22
@@ -113,6 +128,9 @@ LL | type _T11 = dyn _3 + _2;
| -- ^^ trait alias used in trait object type (additional use)
| |
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Obj + Obj + Obj {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:43:23
@@ -127,7 +145,9 @@ LL | type _T12 = dyn Obj + _2;
| --- ^^ trait alias used in trait object type (additional use)
| |
| first non-auto trait
- | trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Obj + Obj + Obj {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:46:17
@@ -150,6 +170,9 @@ LL | type _T13 = dyn _2 + Obj;
| |
| trait alias used in trait object type (additional use)
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Obj + Obj + Obj {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:49:22
@@ -166,6 +189,9 @@ LL | type _T14 = dyn _1 + _3;
| -- ^^ trait alias used in trait object type (additional use)
| |
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Obj + Obj {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:52:22
@@ -182,6 +208,9 @@ LL | type _T15 = dyn _3 + _1;
| -- ^^ trait alias used in trait object type (additional use)
| |
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Obj + Obj {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:55:22
@@ -200,6 +229,9 @@ LL | type _T16 = dyn _1 + _4;
| -- ^^ trait alias used in trait object type (additional use)
| |
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Obj + Obj {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:58:22
@@ -218,6 +250,9 @@ LL | type _T17 = dyn _4 + _1;
| -- ^^ trait alias used in trait object type (additional use)
| |
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Obj + Obj {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:65:22
@@ -232,6 +267,9 @@ LL | type _T20 = dyn _5 + _5;
| -- ^^ trait alias used in trait object type (additional use)
| |
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Obj + Obj {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:68:23
@@ -243,7 +281,9 @@ LL | type _T21 = dyn Obj + _5;
| --- ^^ trait alias used in trait object type (additional use)
| |
| first non-auto trait
- | trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Obj + Obj {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:71:22
@@ -252,11 +292,12 @@ LL | trait _5 = Obj + Send;
| --- first non-auto trait
...
LL | type _T22 = dyn _5 + Obj;
- | -- ^^^
- | | |
- | | additional non-auto trait
- | | trait alias used in trait object type (additional use)
+ | -- ^^^ additional non-auto trait
+ | |
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Obj + Obj {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:74:36
@@ -265,11 +306,12 @@ LL | trait _5 = Obj + Send;
| --- first non-auto trait
...
LL | type _T23 = dyn _5 + Send + Sync + Obj;
- | -- ^^^
- | | |
- | | additional non-auto trait
- | | trait alias used in trait object type (additional use)
+ | -- ^^^ additional non-auto trait
+ | |
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Obj + Obj {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:81:17
@@ -290,6 +332,9 @@ LL | type _T30 = dyn _6;
| |
| trait alias used in trait object type (additional use)
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Obj + Obj {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:84:17
@@ -310,6 +355,9 @@ LL | type _T31 = dyn _6 + Send;
| |
| trait alias used in trait object type (additional use)
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Obj + Obj {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:87:24
@@ -330,6 +378,9 @@ LL | type _T32 = dyn Send + _6;
| |
| trait alias used in trait object type (additional use)
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Obj + Obj {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:95:22
@@ -343,11 +394,12 @@ LL | trait _8 = Unpin + _7;
| -- referenced here (first use)
LL |
LL | type _T40 = dyn _8 + Obj;
- | -- ^^^
- | | |
- | | additional non-auto trait
- | | trait alias used in trait object type (additional use)
+ | -- ^^^ additional non-auto trait
+ | |
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Obj + Obj {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:98:23
@@ -364,7 +416,9 @@ LL | type _T41 = dyn Obj + _8;
| --- ^^ trait alias used in trait object type (additional use)
| |
| first non-auto trait
- | trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Obj + Obj {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:101:22
@@ -386,6 +440,9 @@ LL | type _T42 = dyn _8 + _4;
| -- ^^ trait alias used in trait object type (additional use)
| |
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Obj + Obj {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:104:22
@@ -407,6 +464,9 @@ LL | type _T43 = dyn _4 + _8;
| -- ^^ trait alias used in trait object type (additional use)
| |
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Obj + Obj {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:107:36
@@ -428,6 +488,9 @@ LL | type _T44 = dyn _4 + Send + Sync + _8;
| -- ^^ trait alias used in trait object type (additional use)
| |
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Obj + Obj {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:117:22
@@ -440,6 +503,9 @@ LL | type _T50 = dyn _9 + _10;
| -- ^^^ trait alias used in trait object type (additional use)
| |
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: for<'a> ObjL<'a> + for<'b> ObjL<'b> {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-duplicates.rs:123:23
@@ -452,6 +518,9 @@ LL | type _T60 = dyn _11 + _12;
| --- ^^^ trait alias used in trait object type (additional use)
| |
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: ObjT<for<'a> fn(&'a u8)> + ObjT<for<'b> fn(&'b u8)> {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error: aborting due to 27 previous errors
diff --git a/src/test/ui/traits/trait-alias/trait-alias-no-extra-traits.stderr b/src/test/ui/traits/trait-alias/trait-alias-no-extra-traits.stderr
index 15685a22883..1d7b3fa112b 100644
--- a/src/test/ui/traits/trait-alias/trait-alias-no-extra-traits.stderr
+++ b/src/test/ui/traits/trait-alias/trait-alias-no-extra-traits.stderr
@@ -5,11 +5,12 @@ LL | trait _0 = ObjA;
| ---- first non-auto trait
...
LL | type _T00 = dyn _0 + ObjB;
- | -- ^^^^
- | | |
- | | additional non-auto trait
- | | trait alias used in trait object type (additional use)
+ | -- ^^^^ additional non-auto trait
+ | |
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: ObjA + ObjB {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:19:24
@@ -21,7 +22,9 @@ LL | type _T01 = dyn ObjB + _0;
| ---- ^^ trait alias used in trait object type (additional use)
| |
| first non-auto trait
- | trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: ObjB + ObjA {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:22:24
@@ -35,7 +38,9 @@ LL | type _T02 = dyn ObjB + _1;
| ---- ^^ trait alias used in trait object type (additional use)
| |
| first non-auto trait
- | trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: ObjB + ObjA {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:25:22
@@ -46,11 +51,12 @@ LL | trait _1 = _0;
| -- referenced here (first use)
...
LL | type _T03 = dyn _1 + ObjB;
- | -- ^^^^
- | | |
- | | additional non-auto trait
- | | trait alias used in trait object type (additional use)
+ | -- ^^^^ additional non-auto trait
+ | |
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: ObjA + ObjB {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:34:22
@@ -67,6 +73,9 @@ LL | type _T10 = dyn _2 + _3;
| -- ^^ trait alias used in trait object type (additional use)
| |
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: ObjB + ObjB {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:37:22
@@ -83,6 +92,9 @@ LL | type _T11 = dyn _3 + _2;
| -- ^^ trait alias used in trait object type (additional use)
| |
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: ObjB + ObjB {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:40:22
@@ -101,6 +113,9 @@ LL | type _T12 = dyn _2 + _4;
| -- ^^ trait alias used in trait object type (additional use)
| |
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: ObjB + ObjB {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:43:22
@@ -119,6 +134,9 @@ LL | type _T13 = dyn _4 + _2;
| -- ^^ trait alias used in trait object type (additional use)
| |
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: ObjB + ObjB {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:50:22
@@ -135,6 +153,9 @@ LL | type _T20 = dyn _5 + _1;
| -- ^^ trait alias used in trait object type (additional use)
| |
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: ObjB + ObjA {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:53:22
@@ -151,6 +172,9 @@ LL | type _T21 = dyn _1 + _5;
| -- ^^ trait alias used in trait object type (additional use)
| |
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: ObjA + ObjB {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:56:22
@@ -159,11 +183,12 @@ LL | trait _5 = Sync + ObjB + Send;
| ---- first non-auto trait
...
LL | type _T22 = dyn _5 + ObjA;
- | -- ^^^^
- | | |
- | | additional non-auto trait
- | | trait alias used in trait object type (additional use)
+ | -- ^^^^ additional non-auto trait
+ | |
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: ObjB + ObjA {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:59:24
@@ -175,7 +200,9 @@ LL | type _T23 = dyn ObjA + _5;
| ---- ^^ trait alias used in trait object type (additional use)
| |
| first non-auto trait
- | trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: ObjA + ObjB {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:62:29
@@ -192,6 +219,9 @@ LL | type _T24 = dyn Send + _5 + _1 + Sync;
| -- ^^ trait alias used in trait object type (additional use)
| |
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: ObjB + ObjA {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:65:29
@@ -208,6 +238,9 @@ LL | type _T25 = dyn _1 + Sync + _5 + Send;
| -- ^^ trait alias used in trait object type (additional use)
| |
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: ObjA + ObjB {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:68:36
@@ -216,11 +249,12 @@ LL | trait _5 = Sync + ObjB + Send;
| ---- first non-auto trait
...
LL | type _T26 = dyn Sync + Send + _5 + ObjA;
- | -- ^^^^
- | | |
- | | additional non-auto trait
- | | trait alias used in trait object type (additional use)
+ | -- ^^^^ additional non-auto trait
+ | |
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: ObjB + ObjA {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:71:38
@@ -232,7 +266,9 @@ LL | type _T27 = dyn Send + Sync + ObjA + _5;
| ---- ^^ trait alias used in trait object type (additional use)
| |
| first non-auto trait
- | trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: ObjA + ObjB {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:80:17
@@ -255,6 +291,9 @@ LL | type _T30 = dyn _6;
| |
| trait alias used in trait object type (additional use)
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: ObjA + ObjB {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:83:17
@@ -277,6 +316,9 @@ LL | type _T31 = dyn _6 + Send;
| |
| trait alias used in trait object type (additional use)
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: ObjA + ObjB {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:86:24
@@ -299,6 +341,9 @@ LL | type _T32 = dyn Send + _6;
| |
| trait alias used in trait object type (additional use)
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: ObjA + ObjB {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:89:17
@@ -331,6 +376,9 @@ LL | type _T33 = dyn _8;
| |
| trait alias used in trait object type (additional use)
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: ObjA + ObjB {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:92:17
@@ -363,6 +411,9 @@ LL | type _T34 = dyn _8 + Send;
| |
| trait alias used in trait object type (additional use)
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: ObjA + ObjB {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:95:24
@@ -395,6 +446,9 @@ LL | type _T35 = dyn Send + _8;
| |
| trait alias used in trait object type (additional use)
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: ObjA + ObjB {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:103:23
@@ -408,11 +462,12 @@ LL | trait _10 = Unpin + _9;
| -- referenced here (first use)
LL |
LL | type _T40 = dyn _10 + ObjA;
- | --- ^^^^
- | | |
- | | additional non-auto trait
- | | trait alias used in trait object type (additional use)
+ | --- ^^^^ additional non-auto trait
+ | |
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: ObjB + ObjA {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:106:24
@@ -429,7 +484,9 @@ LL | type _T41 = dyn ObjA + _10;
| ---- ^^^ trait alias used in trait object type (additional use)
| |
| first non-auto trait
- | trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: ObjA + ObjB {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:109:23
@@ -451,6 +508,9 @@ LL | type _T42 = dyn _10 + _1;
| --- ^^ trait alias used in trait object type (additional use)
| |
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: ObjB + ObjA {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:112:37
@@ -464,11 +524,12 @@ LL | trait _10 = Unpin + _9;
| -- referenced here (first use)
...
LL | type _T43 = dyn Send + _10 + Sync + ObjA;
- | --- ^^^^
- | | |
- | | additional non-auto trait
- | | trait alias used in trait object type (additional use)
+ | --- ^^^^ additional non-auto trait
+ | |
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: ObjB + ObjA {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:115:24
@@ -485,7 +546,9 @@ LL | type _T44 = dyn ObjA + _10 + Send + Sync;
| ---- ^^^ trait alias used in trait object type (additional use)
| |
| first non-auto trait
- | trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: ObjA + ObjB {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/trait-alias-no-extra-traits.rs:118:37
@@ -507,6 +570,9 @@ LL | type _T45 = dyn Sync + Send + _10 + _1;
| --- ^^ trait alias used in trait object type (additional use)
| |
| trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: ObjB + ObjA {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error: aborting due to 28 previous errors
diff --git a/src/test/ui/traits/wf-trait-object-no-duplicates.stderr b/src/test/ui/traits/wf-trait-object-no-duplicates.stderr
index 269d92fe43d..ed5409d0159 100644
--- a/src/test/ui/traits/wf-trait-object-no-duplicates.stderr
+++ b/src/test/ui/traits/wf-trait-object-no-duplicates.stderr
@@ -2,56 +2,56 @@ error[E0225]: only auto traits can be used as additional traits in a trait objec
--> $DIR/wf-trait-object-no-duplicates.rs:8:21
|
LL | type _0 = dyn Obj + Obj;
- | --- ^^^
- | | |
- | | additional non-auto trait
- | | trait alias used in trait object type (additional use)
+ | --- ^^^ additional non-auto trait
+ | |
| first non-auto trait
- | trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Obj + Obj {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/wf-trait-object-no-duplicates.rs:13:28
|
LL | type _1 = dyn Send + Obj + Obj;
- | --- ^^^
- | | |
- | | additional non-auto trait
- | | trait alias used in trait object type (additional use)
+ | --- ^^^ additional non-auto trait
+ | |
| first non-auto trait
- | trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Obj + Obj {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/wf-trait-object-no-duplicates.rs:16:28
|
LL | type _2 = dyn Obj + Send + Obj;
- | --- ^^^
- | | |
- | | additional non-auto trait
- | | trait alias used in trait object type (additional use)
+ | --- ^^^ additional non-auto trait
+ | |
| first non-auto trait
- | trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Obj + Obj {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/wf-trait-object-no-duplicates.rs:26:34
|
LL | type _4 = dyn for<'a> ObjL<'a> + for<'b> ObjL<'b>;
- | ---------------- ^^^^^^^^^^^^^^^^
- | | |
- | | additional non-auto trait
- | | trait alias used in trait object type (additional use)
+ | ---------------- ^^^^^^^^^^^^^^^^ additional non-auto trait
+ | |
| first non-auto trait
- | trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: for<'a> ObjL<'a> + for<'b> ObjL<'b> {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error[E0225]: only auto traits can be used as additional traits in a trait object
--> $DIR/wf-trait-object-no-duplicates.rs:30:42
|
LL | type _5 = dyn ObjT<for<'a> fn(&'a u8)> + ObjT<for<'b> fn(&'b u8)>;
- | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^
- | | |
- | | additional non-auto trait
- | | trait alias used in trait object type (additional use)
+ | ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^ additional non-auto trait
+ | |
| first non-auto trait
- | trait alias used in trait object type (first use)
+ |
+ = help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: ObjT<for<'a> fn(&'a u8)> + ObjT<for<'b> fn(&'b u8)> {}`
+ = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
error: aborting due to 5 previous errors