Address minor comments
This commit is contained in:
parent
bfc3b20663
commit
11adc1300c
6 changed files with 12 additions and 26 deletions
|
|
@ -931,7 +931,7 @@ impl<'a, 'gcx, 'tcx> Generics {
|
|||
pub fn requires_monomorphization(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> bool {
|
||||
for param in &self.params {
|
||||
match param.kind {
|
||||
GenericParamDefKind::Type {..} => return true,
|
||||
GenericParamDefKind::Type { .. } => return true,
|
||||
GenericParamDefKind::Lifetime => {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -231,7 +231,6 @@ impl<'a, 'gcx, 'tcx> Substs<'tcx> {
|
|||
mk_kind: &mut F)
|
||||
where F: FnMut(&ty::GenericParamDef, &[Kind<'tcx>]) -> Kind<'tcx>
|
||||
{
|
||||
|
||||
if let Some(def_id) = defs.parent {
|
||||
let parent_defs = tcx.generics_of(def_id);
|
||||
Substs::fill_item(substs, tcx, parent_defs, mk_kind);
|
||||
|
|
|
|||
|
|
@ -819,14 +819,6 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for VariantSizeDifferences {
|
|||
fn check_item(&mut self, cx: &LateContext, it: &hir::Item) {
|
||||
if let hir::ItemKind::Enum(ref enum_definition, _) = it.node {
|
||||
let item_def_id = cx.tcx.hir.local_def_id(it.id);
|
||||
let generics = cx.tcx.generics_of(item_def_id);
|
||||
for param in &generics.params {
|
||||
match param.kind {
|
||||
ty::GenericParamDefKind::Lifetime { .. } => {},
|
||||
ty::GenericParamDefKind::Type { .. } => return,
|
||||
}
|
||||
}
|
||||
// Sizes only make sense for non-generic types.
|
||||
let t = cx.tcx.type_of(item_def_id);
|
||||
let ty = cx.tcx.erase_regions(&t);
|
||||
match cx.layout_of(ty) {
|
||||
|
|
|
|||
|
|
@ -539,10 +539,7 @@ impl<'a> Visitor<'a> for NestedImplTraitVisitor<'a> {
|
|||
fn visit_generic_args(&mut self, _: Span, generic_args: &'a GenericArgs) {
|
||||
match *generic_args {
|
||||
GenericArgs::AngleBracketed(ref data) => {
|
||||
data.args.iter().for_each(|arg| match arg {
|
||||
GenericArg::Type(ty) => self.visit_ty(ty),
|
||||
_ => {}
|
||||
});
|
||||
data.args.iter().for_each(|arg| self.visit_generic_arg(arg));
|
||||
for type_binding in &data.bindings {
|
||||
// Type bindings such as `Item=impl Debug` in `Iterator<Item=Debug>`
|
||||
// are allowed to contain nested `impl Trait`.
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ extern crate rustc_typeck;
|
|||
extern crate syntax_pos;
|
||||
extern crate rustc_data_structures;
|
||||
|
||||
use rustc::hir::{self, GenericParamKind, PatKind};
|
||||
use rustc::hir::{self, PatKind};
|
||||
use rustc::hir::def::Def;
|
||||
use rustc::hir::def_id::{CRATE_DEF_INDEX, LOCAL_CRATE, CrateNum, DefId};
|
||||
use rustc::hir::intravisit::{self, Visitor, NestedVisitorMap};
|
||||
|
|
@ -1270,14 +1270,11 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {
|
|||
}
|
||||
|
||||
fn visit_generics(&mut self, generics: &'tcx hir::Generics) {
|
||||
generics.params.iter().for_each(|param| match param.kind {
|
||||
GenericParamKind::Lifetime { .. } => {}
|
||||
GenericParamKind::Type { .. } => {
|
||||
for bound in ¶m.bounds {
|
||||
self.check_generic_bound(bound);
|
||||
}
|
||||
for param in &generics.params {
|
||||
for bound in ¶m.bounds {
|
||||
self.check_generic_bound(bound);
|
||||
}
|
||||
});
|
||||
}
|
||||
for predicate in &generics.where_clause.predicates {
|
||||
match predicate {
|
||||
&hir::WherePredicate::BoundPredicate(ref bound_pred) => {
|
||||
|
|
|
|||
|
|
@ -822,11 +822,12 @@ impl<'a, 'tcx, 'cl> Visitor<'tcx> for Resolver<'a, 'cl> {
|
|||
.filter_map(|param| match param.kind {
|
||||
GenericParamKind::Lifetime { .. } => None,
|
||||
GenericParamKind::Type { ref default, .. } => {
|
||||
if found_default || default.is_some() {
|
||||
found_default = true;
|
||||
return Some((Ident::with_empty_ctxt(param.ident.name), Def::Err));
|
||||
found_default |= default.is_some();
|
||||
if found_default {
|
||||
Some((Ident::with_empty_ctxt(param.ident.name), Def::Err));
|
||||
} else {
|
||||
None
|
||||
}
|
||||
None
|
||||
}
|
||||
}));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue