about summary refs log tree commit diff
path: root/src/test/ui/const_prop
diff options
context:
space:
mode:
authorAlbert Larsan <74931857+albertlarsan68@users.noreply.github.com>2023-01-05 09:13:28 +0100
committerAlbert Larsan <74931857+albertlarsan68@users.noreply.github.com>2023-01-11 09:32:08 +0000
commitcf2dff2b1e3fa55fa5415d524200070d0d7aacfe (patch)
tree40a88d9a46aaf3e8870676eb2538378b75a263eb /src/test/ui/const_prop
parentca855e6e42787ecd062d81d53336fe6788ef51a9 (diff)
downloadrust-cf2dff2b1e3fa55fa5415d524200070d0d7aacfe.tar.gz
rust-cf2dff2b1e3fa55fa5415d524200070d0d7aacfe.zip
Move /src/test to /tests
Diffstat (limited to 'src/test/ui/const_prop')
-rw-r--r--src/test/ui/const_prop/ice-assert-fail-div-by-zero.rs14
-rw-r--r--src/test/ui/const_prop/ice-assert-fail-div-by-zero.stderr14
-rw-r--r--src/test/ui/const_prop/inline_spans.rs15
-rw-r--r--src/test/ui/const_prop/inline_spans_lint_attribute.rs15
-rw-r--r--src/test/ui/const_prop/issue-102553.rs24
5 files changed, 0 insertions, 82 deletions
diff --git a/src/test/ui/const_prop/ice-assert-fail-div-by-zero.rs b/src/test/ui/const_prop/ice-assert-fail-div-by-zero.rs
deleted file mode 100644
index 2afbf3432fb..00000000000
--- a/src/test/ui/const_prop/ice-assert-fail-div-by-zero.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-// check-pass
-
-// need to emit MIR, because const prop (which emits `unconditional_panic`) only runs if
-// the `optimized_mir` query is run, which it isn't in check-only mode.
-// compile-flags: --crate-type lib --emit=mir,link
-
-#![warn(unconditional_panic)]
-
-pub struct Fixed64(i64);
-
-// HACK: this test passes only because this is a const fn that is written to metadata
-pub const fn div(f: Fixed64) {
-    f.0 / 0; //~ WARN will panic at runtime
-}
diff --git a/src/test/ui/const_prop/ice-assert-fail-div-by-zero.stderr b/src/test/ui/const_prop/ice-assert-fail-div-by-zero.stderr
deleted file mode 100644
index 865c69c3c89..00000000000
--- a/src/test/ui/const_prop/ice-assert-fail-div-by-zero.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-warning: this operation will panic at runtime
-  --> $DIR/ice-assert-fail-div-by-zero.rs:13:5
-   |
-LL |     f.0 / 0;
-   |     ^^^^^^^ attempt to divide `_` by zero
-   |
-note: the lint level is defined here
-  --> $DIR/ice-assert-fail-div-by-zero.rs:7:9
-   |
-LL | #![warn(unconditional_panic)]
-   |         ^^^^^^^^^^^^^^^^^^^
-
-warning: 1 warning emitted
-
diff --git a/src/test/ui/const_prop/inline_spans.rs b/src/test/ui/const_prop/inline_spans.rs
deleted file mode 100644
index 504f2781156..00000000000
--- a/src/test/ui/const_prop/inline_spans.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-// build-pass
-// compile-flags: -Zmir-opt-level=3
-// Overflow can't be detected by const prop
-// could only be detected after optimizations
-
-#![deny(warnings)]
-
-fn main() {
-    let _ = add(u8::MAX, 1);
-}
-
-#[inline(always)]
-fn add(x: u8, y: u8) -> u8 {
-    x + y
-}
diff --git a/src/test/ui/const_prop/inline_spans_lint_attribute.rs b/src/test/ui/const_prop/inline_spans_lint_attribute.rs
deleted file mode 100644
index 1db53d77193..00000000000
--- a/src/test/ui/const_prop/inline_spans_lint_attribute.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-// Must be build-pass, because check-pass will not run const prop and thus not emit the lint anyway.
-// build-pass
-// compile-flags: -Zmir-opt-level=3
-
-#![deny(warnings)]
-
-fn main() {
-    #[allow(arithmetic_overflow)]
-    let _ = add(u8::MAX, 1);
-}
-
-#[inline(always)]
-fn add(x: u8, y: u8) -> u8 {
-    x + y
-}
diff --git a/src/test/ui/const_prop/issue-102553.rs b/src/test/ui/const_prop/issue-102553.rs
deleted file mode 100644
index 523a9d7ac72..00000000000
--- a/src/test/ui/const_prop/issue-102553.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-// compile-flags: --crate-type=lib
-// check-pass
-
-pub trait Widget<E> {
-    fn boxed<'w>(self) -> Box<dyn WidgetDyn<E> + 'w>
-    where
-        Self: Sized + 'w;
-}
-
-pub trait WidgetDyn<E> {}
-
-impl<T, E> WidgetDyn<E> for T where T: Widget<E> {}
-
-impl<E> Widget<E> for dyn WidgetDyn<E> + '_ {
-    fn boxed<'w>(self) -> Box<dyn WidgetDyn<E> + 'w>
-    where
-        Self: Sized + 'w,
-    {
-        // Even though this is illegal to const evaluate, this should never
-        // trigger an ICE because it can never be called from actual code
-        // (due to the trivially false where-clause predicate).
-        Box::new(self)
-    }
-}