Skip to content

Rollup of 12 pull requests #54953

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

Closed
wants to merge 34 commits into from
Closed
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
74bf59e
Documents reference equality by address (#54197)
lucasloisp Oct 2, 2018
68236e0
Cleans trailing whitespace
lucasloisp Oct 2, 2018
ac4945c
Fix #24840: make default for `optimize` independent of `debug` settin…
pnkfelix Oct 4, 2018
82444aa
Add doc comments about safest way to initialize a vector of zeros
mandeep Oct 5, 2018
c802e13
Update minifier version
GuillaumeGomez Oct 6, 2018
ded0bf5
Fix mobile doc display
GuillaumeGomez Oct 6, 2018
9a9894a
Fix tracking issue for Once::is_completed
SimonSapin Oct 7, 2018
8c01c22
Stabilize the `Option::replace` method
Kerollmops Oct 8, 2018
c232ea1
Bump the `Option::replace` stabilize version to 1.31.0
Kerollmops Oct 8, 2018
40e20e2
Added text explaining the (new) relative roles of `optimize`+`debug`
pnkfelix Oct 8, 2018
54a3583
it's auto traits that make for automatic implementations
RalfJung Oct 8, 2018
dd0f5e5
Unused result warning: "X which must" ↦ "X that must"
varkor Oct 8, 2018
3447473
parse_trait_item_ now handles interpolated blocks as function body decls
Oct 5, 2018
1e584bf
Refactor macro comment and add resize with zeros example
mandeep Oct 9, 2018
a0577ee
impl Eq+Hash for TyLayout
RalfJung Oct 9, 2018
57f10c7
Point to variable in `asm!` macro when failing borrowck
estebank Oct 9, 2018
dc2343c
Update feature-gate listing
flip1995 Oct 2, 2018
5e9084c
Remove `feature(tool_lints)` from tests
flip1995 Oct 2, 2018
a249981
Remove feature-gate tests
flip1995 Oct 2, 2018
ac231d4
Remove feature-gate code
flip1995 Oct 2, 2018
6328850
Remove unstable-book documentation
flip1995 Oct 2, 2018
ffe1527
Remove nightly check for tool_lints warning
flip1995 Oct 2, 2018
5fb0dfa
Rollup merge of #54755 - lucasloisp:document-reference-address-eq, r=…
pietroalbini Oct 10, 2018
c8b891a
Rollup merge of #54811 - pnkfelix:issue-24840-separate-bootstrap-defa…
pietroalbini Oct 10, 2018
3fa7f4f
Rollup merge of #54850 - mcr431:fix-54707-trait-function-from-macro, …
pietroalbini Oct 10, 2018
0520967
Rollup merge of #54860 - mandeep:vec-initialize, r=alexcrichton
pietroalbini Oct 10, 2018
1e7d0dd
Rollup merge of #54869 - GuillaumeGomez:fix-mobile-docs, r=QuietMisdr…
pietroalbini Oct 10, 2018
6641c2d
Rollup merge of #54870 - flip1995:stabilize_tool_lints, r=Manishearth
pietroalbini Oct 10, 2018
18a78fc
Rollup merge of #54891 - rust-lang:SimonSapin-patch-1, r=nagisa
pietroalbini Oct 10, 2018
12db9d2
Rollup merge of #54904 - Kerollmops:stabilize-option-replace, r=Centril
pietroalbini Oct 10, 2018
df5f0ca
Rollup merge of #54913 - RalfJung:unwind-safe, r=alexcrichton
pietroalbini Oct 10, 2018
2b8799b
Rollup merge of #54917 - varkor:unused-which, r=cramertj
pietroalbini Oct 10, 2018
8e897e3
Rollup merge of #54936 - RalfJung:layout-hash, r=oli-obk
pietroalbini Oct 10, 2018
c6cef8a
Rollup merge of #54945 - estebank:asm-span, r=petrochenkov
pietroalbini Oct 10, 2018
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
35 changes: 26 additions & 9 deletions config.toml.example
Original file line number Diff line number Diff line change
@@ -243,19 +243,36 @@
# =============================================================================
[rust]

# Indicates that the build should be optimized for debugging Rust. Note that
# this is typically not what you want as it takes an incredibly large amount of
# time to have a debug-mode rustc compile any code (notably libstd). If this
# value is set to `true` it will affect a number of configuration options below
# as well, if unconfigured.
#debug = false

# Whether or not to optimize the compiler and standard library
# Whether or not to optimize the compiler and standard library.
#
# Note: the slowness of the non optimized compiler compiling itself usually
# outweighs the time gains in not doing optimizations, therefore a
# full bootstrap takes much more time with optimize set to false.
# full bootstrap takes much more time with `optimize` set to false.
#optimize = true

# Indicates that the build should be configured for debugging Rust. A
# `debug`-enabled compiler and standard library will be somewhat
# slower (due to e.g. checking of debug assertions) but should remain
# usable.
#
# Note: If this value is set to `true`, it will affect a number of
# configuration options below as well, if they have been left
# unconfigured in this file.
#
# Note: changes to the `debug` setting do *not* affect `optimize`
# above. In theory, a "maximally debuggable" environment would
# set `optimize` to `false` above to assist the introspection
# facilities of debuggers like lldb and gdb. To recreate such an
# environment, explicitly set `optimize` to `false` and `debug`
# to `true`. In practice, everyone leaves `optimize` set to
# `true`, because an unoptimized rustc with debugging
# enabled becomes *unusably slow* (e.g. rust-lang/rust#24840
# reported a 25x slowdown) and bootstrapping the supposed
# "maximally debuggable" environment (notably libstd) takes
# hours to build.
#
#debug = false

# Number of codegen units to use for each compiler invocation. A value of 0
# means "the number of cores on this machine", and 1+ is passed through to the
# compiler.
6 changes: 3 additions & 3 deletions src/Cargo.lock
Original file line number Diff line number Diff line change
@@ -1269,7 +1269,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "minifier"
version = "0.0.19"
version = "0.0.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"macro-utils 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2484,7 +2484,7 @@ dependencies = [
name = "rustdoc"
version = "0.0.0"
dependencies = [
"minifier 0.0.19 (registry+https://github.com/rust-lang/crates.io-index)",
"minifier 0.0.20 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"tempfile 3.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3289,7 +3289,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum memchr 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a3b4142ab8738a78c51896f704f83c11df047ff1bda9a92a661aa6361552d93d"
"checksum memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2ffa2c986de11a9df78620c01eeaaf27d94d3ff02bf81bfcca953102dd0c6ff"
"checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3"
"checksum minifier 0.0.19 (registry+https://github.com/rust-lang/crates.io-index)" = "9908ed7c62f990c21ab41fdca53a864a3ada0da69d8729c4de727b397e27bc11"
"checksum minifier 0.0.20 (registry+https://github.com/rust-lang/crates.io-index)" = "96c269bb45c39b333392b2b18ad71760b34ac65666591386b0e959ed58b3f474"
"checksum miniz-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "609ce024854aeb19a0ef7567d348aaa5a746b32fb72e336df7fcc16869d7e2b4"
"checksum miow 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "396aa0f2003d7df8395cb93e09871561ccc3e785f0acb369170e8cc74ddf9226"
"checksum new_debug_unreachable 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0cdc457076c78ab54d5e0d6fa7c47981757f1e34dc39ff92787f217dede586c4"
4 changes: 3 additions & 1 deletion src/bootstrap/config.rs
Original file line number Diff line number Diff line change
@@ -628,6 +628,9 @@ impl Config {
let default = false;
config.llvm_assertions = llvm_assertions.unwrap_or(default);

let default = true;
config.rust_optimize = optimize.unwrap_or(default);

let default = match &config.channel[..] {
"stable" | "beta" | "nightly" => true,
_ => false,
@@ -640,7 +643,6 @@ impl Config {
config.debug_jemalloc = debug_jemalloc.unwrap_or(default);
config.rust_debuginfo = debuginfo.unwrap_or(default);
config.rust_debug_assertions = debug_assertions.unwrap_or(default);
config.rust_optimize = optimize.unwrap_or(!default);

let default = config.channel == "dev";
config.ignore_git = ignore_git.unwrap_or(default);
6 changes: 3 additions & 3 deletions src/doc/rustc/src/lints/listing/warn-by-default.md
Original file line number Diff line number Diff line change
@@ -279,7 +279,7 @@ warning: functions generic over types must be mangled
1 | #[no_mangle]
| ------------ help: remove this attribute
2 | / fn foo<T>(t: T) {
3 | |
3 | |
4 | | }
| |_^
|
@@ -513,7 +513,7 @@ This will produce:
warning: borrow of packed field requires unsafe function or block (error E0133)
--> src/main.rs:11:13
|
11 | let y = &x.data.0;
11 | let y = &x.data.0;
| ^^^^^^^^^
|
= note: #[warn(safe_packed_borrows)] on by default
@@ -874,7 +874,7 @@ fn main() {
This will produce:

```text
warning: unused `std::result::Result` which must be used
warning: unused `std::result::Result` that must be used
--> src/main.rs:6:5
|
6 | returns_result();
35 changes: 0 additions & 35 deletions src/doc/unstable-book/src/language-features/tool-lints.md

This file was deleted.

8 changes: 7 additions & 1 deletion src/liballoc/vec.rs
Original file line number Diff line number Diff line change
@@ -120,11 +120,17 @@ use raw_vec::RawVec;
/// assert_eq!(vec, [1, 2, 3, 4]);
/// ```
///
/// It can also initialize each element of a `Vec<T>` with a given value:
/// It can also initialize each element of a `Vec<T>` with a given value.
/// This may be more efficient than performing allocation and initialization
/// in separate steps, especially when initializing a vector of zeros:
///
/// ```
/// let vec = vec![0; 5];
/// assert_eq!(vec, [0, 0, 0, 0, 0]);
///
/// // The following is equivalent, but potentially slower:
/// let mut vec1 = Vec::with_capacity(5);
/// vec1.resize(5, 0);
/// ```
///
/// Use a `Vec<T>` as an efficient stack:
2 changes: 1 addition & 1 deletion src/libcore/iter/mod.rs
Original file line number Diff line number Diff line change
@@ -253,7 +253,7 @@
//! using it. The compiler will warn us about this kind of behavior:
//!
//! ```text
//! warning: unused result which must be used: iterator adaptors are lazy and
//! warning: unused result that must be used: iterator adaptors are lazy and
//! do nothing unless consumed
//! ```
//!
4 changes: 1 addition & 3 deletions src/libcore/option.rs
Original file line number Diff line number Diff line change
@@ -867,8 +867,6 @@ impl<T> Option<T> {
/// # Examples
///
/// ```
/// #![feature(option_replace)]
///
/// let mut x = Some(2);
/// let old = x.replace(5);
/// assert_eq!(x, Some(5));
@@ -880,7 +878,7 @@ impl<T> Option<T> {
/// assert_eq!(old, None);
/// ```
#[inline]
#[unstable(feature = "option_replace", issue = "51998")]
#[stable(feature = "option_replace", since = "1.31.0")]
pub fn replace(&mut self, value: T) -> Option<T> {
mem::replace(self, Some(value))
}
1 change: 0 additions & 1 deletion src/libcore/tests/lib.rs
Original file line number Diff line number Diff line change
@@ -39,7 +39,6 @@
#![feature(reverse_bits)]
#![feature(inner_deref)]
#![feature(slice_internals)]
#![feature(option_replace)]
#![feature(slice_partition_dedup)]
#![feature(copy_within)]

1 change: 1 addition & 0 deletions src/librustc/hir/lowering.rs
Original file line number Diff line number Diff line change
@@ -3953,6 +3953,7 @@ impl<'a> LoweringContext<'a> {
constraint: out.constraint.clone(),
is_rw: out.is_rw,
is_indirect: out.is_indirect,
span: out.expr.span,
})
.collect(),
asm: asm.asm.clone(),
1 change: 1 addition & 0 deletions src/librustc/hir/mod.rs
Original file line number Diff line number Diff line change
@@ -1812,6 +1812,7 @@ pub struct InlineAsmOutput {
pub constraint: Symbol,
pub is_rw: bool,
pub is_indirect: bool,
pub span: Span,
}

#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
3 changes: 2 additions & 1 deletion src/librustc/ich/impls_hir.rs
Original file line number Diff line number Diff line change
@@ -983,7 +983,8 @@ impl<'a> ToStableHashKey<StableHashingContext<'a>> for hir::BodyId {
impl_stable_hash_for!(struct hir::InlineAsmOutput {
constraint,
is_rw,
is_indirect
is_indirect,
span
});

impl_stable_hash_for!(struct hir::GlobalAsm {
27 changes: 3 additions & 24 deletions src/librustc/lint/levels.rs
Original file line number Diff line number Diff line change
@@ -18,11 +18,10 @@ use lint::context::CheckLintNameResult;
use lint::{self, Lint, LintId, Level, LintSource};
use rustc_data_structures::stable_hasher::{HashStable, ToStableHashKey,
StableHasher, StableHasherResult};
use session::{config::nightly_options, Session};
use session::Session;
use syntax::ast;
use syntax::attr;
use syntax::source_map::MultiSpan;
use syntax::feature_gate;
use syntax::symbol::Symbol;
use util::nodemap::FxHashMap;

@@ -228,28 +227,14 @@ impl<'a> LintLevelsBuilder<'a> {
}
};
let tool_name = if let Some(lint_tool) = word.is_scoped() {
let gate_feature = !self.sess.features_untracked().tool_lints;
let known_tool = attr::is_known_lint_tool(lint_tool);
if gate_feature {
feature_gate::emit_feature_err(
&sess.parse_sess,
"tool_lints",
word.span,
feature_gate::GateIssue::Language,
&format!("scoped lint `{}` is experimental", word.ident),
);
}
if !known_tool {
if !attr::is_known_lint_tool(lint_tool) {
span_err!(
sess,
lint_tool.span,
E0710,
"an unknown tool name found in scoped lint: `{}`",
word.ident
);
}

if gate_feature || !known_tool {
continue;
}

@@ -299,13 +284,7 @@ impl<'a> LintLevelsBuilder<'a> {
"change it to",
new_lint_name.to_string(),
Applicability::MachineApplicable,
);

if nightly_options::is_nightly_build() {
err.emit();
} else {
err.cancel();
}
).emit();

let src = LintSource::Node(Symbol::intern(&new_lint_name), li.span);
for id in ids {
23 changes: 14 additions & 9 deletions src/librustc/middle/expr_use_visitor.rs
Original file line number Diff line number Diff line change
@@ -364,11 +364,12 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> {
}

fn mutate_expr(&mut self,
span: Span,
assignment_expr: &hir::Expr,
expr: &hir::Expr,
mode: MutateMode) {
let cmt = return_if_err!(self.mc.cat_expr(expr));
self.delegate.mutate(assignment_expr.id, assignment_expr.span, &cmt, mode);
self.delegate.mutate(assignment_expr.id, span, &cmt, mode);
self.walk_expr(expr);
}

@@ -472,12 +473,16 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> {
if o.is_indirect {
self.consume_expr(output);
} else {
self.mutate_expr(expr, output,
if o.is_rw {
MutateMode::WriteAndRead
} else {
MutateMode::JustWrite
});
self.mutate_expr(
output.span,
expr,
output,
if o.is_rw {
MutateMode::WriteAndRead
} else {
MutateMode::JustWrite
},
);
}
}
self.consume_exprs(inputs);
@@ -515,7 +520,7 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> {
}

hir::ExprKind::Assign(ref lhs, ref rhs) => {
self.mutate_expr(expr, &lhs, MutateMode::JustWrite);
self.mutate_expr(expr.span, expr, &lhs, MutateMode::JustWrite);
self.consume_expr(&rhs);
}

@@ -527,7 +532,7 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> {
if self.mc.tables.is_method_call(expr) {
self.consume_expr(lhs);
} else {
self.mutate_expr(expr, &lhs, MutateMode::WriteAndRead);
self.mutate_expr(expr.span, expr, &lhs, MutateMode::WriteAndRead);
}
self.consume_expr(&rhs);
}
1 change: 0 additions & 1 deletion src/librustc_driver/lib.rs
Original file line number Diff line number Diff line change
@@ -21,7 +21,6 @@
#![feature(box_syntax)]
#![cfg_attr(unix, feature(libc))]
#![feature(nll)]
#![feature(option_replace)]
#![feature(quote)]
#![feature(rustc_diagnostic_macros)]
#![feature(slice_sort_by_cached_key)]
6 changes: 3 additions & 3 deletions src/librustc_lint/unused.rs
Original file line number Diff line number Diff line change
@@ -135,7 +135,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedResults {

if let Some(must_use_op) = must_use_op {
cx.span_lint(UNUSED_MUST_USE, expr.span,
&format!("unused {} which must be used", must_use_op));
&format!("unused {} that must be used", must_use_op));
op_warned = true;
}

@@ -146,7 +146,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedResults {
fn check_must_use(cx: &LateContext, def_id: DefId, sp: Span, describe_path: &str) -> bool {
for attr in cx.tcx.get_attrs(def_id).iter() {
if attr.check_name("must_use") {
let msg = format!("unused {}`{}` which must be used",
let msg = format!("unused {}`{}` that must be used",
describe_path, cx.tcx.item_path_str(def_id));
let mut err = cx.struct_span_lint(UNUSED_MUST_USE, sp, &msg);
// check for #[must_use = "..."]
@@ -233,7 +233,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedAttributes {
.find(|&&(builtin, ty, _)| name == builtin && ty == AttributeType::CrateLevel)
.is_some();

// Has a plugin registered this attribute as one which must be used at
// Has a plugin registered this attribute as one that must be used at
// the crate level?
let plugin_crate = plugin_attributes.iter()
.find(|&&(ref x, t)| name == &**x && AttributeType::CrateLevel == t)
Loading