mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00:00
parent
6bc7f41955
commit
39f9d23b65
@ -2228,6 +2228,7 @@ bitflags! {
|
||||
const RUSTC_ALLOCATOR_NOUNWIND = 0b0000_1000;
|
||||
const NAKED = 0b0001_0000;
|
||||
const NO_MANGLE = 0b0010_0000;
|
||||
const RUSTC_STD_INTERNAL_SYMBOL = 0b0100_0000;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -188,7 +188,7 @@
|
||||
//! this is not implemented however: a mono item will be produced
|
||||
//! regardless of whether it is actually needed or not.
|
||||
|
||||
use rustc::hir;
|
||||
use rustc::hir::{self, TransFnAttrFlags};
|
||||
use rustc::hir::itemlikevisit::ItemLikeVisitor;
|
||||
|
||||
use rustc::hir::map as hir_map;
|
||||
@ -211,8 +211,6 @@ use monomorphize::item::{MonoItemExt, DefPathBasedNames, InstantiationMode};
|
||||
|
||||
use rustc_data_structures::bitvec::BitVector;
|
||||
|
||||
use syntax::attr;
|
||||
|
||||
use std::iter;
|
||||
|
||||
#[derive(PartialEq, Eq, Hash, Clone, Copy, Debug)]
|
||||
@ -985,8 +983,8 @@ impl<'b, 'a, 'v> RootCollector<'b, 'a, 'v> {
|
||||
MonoItemCollectionMode::Lazy => {
|
||||
self.entry_fn == Some(def_id) ||
|
||||
self.tcx.is_reachable_non_generic(def_id) ||
|
||||
attr::contains_name(&self.tcx.get_attrs(def_id),
|
||||
"rustc_std_internal_symbol")
|
||||
self.tcx.trans_fn_attrs(def_id).flags.contains(
|
||||
TransFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ use std::sync::Arc;
|
||||
|
||||
use monomorphize::Instance;
|
||||
use rustc::hir;
|
||||
use rustc::hir::TransFnAttrFlags;
|
||||
use rustc::hir::def_id::CrateNum;
|
||||
use rustc::hir::def_id::{DefId, LOCAL_CRATE};
|
||||
use rustc::middle::exported_symbols::{SymbolExportLevel, ExportedSymbol, metadata_symbol_name};
|
||||
@ -21,7 +22,6 @@ use rustc::ty::{TyCtxt, SymbolName};
|
||||
use rustc::ty::maps::Providers;
|
||||
use rustc::util::nodemap::{FxHashMap, DefIdSet};
|
||||
use rustc_allocator::ALLOCATOR_METHODS;
|
||||
use syntax::attr;
|
||||
|
||||
pub type ExportedSymbols = FxHashMap<
|
||||
CrateNum,
|
||||
@ -258,8 +258,8 @@ fn symbol_export_level_provider(tcx: TyCtxt, sym_def_id: DefId) -> SymbolExportL
|
||||
// are not considered for export
|
||||
let trans_fn_attrs = tcx.trans_fn_attrs(sym_def_id);
|
||||
let is_extern = trans_fn_attrs.contains_extern_indicator();
|
||||
let std_internal = attr::contains_name(&tcx.get_attrs(sym_def_id),
|
||||
"rustc_std_internal_symbol");
|
||||
let std_internal = trans_fn_attrs.flags.contains(TransFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL);
|
||||
|
||||
if is_extern && !std_internal {
|
||||
SymbolExportLevel::C
|
||||
} else {
|
||||
|
@ -1745,6 +1745,8 @@ fn trans_fn_attrs<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, id: DefId) -> TransFnAt
|
||||
trans_fn_attrs.flags |= TransFnAttrFlags::NAKED;
|
||||
} else if attr.check_name("no_mangle") {
|
||||
trans_fn_attrs.flags |= TransFnAttrFlags::NO_MANGLE;
|
||||
} else if attr.check_name("rustc_std_internal_symbol") {
|
||||
trans_fn_attrs.flags |= TransFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL;
|
||||
} else if attr.check_name("inline") {
|
||||
trans_fn_attrs.inline = attrs.iter().fold(InlineAttr::None, |ia, attr| {
|
||||
if attr.path != "inline" {
|
||||
|
Loading…
Reference in New Issue
Block a user