Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 9 pull requests #59244

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
9aa89b2
When encountetring `||{}()`, suggest the likely intended `(||{})()`
estebank Mar 9, 2019
94a6936
Track embedded-book in the toolstate
kennytm Mar 9, 2019
135b686
Update src/tools/publish_toolstate.py
jamesmunns Mar 10, 2019
d6f5100
Fix tidy
kennytm Mar 10, 2019
8353487
refactor build-mainfest.
Centril Mar 7, 2019
7e1914f
hir: replace NodeId with HirId in trait_impls
ljedrz Mar 10, 2019
401329e
HirIdification: remove all NodeIds from borrowck
ljedrz Mar 10, 2019
aa53741
HirIdification: remove all NodeIds from typeck
ljedrz Mar 10, 2019
9151eab
HirIdification: remove all NodeIds from rustc_mir
ljedrz Mar 10, 2019
584d61a
hir: remove trait_auto_impl
ljedrz Mar 10, 2019
b9d12ed
Be more discerning on when to attempt suggesting a comma in a macro i…
estebank Mar 11, 2019
27abd52
Fix operator precedence
estebank Mar 13, 2019
856b081
middle: replace NodeId with HirId in AccessLevels
ljedrz Mar 11, 2019
4e5692d
test that wildcard type `_` is not duplicated by `type Foo<X> = (X, X…
pnkfelix Jan 18, 2019
a7bd36c
Add peer_addr function to UdpSocket
LinusU Mar 11, 2019
bf473e3
Mark UdpSocket peer_addr unstable w/ tracking issue
LinusU Mar 12, 2019
24e3fa0
Document UdpSocket peer_addr NotConnected error
LinusU Mar 12, 2019
7f7cfae
Add test for UdpSocket peer_addr
LinusU Mar 12, 2019
7e73cd4
Fix test names regarding ip version
LinusU Mar 12, 2019
214110b
Add UdpSocket peer_addr implementation for L4Re
LinusU Mar 16, 2019
81d5fb5
Add UdpSocket peer_addr implementation for Wasm
LinusU Mar 16, 2019
47ee538
resolve: Account for new importable entities
petrochenkov Mar 9, 2019
8c84630
Rollup merge of #57729 - pnkfelix:issue-55748-pat-types-are-constrain…
Centril Mar 16, 2019
bc7b660
Rollup merge of #58995 - Centril:refactor-build-manifest, r=alexcrichton
Centril Mar 16, 2019
5ae8b97
Rollup merge of #59035 - estebank:closure-instacall, r=davidtwco
Centril Mar 16, 2019
aa3ada8
Rollup merge of #59038 - kennytm:track-embedded-book, r=oli-obk
Centril Mar 16, 2019
657cb3f
Rollup merge of #59047 - petrochenkov:modnodefid, r=Centril
Centril Mar 16, 2019
cadb47c
Rollup merge of #59068 - ljedrz:kill_off_NodeId_stragglers, r=Zoxc
Centril Mar 16, 2019
f0cdccd
Rollup merge of #59096 - ljedrz:HirIdify_AccessLevel, r=Zoxc
Centril Mar 16, 2019
6656fe5
Rollup merge of #59106 - LinusU:udp-peer-addr, r=kennytm
Centril Mar 16, 2019
1729852
Rollup merge of #59116 - estebank:comma-sugg, r=petrochenkov
Centril Mar 16, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/ci/docker/x86_64-gnu-tools/checktools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ status_check() {
check_dispatch $1 beta clippy-driver src/tools/clippy
# these tools are not required for beta to successfully branch
check_dispatch $1 nightly miri src/tools/miri
check_dispatch $1 nightly embedded-book src/doc/embedded-book
}

# If this PR is intended to update one of these tools, do not let the build pass
Expand Down
9 changes: 4 additions & 5 deletions src/librustc/hir/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ pub struct LoweringContext<'a> {
bodies: BTreeMap<hir::BodyId, hir::Body>,
exported_macros: Vec<hir::MacroDef>,

trait_impls: BTreeMap<DefId, Vec<NodeId>>,
trait_auto_impl: BTreeMap<DefId, NodeId>,
trait_impls: BTreeMap<DefId, Vec<hir::HirId>>,

modules: BTreeMap<NodeId, hir::ModuleItems>,

Expand Down Expand Up @@ -233,7 +232,6 @@ pub fn lower_crate(
impl_items: BTreeMap::new(),
bodies: BTreeMap::new(),
trait_impls: BTreeMap::new(),
trait_auto_impl: BTreeMap::new(),
modules: BTreeMap::new(),
exported_macros: Vec::new(),
catch_scopes: Vec::new(),
Expand Down Expand Up @@ -514,7 +512,6 @@ impl<'a> LoweringContext<'a> {
bodies: self.bodies,
body_ids,
trait_impls: self.trait_impls,
trait_auto_impl: self.trait_auto_impl,
modules: self.modules,
}
}
Expand Down Expand Up @@ -2967,6 +2964,7 @@ impl<'a> LoweringContext<'a> {
// method, it will not be considered an in-band
// lifetime to be added, but rather a reference to a
// parent lifetime.
let lowered_trait_impl_id = self.lower_node_id(id).hir_id;
let (generics, (trait_ref, lowered_ty)) = self.add_in_band_defs(
ast_generics,
def_id,
Expand All @@ -2978,7 +2976,8 @@ impl<'a> LoweringContext<'a> {

if let Some(ref trait_ref) = trait_ref {
if let Def::Trait(def_id) = trait_ref.path.def {
this.trait_impls.entry(def_id).or_default().push(id);
this.trait_impls.entry(def_id).or_default().push(
lowered_trait_impl_id);
}
}

Expand Down
1 change: 0 additions & 1 deletion src/librustc/hir/map/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
impl_items: _,
bodies: _,
trait_impls: _,
trait_auto_impl: _,
body_ids: _,
modules: _,
} = *krate;
Expand Down
14 changes: 1 addition & 13 deletions src/librustc/hir/map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -557,26 +557,14 @@ impl<'hir> Map<'hir> {
}
}

pub fn trait_impls(&self, trait_did: DefId) -> &'hir [NodeId] {
pub fn trait_impls(&self, trait_did: DefId) -> &'hir [HirId] {
self.dep_graph.read(DepNode::new_no_params(DepKind::AllLocalTraitImpls));

// N.B., intentionally bypass `self.forest.krate()` so that we
// do not trigger a read of the whole krate here
self.forest.krate.trait_impls.get(&trait_did).map_or(&[], |xs| &xs[..])
}

pub fn trait_auto_impl(&self, trait_did: DefId) -> Option<NodeId> {
self.dep_graph.read(DepNode::new_no_params(DepKind::AllLocalTraitImpls));

// N.B., intentionally bypass `self.forest.krate()` so that we
// do not trigger a read of the whole krate here
self.forest.krate.trait_auto_impl.get(&trait_did).cloned()
}

pub fn trait_is_auto(&self, trait_did: DefId) -> bool {
self.trait_auto_impl(trait_did).is_some()
}

/// Gets the attributes on the crate. This is preferable to
/// invoking `krate.attrs` because it registers a tighter
/// dep-graph access.
Expand Down
3 changes: 1 addition & 2 deletions src/librustc/hir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -727,8 +727,7 @@ pub struct Crate {
pub trait_items: BTreeMap<TraitItemId, TraitItem>,
pub impl_items: BTreeMap<ImplItemId, ImplItem>,
pub bodies: BTreeMap<BodyId, Body>,
pub trait_impls: BTreeMap<DefId, Vec<NodeId>>,
pub trait_auto_impl: BTreeMap<DefId, NodeId>,
pub trait_impls: BTreeMap<DefId, Vec<HirId>>,

/// A list of the body ids written out in the order in which they
/// appear in the crate. If you're going to process all the bodies
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/dead.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ fn create_and_seed_worklist<'a, 'tcx>(
) -> (Vec<hir::HirId>, FxHashMap<hir::HirId, hir::HirId>) {
let worklist = access_levels.map.iter().filter_map(|(&id, level)| {
if level >= &privacy::AccessLevel::Reachable {
Some(tcx.hir().node_to_hir_id(id))
Some(id)
} else {
None
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/privacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
//! outside their scopes. This pass will also generate a set of exported items
//! which are available for use externally when compiled as a library.

use crate::hir::HirId;
use crate::util::nodemap::{DefIdSet, FxHashMap};

use std::hash::Hash;
use std::fmt;
use syntax::ast::NodeId;
use rustc_macros::HashStable;

// Accessibility levels, sorted in ascending order
Expand All @@ -27,7 +27,7 @@ pub enum AccessLevel {

// Accessibility levels for reachable HIR nodes
#[derive(Clone)]
pub struct AccessLevels<Id = NodeId> {
pub struct AccessLevels<Id = HirId> {
pub map: FxHashMap<Id, AccessLevel>
}

Expand Down
5 changes: 2 additions & 3 deletions src/librustc/middle/reachable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,7 @@ impl<'a, 'tcx: 'a> ItemLikeVisitor<'tcx> for CollectPrivateImplItemsVisitor<'a,

// We need only trait impls here, not inherent impls, and only non-exported ones
if let hir::ItemKind::Impl(.., Some(ref trait_ref), _, ref impl_item_refs) = item.node {
let node_id = self.tcx.hir().hir_to_node_id(item.hir_id);
if !self.access_levels.is_reachable(node_id) {
if !self.access_levels.is_reachable(item.hir_id) {
self.worklist.extend(impl_item_refs.iter().map(|ii_ref| ii_ref.id.hir_id));

let trait_def_id = match trait_ref.path.def {
Expand Down Expand Up @@ -415,7 +414,7 @@ fn reachable_set<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, crate_num: CrateNum) ->
// use the lang items, so we need to be sure to mark them as
// exported.
reachable_context.worklist.extend(
access_levels.map.iter().map(|(id, _)| tcx.hir().node_to_hir_id(*id)));
access_levels.map.iter().map(|(id, _)| *id));
for item in tcx.lang_items().items().iter() {
if let Some(did) = *item {
if let Some(hir_id) = tcx.hir().as_local_hir_id(did) {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ impl<'a, 'tcx: 'a> MissingStabilityAnnotations<'a, 'tcx> {
let stab = self.tcx.stability().local_stability(hir_id);
let is_error = !self.tcx.sess.opts.test &&
stab.is_none() &&
self.access_levels.is_reachable(self.tcx.hir().hir_to_node_id(hir_id));
self.access_levels.is_reachable(hir_id);
if is_error {
self.tcx.sess.span_err(
span,
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/ty/trait_def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ pub(super) fn trait_impls_of_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
}
}

for &node_id in tcx.hir().trait_impls(trait_id) {
add_impl(tcx.hir().local_def_id(node_id));
for &hir_id in tcx.hir().trait_impls(trait_id) {
add_impl(tcx.hir().local_def_id_from_hir_id(hir_id));
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/librustc_borrowck/borrowck/gather_loans/lifetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
//! does not exceed the lifetime of the value being borrowed.

use crate::borrowck::*;
use rustc::hir::HirId;
use rustc::middle::expr_use_visitor as euv;
use rustc::middle::mem_categorization as mc;
use rustc::middle::mem_categorization::Categorization;
use rustc::middle::region;
use rustc::ty;

use syntax::ast;
use syntax_pos::Span;
use log::debug;

Expand Down Expand Up @@ -51,7 +51,7 @@ struct GuaranteeLifetimeContext<'a, 'tcx: 'a> {
}

impl<'a, 'tcx> GuaranteeLifetimeContext<'a, 'tcx> {
fn check(&self, cmt: &mc::cmt_<'tcx>, discr_scope: Option<ast::NodeId>) -> R {
fn check(&self, cmt: &mc::cmt_<'tcx>, discr_scope: Option<HirId>) -> R {
//! Main routine. Walks down `cmt` until we find the
//! "guarantor". Reports an error if `self.loan_region` is
//! larger than scope of `cmt`.
Expand Down
9 changes: 3 additions & 6 deletions src/librustc_borrowck/borrowck/gather_loans/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use rustc::middle::mem_categorization::Categorization;
use rustc::middle::region;
use rustc::ty::{self, TyCtxt};

use syntax::ast;
use syntax_pos::Span;
use rustc::hir;
use log::debug;
Expand Down Expand Up @@ -141,8 +140,7 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for GatherLoanCtxt<'a, 'tcx> {
assignee_cmt: &mc::cmt_<'tcx>,
_: euv::MutateMode)
{
let node_id = self.bccx.tcx.hir().hir_to_node_id(assignment_id);
self.guarantee_assignment_valid(node_id,
self.guarantee_assignment_valid(assignment_id,
assignment_span,
assignee_cmt);
}
Expand Down Expand Up @@ -256,7 +254,7 @@ impl<'a, 'tcx> GatherLoanCtxt<'a, 'tcx> {

/// Guarantees that `cmt` is assignable, or reports an error.
fn guarantee_assignment_valid(&mut self,
assignment_id: ast::NodeId,
assignment_id: hir::HirId,
assignment_span: Span,
cmt: &mc::cmt_<'tcx>) {

Expand Down Expand Up @@ -290,8 +288,7 @@ impl<'a, 'tcx> GatherLoanCtxt<'a, 'tcx> {
self.mark_loan_path_as_mutated(&lp);
}
gather_moves::gather_assignment(self.bccx, &self.move_data,
self.bccx.tcx.hir().node_to_hir_id(assignment_id)
.local_id,
assignment_id.local_id,
assignment_span,
lp);
}
Expand Down
8 changes: 3 additions & 5 deletions src/librustc_borrowck/borrowck/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ use std::fmt;
use std::rc::Rc;
use rustc_data_structures::sync::Lrc;
use std::hash::{Hash, Hasher};
use syntax::ast;
use syntax_pos::{MultiSpan, Span};
use errors::{Applicability, DiagnosticBuilder, DiagnosticId};
use log::debug;
Expand Down Expand Up @@ -399,12 +398,12 @@ pub enum LoanPathElem<'tcx> {
}

fn closure_to_block(closure_id: LocalDefId,
tcx: TyCtxt<'_, '_, '_>) -> ast::NodeId {
tcx: TyCtxt<'_, '_, '_>) -> HirId {
let closure_id = tcx.hir().local_def_id_to_node_id(closure_id);
match tcx.hir().get(closure_id) {
Node::Expr(expr) => match expr.node {
hir::ExprKind::Closure(.., body_id, _, _) => {
tcx.hir().hir_to_node_id(body_id.hir_id)
body_id.hir_id
}
_ => {
bug!("encountered non-closure id: {}", closure_id)
Expand All @@ -422,8 +421,7 @@ impl<'a, 'tcx> LoanPath<'tcx> {
}
LpUpvar(upvar_id) => {
let block_id = closure_to_block(upvar_id.closure_expr_id, bccx.tcx);
let hir_id = bccx.tcx.hir().node_to_hir_id(block_id);
region::Scope { id: hir_id.local_id, data: region::ScopeData::Node }
region::Scope { id: block_id.local_id, data: region::ScopeData::Node }
}
LpDowncast(ref base, _) |
LpExtend(ref base, ..) => base.kill_scope(bccx),
Expand Down
12 changes: 4 additions & 8 deletions src/librustc_lint/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,7 @@ impl MissingDoc {
// It's an option so the crate root can also use this function (it doesn't
// have a NodeId).
if let Some(id) = id {
let node_id = cx.tcx.hir().hir_to_node_id(id);
if !cx.access_levels.is_exported(node_id) {
if !cx.access_levels.is_exported(id) {
return;
}
}
Expand Down Expand Up @@ -557,8 +556,7 @@ impl LintPass for MissingCopyImplementations {

impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingCopyImplementations {
fn check_item(&mut self, cx: &LateContext<'_, '_>, item: &hir::Item) {
let node_id = cx.tcx.hir().hir_to_node_id(item.hir_id);
if !cx.access_levels.is_reachable(node_id) {
if !cx.access_levels.is_reachable(item.hir_id) {
return;
}
let (def, ty) = match item.node {
Expand Down Expand Up @@ -629,8 +627,7 @@ impl LintPass for MissingDebugImplementations {

impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDebugImplementations {
fn check_item(&mut self, cx: &LateContext<'_, '_>, item: &hir::Item) {
let node_id = cx.tcx.hir().hir_to_node_id(item.hir_id);
if !cx.access_levels.is_reachable(node_id) {
if !cx.access_levels.is_reachable(item.hir_id) {
return;
}

Expand Down Expand Up @@ -1169,9 +1166,8 @@ impl UnreachablePub {
fn perform_lint(&self, cx: &LateContext<'_, '_>, what: &str, id: hir::HirId,
vis: &hir::Visibility, span: Span, exportable: bool) {
let mut applicability = Applicability::MachineApplicable;
let node_id = cx.tcx.hir().hir_to_node_id(id);
match vis.node {
hir::VisibilityKind::Public if !cx.access_levels.is_reachable(node_id) => {
hir::VisibilityKind::Public if !cx.access_levels.is_reachable(id) => {
if span.ctxt().outer().expn_info().is_some() {
applicability = Applicability::MaybeIncorrect;
}
Expand Down
8 changes: 2 additions & 6 deletions src/librustc_mir/borrow_check/nll/universal_regions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use rustc::util::nodemap::FxHashMap;
use rustc_data_structures::indexed_vec::{Idx, IndexVec};
use rustc_errors::DiagnosticBuilder;
use std::iter;
use syntax::ast;

use super::ToRegionVid;

Expand Down Expand Up @@ -200,12 +199,10 @@ impl<'tcx> UniversalRegions<'tcx> {
param_env: ty::ParamEnv<'tcx>,
) -> Self {
let tcx = infcx.tcx;
let mir_node_id = tcx.hir().as_local_node_id(mir_def_id).unwrap();
let mir_hir_id = tcx.hir().node_to_hir_id(mir_node_id);
let mir_hir_id = tcx.hir().as_local_hir_id(mir_def_id).unwrap();
UniversalRegionsBuilder {
infcx,
mir_def_id,
mir_node_id,
mir_hir_id,
param_env,
}.build()
Expand Down Expand Up @@ -370,7 +367,6 @@ struct UniversalRegionsBuilder<'cx, 'gcx: 'tcx, 'tcx: 'cx> {
infcx: &'cx InferCtxt<'cx, 'gcx, 'tcx>,
mir_def_id: DefId,
mir_hir_id: HirId,
mir_node_id: ast::NodeId,
param_env: ty::ParamEnv<'tcx>,
}

Expand Down Expand Up @@ -475,7 +471,7 @@ impl<'cx, 'gcx, 'tcx> UniversalRegionsBuilder<'cx, 'gcx, 'tcx> {
let tcx = self.infcx.tcx;
let closure_base_def_id = tcx.closure_base_def_id(self.mir_def_id);

match tcx.hir().body_owner_kind(self.mir_node_id) {
match tcx.hir().body_owner_kind_by_hir_id(self.mir_hir_id) {
BodyOwnerKind::Closure |
BodyOwnerKind::Fn => {
let defining_ty = if self.mir_def_id == closure_base_def_id {
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_mir/build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ struct Builder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
/// finish building it.
guard_context: Vec<GuardFrame>,

/// Maps `NodeId`s of variable bindings to the `Local`s created for them.
/// Maps `HirId`s of variable bindings to the `Local`s created for them.
/// (A match binding can have two locals; the 2nd is for the arm's guard.)
var_indices: HirIdMap<LocalsForNode>,
local_decls: IndexVec<Local, LocalDecl<'tcx>>,
Expand Down Expand Up @@ -451,7 +451,7 @@ impl BlockContext {

#[derive(Debug)]
enum LocalsForNode {
/// In the usual case, a `NodeId` for an identifier maps to at most
/// In the usual case, a `HirId` for an identifier maps to at most
/// one `Local` declaration.
One(Local),

Expand Down
Loading