Skip to content

Commit e575d19

Browse files
author
Robin Kruppe
committed
Reword the short diagnostic for E0509
Saying that a type *implements* a trait is much more idiomatic than saying it *defines* the trait.
1 parent 0c5d651 commit e575d19

6 files changed

+13
-11
lines changed

src/librustc_borrowck/borrowck/gather_loans/move_error.rs

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

src/test/compile-fail/borrowck/borrowck-move-error-with-note.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ impl Drop for S {
3737

3838
fn move_in_match() {
3939
match (S {f: "foo".to_string(), g: "bar".to_string()}) {
40-
S { //~ ERROR cannot move out of type `S`, which defines the `Drop` trait
40+
S { //~ ERROR cannot move out of type `S`, which implements the `Drop` trait
4141
//~| cannot move out of here
4242
f: _s, //~ NOTE to prevent move
4343
g: _t //~ NOTE and here

src/test/compile-fail/borrowck/borrowck-move-out-of-struct-with-dtor.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@ impl Drop for S {
1616
fn move_in_match() {
1717
match (S {f:"foo".to_string()}) {
1818
S {f:_s} => {}
19-
//~^ ERROR cannot move out of type `S`, which defines the `Drop` trait
19+
//~^ ERROR cannot move out of type `S`, which implements the `Drop` trait
2020
}
2121
}
2222

2323
fn move_in_let() {
2424
let S {f:_s} = S {f:"foo".to_string()};
25-
//~^ ERROR cannot move out of type `S`, which defines the `Drop` trait
25+
//~^ ERROR cannot move out of type `S`, which implements the `Drop` trait
2626
}
2727

2828
fn move_in_fn_arg(S {f:_s}: S) {
29-
//~^ ERROR cannot move out of type `S`, which defines the `Drop` trait
29+
//~^ ERROR cannot move out of type `S`, which implements the `Drop` trait
3030
}
3131

3232
fn main() {}

src/test/compile-fail/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@ impl Drop for S {
1616
fn move_in_match() {
1717
match S("foo".to_string()) {
1818
S(_s) => {}
19-
//~^ ERROR cannot move out of type `S`, which defines the `Drop` trait
19+
//~^ ERROR cannot move out of type `S`, which implements the `Drop` trait
2020
}
2121
}
2222

2323
fn move_in_let() {
2424
let S(_s) = S("foo".to_string());
25-
//~^ ERROR cannot move out of type `S`, which defines the `Drop` trait
25+
//~^ ERROR cannot move out of type `S`, which implements the `Drop` trait
2626
}
2727

2828
fn move_in_fn_arg(S(_s): S) {
29-
//~^ ERROR cannot move out of type `S`, which defines the `Drop` trait
29+
//~^ ERROR cannot move out of type `S`, which implements the `Drop` trait
3030
}
3131

3232
fn main() {}

src/test/compile-fail/borrowck/borrowck-struct-update-with-dtor.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ struct T { a: isize, mv: Box<isize> }
1919
impl Drop for T { fn drop(&mut self) { } }
2020

2121
fn f(s0:S) {
22-
let _s2 = S{a: 2, ..s0}; //~error: cannot move out of type `S`, which defines the `Drop` trait
22+
let _s2 = S{a: 2, ..s0};
23+
//~^ error: cannot move out of type `S`, which implements the `Drop` trait
2324
}
2425

2526
fn g(s0:T) {
26-
let _s2 = T{a: 2, ..s0}; //~error: cannot move out of type `T`, which defines the `Drop` trait
27+
let _s2 = T{a: 2, ..s0};
28+
//~^ error: cannot move out of type `T`, which implements the `Drop` trait
2729
}
2830

2931
fn main() { }

src/test/compile-fail/disallowed-deconstructing-destructing-struct-match.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ fn main() {
2323

2424
match x {
2525
X { x: y } => println!("contents: {}", y)
26-
//~^ ERROR cannot move out of type `X`, which defines the `Drop` trait
26+
//~^ ERROR cannot move out of type `X`, which implements the `Drop` trait
2727
}
2828
}

0 commit comments

Comments
 (0)