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 7 pull requests #60001

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
4 changes: 1 addition & 3 deletions src/bootstrap/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,7 @@ fn main() {
}

// This is required for internal lints.
if stage != "0" {
cmd.arg("-Zunstable-options");
}
cmd.arg("-Zunstable-options");

// Force all crates compiled by this compiler to (a) be unstable and (b)
// allow the `rustc_private` feature to link to other unstable crates
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use build_helper::output;
use crate::Build;

// The version number
pub const CFG_RELEASE_NUM: &str = "1.35.0";
pub const CFG_RELEASE_NUM: &str = "1.36.0";

pub struct GitInfo {
inner: Option<Info>,
Expand Down
2 changes: 0 additions & 2 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1125,8 +1125,6 @@ impl Build {
/// `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) {
use std::io::{Seek, SeekFrom};

if let Some(ref path) = self.config.save_toolstates {
let mut file = t!(fs::OpenOptions::new()
.create(true)
Expand Down
2 changes: 1 addition & 1 deletion src/libarena/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
test(no_crate_inject, attr(deny(warnings))))]

#![deny(rust_2018_idioms)]
#![cfg_attr(not(stage0), deny(internal))]
#![deny(internal)]

#![feature(core_intrinsics)]
#![feature(dropck_eyepatch)]
Expand Down
7 changes: 3 additions & 4 deletions src/libcore/hint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ use intrinsics;
/// difficult-to-debug problems.
///
/// Use this function only when you can prove that the code will never call it.
/// Otherwise, consider using the [`unreachable!`] macro, which does not allow
/// optimizations but will panic when executed.
///
/// The [`unreachable!()`] macro is the safe counterpart of this function, which
/// will panic instead when executed.
///
/// [`unreachable!()`]: ../macro.unreachable.html
/// [`unreachable!`]: ../macro.unreachable.html
///
/// # Example
///
Expand Down
2 changes: 1 addition & 1 deletion src/libfmt_macros/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
test(attr(deny(warnings))))]

#![deny(rust_2018_idioms)]
#![cfg_attr(not(stage0), deny(internal))]
#![deny(internal)]

#![feature(nll)]
#![feature(rustc_private)]
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]

#![deny(rust_2018_idioms)]
#![cfg_attr(not(stage0), deny(internal))]
#![deny(internal)]
#![allow(explicit_outlives_requirements)]

#![feature(arbitrary_self_types)]
Expand Down
1 change: 0 additions & 1 deletion src/librustc/middle/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ fn configure_main(
err.span_note(span, "here is a function named 'main'");
}
err.emit();
tcx.sess.abort_if_errors();
} else {
if let Some(ref filename) = tcx.sess.local_crate_source_file {
err.note(&format!("consider adding a `main` function to `{}`", filename.display()));
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![cfg_attr(not(stage0), allow(usage_of_ty_tykind))]
#![allow(usage_of_ty_tykind)]

pub use self::Variance::*;
pub use self::AssociatedItemContainer::*;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_allocator/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#![feature(rustc_private)]

#![deny(rust_2018_idioms)]
#![cfg_attr(not(stage0), deny(internal))]
#![deny(internal)]

pub mod expand;

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_borrowck/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#![allow(non_camel_case_types)]
#![deny(rust_2018_idioms)]
#![cfg_attr(not(stage0), deny(internal))]
#![deny(internal)]

#![feature(nll)]

Expand Down
23 changes: 8 additions & 15 deletions src/librustc_codegen_ssa/back/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,25 +372,18 @@ impl<'a> Linker for GccLinker<'a> {
}

fn export_symbols(&mut self, tmpdir: &Path, crate_type: CrateType) {
// If we're compiling a dylib, then we let symbol visibility in object
// files to take care of whether they're exported or not.
//
// If we're compiling a cdylib, however, we manually create a list of
// exported symbols to ensure we don't expose any more. The object files
// have far more public symbols than we actually want to export, so we
// hide them all here.
if crate_type == CrateType::Dylib ||
crate_type == CrateType::ProcMacro {
return
}
// We manually create a list of exported symbols to ensure we don't expose any more.
// The object files have far more public symbols than we actually want to export,
// so we hide them all here.

// Symbol visibility takes care of this for the WebAssembly.
// Additionally the only known linker, LLD, doesn't support the script
// arguments just yet
if self.sess.target.target.arch == "wasm32" {
if !self.sess.target.target.options.limit_rdylib_exports {
return;
}

if crate_type == CrateType::ProcMacro {
return
}

let mut arg = OsString::new();
let path = tmpdir.join("list");

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_codegen_ssa/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#![allow(unused_attributes)]
#![allow(dead_code)]
#![deny(rust_2018_idioms)]
#![cfg_attr(not(stage0), deny(internal))]
#![deny(internal)]
#![allow(explicit_outlives_requirements)]

#![recursion_limit="256"]
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_codegen_utils/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#![recursion_limit="256"]

#![deny(rust_2018_idioms)]
#![cfg_attr(not(stage0), deny(internal))]
#![deny(internal)]

#[macro_use]
extern crate rustc;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_driver/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#![recursion_limit="256"]

#![deny(rust_2018_idioms)]
#![cfg_attr(not(stage0), deny(internal))]
#![deny(internal)]

pub extern crate getopts;
#[cfg(unix)]
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_errors/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#![feature(nll)]
#![feature(optin_builtin_traits)]
#![deny(rust_2018_idioms)]
#![cfg_attr(not(stage0), deny(internal))]
#![deny(internal)]

#[allow(unused_extern_crates)]
extern crate serialize as rustc_serialize; // used by deriving
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_incremental/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#![recursion_limit="256"]

#![deny(rust_2018_idioms)]
#![cfg_attr(not(stage0), deny(internal))]
#![deny(internal)]

#[macro_use] extern crate rustc;
#[allow(unused_extern_crates)]
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_interface/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#![cfg_attr(unix, feature(libc))]

#![deny(rust_2018_idioms)]
#![cfg_attr(not(stage0), deny(internal))]
#![deny(internal)]

#![allow(unused_imports)]

Expand Down
8 changes: 6 additions & 2 deletions src/librustc_interface/passes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -886,10 +886,11 @@ fn analysis<'tcx>(
assert_eq!(cnum, LOCAL_CRATE);

let sess = tcx.sess;
let mut entry_point = None;

time(sess, "misc checking 1", || {
parallel!({
time(sess, "looking for entry point", || {
entry_point = time(sess, "looking for entry point", || {
middle::entry::find_entry_point(tcx)
});

Expand Down Expand Up @@ -937,7 +938,10 @@ fn analysis<'tcx>(

// Abort so we don't try to construct MIR with liveness errors.
// We also won't want to continue with errors from rvalue promotion
tcx.sess.abort_if_errors();
// We only do so if the only error found so far *isn't* a missing `fn main()`
if !(entry_point.is_none() && sess.err_count() == 1) {
tcx.sess.abort_if_errors();
}

time(sess, "borrow checking", || {
if tcx.use_ast_borrowck() {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_lint/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#![recursion_limit="256"]

#![deny(rust_2018_idioms)]
#![cfg_attr(not(stage0), deny(internal))]
#![deny(internal)]

#[macro_use]
extern crate rustc;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_metadata/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#![recursion_limit="256"]

#![deny(rust_2018_idioms)]
#![cfg_attr(not(stage0), deny(internal))]
#![deny(internal)]

extern crate libc;
#[allow(unused_extern_crates)]
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
#![recursion_limit="256"]

#![deny(rust_2018_idioms)]
#![cfg_attr(not(stage0), deny(internal))]
#![deny(internal)]
#![allow(explicit_outlives_requirements)]

#[macro_use] extern crate log;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_passes/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#![recursion_limit="256"]

#![deny(rust_2018_idioms)]
#![cfg_attr(not(stage0), deny(internal))]
#![deny(internal)]

#[macro_use]
extern crate rustc;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_privacy/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]

#![deny(rust_2018_idioms)]
#![cfg_attr(not(stage0), deny(internal))]
#![deny(internal)]

#![feature(nll)]
#![feature(rustc_diagnostic_macros)]
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#![recursion_limit="256"]

#![deny(rust_2018_idioms)]
#![cfg_attr(not(stage0), deny(internal))]
#![deny(internal)]

pub use rustc::hir::def::{Namespace, PerNS};

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_save_analysis/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#![feature(custom_attribute)]
#![feature(nll)]
#![deny(rust_2018_idioms)]
#![cfg_attr(not(stage0), deny(internal))]
#![deny(internal)]
#![allow(unused_attributes)]

#![recursion_limit="256"]
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_target/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#![feature(step_trait)]

#![deny(rust_2018_idioms)]
#![cfg_attr(not(stage0), deny(internal))]
#![deny(internal)]

#[macro_use] extern crate log;

Expand Down
6 changes: 6 additions & 0 deletions src/librustc_target/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,9 @@ pub struct TargetOptions {
/// wasm32 where the whole program either has simd or not.
pub simd_types_indirect: bool,

/// Pass a list of symbol which should be exported in the dylib to the linker.
pub limit_rdylib_exports: bool,

/// If set, have the linker export exactly these symbols, instead of using
/// the usual logic to figure this out from the crate itself.
pub override_export_symbols: Option<Vec<String>>,
Expand Down Expand Up @@ -846,6 +849,7 @@ impl Default for TargetOptions {
emit_debug_gdb_scripts: true,
requires_uwtable: false,
simd_types_indirect: true,
limit_rdylib_exports: true,
override_export_symbols: None,
merge_functions: MergeFunctions::Aliases,
target_mcount: "mcount".to_string(),
Expand Down Expand Up @@ -1152,6 +1156,7 @@ impl Target {
key!(emit_debug_gdb_scripts, bool);
key!(requires_uwtable, bool);
key!(simd_types_indirect, bool);
key!(limit_rdylib_exports, bool);
key!(override_export_symbols, opt_list);
key!(merge_functions, MergeFunctions)?;
key!(target_mcount);
Expand Down Expand Up @@ -1367,6 +1372,7 @@ impl ToJson for Target {
target_option_val!(emit_debug_gdb_scripts);
target_option_val!(requires_uwtable);
target_option_val!(simd_types_indirect);
target_option_val!(limit_rdylib_exports);
target_option_val!(override_export_symbols);
target_option_val!(merge_functions);
target_option_val!(target_mcount);
Expand Down
1 change: 1 addition & 0 deletions src/librustc_target/spec/solaris_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ pub fn opts() -> TargetOptions {
has_rpath: true,
target_family: Some("unix".to_string()),
is_like_solaris: true,
limit_rdylib_exports: false, // Linker doesn't support this

.. Default::default()
}
Expand Down
5 changes: 5 additions & 0 deletions src/librustc_target/spec/wasm32_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ pub fn options() -> TargetOptions {
// no dynamic linking, no need for default visibility!
default_hidden_visibility: true,

// Symbol visibility takes care of this for the WebAssembly.
// Additionally the only known linker, LLD, doesn't support the script
// arguments just yet
limit_rdylib_exports: false,

// we use the LLD shipped with the Rust toolchain by default
linker: Some("rust-lld".to_owned()),
lld_flavor: LldFlavor::Wasm,
Expand Down
1 change: 1 addition & 0 deletions src/librustc_target/spec/wasm32_experimental_emscripten.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ pub fn target() -> Result<Target, String> {
is_like_emscripten: true,
max_atomic_width: Some(32),
post_link_args,
limit_rdylib_exports: false,
target_family: Some("unix".to_string()),
.. Default::default()
};
Expand Down
1 change: 1 addition & 0 deletions src/librustc_target/spec/wasm32_unknown_emscripten.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ pub fn target() -> Result<Target, String> {
is_like_emscripten: true,
max_atomic_width: Some(32),
post_link_args,
limit_rdylib_exports: false,
target_family: Some("unix".to_string()),
codegen_backend: "emscripten".to_string(),
.. Default::default()
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_traits/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//! the guts are broken up into modules; see the comments in those modules.

#![deny(rust_2018_idioms)]
#![cfg_attr(not(stage0), deny(internal))]
#![deny(internal)]

#![feature(crate_visibility_modifier)]
#![feature(in_band_lifetimes)]
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_typeck/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ This API is completely unstable and subject to change.
#![recursion_limit="256"]

#![deny(rust_2018_idioms)]
#![cfg_attr(not(stage0), deny(internal))]
#![deny(internal)]
#![allow(explicit_outlives_requirements)]

#[macro_use] extern crate log;
Expand Down
3 changes: 2 additions & 1 deletion src/librustdoc/html/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2113,7 +2113,8 @@ impl Context {
&final_file);

// Generating settings page.
let settings = Settings::new("./", &self.shared.resource_suffix);
let settings = Settings::new(self.shared.static_root_path.deref().unwrap_or("./"),
&self.shared.resource_suffix);
page.title = "Rustdoc settings";
page.description = "Settings of Rustdoc";
page.root_path = "./";
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![deny(rust_2018_idioms)]
#![cfg_attr(not(stage0), deny(internal))]
#![deny(internal)]

#![doc(html_root_url = "https://doc.rust-lang.org/nightly/",
html_playground_url = "https://play.rust-lang.org/")]
Expand Down
Loading