Skip to content

Commit a336aa9

Browse files
committed
Allow unused_labels in some compile-fail tests
1 parent f488d2b commit a336aa9

10 files changed

+16
-2
lines changed

src/test/compile-fail/associated-types-outlives.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ fn denormalise<'a, T>(t: &'a T) -> <T as Foo<'a>>::Bar {
2727
pub fn free_and_use<T: for<'a> Foo<'a>,
2828
F: for<'a> FnOnce(<T as Foo<'a>>::Bar)>(x: T, f: F) {
2929
let y;
30+
#[allow(unused_labels)]
3031
'body: loop { // lifetime annotations added for clarity
3132
's: loop { y = denormalise(&x); break }
3233
drop(x); //~ ERROR cannot move out of `x` because it is borrowed

src/test/compile-fail/hygienic-label-1.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ macro_rules! foo {
1313
}
1414

1515
pub fn main() {
16+
#[allow(unused_labels)]
1617
'x: loop { foo!() }
1718
}

src/test/compile-fail/hygienic-label-2.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
// except according to those terms.
1010

1111
macro_rules! foo {
12-
($e: expr) => { 'x: loop { $e } }
12+
($e: expr) => {
13+
#[allow(unused_labels)]
14+
'x: loop { $e }
15+
}
1316
}
1417

1518
pub fn main() {

src/test/compile-fail/hygienic-label-3.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ macro_rules! foo {
1313
}
1414

1515
pub fn main() {
16+
#[allow(unused_labels)]
1617
'x: for _ in 0..1 {
1718
foo!()
1819
};

src/test/compile-fail/hygienic-label-4.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
// except according to those terms.
1010

1111
macro_rules! foo {
12-
($e: expr) => { 'x: for _ in 0..1 { $e } }
12+
($e: expr) => {
13+
#[allow(unused_labels)]
14+
'x: for _ in 0..1 { $e }
15+
}
1316
}
1417

1518
pub fn main() {

src/test/compile-fail/issue-27042.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
// Regression test for #27042. Test that a loop's label is included in its span.
1212

13+
#[allow(unused_labels)]
1314
fn main() {
1415
let _: i32 =
1516
'a: // in this case, the citation is just the `break`:

src/test/compile-fail/issue-46311.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
fn main() {
12+
#[allow(unused_labels)]
1213
'break: loop { //~ ERROR invalid label name `'break`
1314
}
1415
}

src/test/compile-fail/loop-break-value.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ fn main() {
7777
}
7878

7979
let _: i32 = 'a: loop {
80+
#[allow(unused_labels)]
8081
let _: () = 'b: loop {
8182
break ('c: loop {
8283
break;

src/test/compile-fail/loop-proper-liveness.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ fn test2() {
3232
fn test3() {
3333
let x: i32;
3434
// Similarly, the use of variable `x` is unreachable.
35+
#[allow(unused_labels)]
3536
'a: loop {
3637
x = loop { return };
3738
}

src/test/compile-fail/resolve-label.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#[allow(unused_labels)]
1112
fn f() {
1213
'l: loop {
1314
fn g() {

0 commit comments

Comments
 (0)