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

Commit 84c67b0

Browse files
authored
Merge pull request #1413 from matthiaskrgr/bla
2 parents 97ab2f6 + dc11b43 commit 84c67b0

File tree

4 files changed

+115
-0
lines changed

4 files changed

+115
-0
lines changed

ices/101465.rs

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#![feature(trait_alias)]
2+
3+
struct B;
4+
5+
struct C;
6+
7+
trait Tr2<S> = Into<S>;
8+
9+
fn foo2<T: Tr2<()>>() {}
10+
11+
fn foo() -> impl Sized {
12+
let x = foo2::<_>();
13+
14+
match true {
15+
true => B,
16+
false => C,
17+
}
18+
}
19+
20+
pub fn main() {}

ices/101518-1.sh

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
3+
rustc -Cincremental=/tmp/a -Zincremental-verify-ich=yes --crate-type lib - <<'EOF'
4+
5+
6+
#[derive(PartialEq, Eq)]
7+
struct Id<'a> {
8+
ns: &'a str,
9+
}
10+
fn visit_struct() {
11+
let id = Id { ns: "random1" };
12+
const FLAG: Id<'static> = Id {
13+
ns: "needs_to_be_the_same",
14+
};
15+
match id {
16+
FLAG => {}
17+
_ => {}
18+
}
19+
}
20+
fn visit_struct2() {
21+
let id = Id { ns: "random2" };
22+
const FLAG: Id<'static> = Id {
23+
ns: "needs_to_be_the_same",
24+
};
25+
match id {
26+
FLAG => {}
27+
_ => {}
28+
}
29+
}
30+
31+
EOF

ices/101518-2.sh

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
rustc -Cincremental=/tmp/a -Zincremental-verify-ich=yes --crate-type lib - <<'EOF'
4+
5+
#[derive(Eq, PartialEq)]
6+
struct Id(&'static str);
7+
8+
fn f() {
9+
const FLAG: Id = Id("");
10+
match Id("") {
11+
FLAG => (),
12+
_ => (),
13+
};
14+
}
15+
16+
fn g() {
17+
const FLAG: Id = Id("");
18+
match Id("") {
19+
FLAG => (),
20+
_ => (),
21+
};
22+
}
23+
24+
EOF

ices/101557.rs

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#![feature(generic_const_exprs)]
2+
use std::marker::PhantomData;
3+
4+
trait Trait {
5+
const CONST: usize;
6+
}
7+
8+
struct A<T: Trait> {
9+
_marker: PhantomData<T>,
10+
}
11+
12+
impl<const N: usize> Trait for [i8; N] {
13+
const CONST: usize = N;
14+
}
15+
16+
impl<const N: usize> From<usize> for A<[i8; N]> {
17+
fn from(_: usize) -> Self {
18+
todo!()
19+
}
20+
}
21+
22+
impl<T: Trait> From<A<[i8; T::CONST]>> for A<T> {
23+
fn from(_: A<[i8; T::CONST]>) -> Self {
24+
todo!()
25+
}
26+
}
27+
28+
fn f<T: Trait>() -> A<T>
29+
where
30+
[(); T::CONST]:,
31+
{
32+
// Usage of `0` is arbitrary
33+
let a = A::<[i8; T::CONST]>::from(0);
34+
A::<T>::from(a)
35+
}
36+
37+
fn main() {
38+
// Usage of `1` is arbitrary
39+
f::<[i8; 1]>();
40+
}

0 commit comments

Comments
 (0)