Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Accept LocalDefId as key for mir_validated query
  • Loading branch information
marmeladema committed Apr 25, 2020
commit 58ba9252923624d557e5ec608154c22eabc647b3
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
3 changes: 2 additions & 1 deletion src/librustc_middle/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,13 @@ rustc_queries! {
no_hash
}

query mir_validated(_: DefId) ->
query mir_validated(key: LocalDefId) ->
(
&'tcx Steal<mir::Body<'tcx>>,
&'tcx Steal<IndexVec<mir::Promoted, mir::Body<'tcx>>>
) {
no_hash
desc { |tcx| "processing `{}`", tcx.def_path_str(key.to_def_id()) }
}

/// MIR after our optimization passes have run. This is MIR that is ready
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/borrow_check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ pub fn provide(providers: &mut Providers<'_>) {
}

fn mir_borrowck(tcx: TyCtxt<'_>, def_id: LocalDefId) -> &BorrowCheckResult<'_> {
let (input_body, promoted) = tcx.mir_validated(def_id.to_def_id());
let (input_body, promoted) = tcx.mir_validated(def_id);
debug!("run query mir_borrowck: {}", tcx.def_path_str(def_id.to_def_id()));

let opt_closure_req = tcx.infer_ctxt().enter(|infcx| {
Expand Down
20 changes: 12 additions & 8 deletions src/librustc_mir/transform/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,13 +238,13 @@ fn mir_const(tcx: TyCtxt<'_>, def_id: DefId) -> &Steal<Body<'_>> {

fn mir_validated(
tcx: TyCtxt<'tcx>,
def_id: DefId,
def_id: LocalDefId,
) -> (&'tcx Steal<Body<'tcx>>, &'tcx Steal<IndexVec<Promoted, Body<'tcx>>>) {
// Ensure that we compute the `mir_const_qualif` for constants at
// this point, before we steal the mir-const result.
let _ = tcx.mir_const_qualif(def_id);
let _ = tcx.mir_const_qualif(def_id.to_def_id());

let mut body = tcx.mir_const(def_id).steal();
let mut body = tcx.mir_const(def_id.to_def_id()).steal();

let mut required_consts = Vec::new();
let mut required_consts_visitor = RequiredConstsVisitor::new(&mut required_consts);
Expand All @@ -257,7 +257,7 @@ fn mir_validated(
run_passes(
tcx,
&mut body,
InstanceDef::Item(def_id),
InstanceDef::Item(def_id.to_def_id()),
None,
MirPhase::Validated,
&[
Expand All @@ -274,13 +274,13 @@ fn mir_validated(
fn run_optimization_passes<'tcx>(
tcx: TyCtxt<'tcx>,
body: &mut Body<'tcx>,
def_id: DefId,
def_id: LocalDefId,
promoted: Option<Promoted>,
) {
run_passes(
tcx,
body,
InstanceDef::Item(def_id),
InstanceDef::Item(def_id.to_def_id()),
promoted,
MirPhase::Optimized,
&[
Expand Down Expand Up @@ -338,9 +338,11 @@ fn optimized_mir(tcx: TyCtxt<'_>, def_id: DefId) -> &Body<'_> {
return shim::build_adt_ctor(tcx, def_id);
}

let def_id = def_id.expect_local();

// (Mir-)Borrowck uses `mir_validated`, so we have to force it to
// execute before we can steal.
tcx.ensure().mir_borrowck(def_id.expect_local());
tcx.ensure().mir_borrowck(def_id);

let (body, _) = tcx.mir_validated(def_id);
let mut body = body.steal();
Expand All @@ -356,7 +358,9 @@ fn promoted_mir(tcx: TyCtxt<'_>, def_id: DefId) -> &IndexVec<Promoted, Body<'_>>
return tcx.intern_promoted(IndexVec::new());
}

tcx.ensure().mir_borrowck(def_id.expect_local());
let def_id = def_id.expect_local();

tcx.ensure().mir_borrowck(def_id);
let (_, promoted) = tcx.mir_validated(def_id);
let mut promoted = promoted.steal();

Expand Down