diff options
author | Josh Matthews <josh@joshmatthews.net> | 2021-03-12 17:23:09 -0500 |
---|---|---|
committer | Josh Matthews <josh@joshmatthews.net> | 2021-03-14 13:24:21 -0400 |
commit | 129c5837998e1c7a71a03a06f87516c7b2fbbcb0 (patch) | |
tree | 064ed0b2c12b412f1aeea1d1c52e951c3b1ec18e /components/script_plugins/lib.rs | |
parent | 2985d48b773c25910b20f6201e99ed2240a46a55 (diff) | |
download | servo-129c5837998e1c7a71a03a06f87516c7b2fbbcb0.tar.gz servo-129c5837998e1c7a71a03a06f87516c7b2fbbcb0.zip |
Update to 3/12 rustc nightly.
Diffstat (limited to 'components/script_plugins/lib.rs')
-rw-r--r-- | components/script_plugins/lib.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/components/script_plugins/lib.rs b/components/script_plugins/lib.rs index 211b6117781..926c5a04b03 100644 --- a/components/script_plugins/lib.rs +++ b/components/script_plugins/lib.rs @@ -210,7 +210,8 @@ impl<'tcx> LateLintPass<'tcx> for UnrootedPass { /// All structs containing #[unrooted_must_root_lint::must_root] types /// must be #[unrooted_must_root_lint::must_root] themselves fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::Item) { - if has_lint_attr(&self.symbols, &item.attrs, self.symbols.must_root) { + let attrs = cx.tcx.hir().attrs(item.hir_id()); + if has_lint_attr(&self.symbols, &attrs, self.symbols.must_root) { return; } if let hir::ItemKind::Struct(def, ..) = &item.kind { @@ -235,7 +236,8 @@ impl<'tcx> LateLintPass<'tcx> for UnrootedPass { fn check_variant(&mut self, cx: &LateContext, var: &hir::Variant) { let ref map = cx.tcx.hir(); let parent_item = map.expect_item(map.get_parent_item(var.id)); - if !has_lint_attr(&self.symbols, &parent_item.attrs, self.symbols.must_root) { + let attrs = cx.tcx.hir().attrs(parent_item.hir_id()); + if !has_lint_attr(&self.symbols, &attrs, self.symbols.must_root) { match var.data { hir::VariantData::Tuple(fields, ..) => { for field in fields { @@ -268,10 +270,10 @@ impl<'tcx> LateLintPass<'tcx> for UnrootedPass { id: HirId, ) { let in_new_function = match kind { - visit::FnKind::ItemFn(n, _, _, _, _) | visit::FnKind::Method(n, _, _, _) => { + visit::FnKind::ItemFn(n, _, _, _) | visit::FnKind::Method(n, _, _) => { &*n.as_str() == "new" || n.as_str().starts_with("new_") }, - visit::FnKind::Closure(_) => return, + visit::FnKind::Closure => return, }; if !in_derive_expn(span) { |