@@ -10,7 +10,6 @@ pub use self::UnsafeSource::*;
1010
1111use crate :: hir:: def:: { DefKind , Res } ;
1212use crate :: hir:: def_id:: { DefId , DefIndex , LocalDefId , CRATE_DEF_INDEX } ;
13- use crate :: mir:: mono:: Linkage ;
1413use crate :: ty:: query:: Providers ;
1514use crate :: util:: nodemap:: { FxHashSet , NodeMap } ;
1615
@@ -29,7 +28,6 @@ use syntax::ast::{self, AsmDialect, CrateSugar, Ident, Name, NodeId};
2928use syntax:: ast:: { AttrVec , Attribute , FloatTy , IntTy , Label , LitKind , StrStyle , UintTy } ;
3029pub use syntax:: ast:: { BorrowKind , ImplPolarity , IsAuto } ;
3130pub use syntax:: ast:: { CaptureBy , Constness , Movability , Mutability , Unsafety } ;
32- use syntax:: attr:: { InlineAttr , OptimizeAttr } ;
3331use syntax:: tokenstream:: TokenStream ;
3432use syntax:: util:: parser:: ExprPrecedence ;
3533
@@ -2668,119 +2666,6 @@ pub fn provide(providers: &mut Providers<'_>) {
26682666 upvars:: provide ( providers) ;
26692667}
26702668
2671- #[ derive( Clone , RustcEncodable , RustcDecodable , HashStable ) ]
2672- pub struct CodegenFnAttrs {
2673- pub flags : CodegenFnAttrFlags ,
2674- /// Parsed representation of the `#[inline]` attribute
2675- pub inline : InlineAttr ,
2676- /// Parsed representation of the `#[optimize]` attribute
2677- pub optimize : OptimizeAttr ,
2678- /// The `#[export_name = "..."]` attribute, indicating a custom symbol a
2679- /// function should be exported under
2680- pub export_name : Option < Symbol > ,
2681- /// The `#[link_name = "..."]` attribute, indicating a custom symbol an
2682- /// imported function should be imported as. Note that `export_name`
2683- /// probably isn't set when this is set, this is for foreign items while
2684- /// `#[export_name]` is for Rust-defined functions.
2685- pub link_name : Option < Symbol > ,
2686- /// The `#[link_ordinal = "..."]` attribute, indicating an ordinal an
2687- /// imported function has in the dynamic library. Note that this must not
2688- /// be set when `link_name` is set. This is for foreign items with the
2689- /// "raw-dylib" kind.
2690- pub link_ordinal : Option < usize > ,
2691- /// The `#[target_feature(enable = "...")]` attribute and the enabled
2692- /// features (only enabled features are supported right now).
2693- pub target_features : Vec < Symbol > ,
2694- /// The `#[linkage = "..."]` attribute and the value we found.
2695- pub linkage : Option < Linkage > ,
2696- /// The `#[link_section = "..."]` attribute, or what executable section this
2697- /// should be placed in.
2698- pub link_section : Option < Symbol > ,
2699- }
2700-
2701- bitflags ! {
2702- #[ derive( RustcEncodable , RustcDecodable , HashStable ) ]
2703- pub struct CodegenFnAttrFlags : u32 {
2704- /// `#[cold]`: a hint to LLVM that this function, when called, is never on
2705- /// the hot path.
2706- const COLD = 1 << 0 ;
2707- /// `#[rustc_allocator]`: a hint to LLVM that the pointer returned from this
2708- /// function is never null.
2709- const ALLOCATOR = 1 << 1 ;
2710- /// `#[unwind]`: an indicator that this function may unwind despite what
2711- /// its ABI signature may otherwise imply.
2712- const UNWIND = 1 << 2 ;
2713- /// `#[rust_allocator_nounwind]`, an indicator that an imported FFI
2714- /// function will never unwind. Probably obsolete by recent changes with
2715- /// #[unwind], but hasn't been removed/migrated yet
2716- const RUSTC_ALLOCATOR_NOUNWIND = 1 << 3 ;
2717- /// `#[naked]`: an indicator to LLVM that no function prologue/epilogue
2718- /// should be generated.
2719- const NAKED = 1 << 4 ;
2720- /// `#[no_mangle]`: an indicator that the function's name should be the same
2721- /// as its symbol.
2722- const NO_MANGLE = 1 << 5 ;
2723- /// `#[rustc_std_internal_symbol]`: an indicator that this symbol is a
2724- /// "weird symbol" for the standard library in that it has slightly
2725- /// different linkage, visibility, and reachability rules.
2726- const RUSTC_STD_INTERNAL_SYMBOL = 1 << 6 ;
2727- /// `#[no_debug]`: an indicator that no debugging information should be
2728- /// generated for this function by LLVM.
2729- const NO_DEBUG = 1 << 7 ;
2730- /// `#[thread_local]`: indicates a static is actually a thread local
2731- /// piece of memory
2732- const THREAD_LOCAL = 1 << 8 ;
2733- /// `#[used]`: indicates that LLVM can't eliminate this function (but the
2734- /// linker can!).
2735- const USED = 1 << 9 ;
2736- /// `#[ffi_returns_twice]`, indicates that an extern function can return
2737- /// multiple times
2738- const FFI_RETURNS_TWICE = 1 << 10 ;
2739- /// `#[track_caller]`: allow access to the caller location
2740- const TRACK_CALLER = 1 << 11 ;
2741- }
2742- }
2743-
2744- impl CodegenFnAttrs {
2745- pub fn new ( ) -> CodegenFnAttrs {
2746- CodegenFnAttrs {
2747- flags : CodegenFnAttrFlags :: empty ( ) ,
2748- inline : InlineAttr :: None ,
2749- optimize : OptimizeAttr :: None ,
2750- export_name : None ,
2751- link_name : None ,
2752- link_ordinal : None ,
2753- target_features : vec ! [ ] ,
2754- linkage : None ,
2755- link_section : None ,
2756- }
2757- }
2758-
2759- /// Returns `true` if `#[inline]` or `#[inline(always)]` is present.
2760- pub fn requests_inline ( & self ) -> bool {
2761- match self . inline {
2762- InlineAttr :: Hint | InlineAttr :: Always => true ,
2763- InlineAttr :: None | InlineAttr :: Never => false ,
2764- }
2765- }
2766-
2767- /// Returns `true` if it looks like this symbol needs to be exported, for example:
2768- ///
2769- /// * `#[no_mangle]` is present
2770- /// * `#[export_name(...)]` is present
2771- /// * `#[linkage]` is present
2772- pub fn contains_extern_indicator ( & self ) -> bool {
2773- self . flags . contains ( CodegenFnAttrFlags :: NO_MANGLE )
2774- || self . export_name . is_some ( )
2775- || match self . linkage {
2776- // These are private, so make sure we don't try to consider
2777- // them external.
2778- None | Some ( Linkage :: Internal ) | Some ( Linkage :: Private ) => false ,
2779- Some ( _) => true ,
2780- }
2781- }
2782- }
2783-
27842669#[ derive( Copy , Clone , Debug ) ]
27852670pub enum Node < ' hir > {
27862671 Param ( & ' hir Param < ' hir > ) ,
0 commit comments