Allow unused_labels in some compile-fail tests

This commit is contained in:
Kyle Stachowicz 2018-05-17 22:17:06 -07:00
parent f488d2b393
commit a336aa91db
10 changed files with 16 additions and 2 deletions

View file

@ -27,6 +27,7 @@ fn denormalise<'a, T>(t: &'a T) -> <T as Foo<'a>>::Bar {
pub fn free_and_use<T: for<'a> Foo<'a>,
F: for<'a> FnOnce(<T as Foo<'a>>::Bar)>(x: T, f: F) {
let y;
#[allow(unused_labels)]
'body: loop { // lifetime annotations added for clarity
's: loop { y = denormalise(&x); break }
drop(x); //~ ERROR cannot move out of `x` because it is borrowed

View file

@ -13,5 +13,6 @@ macro_rules! foo {
}
pub fn main() {
#[allow(unused_labels)]
'x: loop { foo!() }
}

View file

@ -9,7 +9,10 @@
// except according to those terms.
macro_rules! foo {
($e: expr) => { 'x: loop { $e } }
($e: expr) => {
#[allow(unused_labels)]
'x: loop { $e }
}
}
pub fn main() {

View file

@ -13,6 +13,7 @@ macro_rules! foo {
}
pub fn main() {
#[allow(unused_labels)]
'x: for _ in 0..1 {
foo!()
};

View file

@ -9,7 +9,10 @@
// except according to those terms.
macro_rules! foo {
($e: expr) => { 'x: for _ in 0..1 { $e } }
($e: expr) => {
#[allow(unused_labels)]
'x: for _ in 0..1 { $e }
}
}
pub fn main() {

View file

@ -10,6 +10,7 @@
// Regression test for #27042. Test that a loop's label is included in its span.
#[allow(unused_labels)]
fn main() {
let _: i32 =
'a: // in this case, the citation is just the `break`:

View file

@ -9,6 +9,7 @@
// except according to those terms.
fn main() {
#[allow(unused_labels)]
'break: loop { //~ ERROR invalid label name `'break`
}
}

View file

@ -77,6 +77,7 @@ fn main() {
}
let _: i32 = 'a: loop {
#[allow(unused_labels)]
let _: () = 'b: loop {
break ('c: loop {
break;

View file

@ -32,6 +32,7 @@ fn test2() {
fn test3() {
let x: i32;
// Similarly, the use of variable `x` is unreachable.
#[allow(unused_labels)]
'a: loop {
x = loop { return };
}

View file

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[allow(unused_labels)]
fn f() {
'l: loop {
fn g() {