Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

add more ices #1420

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions ices/101696-1.rs
Original file line number Diff line number Diff line change
@@ -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<G> = <G as AsVariantTrait>::Type;

fn foo<T: Default, F: FnOnce(T)>(f: F) {
let input = T::default();
f(input);
}

fn main() {
foo(|a: Variant<MyType>| {
a.field;
});
}
32 changes: 32 additions & 0 deletions ices/101696-2.rs
Original file line number Diff line number Diff line change
@@ -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<T: Default, F: FnOnce(T)>(f: F) {
let input = T::default();
f(input);
}

fn main() {
foo(|a: <MyType as AsVariantTrait>::Type| {
a.field;
});
}
24 changes: 24 additions & 0 deletions ices/101739.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

rustc -Zsave-analysis - <<'EOF'

#![feature(transmutability)]

mod assert {
use std::mem::BikeshedIntrinsicFrom;

pub fn is_transmutable<Src, Context, const ASSUME_ALIGNMENT: bool>()
where
Dst: BikeshedIntrinsicFrom<Src, Context, ASSUME_ALIGNMENT>,
{}
}

fn via_const() {
struct Context;
struct Src;

assert::is_transmutable::<Src, Context, false>();
}

EOF

10 changes: 10 additions & 0 deletions ices/101852.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
pub fn ice(
x: impl AsRef<str>,
) -> impl IntoIterator<Item = ()> {
vec![].append(&mut ice(x.as_ref()));

Vec::new()
}

fn main() {
}
19 changes: 19 additions & 0 deletions ices/101940.rs
Original file line number Diff line number Diff line change
@@ -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() {}
9 changes: 9 additions & 0 deletions ices/101962.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#![feature(core_intrinsics)]

pub fn wrapping<T: Copy>(a: T, b: T) {
let _z = core::intrinsics::wrapping_mul(a, b);
}

pub fn main() {
wrapping(1,2);
}