Skip to content

Commit 3b49aa0

Browse files
authored
Rollup merge of #112071 - WaffleLapkin:group-rfcs-tests, r=oli-obk
Group rfcs tests This moves all RFC tests to `tests/ui/rfcs/rfc-NNNN-title-title-title/...` I had to rename some tests due to conflicts, but otherwise this is just a move.
2 parents f00651c + b694a03 commit 3b49aa0

File tree

544 files changed

+146
-146
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

544 files changed

+146
-146
lines changed

src/tools/tidy/src/ui_tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use std::path::{Path, PathBuf};
1111
const ENTRY_LIMIT: usize = 900;
1212
// FIXME: The following limits should be reduced eventually.
1313
const ISSUES_ENTRY_LIMIT: usize = 1898;
14-
const ROOT_ENTRY_LIMIT: usize = 894;
14+
const ROOT_ENTRY_LIMIT: usize = 874;
1515

1616
const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[
1717
"rs", // test source files

tests/ui/rfc-2005-default-binding-mode/enum.rs

-22
This file was deleted.

tests/ui/rfc-2005-default-binding-mode/for.rs

-9
This file was deleted.

tests/ui/rfc-2005-default-binding-mode/lit.rs

-24
This file was deleted.

tests/ui/rfc-2005-default-binding-mode/slice.rs

-7
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// run-pass
2+
enum Wrapper {
3+
Wrap(i32),
4+
}
5+
6+
use Wrapper::Wrap;
7+
8+
pub fn main() {
9+
let Wrap(x) = &Wrap(3);
10+
println!("{}", *x);
11+
12+
let Wrap(x) = &mut Wrap(3);
13+
println!("{}", *x);
14+
15+
if let Some(x) = &Some(3) {
16+
println!("{}", *x);
17+
} else {
18+
panic!();
19+
}
20+
21+
if let Some(x) = &mut Some(3) {
22+
println!("{}", *x);
23+
} else {
24+
panic!();
25+
}
26+
27+
if let Some(x) = &mut Some(3) {
28+
*x += 1;
29+
} else {
30+
panic!();
31+
}
32+
33+
while let Some(x) = &Some(3) {
34+
println!("{}", *x);
35+
break;
36+
}
37+
while let Some(x) = &mut Some(3) {
38+
println!("{}", *x);
39+
break;
40+
}
41+
while let Some(x) = &mut Some(3) {
42+
*x += 1;
43+
break;
44+
}
45+
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// run-pass
21
enum Wrapper {
32
Wrap(i32),
43
}
@@ -7,39 +6,17 @@ use Wrapper::Wrap;
76

87
pub fn main() {
98
let Wrap(x) = &Wrap(3);
10-
println!("{}", *x);
9+
*x += 1; //~ ERROR cannot assign to `*x`, which is behind a `&` reference
1110

12-
let Wrap(x) = &mut Wrap(3);
13-
println!("{}", *x);
1411

1512
if let Some(x) = &Some(3) {
16-
println!("{}", *x);
17-
} else {
18-
panic!();
19-
}
20-
21-
if let Some(x) = &mut Some(3) {
22-
println!("{}", *x);
23-
} else {
24-
panic!();
25-
}
26-
27-
if let Some(x) = &mut Some(3) {
28-
*x += 1;
13+
*x += 1; //~ ERROR cannot assign to `*x`, which is behind a `&` reference
2914
} else {
3015
panic!();
3116
}
3217

3318
while let Some(x) = &Some(3) {
34-
println!("{}", *x);
35-
break;
36-
}
37-
while let Some(x) = &mut Some(3) {
38-
println!("{}", *x);
39-
break;
40-
}
41-
while let Some(x) = &mut Some(3) {
42-
*x += 1;
19+
*x += 1; //~ ERROR cannot assign to `*x`, which is behind a `&` reference
4320
break;
4421
}
4522
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// run-pass
2+
pub fn main() {
3+
let mut tups = vec![(0u8, 1u8)];
4+
5+
for (n, m) in &tups {
6+
let _: &u8 = n;
7+
let _: &u8 = m;
8+
}
9+
10+
for (n, m) in &mut tups {
11+
*n += 1;
12+
*m += 2;
13+
}
14+
15+
assert_eq!(tups, vec![(1u8, 3u8)]);
16+
17+
for (n, m) in tups {
18+
println!("{} {}", m, n);
19+
}
20+
}
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,9 @@
1-
// run-pass
2-
pub fn main() {
3-
let mut tups = vec![(0u8, 1u8)];
4-
5-
for (n, m) in &tups {
6-
let _: &u8 = n;
7-
let _: &u8 = m;
8-
}
1+
struct Foo {}
92

10-
for (n, m) in &mut tups {
11-
*n += 1;
12-
*m += 2;
13-
}
14-
15-
assert_eq!(tups, vec![(1u8, 3u8)]);
16-
17-
for (n, m) in tups {
18-
println!("{} {}", m, n);
3+
pub fn main() {
4+
let mut tups = vec![(Foo {}, Foo {})];
5+
// The below desugars to &(ref n, mut m).
6+
for (n, mut m) in &tups {
7+
//~^ ERROR cannot move out of a shared reference
198
}
209
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// run-pass
2+
#![allow(dead_code)]
3+
fn with_u8() {
4+
let s = 5u8;
5+
let r = match &s {
6+
4 => false,
7+
5 => true,
8+
_ => false,
9+
};
10+
assert!(r);
11+
}
12+
13+
// A string literal isn't mistaken for a non-ref pattern (in which case we'd
14+
// deref `s` and mess things up).
15+
fn with_str() {
16+
let s: &'static str = "abc";
17+
match s {
18+
"abc" => true,
19+
_ => panic!(),
20+
};
21+
}
22+
23+
// Ditto with byte strings.
24+
fn with_bytes() {
25+
let s: &'static [u8] = b"abc";
26+
match s {
27+
b"abc" => true,
28+
_ => panic!(),
29+
};
30+
}
31+
32+
pub fn main() {
33+
with_str();
34+
}
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,24 @@
1-
// run-pass
2-
#![allow(dead_code)]
3-
fn with_u8() {
4-
let s = 5u8;
5-
let r = match &s {
6-
4 => false,
7-
5 => true,
8-
_ => false,
9-
};
10-
assert!(r);
11-
}
1+
// FIXME(tschottdorf): we want these to compile, but they don't.
122

13-
// A string literal isn't mistaken for a non-ref pattern (in which case we'd
14-
// deref `s` and mess things up).
153
fn with_str() {
164
let s: &'static str = "abc";
17-
match s {
18-
"abc" => true,
5+
6+
match &s {
7+
"abc" => true, //~ ERROR mismatched types
198
_ => panic!(),
209
};
2110
}
2211

23-
// Ditto with byte strings.
2412
fn with_bytes() {
2513
let s: &'static [u8] = b"abc";
26-
match s {
27-
b"abc" => true,
14+
15+
match &s {
16+
b"abc" => true, //~ ERROR mismatched types
2817
_ => panic!(),
2918
};
3019
}
3120

3221
pub fn main() {
3322
with_str();
23+
with_bytes();
3424
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// run-pass
2+
3+
fn slice_pat() {
4+
let sl: &[u8] = b"foo";
5+
6+
match sl {
7+
[first, remainder @ ..] => {
8+
let _: &u8 = first;
9+
assert_eq!(first, &b'f');
10+
assert_eq!(remainder, b"oo");
11+
}
12+
[] => panic!(),
13+
}
14+
}
15+
16+
fn slice_pat_omission() {
17+
match &[0, 1, 2] {
18+
[..] => {}
19+
};
20+
}
21+
22+
fn main() {
23+
slice_pat();
24+
slice_pat_omission();
25+
}
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,7 @@
1-
// run-pass
2-
3-
fn slice_pat() {
1+
pub fn main() {
42
let sl: &[u8] = b"foo";
53

6-
match sl {
7-
[first, remainder @ ..] => {
8-
let _: &u8 = first;
9-
assert_eq!(first, &b'f');
10-
assert_eq!(remainder, b"oo");
11-
}
12-
[] => panic!(),
13-
}
14-
}
15-
16-
fn slice_pat_omission() {
17-
match &[0, 1, 2] {
18-
[..] => {}
19-
};
20-
}
21-
22-
fn main() {
23-
slice_pat();
24-
slice_pat_omission();
4+
match sl { //~ ERROR non-exhaustive patterns
5+
[first, remainder @ ..] => {},
6+
};
257
}

0 commit comments

Comments
 (0)