From 2ff14448863ac1a1dd9533461708e29aae170c2d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:06:31 +0200 Subject: Adding debian version 1.65.0+dfsg1-2. Signed-off-by: Daniel Baumann --- .../ui/mir/issue-100476-recursion-check-blewup.rs | 42 ------------- src/test/ui/mir/issue-101844.rs | 73 ++++++++++++++++++++++ src/test/ui/mir/issue-102389.rs | 8 +++ src/test/ui/mir/issue-102389.stderr | 9 +++ src/test/ui/mir/issue-99852.rs | 24 +++++++ src/test/ui/mir/issue-99866.rs | 25 ++++++++ .../ice-issue-100550-unnormalized-projection.rs | 30 +++++++++ .../ui/mir/mir_codegen_calls_diverging_drops.rs | 1 + 8 files changed, 170 insertions(+), 42 deletions(-) delete mode 100644 src/test/ui/mir/issue-100476-recursion-check-blewup.rs create mode 100644 src/test/ui/mir/issue-101844.rs create mode 100644 src/test/ui/mir/issue-102389.rs create mode 100644 src/test/ui/mir/issue-102389.stderr create mode 100644 src/test/ui/mir/issue-99852.rs create mode 100644 src/test/ui/mir/issue-99866.rs create mode 100644 src/test/ui/mir/mir-inlining/ice-issue-100550-unnormalized-projection.rs (limited to 'src/test/ui/mir') diff --git a/src/test/ui/mir/issue-100476-recursion-check-blewup.rs b/src/test/ui/mir/issue-100476-recursion-check-blewup.rs deleted file mode 100644 index bc2f32f4c..000000000 --- a/src/test/ui/mir/issue-100476-recursion-check-blewup.rs +++ /dev/null @@ -1,42 +0,0 @@ -// check-pass - -// compile-flags: --emit=mir,link -O - -// At one point the MIR inlining, when guarding against infinitely (or even just -// excessive) recursion, was using `ty::Instance` as the basis for its history -// check. The problem is that when you have polymorphic recursion, you can have -// distinct instances of the same code (because you're inlining the same code -// with differing substitutions), causing the amount of inlining to blow up -// exponentially. -// -// This test illustrates an example of that filed in issue rust#100476. - -#![allow(unconditional_recursion)] -#![feature(decl_macro)] - -macro emit($($m:ident)*) {$( - // Randomize `def_path_hash` by defining them under a module with - // different names - pub mod $m { - pub trait Tr { - type Next: Tr; - } - - pub fn hoge() { - inner::(); - } - - #[inline(always)] - fn inner() { - inner::(); - } - } -)*} - -// Increase the chance of triggering the bug -emit!( - m00 m01 m02 m03 m04 m05 m06 m07 m08 m09 - m10 m11 m12 m13 m14 m15 m16 m17 m18 m19 -); - -fn main() { } diff --git a/src/test/ui/mir/issue-101844.rs b/src/test/ui/mir/issue-101844.rs new file mode 100644 index 000000000..da8a25f5f --- /dev/null +++ b/src/test/ui/mir/issue-101844.rs @@ -0,0 +1,73 @@ +// check-pass + +pub trait FirstTrait { + type Item; + type Extra: Extra<(), Error = Self::Item>; +} + +trait SecondTrait { + type Item2; +} + +trait ThirdTrait: SecondTrait { + type Item3; +} + +trait FourthTrait { + type Item4; +} + +impl SecondTrait for First +where + First: FirstTrait, +{ + type Item2 = First::Extra; +} + +impl ThirdTrait for Second +where + Second: SecondTrait, +{ + type Item3 = T; +} + +impl FourthTrait for Third +where + Third: ThirdTrait, +{ + type Item4 = S; +} + +pub trait Extra { + type Error; +} + +struct ImplShoulExist { + _gen: (D, Req), +} + +impl ImplShoulExist +where + D: FourthTrait, + D::Item4: Extra, + >::Error: Into<()>, +{ + fn access_fn(_: D) { + todo!() + } +} + +impl Extra for ImplShoulExist { + type Error = (); +} + +pub fn broken(ms: MS) +where + MS: FirstTrait, + MS::Item: Into<()>, +{ + // Error: Apparently Balance::new doesn't exist during MIR validation + let _ = ImplShoulExist::::access_fn(ms); +} + +fn main() {} diff --git a/src/test/ui/mir/issue-102389.rs b/src/test/ui/mir/issue-102389.rs new file mode 100644 index 000000000..8b27d5e55 --- /dev/null +++ b/src/test/ui/mir/issue-102389.rs @@ -0,0 +1,8 @@ +enum Enum { A, B, C } + +fn func(inbounds: &Enum, array: &[i16; 3]) -> i16 { + array[*inbounds as usize] + //~^ ERROR [E0507] +} + +fn main() {} diff --git a/src/test/ui/mir/issue-102389.stderr b/src/test/ui/mir/issue-102389.stderr new file mode 100644 index 000000000..925dc258a --- /dev/null +++ b/src/test/ui/mir/issue-102389.stderr @@ -0,0 +1,9 @@ +error[E0507]: cannot move out of `*inbounds` which is behind a shared reference + --> $DIR/issue-102389.rs:4:11 + | +LL | array[*inbounds as usize] + | ^^^^^^^^^ move occurs because `*inbounds` has type `Enum`, which does not implement the `Copy` trait + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/mir/issue-99852.rs b/src/test/ui/mir/issue-99852.rs new file mode 100644 index 000000000..1c675788e --- /dev/null +++ b/src/test/ui/mir/issue-99852.rs @@ -0,0 +1,24 @@ +// check-pass +// compile-flags: -Z validate-mir +#![feature(let_chains)] + +fn lambda() -> U +where + T: Default, + U: Default, +{ + let foo: Result = Ok(T::default()); + let baz: U = U::default(); + + if let Ok(foo) = foo && let Ok(bar) = transform(foo) { + bar + } else { + baz + } +} + +fn transform(input: T) -> Result { + todo!() +} + +fn main() {} diff --git a/src/test/ui/mir/issue-99866.rs b/src/test/ui/mir/issue-99866.rs new file mode 100644 index 000000000..d39ae6ebf --- /dev/null +++ b/src/test/ui/mir/issue-99866.rs @@ -0,0 +1,25 @@ +// check-pass +pub trait Backend { + type DescriptorSetLayout; +} + +pub struct Back; + +impl Backend for Back { + type DescriptorSetLayout = u32; +} + +pub struct HalSetLayouts { + vertex_layout: ::DescriptorSetLayout, +} + +impl HalSetLayouts { + pub fn iter(self) -> DSL + where + Back: Backend, + { + self.vertex_layout + } +} + +fn main() {} diff --git a/src/test/ui/mir/mir-inlining/ice-issue-100550-unnormalized-projection.rs b/src/test/ui/mir/mir-inlining/ice-issue-100550-unnormalized-projection.rs new file mode 100644 index 000000000..f67b07354 --- /dev/null +++ b/src/test/ui/mir/mir-inlining/ice-issue-100550-unnormalized-projection.rs @@ -0,0 +1,30 @@ +// This test verifies that we do not ICE due to MIR inlining in case of normalization failure +// in a projection. +// +// compile-flags: --crate-type lib -C opt-level=3 +// build-pass + +pub trait Trait { + type Associated; +} +impl Trait for T { + type Associated = T; +} + +pub struct Struct(::Associated); + +pub fn foo() -> Struct +where + T: Trait, +{ + bar() +} + +#[inline] +fn bar() -> Struct { + Struct(baz()) +} + +fn baz() -> T { + unimplemented!() +} diff --git a/src/test/ui/mir/mir_codegen_calls_diverging_drops.rs b/src/test/ui/mir/mir_codegen_calls_diverging_drops.rs index 796d74477..3d2156105 100644 --- a/src/test/ui/mir/mir_codegen_calls_diverging_drops.rs +++ b/src/test/ui/mir/mir_codegen_calls_diverging_drops.rs @@ -2,6 +2,7 @@ // error-pattern:diverging_fn called // error-pattern:0 dropped // ignore-emscripten no processes +// needs-unwind this test checks that a destructor is called after panicking struct Droppable(u8); impl Drop for Droppable { -- cgit v1.2.3