Skip to content

Commit 012c300

Browse files
committed
Auto merge of #60351 - Centril:rollup-5xv3tka, r=Centril
Rollup of 4 pull requests Successful merges: - #60022 (Document `Item` type in `std::env::SplitPaths` iterator.) - #60270 (rustc: Flag metadata compatible with multiple CGUs) - #60325 (Document ast::ExprKind::Type) - #60347 (Remove `-Z two-phase-borrows` and `-Z two-phase-beyond-autoref`) Failed merges: r? @ghost
2 parents 3418d2f + fe52f8e commit 012c300

File tree

5 files changed

+13
-18
lines changed

5 files changed

+13
-18
lines changed

src/librustc/session/config.rs

+2-7
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,12 @@ impl_stable_hash_via_hash!(OutputType);
155155
impl OutputType {
156156
fn is_compatible_with_codegen_units_and_single_output_file(&self) -> bool {
157157
match *self {
158-
OutputType::Exe | OutputType::DepInfo => true,
158+
OutputType::Exe | OutputType::DepInfo | OutputType::Metadata => true,
159159
OutputType::Bitcode
160160
| OutputType::Assembly
161161
| OutputType::LlvmAssembly
162162
| OutputType::Mir
163-
| OutputType::Object
164-
| OutputType::Metadata => false,
163+
| OutputType::Object => false,
165164
}
166165
}
167166

@@ -1216,10 +1215,6 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
12161215
"make unnamed regions display as '# (where # is some non-ident unique id)"),
12171216
borrowck: Option<String> = (None, parse_opt_string, [UNTRACKED],
12181217
"select which borrowck is used (`ast`, `mir`, `migrate`, or `compare`)"),
1219-
two_phase_borrows: bool = (false, parse_bool, [UNTRACKED],
1220-
"use two-phase reserved/active distinction for `&mut` borrows in MIR borrowck"),
1221-
two_phase_beyond_autoref: bool = (false, parse_bool, [UNTRACKED],
1222-
"when using two-phase-borrows, allow two phases even for non-autoref `&mut` borrows"),
12231218
time_passes: bool = (false, parse_bool, [UNTRACKED],
12241219
"measure time of each rustc pass"),
12251220
time: bool = (false, parse_bool, [UNTRACKED],

src/librustc_mir/borrow_check/borrow_set.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use crate::borrow_check::place_ext::PlaceExt;
22
use crate::borrow_check::nll::ToRegionVid;
3+
use crate::borrow_check::path_utils::allow_two_phase_borrow;
34
use crate::dataflow::indexes::BorrowIndex;
45
use crate::dataflow::move_paths::MoveData;
56
use rustc::mir::traversal;
@@ -299,13 +300,6 @@ impl<'a, 'gcx, 'tcx> Visitor<'tcx> for GatherBorrows<'a, 'gcx, 'tcx> {
299300
}
300301

301302
impl<'a, 'gcx, 'tcx> GatherBorrows<'a, 'gcx, 'tcx> {
302-
/// Returns `true` if the borrow represented by `kind` is
303-
/// allowed to be split into separate Reservation and
304-
/// Activation phases.
305-
fn allow_two_phase_borrow(&self, kind: mir::BorrowKind) -> bool {
306-
kind.allows_two_phase_borrow()
307-
|| self.tcx.sess.opts.debugging_opts.two_phase_beyond_autoref
308-
}
309303

310304
/// If this is a two-phase borrow, then we will record it
311305
/// as "pending" until we find the activating use.
@@ -321,7 +315,7 @@ impl<'a, 'gcx, 'tcx> GatherBorrows<'a, 'gcx, 'tcx> {
321315
start_location, assigned_place, borrow_index,
322316
);
323317

324-
if !self.allow_two_phase_borrow(kind) {
318+
if !allow_two_phase_borrow(&self.tcx, kind) {
325319
debug!(" -> {:?}", start_location);
326320
return;
327321
}

src/librustc_mir/borrow_check/path_utils.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@ use rustc_data_structures::graph::dominators::Dominators;
1212
/// allowed to be split into separate Reservation and
1313
/// Activation phases.
1414
pub(super) fn allow_two_phase_borrow<'a, 'tcx, 'gcx: 'tcx>(
15-
tcx: &TyCtxt<'a, 'gcx, 'tcx>,
15+
_tcx: &TyCtxt<'a, 'gcx, 'tcx>,
1616
kind: BorrowKind
1717
) -> bool {
1818
kind.allows_two_phase_borrow()
19-
|| tcx.sess.opts.debugging_opts.two_phase_beyond_autoref
2019
}
2120

2221
/// Control for the path borrow checking code

src/libstd/env.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -359,17 +359,21 @@ fn _remove_var(k: &OsStr) {
359359
/// An iterator that splits an environment variable into paths according to
360360
/// platform-specific conventions.
361361
///
362+
/// The iterator element type is [`PathBuf`].
363+
///
362364
/// This structure is created by the [`std::env::split_paths`] function. See its
363365
/// documentation for more.
364366
///
367+
/// [`PathBuf`]: ../../std/path/struct.PathBuf.html
365368
/// [`std::env::split_paths`]: fn.split_paths.html
366369
#[stable(feature = "env", since = "1.0.0")]
367370
pub struct SplitPaths<'a> { inner: os_imp::SplitPaths<'a> }
368371

369372
/// Parses input according to platform conventions for the `PATH`
370373
/// environment variable.
371374
///
372-
/// Returns an iterator over the paths contained in `unparsed`.
375+
/// Returns an iterator over the paths contained in `unparsed`. The iterator
376+
/// element type is [`PathBuf`].
373377
///
374378
/// # Examples
375379
///
@@ -386,6 +390,8 @@ pub struct SplitPaths<'a> { inner: os_imp::SplitPaths<'a> }
386390
/// None => println!("{} is not defined in the environment.", key)
387391
/// }
388392
/// ```
393+
///
394+
/// [`PathBuf`]: ../../std/path/struct.PathBuf.html
389395
#[stable(feature = "env", since = "1.0.0")]
390396
pub fn split_paths<T: AsRef<OsStr> + ?Sized>(unparsed: &T) -> SplitPaths<'_> {
391397
SplitPaths { inner: os_imp::split_paths(unparsed.as_ref()) }

src/libsyntax/ast.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1137,6 +1137,7 @@ pub enum ExprKind {
11371137
Lit(Lit),
11381138
/// A cast (e.g., `foo as f64`).
11391139
Cast(P<Expr>, P<Ty>),
1140+
/// A type ascription (e.g., `42: usize`).
11401141
Type(P<Expr>, P<Ty>),
11411142
/// An `if` block, with an optional `else` block.
11421143
///

0 commit comments

Comments
 (0)