summary refs log tree commit diff
path: root/src/test/ui/parser
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 /src/test/ui/parser
parentde32266a1780aa4ef748ce7f6200a1554fad0aca (diff)
parent0afb9c28bb80467cf2af8e9cd1f1b6af63744004 (diff)
downloadrust-97ba0c7171c4d2d9b899a2bd8e40a8974c47b86d.tar.gz
rust-97ba0c7171c4d2d9b899a2bd8e40a8974c47b86d.zip
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_
Diffstat (limited to 'src/test/ui/parser')
-rw-r--r--src/test/ui/parser/trait-object-trait-parens.stderr30
1 files changed, 15 insertions, 15 deletions
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