Auto merge of #61426 - Zoxc:just-tcx-mir-building, r=eddyb

Use a single lifetime for MIR construction

Builds on https://github.com/rust-lang/rust/pull/57214

r? @eddyb
This commit is contained in:
bors 2019-06-12 19:24:40 +00:00
commit 2887008e0c
24 changed files with 147 additions and 196 deletions

View File

@ -465,7 +465,7 @@ impl<'tcx> fmt::Display for FixupError<'tcx> {
/// Helper type of a temporary returned by `tcx.infer_ctxt()`. /// Helper type of a temporary returned by `tcx.infer_ctxt()`.
/// Necessary because we can't write the following bound: /// Necessary because we can't write the following bound:
/// `F: for<'b, 'tcx> where 'gcx: 'tcx FnOnce(InferCtxt<'b, 'gcx, 'tcx>)`. /// `F: for<'b, 'tcx> where 'gcx: 'tcx FnOnce(InferCtxt<'b, 'gcx, 'tcx>)`.
pub struct InferCtxtBuilder<'gcx, 'tcx> { pub struct InferCtxtBuilder<'gcx: 'tcx, 'tcx> {
global_tcx: TyCtxt<'gcx, 'gcx>, global_tcx: TyCtxt<'gcx, 'gcx>,
fresh_tables: Option<RefCell<ty::TypeckTables<'tcx>>>, fresh_tables: Option<RefCell<ty::TypeckTables<'tcx>>>,
} }
@ -510,7 +510,7 @@ impl<'gcx, 'tcx> InferCtxtBuilder<'gcx, 'tcx> {
}) })
} }
pub fn enter<R>(&'tcx mut self, f: impl for<'a> FnOnce(InferCtxt<'a, 'gcx, 'tcx>) -> R) -> R { pub fn enter<R>(&mut self, f: impl for<'a> FnOnce(InferCtxt<'a, 'gcx, 'tcx>) -> R) -> R {
let InferCtxtBuilder { let InferCtxtBuilder {
global_tcx, global_tcx,
ref fresh_tables, ref fresh_tables,

View File

@ -6,7 +6,7 @@ use rustc::mir::*;
use rustc::hir; use rustc::hir;
use syntax_pos::Span; use syntax_pos::Span;
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { impl<'a, 'tcx> Builder<'a, 'tcx> {
pub fn ast_block(&mut self, pub fn ast_block(&mut self,
destination: &Place<'tcx>, destination: &Place<'tcx>,
block: BasicBlock, block: BasicBlock,

View File

@ -5,7 +5,7 @@ use crate::hair::*;
use rustc::mir::*; use rustc::mir::*;
use rustc::ty::CanonicalUserTypeAnnotation; use rustc::ty::CanonicalUserTypeAnnotation;
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { impl<'a, 'tcx> Builder<'a, 'tcx> {
/// Compile `expr`, yielding a compile-time constant. Assumes that /// Compile `expr`, yielding a compile-time constant. Assumes that
/// `expr` is a valid compile-time constant! /// `expr` is a valid compile-time constant!
pub fn as_constant<M>(&mut self, expr: M) -> Constant<'tcx> pub fn as_constant<M>(&mut self, expr: M) -> Constant<'tcx>

View File

@ -6,7 +6,7 @@ use crate::hair::*;
use rustc::middle::region; use rustc::middle::region;
use rustc::mir::*; use rustc::mir::*;
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { impl<'a, 'tcx> Builder<'a, 'tcx> {
/// Returns an operand suitable for use until the end of the current /// Returns an operand suitable for use until the end of the current
/// scope expression. /// scope expression.
/// ///

View File

@ -10,7 +10,7 @@ use rustc::ty::{CanonicalUserTypeAnnotation, Variance};
use rustc_data_structures::indexed_vec::Idx; use rustc_data_structures::indexed_vec::Idx;
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { impl<'a, 'tcx> Builder<'a, 'tcx> {
/// Compile `expr`, yielding a place that we can move from etc. /// Compile `expr`, yielding a place that we can move from etc.
pub fn as_place<M>(&mut self, block: BasicBlock, expr: M) -> BlockAnd<Place<'tcx>> pub fn as_place<M>(&mut self, block: BasicBlock, expr: M) -> BlockAnd<Place<'tcx>>
where where

View File

@ -12,7 +12,7 @@ use rustc::mir::*;
use rustc::ty::{self, CanonicalUserTypeAnnotation, Ty, UpvarSubsts}; use rustc::ty::{self, CanonicalUserTypeAnnotation, Ty, UpvarSubsts};
use syntax_pos::Span; use syntax_pos::Span;
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { impl<'a, 'tcx> Builder<'a, 'tcx> {
/// See comment on `as_local_operand` /// See comment on `as_local_operand`
pub fn as_local_rvalue<M>(&mut self, block: BasicBlock, expr: M) -> BlockAnd<Rvalue<'tcx>> pub fn as_local_rvalue<M>(&mut self, block: BasicBlock, expr: M) -> BlockAnd<Rvalue<'tcx>>
where where

View File

@ -6,7 +6,7 @@ use crate::hair::*;
use rustc::middle::region; use rustc::middle::region;
use rustc::mir::*; use rustc::mir::*;
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { impl<'a, 'tcx> Builder<'a, 'tcx> {
/// Compile `expr` into a fresh temporary. This is used when building /// Compile `expr` into a fresh temporary. This is used when building
/// up rvalues so as to freeze the value that will be consumed. /// up rvalues so as to freeze the value that will be consumed.
pub fn as_temp<M>( pub fn as_temp<M>(

View File

@ -8,7 +8,7 @@ use rustc::ty;
use rustc_target::spec::abi::Abi; use rustc_target::spec::abi::Abi;
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { impl<'a, 'tcx> Builder<'a, 'tcx> {
/// Compile `expr`, storing the result into `destination`, which /// Compile `expr`, storing the result into `destination`, which
/// is assumed to be uninitialized. /// is assumed to be uninitialized.
pub fn into_expr( pub fn into_expr(

View File

@ -3,7 +3,7 @@ use crate::build::{BlockAnd, BlockAndExtension, BlockFrame, Builder};
use crate::hair::*; use crate::hair::*;
use rustc::mir::*; use rustc::mir::*;
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { impl<'a, 'tcx> Builder<'a, 'tcx> {
/// Builds a block of MIR statements to evaluate the HAIR `expr`. /// Builds a block of MIR statements to evaluate the HAIR `expr`.
/// If the original expression was an AST statement, /// If the original expression was an AST statement,
/// (e.g., `some().code(&here());`) then `opt_stmt_span` is the /// (e.g., `some().code(&here());`) then `opt_stmt_span` is the

View File

@ -9,14 +9,15 @@ use crate::hair::*;
use rustc::mir::*; use rustc::mir::*;
pub(in crate::build) trait EvalInto<'tcx> { pub(in crate::build) trait EvalInto<'tcx> {
fn eval_into<'a, 'gcx>(self, fn eval_into(
builder: &mut Builder<'a, 'gcx, 'tcx>, self,
destination: &Place<'tcx>, builder: &mut Builder<'_, 'tcx>,
block: BasicBlock) destination: &Place<'tcx>,
-> BlockAnd<()>; block: BasicBlock,
) -> BlockAnd<()>;
} }
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { impl<'a, 'tcx> Builder<'a, 'tcx> {
pub fn into<E>(&mut self, pub fn into<E>(&mut self,
destination: &Place<'tcx>, destination: &Place<'tcx>,
block: BasicBlock, block: BasicBlock,
@ -29,22 +30,24 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
} }
impl<'tcx> EvalInto<'tcx> for ExprRef<'tcx> { impl<'tcx> EvalInto<'tcx> for ExprRef<'tcx> {
fn eval_into<'a, 'gcx>(self, fn eval_into(
builder: &mut Builder<'a, 'gcx, 'tcx>, self,
destination: &Place<'tcx>, builder: &mut Builder<'_, 'tcx>,
block: BasicBlock) destination: &Place<'tcx>,
-> BlockAnd<()> { block: BasicBlock,
) -> BlockAnd<()> {
let expr = builder.hir.mirror(self); let expr = builder.hir.mirror(self);
builder.into_expr(destination, block, expr) builder.into_expr(destination, block, expr)
} }
} }
impl<'tcx> EvalInto<'tcx> for Expr<'tcx> { impl<'tcx> EvalInto<'tcx> for Expr<'tcx> {
fn eval_into<'a, 'gcx>(self, fn eval_into(
builder: &mut Builder<'a, 'gcx, 'tcx>, self,
destination: &Place<'tcx>, builder: &mut Builder<'_, 'tcx>,
block: BasicBlock) destination: &Place<'tcx>,
-> BlockAnd<()> { block: BasicBlock,
) -> BlockAnd<()> {
builder.into_expr(destination, block, self) builder.into_expr(destination, block, self)
} }
} }

View File

@ -27,7 +27,7 @@ mod util;
use std::convert::TryFrom; use std::convert::TryFrom;
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { impl<'a, 'tcx> Builder<'a, 'tcx> {
/// Generates MIR for a `match` expression. /// Generates MIR for a `match` expression.
/// ///
/// The MIR that we generate for a match looks like this. /// The MIR that we generate for a match looks like this.
@ -768,7 +768,7 @@ pub(crate) struct ArmHasGuard(pub bool);
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// Main matching algorithm // Main matching algorithm
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { impl<'a, 'tcx> Builder<'a, 'tcx> {
/// The main match algorithm. It begins with a set of candidates /// The main match algorithm. It begins with a set of candidates
/// `candidates` and has the job of generating code to determine /// `candidates` and has the job of generating code to determine
/// which of these candidates, if any, is the correct one. The /// which of these candidates, if any, is the correct one. The
@ -1296,7 +1296,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// Pattern binding - used for `let` and function parameters as well. // Pattern binding - used for `let` and function parameters as well.
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { impl<'a, 'tcx> Builder<'a, 'tcx> {
/// Initializes each of the bindings from the candidate by /// Initializes each of the bindings from the candidate by
/// moving/copying/ref'ing the source as appropriate. Tests the guard, if /// moving/copying/ref'ing the source as appropriate. Tests the guard, if
/// any, and then branches to the arm. Returns the block for the case where /// any, and then branches to the arm. Returns the block for the case where

View File

@ -23,7 +23,7 @@ use rustc::mir::interpret::truncate;
use std::mem; use std::mem;
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { impl<'a, 'tcx> Builder<'a, 'tcx> {
pub fn simplify_candidate<'pat>(&mut self, pub fn simplify_candidate<'pat>(&mut self,
candidate: &mut Candidate<'pat, 'tcx>) { candidate: &mut Candidate<'pat, 'tcx>) {
// repeatedly simplify match pairs until fixed point is reached // repeatedly simplify match pairs until fixed point is reached

View File

@ -19,7 +19,7 @@ use rustc::hir::{RangeEnd, Mutability};
use syntax_pos::Span; use syntax_pos::Span;
use std::cmp::Ordering; use std::cmp::Ordering;
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { impl<'a, 'tcx> Builder<'a, 'tcx> {
/// Identifies what test is needed to decide if `match_pair` is applicable. /// Identifies what test is needed to decide if `match_pair` is applicable.
/// ///
/// It is a bug to call this with a simplifiable pattern. /// It is a bug to call this with a simplifiable pattern.

View File

@ -5,7 +5,7 @@ use rustc::mir::*;
use std::u32; use std::u32;
use std::convert::TryInto; use std::convert::TryInto;
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { impl<'a, 'tcx> Builder<'a, 'tcx> {
pub fn field_match_pairs<'pat>(&mut self, pub fn field_match_pairs<'pat>(&mut self,
place: Place<'tcx>, place: Place<'tcx>,
subpatterns: &'pat [FieldPattern<'tcx>]) subpatterns: &'pat [FieldPattern<'tcx>])

View File

@ -8,7 +8,7 @@ use rustc::ty::{self, Ty};
use rustc::mir::*; use rustc::mir::*;
use syntax_pos::{Span, DUMMY_SP}; use syntax_pos::{Span, DUMMY_SP};
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { impl<'a, 'tcx> Builder<'a, 'tcx> {
/// Adds a new temporary value of type `ty` storing the result of /// Adds a new temporary value of type `ty` storing the result of
/// evaluating `expr`. /// evaluating `expr`.
/// ///

View File

@ -9,13 +9,10 @@ use rustc::hir::Node;
use rustc::hir::def_id::DefId; use rustc::hir::def_id::DefId;
use rustc::middle::region; use rustc::middle::region;
use rustc::mir::*; use rustc::mir::*;
use rustc::mir::visit::{MutVisitor, TyContext};
use rustc::ty::{self, Ty, TyCtxt}; use rustc::ty::{self, Ty, TyCtxt};
use rustc::ty::subst::SubstsRef;
use rustc::util::nodemap::HirIdMap; use rustc::util::nodemap::HirIdMap;
use rustc_target::spec::PanicStrategy; use rustc_target::spec::PanicStrategy;
use rustc_data_structures::indexed_vec::{IndexVec, Idx}; use rustc_data_structures::indexed_vec::{IndexVec, Idx};
use std::mem;
use std::u32; use std::u32;
use rustc_target::spec::abi::Abi; use rustc_target::spec::abi::Abi;
use syntax::attr::{self, UnwindAttr}; use syntax::attr::{self, UnwindAttr};
@ -66,7 +63,7 @@ pub fn mir_build<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> Body<'tcx> {
tcx.infer_ctxt().enter(|infcx| { tcx.infer_ctxt().enter(|infcx| {
let cx = Cx::new(&infcx, id); let cx = Cx::new(&infcx, id);
let mut body = if cx.tables().tainted_by_errors { let body = if cx.tables().tainted_by_errors {
build::construct_error(cx, body_id) build::construct_error(cx, body_id)
} else if cx.body_owner_kind.is_fn_or_closure() { } else if cx.body_owner_kind.is_fn_or_closure() {
// fetch the fully liberated fn signature (that is, all bound // fetch the fully liberated fn signature (that is, all bound
@ -162,16 +159,6 @@ pub fn mir_build<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> Body<'tcx> {
build::construct_const(cx, body_id, return_ty, return_ty_span) build::construct_const(cx, body_id, return_ty, return_ty_span)
}; };
// Convert the `mir::Body` to global types.
let mut globalizer = GlobalizeMir {
tcx,
span: body.span
};
globalizer.visit_body(&mut body);
let body = unsafe {
mem::transmute::<Body<'_>, Body<'tcx>>(body)
};
mir_util::dump_mir(tcx, None, "mir_map", &0, mir_util::dump_mir(tcx, None, "mir_map", &0,
MirSource::item(def_id), &body, |_, _| Ok(()) ); MirSource::item(def_id), &body, |_, _| Ok(()) );
@ -181,61 +168,11 @@ pub fn mir_build<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> Body<'tcx> {
}) })
} }
/// A pass to lift all the types and substitutions in a MIR
/// to the global tcx. Sadly, we don't have a "folder" that
/// can change `'tcx` so we have to transmute afterwards.
struct GlobalizeMir<'gcx> {
tcx: TyCtxt<'gcx, 'gcx>,
span: Span,
}
impl<'gcx: 'tcx, 'tcx> MutVisitor<'tcx> for GlobalizeMir<'gcx> {
fn visit_ty(&mut self, ty: &mut Ty<'tcx>, _: TyContext) {
if let Some(lifted) = self.tcx.lift(ty) {
*ty = lifted;
} else {
span_bug!(self.span,
"found type `{:?}` with inference types/regions in MIR",
ty);
}
}
fn visit_region(&mut self, region: &mut ty::Region<'tcx>, _: Location) {
if let Some(lifted) = self.tcx.lift(region) {
*region = lifted;
} else {
span_bug!(self.span,
"found region `{:?}` with inference types/regions in MIR",
region);
}
}
fn visit_const(&mut self, constant: &mut &'tcx ty::Const<'tcx>, _: Location) {
if let Some(lifted) = self.tcx.lift(constant) {
*constant = lifted;
} else {
span_bug!(self.span,
"found constant `{:?}` with inference types/regions in MIR",
constant);
}
}
fn visit_substs(&mut self, substs: &mut SubstsRef<'tcx>, _: Location) {
if let Some(lifted) = self.tcx.lift(substs) {
*substs = lifted;
} else {
span_bug!(self.span,
"found substs `{:?}` with inference types/regions in MIR",
substs);
}
}
}
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// BuildMir -- walks a crate, looking for fn items and methods to build MIR from // BuildMir -- walks a crate, looking for fn items and methods to build MIR from
fn liberated_closure_env_ty<'gcx, 'tcx>( fn liberated_closure_env_ty<'tcx>(
tcx: TyCtxt<'gcx, 'tcx>, tcx: TyCtxt<'tcx, 'tcx>,
closure_expr_id: hir::HirId, closure_expr_id: hir::HirId,
body_id: hir::BodyId, body_id: hir::BodyId,
) -> Ty<'tcx> { ) -> Ty<'tcx> {
@ -304,8 +241,8 @@ impl BlockFrame {
#[derive(Debug)] #[derive(Debug)]
struct BlockContext(Vec<BlockFrame>); struct BlockContext(Vec<BlockFrame>);
struct Builder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { struct Builder<'a, 'tcx: 'a> {
hir: Cx<'a, 'gcx, 'tcx>, hir: Cx<'a, 'tcx>,
cfg: CFG<'tcx>, cfg: CFG<'tcx>,
fn_span: Span, fn_span: Span,
@ -370,7 +307,7 @@ struct Builder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
cached_unreachable_block: Option<BasicBlock>, cached_unreachable_block: Option<BasicBlock>,
} }
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { impl<'a, 'tcx> Builder<'a, 'tcx> {
fn is_bound_var_in_guard(&self, id: hir::HirId) -> bool { fn is_bound_var_in_guard(&self, id: hir::HirId) -> bool {
self.guard_context.iter().any(|frame| frame.locals.iter().any(|local| local.id == id)) self.guard_context.iter().any(|frame| frame.locals.iter().any(|local| local.id == id))
} }
@ -552,7 +489,7 @@ macro_rules! unpack {
}; };
} }
fn should_abort_on_panic<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, fn_def_id: DefId, abi: Abi) -> bool { fn should_abort_on_panic<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, fn_def_id: DefId, abi: Abi) -> bool {
// Not callable from C, so we can safely unwind through these // Not callable from C, so we can safely unwind through these
if abi == Abi::Rust || abi == Abi::RustCall { return false; } if abi == Abi::Rust || abi == Abi::RustCall { return false; }
@ -580,17 +517,19 @@ fn should_abort_on_panic<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, fn_def_id: DefId,
struct ArgInfo<'gcx>(Ty<'gcx>, Option<Span>, Option<&'gcx hir::Pat>, Option<ImplicitSelfKind>); struct ArgInfo<'gcx>(Ty<'gcx>, Option<Span>, Option<&'gcx hir::Pat>, Option<ImplicitSelfKind>);
fn construct_fn<'a, 'gcx, 'tcx, A>(hir: Cx<'a, 'gcx, 'tcx>, fn construct_fn<'a, 'tcx, A>(
fn_id: hir::HirId, hir: Cx<'a, 'tcx>,
arguments: A, fn_id: hir::HirId,
safety: Safety, arguments: A,
abi: Abi, safety: Safety,
return_ty: Ty<'gcx>, abi: Abi,
yield_ty: Option<Ty<'gcx>>, return_ty: Ty<'tcx>,
return_ty_span: Span, yield_ty: Option<Ty<'tcx>>,
body: &'gcx hir::Body) return_ty_span: Span,
-> Body<'tcx> body: &'tcx hir::Body,
where A: Iterator<Item=ArgInfo<'gcx>> ) -> Body<'tcx>
where
A: Iterator<Item=ArgInfo<'tcx>>
{ {
let arguments: Vec<_> = arguments.collect(); let arguments: Vec<_> = arguments.collect();
@ -703,8 +642,8 @@ fn construct_fn<'a, 'gcx, 'tcx, A>(hir: Cx<'a, 'gcx, 'tcx>,
body body
} }
fn construct_const<'a, 'gcx, 'tcx>( fn construct_const<'a, 'tcx>(
hir: Cx<'a, 'gcx, 'tcx>, hir: Cx<'a, 'tcx>,
body_id: hir::BodyId, body_id: hir::BodyId,
const_ty: Ty<'tcx>, const_ty: Ty<'tcx>,
const_ty_span: Span, const_ty_span: Span,
@ -745,9 +684,10 @@ fn construct_const<'a, 'gcx, 'tcx>(
builder.finish(None) builder.finish(None)
} }
fn construct_error<'a, 'gcx, 'tcx>(hir: Cx<'a, 'gcx, 'tcx>, fn construct_error<'a, 'tcx>(
body_id: hir::BodyId) hir: Cx<'a, 'tcx>,
-> Body<'tcx> { body_id: hir::BodyId
) -> Body<'tcx> {
let owner_id = hir.tcx().hir().body_owner(body_id); let owner_id = hir.tcx().hir().body_owner(body_id);
let span = hir.tcx().hir().span(owner_id); let span = hir.tcx().hir().span(owner_id);
let ty = hir.tcx().types.err; let ty = hir.tcx().types.err;
@ -757,8 +697,8 @@ fn construct_error<'a, 'gcx, 'tcx>(hir: Cx<'a, 'gcx, 'tcx>,
builder.finish(None) builder.finish(None)
} }
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { impl<'a, 'tcx> Builder<'a, 'tcx> {
fn new(hir: Cx<'a, 'gcx, 'tcx>, fn new(hir: Cx<'a, 'tcx>,
span: Span, span: Span,
arg_count: usize, arg_count: usize,
safety: Safety, safety: Safety,
@ -767,7 +707,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
__upvar_debuginfo_codegen_only_do_not_use: Vec<UpvarDebuginfo>, __upvar_debuginfo_codegen_only_do_not_use: Vec<UpvarDebuginfo>,
upvar_mutbls: Vec<Mutability>, upvar_mutbls: Vec<Mutability>,
is_generator: bool) is_generator: bool)
-> Builder<'a, 'gcx, 'tcx> { -> Builder<'a, 'tcx> {
let lint_level = LintLevel::Explicit(hir.root_lint_level); let lint_level = LintLevel::Explicit(hir.root_lint_level);
let mut builder = Builder { let mut builder = Builder {
hir, hir,
@ -833,9 +773,9 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
fn args_and_body(&mut self, fn args_and_body(&mut self,
mut block: BasicBlock, mut block: BasicBlock,
arguments: &[ArgInfo<'gcx>], arguments: &[ArgInfo<'tcx>],
argument_scope: region::Scope, argument_scope: region::Scope,
ast_body: &'gcx hir::Expr) ast_body: &'tcx hir::Expr)
-> BlockAnd<()> -> BlockAnd<()>
{ {
// Allocate locals for the function arguments // Allocate locals for the function arguments

View File

@ -257,7 +257,7 @@ impl<'tcx> Scope<'tcx> {
} }
} }
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { impl<'a, 'tcx> Builder<'a, 'tcx> {
// Adding and removing scopes // Adding and removing scopes
// ========================== // ==========================
/// Start a breakable scope, which tracks where `continue` and `break` /// Start a breakable scope, which tracks where `continue` and `break`
@ -269,7 +269,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
break_block: BasicBlock, break_block: BasicBlock,
break_destination: Place<'tcx>, break_destination: Place<'tcx>,
f: F) -> R f: F) -> R
where F: FnOnce(&mut Builder<'a, 'gcx, 'tcx>) -> R where F: FnOnce(&mut Builder<'a, 'tcx>) -> R
{ {
let region_scope = self.topmost_scope(); let region_scope = self.topmost_scope();
let scope = BreakableScope { let scope = BreakableScope {
@ -289,7 +289,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
opt_scope: Option<(region::Scope, SourceInfo)>, opt_scope: Option<(region::Scope, SourceInfo)>,
f: F) f: F)
-> BlockAnd<R> -> BlockAnd<R>
where F: FnOnce(&mut Builder<'a, 'gcx, 'tcx>) -> BlockAnd<R> where F: FnOnce(&mut Builder<'a, 'tcx>) -> BlockAnd<R>
{ {
debug!("in_opt_scope(opt_scope={:?})", opt_scope); debug!("in_opt_scope(opt_scope={:?})", opt_scope);
if let Some(region_scope) = opt_scope { self.push_scope(region_scope); } if let Some(region_scope) = opt_scope { self.push_scope(region_scope); }
@ -309,7 +309,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
lint_level: LintLevel, lint_level: LintLevel,
f: F) f: F)
-> BlockAnd<R> -> BlockAnd<R>
where F: FnOnce(&mut Builder<'a, 'gcx, 'tcx>) -> BlockAnd<R> where F: FnOnce(&mut Builder<'a, 'tcx>) -> BlockAnd<R>
{ {
debug!("in_scope(region_scope={:?})", region_scope); debug!("in_scope(region_scope={:?})", region_scope);
let source_scope = self.source_scope; let source_scope = self.source_scope;

View File

@ -9,9 +9,9 @@ crate enum LitToConstError {
Reported, Reported,
} }
crate fn lit_to_const<'gcx, 'tcx>( crate fn lit_to_const<'tcx>(
lit: &'tcx ast::LitKind, lit: &'tcx ast::LitKind,
tcx: TyCtxt<'gcx, 'tcx>, tcx: TyCtxt<'tcx, 'tcx>,
ty: Ty<'tcx>, ty: Ty<'tcx>,
neg: bool, neg: bool,
) -> Result<&'tcx ty::Const<'tcx>, LitToConstError> { ) -> Result<&'tcx ty::Const<'tcx>, LitToConstError> {

View File

@ -10,7 +10,7 @@ use rustc_data_structures::indexed_vec::Idx;
impl<'tcx> Mirror<'tcx> for &'tcx hir::Block { impl<'tcx> Mirror<'tcx> for &'tcx hir::Block {
type Output = Block<'tcx>; type Output = Block<'tcx>;
fn make_mirror<'a, 'gcx>(self, cx: &mut Cx<'a, 'gcx, 'tcx>) -> Block<'tcx> { fn make_mirror(self, cx: &mut Cx<'_, 'tcx>) -> Block<'tcx> {
// We have to eagerly lower the "spine" of the statements // We have to eagerly lower the "spine" of the statements
// in order to get the lexical scoping correctly. // in order to get the lexical scoping correctly.
let stmts = mirror_stmts(cx, self.hir_id.local_id, &*self.stmts); let stmts = mirror_stmts(cx, self.hir_id.local_id, &*self.stmts);
@ -40,10 +40,11 @@ impl<'tcx> Mirror<'tcx> for &'tcx hir::Block {
} }
} }
fn mirror_stmts<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, fn mirror_stmts<'a, 'tcx>(
block_id: hir::ItemLocalId, cx: &mut Cx<'a, 'tcx>,
stmts: &'tcx [hir::Stmt]) block_id: hir::ItemLocalId,
-> Vec<StmtRef<'tcx>> { stmts: &'tcx [hir::Stmt],
) -> Vec<StmtRef<'tcx>> {
let mut result = vec![]; let mut result = vec![];
for (index, stmt) in stmts.iter().enumerate() { for (index, stmt) in stmts.iter().enumerate() {
let hir_id = stmt.hir_id; let hir_id = stmt.hir_id;
@ -114,9 +115,10 @@ fn mirror_stmts<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
return result; return result;
} }
pub fn to_expr_ref<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, pub fn to_expr_ref<'a, 'tcx>(
block: &'tcx hir::Block) cx: &mut Cx<'a, 'tcx>,
-> ExprRef<'tcx> { block: &'tcx hir::Block,
) -> ExprRef<'tcx> {
let block_ty = cx.tables().node_type(block.hir_id); let block_ty = cx.tables().node_type(block.hir_id);
let temp_lifetime = cx.region_scope_tree.temporary_scope(block.hir_id.local_id); let temp_lifetime = cx.region_scope_tree.temporary_scope(block.hir_id.local_id);
let expr = Expr { let expr = Expr {

View File

@ -17,7 +17,7 @@ use syntax_pos::Span;
impl<'tcx> Mirror<'tcx> for &'tcx hir::Expr { impl<'tcx> Mirror<'tcx> for &'tcx hir::Expr {
type Output = Expr<'tcx>; type Output = Expr<'tcx>;
fn make_mirror<'a, 'gcx>(self, cx: &mut Cx<'a, 'gcx, 'tcx>) -> Expr<'tcx> { fn make_mirror(self, cx: &mut Cx<'_, 'tcx>) -> Expr<'tcx> {
let temp_lifetime = cx.region_scope_tree.temporary_scope(self.hir_id.local_id); let temp_lifetime = cx.region_scope_tree.temporary_scope(self.hir_id.local_id);
let expr_scope = region::Scope { let expr_scope = region::Scope {
id: self.hir_id.local_id, id: self.hir_id.local_id,
@ -68,11 +68,12 @@ impl<'tcx> Mirror<'tcx> for &'tcx hir::Expr {
} }
} }
fn apply_adjustment<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, fn apply_adjustment<'a, 'tcx>(
hir_expr: &'tcx hir::Expr, cx: &mut Cx<'a, 'tcx>,
mut expr: Expr<'tcx>, hir_expr: &'tcx hir::Expr,
adjustment: &Adjustment<'tcx>) mut expr: Expr<'tcx>,
-> Expr<'tcx> { adjustment: &Adjustment<'tcx>
) -> Expr<'tcx> {
let Expr { temp_lifetime, mut span, .. } = expr; let Expr { temp_lifetime, mut span, .. } = expr;
// Adjust the span from the block, to the last expression of the // Adjust the span from the block, to the last expression of the
@ -196,9 +197,10 @@ fn apply_adjustment<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
} }
} }
fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, fn make_mirror_unadjusted<'a, 'tcx>(
expr: &'tcx hir::Expr) cx: &mut Cx<'a, 'tcx>,
-> Expr<'tcx> { expr: &'tcx hir::Expr,
) -> Expr<'tcx> {
let expr_ty = cx.tables().expr_ty(expr); let expr_ty = cx.tables().expr_ty(expr);
let temp_lifetime = cx.region_scope_tree.temporary_scope(expr.hir_id.local_id); let temp_lifetime = cx.region_scope_tree.temporary_scope(expr.hir_id.local_id);
@ -774,7 +776,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
} }
fn user_substs_applied_to_res( fn user_substs_applied_to_res(
cx: &mut Cx<'a, 'gcx, 'tcx>, cx: &mut Cx<'a, 'tcx>,
hir_id: hir::HirId, hir_id: hir::HirId,
res: Res, res: Res,
) -> Option<ty::CanonicalUserType<'tcx>> { ) -> Option<ty::CanonicalUserType<'tcx>> {
@ -808,8 +810,8 @@ fn user_substs_applied_to_res(
user_provided_type user_provided_type
} }
fn method_callee<'a, 'gcx, 'tcx>( fn method_callee<'a, 'tcx>(
cx: &mut Cx<'a, 'gcx, 'tcx>, cx: &mut Cx<'a, 'tcx>,
expr: &hir::Expr, expr: &hir::Expr,
span: Span, span: Span,
overloaded_callee: Option<(DefId, SubstsRef<'tcx>)>, overloaded_callee: Option<(DefId, SubstsRef<'tcx>)>,
@ -865,7 +867,7 @@ impl ToBorrowKind for hir::Mutability {
} }
} }
fn convert_arm<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, arm: &'tcx hir::Arm) -> Arm<'tcx> { fn convert_arm<'a, 'tcx>(cx: &mut Cx<'a, 'tcx>, arm: &'tcx hir::Arm) -> Arm<'tcx> {
Arm { Arm {
patterns: arm.pats.iter().map(|p| cx.pattern_from_hir(p)).collect(), patterns: arm.pats.iter().map(|p| cx.pattern_from_hir(p)).collect(),
guard: match arm.guard { guard: match arm.guard {
@ -882,10 +884,11 @@ fn convert_arm<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, arm: &'tcx hir::Arm)
} }
} }
fn convert_path_expr<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, fn convert_path_expr<'a, 'tcx>(
expr: &'tcx hir::Expr, cx: &mut Cx<'a, 'tcx>,
res: Res) expr: &'tcx hir::Expr,
-> ExprKind<'tcx> { res: Res,
) -> ExprKind<'tcx> {
let substs = cx.tables().node_substs(expr.hir_id); let substs = cx.tables().node_substs(expr.hir_id);
match res { match res {
// A regular function, constructor function or a constant. // A regular function, constructor function or a constant.
@ -967,7 +970,7 @@ fn convert_path_expr<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
} }
fn convert_var( fn convert_var(
cx: &mut Cx<'_, '_, 'tcx>, cx: &mut Cx<'_, 'tcx>,
expr: &'tcx hir::Expr, expr: &'tcx hir::Expr,
var_hir_id: hir::HirId, var_hir_id: hir::HirId,
) -> ExprKind<'tcx> { ) -> ExprKind<'tcx> {
@ -1117,10 +1120,11 @@ fn bin_op(op: hir::BinOpKind) -> BinOp {
} }
} }
fn overloaded_operator<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, fn overloaded_operator<'a, 'tcx>(
expr: &'tcx hir::Expr, cx: &mut Cx<'a, 'tcx>,
args: Vec<ExprRef<'tcx>>) expr: &'tcx hir::Expr,
-> ExprKind<'tcx> { args: Vec<ExprRef<'tcx>>
) -> ExprKind<'tcx> {
let fun = method_callee(cx, expr, expr.span, None); let fun = method_callee(cx, expr, expr.span, None);
ExprKind::Call { ExprKind::Call {
ty: fun.ty, ty: fun.ty,
@ -1130,8 +1134,8 @@ fn overloaded_operator<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
} }
} }
fn overloaded_place<'a, 'gcx, 'tcx>( fn overloaded_place<'a, 'tcx>(
cx: &mut Cx<'a, 'gcx, 'tcx>, cx: &mut Cx<'a, 'tcx>,
expr: &'tcx hir::Expr, expr: &'tcx hir::Expr,
place_ty: Ty<'tcx>, place_ty: Ty<'tcx>,
overloaded_callee: Option<(DefId, SubstsRef<'tcx>)>, overloaded_callee: Option<(DefId, SubstsRef<'tcx>)>,
@ -1178,11 +1182,12 @@ fn overloaded_place<'a, 'gcx, 'tcx>(
ExprKind::Deref { arg: ref_expr.to_ref() } ExprKind::Deref { arg: ref_expr.to_ref() }
} }
fn capture_upvar<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, fn capture_upvar<'tcx>(
closure_expr: &'tcx hir::Expr, cx: &mut Cx<'_, 'tcx>,
var_hir_id: hir::HirId, closure_expr: &'tcx hir::Expr,
upvar_ty: Ty<'tcx>) var_hir_id: hir::HirId,
-> ExprRef<'tcx> { upvar_ty: Ty<'tcx>
) -> ExprRef<'tcx> {
let upvar_id = ty::UpvarId { let upvar_id = ty::UpvarId {
var_path: ty::UpvarPath { hir_id: var_hir_id }, var_path: ty::UpvarPath { hir_id: var_hir_id },
closure_expr_id: cx.tcx.hir().local_def_id_from_hir_id(closure_expr.hir_id).to_local(), closure_expr_id: cx.tcx.hir().local_def_id_from_hir_id(closure_expr.hir_id).to_local(),
@ -1218,9 +1223,10 @@ fn capture_upvar<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
} }
/// Converts a list of named fields (i.e., for struct-like struct/enum ADTs) into FieldExprRef. /// Converts a list of named fields (i.e., for struct-like struct/enum ADTs) into FieldExprRef.
fn field_refs<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, fn field_refs<'a, 'tcx>(
fields: &'tcx [hir::Field]) cx: &mut Cx<'a, 'tcx>,
-> Vec<FieldExprRef<'tcx>> { fields: &'tcx [hir::Field]
) -> Vec<FieldExprRef<'tcx>> {
fields.iter() fields.iter()
.map(|field| { .map(|field| {
FieldExprRef { FieldExprRef {

View File

@ -21,18 +21,18 @@ use rustc::hir;
use crate::hair::constant::{lit_to_const, LitToConstError}; use crate::hair::constant::{lit_to_const, LitToConstError};
#[derive(Clone)] #[derive(Clone)]
pub struct Cx<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { pub struct Cx<'a, 'tcx: 'a> {
tcx: TyCtxt<'gcx, 'tcx>, tcx: TyCtxt<'tcx, 'tcx>,
infcx: &'a InferCtxt<'a, 'gcx, 'tcx>, infcx: &'a InferCtxt<'a, 'tcx, 'tcx>,
pub root_lint_level: hir::HirId, pub root_lint_level: hir::HirId,
pub param_env: ty::ParamEnv<'gcx>, pub param_env: ty::ParamEnv<'tcx>,
/// Identity `InternalSubsts` for use with const-evaluation. /// Identity `InternalSubsts` for use with const-evaluation.
pub identity_substs: &'gcx InternalSubsts<'gcx>, pub identity_substs: &'tcx InternalSubsts<'tcx>,
pub region_scope_tree: &'gcx region::ScopeTree, pub region_scope_tree: &'tcx region::ScopeTree,
pub tables: &'a ty::TypeckTables<'gcx>, pub tables: &'a ty::TypeckTables<'tcx>,
/// This is `Constness::Const` if we are compiling a `static`, /// This is `Constness::Const` if we are compiling a `static`,
/// `const`, or the body of a `const fn`. /// `const`, or the body of a `const fn`.
@ -51,9 +51,9 @@ pub struct Cx<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> {
control_flow_destroyed: Vec<(Span, String)>, control_flow_destroyed: Vec<(Span, String)>,
} }
impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> { impl<'a, 'tcx> Cx<'a, 'tcx> {
pub fn new(infcx: &'a InferCtxt<'a, 'gcx, 'tcx>, pub fn new(infcx: &'a InferCtxt<'a, 'tcx, 'tcx>,
src_id: hir::HirId) -> Cx<'a, 'gcx, 'tcx> { src_id: hir::HirId) -> Cx<'a, 'tcx> {
let tcx = infcx.tcx; let tcx = infcx.tcx;
let src_def_id = tcx.hir().local_def_id_from_hir_id(src_id); let src_def_id = tcx.hir().local_def_id_from_hir_id(src_id);
let tables = tcx.typeck_tables_of(src_def_id); let tables = tcx.typeck_tables_of(src_def_id);
@ -100,7 +100,7 @@ impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> {
} }
} }
impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> { impl<'a, 'tcx> Cx<'a, 'tcx> {
/// Normalizes `ast` into the appropriate "mirror" type. /// Normalizes `ast` into the appropriate "mirror" type.
pub fn mirror<M: Mirror<'tcx>>(&mut self, ast: M) -> M::Output { pub fn mirror<M: Mirror<'tcx>>(&mut self, ast: M) -> M::Output {
ast.make_mirror(self) ast.make_mirror(self)
@ -200,11 +200,11 @@ impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> {
ty.needs_drop(self.tcx.global_tcx(), param_env) ty.needs_drop(self.tcx.global_tcx(), param_env)
} }
pub fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { pub fn tcx(&self) -> TyCtxt<'tcx, 'tcx> {
self.tcx self.tcx
} }
pub fn tables(&self) -> &'a ty::TypeckTables<'gcx> { pub fn tables(&self) -> &'a ty::TypeckTables<'tcx> {
self.tables self.tables
} }
@ -217,8 +217,8 @@ impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> {
} }
} }
impl UserAnnotatedTyHelpers<'gcx, 'tcx> for Cx<'_, 'gcx, 'tcx> { impl UserAnnotatedTyHelpers<'tcx> for Cx<'_, 'tcx> {
fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { fn tcx(&self) -> TyCtxt<'tcx, 'tcx> {
self.tcx() self.tcx()
} }

View File

@ -344,13 +344,13 @@ impl<'tcx> ExprRef<'tcx> {
pub trait Mirror<'tcx> { pub trait Mirror<'tcx> {
type Output; type Output;
fn make_mirror<'a, 'gcx>(self, cx: &mut Cx<'a, 'gcx, 'tcx>) -> Self::Output; fn make_mirror(self, cx: &mut Cx<'_, 'tcx>) -> Self::Output;
} }
impl<'tcx> Mirror<'tcx> for Expr<'tcx> { impl<'tcx> Mirror<'tcx> for Expr<'tcx> {
type Output = Expr<'tcx>; type Output = Expr<'tcx>;
fn make_mirror<'a, 'gcx>(self, _: &mut Cx<'a, 'gcx, 'tcx>) -> Expr<'tcx> { fn make_mirror(self, _: &mut Cx<'_, 'tcx>) -> Expr<'tcx> {
self self
} }
} }
@ -358,7 +358,7 @@ impl<'tcx> Mirror<'tcx> for Expr<'tcx> {
impl<'tcx> Mirror<'tcx> for ExprRef<'tcx> { impl<'tcx> Mirror<'tcx> for ExprRef<'tcx> {
type Output = Expr<'tcx>; type Output = Expr<'tcx>;
fn make_mirror<'a, 'gcx>(self, hir: &mut Cx<'a, 'gcx, 'tcx>) -> Expr<'tcx> { fn make_mirror(self, hir: &mut Cx<'a, 'tcx>) -> Expr<'tcx> {
match self { match self {
ExprRef::Hair(h) => h.make_mirror(hir), ExprRef::Hair(h) => h.make_mirror(hir),
ExprRef::Mirror(m) => *m, ExprRef::Mirror(m) => *m,
@ -369,7 +369,7 @@ impl<'tcx> Mirror<'tcx> for ExprRef<'tcx> {
impl<'tcx> Mirror<'tcx> for Stmt<'tcx> { impl<'tcx> Mirror<'tcx> for Stmt<'tcx> {
type Output = Stmt<'tcx>; type Output = Stmt<'tcx>;
fn make_mirror<'a, 'gcx>(self, _: &mut Cx<'a, 'gcx, 'tcx>) -> Stmt<'tcx> { fn make_mirror(self, _: &mut Cx<'_, 'tcx>) -> Stmt<'tcx> {
self self
} }
} }
@ -377,7 +377,7 @@ impl<'tcx> Mirror<'tcx> for Stmt<'tcx> {
impl<'tcx> Mirror<'tcx> for StmtRef<'tcx> { impl<'tcx> Mirror<'tcx> for StmtRef<'tcx> {
type Output = Stmt<'tcx>; type Output = Stmt<'tcx>;
fn make_mirror<'a, 'gcx>(self, _: &mut Cx<'a, 'gcx, 'tcx>) -> Stmt<'tcx> { fn make_mirror(self, _: &mut Cx<'_, 'tcx>) -> Stmt<'tcx> {
match self { match self {
StmtRef::Mirror(m) => *m, StmtRef::Mirror(m) => *m,
} }
@ -387,7 +387,7 @@ impl<'tcx> Mirror<'tcx> for StmtRef<'tcx> {
impl<'tcx> Mirror<'tcx> for Block<'tcx> { impl<'tcx> Mirror<'tcx> for Block<'tcx> {
type Output = Block<'tcx>; type Output = Block<'tcx>;
fn make_mirror<'a, 'gcx>(self, _: &mut Cx<'a, 'gcx, 'tcx>) -> Block<'tcx> { fn make_mirror(self, _: &mut Cx<'_, 'tcx>) -> Block<'tcx> {
self self
} }
} }

View File

@ -1058,7 +1058,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> {
} }
} }
impl UserAnnotatedTyHelpers<'tcx, 'tcx> for PatternContext<'_, 'tcx> { impl UserAnnotatedTyHelpers<'tcx> for PatternContext<'_, 'tcx> {
fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { fn tcx(&self) -> TyCtxt<'tcx, 'tcx> {
self.tcx self.tcx
} }
@ -1246,8 +1246,8 @@ impl<'tcx> PatternFoldable<'tcx> for PatternKind<'tcx> {
} }
} }
pub fn compare_const_vals<'gcx, 'tcx>( pub fn compare_const_vals<'tcx>(
tcx: TyCtxt<'gcx, 'tcx>, tcx: TyCtxt<'tcx, 'tcx>,
a: &'tcx ty::Const<'tcx>, a: &'tcx ty::Const<'tcx>,
b: &'tcx ty::Const<'tcx>, b: &'tcx ty::Const<'tcx>,
ty: ty::ParamEnvAnd<'tcx, Ty<'tcx>>, ty: ty::ParamEnvAnd<'tcx, Ty<'tcx>>,

View File

@ -1,8 +1,8 @@
use rustc::hir; use rustc::hir;
use rustc::ty::{self, CanonicalUserType, TyCtxt, UserType}; use rustc::ty::{self, CanonicalUserType, TyCtxt, UserType};
crate trait UserAnnotatedTyHelpers<'gcx: 'tcx, 'tcx> { crate trait UserAnnotatedTyHelpers<'tcx> {
fn tcx(&self) -> TyCtxt<'gcx, 'tcx>; fn tcx(&self) -> TyCtxt<'tcx, 'tcx>;
fn tables(&self) -> &ty::TypeckTables<'tcx>; fn tables(&self) -> &ty::TypeckTables<'tcx>;