File tree 1 file changed +10
-2
lines changed
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ use rustc_hir::{BodyId, Mutability};
23
23
use rustc_hir_analysis:: check:: intrinsic:: intrinsic_operation_unsafety;
24
24
use rustc_index:: IndexVec ;
25
25
use rustc_metadata:: rendered_const;
26
+ use rustc_middle:: span_bug;
26
27
use rustc_middle:: ty:: fast_reject:: SimplifiedType ;
27
28
use rustc_middle:: ty:: { self , TyCtxt , Visibility } ;
28
29
use rustc_resolve:: rustdoc:: {
@@ -266,8 +267,15 @@ impl ExternalCrate {
266
267
let as_primitive = |res : Res < !> | {
267
268
let Res :: Def ( DefKind :: Mod , def_id) = res else { return None } ;
268
269
tcx. get_attrs ( def_id, sym:: rustc_doc_primitive) . find_map ( |attr| {
269
- // FIXME: should warn on unknown primitives?
270
- Some ( ( def_id, PrimitiveType :: from_symbol ( attr. value_str ( ) ?) ?) )
270
+ let attr_value = attr. value_str ( ) . expect ( "syntax should already be validated" ) ;
271
+ let Some ( prim) = PrimitiveType :: from_symbol ( attr_value) else {
272
+ span_bug ! (
273
+ attr. span,
274
+ "primitive `{attr_value}` is not a member of `PrimitiveType`"
275
+ ) ;
276
+ } ;
277
+
278
+ Some ( ( def_id, prim) )
271
279
} )
272
280
} ;
273
281
You can’t perform that action at this time.
0 commit comments