mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-19 03:03:21 +00:00
Better group RFC ui tests together
This commit is contained in:
parent
7452822843
commit
9d3482c403
@ -1,22 +0,0 @@
|
||||
enum Wrapper {
|
||||
Wrap(i32),
|
||||
}
|
||||
|
||||
use Wrapper::Wrap;
|
||||
|
||||
pub fn main() {
|
||||
let Wrap(x) = &Wrap(3);
|
||||
*x += 1; //~ ERROR cannot assign to `*x`, which is behind a `&` reference
|
||||
|
||||
|
||||
if let Some(x) = &Some(3) {
|
||||
*x += 1; //~ ERROR cannot assign to `*x`, which is behind a `&` reference
|
||||
} else {
|
||||
panic!();
|
||||
}
|
||||
|
||||
while let Some(x) = &Some(3) {
|
||||
*x += 1; //~ ERROR cannot assign to `*x`, which is behind a `&` reference
|
||||
break;
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
struct Foo {}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
// FIXME(tschottdorf): we want these to compile, but they don't.
|
||||
|
||||
fn with_str() {
|
||||
let s: &'static str = "abc";
|
||||
|
||||
match &s {
|
||||
"abc" => true, //~ ERROR mismatched types
|
||||
_ => panic!(),
|
||||
};
|
||||
}
|
||||
|
||||
fn with_bytes() {
|
||||
let s: &'static [u8] = b"abc";
|
||||
|
||||
match &s {
|
||||
b"abc" => true, //~ ERROR mismatched types
|
||||
_ => panic!(),
|
||||
};
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
with_str();
|
||||
with_bytes();
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
pub fn main() {
|
||||
let sl: &[u8] = b"foo";
|
||||
|
||||
match sl { //~ ERROR non-exhaustive patterns
|
||||
[first, remainder @ ..] => {},
|
||||
};
|
||||
}
|
45
tests/ui/rfcs/rfc-2005-default-binding-mode/enum-ok.rs
Normal file
45
tests/ui/rfcs/rfc-2005-default-binding-mode/enum-ok.rs
Normal file
@ -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;
|
||||
}
|
||||
}
|
@ -1,4 +1,3 @@
|
||||
// run-pass
|
||||
enum Wrapper {
|
||||
Wrap(i32),
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user