File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments