Allow unused_labels in some compile-fail tests
This commit is contained in:
parent
f488d2b393
commit
a336aa91db
10 changed files with 16 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -13,5 +13,6 @@ macro_rules! foo {
|
|||
}
|
||||
|
||||
pub fn main() {
|
||||
#[allow(unused_labels)]
|
||||
'x: loop { foo!() }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ macro_rules! foo {
|
|||
}
|
||||
|
||||
pub fn main() {
|
||||
#[allow(unused_labels)]
|
||||
'x: for _ in 0..1 {
|
||||
foo!()
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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`:
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
#[allow(unused_labels)]
|
||||
'break: loop { //~ ERROR invalid label name `'break`
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ fn main() {
|
|||
}
|
||||
|
||||
let _: i32 = 'a: loop {
|
||||
#[allow(unused_labels)]
|
||||
let _: () = 'b: loop {
|
||||
break ('c: loop {
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -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 };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue