1
Fork 0

Fix lint findings in librustc_traits

This commit is contained in:
flip1995 2019-04-26 14:10:46 +02:00
parent 1526f7a4ed
commit 654d045b6f
No known key found for this signature in database
GPG key ID: 693086869D506637
5 changed files with 32 additions and 32 deletions

View file

@ -4,7 +4,7 @@ use rustc::traits::{
ProgramClause,
ProgramClauseCategory,
};
use rustc::ty;
use rustc::ty::{self, Ty, TyCtxt};
use rustc::ty::subst::{Kind, InternalSubsts, Subst};
use rustc::hir;
use rustc::hir::def_id::DefId;
@ -15,8 +15,8 @@ use crate::generic_types;
/// `Implemented(ty: Trait) :- Implemented(nested: Trait)...`
/// where `Trait` is specified by `trait_def_id`.
fn builtin_impl_clause(
tcx: ty::TyCtxt<'_, '_, 'tcx>,
ty: ty::Ty<'tcx>,
tcx: TyCtxt<'_, '_, 'tcx>,
ty: Ty<'tcx>,
nested: &[Kind<'tcx>],
trait_def_id: DefId
) -> ProgramClause<'tcx> {
@ -43,10 +43,10 @@ fn builtin_impl_clause(
}
crate fn assemble_builtin_unsize_impls<'tcx>(
tcx: ty::TyCtxt<'_, '_, 'tcx>,
tcx: TyCtxt<'_, '_, 'tcx>,
unsize_def_id: DefId,
source: ty::Ty<'tcx>,
target: ty::Ty<'tcx>,
source: Ty<'tcx>,
target: Ty<'tcx>,
clauses: &mut Vec<Clause<'tcx>>
) {
match (&source.sty, &target.sty) {
@ -119,12 +119,12 @@ crate fn assemble_builtin_unsize_impls<'tcx>(
}
crate fn assemble_builtin_sized_impls<'tcx>(
tcx: ty::TyCtxt<'_, '_, 'tcx>,
tcx: TyCtxt<'_, '_, 'tcx>,
sized_def_id: DefId,
ty: ty::Ty<'tcx>,
ty: Ty<'tcx>,
clauses: &mut Vec<Clause<'tcx>>
) {
let mut push_builtin_impl = |ty: ty::Ty<'tcx>, nested: &[Kind<'tcx>]| {
let mut push_builtin_impl = |ty: Ty<'tcx>, nested: &[Kind<'tcx>]| {
let clause = builtin_impl_clause(tcx, ty, nested, sized_def_id);
// Bind innermost bound vars that may exist in `ty` and `nested`.
clauses.push(Clause::ForAll(ty::Binder::bind(clause)));
@ -223,12 +223,12 @@ crate fn assemble_builtin_sized_impls<'tcx>(
}
crate fn assemble_builtin_copy_clone_impls<'tcx>(
tcx: ty::TyCtxt<'_, '_, 'tcx>,
tcx: TyCtxt<'_, '_, 'tcx>,
trait_def_id: DefId,
ty: ty::Ty<'tcx>,
ty: Ty<'tcx>,
clauses: &mut Vec<Clause<'tcx>>
) {
let mut push_builtin_impl = |ty: ty::Ty<'tcx>, nested: &[Kind<'tcx>]| {
let mut push_builtin_impl = |ty: Ty<'tcx>, nested: &[Kind<'tcx>]| {
let clause = builtin_impl_clause(tcx, ty, nested, trait_def_id);
// Bind innermost bound vars that may exist in `ty` and `nested`.
clauses.push(Clause::ForAll(ty::Binder::bind(clause)));

View file

@ -10,7 +10,7 @@ use rustc::traits::{
ProgramClauseCategory,
Environment,
};
use rustc::ty;
use rustc::ty::{self, TyCtxt};
use rustc::hir::def_id::DefId;
use super::ChalkInferenceContext;
use std::iter;
@ -19,7 +19,7 @@ use self::primitive::*;
use self::builtin::*;
fn assemble_clauses_from_impls<'tcx>(
tcx: ty::TyCtxt<'_, '_, 'tcx>,
tcx: TyCtxt<'_, '_, 'tcx>,
trait_def_id: DefId,
clauses: &mut Vec<Clause<'tcx>>
) {
@ -33,7 +33,7 @@ fn assemble_clauses_from_impls<'tcx>(
}
fn assemble_clauses_from_assoc_ty_values<'tcx>(
tcx: ty::TyCtxt<'_, '_, 'tcx>,
tcx: TyCtxt<'_, '_, 'tcx>,
trait_def_id: DefId,
clauses: &mut Vec<Clause<'tcx>>
) {

View file

@ -7,7 +7,7 @@ use rustc::traits::{
ProgramClause,
ProgramClauseCategory,
};
use rustc::ty;
use rustc::ty::{self, TyCtxt};
use rustc::hir;
use rustc::hir::def_id::DefId;
use rustc_target::spec::abi;
@ -16,7 +16,7 @@ use crate::generic_types;
use std::iter;
crate fn wf_clause_for_raw_ptr<'tcx>(
tcx: ty::TyCtxt<'_, '_, 'tcx>,
tcx: TyCtxt<'_, '_, 'tcx>,
mutbl: hir::Mutability
) -> Clauses<'tcx> {
let ptr_ty = generic_types::raw_ptr(tcx, mutbl);
@ -33,7 +33,7 @@ crate fn wf_clause_for_raw_ptr<'tcx>(
}
crate fn wf_clause_for_fn_ptr<'tcx>(
tcx: ty::TyCtxt<'_, '_, 'tcx>,
tcx: TyCtxt<'_, '_, 'tcx>,
arity_and_output: usize,
variadic: bool,
unsafety: hir::Unsafety,
@ -53,7 +53,7 @@ crate fn wf_clause_for_fn_ptr<'tcx>(
tcx.mk_clauses(iter::once(wf_clause))
}
crate fn wf_clause_for_slice<'tcx>(tcx: ty::TyCtxt<'_, '_, 'tcx>) -> Clauses<'tcx> {
crate fn wf_clause_for_slice<'tcx>(tcx: TyCtxt<'_, '_, 'tcx>) -> Clauses<'tcx> {
let ty = generic_types::bound(tcx, 0);
let slice_ty = tcx.mk_slice(ty);
@ -83,7 +83,7 @@ crate fn wf_clause_for_slice<'tcx>(tcx: ty::TyCtxt<'_, '_, 'tcx>) -> Clauses<'tc
}
crate fn wf_clause_for_array<'tcx>(
tcx: ty::TyCtxt<'_, '_, 'tcx>,
tcx: TyCtxt<'_, '_, 'tcx>,
length: &'tcx ty::Const<'tcx>
) -> Clauses<'tcx> {
let ty = generic_types::bound(tcx, 0);
@ -115,7 +115,7 @@ crate fn wf_clause_for_array<'tcx>(
}
crate fn wf_clause_for_tuple<'tcx>(
tcx: ty::TyCtxt<'_, '_, 'tcx>,
tcx: TyCtxt<'_, '_, 'tcx>,
arity: usize
) -> Clauses<'tcx> {
let type_list = generic_types::type_list(tcx, arity);
@ -159,7 +159,7 @@ crate fn wf_clause_for_tuple<'tcx>(
}
crate fn wf_clause_for_ref<'tcx>(
tcx: ty::TyCtxt<'_, '_, 'tcx>,
tcx: TyCtxt<'_, '_, 'tcx>,
mutbl: hir::Mutability
) -> Clauses<'tcx> {
let region = tcx.mk_region(
@ -186,7 +186,7 @@ crate fn wf_clause_for_ref<'tcx>(
}
crate fn wf_clause_for_fn_def<'tcx>(
tcx: ty::TyCtxt<'_, '_, 'tcx>,
tcx: TyCtxt<'_, '_, 'tcx>,
def_id: DefId
) -> Clauses<'tcx> {
let fn_def = generic_types::fn_def(tcx, def_id);

View file

@ -16,7 +16,7 @@ use rustc::traits::{
Environment,
InEnvironment,
};
use rustc::ty::{self, Ty};
use rustc::ty::{self, Ty, TyCtxt};
use rustc::ty::subst::Kind;
use rustc::ty::relate::{Relate, RelateResult, TypeRelation};
use syntax_pos::DUMMY_SP;
@ -169,7 +169,7 @@ impl AnswerSubstitutor<'cx, 'gcx, 'tcx> {
}
impl TypeRelation<'cx, 'gcx, 'tcx> for AnswerSubstitutor<'cx, 'gcx, 'tcx> {
fn tcx(&self) -> ty::TyCtxt<'cx, 'gcx, 'tcx> {
fn tcx(&self) -> TyCtxt<'cx, 'gcx, 'tcx> {
self.infcx.tcx
}

View file

@ -6,7 +6,7 @@ use rustc::hir;
use rustc::hir::def_id::DefId;
use rustc_target::spec::abi;
crate fn bound(tcx: ty::TyCtxt<'_, '_, 'tcx>, index: u32) -> Ty<'tcx> {
crate fn bound(tcx: TyCtxt<'_, '_, 'tcx>, index: u32) -> Ty<'tcx> {
let ty = ty::Bound(
ty::INNERMOST,
ty::BoundVar::from_u32(index).into()
@ -22,7 +22,7 @@ crate fn raw_ptr(tcx: TyCtxt<'_, '_, 'tcx>, mutbl: hir::Mutability) -> Ty<'tcx>
}
crate fn fn_ptr(
tcx: ty::TyCtxt<'_, '_, 'tcx>,
tcx: TyCtxt<'_, '_, 'tcx>,
arity_and_output: usize,
c_variadic: bool,
unsafety: hir::Unsafety,
@ -44,7 +44,7 @@ crate fn fn_ptr(
tcx.mk_fn_ptr(fn_sig)
}
crate fn type_list(tcx: ty::TyCtxt<'_, '_, 'tcx>, arity: usize) -> SubstsRef<'tcx> {
crate fn type_list(tcx: TyCtxt<'_, '_, 'tcx>, arity: usize) -> SubstsRef<'tcx> {
tcx.mk_substs(
(0..arity).into_iter()
.map(|i| ty::BoundVar::from(i))
@ -53,7 +53,7 @@ crate fn type_list(tcx: ty::TyCtxt<'_, '_, 'tcx>, arity: usize) -> SubstsRef<'tc
)
}
crate fn ref_ty(tcx: ty::TyCtxt<'_, '_, 'tcx>, mutbl: hir::Mutability) -> Ty<'tcx> {
crate fn ref_ty(tcx: TyCtxt<'_, '_, 'tcx>, mutbl: hir::Mutability) -> Ty<'tcx> {
let region = tcx.mk_region(
ty::ReLateBound(ty::INNERMOST, ty::BoundRegion::BrAnon(0))
);
@ -64,17 +64,17 @@ crate fn ref_ty(tcx: ty::TyCtxt<'_, '_, 'tcx>, mutbl: hir::Mutability) -> Ty<'tc
})
}
crate fn fn_def(tcx: ty::TyCtxt<'_, '_, 'tcx>, def_id: DefId) -> Ty<'tcx> {
crate fn fn_def(tcx: TyCtxt<'_, '_, 'tcx>, def_id: DefId) -> Ty<'tcx> {
tcx.mk_ty(ty::FnDef(def_id, InternalSubsts::bound_vars_for_item(tcx, def_id)))
}
crate fn closure(tcx: ty::TyCtxt<'_, '_, 'tcx>, def_id: DefId) -> Ty<'tcx> {
crate fn closure(tcx: TyCtxt<'_, '_, 'tcx>, def_id: DefId) -> Ty<'tcx> {
tcx.mk_closure(def_id, ty::ClosureSubsts {
substs: InternalSubsts::bound_vars_for_item(tcx, def_id),
})
}
crate fn generator(tcx: ty::TyCtxt<'_, '_, 'tcx>, def_id: DefId) -> Ty<'tcx> {
crate fn generator(tcx: TyCtxt<'_, '_, 'tcx>, def_id: DefId) -> Ty<'tcx> {
tcx.mk_generator(def_id, ty::GeneratorSubsts {
substs: InternalSubsts::bound_vars_for_item(tcx, def_id),
}, hir::GeneratorMovability::Movable)