rustup to rustc 1.13.0-nightly (91f057de3
2016-09-04)
This commit is contained in:
parent
45cf3cfde2
commit
cd42bb97f0
5 changed files with 48 additions and 38 deletions
12
Cargo.lock
generated
12
Cargo.lock
generated
|
@ -37,7 +37,7 @@ version = "0.3.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"regex 0.1.73 (registry+https://github.com/rust-lang/crates.io-index)",
|
"regex 0.1.75 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -82,19 +82,19 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex"
|
name = "regex"
|
||||||
version = "0.1.73"
|
version = "0.1.75"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aho-corasick 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"aho-corasick 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
"memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"regex-syntax 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"regex-syntax 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"thread_local 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"thread_local 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex-syntax"
|
name = "regex-syntax"
|
||||||
version = "0.3.4"
|
version = "0.3.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -145,8 +145,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
"checksum log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ab83497bf8bf4ed2a74259c1c802351fcd67a65baa86394b6ba73c36f4838054"
|
"checksum log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ab83497bf8bf4ed2a74259c1c802351fcd67a65baa86394b6ba73c36f4838054"
|
||||||
"checksum log_settings 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3d382732ea0fbc09790c4899db3255bdea0fc78b54bf234bd18a63bb603915b6"
|
"checksum log_settings 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3d382732ea0fbc09790c4899db3255bdea0fc78b54bf234bd18a63bb603915b6"
|
||||||
"checksum memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d8b629fb514376c675b98c1421e80b151d3817ac42d7c667717d282761418d20"
|
"checksum memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d8b629fb514376c675b98c1421e80b151d3817ac42d7c667717d282761418d20"
|
||||||
"checksum regex 0.1.73 (registry+https://github.com/rust-lang/crates.io-index)" = "56b7ee9f764ecf412c6e2fff779bca4b22980517ae335a21aeaf4e32625a5df2"
|
"checksum regex 0.1.75 (registry+https://github.com/rust-lang/crates.io-index)" = "f62414f9d3b0f53e827ac46d6f8ce2ff6a91afd724225a5986e54e81e170693c"
|
||||||
"checksum regex-syntax 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "31040aad7470ad9d8c46302dcffba337bb4289ca5da2e3cd6e37b64109a85199"
|
"checksum regex-syntax 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "279401017ae31cf4e15344aa3f085d0e2e5c1e70067289ef906906fdbe92c8fd"
|
||||||
"checksum rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "6159e4e6e559c81bd706afe9c8fd68f547d3e851ce12e76b1de7914bab61691b"
|
"checksum rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "6159e4e6e559c81bd706afe9c8fd68f547d3e851ce12e76b1de7914bab61691b"
|
||||||
"checksum thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9539db560102d1cef46b8b78ce737ff0bb64e7e18d35b2a5688f7d097d0ff03"
|
"checksum thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9539db560102d1cef46b8b78ce737ff0bb64e7e18d35b2a5688f7d097d0ff03"
|
||||||
"checksum thread_local 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "55dd963dbaeadc08aa7266bf7f91c3154a7805e32bb94b820b769d2ef3b4744d"
|
"checksum thread_local 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "55dd963dbaeadc08aa7266bf7f91c3154a7805e32bb94b820b769d2ef3b4744d"
|
||||||
|
|
|
@ -13,7 +13,7 @@ use miri::{eval_main, run_mir_passes};
|
||||||
use rustc::session::Session;
|
use rustc::session::Session;
|
||||||
use rustc::mir::mir_map::MirMap;
|
use rustc::mir::mir_map::MirMap;
|
||||||
use rustc_driver::{driver, CompilerCalls, Compilation};
|
use rustc_driver::{driver, CompilerCalls, Compilation};
|
||||||
use syntax::ast::MetaItemKind;
|
use syntax::ast::{MetaItemKind, NestedMetaItemKind};
|
||||||
|
|
||||||
struct MiriCompilerCalls;
|
struct MiriCompilerCalls;
|
||||||
|
|
||||||
|
@ -52,6 +52,7 @@ impl<'a> CompilerCalls<'a> for MiriCompilerCalls {
|
||||||
MetaItemKind::List(ref name, _) if name != "miri" => {}
|
MetaItemKind::List(ref name, _) if name != "miri" => {}
|
||||||
MetaItemKind::List(_, ref items) => for item in items {
|
MetaItemKind::List(_, ref items) => for item in items {
|
||||||
match item.node {
|
match item.node {
|
||||||
|
NestedMetaItemKind::MetaItem(ref inner) => match inner.node {
|
||||||
MetaItemKind::NameValue(ref name, ref value) => {
|
MetaItemKind::NameValue(ref name, ref value) => {
|
||||||
match &**name {
|
match &**name {
|
||||||
"memory_size" => memory_size = extract_str(value).parse().expect("not a number"),
|
"memory_size" => memory_size = extract_str(value).parse().expect("not a number"),
|
||||||
|
@ -60,6 +61,8 @@ impl<'a> CompilerCalls<'a> for MiriCompilerCalls {
|
||||||
_ => state.session.span_err(item.span, "unknown miri attribute"),
|
_ => state.session.span_err(item.span, "unknown miri attribute"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_ => state.session.span_err(inner.span, "miri attributes need to be of key = value kind"),
|
||||||
|
},
|
||||||
_ => state.session.span_err(item.span, "miri attributes need to be of key = value kind"),
|
_ => state.session.span_err(item.span, "miri attributes need to be of key = value kind"),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -292,7 +292,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
|
||||||
// TODO(solson): Is this inefficient? Needs investigation.
|
// TODO(solson): Is this inefficient? Needs investigation.
|
||||||
let ty = self.monomorphize(ty, substs);
|
let ty = self.monomorphize(ty, substs);
|
||||||
|
|
||||||
self.tcx.normalizing_infer_ctxt(Reveal::All).enter(|infcx| {
|
self.tcx.infer_ctxt(None, None, Reveal::All).enter(|infcx| {
|
||||||
// TODO(solson): Report this error properly.
|
// TODO(solson): Report this error properly.
|
||||||
ty.layout(&infcx).unwrap()
|
ty.layout(&infcx).unwrap()
|
||||||
})
|
})
|
||||||
|
@ -454,7 +454,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
General { discr, ref variants, .. } => {
|
General { discr, ref variants, .. } => {
|
||||||
if let mir::AggregateKind::Adt(adt_def, variant, _) = *kind {
|
if let mir::AggregateKind::Adt(adt_def, variant, _, _) = *kind {
|
||||||
let discr_val = adt_def.variants[variant].disr_val.to_u64_unchecked();
|
let discr_val = adt_def.variants[variant].disr_val.to_u64_unchecked();
|
||||||
let discr_size = discr.size().bytes() as usize;
|
let discr_size = discr.size().bytes() as usize;
|
||||||
self.memory.write_uint(dest, discr_val, discr_size)?;
|
self.memory.write_uint(dest, discr_val, discr_size)?;
|
||||||
|
@ -468,7 +468,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
RawNullablePointer { nndiscr, .. } => {
|
RawNullablePointer { nndiscr, .. } => {
|
||||||
if let mir::AggregateKind::Adt(_, variant, _) = *kind {
|
if let mir::AggregateKind::Adt(_, variant, _, _) = *kind {
|
||||||
if nndiscr == variant as u64 {
|
if nndiscr == variant as u64 {
|
||||||
assert_eq!(operands.len(), 1);
|
assert_eq!(operands.len(), 1);
|
||||||
let operand = &operands[0];
|
let operand = &operands[0];
|
||||||
|
@ -485,7 +485,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
StructWrappedNullablePointer { nndiscr, ref nonnull, ref discrfield } => {
|
StructWrappedNullablePointer { nndiscr, ref nonnull, ref discrfield } => {
|
||||||
if let mir::AggregateKind::Adt(_, variant, _) = *kind {
|
if let mir::AggregateKind::Adt(_, variant, _, _) = *kind {
|
||||||
if nndiscr == variant as u64 {
|
if nndiscr == variant as u64 {
|
||||||
let offsets = iter::once(0)
|
let offsets = iter::once(0)
|
||||||
.chain(nonnull.offset_after_field.iter().map(|s| s.bytes()));
|
.chain(nonnull.offset_after_field.iter().map(|s| s.bytes()));
|
||||||
|
@ -503,7 +503,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
|
||||||
|
|
||||||
CEnum { discr, signed, .. } => {
|
CEnum { discr, signed, .. } => {
|
||||||
assert_eq!(operands.len(), 0);
|
assert_eq!(operands.len(), 0);
|
||||||
if let mir::AggregateKind::Adt(adt_def, variant, _) = *kind {
|
if let mir::AggregateKind::Adt(adt_def, variant, _, _) = *kind {
|
||||||
let val = adt_def.variants[variant].disr_val.to_u64_unchecked();
|
let val = adt_def.variants[variant].disr_val.to_u64_unchecked();
|
||||||
let size = discr.size().bytes() as usize;
|
let size = discr.size().bytes() as usize;
|
||||||
|
|
||||||
|
|
|
@ -24,11 +24,11 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
let block = self.frame().block;
|
let block = self.frame().block;
|
||||||
let stmt = self.frame().stmt;
|
let stmt_id = self.frame().stmt;
|
||||||
let mir = self.mir();
|
let mir = self.mir();
|
||||||
let basic_block = &mir.basic_blocks()[block];
|
let basic_block = &mir.basic_blocks()[block];
|
||||||
|
|
||||||
if let Some(ref stmt) = basic_block.statements.get(stmt) {
|
if let Some(ref stmt) = basic_block.statements.get(stmt_id) {
|
||||||
let mut new = Ok(0);
|
let mut new = Ok(0);
|
||||||
ConstantExtractor {
|
ConstantExtractor {
|
||||||
span: stmt.source_info.span,
|
span: stmt.source_info.span,
|
||||||
|
@ -37,7 +37,10 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
|
||||||
ecx: self,
|
ecx: self,
|
||||||
mir: &mir,
|
mir: &mir,
|
||||||
new_constants: &mut new,
|
new_constants: &mut new,
|
||||||
}.visit_statement(block, stmt);
|
}.visit_statement(block, stmt, mir::Location {
|
||||||
|
block: block,
|
||||||
|
statement_index: stmt_id,
|
||||||
|
});
|
||||||
if new? == 0 {
|
if new? == 0 {
|
||||||
self.statement(stmt)?;
|
self.statement(stmt)?;
|
||||||
}
|
}
|
||||||
|
@ -55,7 +58,10 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
|
||||||
ecx: self,
|
ecx: self,
|
||||||
mir: &mir,
|
mir: &mir,
|
||||||
new_constants: &mut new,
|
new_constants: &mut new,
|
||||||
}.visit_terminator(block, terminator);
|
}.visit_terminator(block, terminator, mir::Location {
|
||||||
|
block: block,
|
||||||
|
statement_index: stmt_id,
|
||||||
|
});
|
||||||
if new? == 0 {
|
if new? == 0 {
|
||||||
self.terminator(terminator)?;
|
self.terminator(terminator)?;
|
||||||
}
|
}
|
||||||
|
@ -135,8 +141,8 @@ impl<'a, 'b, 'tcx> ConstantExtractor<'a, 'b, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b, 'tcx> Visitor<'tcx> for ConstantExtractor<'a, 'b, 'tcx> {
|
impl<'a, 'b, 'tcx> Visitor<'tcx> for ConstantExtractor<'a, 'b, 'tcx> {
|
||||||
fn visit_constant(&mut self, constant: &mir::Constant<'tcx>) {
|
fn visit_constant(&mut self, constant: &mir::Constant<'tcx>, location: mir::Location) {
|
||||||
self.super_constant(constant);
|
self.super_constant(constant, location);
|
||||||
match constant.literal {
|
match constant.literal {
|
||||||
// already computed by rustc
|
// already computed by rustc
|
||||||
mir::Literal::Value { .. } => {}
|
mir::Literal::Value { .. } => {}
|
||||||
|
@ -170,8 +176,8 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for ConstantExtractor<'a, 'b, 'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_lvalue(&mut self, lvalue: &mir::Lvalue<'tcx>, context: LvalueContext) {
|
fn visit_lvalue(&mut self, lvalue: &mir::Lvalue<'tcx>, context: LvalueContext, location: mir::Location) {
|
||||||
self.super_lvalue(lvalue, context);
|
self.super_lvalue(lvalue, context, location);
|
||||||
if let mir::Lvalue::Static(def_id) = *lvalue {
|
if let mir::Lvalue::Static(def_id) = *lvalue {
|
||||||
let substs = subst::Substs::empty(self.ecx.tcx);
|
let substs = subst::Substs::empty(self.ecx.tcx);
|
||||||
let span = self.span;
|
let span = self.span;
|
||||||
|
|
|
@ -240,6 +240,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
|
||||||
// The discriminant_value intrinsic returns 0 for non-sum types.
|
// The discriminant_value intrinsic returns 0 for non-sum types.
|
||||||
Array { .. } | FatPointer { .. } | Scalar { .. } | Univariant { .. } |
|
Array { .. } | FatPointer { .. } | Scalar { .. } | Univariant { .. } |
|
||||||
Vector { .. } => 0,
|
Vector { .. } => 0,
|
||||||
|
UntaggedUnion { .. } => unimplemented!(),
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(discr_val)
|
Ok(discr_val)
|
||||||
|
@ -278,7 +279,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
|
||||||
"assume" => {}
|
"assume" => {}
|
||||||
|
|
||||||
"copy_nonoverlapping" => {
|
"copy_nonoverlapping" => {
|
||||||
let elem_ty = substs.types[0];
|
let elem_ty = substs.types().next().expect("should at least have one type argument");
|
||||||
let elem_size = self.type_size(elem_ty);
|
let elem_size = self.type_size(elem_ty);
|
||||||
let elem_align = self.type_align(elem_ty);
|
let elem_align = self.type_align(elem_ty);
|
||||||
let src = self.memory.read_ptr(args_ptrs[0])?;
|
let src = self.memory.read_ptr(args_ptrs[0])?;
|
||||||
|
@ -288,7 +289,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
"discriminant_value" => {
|
"discriminant_value" => {
|
||||||
let ty = substs.types[0];
|
let ty = substs.types().next().expect("should have at least one type argument");
|
||||||
let adt_ptr = self.memory.read_ptr(args_ptrs[0])?;
|
let adt_ptr = self.memory.read_ptr(args_ptrs[0])?;
|
||||||
let discr_val = self.read_discriminant_value(adt_ptr, ty)?;
|
let discr_val = self.read_discriminant_value(adt_ptr, ty)?;
|
||||||
self.memory.write_uint(dest, discr_val, 8)?;
|
self.memory.write_uint(dest, discr_val, 8)?;
|
||||||
|
@ -299,19 +300,19 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
|
||||||
"init" => self.memory.write_repeat(dest, 0, dest_layout.size(&self.tcx.data_layout).bytes() as usize)?,
|
"init" => self.memory.write_repeat(dest, 0, dest_layout.size(&self.tcx.data_layout).bytes() as usize)?,
|
||||||
|
|
||||||
"min_align_of" => {
|
"min_align_of" => {
|
||||||
let elem_ty = substs.types[0];
|
let elem_ty = substs.types().next().expect("should have at least one type argument");
|
||||||
let elem_align = self.type_align(elem_ty);
|
let elem_align = self.type_align(elem_ty);
|
||||||
self.memory.write_uint(dest, elem_align as u64, pointer_size)?;
|
self.memory.write_uint(dest, elem_align as u64, pointer_size)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
"move_val_init" => {
|
"move_val_init" => {
|
||||||
let ty = substs.types[0];
|
let ty = substs.types().next().expect("should have at least one type argument");
|
||||||
let ptr = self.memory.read_ptr(args_ptrs[0])?;
|
let ptr = self.memory.read_ptr(args_ptrs[0])?;
|
||||||
self.move_(args_ptrs[1], ptr, ty)?;
|
self.move_(args_ptrs[1], ptr, ty)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
"offset" => {
|
"offset" => {
|
||||||
let pointee_ty = substs.types[0];
|
let pointee_ty = substs.types().next().expect("should have at least one type argument");
|
||||||
let pointee_size = self.type_size(pointee_ty) as isize;
|
let pointee_size = self.type_size(pointee_ty) as isize;
|
||||||
let ptr_arg = args_ptrs[0];
|
let ptr_arg = args_ptrs[0];
|
||||||
let offset = self.memory.read_isize(args_ptrs[1])?;
|
let offset = self.memory.read_isize(args_ptrs[1])?;
|
||||||
|
@ -343,13 +344,13 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
"size_of" => {
|
"size_of" => {
|
||||||
let ty = substs.types[0];
|
let ty = substs.types().next().expect("should have at least one type argument");
|
||||||
let size = self.type_size(ty) as u64;
|
let size = self.type_size(ty) as u64;
|
||||||
self.memory.write_uint(dest, size, pointer_size)?;
|
self.memory.write_uint(dest, size, pointer_size)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
"size_of_val" => {
|
"size_of_val" => {
|
||||||
let ty = substs.types[0];
|
let ty = substs.types().next().expect("should have at least one type argument");
|
||||||
if self.type_is_sized(ty) {
|
if self.type_is_sized(ty) {
|
||||||
let size = self.type_size(ty) as u64;
|
let size = self.type_size(ty) as u64;
|
||||||
self.memory.write_uint(dest, size, pointer_size)?;
|
self.memory.write_uint(dest, size, pointer_size)?;
|
||||||
|
@ -369,7 +370,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
"transmute" => {
|
"transmute" => {
|
||||||
let ty = substs.types[0];
|
let ty = substs.types().next().expect("should have at least one type argument");
|
||||||
self.move_(args_ptrs[0], dest, ty)?;
|
self.move_(args_ptrs[0], dest, ty)?;
|
||||||
}
|
}
|
||||||
"uninit" => self.memory.mark_definedness(dest, dest_layout.size(&self.tcx.data_layout).bytes() as usize, false)?,
|
"uninit" => self.memory.mark_definedness(dest, dest_layout.size(&self.tcx.data_layout).bytes() as usize, false)?,
|
||||||
|
@ -457,7 +458,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
|
||||||
fn fulfill_obligation(&self, trait_ref: ty::PolyTraitRef<'tcx>) -> traits::Vtable<'tcx, ()> {
|
fn fulfill_obligation(&self, trait_ref: ty::PolyTraitRef<'tcx>) -> traits::Vtable<'tcx, ()> {
|
||||||
// Do the initial selection for the obligation. This yields the shallow result we are
|
// Do the initial selection for the obligation. This yields the shallow result we are
|
||||||
// looking for -- that is, what specific impl.
|
// looking for -- that is, what specific impl.
|
||||||
self.tcx.normalizing_infer_ctxt(Reveal::All).enter(|infcx| {
|
self.tcx.infer_ctxt(None, None, Reveal::All).enter(|infcx| {
|
||||||
let mut selcx = traits::SelectionContext::new(&infcx);
|
let mut selcx = traits::SelectionContext::new(&infcx);
|
||||||
|
|
||||||
let obligation = traits::Obligation::new(
|
let obligation = traits::Obligation::new(
|
||||||
|
@ -570,14 +571,14 @@ fn get_impl_method<'a, 'tcx>(
|
||||||
impl_substs: &'tcx Substs<'tcx>,
|
impl_substs: &'tcx Substs<'tcx>,
|
||||||
name: ast::Name,
|
name: ast::Name,
|
||||||
) -> ImplMethod<'tcx> {
|
) -> ImplMethod<'tcx> {
|
||||||
assert!(!substs.types.needs_infer());
|
assert!(!substs.types().any(|ty| ty.needs_infer()));
|
||||||
|
|
||||||
let trait_def_id = tcx.trait_id_of_impl(impl_def_id).unwrap();
|
let trait_def_id = tcx.trait_id_of_impl(impl_def_id).unwrap();
|
||||||
let trait_def = tcx.lookup_trait_def(trait_def_id);
|
let trait_def = tcx.lookup_trait_def(trait_def_id);
|
||||||
|
|
||||||
match trait_def.ancestors(impl_def_id).fn_defs(tcx, name).next() {
|
match trait_def.ancestors(impl_def_id).fn_defs(tcx, name).next() {
|
||||||
Some(node_item) => {
|
Some(node_item) => {
|
||||||
let substs = tcx.normalizing_infer_ctxt(Reveal::All).enter(|infcx| {
|
let substs = tcx.infer_ctxt(None, None, Reveal::All).enter(|infcx| {
|
||||||
let substs = substs.rebase_onto(tcx, trait_def_id, impl_substs);
|
let substs = substs.rebase_onto(tcx, trait_def_id, impl_substs);
|
||||||
let substs = traits::translate_substs(&infcx, impl_def_id,
|
let substs = traits::translate_substs(&infcx, impl_def_id,
|
||||||
substs, node_item.node);
|
substs, node_item.node);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue