This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed
src/test/ui/stability-attribute Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -32,18 +32,22 @@ impl Trait3<usize> for S {
3232fn main ( ) {
3333 let _ = S ;
3434
35- let _ = Struct1 { field : 1 } ; // ERROR use of unstable library feature 'unstable_default'
36- let _: Struct1 = Struct1 { field : 1 } ; // ERROR use of unstable library feature 'unstable_default'
3735 let _: Struct1 < isize > = Struct1 { field : 1 } ; //~ ERROR use of unstable library feature 'unstable_default'
3836
3937 let _ = STRUCT1 ; // ok
4038 let _: Struct1 = STRUCT1 ; // ok
4139 let _: Struct1 < usize > = STRUCT1 ; //~ ERROR use of unstable library feature 'unstable_default'
42- let _: Struct1 < usize > = STRUCT1 ; //~ ERROR use of unstable library feature 'unstable_default'
43- let _ = STRUCT1 . field ; // ok
44- let _: usize = STRUCT1 . field ; // ERROR use of unstable library feature 'unstable_default'
45- let _ = STRUCT1 . field + 1 ; // ERROR use of unstable library feature 'unstable_default'
46- let _ = STRUCT1 . field + 1usize ; // ERROR use of unstable library feature 'unstable_default'
40+ let _: Struct1 < isize > = STRUCT1 ; //~ ERROR use of unstable library feature 'unstable_default'
41+
42+ // Instability is not enforced for generic type parameters used in public fields.
43+ // Note how the unstable type default `usize` leaks,
44+ // and can be used without the 'unstable_default' feature.
45+ let _ = STRUCT1 . field ;
46+ let _ = Struct1 { field : 1 } ;
47+ let _: Struct1 = Struct1 { field : 1 } ;
48+ let _: usize = STRUCT1 . field ;
49+ let _ = STRUCT1 . field + 1 ;
50+ let _ = STRUCT1 . field + 1usize ;
4751
4852 let _ = Struct2 { field : 1 } ; // ok
4953 let _: Struct2 = Struct2 { field : 1 } ; // ok
You can’t perform that action at this time.
0 commit comments