Skip to content

Commit 58ac2b2

Browse files
authored
Rollup merge of rust-lang#63473 - adrian-budau:master, r=Centril
Regression test for rust-lang#56870 Closes rust-lang#56870.
2 parents 4d27aac + 75d2db9 commit 58ac2b2

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

Diff for: src/test/ui/issues/issue-56870.rs

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// build-pass
2+
// Regression test for #56870: Internal compiler error (traits & associated consts)
3+
4+
use std::fmt::Debug;
5+
6+
pub trait Foo<T> {
7+
const FOO: *const u8;
8+
}
9+
10+
impl <T: Debug> Foo<T> for dyn Debug {
11+
const FOO: *const u8 = <T as Debug>::fmt as *const u8;
12+
}
13+
14+
pub trait Bar {
15+
const BAR: *const u8;
16+
}
17+
18+
pub trait Baz {
19+
type Data: Debug;
20+
}
21+
22+
pub struct BarStruct<S: Baz>(S);
23+
24+
impl<S: Baz> Bar for BarStruct<S> {
25+
const BAR: *const u8 = <dyn Debug as Foo<<S as Baz>::Data>>::FOO;
26+
}
27+
28+
struct AnotherStruct;
29+
#[derive(Debug)]
30+
struct SomeStruct;
31+
32+
impl Baz for AnotherStruct {
33+
type Data = SomeStruct;
34+
}
35+
36+
fn main() {
37+
let _x = <BarStruct<AnotherStruct> as Bar>::BAR;
38+
}

0 commit comments

Comments
 (0)