Skip to content

Commit 6963320

Browse files
committed
Add 79018
Issue: rust-lang/rust#79018
1 parent ae2d2d9 commit 6963320

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

ices/79018.sh

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
3+
rustc - << 'EOF'
4+
#![crate_type = "lib"]
5+
#![feature(const_generics, const_evaluatable_checked)]
6+
#![allow(incomplete_features)]
7+
8+
pub struct Const<const U: u8>;
9+
10+
pub trait Trait {
11+
type AssocTy;
12+
fn assoc_fn() -> Self::AssocTy;
13+
}
14+
15+
impl<const U: u8> Trait for Const<U>
16+
where
17+
Const<{ my_const_fn(U) }>: ,
18+
{
19+
type AssocTy = Const<{ my_const_fn(U) }>;
20+
fn assoc_fn() -> Self::AssocTy {
21+
Const
22+
}
23+
}
24+
25+
const fn my_const_fn(val: u8) -> u8 {
26+
// body of this function doesn't matter
27+
val
28+
}
29+
EOF
30+
31+
rustc --extern my_crate=$(ls librust_out.*) - << 'EOF'
32+
extern crate my_crate;
33+
34+
use my_crate::{Const, Trait};
35+
36+
fn main() {
37+
let _ = Const::<1>::assoc_fn();
38+
}
39+
EOF

0 commit comments

Comments
 (0)