Skip to content

Commit e4828d5

Browse files
committedSep 16, 2021
Auto merge of #89019 - Manishearth:rollup-5qp8a5s, r=Manishearth
Rollup of 10 pull requests Successful merges: - #88292 (Enable --generate-link-to-definition for rustc's docs) - #88729 (Recover from `Foo(a: 1, b: 2)`) - #88875 (cleanup(rustc_trait_selection): remove vestigial code from rustc_on_unimplemented) - #88892 (Move object safety suggestions to the end of the error) - #88928 (Document the closure arguments for `reduce`.) - #88976 (Clean up and add doc comments for CStr) - #88983 (Allow calling `get_body_with_borrowck_facts` without `-Z polonius`) - #88985 (Update clobber_abi list to include k[1-7] regs) - #88986 (Update the backtrace crate) - #89009 (Fix typo in `break` docs) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 237bb5e + d9fa356 commit e4828d5

File tree

49 files changed

+210
-106
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+210
-106
lines changed
 

‎compiler/rustc_borrowck/src/consumers.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ pub use super::{
1414
};
1515

1616
/// This function computes Polonius facts for the given body. It makes a copy of
17-
/// the body because it needs to regenerate the region identifiers.
17+
/// the body because it needs to regenerate the region identifiers. This function
18+
/// should never be invoked during a typical compilation session due to performance
19+
/// issues with Polonius.
1820
///
1921
/// Note:
2022
/// * This function will panic if the required body was already stolen. This
2123
/// can, for example, happen when requesting a body of a `const` function
2224
/// because they are evaluated during typechecking. The panic can be avoided
2325
/// by overriding the `mir_borrowck` query. You can find a complete example
2426
/// that shows how to do this at `src/test/run-make/obtain-borrowck/`.
25-
/// * This function will also panic if computation of Polonius facts
26-
/// (`-Zpolonius` flag) is not enabled.
2727
///
2828
/// * Polonius is highly unstable, so expect regular changes in its signature or other details.
2929
pub fn get_body_with_borrowck_facts<'tcx>(

‎compiler/rustc_borrowck/src/lib.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,6 @@ fn do_mir_borrowck<'a, 'tcx>(
154154

155155
debug!("do_mir_borrowck(def = {:?})", def);
156156

157-
assert!(
158-
!return_body_with_facts || infcx.tcx.sess.opts.debugging_opts.polonius,
159-
"borrowck facts can be requested only when Polonius is enabled"
160-
);
161-
162157
let tcx = infcx.tcx;
163158
let param_env = tcx.param_env(def.did);
164159
let id = tcx.hir().local_def_id_to_hir_id(def.did);
@@ -235,6 +230,8 @@ fn do_mir_borrowck<'a, 'tcx>(
235230
let borrow_set =
236231
Rc::new(BorrowSet::build(tcx, body, locals_are_invalidated_at_exit, &mdpe.move_data));
237232

233+
let use_polonius = return_body_with_facts || infcx.tcx.sess.opts.debugging_opts.polonius;
234+
238235
// Compute non-lexical lifetimes.
239236
let nll::NllOutput {
240237
regioncx,
@@ -254,6 +251,7 @@ fn do_mir_borrowck<'a, 'tcx>(
254251
&mdpe.move_data,
255252
&borrow_set,
256253
&upvars,
254+
use_polonius,
257255
);
258256

259257
// Dump MIR results into a file, if that is enabled. This let us

0 commit comments

Comments
 (0)
Please sign in to comment.