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 5 pull requests #71603

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
0fc9d39
Minimize parameter of coerce_borrowed_pointer()
ldm0 Apr 24, 2020
169c399
Use `LocalDefId` in `typeck_tables_of` and `used_trait_imports` queries
marmeladema Apr 17, 2020
afe4b1b
Use `LocalDefId` in `unsafety_check_result` query
marmeladema Apr 17, 2020
d9e286b
Use `LocalDefId` in `mir_built` query
marmeladema Apr 17, 2020
f27cec9
Use `LocalDefId` for `type_param_predicates` query
marmeladema Apr 17, 2020
efe30de
Accept `LocalDefId` as keyt for `names_imported_by_glob_use`
marmeladema Apr 18, 2020
6a5b281
Return a `FxHashSet<LocalDefId>` from `mir_keys` query
marmeladema Apr 18, 2020
28e3022
Accept `LocalDefId` as key for `mir_borrowck` query
marmeladema Apr 18, 2020
58ba925
Accept `LocalDefId` as key for `mir_validated` query
marmeladema Apr 18, 2020
283de4f
Accept `LocalDefId` as argument for `mir_build::lint::check`
marmeladema Apr 18, 2020
df05e10
Accept `LocalDefId` as key for `lint_mod` query
marmeladema Apr 18, 2020
2286364
Accept `LocalDefId` as key for `check_mod_privacy` query
marmeladema Apr 18, 2020
d826fb0
Declare `body_owner` as `LocalDefId` in `MemCategorizationContext`
marmeladema Apr 18, 2020
eb866d0
Declare `body_owner` as `LocalDefId` in `RegionCtxt`
marmeladema Apr 18, 2020
f2a1338
Change return type of `entry_fn` query to return a `LocalDefId`
marmeladema Apr 18, 2020
a9214a9
Accept `LocalDefId` as key for `check_item_well_formed` query
marmeladema Apr 18, 2020
1c56ff3
Accept `LocalDefId` as key for `check_trait_item_well_formed` query
marmeladema Apr 18, 2020
90639e2
Accept `LocalDefId` as key for `check_impl_item_well_formed` query
marmeladema Apr 18, 2020
5a5fa39
Handle build completion message from Cargo
Mark-Simulacrum Apr 25, 2020
3a6fa99
linkchecker: fix typo in main.rs
ryzokuken Apr 26, 2020
efb6d6c
Fix broken link in `QPath` documentation
LeSeulArtichaut Apr 26, 2020
b893ad0
Rollup merge of #71292 - marmeladema:queries-local-def-id, r=eddyb
Dylan-DPC Apr 27, 2020
9cb7f25
Rollup merge of #71524 - ldm0:ptrparam, r=matthewjasper
Dylan-DPC Apr 27, 2020
76a51c0
Rollup merge of #71567 - Mark-Simulacrum:no-success, r=matthiaskrgr
Dylan-DPC Apr 27, 2020
e4837a5
Rollup merge of #71578 - ryzokuken:linkchecker, r=Dylan-DPC
Dylan-DPC Apr 27, 2020
df54124
Rollup merge of #71596 - LeSeulArtichaut:patch-1, r=Dylan-DPC
Dylan-DPC Apr 27, 2020
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
3 changes: 3 additions & 0 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1012,4 +1012,7 @@ pub enum CargoMessage<'a> {
BuildScriptExecuted {
package_id: Cow<'a, str>,
},
BuildFinished {
success: bool,
},
}
7 changes: 5 additions & 2 deletions src/librustc_builtin_macros/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,9 @@ impl<'a, 'b> Context<'a, 'b> {
.iter()
.filter(|fmt| fmt.precision_span.is_some())
.count();
e.span_label(span, &format!(
e.span_label(
span,
&format!(
"this precision flag adds an extra required argument at position {}, \
which is why there {} expected",
pos,
Expand All @@ -419,7 +421,8 @@ impl<'a, 'b> Context<'a, 'b> {
} else {
format!("are {} arguments", count)
},
));
),
);
if let Some(arg) = self.args.get(pos) {
e.span_label(
arg.span,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_codegen_llvm/debuginfo/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
spflags |= DISPFlags::SPFlagOptimized;
}
if let Some((id, _)) = self.tcx.entry_fn(LOCAL_CRATE) {
if id == def_id {
if id.to_def_id() == def_id {
spflags |= DISPFlags::SPFlagMainSubprogram;
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_codegen_ssa/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::profiling::print_time_passes_entry;
use rustc_data_structures::sync::{par_iter, Lock, ParallelIterator};
use rustc_hir as hir;
use rustc_hir::def_id::{DefId, LOCAL_CRATE};
use rustc_hir::def_id::{LocalDefId, LOCAL_CRATE};
use rustc_hir::lang_items::StartFnLangItem;
use rustc_index::vec::Idx;
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrs;
Expand Down Expand Up @@ -397,7 +397,7 @@ pub fn maybe_create_entry_wrapper<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
None => return None,
};

let instance = Instance::mono(cx.tcx(), main_def_id);
let instance = Instance::mono(cx.tcx(), main_def_id.to_def_id());

if !cx.codegen_unit().contains_item(&MonoItem::Fn(instance)) {
// We want to create the wrapper in the same codegen unit as Rust's main
Expand All @@ -416,7 +416,7 @@ pub fn maybe_create_entry_wrapper<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
cx: &'a Bx::CodegenCx,
sp: Span,
rust_main: Bx::Value,
rust_main_def_id: DefId,
rust_main_def_id: LocalDefId,
use_start_lang_item: bool,
) -> Bx::Function {
// The entry function is either `int main(void)` or `int main(int argc, char **argv)`,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_hir/hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1601,7 +1601,7 @@ pub enum ExprKind<'hir> {
///
/// To resolve the path to a `DefId`, call [`qpath_res`].
///
/// [`qpath_res`]: ../ty/struct.TypeckTables.html#method.qpath_res
/// [`qpath_res`]: ../rustc_middle/ty/struct.TypeckTables.html#method.qpath_res
#[derive(RustcEncodable, RustcDecodable, Debug, HashStable_Generic)]
pub enum QPath<'hir> {
/// Path to a definition, optionally "fully-qualified" with a `Self`
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_interface/passes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ fn analysis(tcx: TyCtxt<'_>, cnum: CrateNum) -> Result<()> {
});

sess.time("MIR_borrow_checking", || {
tcx.par_body_owners(|def_id| tcx.ensure().mir_borrowck(def_id.to_def_id()));
tcx.par_body_owners(|def_id| tcx.ensure().mir_borrowck(def_id));
});

sess.time("dumping_chalk_like_clauses", || {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_interface/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ impl<'tcx> Queries<'tcx> {
_ => return,
};

let attrs = &*tcx.get_attrs(def_id);
let attrs = &*tcx.get_attrs(def_id.to_def_id());
let attrs = attrs.iter().filter(|attr| attr.check_name(sym::rustc_error));
for attr in attrs {
match attr.meta_item_list() {
Expand Down
10 changes: 3 additions & 7 deletions src/librustc_lint/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ mod unused;

use rustc_ast::ast;
use rustc_hir as hir;
use rustc_hir::def_id::DefId;
use rustc_hir::def_id::LocalDefId;
use rustc_middle::ty::query::Providers;
use rustc_middle::ty::TyCtxt;
use rustc_session::lint::builtin::{
Expand Down Expand Up @@ -90,12 +90,8 @@ pub fn provide(providers: &mut Providers<'_>) {
*providers = Providers { lint_mod, ..*providers };
}

fn lint_mod(tcx: TyCtxt<'_>, module_def_id: DefId) {
late::late_lint_mod(
tcx,
module_def_id.expect_local(),
BuiltinCombinedModuleLateLintPass::new(),
);
fn lint_mod(tcx: TyCtxt<'_>, module_def_id: LocalDefId) {
late::late_lint_mod(tcx, module_def_id, BuiltinCombinedModuleLateLintPass::new());
}

macro_rules! pre_expansion_lint_passes {
Expand Down
66 changes: 31 additions & 35 deletions src/librustc_metadata/rmeta/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ use log::{debug, trace};
use rustc_ast::ast::{self, Ident};
use rustc_ast::attr;
use rustc_data_structures::fingerprint::Fingerprint;
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_data_structures::stable_hasher::StableHasher;
use rustc_data_structures::sync::{join, Lrc};
use rustc_hir as hir;
use rustc_hir::def::CtorKind;
use rustc_hir::def_id::DefIdSet;
use rustc_hir::def_id::{CrateNum, DefId, DefIndex, LocalDefId, CRATE_DEF_INDEX, LOCAL_CRATE};
use rustc_hir::definitions::DefPathTable;
use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
Expand Down Expand Up @@ -644,8 +643,8 @@ impl EncodeContext<'tcx> {
self.encode_generics(def_id);
self.encode_explicit_predicates(def_id);
self.encode_inferred_outlives(def_id);
self.encode_optimized_mir(def_id);
self.encode_promoted_mir(def_id);
self.encode_optimized_mir(def_id.expect_local());
self.encode_promoted_mir(def_id.expect_local());
}

fn encode_enum_variant_ctor(&mut self, def: &ty::AdtDef, index: VariantIdx) {
Expand Down Expand Up @@ -683,8 +682,8 @@ impl EncodeContext<'tcx> {
self.encode_generics(def_id);
self.encode_explicit_predicates(def_id);
self.encode_inferred_outlives(def_id);
self.encode_optimized_mir(def_id);
self.encode_promoted_mir(def_id);
self.encode_optimized_mir(def_id.expect_local());
self.encode_promoted_mir(def_id.expect_local());
}

fn encode_info_for_mod(
Expand Down Expand Up @@ -786,8 +785,8 @@ impl EncodeContext<'tcx> {
self.encode_generics(def_id);
self.encode_explicit_predicates(def_id);
self.encode_inferred_outlives(def_id);
self.encode_optimized_mir(def_id);
self.encode_promoted_mir(def_id);
self.encode_optimized_mir(def_id.expect_local());
self.encode_promoted_mir(def_id.expect_local());
}

fn encode_generics(&mut self, def_id: DefId) {
Expand Down Expand Up @@ -896,8 +895,8 @@ impl EncodeContext<'tcx> {
self.encode_inferred_outlives(def_id);

// This should be kept in sync with `PrefetchVisitor.visit_trait_item`.
self.encode_optimized_mir(def_id);
self.encode_promoted_mir(def_id);
self.encode_optimized_mir(def_id.expect_local());
self.encode_promoted_mir(def_id.expect_local());
}

fn metadata_output_only(&self) -> bool {
Expand Down Expand Up @@ -985,8 +984,8 @@ impl EncodeContext<'tcx> {
hir::ImplItemKind::OpaqueTy(..) | hir::ImplItemKind::TyAlias(..) => false,
};
if mir {
self.encode_optimized_mir(def_id);
self.encode_promoted_mir(def_id);
self.encode_optimized_mir(def_id.expect_local());
self.encode_promoted_mir(def_id.expect_local());
}
}

Expand All @@ -1004,17 +1003,17 @@ impl EncodeContext<'tcx> {
self.lazy(param_names.iter().map(|ident| ident.name))
}

fn encode_optimized_mir(&mut self, def_id: DefId) {
fn encode_optimized_mir(&mut self, def_id: LocalDefId) {
debug!("EntryBuilder::encode_mir({:?})", def_id);
if self.tcx.mir_keys(LOCAL_CRATE).contains(&def_id) {
record!(self.tables.mir[def_id] <- self.tcx.optimized_mir(def_id));
record!(self.tables.mir[def_id.to_def_id()] <- self.tcx.optimized_mir(def_id));
}
}

fn encode_promoted_mir(&mut self, def_id: DefId) {
fn encode_promoted_mir(&mut self, def_id: LocalDefId) {
debug!("EncodeContext::encode_promoted_mir({:?})", def_id);
if self.tcx.mir_keys(LOCAL_CRATE).contains(&def_id) {
record!(self.tables.promoted_mir[def_id] <- self.tcx.promoted_mir(def_id));
record!(self.tables.promoted_mir[def_id.to_def_id()] <- self.tcx.promoted_mir(def_id));
}
}

Expand Down Expand Up @@ -1282,8 +1281,8 @@ impl EncodeContext<'tcx> {
_ => false,
};
if mir {
self.encode_optimized_mir(def_id);
self.encode_promoted_mir(def_id);
self.encode_optimized_mir(def_id.expect_local());
self.encode_promoted_mir(def_id.expect_local());
}
}

Expand Down Expand Up @@ -1316,8 +1315,7 @@ impl EncodeContext<'tcx> {
let hir_id = self.tcx.hir().as_local_hir_id(def_id);
let ty = self.tcx.typeck_tables_of(def_id).node_type(hir_id);

let def_id = def_id.to_def_id();
record!(self.tables.kind[def_id] <- match ty.kind {
record!(self.tables.kind[def_id.to_def_id()] <- match ty.kind {
ty::Generator(..) => {
let data = self.tcx.generator_kind(def_id).unwrap();
EntryKind::Generator(data)
Expand All @@ -1327,14 +1325,14 @@ impl EncodeContext<'tcx> {

_ => bug!("closure that is neither generator nor closure"),
});
record!(self.tables.visibility[def_id] <- ty::Visibility::Public);
record!(self.tables.span[def_id] <- self.tcx.def_span(def_id));
record!(self.tables.attributes[def_id] <- &self.tcx.get_attrs(def_id)[..]);
self.encode_item_type(def_id);
record!(self.tables.visibility[def_id.to_def_id()] <- ty::Visibility::Public);
record!(self.tables.span[def_id.to_def_id()] <- self.tcx.def_span(def_id));
record!(self.tables.attributes[def_id.to_def_id()] <- &self.tcx.get_attrs(def_id.to_def_id())[..]);
self.encode_item_type(def_id.to_def_id());
if let ty::Closure(def_id, substs) = ty.kind {
record!(self.tables.fn_sig[def_id] <- substs.as_closure().sig());
}
self.encode_generics(def_id);
self.encode_generics(def_id.to_def_id());
self.encode_optimized_mir(def_id);
self.encode_promoted_mir(def_id);
}
Expand All @@ -1344,16 +1342,15 @@ impl EncodeContext<'tcx> {
let id = self.tcx.hir().as_local_hir_id(def_id);
let body_id = self.tcx.hir().body_owned_by(id);
let const_data = self.encode_rendered_const_for_body(body_id);
let def_id = def_id.to_def_id();
let qualifs = self.tcx.mir_const_qualif(def_id);

record!(self.tables.kind[def_id] <- EntryKind::Const(qualifs, const_data));
record!(self.tables.visibility[def_id] <- ty::Visibility::Public);
record!(self.tables.span[def_id] <- self.tcx.def_span(def_id));
self.encode_item_type(def_id);
self.encode_generics(def_id);
self.encode_explicit_predicates(def_id);
self.encode_inferred_outlives(def_id);
record!(self.tables.kind[def_id.to_def_id()] <- EntryKind::Const(qualifs, const_data));
record!(self.tables.visibility[def_id.to_def_id()] <- ty::Visibility::Public);
record!(self.tables.span[def_id.to_def_id()] <- self.tcx.def_span(def_id));
self.encode_item_type(def_id.to_def_id());
self.encode_generics(def_id.to_def_id());
self.encode_explicit_predicates(def_id.to_def_id());
self.encode_inferred_outlives(def_id.to_def_id());
self.encode_optimized_mir(def_id);
self.encode_promoted_mir(def_id);
}
Expand Down Expand Up @@ -1726,12 +1723,11 @@ impl<'tcx, 'v> ItemLikeVisitor<'v> for ImplVisitor<'tcx> {
/// Only a subset of the queries are actually prefetched to keep this code smaller.
struct PrefetchVisitor<'tcx> {
tcx: TyCtxt<'tcx>,
mir_keys: &'tcx DefIdSet,
mir_keys: &'tcx FxHashSet<LocalDefId>,
}

impl<'tcx> PrefetchVisitor<'tcx> {
fn prefetch_mir(&self, def_id: LocalDefId) {
let def_id = def_id.to_def_id();
if self.mir_keys.contains(&def_id) {
self.tcx.optimized_mir(def_id);
self.tcx.promoted_mir(def_id);
Expand Down
3 changes: 2 additions & 1 deletion src/librustc_middle/arena.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ macro_rules! arena_types {
rustc_hir::def_id::DefId,
rustc_middle::ty::subst::SubstsRef<$tcx>
)>,
[few, decode] mir_keys: rustc_hir::def_id::DefIdSet,
[few, decode] collect_and_partition_mono_items: rustc_hir::def_id::DefIdSet,
[few, decode] mir_keys: rustc_data_structures::fx::FxHashSet<rustc_hir::def_id::LocalDefId>,
[decode] specialization_graph: rustc_middle::traits::specialization_graph::Graph,
[] region_scope_tree: rustc_middle::middle::region::ScopeTree,
[] item_local_set: rustc_hir::ItemLocalSet,
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_middle/mir/mono.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use rustc_data_structures::base_n;
use rustc_data_structures::fingerprint::Fingerprint;
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, LOCAL_CRATE};
use rustc_hir::HirId;
use rustc_session::config::OptLevel;
use rustc_span::source_map::Span;
Expand Down Expand Up @@ -95,7 +95,7 @@ impl<'tcx> MonoItem<'tcx> {
// linkage, then we'll be creating a globally shared version.
if self.explicit_linkage(tcx).is_some()
|| !instance.def.generates_cgu_internal_copy(tcx)
|| Some(instance.def_id()) == entry_def_id
|| Some(instance.def_id()) == entry_def_id.map(LocalDefId::to_def_id)
{
return InstantiationMode::GloballyShared { may_conflict: false };
}
Expand Down
Loading