File tree Expand file tree Collapse file tree 3 files changed +6
-45
lines changed
compiler/rustc_const_eval/src/const_eval Expand file tree Collapse file tree 3 files changed +6
-45
lines changed Original file line number Diff line number Diff line change @@ -74,14 +74,6 @@ impl<'tcx> InterpCx<'tcx, CompileTimeMachine<'tcx>> {
7474
7575 variant
7676 }
77- ty:: Bool => {
78- let ( variant, _variant_place) = downcast ( sym:: Bool ) ?;
79- variant
80- }
81- ty:: Char => {
82- let ( variant, _variant_place) = downcast ( sym:: Char ) ?;
83- variant
84- }
8577 ty:: Int ( int_ty) => {
8678 let ( variant, variant_place) = downcast ( sym:: Int ) ?;
8779 let place = self . project_field ( & variant_place, FieldIdx :: ZERO ) ?;
@@ -108,10 +100,6 @@ impl<'tcx> InterpCx<'tcx, CompileTimeMachine<'tcx>> {
108100 self . write_float_type_info ( place, float_ty. bit_width ( ) ) ?;
109101 variant
110102 }
111- ty:: Str => {
112- let ( variant, _variant_place) = downcast ( sym:: Str ) ?;
113- variant
114- }
115103 ty:: Ref ( _, ty, mutability) => {
116104 let ( variant, variant_place) = downcast ( sym:: Reference ) ?;
117105 let reference_place =
@@ -136,6 +124,9 @@ impl<'tcx> InterpCx<'tcx, CompileTimeMachine<'tcx>> {
136124 variant
137125 }
138126 ty:: Adt ( _, _)
127+ | ty:: Bool
128+ | ty:: Char
129+ | ty:: Str
139130 | ty:: Foreign ( _)
140131 | ty:: Pat ( _, _)
141132 | ty:: FnDef ( ..)
Original file line number Diff line number Diff line change @@ -49,16 +49,10 @@ pub enum TypeKind {
4949 Slice ( Slice ) ,
5050 /// Dynamic Traits.
5151 DynTrait ( DynTrait ) ,
52- /// Primitive boolean type.
53- Bool ( Bool ) ,
54- /// Primitive character type.
55- Char ( Char ) ,
5652 /// Primitive signed and unsigned integer type.
5753 Int ( Int ) ,
5854 /// Primitive floating-point type.
5955 Float ( Float ) ,
60- /// String slice type.
61- Str ( Str ) ,
6256 /// References.
6357 Reference ( Reference ) ,
6458 /// Pointers.
@@ -137,22 +131,6 @@ pub struct Trait {
137131 pub is_auto : bool ,
138132}
139133
140- /// Compile-time type information about `bool`.
141- #[ derive( Debug ) ]
142- #[ non_exhaustive]
143- #[ unstable( feature = "type_info" , issue = "146922" ) ]
144- pub struct Bool {
145- // No additional information to provide for now.
146- }
147-
148- /// Compile-time type information about `char`.
149- #[ derive( Debug ) ]
150- #[ non_exhaustive]
151- #[ unstable( feature = "type_info" , issue = "146922" ) ]
152- pub struct Char {
153- // No additional information to provide for now.
154- }
155-
156134/// Compile-time type information about signed and unsigned integer types.
157135#[ derive( Debug ) ]
158136#[ non_exhaustive]
@@ -173,14 +151,6 @@ pub struct Float {
173151 pub bits : u32 ,
174152}
175153
176- /// Compile-time type information about string slice types.
177- #[ derive( Debug ) ]
178- #[ non_exhaustive]
179- #[ unstable( feature = "type_info" , issue = "146922" ) ]
180- pub struct Str {
181- // No additional information to provide for now.
182- }
183-
184154/// Compile-time type information about references.
185155#[ derive( Debug ) ]
186156#[ non_exhaustive]
Original file line number Diff line number Diff line change @@ -70,10 +70,10 @@ fn test_tuples() {
7070fn test_primitives ( ) {
7171 use TypeKind :: * ;
7272
73- let Type { kind : Bool ( _ty ) , size, .. } = ( const { Type :: of :: < bool > ( ) } ) else { panic ! ( ) } ;
73+ let Type { kind : Other , size, .. } = ( const { Type :: of :: < bool > ( ) } ) else { panic ! ( ) } ;
7474 assert_eq ! ( size, Some ( 1 ) ) ;
7575
76- let Type { kind : Char ( _ty ) , size, .. } = ( const { Type :: of :: < char > ( ) } ) else { panic ! ( ) } ;
76+ let Type { kind : Other , size, .. } = ( const { Type :: of :: < char > ( ) } ) else { panic ! ( ) } ;
7777 assert_eq ! ( size, Some ( 4 ) ) ;
7878
7979 let Type { kind : Int ( ty) , size, .. } = ( const { Type :: of :: < i32 > ( ) } ) else { panic ! ( ) } ;
@@ -100,7 +100,7 @@ fn test_primitives() {
100100 assert_eq ! ( size, Some ( 4 ) ) ;
101101 assert_eq ! ( ty. bits, 32 ) ;
102102
103- let Type { kind : Str ( _ty ) , size, .. } = ( const { Type :: of :: < str > ( ) } ) else { panic ! ( ) } ;
103+ let Type { kind : Other , size, .. } = ( const { Type :: of :: < str > ( ) } ) else { panic ! ( ) } ;
104104 assert_eq ! ( size, None ) ;
105105}
106106
You can’t perform that action at this time.
0 commit comments