&mut f
+
&f; //~ ERROR: cannot borrow `f` as immutable because it is also borrowed as mutable
- //~^ cannot borrow `f` as immutable because it is also borrowed as mutable
}
fn immut_plus_mut() {
&f
+
&mut f; //~ ERROR: cannot borrow `f` as mutable because it is also borrowed as immutable
- //~^ cannot borrow `f` as mutable because it is also borrowed as immutable
}
fn main() {}
borrow(&*v); //~ ERROR cannot borrow
if cond2 {
x = &mut v; //~ ERROR cannot borrow
- //~^ ERROR cannot borrow
}
}
}
match 1 {
1 => { addr = &mut x; }
//~^ ERROR cannot borrow `x` as mutable more than once at a time
- //~| ERROR cannot borrow `x` as mutable more than once at a time
2 => { addr = &mut x; }
//~^ ERROR cannot borrow `x` as mutable more than once at a time
_ => { addr = &mut x; }
loop { match l {
&mut Sexpression::Num(ref mut n) => {},
&mut Sexpression::Cons(ref mut expr) => { //~ ERROR cannot borrow `l.0`
- //~| ERROR cannot borrow `l.0`
l = &mut **expr; //~ ERROR cannot assign to `l`
}
}}
fn main() {
let Box(a) = loop { };
//~^ ERROR expected tuple struct/variant, found struct `Box`
- //~| ERROR expected tuple struct/variant, found struct `Box`
// (The below is a trick to allow compiler to infer a type for
// variable `a` without attempting to ascribe a type to the
// Should get errors for both 'Some' and 'None'
use std::option::Option::{Some, None};
//~^ ERROR unused imports: `None`, `Some`
-//~| ERROR unused imports: `None`, `Some`
use test::A; //~ ERROR unused import: `test::A`
// Be sure that if we just bring some methods into scope that they're also
let primary_spans: Vec<_> = spans_in_this_file.iter()
.cloned()
.filter(|span| span.is_primary)
+ .take(1) // sometimes we have more than one showing up in the json; pick first
.collect();
let primary_spans = if primary_spans.is_empty() {
// subdiagnostics often don't have a span of their own;