Skip to content

Commit

Permalink
Upgrade to rustc 1.39.0-nightly (521d78407 2019-08-25)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonSapin committed Aug 26, 2019
1 parent 66e5ad0 commit e18846a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 27 deletions.
22 changes: 7 additions & 15 deletions components/script_plugins/unrooted_must_root.rs
Expand Up @@ -7,8 +7,8 @@ use rustc::hir::intravisit as visit;
use rustc::hir::{self, ExprKind, HirId};
use rustc::lint::{LateContext, LateLintPass, LintArray, LintContext, LintPass};
use rustc::ty;
use syntax::source_map;
use syntax::symbol::sym;
use syntax::{ast, source_map};

declare_lint!(
UNROOTED_MUST_ROOT,
Expand Down Expand Up @@ -143,23 +143,15 @@ impl LintPass for UnrootedPass {

impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnrootedPass {
/// All structs containing #[must_root] types must be #[must_root] themselves
fn check_struct_def(
&mut self,
cx: &LateContext<'a, 'tcx>,
def: &'tcx hir::VariantData,
_n: ast::Name,
_gen: &'tcx hir::Generics,
id: HirId,
) {
let item = match cx.tcx.hir().get(id) {
hir::Node::Item(item) => item,
_ => cx.tcx.hir().expect_item(cx.tcx.hir().get_parent_item(id)),
};
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Item) {
if item
.attrs
.iter()
.all(|a| !a.check_name(self.symbols.must_root))
.any(|a| a.check_name(self.symbols.must_root))
{
return;
}
if let hir::ItemKind::Struct(def, ..) = &item.node {
for ref field in def.fields() {
let def_id = cx.tcx.hir().local_def_id(field.hir_id);
if is_unrooted_ty(&self.symbols, cx, cx.tcx.type_of(def_id), false) {
Expand All @@ -171,7 +163,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnrootedPass {
}

/// All enums containing #[must_root] types must be #[must_root] themselves
fn check_variant(&mut self, cx: &LateContext, var: &hir::Variant, _gen: &hir::Generics) {
fn check_variant(&mut self, cx: &LateContext, var: &hir::Variant) {
let ref map = cx.tcx.hir();
if map
.expect_item(map.get_parent_item(var.id))
Expand Down
19 changes: 8 additions & 11 deletions components/script_plugins/webidl_must_inherit.rs
Expand Up @@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */

use rustc::hir::{self, HirId};
use rustc::hir;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintContext, LintPass};
use rustc::ty;
use std::boxed;
Expand All @@ -12,7 +12,6 @@ use std::fmt;
use std::fs;
use std::io;
use std::path;
use syntax::ast;
use weedle;

declare_lint!(
Expand Down Expand Up @@ -177,14 +176,12 @@ impl LintPass for WebIdlPass {
}

impl<'a, 'tcx> LateLintPass<'a, 'tcx> for WebIdlPass {
fn check_struct_def(
&mut self,
cx: &LateContext<'a, 'tcx>,
def: &'tcx hir::VariantData,
n: ast::Name,
_gen: &'tcx hir::Generics,
id: HirId,
) {
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Item) {
let def = match &item.node {
hir::ItemKind::Struct(def, ..) => def,
_ => return,
};
let id = item.hir_id;
let def_id = cx.tcx.hir().local_def_id(id);
if !is_webidl_ty(&self.symbols, cx, cx.tcx.type_of(def_id)) {
return;
Expand All @@ -201,7 +198,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for WebIdlPass {
get_ty_name(&ty).to_string()
});

let struct_name = n.to_string();
let struct_name = item.ident.to_string();
match check_webidl(&struct_name, &parent_name) {
Ok(()) => {},
Err(e) => {
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
@@ -1 +1 @@
nightly-2019-08-24
nightly-2019-08-26

0 comments on commit e18846a

Please sign in to comment.