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

update from origin 2020-06-18 #4

Merged
merged 35 commits into from
Jun 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
3da3d15
[RISC-V] Do not force frame pointers
lenary May 30, 2020
e9b67d2
Fix link error with #[thread_local] introduced by #71192
Amanieu Jun 6, 2020
af7fbec
store `ObligationCause` on the heap
lcnr Jun 3, 2020
ea668d9
use enum to represent ObligationCause::dummy without allocating
lcnr Jun 6, 2020
2af53e9
Add -O compile flag to test
Amanieu Jun 10, 2020
01e29c7
Don't run test on emscripten which doesn't have threads
Amanieu Jun 13, 2020
241d16f
Update LLVM submodule
Amanieu Jun 13, 2020
4004bf1
Don't run generator transform when there's a TyErr
jonas-schievink Jun 14, 2020
c0c3327
Check for overflow in DroplessArena and return aligned pointer
tmiasko Jun 11, 2020
1f08951
Avoid forming references to an uninitialized memory in DroplessArena
tmiasko Jun 14, 2020
64a6de2
Join mutiple lines if it is more readable
tesuji Jun 15, 2020
b67bdb5
Re-order correctly the sections in the sidebar
GuillaumeGomez Jun 15, 2020
fe7456c
Use track caller for bug! macro
tesuji Jun 15, 2020
51e11e3
Avoid prematurely recording toolstates
Mark-Simulacrum Jun 12, 2020
399bf38
Disable clippy tests
Mark-Simulacrum Jun 15, 2020
b34a417
Add more info to `x.py build --help` on default value for `-j JOBS`.
pnkfelix Jun 15, 2020
71c54db
Fix typo in docs of std::mem
ratijas Jun 15, 2020
e8cf572
linker: Never pass `-no-pie` to non-gnu linkers
petrochenkov Jun 15, 2020
0e6c333
Use `Ipv4Addr::from<[u8; 4]>` when possible
tesuji Jun 16, 2020
c8a9c34
Auto merge of #72962 - lcnr:ObligationCause-lrc, r=ecstatic-morse
bors Jun 16, 2020
435f97c
Auto merge of #73285 - Mark-Simulacrum:clippy-fail, r=RalfJung,oli-obk
bors Jun 16, 2020
60410ef
Fix forge-platform-support URL
rnestler Jun 16, 2020
c65f39d
Rollup merge of #73237 - tmiasko:arena, r=nnethercote
Dylan-DPC Jun 16, 2020
5bbcdf5
Rollup merge of #73339 - jonas-schievink:unbug, r=estebank
Dylan-DPC Jun 16, 2020
6c44519
Rollup merge of #73372 - GuillaumeGomez:re-order-sidebar-sections, r=…
Dylan-DPC Jun 16, 2020
94105c2
Rollup merge of #73373 - lzutao:bug-trackcaller, r=Amanieu
Dylan-DPC Jun 16, 2020
66a1da3
Rollup merge of #73380 - pnkfelix:make-bootstrap-help-print-num-cpus,…
Dylan-DPC Jun 16, 2020
759547b
Rollup merge of #73381 - ratijas:fix-typo-std-mem, r=jonas-schievink
Dylan-DPC Jun 16, 2020
3c437e5
Rollup merge of #73389 - lzutao:from, r=kennytm
Dylan-DPC Jun 16, 2020
b4dd6a0
Rollup merge of #73400 - rnestler:patch-1, r=jonas-schievink
Dylan-DPC Jun 16, 2020
a647c0c
Auto merge of #73402 - Dylan-DPC:rollup-8udzpfu, r=Dylan-DPC
bors Jun 16, 2020
e8ff4bc
Auto merge of #73322 - Amanieu:asm-srcloc-llvm, r=cuviper
bors Jun 16, 2020
2935d29
Auto merge of #69890 - lenary:lenary/riscv-frame-pointers, r=hanna-kr…
bors Jun 17, 2020
7d16c1d
Auto merge of #73065 - Amanieu:tls-fix, r=oli-obk
bors Jun 18, 2020
e55d3f9
Auto merge of #73384 - petrochenkov:gnulink, r=cuviper
bors Jun 18, 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
2 changes: 1 addition & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@ Compatibility Notes
[`Duration::mul_f32`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.mul_f32
[`Duration::mul_f64`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.mul_f64
[`any::type_name`]: https://doc.rust-lang.org/std/any/fn.type_name.html
[forge-platform-support]: https://forge.rust-lang.org/platform-support.html
[forge-platform-support]: https://forge.rust-lang.org/release/platform-support.html
[pipeline-internals]: https://internals.rust-lang.org/t/evaluating-pipelined-rustc-compilation/10199

Version 1.37.0 (2019-08-15)
Expand Down
10 changes: 10 additions & 0 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,16 @@ pub fn std_cargo(builder: &Builder<'_>, target: Interned<String>, stage: u32, ca
if stage >= 1 {
cargo.rustflag("-Cembed-bitcode=yes");
}

// By default, rustc does not include unwind tables unless they are required
// for a particular target. They are not required by RISC-V targets, but
// compiling the standard library with them means that users can get
// backtraces without having to recompile the standard library themselves.
//
// This choice was discussed in https://github.com/rust-lang/rust/pull/69890
if target.contains("riscv") {
cargo.rustflag("-Cforce-unwind-tables=yes");
}
}

#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
Expand Down
7 changes: 6 additions & 1 deletion src/bootstrap/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,12 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`",
"N",
);
opts.optopt("", "src", "path to the root of the rust checkout", "DIR");
opts.optopt("j", "jobs", "number of jobs to run in parallel", "JOBS");
let j_msg = format!(
"number of jobs to run in parallel; \
defaults to {} (this host's logical CPU count)",
num_cpus::get()
);
opts.optopt("j", "jobs", &j_msg, "JOBS");
opts.optflag("h", "help", "print this help message");
opts.optopt(
"",
Expand Down
5 changes: 4 additions & 1 deletion src/bootstrap/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,10 @@ impl Step for Clippy {

builder.add_rustc_lib_path(compiler, &mut cargo);

builder.run(&mut cargo.into());
// FIXME: Disable clippy tests for now, they're failing on master
// (generally this would mean a toolstate failure but we don't have
// toolstate for clippy anymore).
// builder.run(&mut cargo.into());
}
}

Expand Down
12 changes: 12 additions & 0 deletions src/bootstrap/toolstate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,18 @@ impl Builder<'_> {
/// `rust.save-toolstates` in `config.toml`. If unspecified, nothing will be
/// done. The file is updated immediately after this function completes.
pub fn save_toolstate(&self, tool: &str, state: ToolState) {
// If we're in a dry run setting we don't want to save toolstates as
// that means if we e.g. panic down the line it'll look like we tested
// everything (but we actually haven't).
if self.config.dry_run {
return;
}
// Toolstate isn't tracked for clippy, but since most tools do, we avoid
// checking in all the places we could save toolstate and just do so
// here.
if tool == "clippy-driver" {
return;
}
if let Some(ref path) = self.config.save_toolstates {
if let Some(parent) = path.parent() {
// Ensure the parent directory always exists
Expand Down
4 changes: 3 additions & 1 deletion src/ci/docker/x86_64-gnu-tools/checktools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ python3 "$X_PY" test --no-fail-fast \
src/doc/rust-by-example \
src/doc/embedded-book \
src/doc/edition-guide \
src/tools/clippy \
src/tools/rls \
src/tools/rustfmt \
src/tools/miri \

set -e

# debugging: print out the saved toolstates
cat /tmp/toolstate/toolstates.json
python3 "$X_PY" test check-tools
python3 "$X_PY" test src/tools/clippy
2 changes: 1 addition & 1 deletion src/libcore/mem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ pub use crate::intrinsics::transmute;
/// erring on the side of (double-)dropping.
///
/// Also, `ManuallyDrop` prevents us from having to "touch" `v` after transferring the
/// ownership to `s` - the final step of interacting with `v` to dispoe of it without
/// ownership to `s` the final step of interacting with `v` to dispose of it without
/// running its destructor is entirely avoided.
///
/// [drop]: fn.drop.html
Expand Down
9 changes: 3 additions & 6 deletions src/libcore/panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ pub struct PanicInfo<'a> {
impl<'a> PanicInfo<'a> {
#[unstable(
feature = "panic_internals",
reason = "internal details of the implementation of the `panic!` \
and related macros",
reason = "internal details of the implementation of the `panic!` and related macros",
issue = "none"
)]
#[doc(hidden)]
Expand All @@ -55,8 +54,7 @@ impl<'a> PanicInfo<'a> {

#[unstable(
feature = "panic_internals",
reason = "internal details of the implementation of the `panic!` \
and related macros",
reason = "internal details of the implementation of the `panic!` and related macros",
issue = "none"
)]
#[doc(hidden)]
Expand Down Expand Up @@ -244,8 +242,7 @@ impl<'a> Location<'a> {
impl<'a> Location<'a> {
#![unstable(
feature = "panic_internals",
reason = "internal details of the implementation of the `panic!` \
and related macros",
reason = "internal details of the implementation of the `panic!` and related macros",
issue = "none"
)]
#[doc(hidden)]
Expand Down
3 changes: 1 addition & 2 deletions src/libcore/panicking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
#![allow(dead_code, missing_docs)]
#![unstable(
feature = "core_panic",
reason = "internal details of the implementation of the `panic!` \
and related macros",
reason = "internal details of the implementation of the `panic!` and related macros",
issue = "none"
)]

Expand Down
72 changes: 41 additions & 31 deletions src/librustc_arena/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,13 +333,6 @@ impl Default for DroplessArena {
}

impl DroplessArena {
#[inline]
fn align(&self, align: usize) {
let final_address = ((self.ptr.get() as usize) + align - 1) & !(align - 1);
self.ptr.set(final_address as *mut u8);
assert!(self.ptr <= self.end);
}

#[inline(never)]
#[cold]
fn grow(&self, additional: usize) {
Expand Down Expand Up @@ -370,30 +363,50 @@ impl DroplessArena {
}
}

/// Allocates a byte slice with specified size and alignment from the
/// current memory chunk. Returns `None` if there is no free space left to
/// satisfy the request.
#[inline]
pub fn alloc_raw(&self, bytes: usize, align: usize) -> &mut [u8] {
unsafe {
assert!(bytes != 0);

self.align(align);
fn alloc_raw_without_grow(&self, bytes: usize, align: usize) -> Option<*mut u8> {
let ptr = self.ptr.get() as usize;
let end = self.end.get() as usize;
// The allocation request fits into the current chunk iff:
//
// let aligned = align_to(ptr, align);
// ptr <= aligned && aligned + bytes <= end
//
// Except that we work with fixed width integers and need to be careful
// about potential overflow in the calcuation. If the overflow does
// happen, then we definitely don't have enough free and need to grow
// the arena.
let aligned = ptr.checked_add(align - 1)? & !(align - 1);
let new_ptr = aligned.checked_add(bytes)?;
if new_ptr <= end {
self.ptr.set(new_ptr as *mut u8);
Some(aligned as *mut u8)
} else {
None
}
}

let future_end = intrinsics::arith_offset(self.ptr.get(), bytes as isize);
if (future_end as *mut u8) > self.end.get() {
self.grow(bytes);
#[inline]
pub fn alloc_raw(&self, bytes: usize, align: usize) -> *mut u8 {
assert!(bytes != 0);
loop {
if let Some(a) = self.alloc_raw_without_grow(bytes, align) {
break a;
}

let ptr = self.ptr.get();
// Set the pointer past ourselves
self.ptr.set(intrinsics::arith_offset(self.ptr.get(), bytes as isize) as *mut u8);
slice::from_raw_parts_mut(ptr, bytes)
// No free space left. Allocate a new chunk to satisfy the request.
// On failure the grow will panic or abort.
self.grow(bytes);
}
}

#[inline]
pub fn alloc<T>(&self, object: T) -> &mut T {
assert!(!mem::needs_drop::<T>());

let mem = self.alloc_raw(mem::size_of::<T>(), mem::align_of::<T>()) as *mut _ as *mut T;
let mem = self.alloc_raw(mem::size_of::<T>(), mem::align_of::<T>()) as *mut T;

unsafe {
// Write into uninitialized memory.
Expand All @@ -418,13 +431,11 @@ impl DroplessArena {
assert!(mem::size_of::<T>() != 0);
assert!(!slice.is_empty());

let mem = self.alloc_raw(slice.len() * mem::size_of::<T>(), mem::align_of::<T>()) as *mut _
as *mut T;
let mem = self.alloc_raw(slice.len() * mem::size_of::<T>(), mem::align_of::<T>()) as *mut T;

unsafe {
let arena_slice = slice::from_raw_parts_mut(mem, slice.len());
arena_slice.copy_from_slice(slice);
arena_slice
mem.copy_from_nonoverlapping(slice.as_ptr(), slice.len());
slice::from_raw_parts_mut(mem, slice.len())
}
}

Expand Down Expand Up @@ -467,7 +478,7 @@ impl DroplessArena {
return &mut [];
}
let size = len.checked_mul(mem::size_of::<T>()).unwrap();
let mem = self.alloc_raw(size, mem::align_of::<T>()) as *mut _ as *mut T;
let mem = self.alloc_raw(size, mem::align_of::<T>()) as *mut T;
unsafe { self.write_from_iter(iter, len, mem) }
}
(_, _) => {
Expand All @@ -482,7 +493,7 @@ impl DroplessArena {
let len = vec.len();
let start_ptr = self
.alloc_raw(len * mem::size_of::<T>(), mem::align_of::<T>())
as *mut _ as *mut T;
as *mut T;
vec.as_ptr().copy_to_nonoverlapping(start_ptr, len);
vec.set_len(0);
slice::from_raw_parts_mut(start_ptr, len)
Expand Down Expand Up @@ -526,8 +537,7 @@ pub struct DropArena {
impl DropArena {
#[inline]
pub unsafe fn alloc<T>(&self, object: T) -> &mut T {
let mem =
self.arena.alloc_raw(mem::size_of::<T>(), mem::align_of::<T>()) as *mut _ as *mut T;
let mem = self.arena.alloc_raw(mem::size_of::<T>(), mem::align_of::<T>()) as *mut T;
// Write into uninitialized memory.
ptr::write(mem, object);
let result = &mut *mem;
Expand All @@ -550,7 +560,7 @@ impl DropArena {
let start_ptr = self
.arena
.alloc_raw(len.checked_mul(mem::size_of::<T>()).unwrap(), mem::align_of::<T>())
as *mut _ as *mut T;
as *mut T;

let mut destructors = self.destructors.borrow_mut();
// Reserve space for the destructors so we can't panic while adding them
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_codegen_ssa/back/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ impl<'a> Linker for GccLinker<'a> {
fn set_output_kind(&mut self, output_kind: LinkOutputKind, out_filename: &Path) {
match output_kind {
LinkOutputKind::DynamicNoPicExe => {
if !self.is_ld {
if !self.is_ld && self.sess.target.target.options.linker_is_gnu {
self.cmd.arg("-no-pie");
}
}
Expand All @@ -291,7 +291,7 @@ impl<'a> Linker for GccLinker<'a> {
LinkOutputKind::StaticNoPicExe => {
// `-static` works for both gcc wrapper and ld.
self.cmd.arg("-static");
if !self.is_ld {
if !self.is_ld && self.sess.target.target.options.linker_is_gnu {
self.cmd.arg("-no-pie");
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_infer/traits/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub type TraitObligation<'tcx> = Obligation<'tcx, ty::PolyTraitPredicate<'tcx>>;

// `PredicateObligation` is used a lot. Make sure it doesn't unintentionally get bigger.
#[cfg(target_arch = "x86_64")]
static_assert_size!(PredicateObligation<'_>, 88);
static_assert_size!(PredicateObligation<'_>, 48);

pub type Obligations<'tcx, O> = Vec<Obligation<'tcx, O>>;
pub type PredicateObligations<'tcx> = Vec<PredicateObligation<'tcx>>;
Expand Down
10 changes: 6 additions & 4 deletions src/librustc_infer/traits/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,12 @@ fn predicate_obligation<'tcx>(
predicate: ty::Predicate<'tcx>,
span: Option<Span>,
) -> PredicateObligation<'tcx> {
let mut cause = ObligationCause::dummy();
if let Some(span) = span {
cause.span = span;
}
let cause = if let Some(span) = span {
ObligationCause::dummy_with_span(span)
} else {
ObligationCause::dummy()
};

Obligation { cause, param_env: ty::ParamEnv::empty(), recursion_depth: 0, predicate }
}

Expand Down
18 changes: 11 additions & 7 deletions src/librustc_middle/macros.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
#[macro_export]
macro_rules! bug {
() => ( bug!("impossible case reached") );
($($message:tt)*) => ({
$crate::util::bug::bug_fmt(file!(), line!(), format_args!($($message)*))
})
() => ( $crate::bug!("impossible case reached") );
($msg:expr) => ({ $crate::util::bug::bug_fmt(::std::format_args!($msg)) });
($msg:expr,) => ({ $crate::bug!($msg) });
($fmt:expr, $($arg:tt)+) => ({
$crate::util::bug::bug_fmt(::std::format_args!($fmt, $($arg)+))
});
}

#[macro_export]
macro_rules! span_bug {
($span:expr, $($message:tt)*) => ({
$crate::util::bug::span_bug_fmt(file!(), line!(), $span, format_args!($($message)*))
})
($span:expr, $msg:expr) => ({ $crate::util::bug::span_bug_fmt($span, ::std::format_args!($msg)) });
($span:expr, $msg:expr,) => ({ $crate::span_bug!($span, $msg) });
($span:expr, $fmt:expr, $($arg:tt)+) => ({
$crate::util::bug::span_bug_fmt($span, ::std::format_args!($fmt, $($arg)+))
});
}

///////////////////////////////////////////////////////////////////////////
Expand Down
Loading