Fix lint findings in librustc
This commit is contained in:
parent
8af35fe3f0
commit
6c272b78dc
@ -690,7 +690,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
|
||||
name: String,
|
||||
sub: ty::subst::SubstsRef<'tcx>,
|
||||
pos: usize,
|
||||
other_ty: &Ty<'tcx>,
|
||||
other_ty: Ty<'tcx>,
|
||||
) {
|
||||
// `value` and `other_value` hold two incomplete type representation for display.
|
||||
// `name` is the path of both types being compared. `sub`
|
||||
@ -768,10 +768,10 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
|
||||
path: String,
|
||||
sub: ty::subst::SubstsRef<'tcx>,
|
||||
other_path: String,
|
||||
other_ty: &Ty<'tcx>,
|
||||
other_ty: Ty<'tcx>,
|
||||
) -> Option<()> {
|
||||
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);
|
||||
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
|
||||
/// relevant differences, and return two representation of those types for highlighted printing.
|
||||
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) {
|
||||
(a, b) if *a == *b => true,
|
||||
(&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());
|
||||
if let Some((sp, msg)) = secondary_span {
|
||||
@ -1233,7 +1233,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
|
||||
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 mut diag = match failure_code {
|
||||
FailureCode::Error0317(failure_str) => {
|
||||
|
@ -11,7 +11,7 @@ use errors::DiagnosticBuilder;
|
||||
|
||||
struct FindLocalByTypeVisitor<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> {
|
||||
infcx: &'a InferCtxt<'a, 'gcx, 'tcx>,
|
||||
target_ty: &'a Ty<'tcx>,
|
||||
target_ty: Ty<'tcx>,
|
||||
hir_map: &'a hir::map::Map<'gcx>,
|
||||
found_local_pattern: Option<&'gcx Pat>,
|
||||
found_arg_pattern: Option<&'gcx Pat>,
|
||||
@ -26,7 +26,7 @@ impl<'a, 'gcx, 'tcx> FindLocalByTypeVisitor<'a, 'gcx, 'tcx> {
|
||||
Some(ty) => {
|
||||
let ty = self.infcx.resolve_type_vars_if_possible(&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))) => {
|
||||
self.infcx
|
||||
.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> {
|
||||
pub fn extract_type_name(
|
||||
&self,
|
||||
ty: &'a Ty<'tcx>,
|
||||
ty: Ty<'tcx>,
|
||||
highlight: Option<ty::print::RegionHighlightMode>,
|
||||
) -> 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();
|
||||
if let TypeVariableOrigin::TypeParameterDefinition(_, name) =
|
||||
*ty_vars.var_origin(ty_vid) {
|
||||
@ -102,7 +102,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
|
||||
|
||||
let mut local_visitor = FindLocalByTypeVisitor {
|
||||
infcx: &self,
|
||||
target_ty: &ty,
|
||||
target_ty: ty,
|
||||
hir_map: &self.tcx.hir(),
|
||||
found_local_pattern: None,
|
||||
found_arg_pattern: None,
|
||||
|
@ -193,7 +193,7 @@ impl NiceRegionError<'me, 'gcx, 'tcx> {
|
||||
);
|
||||
|
||||
let mut err = self.tcx().sess.struct_span_err(
|
||||
cause.span(&self.tcx()),
|
||||
cause.span(self.tcx()),
|
||||
&format!(
|
||||
"implementation of `{}` is not general enough",
|
||||
self.tcx().def_path_str(trait_def_id),
|
||||
|
@ -267,7 +267,7 @@ where
|
||||
fn relate_projection_ty(
|
||||
&mut self,
|
||||
projection_ty: ty::ProjectionTy<'tcx>,
|
||||
value_ty: ty::Ty<'tcx>,
|
||||
value_ty: Ty<'tcx>,
|
||||
) -> Ty<'tcx> {
|
||||
use crate::infer::type_variable::TypeVariableOrigin;
|
||||
use crate::traits::WhereClause;
|
||||
|
@ -4,7 +4,7 @@ use rustc_data_structures::stable_hasher::{StableHasher, HashStable,
|
||||
StableHasherResult};
|
||||
use std::cmp;
|
||||
use std::mem;
|
||||
use crate::ty;
|
||||
use crate::ty::{self, TyCtxt};
|
||||
use crate::ty::subst::SubstsRef;
|
||||
|
||||
/// The SymbolExportLevel of a symbols specifies from which kinds of crates
|
||||
@ -39,7 +39,7 @@ pub enum ExportedSymbol<'tcx> {
|
||||
|
||||
impl<'tcx> ExportedSymbol<'tcx> {
|
||||
pub fn symbol_name(&self,
|
||||
tcx: ty::TyCtxt<'_, 'tcx, '_>)
|
||||
tcx: TyCtxt<'_, 'tcx, '_>)
|
||||
-> ty::SymbolName {
|
||||
match *self {
|
||||
ExportedSymbol::NonGeneric(def_id) => {
|
||||
@ -55,7 +55,7 @@ impl<'tcx> ExportedSymbol<'tcx> {
|
||||
}
|
||||
|
||||
pub fn compare_stable(&self,
|
||||
tcx: ty::TyCtxt<'_, 'tcx, '_>,
|
||||
tcx: TyCtxt<'_, 'tcx, '_>,
|
||||
other: &ExportedSymbol<'tcx>)
|
||||
-> cmp::Ordering {
|
||||
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_{}_{}",
|
||||
tcx.original_crate_name(LOCAL_CRATE),
|
||||
tcx.crate_disambiguator(LOCAL_CRATE).to_fingerprint().to_hex())
|
||||
|
@ -18,7 +18,7 @@ pub enum 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 {
|
||||
MonoItem::Fn(instance) => {
|
||||
// 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)
|
||||
}
|
||||
|
||||
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
|
||||
// statements it corresponds to.
|
||||
self.size_estimate = Some(self.items.keys().map(|mi| mi.size_estimate(tcx)).sum());
|
||||
|
@ -198,7 +198,7 @@ macro_rules! make_mir_visitor {
|
||||
}
|
||||
|
||||
fn visit_ty(&mut self,
|
||||
ty: & $($mutability)? Ty<'tcx>,
|
||||
ty: $(& $mutability)? Ty<'tcx>,
|
||||
_: TyContext) {
|
||||
self.super_ty(ty);
|
||||
}
|
||||
@ -864,7 +864,7 @@ macro_rules! make_mir_visitor {
|
||||
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>) {
|
||||
|
@ -49,11 +49,11 @@ pub struct AutoTraitInfo<'cx> {
|
||||
}
|
||||
|
||||
pub struct AutoTraitFinder<'a, 'tcx: 'a> {
|
||||
tcx: &'a TyCtxt<'a, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'a, 'tcx, '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 }
|
||||
}
|
||||
|
||||
@ -291,7 +291,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
|
||||
infcx: &InferCtxt<'b, 'tcx, 'c>,
|
||||
ty_did: DefId,
|
||||
trait_did: DefId,
|
||||
ty: ty::Ty<'c>,
|
||||
ty: Ty<'c>,
|
||||
param_env: ty::ParamEnv<'c>,
|
||||
user_env: ty::ParamEnv<'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>>>,
|
||||
>(
|
||||
&self,
|
||||
ty: ty::Ty<'_>,
|
||||
ty: Ty<'_>,
|
||||
nested: T,
|
||||
computed_preds: &'b mut FxHashSet<ty::Predicate<'cx>>,
|
||||
fresh_preds: &'b mut FxHashSet<ty::Predicate<'cx>>,
|
||||
|
@ -1242,7 +1242,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
|
||||
found: ty::PolyTraitRef<'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 {
|
||||
let inputs = trait_ref.substs.type_at(1);
|
||||
let sig = if let ty::Tuple(inputs) = inputs.sty {
|
||||
|
@ -138,7 +138,7 @@ pub struct 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 {
|
||||
ObligationCauseCode::CompareImplMethodObligation { .. } |
|
||||
ObligationCauseCode::MainFunctionType |
|
||||
|
@ -3,7 +3,7 @@ use smallvec::SmallVec;
|
||||
use crate::traits;
|
||||
use crate::traits::project::Normalized;
|
||||
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 std::fmt;
|
||||
@ -311,7 +311,7 @@ impl<'tcx> TypeVisitor<'tcx> for BoundNamesCollector {
|
||||
result
|
||||
}
|
||||
|
||||
fn visit_ty(&mut self, t: ty::Ty<'tcx>) -> bool {
|
||||
fn visit_ty(&mut self, t: Ty<'tcx>) -> bool {
|
||||
use syntax::symbol::Symbol;
|
||||
|
||||
match t.sty {
|
||||
|
@ -421,7 +421,7 @@ struct BoundVarReplacer<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> {
|
||||
current_index: ty::DebruijnIndex,
|
||||
|
||||
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> {
|
||||
@ -431,7 +431,7 @@ impl<'a, 'gcx, 'tcx> BoundVarReplacer<'a, 'gcx, 'tcx> {
|
||||
fld_t: &'a mut G
|
||||
) -> Self
|
||||
where F: FnMut(ty::BoundRegion) -> ty::Region<'tcx>,
|
||||
G: FnMut(ty::BoundTy) -> ty::Ty<'tcx>
|
||||
G: FnMut(ty::BoundTy) -> Ty<'tcx>
|
||||
{
|
||||
BoundVarReplacer {
|
||||
tcx,
|
||||
@ -533,7 +533,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
||||
mut fld_t: G
|
||||
) -> (T, BTreeMap<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>
|
||||
{
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
@ -568,7 +568,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
||||
fld_t: G
|
||||
) -> (T, BTreeMap<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>
|
||||
{
|
||||
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 {
|
||||
ty::Bound(debruijn, bound_ty) => {
|
||||
if self.amount == 0 || debruijn < self.current_index {
|
||||
|
@ -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 {
|
||||
ty::AssociatedKind::Method => {
|
||||
// We skip the binder here because the binder would deanonymize all
|
||||
|
@ -9,7 +9,7 @@ use crate::rustc_serialize::{Decodable, Decoder, Encodable, Encoder, opaque,
|
||||
SpecializedDecoder, SpecializedEncoder,
|
||||
UseSpecializedDecodable, UseSpecializedEncodable};
|
||||
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::context::TyCtxt;
|
||||
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,
|
||||
shorthand: usize,
|
||||
or_insert_with: F)
|
||||
-> Result<ty::Ty<'tcx>, Self::Error>
|
||||
where F: FnOnce(&mut Self) -> Result<ty::Ty<'tcx>, Self::Error>
|
||||
-> Result<Ty<'tcx>, Self::Error>
|
||||
where F: FnOnce(&mut Self) -> Result<Ty<'tcx>, Self::Error>
|
||||
{
|
||||
let tcx = self.tcx();
|
||||
|
||||
@ -751,7 +751,7 @@ struct CacheEncoder<'enc, 'a, 'tcx, E>
|
||||
{
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
encoder: &'enc mut E,
|
||||
type_shorthands: FxHashMap<ty::Ty<'tcx>, usize>,
|
||||
type_shorthands: FxHashMap<Ty<'tcx>, usize>,
|
||||
predicate_shorthands: FxHashMap<ty::Predicate<'tcx>, usize>,
|
||||
expn_info_shorthands: FxHashMap<Mark, AbsoluteBytePos>,
|
||||
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
|
||||
{
|
||||
#[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,
|
||||
|encoder| &mut encoder.type_shorthands)
|
||||
}
|
||||
|
@ -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
|
||||
/// 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 {
|
||||
TyContext::ReturnTy(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) => {
|
||||
self.add_regular_live_constraint(*ty, location);
|
||||
self.add_regular_live_constraint(ty, location);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -228,7 +228,7 @@ pub fn partition<'a, 'tcx, I>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
// functions and statics defined in the local crate.
|
||||
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());
|
||||
|
||||
@ -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,
|
||||
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());
|
||||
|
||||
|
@ -308,7 +308,7 @@ fn compare_predicate_entailment<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
};
|
||||
|
||||
let mut diag = struct_span_err!(tcx.sess,
|
||||
cause.span(&tcx),
|
||||
cause.span(tcx),
|
||||
E0053,
|
||||
"method `{}` has an incompatible type for trait",
|
||||
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)| {
|
||||
(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 {
|
||||
(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 { .. }) => {
|
||||
@ -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()))
|
||||
} 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 {
|
||||
(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));
|
||||
} else {
|
||||
err.note_trait_signature(trait_m.ident.to_string(),
|
||||
trait_m.signature(&tcx));
|
||||
trait_m.signature(tcx));
|
||||
}
|
||||
err.emit();
|
||||
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));
|
||||
} else {
|
||||
err.note_trait_signature(trait_m.ident.to_string(),
|
||||
trait_m.signature(&tcx));
|
||||
trait_m.signature(tcx));
|
||||
}
|
||||
err.emit();
|
||||
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")));
|
||||
} else {
|
||||
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 {}",
|
||||
potentially_plural_count(trait_number_args, "parameter"), impl_number_args));
|
||||
|
@ -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));
|
||||
} else {
|
||||
err.note_trait_signature(trait_item.ident.to_string(),
|
||||
trait_item.signature(&tcx));
|
||||
trait_item.signature(tcx));
|
||||
}
|
||||
}
|
||||
err.emit();
|
||||
|
@ -14,7 +14,7 @@ pub struct AutoTraitFinder<'a, 'tcx> {
|
||||
|
||||
impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
|
||||
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 }
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user