From 5ca315acb81c929adae8b53a8c5a7a79fedf3e90 Mon Sep 17 00:00:00 2001 From: Ben Reeves Date: Sun, 11 Sep 2022 22:41:03 -0500 Subject: [PATCH 1/2] Add two ICEs for issue 101696 Tracks https://github.com/rust-lang/rust/issues/101696 --- ices/101696-1.rs | 34 ++++++++++++++++++++++++++++++++++ ices/101696-2.rs | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 ices/101696-1.rs create mode 100644 ices/101696-2.rs diff --git a/ices/101696-1.rs b/ices/101696-1.rs new file mode 100644 index 00000000..b4995f8b --- /dev/null +++ b/ices/101696-1.rs @@ -0,0 +1,34 @@ +use std::marker::PhantomData; + +#[derive(Default)] +struct MyType<'a> { + field: usize, + _phantom: PhantomData<&'a ()>, +} + +#[derive(Default)] +struct MyTypeVariant<'a> { + field: usize, + _phantom: PhantomData<&'a ()>, +} + +trait AsVariantTrait { + type Type; +} + +impl<'a> AsVariantTrait for MyType<'a> { + type Type = MyTypeVariant<'a>; +} + +type Variant = ::Type; + +fn foo(f: F) { + let input = T::default(); + f(input); +} + +fn main() { + foo(|a: Variant| { + a.field; + }); +} diff --git a/ices/101696-2.rs b/ices/101696-2.rs new file mode 100644 index 00000000..59a6711a --- /dev/null +++ b/ices/101696-2.rs @@ -0,0 +1,32 @@ +use std::marker::PhantomData; + +#[derive(Default)] +struct MyType<'a> { + field: usize, + _phantom: PhantomData<&'a ()>, +} + +#[derive(Default)] +struct MyTypeVariant<'a> { + field: usize, + _phantom: PhantomData<&'a ()>, +} + +trait AsVariantTrait { + type Type; +} + +impl<'a> AsVariantTrait for MyType<'a> { + type Type = MyTypeVariant<'a>; +} + +fn foo(f: F) { + let input = T::default(); + f(input); +} + +fn main() { + foo(|a: ::Type| { + a.field; + }); +} From c1175199b788d4ab1c1c171e030df391de967806 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sun, 18 Sep 2022 04:10:38 +0200 Subject: [PATCH 2/2] add 4 ices https://github.com/rust-lang/rust/issues/101739 https://github.com/rust-lang/rust/issues/101852 https://github.com/rust-lang/rust/issues/101940 https://github.com/rust-lang/rust/issues/101962 --- ices/101739.sh | 24 ++++++++++++++++++++++++ ices/101852.rs | 10 ++++++++++ ices/101940.rs | 19 +++++++++++++++++++ ices/101962.rs | 9 +++++++++ 4 files changed, 62 insertions(+) create mode 100755 ices/101739.sh create mode 100644 ices/101852.rs create mode 100644 ices/101940.rs create mode 100644 ices/101962.rs diff --git a/ices/101739.sh b/ices/101739.sh new file mode 100755 index 00000000..276e4fe4 --- /dev/null +++ b/ices/101739.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +rustc -Zsave-analysis - <<'EOF' + +#![feature(transmutability)] + +mod assert { + use std::mem::BikeshedIntrinsicFrom; + + pub fn is_transmutable() + where + Dst: BikeshedIntrinsicFrom, + {} +} + +fn via_const() { + struct Context; + struct Src; + + assert::is_transmutable::(); +} + +EOF + diff --git a/ices/101852.rs b/ices/101852.rs new file mode 100644 index 00000000..7bbb4a70 --- /dev/null +++ b/ices/101852.rs @@ -0,0 +1,10 @@ +pub fn ice( + x: impl AsRef, +) -> impl IntoIterator { + vec![].append(&mut ice(x.as_ref())); + + Vec::new() +} + +fn main() { +} diff --git a/ices/101940.rs b/ices/101940.rs new file mode 100644 index 00000000..fd3e1e9b --- /dev/null +++ b/ices/101940.rs @@ -0,0 +1,19 @@ +pub trait Trait { + type Fut<'a> where Self: 'a; + fn fun<'a, 'b>(&'a self, x: &'_ mut &'b ()) -> Self::Fut<'a> + where + 'b: 'a; +} +impl Trait for () { + type Fut<'a> = impl ::std::future::Future + 'a + where + Self: 'a; + fn fun<'a, 'b>(&'a self, x: &'_ mut &'b ()) -> Self::Fut<'a> + where + 'b: 'a, + { + async { } + } +} + +pub fn main() {} diff --git a/ices/101962.rs b/ices/101962.rs new file mode 100644 index 00000000..b4e3b825 --- /dev/null +++ b/ices/101962.rs @@ -0,0 +1,9 @@ +#![feature(core_intrinsics)] + +pub fn wrapping(a: T, b: T) { + let _z = core::intrinsics::wrapping_mul(a, b); +} + +pub fn main() { + wrapping(1,2); +}