Move test for issue 5579 under tests/ui/crashes

This commit is contained in:
Eduardo Broto 2020-05-13 20:47:44 +02:00
parent e4cd8e7961
commit 8d1029d3ca
2 changed files with 17 additions and 21 deletions

View file

@ -78,24 +78,3 @@ fn main() {
assert!(x.is_ok(), "{:?}", x.unwrap_err()); // ok, it's a common test pattern
}
mod issue_5579 {
trait IsErr {
fn is_err(&self, err: &str) -> bool;
}
impl<T> IsErr for Option<T> {
fn is_err(&self, _err: &str) -> bool {
true
}
}
#[allow(unused)]
fn boom() {
let t = Some(1);
if t.is_err("") {
t.unwrap();
}
}
}

View file

@ -0,0 +1,17 @@
trait IsErr {
fn is_err(&self, err: &str) -> bool;
}
impl<T> IsErr for Option<T> {
fn is_err(&self, _err: &str) -> bool {
true
}
}
fn main() {
let t = Some(1);
if t.is_err("") {
t.unwrap();
}
}