Skip to content

Reword the short diagnostic for E0509 #33676

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/librustc_borrowck/borrowck/gather_loans/move_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}
Original file line number Diff line number Diff line change
Expand Up @@ -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() { }
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}