constraint: out.constraint.clone(),
is_rw: out.is_rw,
is_indirect: out.is_indirect,
+ span: out.expr.span,
})
.collect(),
asm: asm.asm.clone(),
pub constraint: Symbol,
pub is_rw: bool,
pub is_indirect: bool,
+ pub span: Span,
}
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
impl_stable_hash_for!(struct hir::InlineAsmOutput {
constraint,
is_rw,
- is_indirect
+ is_indirect,
+ span
});
impl_stable_hash_for!(struct hir::GlobalAsm {
}
fn mutate_expr(&mut self,
+ span: Span,
assignment_expr: &hir::Expr,
expr: &hir::Expr,
mode: MutateMode) {
let cmt = return_if_err!(self.mc.cat_expr(expr));
- self.delegate.mutate(assignment_expr.id, assignment_expr.span, &cmt, mode);
+ self.delegate.mutate(assignment_expr.id, span, &cmt, mode);
self.walk_expr(expr);
}
if o.is_indirect {
self.consume_expr(output);
} else {
- self.mutate_expr(expr, output,
- if o.is_rw {
- MutateMode::WriteAndRead
- } else {
- MutateMode::JustWrite
- });
+ self.mutate_expr(
+ output.span,
+ expr,
+ output,
+ if o.is_rw {
+ MutateMode::WriteAndRead
+ } else {
+ MutateMode::JustWrite
+ },
+ );
}
}
self.consume_exprs(inputs);
}
hir::ExprKind::Assign(ref lhs, ref rhs) => {
- self.mutate_expr(expr, &lhs, MutateMode::JustWrite);
+ self.mutate_expr(expr.span, expr, &lhs, MutateMode::JustWrite);
self.consume_expr(&rhs);
}
if self.mc.tables.is_method_call(expr) {
self.consume_expr(lhs);
} else {
- self.mutate_expr(expr, &lhs, MutateMode::WriteAndRead);
+ self.mutate_expr(expr.span, expr, &lhs, MutateMode::WriteAndRead);
}
self.consume_expr(&rhs);
}
// be encoeded through MIR place derefs instead.
self.access_place(
context,
- (output, span),
+ (output, o.span),
(Deep, Read(ReadKind::Copy)),
LocalMutationIsAllowed::No,
flow_state,
self.check_if_path_or_subpath_is_moved(
context,
InitializationRequiringAction::Use,
- (output, span),
+ (output, o.span),
flow_state,
);
} else {
self.mutate_place(
context,
- (output, span),
+ (output, o.span),
if o.is_rw { Deep } else { Shallow(None) },
if o.is_rw { WriteAndRead } else { JustWrite },
flow_state,
error[E0384]: cannot assign twice to immutable variable `x`
- --> $DIR/asm-out-assign-imm.rs:34:9
+ --> $DIR/asm-out-assign-imm.rs:34:34
|
LL | let x: isize;
| - help: make this binding mutable: `mut x`
| ----- first assignment to `x`
...
LL | asm!("mov $1, $0" : "=r"(x) : "r"(5));
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable
+ | ^ cannot assign twice to immutable variable
error: aborting due to previous error
error[E0384]: cannot assign twice to immutable variable `x`
- --> $DIR/asm-out-assign-imm.rs:34:9
+ --> $DIR/asm-out-assign-imm.rs:34:34
|
LL | x = 1;
| ----- first assignment to `x`
...
LL | asm!("mov $1, $0" : "=r"(x) : "r"(5));
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable
+ | ^ cannot assign twice to immutable variable
error: aborting due to previous error
| - borrow later used here
error[E0384]: cannot assign twice to immutable variable `x`
- --> $DIR/borrowck-asm.rs:54:13
+ --> $DIR/borrowck-asm.rs:54:31
|
LL | let x = 3;
| -
| help: make this binding mutable: `mut x`
LL | unsafe {
LL | asm!("nop" : "=r"(x)); //[ast]~ ERROR cannot assign twice
- | ^^^^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable
+ | ^ cannot assign twice to immutable variable
error[E0384]: cannot assign twice to immutable variable `x`
- --> $DIR/borrowck-asm.rs:70:13
+ --> $DIR/borrowck-asm.rs:70:31
|
LL | let x = 3;
| -
| help: make this binding mutable: `mut x`
LL | unsafe {
LL | asm!("nop" : "+r"(x)); //[ast]~ ERROR cannot assign twice
- | ^^^^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable
+ | ^ cannot assign twice to immutable variable
error[E0381]: use of possibly uninitialized variable: `x`
- --> $DIR/borrowck-asm.rs:78:13
+ --> $DIR/borrowck-asm.rs:78:32
|
LL | asm!("nop" : "=*r"(x)); //[ast]~ ERROR use of possibly uninitialized variable
- | ^^^^^^^^^^^^^^^^^^^^^^^ use of possibly uninitialized `x`
+ | ^ use of possibly uninitialized `x`
error[E0506]: cannot assign to `x` because it is borrowed
- --> $DIR/borrowck-asm.rs:87:13
+ --> $DIR/borrowck-asm.rs:87:31
|
LL | let y = &*x;
| --- borrow of `x` occurs here
LL | unsafe {
LL | asm!("nop" : "+r"(x)); //[ast]~ ERROR cannot assign to `x` because it is borrowed
- | ^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `x` occurs here
+ | ^ assignment to borrowed `x` occurs here
...
LL | let z = y;
| - borrow later used here
| ^ use of borrowed `x`
error[E0384]: cannot assign twice to immutable variable `x`
- --> $DIR/borrowck-asm.rs:54:13
+ --> $DIR/borrowck-asm.rs:54:31
|
LL | let x = 3;
| - first assignment to `x`
LL | unsafe {
LL | asm!("nop" : "=r"(x)); //[ast]~ ERROR cannot assign twice
- | ^^^^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable
+ | ^ cannot assign twice to immutable variable
error[E0506]: cannot assign to `a` because it is borrowed
- --> $DIR/borrowck-asm.rs:60:13
+ --> $DIR/borrowck-asm.rs:60:31
|
LL | let b = &*a;
| -- borrow of `a` occurs here
LL | unsafe {
LL | asm!("nop" : "=r"(a)); //[ast]~ ERROR cannot assign to `a` because it is borrowed
- | ^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `a` occurs here
+ | ^ assignment to borrowed `a` occurs here
error[E0384]: cannot assign twice to immutable variable `x`
- --> $DIR/borrowck-asm.rs:70:13
+ --> $DIR/borrowck-asm.rs:70:31
|
LL | let x = 3;
| - first assignment to `x`
LL | unsafe {
LL | asm!("nop" : "+r"(x)); //[ast]~ ERROR cannot assign twice
- | ^^^^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable
+ | ^ cannot assign twice to immutable variable
error[E0381]: use of possibly uninitialized variable: `x`
--> $DIR/borrowck-asm.rs:78:32
| ^ use of possibly uninitialized `x`
error[E0506]: cannot assign to `x` because it is borrowed
- --> $DIR/borrowck-asm.rs:87:13
+ --> $DIR/borrowck-asm.rs:87:31
|
LL | let y = &*x;
| -- borrow of `x` occurs here
LL | unsafe {
LL | asm!("nop" : "+r"(x)); //[ast]~ ERROR cannot assign to `x` because it is borrowed
- | ^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `x` occurs here
+ | ^ assignment to borrowed `x` occurs here
error[E0382]: use of moved value: `x`
--> $DIR/borrowck-asm.rs:96:40
| - borrow later used here
error[E0384]: cannot assign twice to immutable variable `x`
- --> $DIR/borrowck-asm.rs:54:13
+ --> $DIR/borrowck-asm.rs:54:31
|
LL | let x = 3;
| -
| help: make this binding mutable: `mut x`
LL | unsafe {
LL | asm!("nop" : "=r"(x)); //[ast]~ ERROR cannot assign twice
- | ^^^^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable
+ | ^ cannot assign twice to immutable variable
error[E0384]: cannot assign twice to immutable variable `x`
- --> $DIR/borrowck-asm.rs:70:13
+ --> $DIR/borrowck-asm.rs:70:31
|
LL | let x = 3;
| -
| help: make this binding mutable: `mut x`
LL | unsafe {
LL | asm!("nop" : "+r"(x)); //[ast]~ ERROR cannot assign twice
- | ^^^^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable
+ | ^ cannot assign twice to immutable variable
error[E0381]: use of possibly uninitialized variable: `x`
- --> $DIR/borrowck-asm.rs:78:13
+ --> $DIR/borrowck-asm.rs:78:32
|
LL | asm!("nop" : "=*r"(x)); //[ast]~ ERROR use of possibly uninitialized variable
- | ^^^^^^^^^^^^^^^^^^^^^^^ use of possibly uninitialized `x`
+ | ^ use of possibly uninitialized `x`
error[E0506]: cannot assign to `x` because it is borrowed
- --> $DIR/borrowck-asm.rs:87:13
+ --> $DIR/borrowck-asm.rs:87:31
|
LL | let y = &*x;
| --- borrow of `x` occurs here
LL | unsafe {
LL | asm!("nop" : "+r"(x)); //[ast]~ ERROR cannot assign to `x` because it is borrowed
- | ^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `x` occurs here
+ | ^ assignment to borrowed `x` occurs here
...
LL | let z = y;
| - borrow later used here