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 13 pull requests #74205

Closed
wants to merge 33 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
fb9fa5b
adjust ub-enum test to be endianess-independent
RalfJung Jul 3, 2020
bcef848
Explain effects of debugging options from config.toml
tmiasko Jul 5, 2020
6b59cac
Suppress debuginfo on naked function arguments
npmccallum Jul 6, 2020
5702e02
Only allow `repr(i128/u128)` on enum
nbdd0121 Jul 6, 2020
97867bb
Add UI test for issue 74082
nbdd0121 Jul 6, 2020
b50c13c
Update books
ehuss Jul 7, 2020
32025fd
Update rust-installer to latest version
michaelforney May 25, 2020
653c091
Add `read_exact_at` and `write_all_at` to WASI's `FileExt`
sunfishcode Jul 3, 2020
58fc61b
Make WASI's FileExt's read_at/write_at consistent with other targets.
sunfishcode Jul 7, 2020
3c63fba
Correctly mark the ending span of a match arm
ayazhafiz Jul 7, 2020
59f979f
Fix cross-compilation of LLVM to aarch64 Windows targets
arlosi Jul 2, 2020
51b646e
ci: disabled: riscv: minimise docker overlays
tblah Jul 8, 2020
d9fec59
ci: fix context for disabled docker images
tblah Jul 8, 2020
7fb421b
linker: illumos ld does not support --eh-frame-hdr
jclulow Jul 8, 2020
6864546
Add a help to use `in_band_lifetimes` in nightly
JohnTitor Jul 8, 2020
a9b6476
Tweak wording
JohnTitor Jul 9, 2020
0a7d297
Eliminate `rust_input`.
nnethercote Jul 7, 2020
1e8ec2d
Add an explanatory comment to `scoped_thread`.
nnethercote Jul 7, 2020
4ad5de2
Tweak `spawn_thread_pool`.
nnethercote Jul 7, 2020
059d6cf
Change some function names.
nnethercote Jul 7, 2020
25d31e9
Rollup merge of #73989 - RalfJung:ub-enum-test, r=oli-obk
Manishearth Jul 10, 2020
bc3db83
Rollup merge of #74045 - tmiasko:config-debug, r=nikomatsakis
Manishearth Jul 10, 2020
a316f51
Rollup merge of #74076 - sunfishcode:wasi-fileext-newmethods, r=alexc…
Manishearth Jul 10, 2020
86b2224
Rollup merge of #74105 - npmccallum:naked, r=matthewjasper
Manishearth Jul 10, 2020
5fa4d01
Rollup merge of #74109 - nbdd0121:issue-74082, r=petrochenkov
Manishearth Jul 10, 2020
c7ab962
Rollup merge of #74116 - arlosi:aarch64build, r=pietroalbini
Manishearth Jul 10, 2020
7ad0e69
Rollup merge of #74122 - nnethercote:startup-cleanup, r=petrochenkov
Manishearth Jul 10, 2020
82fa122
Rollup merge of #74125 - ayazhafiz:i/74050, r=matthewjasper
Manishearth Jul 10, 2020
9db22e6
Rollup merge of #74135 - ehuss:update-books, r=ehuss
Manishearth Jul 10, 2020
4476eb3
Rollup merge of #74145 - michaelforney:rust-installer, r=Mark-Simulacrum
Manishearth Jul 10, 2020
8821c49
Rollup merge of #74161 - tblah:riscv64gc-dockerfile-improvment, r=Mar…
Manishearth Jul 10, 2020
fdb5f7c
Rollup merge of #74167 - jclulow:illumos-linker-eh-frame-hdr-fix, r=p…
Manishearth Jul 10, 2020
e84c903
Rollup merge of #74168 - JohnTitor:help-for-in-band-lifetimes, r=petr…
Manishearth Jul 10, 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
6 changes: 3 additions & 3 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -404,9 +404,9 @@ version = "0.1.0"

[[package]]
name = "cc"
version = "1.0.54"
version = "1.0.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7bbb73db36c1246e9034e307d0fba23f9a2e251faa47ade70c1bd252220c8311"
checksum = "0fde55d2a2bfaa4c9668bbc63f531fbdeee3ffe188f4662511ce2c22b3eedebe"
dependencies = [
"jobserver",
]
Expand Down Expand Up @@ -1366,8 +1366,8 @@ checksum = "7e81a7c05f79578dbc15793d8b619db9ba32b4577003ef3af1a91c416798c58d"
name = "installer"
version = "0.0.0"
dependencies = [
"anyhow",
"clap",
"failure",
"flate2",
"lazy_static",
"num_cpus",
Expand Down
8 changes: 6 additions & 2 deletions config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,9 @@
#codegen-units-std = 1

# Whether or not debug assertions are enabled for the compiler and standard
# library.
# library. Debug assertions control the maximum log level used by rustc. When
# enabled calls to `trace!` and `debug!` macros are preserved in the compiled
# binary, otherwise they are omitted.
#
# Defaults to rust.debug value
#debug-assertions = false
Expand All @@ -331,7 +333,9 @@

# Debuginfo level for most of Rust code, corresponds to the `-C debuginfo=N` option of `rustc`.
# `0` - no debug info
# `1` - line tables only
# `1` - line tables only - sufficient to generate backtraces that include line
# information and inlined functions, set breakpoints at source code
# locations, and step through execution in a debugger.
# `2` - full debug info with variable and type information
# Can be overridden for specific subsets of Rust code (rustc, std or tools).
# Debuginfo for tests run with compiletest is not controlled by this option
Expand Down
31 changes: 23 additions & 8 deletions src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
//! ensure that they're always in place if needed.

use std::env;
use std::env::consts::EXE_EXTENSION;
use std::ffi::OsString;
use std::fs::{self, File};
use std::io;
Expand Down Expand Up @@ -252,8 +253,14 @@ impl Step for Llvm {
// FIXME: if the llvm root for the build triple is overridden then we
// should use llvm-tblgen from there, also should verify that it
// actually exists most of the time in normal installs of LLVM.
let host = builder.llvm_out(builder.config.build).join("bin/llvm-tblgen");
cfg.define("CMAKE_CROSSCOMPILING", "True").define("LLVM_TABLEGEN", &host);
let host_bin = builder.llvm_out(builder.config.build).join("bin");
cfg.define("CMAKE_CROSSCOMPILING", "True");
cfg.define("LLVM_TABLEGEN", host_bin.join("llvm-tblgen").with_extension(EXE_EXTENSION));
cfg.define("LLVM_NM", host_bin.join("llvm-nm").with_extension(EXE_EXTENSION));
cfg.define(
"LLVM_CONFIG_PATH",
host_bin.join("llvm-config").with_extension(EXE_EXTENSION),
);

if target.contains("netbsd") {
cfg.define("CMAKE_SYSTEM_NAME", "NetBSD");
Expand All @@ -262,8 +269,6 @@ impl Step for Llvm {
} else if target.contains("windows") {
cfg.define("CMAKE_SYSTEM_NAME", "Windows");
}

cfg.define("LLVM_NATIVE_BUILD", builder.llvm_out(builder.config.build).join("build"));
}

if let Some(ref suffix) = builder.config.llvm_version_suffix {
Expand Down Expand Up @@ -431,6 +436,9 @@ fn configure_cmake(
cflags.push_str(" -miphoneos-version-min=10.0");
}
}
if builder.config.llvm_clang_cl.is_some() {
cflags.push_str(&format!(" --target={}", target))
}
cfg.define("CMAKE_C_FLAGS", cflags);
let mut cxxflags = builder.cflags(target, GitRepo::Llvm).join(" ");
if builder.config.llvm_static_stdcpp && !target.contains("msvc") && !target.contains("netbsd") {
Expand All @@ -439,6 +447,9 @@ fn configure_cmake(
if let Some(ref s) = builder.config.llvm_cxxflags {
cxxflags.push_str(&format!(" {}", s));
}
if builder.config.llvm_clang_cl.is_some() {
cxxflags.push_str(&format!(" --target={}", target))
}
cfg.define("CMAKE_CXX_FLAGS", cxxflags);
if let Some(ar) = builder.ar(target) {
if ar.is_absolute() {
Expand Down Expand Up @@ -484,7 +495,7 @@ impl Step for Lld {
run.builder.ensure(Lld { target: run.target });
}

/// Compile LLVM for `target`.
/// Compile LLD for `target`.
fn run(self, builder: &Builder<'_>) -> PathBuf {
if builder.config.dry_run {
return PathBuf::from("lld-out-dir-test-gen");
Expand Down Expand Up @@ -521,6 +532,7 @@ impl Step for Lld {
// can't build on a system where your paths require `\` on Windows, but
// there's probably a lot of reasons you can't do that other than this.
let llvm_config_shim = env::current_exe().unwrap().with_file_name("llvm-config-wrapper");

cfg.out_dir(&out_dir)
.profile("Release")
.env("LLVM_CONFIG_REAL", &llvm_config)
Expand All @@ -543,7 +555,10 @@ impl Step for Lld {
if target != builder.config.build {
cfg.env("LLVM_CONFIG_SHIM_REPLACE", &builder.config.build)
.env("LLVM_CONFIG_SHIM_REPLACE_WITH", &target)
.define("LLVM_TABLEGEN_EXE", llvm_config.with_file_name("llvm-tblgen"));
.define(
"LLVM_TABLEGEN_EXE",
llvm_config.with_file_name("llvm-tblgen").with_extension(EXE_EXTENSION),
);
}

// Explicitly set C++ standard, because upstream doesn't do so
Expand Down Expand Up @@ -595,8 +610,8 @@ impl Step for TestHelpers {
}

// We may have found various cross-compilers a little differently due to our
// extra configuration, so inform gcc of these compilers. Note, though, that
// on MSVC we still need gcc's detection of env vars (ugh).
// extra configuration, so inform cc of these compilers. Note, though, that
// on MSVC we still need cc's detection of env vars (ugh).
if !target.contains("msvc") {
if let Some(ar) = builder.ar(target) {
cfg.archiver(ar);
Expand Down
6 changes: 3 additions & 3 deletions src/ci/docker/host-x86_64/disabled/riscv64gc-linux/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ RUN curl https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.6.16.tar.xz | tar
cp linux.config linux-5.6.16/.config && \
cd /build/linux-5.6.16 && \
make olddefconfig && \
make -j$(nproc) vmlinux
RUN cp linux-5.6.16/vmlinux /tmp
RUN rm -rf linux-5.6.16
make -j$(nproc) vmlinux && \
cp vmlinux /tmp && \
rm -rf linux-5.6.16

# Compile an instance of busybox as this provides a lightweight system and init
# binary which we will boot into. Only trick here is configuring busybox to
Expand Down
4 changes: 2 additions & 2 deletions src/ci/docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@ elif [ -f "$docker_dir/disabled/$image/Dockerfile" ]; then
exit 1
fi
# Transform changes the context of disabled Dockerfiles to match the enabled ones
tar --transform 's#^./disabled/#./#' -C $docker_dir -c . | docker \
tar --transform 's#disabled/#./#' -C $script_dir -c . | docker \
build \
--rm \
-t rust-ci \
-f "$image/Dockerfile" \
-f "host-$(uname -m)/$image/Dockerfile" \
-
else
echo Invalid image: $image
Expand Down
2 changes: 1 addition & 1 deletion src/doc/book
2 changes: 1 addition & 1 deletion src/doc/embedded-book
2 changes: 1 addition & 1 deletion src/doc/reference
2 changes: 1 addition & 1 deletion src/doc/rust-by-example
2 changes: 1 addition & 1 deletion src/librustc_codegen_ssa/back/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -621,9 +621,9 @@ impl<'a> Linker for GccLinker<'a> {
// Some versions of `gcc` add it implicitly, some (e.g. `musl-gcc`) don't,
// so we just always add it.
fn add_eh_frame_header(&mut self) {
// The condition here is "uses ELF" basically.
if !self.sess.target.target.options.is_like_osx
&& !self.sess.target.target.options.is_like_windows
&& !self.sess.target.target.options.is_like_solaris
&& self.sess.target.target.target_os != "uefi"
{
self.linker_arg("--eh-frame-hdr");
Expand Down
16 changes: 8 additions & 8 deletions src/librustc_interface/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,7 @@ pub struct Config {
pub registry: Registry,
}

pub fn run_compiler_in_existing_thread_pool<R>(
config: Config,
f: impl FnOnce(&Compiler) -> R,
) -> R {
pub fn create_compiler_and_run<R>(config: Config, f: impl FnOnce(&Compiler) -> R) -> R {
let registry = &config.registry;
let (sess, codegen_backend) = util::create_session(
config.opts,
Expand Down Expand Up @@ -204,17 +201,20 @@ pub fn run_compiler_in_existing_thread_pool<R>(
pub fn run_compiler<R: Send>(mut config: Config, f: impl FnOnce(&Compiler) -> R + Send) -> R {
log::trace!("run_compiler");
let stderr = config.stderr.take();
util::spawn_thread_pool(
util::setup_callbacks_and_run_in_thread_pool_with_globals(
config.opts.edition,
config.opts.debugging_opts.threads,
&stderr,
|| run_compiler_in_existing_thread_pool(config, f),
|| create_compiler_and_run(config, f),
)
}

pub fn default_thread_pool<R: Send>(edition: edition::Edition, f: impl FnOnce() -> R + Send) -> R {
pub fn setup_callbacks_and_run_in_default_thread_pool_with_globals<R: Send>(
edition: edition::Edition,
f: impl FnOnce() -> R + Send,
) -> R {
// the 1 here is duplicating code in config.opts.debugging_opts.threads
// which also defaults to 1; it ultimately doesn't matter as the default
// isn't threaded, and just ignores this parameter
util::spawn_thread_pool(edition, 1, &None, f)
util::setup_callbacks_and_run_in_thread_pool_with_globals(edition, 1, &None, f)
}
29 changes: 16 additions & 13 deletions src/librustc_interface/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ impl Write for Sink {
}
}

/// Like a `thread::Builder::spawn` followed by a `join()`, but avoids the need
/// for `'static` bounds.
#[cfg(not(parallel_compiler))]
pub fn scoped_thread<F: FnOnce() -> R + Send, R: Send>(cfg: thread::Builder, f: F) -> R {
struct Ptr(*mut ());
Expand All @@ -126,7 +128,7 @@ pub fn scoped_thread<F: FnOnce() -> R + Send, R: Send>(cfg: thread::Builder, f:
}

#[cfg(not(parallel_compiler))]
pub fn spawn_thread_pool<F: FnOnce() -> R + Send, R: Send>(
pub fn setup_callbacks_and_run_in_thread_pool_with_globals<F: FnOnce() -> R + Send, R: Send>(
edition: Edition,
_threads: usize,
stderr: &Option<Arc<Mutex<Vec<u8>>>>,
Expand All @@ -140,7 +142,7 @@ pub fn spawn_thread_pool<F: FnOnce() -> R + Send, R: Send>(

crate::callbacks::setup_callbacks();

scoped_thread(cfg, || {
let main_handler = move || {
rustc_ast::with_session_globals(edition, || {
ty::tls::GCX_PTR.set(&Lock::new(0), || {
if let Some(stderr) = stderr {
Expand All @@ -149,22 +151,21 @@ pub fn spawn_thread_pool<F: FnOnce() -> R + Send, R: Send>(
f()
})
})
})
};

scoped_thread(cfg, main_handler)
}

#[cfg(parallel_compiler)]
pub fn spawn_thread_pool<F: FnOnce() -> R + Send, R: Send>(
pub fn setup_callbacks_and_run_in_thread_pool_with_globals<F: FnOnce() -> R + Send, R: Send>(
edition: Edition,
threads: usize,
stderr: &Option<Arc<Mutex<Vec<u8>>>>,
f: F,
) -> R {
use rayon::{ThreadBuilder, ThreadPool, ThreadPoolBuilder};

let gcx_ptr = &Lock::new(0);
crate::callbacks::setup_callbacks();

let mut config = ThreadPoolBuilder::new()
let mut config = rayon::ThreadPoolBuilder::new()
.thread_name(|_| "rustc".to_string())
.acquire_thread_handler(jobserver::acquire_thread)
.release_thread_handler(jobserver::release_thread)
Expand All @@ -175,7 +176,7 @@ pub fn spawn_thread_pool<F: FnOnce() -> R + Send, R: Send>(
config = config.stack_size(size);
}

let with_pool = move |pool: &ThreadPool| pool.install(move || f());
let with_pool = move |pool: &rayon::ThreadPool| pool.install(move || f());

rustc_ast::with_session_globals(edition, || {
rustc_ast::SESSION_GLOBALS.with(|ast_session_globals| {
Expand All @@ -188,10 +189,12 @@ pub fn spawn_thread_pool<F: FnOnce() -> R + Send, R: Send>(
let main_handler = move |thread: ThreadBuilder| {
rustc_ast::SESSION_GLOBALS.set(ast_session_globals, || {
rustc_span::SESSION_GLOBALS.set(span_session_globals, || {
if let Some(stderr) = stderr {
io::set_panic(Some(box Sink(stderr.clone())));
}
ty::tls::GCX_PTR.set(gcx_ptr, || thread.run())
ty::tls::GCX_PTR.set(&Lock::new(0), || {
if let Some(stderr) = stderr {
io::set_panic(Some(box Sink(stderr.clone())));
}
thread.run()
})
})
})
};
Expand Down
12 changes: 11 additions & 1 deletion src/librustc_mir_build/build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use rustc_hir::lang_items;
use rustc_hir::{GeneratorKind, HirIdMap, Node};
use rustc_index::vec::{Idx, IndexVec};
use rustc_infer::infer::TyCtxtInferExt;
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
use rustc_middle::middle::region;
use rustc_middle::mir::*;
use rustc_middle::ty::subst::Subst;
Expand Down Expand Up @@ -790,12 +791,22 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
argument_scope: region::Scope,
ast_body: &'tcx hir::Expr<'tcx>,
) -> BlockAnd<()> {
let tcx = self.hir.tcx();
let attrs = tcx.codegen_fn_attrs(fn_def_id);
let naked = attrs.flags.contains(CodegenFnAttrFlags::NAKED);

// Allocate locals for the function arguments
for &ArgInfo(ty, _, arg_opt, _) in arguments.iter() {
let source_info =
SourceInfo::outermost(arg_opt.map_or(self.fn_span, |arg| arg.pat.span));
let arg_local = self.local_decls.push(LocalDecl::with_source_info(ty, source_info));

// Emit function argument debuginfo only for non-naked functions.
// See: https://github.com/rust-lang/rust/issues/42779
if naked {
continue;
}

// If this is a simple binding pattern, give debuginfo a nice name.
if let Some(arg) = arg_opt {
if let Some(ident) = arg.pat.simple_ident() {
Expand All @@ -808,7 +819,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
}
}

let tcx = self.hir.tcx();
let tcx_hir = tcx.hir();
let hir_tables = self.hir.tables();

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_parse/parser/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1790,7 +1790,7 @@ impl<'a> Parser<'a> {
let require_comma = classify::expr_requires_semi_to_be_stmt(&expr)
&& self.token != token::CloseDelim(token::Brace);

let hi = self.token.span;
let hi = self.prev_token.span;

if require_comma {
let sm = self.sess.source_map();
Expand Down
2 changes: 2 additions & 0 deletions src/librustc_passes/check_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@ impl CheckAttrVisitor<'tcx> {
| sym::u32
| sym::i64
| sym::u64
| sym::i128
| sym::u128
| sym::isize
| sym::usize => {
int_reprs += 1;
Expand Down
11 changes: 11 additions & 0 deletions src/librustc_resolve/late/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1044,6 +1044,7 @@ impl<'tcx> LifetimeContext<'_, 'tcx> {
lifetime_ref
);
err.span_label(lifetime_ref.span, "undeclared lifetime");
let mut suggests_in_band = false;
for missing in &self.missing_named_lifetime_spots {
match missing {
MissingLifetimeSpot::Generics(generics) => {
Expand All @@ -1057,6 +1058,7 @@ impl<'tcx> LifetimeContext<'_, 'tcx> {
}) {
(param.span.shrink_to_lo(), format!("{}, ", lifetime_ref))
} else {
suggests_in_band = true;
(generics.span, format!("<{}>", lifetime_ref))
};
err.span_suggestion(
Expand Down Expand Up @@ -1084,6 +1086,15 @@ impl<'tcx> LifetimeContext<'_, 'tcx> {
}
}
}
if nightly_options::is_nightly_build()
&& !self.tcx.features().in_band_lifetimes
&& suggests_in_band
{
err.help(
"if you want to experiment with in-band lifetime bindings, \
add `#![feature(in_band_lifetimes)]` to the crate attributes",
);
}
err.emit();
}

Expand Down
Loading