Rollup merge of #33676 - rkruppe:e0509-exact-words, r=sanxiyn

Reword the short diagnostic for E0509

Saying that a type *implements* a trait is much more idiomatic than saying it *defines* the trait.
This commit is contained in:
Guillaume Gomez 2016-05-20 15:49:52 +02:00
commit f22c5aab1e
6 changed files with 13 additions and 11 deletions

View File

@ -152,7 +152,7 @@ fn report_cannot_move_out_of<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
ty::TyEnum(def, _) if def.has_dtor() => {
let mut err = struct_span_err!(bccx, move_from.span, E0509,
"cannot move out of type `{}`, \
which defines the `Drop` trait",
which implements the `Drop` trait",
b.ty);
err.span_label(move_from.span, &format!("cannot move out of here"));
err

View File

@ -37,7 +37,7 @@ impl Drop for S {
fn move_in_match() {
match (S {f: "foo".to_string(), g: "bar".to_string()}) {
S { //~ ERROR cannot move out of type `S`, which defines the `Drop` trait
S { //~ ERROR cannot move out of type `S`, which implements the `Drop` trait
//~| cannot move out of here
f: _s, //~ NOTE to prevent move
g: _t //~ NOTE and here

View File

@ -16,17 +16,17 @@ impl Drop for S {
fn move_in_match() {
match (S {f:"foo".to_string()}) {
S {f:_s} => {}
//~^ ERROR cannot move out of type `S`, which defines the `Drop` trait
//~^ ERROR cannot move out of type `S`, which implements the `Drop` trait
}
}
fn move_in_let() {
let S {f:_s} = S {f:"foo".to_string()};
//~^ ERROR cannot move out of type `S`, which defines the `Drop` trait
//~^ ERROR cannot move out of type `S`, which implements the `Drop` trait
}
fn move_in_fn_arg(S {f:_s}: S) {
//~^ ERROR cannot move out of type `S`, which defines the `Drop` trait
//~^ ERROR cannot move out of type `S`, which implements the `Drop` trait
}
fn main() {}

View File

@ -16,17 +16,17 @@ impl Drop for S {
fn move_in_match() {
match S("foo".to_string()) {
S(_s) => {}
//~^ ERROR cannot move out of type `S`, which defines the `Drop` trait
//~^ ERROR cannot move out of type `S`, which implements the `Drop` trait
}
}
fn move_in_let() {
let S(_s) = S("foo".to_string());
//~^ ERROR cannot move out of type `S`, which defines the `Drop` trait
//~^ ERROR cannot move out of type `S`, which implements the `Drop` trait
}
fn move_in_fn_arg(S(_s): S) {
//~^ ERROR cannot move out of type `S`, which defines the `Drop` trait
//~^ ERROR cannot move out of type `S`, which implements the `Drop` trait
}
fn main() {}

View File

@ -19,11 +19,13 @@ struct T { a: isize, mv: Box<isize> }
impl Drop for T { fn drop(&mut self) { } }
fn f(s0:S) {
let _s2 = S{a: 2, ..s0}; //~error: cannot move out of type `S`, which defines the `Drop` trait
let _s2 = S{a: 2, ..s0};
//~^ error: cannot move out of type `S`, which implements the `Drop` trait
}
fn g(s0:T) {
let _s2 = T{a: 2, ..s0}; //~error: cannot move out of type `T`, which defines the `Drop` trait
let _s2 = T{a: 2, ..s0};
//~^ error: cannot move out of type `T`, which implements the `Drop` trait
}
fn main() { }

View File

@ -23,6 +23,6 @@ fn main() {
match x {
X { x: y } => println!("contents: {}", y)
//~^ ERROR cannot move out of type `X`, which defines the `Drop` trait
//~^ ERROR cannot move out of type `X`, which implements the `Drop` trait
}
}