diff options
author | Simon Sapin <simon.sapin@exyr.org> | 2020-04-08 14:57:42 +0200 |
---|---|---|
committer | Simon Sapin <simon.sapin@exyr.org> | 2020-04-09 21:33:44 +0200 |
commit | 1c0549ce7fd748511d6200e622eddf800b3e9ca4 (patch) | |
tree | 38d850f2f0e185c7e652122fa7b080374999c205 /components/script_plugins/lib.rs | |
parent | 4227425c1e6374857b3d881a1d3963be27141576 (diff) | |
download | servo-1c0549ce7fd748511d6200e622eddf800b3e9ca4.tar.gz servo-1c0549ce7fd748511d6200e622eddf800b3e9ca4.zip |
Upgrade to rustc 1.44.0-nightly (42abbd887 2020-04-07)
Diffstat (limited to 'components/script_plugins/lib.rs')
-rw-r--r-- | components/script_plugins/lib.rs | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/components/script_plugins/lib.rs b/components/script_plugins/lib.rs index 0db4b5a5527..8de2a85a47c 100644 --- a/components/script_plugins/lib.rs +++ b/components/script_plugins/lib.rs @@ -101,8 +101,16 @@ fn has_lint_attr(sym: &Symbols, attrs: &[Attribute], name: Symbol) -> bool { /// Checks if a type is unrooted or contains any owned unrooted types fn is_unrooted_ty(sym: &Symbols, cx: &LateContext, ty: &ty::TyS, in_new_function: bool) -> bool { let mut ret = false; - ty.maybe_walk(|t| { - match t.kind { + let mut walker = ty.walk(); + while let Some(generic_arg) = walker.next() { + let t = match generic_arg.unpack() { + rustc_middle::ty::subst::GenericArgKind::Type(t) => t, + _ => { + walker.skip_current_subtree(); + continue; + }, + }; + let recur_into_subtree = match t.kind { ty::Adt(did, substs) => { let has_attr = |did, name| has_lint_attr(sym, &cx.tcx.get_attrs(did), name); if has_attr(did.did, sym.must_root) { @@ -180,8 +188,11 @@ fn is_unrooted_ty(sym: &Symbols, cx: &LateContext, ty: &ty::TyS, in_new_function ty::FnDef(..) | ty::FnPtr(_) => false, _ => true, + }; + if !recur_into_subtree { + walker.skip_current_subtree(); } - }); + } ret } |