summaryrefslogtreecommitdiffstats
path: root/tests/ui/mir
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/mir')
-rw-r--r--tests/ui/mir/issue-101844.rs2
-rw-r--r--tests/ui/mir/issue-112269.rs9
-rw-r--r--tests/ui/mir/issue-112269.stderr31
-rw-r--r--tests/ui/mir/issue-80949.rs2
-rw-r--r--tests/ui/mir/issue66339.rs2
-rw-r--r--tests/ui/mir/ssa-analysis-regression-50041.rs11
-rw-r--r--tests/ui/mir/thir-constparam-temp.rs4
-rw-r--r--tests/ui/mir/thir-constparam-temp.stderr6
8 files changed, 53 insertions, 14 deletions
diff --git a/tests/ui/mir/issue-101844.rs b/tests/ui/mir/issue-101844.rs
index da8a25f5f..72ceefa4f 100644
--- a/tests/ui/mir/issue-101844.rs
+++ b/tests/ui/mir/issue-101844.rs
@@ -67,7 +67,7 @@ where
MS::Item: Into<()>,
{
// Error: Apparently Balance::new doesn't exist during MIR validation
- let _ = ImplShoulExist::<MS, ()>::access_fn(ms);
+ ImplShoulExist::<MS, ()>::access_fn(ms);
}
fn main() {}
diff --git a/tests/ui/mir/issue-112269.rs b/tests/ui/mir/issue-112269.rs
new file mode 100644
index 000000000..8b9b16647
--- /dev/null
+++ b/tests/ui/mir/issue-112269.rs
@@ -0,0 +1,9 @@
+pub fn main() {
+ const x: i32 = 4;
+ let x: i32 = 3;
+ //~^ ERROR refutable pattern in local binding
+
+ const y: i32 = 3;
+ let y = 4;
+ //~^ ERROR refutable pattern in local binding
+}
diff --git a/tests/ui/mir/issue-112269.stderr b/tests/ui/mir/issue-112269.stderr
new file mode 100644
index 000000000..f5b796027
--- /dev/null
+++ b/tests/ui/mir/issue-112269.stderr
@@ -0,0 +1,31 @@
+error[E0005]: refutable pattern in local binding
+ --> $DIR/issue-112269.rs:3:9
+ |
+LL | let x: i32 = 3;
+ | ^
+ | |
+ | patterns `i32::MIN..=3_i32` and `5_i32..=i32::MAX` not covered
+ | missing patterns are not covered because `x` is interpreted as a constant pattern, not a new variable
+ | help: introduce a variable instead: `x_var`
+ |
+ = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
+ = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
+ = note: the matched value is of type `i32`
+
+error[E0005]: refutable pattern in local binding
+ --> $DIR/issue-112269.rs:7:9
+ |
+LL | let y = 4;
+ | ^
+ | |
+ | patterns `i32::MIN..=2_i32` and `4_i32..=i32::MAX` not covered
+ | missing patterns are not covered because `y` is interpreted as a constant pattern, not a new variable
+ | help: introduce a variable instead: `y_var`
+ |
+ = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
+ = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
+ = note: the matched value is of type `i32`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0005`.
diff --git a/tests/ui/mir/issue-80949.rs b/tests/ui/mir/issue-80949.rs
index 7e34a4f5c..96b63e93a 100644
--- a/tests/ui/mir/issue-80949.rs
+++ b/tests/ui/mir/issue-80949.rs
@@ -28,7 +28,7 @@ fn may_panic<X>(_: X) { }
fn main() {
let dyn_trait = make_dyn_trait(&());
let storage = vec![()];
- let _x = may_panic(());
+ may_panic(());
let storage_ref = &storage;
diff(dyn_trait, storage_ref);
}
diff --git a/tests/ui/mir/issue66339.rs b/tests/ui/mir/issue66339.rs
index 2507af38c..f25afd560 100644
--- a/tests/ui/mir/issue66339.rs
+++ b/tests/ui/mir/issue66339.rs
@@ -5,7 +5,7 @@
fn foo() {
let bar = |_| { };
- let _ = bar("a");
+ bar("a");
}
fn main() {
diff --git a/tests/ui/mir/ssa-analysis-regression-50041.rs b/tests/ui/mir/ssa-analysis-regression-50041.rs
index ebc3e2f8c..534f1c465 100644
--- a/tests/ui/mir/ssa-analysis-regression-50041.rs
+++ b/tests/ui/mir/ssa-analysis-regression-50041.rs
@@ -13,13 +13,10 @@ struct Unique<T: ?Sized>(NonNull<T>);
pub struct Box<T: ?Sized>(Unique<T>);
impl<T: ?Sized> Drop for Box<T> {
- fn drop(&mut self) {}
-}
-
-#[lang = "box_free"]
-#[inline(always)]
-unsafe fn box_free<T: ?Sized>(ptr: Unique<T>) {
- dealloc(ptr.0.0)
+ #[inline(always)]
+ fn drop(&mut self) {
+ dealloc(self.0.0.0)
+ }
}
#[inline(never)]
diff --git a/tests/ui/mir/thir-constparam-temp.rs b/tests/ui/mir/thir-constparam-temp.rs
index cdc5910b3..7eedc325d 100644
--- a/tests/ui/mir/thir-constparam-temp.rs
+++ b/tests/ui/mir/thir-constparam-temp.rs
@@ -3,7 +3,9 @@
#![feature(adt_const_params)]
#![allow(incomplete_features)]
-#[derive(PartialEq, Eq)]
+use std::marker::ConstParamTy;
+
+#[derive(PartialEq, Eq, ConstParamTy)]
struct Yikes;
impl Yikes {
diff --git a/tests/ui/mir/thir-constparam-temp.stderr b/tests/ui/mir/thir-constparam-temp.stderr
index b77d67e08..d50747e54 100644
--- a/tests/ui/mir/thir-constparam-temp.stderr
+++ b/tests/ui/mir/thir-constparam-temp.stderr
@@ -1,5 +1,5 @@
warning: taking a mutable reference to a `const` item
- --> $DIR/thir-constparam-temp.rs:14:5
+ --> $DIR/thir-constparam-temp.rs:16:5
|
LL | YIKES.mut_self()
| ^^^^^^^^^^^^^^^^
@@ -7,12 +7,12 @@ LL | YIKES.mut_self()
= note: each usage of a `const` item creates a new temporary
= note: the mutable reference will refer to this temporary, not the original `const` item
note: mutable reference created due to call to this method
- --> $DIR/thir-constparam-temp.rs:10:5
+ --> $DIR/thir-constparam-temp.rs:12:5
|
LL | fn mut_self(&mut self) {}
| ^^^^^^^^^^^^^^^^^^^^^^
note: `const` item defined here
- --> $DIR/thir-constparam-temp.rs:13:8
+ --> $DIR/thir-constparam-temp.rs:15:8
|
LL | fn foo<const YIKES: Yikes>() {
| ^^^^^^^^^^^^^^^^^^