|
1 |
| -use rustc_ast::{MetaItemInner, MetaItemKind, ast, attr}; |
2 |
| -use rustc_attr::{InlineAttr, InstructionSetAttr, OptimizeAttr, list_contains_name}; |
| 1 | +use rustc_ast::{ast, attr, MetaItemInner, MetaItemKind}; |
| 2 | +use rustc_attr::{list_contains_name, InlineAttr, InstructionSetAttr, OptimizeAttr}; |
3 | 3 | use rustc_data_structures::fx::FxHashMap;
|
4 | 4 | use rustc_errors::codes::*;
|
5 |
| -use rustc_errors::{DiagMessage, SubdiagMessage, struct_span_code_err}; |
| 5 | +use rustc_errors::{struct_span_code_err, DiagMessage, SubdiagMessage}; |
6 | 6 | use rustc_hir as hir;
|
7 | 7 | use rustc_hir::def::DefKind;
|
8 |
| -use rustc_hir::def_id::{DefId, LOCAL_CRATE, LocalDefId}; |
| 8 | +use rustc_hir::def_id::{DefId, LocalDefId, LOCAL_CRATE}; |
9 | 9 | use rustc_hir::weak_lang_items::WEAK_LANG_ITEMS;
|
10 |
| -use rustc_hir::{LangItem, lang_items}; |
| 10 | +use rustc_hir::{lang_items, LangItem}; |
11 | 11 | use rustc_middle::middle::codegen_fn_attrs::{
|
12 | 12 | CodegenFnAttrFlags, CodegenFnAttrs, PatchableFunctionEntry,
|
13 | 13 | };
|
14 | 14 | use rustc_middle::mir::mono::Linkage;
|
15 | 15 | use rustc_middle::query::Providers;
|
16 | 16 | use rustc_middle::ty::{self as ty, TyCtxt};
|
17 | 17 | use rustc_session::parse::feature_err;
|
18 |
| -use rustc_session::{Session, lint}; |
| 18 | +use rustc_session::{lint, Session}; |
19 | 19 | use rustc_span::symbol::Ident;
|
20 |
| -use rustc_span::{Span, sym}; |
21 |
| -use rustc_target::spec::{SanitizerSet, abi}; |
| 20 | +use rustc_span::{sym, Span}; |
| 21 | +use rustc_target::spec::{abi, SanitizerSet}; |
22 | 22 |
|
23 | 23 | use crate::errors;
|
24 | 24 | use crate::target_features::{check_target_feature_trait_unsafe, from_target_feature_attr};
|
@@ -399,7 +399,16 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
|
399 | 399 | .emit();
|
400 | 400 | None
|
401 | 401 | }
|
402 |
| - _ => None, |
| 402 | + _ => { |
| 403 | + struct_span_code_err!( |
| 404 | + tcx.dcx(), |
| 405 | + attr.span, |
| 406 | + E0779, |
| 407 | + "`[instruction_set]` attribute argument should be valid" |
| 408 | + ) |
| 409 | + .emit(); |
| 410 | + None |
| 411 | + } |
403 | 412 | }
|
404 | 413 | }
|
405 | 414 | _ => None,
|
|
0 commit comments