Skip to content

Commit 3f9b198

Browse files
committed
rename tests' revisions to allow testing multiple editions
1 parent 586ff15 commit 3f9b198

20 files changed

+93
-93
lines changed
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
//@ edition: 2024
2-
//@ revisions: classic structural
2+
//@ revisions: classic2024 structural2024
33
//! Tests for pattern errors not handled by the pattern typing rules, but by borrowck.
44
#![allow(incomplete_features)]
5-
#![cfg_attr(classic, feature(ref_pat_eat_one_layer_2024))]
6-
#![cfg_attr(structural, feature(ref_pat_eat_one_layer_2024_structural))]
5+
#![cfg_attr(classic2024, feature(ref_pat_eat_one_layer_2024))]
6+
#![cfg_attr(structural2024, feature(ref_pat_eat_one_layer_2024_structural))]
77

88
pub fn main() {
99
if let Some(&Some(x)) = Some(&Some(&mut 0)) {
@@ -15,23 +15,23 @@ pub fn main() {
1515
//~^ cannot borrow data in a `&` reference as mutable [E0596]
1616

1717
if let &Some(Some(x)) = &Some(&mut Some(0)) {
18-
//[classic]~^ ERROR: cannot borrow data in a `&` reference as mutable
18+
//[classic2024]~^ ERROR: cannot borrow data in a `&` reference as mutable
1919
let _: &u32 = x;
2020
}
2121

2222
let &[x] = &&mut [0];
23-
//[classic]~^ ERROR: cannot borrow data in a `&` reference as mutable
23+
//[classic2024]~^ ERROR: cannot borrow data in a `&` reference as mutable
2424
let _: &u32 = x;
2525

2626
let [&x] = &[&mut 0];
27-
//[classic]~^ ERROR: cannot move out of type
27+
//[classic2024]~^ ERROR: cannot move out of type
2828
let _: &u32 = x;
2929

3030
let [&x] = &mut [&mut 0];
31-
//[classic]~^ ERROR: cannot move out of type
31+
//[classic2024]~^ ERROR: cannot move out of type
3232
let _: &u32 = x;
3333

3434
let [&mut x] = &mut [&mut 0];
35-
//[classic]~^ ERROR: cannot move out of type
35+
//[classic2024]~^ ERROR: cannot move out of type
3636
let _: &mut u32 = x;
3737
}

tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/cannot-mutably-deref-shared-ref.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
//@ edition: 2024
2-
//@ revisions: classic structural
2+
//@ revisions: classic2024 structural2024
33
//! Test that `&mut` patterns don't match shared reference types under new typing rules in Rust 2024
44
#![allow(incomplete_features)]
5-
#![cfg_attr(classic, feature(ref_pat_eat_one_layer_2024))]
6-
#![cfg_attr(structural, feature(ref_pat_eat_one_layer_2024_structural))]
5+
#![cfg_attr(classic2024, feature(ref_pat_eat_one_layer_2024))]
6+
#![cfg_attr(structural2024, feature(ref_pat_eat_one_layer_2024_structural))]
77

88
pub fn main() {
99
let &mut _ = &&0;

tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/mut-ref-mut.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
//@ edition: 2024
2-
//@ revisions: classic structural
2+
//@ revisions: classic2024 structural2024
33
//! Test diagnostics for binding with `mut` when the default binding mode is by-ref.
44
#![allow(incomplete_features)]
5-
#![cfg_attr(classic, feature(ref_pat_eat_one_layer_2024))]
6-
#![cfg_attr(structural, feature(ref_pat_eat_one_layer_2024_structural))]
5+
#![cfg_attr(classic2024, feature(ref_pat_eat_one_layer_2024))]
6+
#![cfg_attr(structural2024, feature(ref_pat_eat_one_layer_2024_structural))]
77

88
pub fn main() {
99
struct Foo(u8);
Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
//@ edition: 2024
2-
//@ revisions: classic structural
2+
//@ revisions: classic2024 structural2024
33
//! Test cases for poorly-typed patterns in edition 2024 which are caught by HIR typeck. These must
44
//! be separate from cases caught by MIR borrowck or the latter errors may not be emitted.
55
#![allow(incomplete_features)]
6-
#![cfg_attr(classic, feature(ref_pat_eat_one_layer_2024))]
7-
#![cfg_attr(structural, feature(ref_pat_eat_one_layer_2024_structural))]
6+
#![cfg_attr(classic2024, feature(ref_pat_eat_one_layer_2024))]
7+
#![cfg_attr(structural2024, feature(ref_pat_eat_one_layer_2024_structural))]
88

99
pub fn main() {
1010
if let Some(&mut x) = &Some(&mut 0) {
11-
//[classic]~^ ERROR: mismatched types
11+
//[classic2024]~^ ERROR: mismatched types
1212
let _: &u32 = x;
1313
}
1414
if let Some(&mut Some(&x)) = &Some(&mut Some(0)) {
15-
//[classic]~^ ERROR: mismatched types
15+
//[classic2024]~^ ERROR: mismatched types
1616
let _: u32 = x;
1717
}
1818
if let Some(Some(&mut x)) = &Some(Some(&mut 0)) {
19-
//[classic]~^ ERROR: mismatched types
19+
//[classic2024]~^ ERROR: mismatched types
2020
let _: &u32 = x;
2121
}
2222

2323
if let Some(&mut Some(&_)) = &Some(&Some(0)) {
2424
//~^ ERROR: mismatched types
2525
}
2626
if let Some(&Some(&mut _)) = &Some(&mut Some(0)) {
27-
//[structural]~^ ERROR: mismatched types
27+
//[structural2024]~^ ERROR: mismatched types
2828
}
2929
if let Some(&Some(&mut _)) = &mut Some(&Some(0)) {
3030
//~^ ERROR: mismatched types
3131
}
3232
if let Some(&Some(Some((&mut _)))) = &Some(Some(&mut Some(0))) {
33-
//[structural]~^ ERROR: mismatched types
33+
//[structural2024]~^ ERROR: mismatched types
3434
}
3535
if let Some(&mut Some(x)) = &Some(Some(0)) {
3636
//~^ ERROR: mismatched types
@@ -42,96 +42,96 @@ pub fn main() {
4242

4343
fn structural_errors_0() {
4444
let &[&mut x] = &&mut [0];
45-
//[structural]~^ ERROR: mismatched types
46-
//[structural]~| cannot match inherited `&` with `&mut` pattern
45+
//[structural2024]~^ ERROR: mismatched types
46+
//[structural2024]~| cannot match inherited `&` with `&mut` pattern
4747
let _: u32 = x;
4848

4949
let &[&mut x] = &mut &mut [0];
50-
//[structural]~^ ERROR: mismatched types
51-
//[structural]~| cannot match inherited `&` with `&mut` pattern
50+
//[structural2024]~^ ERROR: mismatched types
51+
//[structural2024]~| cannot match inherited `&` with `&mut` pattern
5252
let _: u32 = x;
5353

5454
let &[&mut ref x] = &&mut [0];
55-
//[structural]~^ ERROR: mismatched types
56-
//[structural]~| cannot match inherited `&` with `&mut` pattern
55+
//[structural2024]~^ ERROR: mismatched types
56+
//[structural2024]~| cannot match inherited `&` with `&mut` pattern
5757
let _: &u32 = x;
5858

5959
let &[&mut ref x] = &mut &mut [0];
60-
//[structural]~^ ERROR: mismatched types
61-
//[structural]~| cannot match inherited `&` with `&mut` pattern
60+
//[structural2024]~^ ERROR: mismatched types
61+
//[structural2024]~| cannot match inherited `&` with `&mut` pattern
6262
let _: &u32 = x;
6363

6464
let &[&mut mut x] = &&mut [0];
65-
//[structural]~^ ERROR: mismatched types
66-
//[structural]~| cannot match inherited `&` with `&mut` pattern
65+
//[structural2024]~^ ERROR: mismatched types
66+
//[structural2024]~| cannot match inherited `&` with `&mut` pattern
6767
let _: u32 = x;
6868

6969
let &[&mut mut x] = &mut &mut [0];
70-
//[structural]~^ ERROR: mismatched types
71-
//[structural]~| cannot match inherited `&` with `&mut` pattern
70+
//[structural2024]~^ ERROR: mismatched types
71+
//[structural2024]~| cannot match inherited `&` with `&mut` pattern
7272
let _: u32 = x;
7373
}
7474

7575
fn structural_errors_1() {
7676
let [&(mut x)] = &[&0];
77-
//[structural]~^ ERROR: binding cannot be both mutable and by-reference
77+
//[structural2024]~^ ERROR: binding cannot be both mutable and by-reference
7878
let _: &u32 = x;
7979

8080
let [&(mut x)] = &mut [&0];
81-
//[structural]~^ ERROR: binding cannot be both mutable and by-reference
81+
//[structural2024]~^ ERROR: binding cannot be both mutable and by-reference
8282
let _: &u32 = x;
8383
}
8484

8585
fn structural_errors_2() {
8686
let [&&mut x] = &[&mut 0];
87-
//[structural]~^ ERROR: mismatched types
88-
//[structural]~| cannot match inherited `&` with `&mut` pattern
87+
//[structural2024]~^ ERROR: mismatched types
88+
//[structural2024]~| cannot match inherited `&` with `&mut` pattern
8989
let _: u32 = x;
9090

9191
let [&&mut x] = &mut [&mut 0];
92-
//[structural]~^ ERROR: mismatched types
93-
//[structural]~| cannot match inherited `&` with `&mut` pattern
92+
//[structural2024]~^ ERROR: mismatched types
93+
//[structural2024]~| cannot match inherited `&` with `&mut` pattern
9494
let _: u32 = x;
9595

9696
let [&&mut ref x] = &[&mut 0];
97-
//[structural]~^ ERROR: mismatched types
98-
//[structural]~| cannot match inherited `&` with `&mut` pattern
97+
//[structural2024]~^ ERROR: mismatched types
98+
//[structural2024]~| cannot match inherited `&` with `&mut` pattern
9999
let _: &u32 = x;
100100

101101
let [&&mut ref x] = &mut [&mut 0];
102-
//[structural]~^ ERROR: mismatched types
103-
//[structural]~| cannot match inherited `&` with `&mut` pattern
102+
//[structural2024]~^ ERROR: mismatched types
103+
//[structural2024]~| cannot match inherited `&` with `&mut` pattern
104104
let _: &u32 = x;
105105

106106
let [&&mut mut x] = &[&mut 0];
107-
//[structural]~^ ERROR: mismatched types
108-
//[structural]~| cannot match inherited `&` with `&mut` pattern
107+
//[structural2024]~^ ERROR: mismatched types
108+
//[structural2024]~| cannot match inherited `&` with `&mut` pattern
109109
let _: u32 = x;
110110

111111
let [&&mut mut x] = &mut [&mut 0];
112-
//[structural]~^ ERROR: mismatched types
113-
//[structural]~| cannot match inherited `&` with `&mut` pattern
112+
//[structural2024]~^ ERROR: mismatched types
113+
//[structural2024]~| cannot match inherited `&` with `&mut` pattern
114114
let _: u32 = x;
115115
}
116116

117117
fn classic_errors_0() {
118118
let [&mut x] = &[&mut 0];
119-
//[classic]~^ ERROR: mismatched types
120-
//[classic]~| cannot match inherited `&` with `&mut` pattern
119+
//[classic2024]~^ ERROR: mismatched types
120+
//[classic2024]~| cannot match inherited `&` with `&mut` pattern
121121
let _: &u32 = x;
122122

123123
let [&mut &x] = &[&mut 0];
124-
//[classic]~^ ERROR: mismatched types
125-
//[classic]~| cannot match inherited `&` with `&mut` pattern
124+
//[classic2024]~^ ERROR: mismatched types
125+
//[classic2024]~| cannot match inherited `&` with `&mut` pattern
126126
let _: u32 = x;
127127

128128
let [&mut &ref x] = &[&mut 0];
129-
//[classic]~^ ERROR: mismatched types
130-
//[classic]~| cannot match inherited `&` with `&mut` pattern
129+
//[classic2024]~^ ERROR: mismatched types
130+
//[classic2024]~| cannot match inherited `&` with `&mut` pattern
131131
let _: &u32 = x;
132132

133133
let [&mut &(mut x)] = &[&mut 0];
134-
//[classic]~^ ERROR: mismatched types
135-
//[classic]~| cannot match inherited `&` with `&mut` pattern
134+
//[classic2024]~^ ERROR: mismatched types
135+
//[classic2024]~| cannot match inherited `&` with `&mut` pattern
136136
let _: u32 = x;
137137
}
Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
11
//@ edition: 2024
2-
//@ revisions: classic structural
3-
//@[classic] run-pass
2+
//@ revisions: classic2024 structural2024
3+
//@[classic2024] run-pass
44
//! Tests for errors from binding with `ref x` under a by-ref default binding mode. These can't be
55
//! in the same body as tests for other errors, since they're emitted during THIR construction.
66
#![allow(incomplete_features)]
7-
#![cfg_attr(classic, feature(ref_pat_eat_one_layer_2024))]
8-
#![cfg_attr(structural, feature(ref_pat_eat_one_layer_2024_structural))]
7+
#![cfg_attr(classic2024, feature(ref_pat_eat_one_layer_2024))]
8+
#![cfg_attr(structural2024, feature(ref_pat_eat_one_layer_2024_structural))]
99

1010
pub fn main() {
1111
let [&ref x] = &[&0];
12-
//[structural]~^ ERROR: this pattern relies on behavior which may change in edition 2024
13-
//[structural]~| cannot override to bind by-reference when that is the implicit default
14-
#[cfg(classic)] let _: &&u32 = x;
12+
//[structural2024]~^ ERROR: this pattern relies on behavior which may change in edition 2024
13+
//[structural2024]~| cannot override to bind by-reference when that is the implicit default
14+
#[cfg(classic2024)] let _: &&u32 = x;
1515

1616
let [&ref x] = &[&mut 0];
17-
//[structural]~^ ERROR: this pattern relies on behavior which may change in edition 2024
18-
//[structural]~| cannot override to bind by-reference when that is the implicit default
19-
#[cfg(classic)] let _: &&mut u32 = x;
17+
//[structural2024]~^ ERROR: this pattern relies on behavior which may change in edition 2024
18+
//[structural2024]~| cannot override to bind by-reference when that is the implicit default
19+
#[cfg(classic2024)] let _: &&mut u32 = x;
2020

2121
let [&ref x] = &mut [&0];
22-
//[structural]~^ ERROR: this pattern relies on behavior which may change in edition 2024
23-
//[structural]~| cannot override to bind by-reference when that is the implicit default
24-
#[cfg(classic)] let _: &&u32 = x;
22+
//[structural2024]~^ ERROR: this pattern relies on behavior which may change in edition 2024
23+
//[structural2024]~| cannot override to bind by-reference when that is the implicit default
24+
#[cfg(classic2024)] let _: &&u32 = x;
2525

2626
let [&ref x] = &mut [&mut 0];
27-
//[structural]~^ ERROR: this pattern relies on behavior which may change in edition 2024
28-
//[structural]~| cannot override to bind by-reference when that is the implicit default
29-
#[cfg(classic)] let _: &&mut u32 = x;
27+
//[structural2024]~^ ERROR: this pattern relies on behavior which may change in edition 2024
28+
//[structural2024]~| cannot override to bind by-reference when that is the implicit default
29+
#[cfg(classic2024)] let _: &&mut u32 = x;
3030

3131
let [&mut ref x] = &mut [&mut 0];
32-
//[structural]~^ ERROR: this pattern relies on behavior which may change in edition 2024
33-
//[structural]~| cannot override to bind by-reference when that is the implicit default
34-
#[cfg(classic)] let _: &&mut u32 = x;
32+
//[structural2024]~^ ERROR: this pattern relies on behavior which may change in edition 2024
33+
//[structural2024]~| cannot override to bind by-reference when that is the implicit default
34+
#[cfg(classic2024)] let _: &&mut u32 = x;
3535

3636
let [&mut ref mut x] = &mut [&mut 0];
37-
//[structural]~^ ERROR: this pattern relies on behavior which may change in edition 2024
38-
//[structural]~| cannot override to bind by-reference when that is the implicit default
39-
#[cfg(classic)] let _: &mut &mut u32 = x;
37+
//[structural2024]~^ ERROR: this pattern relies on behavior which may change in edition 2024
38+
//[structural2024]~| cannot override to bind by-reference when that is the implicit default
39+
#[cfg(classic2024)] let _: &mut &mut u32 = x;
4040
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
//@ edition: 2024
22
//@ run-rustfix
3-
//@ revisions: classic structural
3+
//@ revisions: classic2024 structural2024
44
//! Tests for `&` patterns matched against `&mut` reference types where the inner pattern attempts
55
//! to bind by mutable reference.
66
#![allow(incomplete_features)]
7-
#![cfg_attr(classic, feature(ref_pat_eat_one_layer_2024))]
8-
#![cfg_attr(structural, feature(ref_pat_eat_one_layer_2024_structural))]
7+
#![cfg_attr(classic2024, feature(ref_pat_eat_one_layer_2024))]
8+
#![cfg_attr(structural2024, feature(ref_pat_eat_one_layer_2024_structural))]
99

1010
pub fn main() {
1111
if let Some(&mut Some(ref mut x)) = &mut Some(Some(0)) {
@@ -32,6 +32,6 @@ pub fn main() {
3232
let _: &mut bool = b;
3333

3434
let &mut [x] = &mut &mut [0];
35-
//[classic]~^ ERROR: cannot borrow as mutable inside an `&` pattern
35+
//[classic2024]~^ ERROR: cannot borrow as mutable inside an `&` pattern
3636
let _: &u32 = x;
3737
}

tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-mut-inside-shared-ref-pat.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
//@ edition: 2024
22
//@ run-rustfix
3-
//@ revisions: classic structural
3+
//@ revisions: classic2024 structural2024
44
//! Tests for `&` patterns matched against `&mut` reference types where the inner pattern attempts
55
//! to bind by mutable reference.
66
#![allow(incomplete_features)]
7-
#![cfg_attr(classic, feature(ref_pat_eat_one_layer_2024))]
8-
#![cfg_attr(structural, feature(ref_pat_eat_one_layer_2024_structural))]
7+
#![cfg_attr(classic2024, feature(ref_pat_eat_one_layer_2024))]
8+
#![cfg_attr(structural2024, feature(ref_pat_eat_one_layer_2024_structural))]
99

1010
pub fn main() {
1111
if let Some(&Some(ref mut x)) = &mut Some(Some(0)) {
@@ -32,6 +32,6 @@ pub fn main() {
3232
let _: &mut bool = b;
3333

3434
let &[x] = &mut &mut [0];
35-
//[classic]~^ ERROR: cannot borrow as mutable inside an `&` pattern
35+
//[classic2024]~^ ERROR: cannot borrow as mutable inside an `&` pattern
3636
let _: &u32 = x;
3737
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
//@ edition: 2024
22
//@ run-rustfix
3-
//@ revisions: classic structural
3+
//@ revisions: classic2024 structural2024
44
//! Tests for `&` patterns matched against `&mut` reference types where the inner pattern attempts
55
//! to bind by mutable reference.
66
#![allow(incomplete_features)]
7-
#![cfg_attr(classic, feature(ref_pat_eat_one_layer_2024))]
8-
#![cfg_attr(structural, feature(ref_pat_eat_one_layer_2024_structural))]
7+
#![cfg_attr(classic2024, feature(ref_pat_eat_one_layer_2024))]
8+
#![cfg_attr(structural2024, feature(ref_pat_eat_one_layer_2024_structural))]
99

1010
pub fn main() {
1111
if let Some(&mut Some(ref mut x)) = &mut Some(Some(0)) {
@@ -32,6 +32,6 @@ pub fn main() {
3232
let _: &mut bool = b;
3333

3434
let &[x] = &mut &mut [0];
35-
//[classic]~^ ERROR: cannot borrow as mutable inside an `&` pattern
35+
//[classic2024]~^ ERROR: cannot borrow as mutable inside an `&` pattern
3636
let _: &u32 = x;
3737
}

tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/well-typed-edition-2024.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
//@ edition: 2024
2-
//@ revisions: classic structural
2+
//@ revisions: classic2024 structural2024
33
//@ run-pass
44
//! Test cases for well-typed patterns in edition 2024. These are in their own file to ensure we
55
//! pass both HIR typeck and MIR borrowck, as we may skip the latter if grouped with failing tests.
66
#![allow(incomplete_features, unused_mut)]
7-
#![cfg_attr(classic, feature(ref_pat_eat_one_layer_2024))]
8-
#![cfg_attr(structural, feature(ref_pat_eat_one_layer_2024_structural))]
7+
#![cfg_attr(classic2024, feature(ref_pat_eat_one_layer_2024))]
8+
#![cfg_attr(structural2024, feature(ref_pat_eat_one_layer_2024_structural))]
99

1010
pub fn main() {
1111
if let Some(Some(&x)) = &Some(&Some(0)) {

0 commit comments

Comments
 (0)