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

add 3/4 ices #1413

Merged
merged 1 commit into from
Sep 8, 2022
Merged
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
20 changes: 20 additions & 0 deletions ices/101465.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#![feature(trait_alias)]

struct B;

struct C;

trait Tr2<S> = Into<S>;

fn foo2<T: Tr2<()>>() {}

fn foo() -> impl Sized {
let x = foo2::<_>();

match true {
true => B,
false => C,
}
}

pub fn main() {}
31 changes: 31 additions & 0 deletions ices/101518-1.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

rustc -Cincremental=/tmp/a -Zincremental-verify-ich=yes --crate-type lib - <<'EOF'


#[derive(PartialEq, Eq)]
struct Id<'a> {
ns: &'a str,
}
fn visit_struct() {
let id = Id { ns: "random1" };
const FLAG: Id<'static> = Id {
ns: "needs_to_be_the_same",
};
match id {
FLAG => {}
_ => {}
}
}
fn visit_struct2() {
let id = Id { ns: "random2" };
const FLAG: Id<'static> = Id {
ns: "needs_to_be_the_same",
};
match id {
FLAG => {}
_ => {}
}
}

EOF
24 changes: 24 additions & 0 deletions ices/101518-2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

rustc -Cincremental=/tmp/a -Zincremental-verify-ich=yes --crate-type lib - <<'EOF'

#[derive(Eq, PartialEq)]
struct Id(&'static str);

fn f() {
const FLAG: Id = Id("");
match Id("") {
FLAG => (),
_ => (),
};
}

fn g() {
const FLAG: Id = Id("");
match Id("") {
FLAG => (),
_ => (),
};
}

EOF
40 changes: 40 additions & 0 deletions ices/101557.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#![feature(generic_const_exprs)]
use std::marker::PhantomData;

trait Trait {
const CONST: usize;
}

struct A<T: Trait> {
_marker: PhantomData<T>,
}

impl<const N: usize> Trait for [i8; N] {
const CONST: usize = N;
}

impl<const N: usize> From<usize> for A<[i8; N]> {
fn from(_: usize) -> Self {
todo!()
}
}

impl<T: Trait> From<A<[i8; T::CONST]>> for A<T> {
fn from(_: A<[i8; T::CONST]>) -> Self {
todo!()
}
}

fn f<T: Trait>() -> A<T>
where
[(); T::CONST]:,
{
// Usage of `0` is arbitrary
let a = A::<[i8; T::CONST]>::from(0);
A::<T>::from(a)
}

fn main() {
// Usage of `1` is arbitrary
f::<[i8; 1]>();
}