@@ -27,6 +27,7 @@ use rustc_middle::middle::resolve_bound_vars::Set1;
27
27
use rustc_middle:: { bug, span_bug} ;
28
28
use rustc_session:: config:: { CrateType , ResolveDocLinks } ;
29
29
use rustc_session:: lint;
30
+ use rustc_session:: parse:: feature_err;
30
31
use rustc_span:: source_map:: { respan, Spanned } ;
31
32
use rustc_span:: symbol:: { kw, sym, Ident , Symbol } ;
32
33
use rustc_span:: { BytePos , Span , SyntaxContext } ;
@@ -4123,6 +4124,25 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
4123
4124
&& PrimTy :: from_name ( path[ 0 ] . ident . name ) . is_some ( ) =>
4124
4125
{
4125
4126
let prim = PrimTy :: from_name ( path[ 0 ] . ident . name ) . unwrap ( ) ;
4127
+ let tcx = self . r . tcx ( ) ;
4128
+
4129
+ let gate_err_sym_msg = match prim {
4130
+ PrimTy :: Float ( FloatTy :: F16 ) if !tcx. features ( ) . f16 => {
4131
+ Some ( ( sym:: f16, "the type `f16` is unstable" ) )
4132
+ }
4133
+ PrimTy :: Float ( FloatTy :: F128 ) if !tcx. features ( ) . f128 => {
4134
+ Some ( ( sym:: f128, "the type `f128` is unstable" ) )
4135
+ }
4136
+ _ => None ,
4137
+ } ;
4138
+
4139
+ if let Some ( ( sym, msg) ) = gate_err_sym_msg {
4140
+ let span = path[ 0 ] . ident . span ;
4141
+ if !span. allows_unstable ( sym) {
4142
+ feature_err ( tcx. sess , sym, span, msg) . emit ( ) ;
4143
+ }
4144
+ } ;
4145
+
4126
4146
PartialRes :: with_unresolved_segments ( Res :: PrimTy ( prim) , path. len ( ) - 1 )
4127
4147
}
4128
4148
PathResult :: Module ( ModuleOrUniformRoot :: Module ( module) ) => {
0 commit comments