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
This commit is contained in:
bors 2019-04-28 12:50:06 +00:00
commit 012c300706
5 changed files with 13 additions and 18 deletions

View File

@ -155,13 +155,12 @@ pub enum OutputType {
impl OutputType {
fn is_compatible_with_codegen_units_and_single_output_file(&self) -> bool {
match *self {
OutputType::Exe | OutputType::DepInfo => true,
OutputType::Exe | OutputType::DepInfo | OutputType::Metadata => true,
OutputType::Bitcode
| OutputType::Assembly
| OutputType::LlvmAssembly
| OutputType::Mir
| OutputType::Object
| OutputType::Metadata => false,
| OutputType::Object => false,
}
}
@ -1216,10 +1215,6 @@ fn parse_merge_functions(slot: &mut Option<MergeFunctions>, v: Option<&str>) ->
"make unnamed regions display as '# (where # is some non-ident unique id)"),
borrowck: Option<String> = (None, parse_opt_string, [UNTRACKED],
"select which borrowck is used (`ast`, `mir`, `migrate`, or `compare`)"),
two_phase_borrows: bool = (false, parse_bool, [UNTRACKED],
"use two-phase reserved/active distinction for `&mut` borrows in MIR borrowck"),
two_phase_beyond_autoref: bool = (false, parse_bool, [UNTRACKED],
"when using two-phase-borrows, allow two phases even for non-autoref `&mut` borrows"),
time_passes: bool = (false, parse_bool, [UNTRACKED],
"measure time of each rustc pass"),
time: bool = (false, parse_bool, [UNTRACKED],

View File

@ -1,5 +1,6 @@
use crate::borrow_check::place_ext::PlaceExt;
use crate::borrow_check::nll::ToRegionVid;
use crate::borrow_check::path_utils::allow_two_phase_borrow;
use crate::dataflow::indexes::BorrowIndex;
use crate::dataflow::move_paths::MoveData;
use rustc::mir::traversal;
@ -299,13 +300,6 @@ fn visit_statement(
}
impl<'a, 'gcx, 'tcx> GatherBorrows<'a, 'gcx, 'tcx> {
/// Returns `true` if the borrow represented by `kind` is
/// allowed to be split into separate Reservation and
/// Activation phases.
fn allow_two_phase_borrow(&self, kind: mir::BorrowKind) -> bool {
kind.allows_two_phase_borrow()
|| self.tcx.sess.opts.debugging_opts.two_phase_beyond_autoref
}
/// If this is a two-phase borrow, then we will record it
/// as "pending" until we find the activating use.
@ -321,7 +315,7 @@ fn insert_as_pending_if_two_phase(
start_location, assigned_place, borrow_index,
);
if !self.allow_two_phase_borrow(kind) {
if !allow_two_phase_borrow(&self.tcx, kind) {
debug!(" -> {:?}", start_location);
return;
}

View File

@ -12,11 +12,10 @@
/// allowed to be split into separate Reservation and
/// Activation phases.
pub(super) fn allow_two_phase_borrow<'a, 'tcx, 'gcx: 'tcx>(
tcx: &TyCtxt<'a, 'gcx, 'tcx>,
_tcx: &TyCtxt<'a, 'gcx, 'tcx>,
kind: BorrowKind
) -> bool {
kind.allows_two_phase_borrow()
|| tcx.sess.opts.debugging_opts.two_phase_beyond_autoref
}
/// Control for the path borrow checking code

View File

@ -359,9 +359,12 @@ fn _remove_var(k: &OsStr) {
/// An iterator that splits an environment variable into paths according to
/// platform-specific conventions.
///
/// The iterator element type is [`PathBuf`].
///
/// This structure is created by the [`std::env::split_paths`] function. See its
/// documentation for more.
///
/// [`PathBuf`]: ../../std/path/struct.PathBuf.html
/// [`std::env::split_paths`]: fn.split_paths.html
#[stable(feature = "env", since = "1.0.0")]
pub struct SplitPaths<'a> { inner: os_imp::SplitPaths<'a> }
@ -369,7 +372,8 @@ pub struct SplitPaths<'a> { inner: os_imp::SplitPaths<'a> }
/// Parses input according to platform conventions for the `PATH`
/// environment variable.
///
/// Returns an iterator over the paths contained in `unparsed`.
/// Returns an iterator over the paths contained in `unparsed`. The iterator
/// element type is [`PathBuf`].
///
/// # Examples
///
@ -386,6 +390,8 @@ pub struct SplitPaths<'a> { inner: os_imp::SplitPaths<'a> }
/// None => println!("{} is not defined in the environment.", key)
/// }
/// ```
///
/// [`PathBuf`]: ../../std/path/struct.PathBuf.html
#[stable(feature = "env", since = "1.0.0")]
pub fn split_paths<T: AsRef<OsStr> + ?Sized>(unparsed: &T) -> SplitPaths<'_> {
SplitPaths { inner: os_imp::split_paths(unparsed.as_ref()) }

View File

@ -1137,6 +1137,7 @@ pub enum ExprKind {
Lit(Lit),
/// A cast (e.g., `foo as f64`).
Cast(P<Expr>, P<Ty>),
/// A type ascription (e.g., `42: usize`).
Type(P<Expr>, P<Ty>),
/// An `if` block, with an optional `else` block.
///