Skip to content

Commit

Permalink
Auto merge of #112071 - WaffleLapkin:group-rfcs-tests, r=oli-obk
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bors committed Jun 5, 2023
2 parents 408bbd0 + 18e016f commit e6d4725
Show file tree
Hide file tree
Showing 544 changed files with 146 additions and 146 deletions.
2 changes: 1 addition & 1 deletion src/tools/tidy/src/ui_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use std::path::{Path, PathBuf};
const ENTRY_LIMIT: usize = 900;
// FIXME: The following limits should be reduced eventually.
const ISSUES_ENTRY_LIMIT: usize = 1898;
const ROOT_ENTRY_LIMIT: usize = 891;
const ROOT_ENTRY_LIMIT: usize = 871;

const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[
"rs", // test source files
Expand Down
22 changes: 0 additions & 22 deletions tests/ui/rfc-2005-default-binding-mode/enum.rs

This file was deleted.

9 changes: 0 additions & 9 deletions tests/ui/rfc-2005-default-binding-mode/for.rs

This file was deleted.

24 changes: 0 additions & 24 deletions tests/ui/rfc-2005-default-binding-mode/lit.rs

This file was deleted.

7 changes: 0 additions & 7 deletions tests/ui/rfc-2005-default-binding-mode/slice.rs

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
45 changes: 45 additions & 0 deletions tests/ui/rfcs/rfc-2005-default-binding-mode/enum-ok.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// run-pass
enum Wrapper {
Wrap(i32),
}

use Wrapper::Wrap;

pub fn main() {
let Wrap(x) = &Wrap(3);
println!("{}", *x);

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

if let Some(x) = &Some(3) {
println!("{}", *x);
} else {
panic!();
}

if let Some(x) = &mut Some(3) {
println!("{}", *x);
} else {
panic!();
}

if let Some(x) = &mut Some(3) {
*x += 1;
} else {
panic!();
}

while let Some(x) = &Some(3) {
println!("{}", *x);
break;
}
while let Some(x) = &mut Some(3) {
println!("{}", *x);
break;
}
while let Some(x) = &mut Some(3) {
*x += 1;
break;
}
}
29 changes: 3 additions & 26 deletions tests/ui/rfcs/rfc-2005-default-binding-mode/enum.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// run-pass
enum Wrapper {
Wrap(i32),
}
Expand All @@ -7,39 +6,17 @@ use Wrapper::Wrap;

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

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

if let Some(x) = &Some(3) {
println!("{}", *x);
} else {
panic!();
}

if let Some(x) = &mut Some(3) {
println!("{}", *x);
} else {
panic!();
}

if let Some(x) = &mut Some(3) {
*x += 1;
*x += 1; //~ ERROR cannot assign to `*x`, which is behind a `&` reference
} else {
panic!();
}

while let Some(x) = &Some(3) {
println!("{}", *x);
break;
}
while let Some(x) = &mut Some(3) {
println!("{}", *x);
break;
}
while let Some(x) = &mut Some(3) {
*x += 1;
*x += 1; //~ ERROR cannot assign to `*x`, which is behind a `&` reference
break;
}
}
20 changes: 20 additions & 0 deletions tests/ui/rfcs/rfc-2005-default-binding-mode/for-ok.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// run-pass
pub fn main() {
let mut tups = vec![(0u8, 1u8)];

for (n, m) in &tups {
let _: &u8 = n;
let _: &u8 = m;
}

for (n, m) in &mut tups {
*n += 1;
*m += 2;
}

assert_eq!(tups, vec![(1u8, 3u8)]);

for (n, m) in tups {
println!("{} {}", m, n);
}
}
23 changes: 6 additions & 17 deletions tests/ui/rfcs/rfc-2005-default-binding-mode/for.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
// run-pass
pub fn main() {
let mut tups = vec![(0u8, 1u8)];

for (n, m) in &tups {
let _: &u8 = n;
let _: &u8 = m;
}
struct Foo {}

for (n, m) in &mut tups {
*n += 1;
*m += 2;
}

assert_eq!(tups, vec![(1u8, 3u8)]);

for (n, m) in tups {
println!("{} {}", m, n);
pub fn main() {
let mut tups = vec![(Foo {}, Foo {})];
// The below desugars to &(ref n, mut m).
for (n, mut m) in &tups {
//~^ ERROR cannot move out of a shared reference
}
}
34 changes: 34 additions & 0 deletions tests/ui/rfcs/rfc-2005-default-binding-mode/lit-ok.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// run-pass
#![allow(dead_code)]
fn with_u8() {
let s = 5u8;
let r = match &s {
4 => false,
5 => true,
_ => false,
};
assert!(r);
}

// A string literal isn't mistaken for a non-ref pattern (in which case we'd
// deref `s` and mess things up).
fn with_str() {
let s: &'static str = "abc";
match s {
"abc" => true,
_ => panic!(),
};
}

// Ditto with byte strings.
fn with_bytes() {
let s: &'static [u8] = b"abc";
match s {
b"abc" => true,
_ => panic!(),
};
}

pub fn main() {
with_str();
}
26 changes: 8 additions & 18 deletions tests/ui/rfcs/rfc-2005-default-binding-mode/lit.rs
Original file line number Diff line number Diff line change
@@ -1,34 +1,24 @@
// run-pass
#![allow(dead_code)]
fn with_u8() {
let s = 5u8;
let r = match &s {
4 => false,
5 => true,
_ => false,
};
assert!(r);
}
// FIXME(tschottdorf): we want these to compile, but they don't.

// A string literal isn't mistaken for a non-ref pattern (in which case we'd
// deref `s` and mess things up).
fn with_str() {
let s: &'static str = "abc";
match s {
"abc" => true,

match &s {
"abc" => true, //~ ERROR mismatched types
_ => panic!(),
};
}

// Ditto with byte strings.
fn with_bytes() {
let s: &'static [u8] = b"abc";
match s {
b"abc" => true,

match &s {
b"abc" => true, //~ ERROR mismatched types
_ => panic!(),
};
}

pub fn main() {
with_str();
with_bytes();
}
25 changes: 25 additions & 0 deletions tests/ui/rfcs/rfc-2005-default-binding-mode/slice-ok.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// run-pass

fn slice_pat() {
let sl: &[u8] = b"foo";

match sl {
[first, remainder @ ..] => {
let _: &u8 = first;
assert_eq!(first, &b'f');
assert_eq!(remainder, b"oo");
}
[] => panic!(),
}
}

fn slice_pat_omission() {
match &[0, 1, 2] {
[..] => {}
};
}

fn main() {
slice_pat();
slice_pat_omission();
}
26 changes: 4 additions & 22 deletions tests/ui/rfcs/rfc-2005-default-binding-mode/slice.rs
Original file line number Diff line number Diff line change
@@ -1,25 +1,7 @@
// run-pass

fn slice_pat() {
pub fn main() {
let sl: &[u8] = b"foo";

match sl {
[first, remainder @ ..] => {
let _: &u8 = first;
assert_eq!(first, &b'f');
assert_eq!(remainder, b"oo");
}
[] => panic!(),
}
}

fn slice_pat_omission() {
match &[0, 1, 2] {
[..] => {}
};
}

fn main() {
slice_pat();
slice_pat_omission();
match sl { //~ ERROR non-exhaustive patterns
[first, remainder @ ..] => {},
};
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit e6d4725

Please sign in to comment.