Rollup merge of #70176 - rylev:ice-tests, r=Centril

Add tests for #58319 and #65131

Fixes #58319 and fixes #65131
This commit is contained in:
Mazdak Farrokhzad 2020-03-21 05:33:27 +01:00 committed by GitHub
commit 855eac345a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 651 additions and 0 deletions

View File

@ -0,0 +1,621 @@
// run-pass
fn main() {}
#[derive(Clone)]
pub struct Little;
#[derive(Clone)]
pub struct Big(
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
Little,
);

View File

@ -0,0 +1,18 @@
fn get_pair(_a: &mut u32, _b: &mut u32) {}
macro_rules! x10 {
($($t:tt)*) => {
$($t)* $($t)* $($t)* $($t)* $($t)*
$($t)* $($t)* $($t)* $($t)* $($t)*
}
}
#[allow(unused_assignments)]
fn main() {
let mut x = 1;
get_pair(&mut x, &mut x);
//~^ ERROR: cannot borrow `x` as mutable more than once at a time
x10! { x10!{ x10!{ if x > 0 { x += 2 } else { x += 1 } } } }
}

View File

@ -0,0 +1,12 @@
error[E0499]: cannot borrow `x` as mutable more than once at a time
--> $DIR/issue-65131.rs:14:22
|
LL | get_pair(&mut x, &mut x);
| -------- ------ ^^^^^^ second mutable borrow occurs here
| | |
| | first mutable borrow occurs here
| first borrow later used by call
error: aborting due to previous error
For more information about this error, try `rustc --explain E0499`.