Update E0038 to the new error format
This commit is contained in:
parent
b42a384a80
commit
20ea8cba53
@ -670,10 +670,15 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
||||
let mut err = match warning_node_id {
|
||||
Some(_) => None,
|
||||
None => {
|
||||
Some(struct_span_err!(
|
||||
self.sess, span, E0038,
|
||||
"the trait `{}` cannot be made into an object",
|
||||
self.item_path_str(trait_def_id)))
|
||||
let trait_str = self.item_path_str(trait_def_id);
|
||||
let mut db = struct_span_err!(
|
||||
self.sess, span, E0038,
|
||||
"the trait `{}` cannot be made into an object",
|
||||
trait_str);
|
||||
db.span_label(span,
|
||||
&format!("the trait `{}` cannot be made \
|
||||
into an object", trait_str));
|
||||
Some(db)
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -12,7 +12,10 @@ trait Trait {
|
||||
fn foo(&self) -> Self;
|
||||
}
|
||||
|
||||
fn call_foo(x: Box<Trait>) { //~ ERROR E0038
|
||||
fn call_foo(x: Box<Trait>) {
|
||||
//~^ ERROR E0038
|
||||
//~| NOTE the trait `Trait` cannot be made into an object
|
||||
//~| NOTE method `foo` references the `Self` type in its arguments or return type
|
||||
let y = x.foo();
|
||||
}
|
||||
|
||||
|
@ -15,10 +15,12 @@ fn f<T: Array>(x: &T) {
|
||||
//~^ ERROR `Array` cannot be made into an object
|
||||
//~| NOTE the trait cannot require that `Self : Sized`
|
||||
//~| NOTE requirements on the impl of `std::ops::CoerceUnsized<&Array>`
|
||||
//~| NOTE the trait `Array` cannot be made into an object
|
||||
as
|
||||
&Array;
|
||||
//~^ ERROR `Array` cannot be made into an object
|
||||
//~| NOTE the trait cannot require that `Self : Sized`
|
||||
//~| NOTE the trait `Array` cannot be made into an object
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -28,6 +28,7 @@ impl<K> Map for K {
|
||||
fn main() {
|
||||
let _ = &()
|
||||
as &Map<Key=u32,MapValue=u32>;
|
||||
//~^ ERROR the trait `Map` cannot be made into an object
|
||||
//~^ ERROR E0038
|
||||
//~| NOTE the trait cannot use `Self` as a type parameter
|
||||
//~| NOTE the trait `Map` cannot be made into an object
|
||||
}
|
||||
|
@ -24,12 +24,14 @@ trait Quux {
|
||||
fn make_bar<T:Bar>(t: &T) -> &Bar {
|
||||
//~^ ERROR E0038
|
||||
//~| NOTE method `bar` has generic type parameters
|
||||
//~| NOTE the trait `Bar` cannot be made into an object
|
||||
t
|
||||
}
|
||||
|
||||
fn make_bar_explicit<T:Bar>(t: &T) -> &Bar {
|
||||
//~^ ERROR E0038
|
||||
//~^^ NOTE method `bar` has generic type parameters
|
||||
//~| NOTE method `bar` has generic type parameters
|
||||
//~| NOTE the trait `Bar` cannot be made into an object
|
||||
t as &Bar
|
||||
}
|
||||
|
||||
|
@ -27,12 +27,14 @@ trait Quux {
|
||||
fn make_bar<T:Bar>(t: &T) -> &Bar {
|
||||
//~^ ERROR E0038
|
||||
//~| NOTE method `bar` references the `Self` type in its arguments or return type
|
||||
//~| NOTE the trait `Bar` cannot be made into an object
|
||||
loop { }
|
||||
}
|
||||
|
||||
fn make_baz<T:Baz>(t: &T) -> &Baz {
|
||||
//~^ ERROR E0038
|
||||
//~| NOTE method `bar` references the `Self` type in its arguments or return type
|
||||
//~| NOTE the trait `Baz` cannot be made into an object
|
||||
t
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@ trait Bar : Sized {
|
||||
fn make_bar<T:Bar>(t: &T) -> &Bar {
|
||||
//~^ ERROR E0038
|
||||
//~| NOTE the trait cannot require that `Self : Sized`
|
||||
//~| NOTE the trait `Bar` cannot be made into an object
|
||||
t
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,7 @@ fn make_bar<T:Bar<u32>>(t: &T) -> &Bar<u32> {
|
||||
fn make_baz<T:Baz>(t: &T) -> &Baz {
|
||||
//~^ ERROR E0038
|
||||
//~| NOTE the trait cannot use `Self` as a type parameter in the supertrait listing
|
||||
//~| NOTE the trait `Baz` cannot be made into an object
|
||||
t
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user