Rollup merge of #61681 - asfreitas:addSendTrait, r=estebank

Changed the error message to more clearly explain what is allowed

This is in regard to #61634. I changed the language to make it more clear what is allowed.
This commit is contained in:
Mazdak Farrokhzad 2019-06-22 01:42:37 +02:00 committed by GitHub
commit 9eb88f3b82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 15 additions and 15 deletions

View File

@ -1253,7 +1253,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
if regular_traits.is_empty() && auto_traits.is_empty() {
span_err!(tcx.sess, span, E0224,
"at least one non-builtin trait is required for an object type");
"at least one trait is required for an object type");
return tcx.types.err;
}

View File

@ -11,12 +11,12 @@ trait _1 = _0;
// Straight list expansion:
type _T0 = dyn _1;
//~^ ERROR at least one non-builtin trait is required for an object type [E0224]
//~^ ERROR at least one trait is required for an object type [E0224]
// Twice:
trait _2 = _1 + _1;
type _T1 = dyn _2;
//~^ ERROR at least one non-builtin trait is required for an object type [E0224]
//~^ ERROR at least one trait is required for an object type [E0224]
fn main() {}

View File

@ -1,10 +1,10 @@
error[E0224]: at least one non-builtin trait is required for an object type
error[E0224]: at least one trait is required for an object type
--> $DIR/trait-alias-only-maybe-bound.rs:13:12
|
LL | type _T0 = dyn _1;
| ^^^^^^
error[E0224]: at least one non-builtin trait is required for an object type
error[E0224]: at least one trait is required for an object type
--> $DIR/trait-alias-only-maybe-bound.rs:19:12
|
LL | type _T1 = dyn _2;

View File

@ -8,5 +8,5 @@ fn main() {
m!(dyn Copy + Send + 'static);
//~^ ERROR the trait `std::marker::Copy` cannot be made into an object
m!(dyn 'static + Send);
m!(dyn 'static +); //~ ERROR at least one non-builtin trait is required for an object type
m!(dyn 'static +); //~ ERROR at least one trait is required for an object type
}

View File

@ -1,4 +1,4 @@
error[E0224]: at least one non-builtin trait is required for an object type
error[E0224]: at least one trait is required for an object type
--> $DIR/trait-object-macro-matcher.rs:11:8
|
LL | m!(dyn 'static +);

View File

@ -5,7 +5,7 @@
fn g() where
'static: 'static,
dyn 'static +: 'static + Copy,
//~^ ERROR at least one non-builtin trait is required for an object type
//~^ ERROR at least one trait is required for an object type
{}
fn main() {}

View File

@ -1,4 +1,4 @@
error[E0224]: at least one non-builtin trait is required for an object type
error[E0224]: at least one trait is required for an object type
--> $DIR/trait-object-vs-lifetime-2.rs:7:5
|
LL | dyn 'static +: 'static + Copy,

View File

@ -7,11 +7,11 @@ fn main() {
// `'static` is a lifetime argument, `'static +` is a type argument
let _: S<'static, u8>;
let _: S<'static, dyn 'static +>;
//~^ at least one non-builtin trait is required for an object type
//~^ at least one trait is required for an object type
let _: S<'static, 'static>;
//~^ ERROR wrong number of lifetime arguments: expected 1, found 2
//~| ERROR wrong number of type arguments: expected 1, found 0
let _: S<dyn 'static +, 'static>;
//~^ ERROR lifetime arguments must be declared prior to type arguments
//~| ERROR at least one non-builtin trait is required for an object type
//~| ERROR at least one trait is required for an object type
}

View File

@ -4,7 +4,7 @@ error: lifetime arguments must be declared prior to type arguments
LL | let _: S<dyn 'static +, 'static>;
| ^^^^^^^
error[E0224]: at least one non-builtin trait is required for an object type
error[E0224]: at least one trait is required for an object type
--> $DIR/trait-object-vs-lifetime.rs:9:23
|
LL | let _: S<'static, dyn 'static +>;
@ -22,7 +22,7 @@ error[E0107]: wrong number of type arguments: expected 1, found 0
LL | let _: S<'static, 'static>;
| ^^^^^^^^^^^^^^^^^^^ expected 1 type argument
error[E0224]: at least one non-builtin trait is required for an object type
error[E0224]: at least one trait is required for an object type
--> $DIR/trait-object-vs-lifetime.rs:14:14
|
LL | let _: S<dyn 'static +, 'static>;

View File

@ -1,7 +1,7 @@
// Test that `dyn ?Sized` (i.e., a trait object with only a maybe buond) is not allowed.
type _0 = dyn ?Sized;
//~^ ERROR at least one non-builtin trait is required for an object type [E0224]
//~^ ERROR at least one trait is required for an object type [E0224]
//~| ERROR ?Trait` is not permitted in trait object types
fn main() {}

View File

@ -4,7 +4,7 @@ error: `?Trait` is not permitted in trait object types
LL | type _0 = dyn ?Sized;
| ^^^^^^
error[E0224]: at least one non-builtin trait is required for an object type
error[E0224]: at least one trait is required for an object type
--> $DIR/wf-trait-object-only-maybe-bound.rs:3:11
|
LL | type _0 = dyn ?Sized;