Merge pull request #3902 from matthiaskrgr/rustup

rustup https://github.com/rust-lang/rust/pull/59096/
This commit is contained in:
Manish Goregaokar 2019-03-23 16:53:01 -07:00 committed by GitHub
commit 61aa5c957c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 11 additions and 20 deletions

View file

@ -256,8 +256,7 @@ impl<'a, 'tcx> Functions {
hir_id: hir::HirId,
) {
let expr = &body.value;
let node_id = cx.tcx.hir().hir_to_node_id(hir_id);
if unsafety == hir::Unsafety::Normal && cx.access_levels.is_exported(node_id) {
if unsafety == hir::Unsafety::Normal && cx.access_levels.is_exported(hir_id) {
let raw_ptrs = iter_input_pats(decl, body)
.zip(decl.inputs.iter())
.filter_map(|(arg, ty)| raw_ptr_arg(arg, ty))

View file

@ -148,9 +148,7 @@ fn check_trait_items(cx: &LateContext<'_, '_>, visited_trait: &Item, trait_items
}
}
let trait_node_id = cx.tcx.hir().hir_to_node_id(visited_trait.hir_id);
if cx.access_levels.is_exported(trait_node_id) && trait_items.iter().any(|i| is_named_self(cx, i, "len")) {
if cx.access_levels.is_exported(visited_trait.hir_id) && trait_items.iter().any(|i| is_named_self(cx, i, "len")) {
let mut current_and_super_traits = FxHashSet::default();
let visited_trait_def_id = cx.tcx.hir().local_def_id_from_hir_id(visited_trait.hir_id);
fill_trait_set(visited_trait_def_id, &mut current_and_super_traits, cx);
@ -193,10 +191,7 @@ fn check_impl_items(cx: &LateContext<'_, '_>, item: &Item, impl_items: &[ImplIte
}
let is_empty = if let Some(is_empty) = impl_items.iter().find(|i| is_named_self(cx, i, "is_empty")) {
if cx
.access_levels
.is_exported(cx.tcx.hir().hir_to_node_id(is_empty.id.hir_id))
{
if cx.access_levels.is_exported(is_empty.id.hir_id) {
return;
} else {
"a private"
@ -206,7 +201,7 @@ fn check_impl_items(cx: &LateContext<'_, '_>, item: &Item, impl_items: &[ImplIte
};
if let Some(i) = impl_items.iter().find(|i| is_named_self(cx, i, "len")) {
if cx.access_levels.is_exported(cx.tcx.hir().hir_to_node_id(i.id.hir_id)) {
if cx.access_levels.is_exported(i.id.hir_id) {
let def_id = cx.tcx.hir().local_def_id_from_hir_id(item.hir_id);
let ty = cx.tcx.type_of(def_id);

View file

@ -918,8 +918,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
if let Some(first_arg) = iter_input_pats(&sig.decl, cx.tcx.hir().body(id)).next();
if let hir::ItemKind::Impl(_, _, _, _, None, ref self_ty, _) = item.node;
then {
let node_id = cx.tcx.hir().hir_to_node_id(implitem.hir_id);
if cx.access_levels.is_exported(node_id) {
if cx.access_levels.is_exported(implitem.hir_id) {
// check missing trait implementations
for &(method_name, n_args, self_kind, out_type, trait_name) in &TRAIT_METHODS {
if name == method_name &&

View file

@ -95,7 +95,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingInline {
return;
}
if !cx.access_levels.is_exported(cx.tcx.hir().hir_to_node_id(it.hir_id)) {
if !cx.access_levels.is_exported(it.hir_id) {
return;
}
match it.node {
@ -146,8 +146,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingInline {
}
// If the item being implemented is not exported, then we don't need #[inline]
let node_id = cx.tcx.hir().hir_to_node_id(impl_item.hir_id);
if !cx.access_levels.is_exported(node_id) {
if !cx.access_levels.is_exported(impl_item.hir_id) {
return;
}
@ -163,8 +162,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingInline {
};
if let Some(trait_def_id) = trait_def_id {
if let Some(n) = cx.tcx.hir().as_local_node_id(trait_def_id) {
if !cx.access_levels.is_exported(n) {
if cx.tcx.hir().as_local_node_id(trait_def_id).is_some() {
if !cx.access_levels.is_exported(impl_item.hir_id) {
// If a trait is being implemented for an item, and the
// trait is not exported, we don't need #[inline]
return;

View file

@ -111,7 +111,6 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NewWithoutDefault {
if let hir::ImplItemKind::Method(ref sig, _) = impl_item.node {
let name = impl_item.ident.name;
let id = impl_item.hir_id;
let node_id = cx.tcx.hir().hir_to_node_id(id);
if sig.header.constness == hir::Constness::Const {
// can't be implemented by default
return;
@ -129,7 +128,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NewWithoutDefault {
// impl of `Default`
return;
}
if sig.decl.inputs.is_empty() && name == "new" && cx.access_levels.is_reachable(node_id) {
if sig.decl.inputs.is_empty() && name == "new" && cx.access_levels.is_reachable(id) {
let self_did = cx.tcx.hir().local_def_id_from_hir_id(cx.tcx.hir().get_parent_item(id));
let self_ty = cx.tcx.type_of(self_did);
if_chain! {

View file

@ -2075,7 +2075,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ImplicitHasher {
}
}
if !cx.access_levels.is_exported(cx.tcx.hir().hir_to_node_id(item.hir_id)) {
if !cx.access_levels.is_exported(item.hir_id) {
return;
}