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 {
32
32
fn main ( ) {
33
33
let _ = S ;
34
34
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'
37
35
let _: Struct1 < isize > = Struct1 { field : 1 } ; //~ ERROR use of unstable library feature 'unstable_default'
38
36
39
37
let _ = STRUCT1 ; // ok
40
38
let _: Struct1 = STRUCT1 ; // ok
41
39
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 ;
47
51
48
52
let _ = Struct2 { field : 1 } ; // ok
49
53
let _: Struct2 = Struct2 { field : 1 } ; // ok
You can’t perform that action at this time.
0 commit comments