rustup
This commit is contained in:
parent
2c4fcd8d12
commit
bc2f9259e6
6 changed files with 18 additions and 20 deletions
|
|
@ -131,7 +131,7 @@ fn after_analysis<'a, 'tcx>(state: &mut CompileState<'a, 'tcx>) {
|
|||
);
|
||||
} else if let Some((entry_node_id, _)) = *state.session.entry_fn.borrow() {
|
||||
let entry_def_id = tcx.hir.local_def_id(entry_node_id);
|
||||
let start_wrapper = tcx.lang_items.start_fn().and_then(|start_fn| {
|
||||
let start_wrapper = tcx.lang_items().start_fn().and_then(|start_fn| {
|
||||
if tcx.is_mir_available(start_fn) {
|
||||
Some(start_fn)
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -96,11 +96,11 @@ impl<'a, 'tcx> EvalContextExt<'tcx> for EvalContext<'a, 'tcx, super::Evaluator>
|
|||
dest_ty: Ty<'tcx>,
|
||||
dest_block: mir::BasicBlock,
|
||||
) -> EvalResult<'tcx> {
|
||||
let name = self.tcx.item_name(def_id);
|
||||
let attrs = self.tcx.get_attrs(def_id);
|
||||
let link_name = attr::first_attr_value_str_by_name(&attrs, "link_name")
|
||||
.unwrap_or(name)
|
||||
.as_str();
|
||||
let link_name = match attr::first_attr_value_str_by_name(&attrs, "link_name") {
|
||||
Some(name) => name.as_str(),
|
||||
None => self.tcx.item_name(def_id),
|
||||
};
|
||||
|
||||
match &link_name[..] {
|
||||
"malloc" => {
|
||||
|
|
@ -477,28 +477,26 @@ impl<'a, 'tcx> EvalContextExt<'tcx> for EvalContext<'a, 'tcx, super::Evaluator>
|
|||
|
||||
/// Get an instance for a path.
|
||||
fn resolve_path(&self, path: &[&str]) -> EvalResult<'tcx, ty::Instance<'tcx>> {
|
||||
let cstore = &self.tcx.sess.cstore;
|
||||
|
||||
let crates = cstore.crates();
|
||||
crates
|
||||
self.tcx
|
||||
.crates()
|
||||
.iter()
|
||||
.find(|&&krate| cstore.crate_name(krate) == path[0])
|
||||
.find(|&&krate| self.tcx.original_crate_name(krate) == path[0])
|
||||
.and_then(|krate| {
|
||||
let krate = DefId {
|
||||
krate: *krate,
|
||||
index: CRATE_DEF_INDEX,
|
||||
};
|
||||
let mut items = cstore.item_children(krate, self.tcx.sess);
|
||||
let mut items = self.tcx.item_children(krate);
|
||||
let mut path_it = path.iter().skip(1).peekable();
|
||||
|
||||
while let Some(segment) = path_it.next() {
|
||||
for item in &mem::replace(&mut items, vec![]) {
|
||||
for item in mem::replace(&mut items, Default::default()).iter() {
|
||||
if item.ident.name == *segment {
|
||||
if path_it.peek().is_none() {
|
||||
return Some(ty::Instance::mono(self.tcx, item.def.def_id()));
|
||||
}
|
||||
|
||||
items = cstore.item_children(item.def.def_id(), self.tcx.sess);
|
||||
items = self.tcx.item_children(item.def.def_id());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ impl<'a, 'tcx> EvalContextExt<'tcx> for EvalContext<'a, 'tcx, super::Evaluator>
|
|||
) -> EvalResult<'tcx> {
|
||||
let substs = instance.substs;
|
||||
|
||||
let intrinsic_name = &self.tcx.item_name(instance.def_id()).as_str()[..];
|
||||
let intrinsic_name = &self.tcx.item_name(instance.def_id())[..];
|
||||
match intrinsic_name {
|
||||
"align_offset" => {
|
||||
// FIXME: return a real value in case the target allocation has an
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ fn after_analysis<'a, 'tcx>(state: &mut CompileState<'a, 'tcx>) {
|
|||
state.hir_crate.unwrap().visit_all_item_likes(&mut Visitor(limits, tcx, state));
|
||||
} else if let Some((entry_node_id, _)) = *state.session.entry_fn.borrow() {
|
||||
let entry_def_id = tcx.hir.local_def_id(entry_node_id);
|
||||
let start_wrapper = tcx.lang_items.start_fn().and_then(|start_fn|
|
||||
let start_wrapper = tcx.lang_items().start_fn().and_then(|start_fn|
|
||||
if tcx.is_mir_available(start_fn) { Some(start_fn) } else { None });
|
||||
miri::eval_main(tcx, entry_def_id, start_wrapper, limits);
|
||||
|
||||
|
|
|
|||
|
|
@ -2267,7 +2267,7 @@ fn fn_once_adapter_instance<'a, 'tcx>(
|
|||
substs: ty::ClosureSubsts<'tcx>,
|
||||
) -> ty::Instance<'tcx> {
|
||||
debug!("fn_once_adapter_shim({:?}, {:?})", closure_did, substs);
|
||||
let fn_once = tcx.lang_items.fn_once_trait().unwrap();
|
||||
let fn_once = tcx.lang_items().fn_once_trait().unwrap();
|
||||
let call_once = tcx.associated_items(fn_once)
|
||||
.find(|it| it.kind == ty::AssociatedKind::Method)
|
||||
.unwrap()
|
||||
|
|
@ -2346,7 +2346,7 @@ pub fn resolve<'a, 'tcx>(
|
|||
ty::InstanceDef::Intrinsic(def_id)
|
||||
}
|
||||
_ => {
|
||||
if Some(def_id) == tcx.lang_items.drop_in_place_fn() {
|
||||
if Some(def_id) == tcx.lang_items().drop_in_place_fn() {
|
||||
let ty = substs.type_at(0);
|
||||
if needs_drop_glue(tcx, ty) {
|
||||
debug!(" => nontrivial drop glue");
|
||||
|
|
@ -2440,7 +2440,7 @@ fn resolve_associated_item<'a, 'tcx>(
|
|||
}
|
||||
}
|
||||
::rustc::traits::VtableClosure(closure_data) => {
|
||||
let trait_closure_kind = tcx.lang_items.fn_trait_kind(trait_id).unwrap();
|
||||
let trait_closure_kind = tcx.lang_items().fn_trait_kind(trait_id).unwrap();
|
||||
resolve_closure(
|
||||
tcx,
|
||||
closure_data.closure_def_id,
|
||||
|
|
@ -2461,7 +2461,7 @@ fn resolve_associated_item<'a, 'tcx>(
|
|||
substs: rcvr_substs,
|
||||
}
|
||||
}
|
||||
::rustc::traits::VtableBuiltin(..) if Some(trait_id) == tcx.lang_items.clone_trait() => {
|
||||
::rustc::traits::VtableBuiltin(..) if Some(trait_id) == tcx.lang_items().clone_trait() => {
|
||||
ty::Instance {
|
||||
def: ty::InstanceDef::CloneShim(def_id, trait_ref.self_ty()),
|
||||
substs: rcvr_substs
|
||||
|
|
|
|||
|
|
@ -543,7 +543,7 @@ impl<'a, 'tcx, M: Machine<'tcx>> EvalContext<'a, 'tcx, M> {
|
|||
Ok(())
|
||||
}
|
||||
TyAdt(adt, subst) => {
|
||||
if Some(adt.did) == self.tcx.lang_items.unsafe_cell_type() &&
|
||||
if Some(adt.did) == self.tcx.lang_items().unsafe_cell_type() &&
|
||||
query.mutbl == MutImmutable
|
||||
{
|
||||
// No locks for shared unsafe cells. Also no other validation, the only field is private anyway.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue