File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 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};
2323use rustc_hir_analysis:: check:: intrinsic:: intrinsic_operation_unsafety;
2424use rustc_index:: IndexVec ;
2525use rustc_metadata:: rendered_const;
26+ use rustc_middle:: span_bug;
2627use rustc_middle:: ty:: fast_reject:: SimplifiedType ;
2728use rustc_middle:: ty:: { self , TyCtxt , Visibility } ;
2829use rustc_resolve:: rustdoc:: {
@@ -266,8 +267,15 @@ impl ExternalCrate {
266267 let as_primitive = |res : Res < !> | {
267268 let Res :: Def ( DefKind :: Mod , def_id) = res else { return None } ;
268269 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) )
271279 } )
272280 } ;
273281
You can’t perform that action at this time.
0 commit comments