use value::Value;
use rustc::ty::{self, Ty, TyCtxt};
use rustc::ty::layout::Layout;
-use rustc::traits::{self, SelectionContext, ProjectionMode};
+use rustc::traits::{self, SelectionContext, Reveal};
use rustc::ty::fold::TypeFoldable;
use rustc::hir;
use util::nodemap::NodeMap;
pub fn type_is_imm_pair<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, ty: Ty<'tcx>)
-> bool {
let tcx = ccx.tcx();
- let layout = tcx.normalizing_infer_ctxt(ProjectionMode::Any).enter(|infcx| {
+ let layout = tcx.normalizing_infer_ctxt(Reveal::All).enter(|infcx| {
match ty.layout(&infcx) {
Ok(layout) => layout,
Err(err) => {
abi: Abi::C,
sig: ty::Binder(ty::FnSig {
inputs: vec![tcx.mk_mut_ptr(tcx.types.u8)],
- output: ty::FnDiverging,
+ output: tcx.types.never,
variadic: false
}),
}));
});
llvm::LLVMSetInitializer(g, sc);
llvm::LLVMSetGlobalConstant(g, True);
- llvm::SetLinkage(g, llvm::InternalLinkage);
+ llvm::LLVMSetLinkage(g, llvm::InternalLinkage);
cx.const_cstr_cache().borrow_mut().insert(s, g);
g
// Do the initial selection for the obligation. This yields the
// shallow result we are looking for -- that is, what specific impl.
- tcx.normalizing_infer_ctxt(ProjectionMode::Any).enter(|infcx| {
+ tcx.normalizing_infer_ctxt(Reveal::All).enter(|infcx| {
let mut selcx = SelectionContext::new(&infcx);
let obligation_cause = traits::ObligationCause::misc(span,
debug!("normalize_and_test_predicates(predicates={:?})",
predicates);
- tcx.normalizing_infer_ctxt(ProjectionMode::Any).enter(|infcx| {
+ tcx.normalizing_infer_ctxt(Reveal::All).enter(|infcx| {
let mut selcx = SelectionContext::new(&infcx);
let mut fulfill_cx = traits::FulfillmentContext::new();
let cause = traits::ObligationCause::dummy();
inlined_vid: ast::NodeId)
-> ty::VariantDef<'tcx>
{
-
let ctor_ty = ccx.tcx().node_id_to_type(inlined_vid);
debug!("inlined_variant_def: ctor_ty={:?} inlined_vid={:?}", ctor_ty,
inlined_vid);
let adt_def = match ctor_ty.sty {
ty::TyFnDef(_, _, &ty::BareFnTy { sig: ty::Binder(ty::FnSig {
- output: ty::FnConverging(ty), ..
- }), ..}) => ty,
+ output, ..
+ }), ..}) => output,
_ => ctor_ty
}.ty_adt_def().unwrap();
- let inlined_vid_def_id = ccx.tcx().map.local_def_id(inlined_vid);
- adt_def.variants.iter().find(|v| {
- inlined_vid_def_id == v.did ||
- ccx.external().borrow().get(&v.did) == Some(&Some(inlined_vid))
- }).unwrap_or_else(|| {
- bug!("no variant for {:?}::{}", adt_def, inlined_vid)
- })
+ let variant_def_id = if ccx.tcx().map.is_inlined_node_id(inlined_vid) {
+ ccx.defid_for_inlined_node(inlined_vid).unwrap()
+ } else {
+ ccx.tcx().map.local_def_id(inlined_vid)
+ };
+
+ adt_def.variants
+ .iter()
+ .find(|v| variant_def_id == v.did)
+ .unwrap_or_else(|| {
+ bug!("no variant for {:?}::{}", adt_def, inlined_vid)
+ })
}
// To avoid UB from LLVM, these two functions mask RHS with an