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 8 pull requests #70067

Closed
wants to merge 44 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
d6a17b5
Move tidy check to mingw-check
JohnTitor Mar 4, 2020
726d518
bootstrap: Use hash to determine if sanitizers needs to be rebuilt
tmiasko Mar 5, 2020
d49306d
implement zeroed and uninitialized with MaybeUninit
RalfJung Mar 11, 2020
c7eb0f2
fix expand-to-unstable test
RalfJung Mar 11, 2020
f4eb6ed
Ensure HAS_FREE_LOCAL_NAMES is set for ReFree
matthewjasper Mar 11, 2020
996a51b
init-large-type test needs optimizations
RalfJung Mar 16, 2020
a2160e6
make mem::{zeroed,uninitialized} inline(always)
RalfJung Mar 16, 2020
ec86270
Make macro metavars respect (non-)hygiene
matthewjasper Mar 11, 2020
a4125a6
submod_path_from_attr: simplify & document
Centril Mar 7, 2020
48b9526
extract error_cannot_declare_mod_here
Centril Mar 7, 2020
bbd2129
extract error_decl_mod_in_block
Centril Mar 7, 2020
7042554
simplify submod_path
Centril Mar 7, 2020
586c9b5
submod_path: use id.span
Centril Mar 7, 2020
d06031c
extract parse_mod
Centril Mar 7, 2020
a2a32c7
extract error_on_circular_module
Centril Mar 7, 2020
4d05f90
detach submod_path from Parser
Centril Mar 8, 2020
c824f5d
decouple push_directory from Parser
Centril Mar 8, 2020
4a70313
decouple eval_src_mod from Parser
Centril Mar 8, 2020
033f8a2
expand: use push_directory
Centril Mar 8, 2020
60a00b0
de-fatalize outline module parsing
Centril Mar 8, 2020
16d444a
extract parse_external_module
Centril Mar 8, 2020
a1f9953
extract error_on_circular_module
Centril Mar 8, 2020
97fa2bd
outline modules: parse -> expand.
Centril Mar 8, 2020
fb540a9
parse: module parsing -> item.rs
Centril Mar 8, 2020
e2cd4d0
move Directory -> parser::module
Centril Mar 8, 2020
e830157
{rustc_parse::parser -> rustc_expand}::module
Centril Mar 8, 2020
c16f0d3
{rustc_parse -> rustc_expand}::config
Centril Mar 8, 2020
2454395
add test for stripped nested outline module
Centril Mar 8, 2020
ed9d81e
parser/expand: minor cleanup
Centril Mar 9, 2020
9741bb6
tweak outline module parsing spans
Centril Mar 9, 2020
48b8ecc
use pretty-compare-only in a test
Centril Mar 10, 2020
998b33e
fix pre-expansion linting infra
Centril Mar 15, 2020
5cc4e94
fix rebase fallout
Centril Mar 15, 2020
442e5ff
Small fixes in documentation
JOE1994 Mar 17, 2020
194de27
Update books
ehuss Mar 17, 2020
8b0698b
--bless windows test
Centril Mar 17, 2020
34afc76
Rollup merge of #68746 - matthewjasper:metahygiene, r=petrochenkov
Centril Mar 17, 2020
3e8c948
Rollup merge of #69688 - JohnTitor:move-tidy, r=Mark-Simulacrum
Centril Mar 17, 2020
fbf9590
Rollup merge of #69735 - tmiasko:bootstrap-sanitizers-hash, r=Mark-Si…
Centril Mar 17, 2020
9712711
Rollup merge of #69838 - Centril:expand-module, r=petrochenkov
Centril Mar 17, 2020
ffec535
Rollup merge of #69922 - RalfJung:less-intrinsic, r=oli-obk
Centril Mar 17, 2020
9808a21
Rollup merge of #69956 - matthewjasper:fix-region-flags, r=nikomatsakis
Centril Mar 17, 2020
34b6d0e
Rollup merge of #70061 - JOE1994:patch-2, r=Dylan-DPC
Centril Mar 17, 2020
2a06433
Rollup merge of #70064 - ehuss:update-books, r=ehuss
Centril Mar 17, 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
98 changes: 67 additions & 31 deletions src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use std::env;
use std::ffi::OsString;
use std::fs::{self, File};
use std::io;
use std::path::{Path, PathBuf};
use std::process::Command;

Expand Down Expand Up @@ -54,7 +55,6 @@ impl Step for Llvm {
}
}

let llvm_info = &builder.in_tree_llvm_info;
let root = "src/llvm-project/llvm";
let out_dir = builder.llvm_out(target);
let mut llvm_config_ret_dir = builder.llvm_out(builder.config.build);
Expand All @@ -65,40 +65,35 @@ impl Step for Llvm {

let build_llvm_config =
llvm_config_ret_dir.join(exe("llvm-config", &*builder.config.build));
let done_stamp = out_dir.join("llvm-finished-building");

if done_stamp.exists() {
if builder.config.llvm_skip_rebuild {
builder.info(
"Warning: \
Using a potentially stale build of LLVM; \
This may not behave well.",
);
return build_llvm_config;
}
let stamp = out_dir.join("llvm-finished-building");
let stamp = HashStamp::new(stamp, builder.in_tree_llvm_info.sha());

if let Some(llvm_commit) = llvm_info.sha() {
let done_contents = t!(fs::read(&done_stamp));
if builder.config.llvm_skip_rebuild && stamp.path.exists() {
builder.info(
"Warning: \
Using a potentially stale build of LLVM; \
This may not behave well.",
);
return build_llvm_config;
}

// If LLVM was already built previously and the submodule's commit didn't change
// from the previous build, then no action is required.
if done_contents == llvm_commit.as_bytes() {
return build_llvm_config;
}
} else {
if stamp.is_done() {
if stamp.hash.is_none() {
builder.info(
"Could not determine the LLVM submodule commit hash. \
Assuming that an LLVM rebuild is not necessary.",
);
builder.info(&format!(
"To force LLVM to rebuild, remove the file `{}`",
done_stamp.display()
stamp.path.display()
));
return build_llvm_config;
}
return build_llvm_config;
}

builder.info(&format!("Building LLVM for {}", target));
t!(stamp.remove());
let _time = util::timeit(&builder);
t!(fs::create_dir_all(&out_dir));

Expand Down Expand Up @@ -271,7 +266,7 @@ impl Step for Llvm {

cfg.build();

t!(fs::write(&done_stamp, llvm_info.sha().unwrap_or("")));
t!(stamp.write());

build_llvm_config
}
Expand Down Expand Up @@ -584,17 +579,21 @@ impl Step for Sanitizers {
return runtimes;
}

let done_stamp = out_dir.join("sanitizers-finished-building");
if done_stamp.exists() {
builder.info(&format!(
"Assuming that sanitizers rebuild is not necessary. \
To force a rebuild, remove the file `{}`",
done_stamp.display()
));
let stamp = out_dir.join("sanitizers-finished-building");
let stamp = HashStamp::new(stamp, builder.in_tree_llvm_info.sha());

if stamp.is_done() {
if stamp.hash.is_none() {
builder.info(&format!(
"Rebuild sanitizers by removing the file `{}`",
stamp.path.display()
));
}
return runtimes;
}

builder.info(&format!("Building sanitizers for {}", self.target));
t!(stamp.remove());
let _time = util::timeit(&builder);

let mut cfg = cmake::Config::new(&compiler_rt_dir);
Expand Down Expand Up @@ -623,8 +622,7 @@ impl Step for Sanitizers {
cfg.build_target(&runtime.cmake_target);
cfg.build();
}

t!(fs::write(&done_stamp, b""));
t!(stamp.write());

runtimes
}
Expand Down Expand Up @@ -689,3 +687,41 @@ fn supported_sanitizers(
}
result
}

struct HashStamp {
path: PathBuf,
hash: Option<Vec<u8>>,
}

impl HashStamp {
fn new(path: PathBuf, hash: Option<&str>) -> Self {
HashStamp { path, hash: hash.map(|s| s.as_bytes().to_owned()) }
}

fn is_done(&self) -> bool {
match fs::read(&self.path) {
Ok(h) => self.hash.as_deref().unwrap_or(b"") == h.as_slice(),
Err(e) if e.kind() == io::ErrorKind::NotFound => false,
Err(e) => {
panic!("failed to read stamp file `{}`: {}", self.path.display(), e);
}
}
}

fn remove(&self) -> io::Result<()> {
match fs::remove_file(&self.path) {
Ok(()) => Ok(()),
Err(e) => {
if e.kind() == io::ErrorKind::NotFound {
Ok(())
} else {
Err(e)
}
}
}
}

fn write(&self) -> io::Result<()> {
fs::write(&self.path, self.hash.as_deref().unwrap_or(b""))
}
}
1 change: 1 addition & 0 deletions src/ci/docker/mingw-check/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ ENV RUN_CHECK_WITH_PARALLEL_QUERIES 1
ENV SCRIPT python2.7 ../x.py check --target=i686-pc-windows-gnu --host=i686-pc-windows-gnu && \
python2.7 ../x.py build --stage 0 src/tools/build-manifest && \
python2.7 ../x.py test --stage 0 src/tools/compiletest && \
python2.7 ../x.py test src/tools/tidy && \
/scripts/validate-toolstate.sh
2 changes: 1 addition & 1 deletion src/ci/docker/x86_64-gnu-llvm-7/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ENV RUST_CONFIGURE_ARGS \
--enable-llvm-link-shared \
--set rust.thin-lto-import-instr-limit=10

ENV SCRIPT python2.7 ../x.py test src/tools/tidy && python2.7 ../x.py test
ENV SCRIPT python2.7 ../x.py test --exclude src/tools/tidy && python2.7 ../x.py test src/tools/tidy

# The purpose of this container isn't to test with debug assertions and
# this is run on all PRs, so let's get speedier builds by disabling these extra
Expand Down
2 changes: 1 addition & 1 deletion src/doc/embedded-book
2 changes: 1 addition & 1 deletion src/doc/rust-by-example
40 changes: 1 addition & 39 deletions src/libcore/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1027,46 +1027,8 @@ extern "rust-intrinsic" {
#[rustc_const_unstable(feature = "const_caller_location", issue = "47809")]
pub fn caller_location() -> &'static crate::panic::Location<'static>;

/// Creates a value initialized to zero.
///
/// `init` is unsafe because it returns a zeroed-out datum,
/// which is unsafe unless `T` is `Copy`. Also, even if T is
/// `Copy`, an all-zero value may not correspond to any legitimate
/// state for the type in question.
///
/// The stabilized version of this intrinsic is
/// [`std::mem::zeroed`](../../std/mem/fn.zeroed.html).
#[unstable(
feature = "core_intrinsics",
reason = "intrinsics are unlikely to ever be stabilized, instead \
they should be used through stabilized interfaces \
in the rest of the standard library",
issue = "none"
)]
#[rustc_deprecated(reason = "superseded by MaybeUninit, removal planned", since = "1.38.0")]
pub fn init<T>() -> T;

/// Creates an uninitialized value.
///
/// `uninit` is unsafe because there is no guarantee of what its
/// contents are. In particular its drop-flag may be set to any
/// state, which means it may claim either dropped or
/// undropped. In the general case one must use `ptr::write` to
/// initialize memory previous set to the result of `uninit`.
///
/// The stabilized version of this intrinsic is
/// [`std::mem::MaybeUninit`](../../std/mem/union.MaybeUninit.html).
#[unstable(
feature = "core_intrinsics",
reason = "intrinsics are unlikely to ever be stabilized, instead \
they should be used through stabilized interfaces \
in the rest of the standard library",
issue = "none"
)]
#[rustc_deprecated(reason = "superseded by MaybeUninit, removal planned", since = "1.38.0")]
pub fn uninit<T>() -> T;

/// Moves a value out of scope without running drop glue.
/// This exists solely for `mem::forget_unsized`; normal `forget` uses `ManuallyDrop` instead.
pub fn forget<T: ?Sized>(_: T);

/// Reinterprets the bits of a value of one type as another type.
Expand Down
8 changes: 4 additions & 4 deletions src/libcore/mem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ pub const fn needs_drop<T>() -> bool {
///
/// let _x: &i32 = unsafe { mem::zeroed() }; // Undefined behavior!
/// ```
#[inline]
#[inline(always)]
#[stable(feature = "rust1", since = "1.0.0")]
#[allow(deprecated_in_future)]
#[allow(deprecated)]
Expand All @@ -500,7 +500,7 @@ pub unsafe fn zeroed<T>() -> T {
intrinsics::assert_zero_valid::<T>();
#[cfg(bootstrap)]
intrinsics::panic_if_uninhabited::<T>();
intrinsics::init()
MaybeUninit::zeroed().assume_init()
}

/// Bypasses Rust's normal memory-initialization checks by pretending to
Expand All @@ -525,7 +525,7 @@ pub unsafe fn zeroed<T>() -> T {
/// [uninit]: union.MaybeUninit.html#method.uninit
/// [assume_init]: union.MaybeUninit.html#method.assume_init
/// [inv]: union.MaybeUninit.html#initialization-invariant
#[inline]
#[inline(always)]
#[rustc_deprecated(since = "1.39.0", reason = "use `mem::MaybeUninit` instead")]
#[stable(feature = "rust1", since = "1.0.0")]
#[allow(deprecated_in_future)]
Expand All @@ -536,7 +536,7 @@ pub unsafe fn uninitialized<T>() -> T {
intrinsics::assert_uninit_valid::<T>();
#[cfg(bootstrap)]
intrinsics::panic_if_uninhabited::<T>();
intrinsics::uninit()
MaybeUninit::uninit().assume_init()
}

/// Swaps the values at two mutable locations, without deinitializing either one.
Expand Down
2 changes: 0 additions & 2 deletions src/libpanic_unwind/emcc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
//! Emscripten's runtime always implements those APIs and does not
//! implement libunwind.

#![allow(private_no_mangle_fns)]

use alloc::boxed::Box;
use core::any::Any;
use core::mem;
Expand Down
2 changes: 0 additions & 2 deletions src/libpanic_unwind/gcc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
//! Once stack has been unwound down to the handler frame level, unwinding stops
//! and the last personality routine transfers control to the catch block.

#![allow(private_no_mangle_fns)]

use alloc::boxed::Box;
use core::any::Any;

Expand Down
1 change: 0 additions & 1 deletion src/libpanic_unwind/seh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
//! [llvm]: http://llvm.org/docs/ExceptionHandling.html#background-on-windows-exceptions

#![allow(nonstandard_style)]
#![allow(private_no_mangle_fns)]

use alloc::boxed::Box;
use core::any::Any;
Expand Down
27 changes: 15 additions & 12 deletions src/librustc/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -554,24 +554,26 @@ bitflags! {
/// Does this have [ConstKind::Placeholder]?
const HAS_CT_PLACEHOLDER = 1 << 8;

/// `true` if there are "names" of regions and so forth
/// that are local to a particular fn/inferctxt
const HAS_FREE_LOCAL_REGIONS = 1 << 9;

/// `true` if there are "names" of types and regions and so forth
/// that are local to a particular fn
const HAS_FREE_LOCAL_NAMES = TypeFlags::HAS_TY_PARAM.bits
| TypeFlags::HAS_RE_PARAM.bits
| TypeFlags::HAS_CT_PARAM.bits
| TypeFlags::HAS_TY_INFER.bits
| TypeFlags::HAS_RE_INFER.bits
| TypeFlags::HAS_CT_INFER.bits
| TypeFlags::HAS_TY_PLACEHOLDER.bits
| TypeFlags::HAS_RE_PLACEHOLDER.bits
| TypeFlags::HAS_CT_PLACEHOLDER.bits;
| TypeFlags::HAS_CT_PLACEHOLDER.bits
| TypeFlags::HAS_FREE_LOCAL_REGIONS.bits;

/// Does this have [Projection] or [UnnormalizedProjection]?
const HAS_TY_PROJECTION = 1 << 9;
const HAS_TY_PROJECTION = 1 << 10;
/// Does this have [Opaque]?
const HAS_TY_OPAQUE = 1 << 10;
const HAS_TY_OPAQUE = 1 << 11;
/// Does this have [ConstKind::Unevaluated]?
const HAS_CT_PROJECTION = 1 << 11;
const HAS_CT_PROJECTION = 1 << 12;

/// Could this type be normalized further?
const HAS_PROJECTION = TypeFlags::HAS_TY_PROJECTION.bits
Expand All @@ -580,21 +582,21 @@ bitflags! {

/// Present if the type belongs in a local type context.
/// Set for placeholders and inference variables that are not "Fresh".
const KEEP_IN_LOCAL_TCX = 1 << 12;
const KEEP_IN_LOCAL_TCX = 1 << 13;

/// Is an error type reachable?
const HAS_TY_ERR = 1 << 13;
const HAS_TY_ERR = 1 << 14;

/// Does this have any region that "appears free" in the type?
/// Basically anything but [ReLateBound] and [ReErased].
const HAS_FREE_REGIONS = 1 << 14;
const HAS_FREE_REGIONS = 1 << 15;

/// Does this have any [ReLateBound] regions? Used to check
/// if a global bound is safe to evaluate.
const HAS_RE_LATE_BOUND = 1 << 15;
const HAS_RE_LATE_BOUND = 1 << 16;

/// Does this have any [ReErased] regions?
const HAS_RE_ERASED = 1 << 16;
const HAS_RE_ERASED = 1 << 17;

/// Flags representing the nominal content of a type,
/// computed by FlagsComputation. If you add a new nominal
Expand All @@ -608,6 +610,7 @@ bitflags! {
| TypeFlags::HAS_TY_PLACEHOLDER.bits
| TypeFlags::HAS_RE_PLACEHOLDER.bits
| TypeFlags::HAS_CT_PLACEHOLDER.bits
| TypeFlags::HAS_FREE_LOCAL_REGIONS.bits
| TypeFlags::HAS_TY_PROJECTION.bits
| TypeFlags::HAS_TY_OPAQUE.bits
| TypeFlags::HAS_CT_PROJECTION.bits
Expand Down
Loading