Fix lint findings in librustc

This commit is contained in:
flip1995 2019-04-25 22:54:19 +02:00
parent 8af35fe3f0
commit 6c272b78dc
No known key found for this signature in database
GPG Key ID: 693086869D506637
19 changed files with 56 additions and 56 deletions

View File

@ -690,7 +690,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
name: String, name: String,
sub: ty::subst::SubstsRef<'tcx>, sub: ty::subst::SubstsRef<'tcx>,
pos: usize, pos: usize,
other_ty: &Ty<'tcx>, other_ty: Ty<'tcx>,
) { ) {
// `value` and `other_value` hold two incomplete type representation for display. // `value` and `other_value` hold two incomplete type representation for display.
// `name` is the path of both types being compared. `sub` // `name` is the path of both types being compared. `sub`
@ -768,10 +768,10 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
path: String, path: String,
sub: ty::subst::SubstsRef<'tcx>, sub: ty::subst::SubstsRef<'tcx>,
other_path: String, other_path: String,
other_ty: &Ty<'tcx>, other_ty: Ty<'tcx>,
) -> Option<()> { ) -> Option<()> {
for (i, ta) in sub.types().enumerate() { for (i, ta) in sub.types().enumerate() {
if &ta == other_ty { if ta == other_ty {
self.highlight_outer(&mut t1_out, &mut t2_out, path, sub, i, &other_ty); self.highlight_outer(&mut t1_out, &mut t2_out, path, sub, i, &other_ty);
return Some(()); return Some(());
} }
@ -839,7 +839,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
/// Compares two given types, eliding parts that are the same between them and highlighting /// Compares two given types, eliding parts that are the same between them and highlighting
/// relevant differences, and return two representation of those types for highlighted printing. /// relevant differences, and return two representation of those types for highlighted printing.
fn cmp(&self, t1: Ty<'tcx>, t2: Ty<'tcx>) -> (DiagnosticStyledString, DiagnosticStyledString) { fn cmp(&self, t1: Ty<'tcx>, t2: Ty<'tcx>) -> (DiagnosticStyledString, DiagnosticStyledString) {
fn equals<'tcx>(a: &Ty<'tcx>, b: &Ty<'tcx>) -> bool { fn equals<'tcx>(a: Ty<'tcx>, b: Ty<'tcx>) -> bool {
match (&a.sty, &b.sty) { match (&a.sty, &b.sty) {
(a, b) if *a == *b => true, (a, b) if *a == *b => true,
(&ty::Int(_), &ty::Infer(ty::InferTy::IntVar(_))) (&ty::Int(_), &ty::Infer(ty::InferTy::IntVar(_)))
@ -1099,7 +1099,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
} }
}; };
let span = cause.span(&self.tcx); let span = cause.span(self.tcx);
diag.span_label(span, terr.to_string()); diag.span_label(span, terr.to_string());
if let Some((sp, msg)) = secondary_span { if let Some((sp, msg)) = secondary_span {
@ -1233,7 +1233,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
trace, terr trace, terr
); );
let span = trace.cause.span(&self.tcx); let span = trace.cause.span(self.tcx);
let failure_code = trace.cause.as_failure_code(terr); let failure_code = trace.cause.as_failure_code(terr);
let mut diag = match failure_code { let mut diag = match failure_code {
FailureCode::Error0317(failure_str) => { FailureCode::Error0317(failure_str) => {

View File

@ -11,7 +11,7 @@ use errors::DiagnosticBuilder;
struct FindLocalByTypeVisitor<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { struct FindLocalByTypeVisitor<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> {
infcx: &'a InferCtxt<'a, 'gcx, 'tcx>, infcx: &'a InferCtxt<'a, 'gcx, 'tcx>,
target_ty: &'a Ty<'tcx>, target_ty: Ty<'tcx>,
hir_map: &'a hir::map::Map<'gcx>, hir_map: &'a hir::map::Map<'gcx>,
found_local_pattern: Option<&'gcx Pat>, found_local_pattern: Option<&'gcx Pat>,
found_arg_pattern: Option<&'gcx Pat>, found_arg_pattern: Option<&'gcx Pat>,
@ -26,7 +26,7 @@ impl<'a, 'gcx, 'tcx> FindLocalByTypeVisitor<'a, 'gcx, 'tcx> {
Some(ty) => { Some(ty) => {
let ty = self.infcx.resolve_type_vars_if_possible(&ty); let ty = self.infcx.resolve_type_vars_if_possible(&ty);
ty.walk().any(|inner_ty| { ty.walk().any(|inner_ty| {
inner_ty == *self.target_ty || match (&inner_ty.sty, &self.target_ty.sty) { inner_ty == self.target_ty || match (&inner_ty.sty, &self.target_ty.sty) {
(&Infer(TyVar(a_vid)), &Infer(TyVar(b_vid))) => { (&Infer(TyVar(a_vid)), &Infer(TyVar(b_vid))) => {
self.infcx self.infcx
.type_variables .type_variables
@ -68,10 +68,10 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for FindLocalByTypeVisitor<'a, 'gcx, 'tcx> {
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
pub fn extract_type_name( pub fn extract_type_name(
&self, &self,
ty: &'a Ty<'tcx>, ty: Ty<'tcx>,
highlight: Option<ty::print::RegionHighlightMode>, highlight: Option<ty::print::RegionHighlightMode>,
) -> String { ) -> String {
if let ty::Infer(ty::TyVar(ty_vid)) = (*ty).sty { if let ty::Infer(ty::TyVar(ty_vid)) = ty.sty {
let ty_vars = self.type_variables.borrow(); let ty_vars = self.type_variables.borrow();
if let TypeVariableOrigin::TypeParameterDefinition(_, name) = if let TypeVariableOrigin::TypeParameterDefinition(_, name) =
*ty_vars.var_origin(ty_vid) { *ty_vars.var_origin(ty_vid) {
@ -102,7 +102,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
let mut local_visitor = FindLocalByTypeVisitor { let mut local_visitor = FindLocalByTypeVisitor {
infcx: &self, infcx: &self,
target_ty: &ty, target_ty: ty,
hir_map: &self.tcx.hir(), hir_map: &self.tcx.hir(),
found_local_pattern: None, found_local_pattern: None,
found_arg_pattern: None, found_arg_pattern: None,

View File

@ -193,7 +193,7 @@ impl NiceRegionError<'me, 'gcx, 'tcx> {
); );
let mut err = self.tcx().sess.struct_span_err( let mut err = self.tcx().sess.struct_span_err(
cause.span(&self.tcx()), cause.span(self.tcx()),
&format!( &format!(
"implementation of `{}` is not general enough", "implementation of `{}` is not general enough",
self.tcx().def_path_str(trait_def_id), self.tcx().def_path_str(trait_def_id),

View File

@ -267,7 +267,7 @@ where
fn relate_projection_ty( fn relate_projection_ty(
&mut self, &mut self,
projection_ty: ty::ProjectionTy<'tcx>, projection_ty: ty::ProjectionTy<'tcx>,
value_ty: ty::Ty<'tcx>, value_ty: Ty<'tcx>,
) -> Ty<'tcx> { ) -> Ty<'tcx> {
use crate::infer::type_variable::TypeVariableOrigin; use crate::infer::type_variable::TypeVariableOrigin;
use crate::traits::WhereClause; use crate::traits::WhereClause;

View File

@ -4,7 +4,7 @@ use rustc_data_structures::stable_hasher::{StableHasher, HashStable,
StableHasherResult}; StableHasherResult};
use std::cmp; use std::cmp;
use std::mem; use std::mem;
use crate::ty; use crate::ty::{self, TyCtxt};
use crate::ty::subst::SubstsRef; use crate::ty::subst::SubstsRef;
/// The SymbolExportLevel of a symbols specifies from which kinds of crates /// The SymbolExportLevel of a symbols specifies from which kinds of crates
@ -39,7 +39,7 @@ pub enum ExportedSymbol<'tcx> {
impl<'tcx> ExportedSymbol<'tcx> { impl<'tcx> ExportedSymbol<'tcx> {
pub fn symbol_name(&self, pub fn symbol_name(&self,
tcx: ty::TyCtxt<'_, 'tcx, '_>) tcx: TyCtxt<'_, 'tcx, '_>)
-> ty::SymbolName { -> ty::SymbolName {
match *self { match *self {
ExportedSymbol::NonGeneric(def_id) => { ExportedSymbol::NonGeneric(def_id) => {
@ -55,7 +55,7 @@ impl<'tcx> ExportedSymbol<'tcx> {
} }
pub fn compare_stable(&self, pub fn compare_stable(&self,
tcx: ty::TyCtxt<'_, 'tcx, '_>, tcx: TyCtxt<'_, 'tcx, '_>,
other: &ExportedSymbol<'tcx>) other: &ExportedSymbol<'tcx>)
-> cmp::Ordering { -> cmp::Ordering {
match *self { match *self {
@ -92,7 +92,7 @@ impl<'tcx> ExportedSymbol<'tcx> {
} }
} }
pub fn metadata_symbol_name(tcx: ty::TyCtxt<'_, '_, '_>) -> String { pub fn metadata_symbol_name(tcx: TyCtxt<'_, '_, '_>) -> String {
format!("rust_metadata_{}_{}", format!("rust_metadata_{}_{}",
tcx.original_crate_name(LOCAL_CRATE), tcx.original_crate_name(LOCAL_CRATE),
tcx.crate_disambiguator(LOCAL_CRATE).to_fingerprint().to_hex()) tcx.crate_disambiguator(LOCAL_CRATE).to_fingerprint().to_hex())

View File

@ -18,7 +18,7 @@ pub enum MonoItem<'tcx> {
} }
impl<'tcx> MonoItem<'tcx> { impl<'tcx> MonoItem<'tcx> {
pub fn size_estimate<'a>(&self, tcx: &TyCtxt<'a, 'tcx, 'tcx>) -> usize { pub fn size_estimate<'a>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> usize {
match *self { match *self {
MonoItem::Fn(instance) => { MonoItem::Fn(instance) => {
// Estimate the size of a function based on how many statements // Estimate the size of a function based on how many statements
@ -144,7 +144,7 @@ impl<'tcx> CodegenUnit<'tcx> {
base_n::encode(hash, base_n::CASE_INSENSITIVE) base_n::encode(hash, base_n::CASE_INSENSITIVE)
} }
pub fn estimate_size<'a>(&mut self, tcx: &TyCtxt<'a, 'tcx, 'tcx>) { pub fn estimate_size<'a>(&mut self, tcx: TyCtxt<'a, 'tcx, 'tcx>) {
// Estimate the size of a codegen unit as (approximately) the number of MIR // Estimate the size of a codegen unit as (approximately) the number of MIR
// statements it corresponds to. // statements it corresponds to.
self.size_estimate = Some(self.items.keys().map(|mi| mi.size_estimate(tcx)).sum()); self.size_estimate = Some(self.items.keys().map(|mi| mi.size_estimate(tcx)).sum());

View File

@ -198,7 +198,7 @@ macro_rules! make_mir_visitor {
} }
fn visit_ty(&mut self, fn visit_ty(&mut self,
ty: & $($mutability)? Ty<'tcx>, ty: $(& $mutability)? Ty<'tcx>,
_: TyContext) { _: TyContext) {
self.super_ty(ty); self.super_ty(ty);
} }
@ -864,7 +864,7 @@ macro_rules! make_mir_visitor {
self.visit_ty(& $($mutability)? ty.inferred_ty, TyContext::UserTy(ty.span)); self.visit_ty(& $($mutability)? ty.inferred_ty, TyContext::UserTy(ty.span));
} }
fn super_ty(&mut self, _ty: & $($mutability)? Ty<'tcx>) { fn super_ty(&mut self, _ty: $(& $mutability)? Ty<'tcx>) {
} }
fn super_region(&mut self, _region: & $($mutability)? ty::Region<'tcx>) { fn super_region(&mut self, _region: & $($mutability)? ty::Region<'tcx>) {

View File

@ -49,11 +49,11 @@ pub struct AutoTraitInfo<'cx> {
} }
pub struct AutoTraitFinder<'a, 'tcx: 'a> { pub struct AutoTraitFinder<'a, 'tcx: 'a> {
tcx: &'a TyCtxt<'a, 'tcx, 'tcx>, tcx: TyCtxt<'a, 'tcx, 'tcx>,
} }
impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
pub fn new(tcx: &'a TyCtxt<'a, 'tcx, 'tcx>) -> Self { pub fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Self {
AutoTraitFinder { tcx } AutoTraitFinder { tcx }
} }
@ -291,7 +291,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
infcx: &InferCtxt<'b, 'tcx, 'c>, infcx: &InferCtxt<'b, 'tcx, 'c>,
ty_did: DefId, ty_did: DefId,
trait_did: DefId, trait_did: DefId,
ty: ty::Ty<'c>, ty: Ty<'c>,
param_env: ty::ParamEnv<'c>, param_env: ty::ParamEnv<'c>,
user_env: ty::ParamEnv<'c>, user_env: ty::ParamEnv<'c>,
fresh_preds: &mut FxHashSet<ty::Predicate<'c>>, fresh_preds: &mut FxHashSet<ty::Predicate<'c>>,
@ -661,7 +661,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
T: Iterator<Item = Obligation<'cx, ty::Predicate<'cx>>>, T: Iterator<Item = Obligation<'cx, ty::Predicate<'cx>>>,
>( >(
&self, &self,
ty: ty::Ty<'_>, ty: Ty<'_>,
nested: T, nested: T,
computed_preds: &'b mut FxHashSet<ty::Predicate<'cx>>, computed_preds: &'b mut FxHashSet<ty::Predicate<'cx>>,
fresh_preds: &'b mut FxHashSet<ty::Predicate<'cx>>, fresh_preds: &'b mut FxHashSet<ty::Predicate<'cx>>,

View File

@ -1242,7 +1242,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
found: ty::PolyTraitRef<'tcx>) found: ty::PolyTraitRef<'tcx>)
-> DiagnosticBuilder<'tcx> -> DiagnosticBuilder<'tcx>
{ {
fn build_fn_sig_string<'a, 'gcx, 'tcx>(tcx: ty::TyCtxt<'a, 'gcx, 'tcx>, fn build_fn_sig_string<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
trait_ref: &ty::TraitRef<'tcx>) -> String { trait_ref: &ty::TraitRef<'tcx>) -> String {
let inputs = trait_ref.substs.type_at(1); let inputs = trait_ref.substs.type_at(1);
let sig = if let ty::Tuple(inputs) = inputs.sty { let sig = if let ty::Tuple(inputs) = inputs.sty {

View File

@ -138,7 +138,7 @@ pub struct ObligationCause<'tcx> {
} }
impl<'tcx> ObligationCause<'tcx> { impl<'tcx> ObligationCause<'tcx> {
pub fn span<'a, 'gcx>(&self, tcx: &TyCtxt<'a, 'gcx, 'tcx>) -> Span { pub fn span<'a, 'gcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Span {
match self.code { match self.code {
ObligationCauseCode::CompareImplMethodObligation { .. } | ObligationCauseCode::CompareImplMethodObligation { .. } |
ObligationCauseCode::MainFunctionType | ObligationCauseCode::MainFunctionType |

View File

@ -3,7 +3,7 @@ use smallvec::SmallVec;
use crate::traits; use crate::traits;
use crate::traits::project::Normalized; use crate::traits::project::Normalized;
use crate::ty::fold::{TypeFoldable, TypeFolder, TypeVisitor}; use crate::ty::fold::{TypeFoldable, TypeFolder, TypeVisitor};
use crate::ty::{self, Lift, TyCtxt}; use crate::ty::{self, Lift, Ty, TyCtxt};
use syntax::symbol::InternedString; use syntax::symbol::InternedString;
use std::fmt; use std::fmt;
@ -311,7 +311,7 @@ impl<'tcx> TypeVisitor<'tcx> for BoundNamesCollector {
result result
} }
fn visit_ty(&mut self, t: ty::Ty<'tcx>) -> bool { fn visit_ty(&mut self, t: Ty<'tcx>) -> bool {
use syntax::symbol::Symbol; use syntax::symbol::Symbol;
match t.sty { match t.sty {

View File

@ -421,7 +421,7 @@ struct BoundVarReplacer<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> {
current_index: ty::DebruijnIndex, current_index: ty::DebruijnIndex,
fld_r: &'a mut (dyn FnMut(ty::BoundRegion) -> ty::Region<'tcx> + 'a), fld_r: &'a mut (dyn FnMut(ty::BoundRegion) -> ty::Region<'tcx> + 'a),
fld_t: &'a mut (dyn FnMut(ty::BoundTy) -> ty::Ty<'tcx> + 'a), fld_t: &'a mut (dyn FnMut(ty::BoundTy) -> Ty<'tcx> + 'a),
} }
impl<'a, 'gcx, 'tcx> BoundVarReplacer<'a, 'gcx, 'tcx> { impl<'a, 'gcx, 'tcx> BoundVarReplacer<'a, 'gcx, 'tcx> {
@ -431,7 +431,7 @@ impl<'a, 'gcx, 'tcx> BoundVarReplacer<'a, 'gcx, 'tcx> {
fld_t: &'a mut G fld_t: &'a mut G
) -> Self ) -> Self
where F: FnMut(ty::BoundRegion) -> ty::Region<'tcx>, where F: FnMut(ty::BoundRegion) -> ty::Region<'tcx>,
G: FnMut(ty::BoundTy) -> ty::Ty<'tcx> G: FnMut(ty::BoundTy) -> Ty<'tcx>
{ {
BoundVarReplacer { BoundVarReplacer {
tcx, tcx,
@ -533,7 +533,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
mut fld_t: G mut fld_t: G
) -> (T, BTreeMap<ty::BoundRegion, ty::Region<'tcx>>) ) -> (T, BTreeMap<ty::BoundRegion, ty::Region<'tcx>>)
where F: FnMut(ty::BoundRegion) -> ty::Region<'tcx>, where F: FnMut(ty::BoundRegion) -> ty::Region<'tcx>,
G: FnMut(ty::BoundTy) -> ty::Ty<'tcx>, G: FnMut(ty::BoundTy) -> Ty<'tcx>,
T: TypeFoldable<'tcx> T: TypeFoldable<'tcx>
{ {
use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::fx::FxHashMap;
@ -568,7 +568,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
fld_t: G fld_t: G
) -> (T, BTreeMap<ty::BoundRegion, ty::Region<'tcx>>) ) -> (T, BTreeMap<ty::BoundRegion, ty::Region<'tcx>>)
where F: FnMut(ty::BoundRegion) -> ty::Region<'tcx>, where F: FnMut(ty::BoundRegion) -> ty::Region<'tcx>,
G: FnMut(ty::BoundTy) -> ty::Ty<'tcx>, G: FnMut(ty::BoundTy) -> Ty<'tcx>,
T: TypeFoldable<'tcx> T: TypeFoldable<'tcx>
{ {
self.replace_escaping_bound_vars(value.skip_binder(), fld_r, fld_t) self.replace_escaping_bound_vars(value.skip_binder(), fld_r, fld_t)
@ -710,7 +710,7 @@ impl TypeFolder<'gcx, 'tcx> for Shifter<'a, 'gcx, 'tcx> {
} }
} }
fn fold_ty(&mut self, ty: ty::Ty<'tcx>) -> ty::Ty<'tcx> { fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
match ty.sty { match ty.sty {
ty::Bound(debruijn, bound_ty) => { ty::Bound(debruijn, bound_ty) => {
if self.amount == 0 || debruijn < self.current_index { if self.amount == 0 || debruijn < self.current_index {

View File

@ -212,7 +212,7 @@ impl AssociatedItem {
} }
} }
pub fn signature<'a, 'tcx>(&self, tcx: &TyCtxt<'a, 'tcx, 'tcx>) -> String { pub fn signature<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> String {
match self.kind { match self.kind {
ty::AssociatedKind::Method => { ty::AssociatedKind::Method => {
// We skip the binder here because the binder would deanonymize all // We skip the binder here because the binder would deanonymize all

View File

@ -9,7 +9,7 @@ use crate::rustc_serialize::{Decodable, Decoder, Encodable, Encoder, opaque,
SpecializedDecoder, SpecializedEncoder, SpecializedDecoder, SpecializedEncoder,
UseSpecializedDecodable, UseSpecializedEncodable}; UseSpecializedDecodable, UseSpecializedEncodable};
use crate::session::{CrateDisambiguator, Session}; use crate::session::{CrateDisambiguator, Session};
use crate::ty; use crate::ty::{self, Ty};
use crate::ty::codec::{self as ty_codec, TyDecoder, TyEncoder}; use crate::ty::codec::{self as ty_codec, TyDecoder, TyEncoder};
use crate::ty::context::TyCtxt; use crate::ty::context::TyCtxt;
use crate::util::common::{time, time_ext}; use crate::util::common::{time, time_ext};
@ -545,8 +545,8 @@ impl<'a, 'tcx: 'a, 'x> ty_codec::TyDecoder<'a, 'tcx> for CacheDecoder<'a, 'tcx,
fn cached_ty_for_shorthand<F>(&mut self, fn cached_ty_for_shorthand<F>(&mut self,
shorthand: usize, shorthand: usize,
or_insert_with: F) or_insert_with: F)
-> Result<ty::Ty<'tcx>, Self::Error> -> Result<Ty<'tcx>, Self::Error>
where F: FnOnce(&mut Self) -> Result<ty::Ty<'tcx>, Self::Error> where F: FnOnce(&mut Self) -> Result<Ty<'tcx>, Self::Error>
{ {
let tcx = self.tcx(); let tcx = self.tcx();
@ -751,7 +751,7 @@ struct CacheEncoder<'enc, 'a, 'tcx, E>
{ {
tcx: TyCtxt<'a, 'tcx, 'tcx>, tcx: TyCtxt<'a, 'tcx, 'tcx>,
encoder: &'enc mut E, encoder: &'enc mut E,
type_shorthands: FxHashMap<ty::Ty<'tcx>, usize>, type_shorthands: FxHashMap<Ty<'tcx>, usize>,
predicate_shorthands: FxHashMap<ty::Predicate<'tcx>, usize>, predicate_shorthands: FxHashMap<ty::Predicate<'tcx>, usize>,
expn_info_shorthands: FxHashMap<Mark, AbsoluteBytePos>, expn_info_shorthands: FxHashMap<Mark, AbsoluteBytePos>,
interpret_allocs: FxHashMap<interpret::AllocId, usize>, interpret_allocs: FxHashMap<interpret::AllocId, usize>,
@ -881,11 +881,11 @@ impl<'enc, 'a, 'tcx, E> SpecializedEncoder<CrateNum> for CacheEncoder<'enc, 'a,
} }
} }
impl<'enc, 'a, 'tcx, E> SpecializedEncoder<ty::Ty<'tcx>> for CacheEncoder<'enc, 'a, 'tcx, E> impl<'enc, 'a, 'tcx, E> SpecializedEncoder<Ty<'tcx>> for CacheEncoder<'enc, 'a, 'tcx, E>
where E: 'enc + ty_codec::TyEncoder where E: 'enc + ty_codec::TyEncoder
{ {
#[inline] #[inline]
fn specialized_encode(&mut self, ty: &ty::Ty<'tcx>) -> Result<(), Self::Error> { fn specialized_encode(&mut self, ty: &Ty<'tcx>) -> Result<(), Self::Error> {
ty_codec::encode_with_shorthand(self, ty, ty_codec::encode_with_shorthand(self, ty,
|encoder| &mut encoder.type_shorthands) |encoder| &mut encoder.type_shorthands)
} }

View File

@ -64,7 +64,7 @@ impl<'cg, 'cx, 'gcx, 'tcx> Visitor<'tcx> for ConstraintGeneration<'cg, 'cx, 'gcx
/// We sometimes have `ty` within an rvalue, or within a /// We sometimes have `ty` within an rvalue, or within a
/// call. Make them live at the location where they appear. /// call. Make them live at the location where they appear.
fn visit_ty(&mut self, ty: &ty::Ty<'tcx>, ty_context: TyContext) { fn visit_ty(&mut self, ty: ty::Ty<'tcx>, ty_context: TyContext) {
match ty_context { match ty_context {
TyContext::ReturnTy(SourceInfo { span, .. }) TyContext::ReturnTy(SourceInfo { span, .. })
| TyContext::YieldTy(SourceInfo { span, .. }) | TyContext::YieldTy(SourceInfo { span, .. })
@ -77,7 +77,7 @@ impl<'cg, 'cx, 'gcx, 'tcx> Visitor<'tcx> for ConstraintGeneration<'cg, 'cx, 'gcx
); );
} }
TyContext::Location(location) => { TyContext::Location(location) => {
self.add_regular_live_constraint(*ty, location); self.add_regular_live_constraint(ty, location);
} }
} }

View File

@ -228,7 +228,7 @@ pub fn partition<'a, 'tcx, I>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
// functions and statics defined in the local crate. // functions and statics defined in the local crate.
let mut initial_partitioning = place_root_mono_items(tcx, mono_items); let mut initial_partitioning = place_root_mono_items(tcx, mono_items);
initial_partitioning.codegen_units.iter_mut().for_each(|cgu| cgu.estimate_size(&tcx)); initial_partitioning.codegen_units.iter_mut().for_each(|cgu| cgu.estimate_size(tcx));
debug_dump(tcx, "INITIAL PARTITIONING:", initial_partitioning.codegen_units.iter()); debug_dump(tcx, "INITIAL PARTITIONING:", initial_partitioning.codegen_units.iter());
@ -247,7 +247,7 @@ pub fn partition<'a, 'tcx, I>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
let mut post_inlining = place_inlined_mono_items(initial_partitioning, let mut post_inlining = place_inlined_mono_items(initial_partitioning,
inlining_map); inlining_map);
post_inlining.codegen_units.iter_mut().for_each(|cgu| cgu.estimate_size(&tcx)); post_inlining.codegen_units.iter_mut().for_each(|cgu| cgu.estimate_size(tcx));
debug_dump(tcx, "POST INLINING:", post_inlining.codegen_units.iter()); debug_dump(tcx, "POST INLINING:", post_inlining.codegen_units.iter());

View File

@ -308,7 +308,7 @@ fn compare_predicate_entailment<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
}; };
let mut diag = struct_span_err!(tcx.sess, let mut diag = struct_span_err!(tcx.sess,
cause.span(&tcx), cause.span(tcx),
E0053, E0053,
"method `{}` has an incompatible type for trait", "method `{}` has an incompatible type for trait",
trait_m.ident); trait_m.ident);
@ -448,9 +448,9 @@ fn extract_spans_for_error_reporting<'a, 'gcx, 'tcx>(infcx: &infer::InferCtxt<'a
}).map(|(ref impl_arg, ref trait_arg)| { }).map(|(ref impl_arg, ref trait_arg)| {
(impl_arg.span, Some(trait_arg.span)) (impl_arg.span, Some(trait_arg.span))
}) })
.unwrap_or_else(|| (cause.span(&tcx), tcx.hir().span_if_local(trait_m.def_id))) .unwrap_or_else(|| (cause.span(tcx), tcx.hir().span_if_local(trait_m.def_id)))
} else { } else {
(cause.span(&tcx), tcx.hir().span_if_local(trait_m.def_id)) (cause.span(tcx), tcx.hir().span_if_local(trait_m.def_id))
} }
} }
TypeError::Sorts(ExpectedFound { .. }) => { TypeError::Sorts(ExpectedFound { .. }) => {
@ -483,14 +483,14 @@ fn extract_spans_for_error_reporting<'a, 'gcx, 'tcx>(infcx: &infer::InferCtxt<'a
{ {
(impl_m_output.span(), Some(trait_m_output.span())) (impl_m_output.span(), Some(trait_m_output.span()))
} else { } else {
(cause.span(&tcx), tcx.hir().span_if_local(trait_m.def_id)) (cause.span(tcx), tcx.hir().span_if_local(trait_m.def_id))
} }
) )
} else { } else {
(cause.span(&tcx), tcx.hir().span_if_local(trait_m.def_id)) (cause.span(tcx), tcx.hir().span_if_local(trait_m.def_id))
} }
} }
_ => (cause.span(&tcx), tcx.hir().span_if_local(trait_m.def_id)), _ => (cause.span(tcx), tcx.hir().span_if_local(trait_m.def_id)),
} }
} }
@ -549,7 +549,7 @@ fn compare_self_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
err.span_label(span, format!("trait method declared without `{}`", self_descr)); err.span_label(span, format!("trait method declared without `{}`", self_descr));
} else { } else {
err.note_trait_signature(trait_m.ident.to_string(), err.note_trait_signature(trait_m.ident.to_string(),
trait_m.signature(&tcx)); trait_m.signature(tcx));
} }
err.emit(); err.emit();
return Err(ErrorReported); return Err(ErrorReported);
@ -569,7 +569,7 @@ fn compare_self_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
err.span_label(span, format!("`{}` used in trait", self_descr)); err.span_label(span, format!("`{}` used in trait", self_descr));
} else { } else {
err.note_trait_signature(trait_m.ident.to_string(), err.note_trait_signature(trait_m.ident.to_string(),
trait_m.signature(&tcx)); trait_m.signature(tcx));
} }
err.emit(); err.emit();
return Err(ErrorReported); return Err(ErrorReported);
@ -726,7 +726,7 @@ fn compare_number_of_method_arguments<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
potentially_plural_count(trait_number_args, "parameter"))); potentially_plural_count(trait_number_args, "parameter")));
} else { } else {
err.note_trait_signature(trait_m.ident.to_string(), err.note_trait_signature(trait_m.ident.to_string(),
trait_m.signature(&tcx)); trait_m.signature(tcx));
} }
err.span_label(impl_span, format!("expected {}, found {}", err.span_label(impl_span, format!("expected {}, found {}",
potentially_plural_count(trait_number_args, "parameter"), impl_number_args)); potentially_plural_count(trait_number_args, "parameter"), impl_number_args));

View File

@ -1667,7 +1667,7 @@ fn check_impl_items_against_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
err.span_label(span, format!("`{}` from trait", trait_item.ident)); err.span_label(span, format!("`{}` from trait", trait_item.ident));
} else { } else {
err.note_trait_signature(trait_item.ident.to_string(), err.note_trait_signature(trait_item.ident.to_string(),
trait_item.signature(&tcx)); trait_item.signature(tcx));
} }
} }
err.emit(); err.emit();

View File

@ -14,7 +14,7 @@ pub struct AutoTraitFinder<'a, 'tcx> {
impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
pub fn new(cx: &'a core::DocContext<'tcx>) -> Self { pub fn new(cx: &'a core::DocContext<'tcx>) -> Self {
let f = auto::AutoTraitFinder::new(&cx.tcx); let f = auto::AutoTraitFinder::new(cx.tcx);
AutoTraitFinder { cx, f } AutoTraitFinder { cx, f }
} }