diff --git a/config.toml.example b/config.toml.example index 312270532affc..1c851999130a0 100644 --- a/config.toml.example +++ b/config.toml.example @@ -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. diff --git a/src/Cargo.lock b/src/Cargo.lock index 6a9488226b1bd..62ce956c1efc8 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -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" diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index c3fbc8eeca6ba..a5ed096a73581 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -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); diff --git a/src/doc/rustc/src/lints/listing/warn-by-default.md b/src/doc/rustc/src/lints/listing/warn-by-default.md index de76ddf33c17e..b01aed0915d08 100644 --- a/src/doc/rustc/src/lints/listing/warn-by-default.md +++ b/src/doc/rustc/src/lints/listing/warn-by-default.md @@ -279,7 +279,7 @@ warning: functions generic over types must be mangled 1 | #[no_mangle] | ------------ help: remove this attribute 2 | / fn foo(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(); diff --git a/src/doc/unstable-book/src/language-features/tool-lints.md b/src/doc/unstable-book/src/language-features/tool-lints.md deleted file mode 100644 index 5c0d33b5ab0c4..0000000000000 --- a/src/doc/unstable-book/src/language-features/tool-lints.md +++ /dev/null @@ -1,35 +0,0 @@ -# `tool_lints` - -The tracking issue for this feature is: [#44690] - -[#44690]: https://github.com/rust-lang/rust/issues/44690 - ------------------------- - -Tool lints let you use scoped lints, to `allow`, `warn`, `deny` or `forbid` lints of -certain tools. - -Currently `clippy` is the only available lint tool. - -It is recommended for lint tools to implement the scoped lints like this: - -- `#[_(TOOL_NAME::lintname)]`: for lint names -- `#[_(TOOL_NAME::lintgroup)]`: for groups of lints -- `#[_(TOOL_NAME::all)]`: for (almost[^1]) all lints - -## An example - -```rust -#![feature(tool_lints)] - -#![warn(clippy::pedantic)] - -#[allow(clippy::filter_map)] -fn main() { - let v = vec![0; 10]; - let _ = v.into_iter().filter(|&x| x < 1).map(|x| x + 1).collect::>(); - println!("No filter_map()!"); -} -``` - -[^1]: Some defined lint groups can be excluded here. diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs index 2bc037e3fee12..f7a0bbdceafc9 100644 --- a/src/liballoc/vec.rs +++ b/src/liballoc/vec.rs @@ -120,11 +120,17 @@ use raw_vec::RawVec; /// assert_eq!(vec, [1, 2, 3, 4]); /// ``` /// -/// It can also initialize each element of a `Vec` with a given value: +/// It can also initialize each element of a `Vec` 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` as an efficient stack: diff --git a/src/libcore/iter/mod.rs b/src/libcore/iter/mod.rs index ef3f4ced4f9b2..c42fb7019c771 100644 --- a/src/libcore/iter/mod.rs +++ b/src/libcore/iter/mod.rs @@ -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 //! ``` //! diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 0255f7a0885ea..cf1c77041b91f 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -867,8 +867,6 @@ impl Option { /// # Examples /// /// ``` - /// #![feature(option_replace)] - /// /// let mut x = Some(2); /// let old = x.replace(5); /// assert_eq!(x, Some(5)); @@ -880,7 +878,7 @@ impl Option { /// 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 { mem::replace(self, Some(value)) } diff --git a/src/libcore/tests/lib.rs b/src/libcore/tests/lib.rs index ada61d8dfd873..0beb60a127097 100644 --- a/src/libcore/tests/lib.rs +++ b/src/libcore/tests/lib.rs @@ -39,7 +39,6 @@ #![feature(reverse_bits)] #![feature(inner_deref)] #![feature(slice_internals)] -#![feature(option_replace)] #![feature(slice_partition_dedup)] #![feature(copy_within)] diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index 7309358091056..4d51126621d7d 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -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(), diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index c57c26434e32a..1a97c678ef1c0 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -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)] diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index da9604702dfa3..9f4ac77fa1fe1 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -983,7 +983,8 @@ impl<'a> ToStableHashKey> 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 { diff --git a/src/librustc/lint/levels.rs b/src/librustc/lint/levels.rs index 87d33e473e7f6..950754a07ab09 100644 --- a/src/librustc/lint/levels.rs +++ b/src/librustc/lint/levels.rs @@ -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,18 +227,7 @@ 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, @@ -247,9 +235,6 @@ impl<'a> LintLevelsBuilder<'a> { "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 { diff --git a/src/librustc/middle/expr_use_visitor.rs b/src/librustc/middle/expr_use_visitor.rs index d6b43ffe6da62..7e9b26bbf729c 100644 --- a/src/librustc/middle/expr_use_visitor.rs +++ b/src/librustc/middle/expr_use_visitor.rs @@ -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); } diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index 4405c0aef9023..0514bd20c985a 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -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)] diff --git a/src/librustc_lint/unused.rs b/src/librustc_lint/unused.rs index ae178888b6a1c..b4c12d42608ef 100644 --- a/src/librustc_lint/unused.rs +++ b/src/librustc_lint/unused.rs @@ -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) diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index 0943b36440aa6..9cbaf35acd33f 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -544,7 +544,7 @@ impl<'cx, 'gcx, 'tcx> DataflowResultsConsumer<'cx, 'tcx> for MirBorrowckCtxt<'cx // be encoeded through MIR place derefs instead. self.access_place( context, - (output, span), + (output, o.span), (Deep, Read(ReadKind::Copy)), LocalMutationIsAllowed::No, flow_state, @@ -552,13 +552,13 @@ impl<'cx, 'gcx, 'tcx> DataflowResultsConsumer<'cx, 'tcx> for MirBorrowckCtxt<'cx self.check_if_path_or_subpath_is_moved( context, InitializationRequiringAction::Use, - (output, span), + (output, o.span), flow_state, ); } else { self.mutate_place( context, - (output, span), + (output, o.span), if o.is_rw { Deep } else { Shallow(None) }, if o.is_rw { WriteAndRead } else { JustWrite }, flow_state, diff --git a/src/librustc_mir/interpret/operand.rs b/src/librustc_mir/interpret/operand.rs index b53bcfa993d53..c0c97b0cabe00 100644 --- a/src/librustc_mir/interpret/operand.rs +++ b/src/librustc_mir/interpret/operand.rs @@ -11,7 +11,6 @@ //! Functions concerning immediate values and operands, and reading from operands. //! All high-level functions to read from memory work on operands as sources. -use std::hash::{Hash, Hasher}; use std::convert::TryInto; use rustc::{mir, ty}; @@ -221,7 +220,7 @@ impl Operand { } } -#[derive(Copy, Clone, Debug)] +#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)] pub struct OpTy<'tcx> { crate op: Operand, // ideally we'd make this private, but const_prop needs this pub layout: TyLayout<'tcx>, @@ -255,20 +254,6 @@ impl<'tcx> From> for OpTy<'tcx> { } } -// Validation needs to hash OpTy, but we cannot hash Layout -- so we just hash the type -impl<'tcx> Hash for OpTy<'tcx> { - fn hash(&self, state: &mut H) { - self.op.hash(state); - self.layout.ty.hash(state); - } -} -impl<'tcx> PartialEq for OpTy<'tcx> { - fn eq(&self, other: &Self) -> bool { - self.op == other.op && self.layout.ty == other.layout.ty - } -} -impl<'tcx> Eq for OpTy<'tcx> {} - // Use the existing layout if given (but sanity check in debug mode), // or compute the layout. #[inline(always)] diff --git a/src/librustc_target/abi/mod.rs b/src/librustc_target/abi/mod.rs index 96eb69163220e..6b28fd091748f 100644 --- a/src/librustc_target/abi/mod.rs +++ b/src/librustc_target/abi/mod.rs @@ -874,7 +874,7 @@ impl LayoutDetails { /// to those obtained from `layout_of(ty)`, as we need to produce /// layouts for which Rust types do not exist, such as enum variants /// or synthetic fields of enums (i.e. discriminants) and fat pointers. -#[derive(Copy, Clone, Debug)] +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] pub struct TyLayout<'a, Ty> { pub ty: Ty, pub details: &'a LayoutDetails diff --git a/src/librustdoc/Cargo.toml b/src/librustdoc/Cargo.toml index 845bfad7807d3..8bac007b748ac 100644 --- a/src/librustdoc/Cargo.toml +++ b/src/librustdoc/Cargo.toml @@ -9,6 +9,6 @@ path = "lib.rs" [dependencies] pulldown-cmark = { version = "0.1.2", default-features = false } -minifier = "0.0.19" +minifier = "0.0.20" tempfile = "3" parking_lot = "0.6.4" diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 1c61e73fae03c..23f1e15de3c92 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -4098,12 +4098,13 @@ impl<'a> fmt::Display for Sidebar<'a> { ", version)?; } + } + write!(fmt, "
")?; + if it.is_crate() { write!(fmt, "

See all {}'s items

", it.name.as_ref().expect("crates always have a name"))?; } - - write!(fmt, "
")?; match it.inner { clean::StructItem(ref s) => sidebar_struct(fmt, it, s)?, clean::TraitItem(ref t) => sidebar_trait(fmt, it, t)?, diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css index 58ac46d22717b..91ff03a327df4 100644 --- a/src/librustdoc/html/static/rustdoc.css +++ b/src/librustdoc/html/static/rustdoc.css @@ -908,10 +908,9 @@ span.since { padding-top: 0px; } - .sidebar { + body > .sidebar { height: 45px; min-height: 40px; - width: calc(100% + 30px); margin: 0; margin-left: -15px; padding: 0 15px; @@ -1013,6 +1012,10 @@ span.since { .anchor { display: none !important; } + + h1.fqn { + overflow: initial; + } } @media print { @@ -1112,6 +1115,18 @@ h4 > .important-traits { top: 2px; } +#all-types { + text-align: center; + border: 1px solid; + margin: 0 10px; + margin-bottom: 10px; + display: block; + border-radius: 7px; +} +#all-types > p { + margin: 5px 0; +} + @media (max-width: 700px) { h4 > .important-traits { position: absolute; @@ -1135,6 +1150,9 @@ h4 > .important-traits { background-color: rgba(0,0,0,0); height: 100%; } + .sidebar { + width: calc(100% + 30px); + } .show-it { display: block; @@ -1180,6 +1198,10 @@ h4 > .important-traits { .impl > .collapse-toggle { left: -10px; } + + #all-types { + margin: 10px; + } } @@ -1383,17 +1405,6 @@ kbd { #main > ul > li { list-style: none; } -#all-types { - text-align: center; - border: 1px solid; - margin: 0 10px; - margin-bottom: 10px; - display: block; - border-radius: 7px; -} -#all-types > p { - margin: 5px 0; -} .non-exhaustive { margin-bottom: 1em; diff --git a/src/libstd/panic.rs b/src/libstd/panic.rs index 48a9b2f4a93de..5c87035d8e929 100644 --- a/src/libstd/panic.rs +++ b/src/libstd/panic.rs @@ -79,7 +79,7 @@ pub use core::panic::{PanicInfo, Location}; /// /// Simply put, a type `T` implements `UnwindSafe` if it cannot easily allow /// witnessing a broken invariant through the use of `catch_unwind` (catching a -/// panic). This trait is a marker trait, so it is automatically implemented for +/// panic). This trait is an auto trait, so it is automatically implemented for /// many types, and it is also structurally composed (e.g. a struct is unwind /// safe if all of its components are unwind safe). /// diff --git a/src/libstd/primitive_docs.rs b/src/libstd/primitive_docs.rs index 8d54728a75f42..3b432d0513209 100644 --- a/src/libstd/primitive_docs.rs +++ b/src/libstd/primitive_docs.rs @@ -908,11 +908,36 @@ mod prim_usize { } /// `&mut T` references can be freely coerced into `&T` references with the same referent type, and /// references with longer lifetimes can be freely coerced into references with shorter ones. /// +/// Reference equality by address, instead of comparing the values pointed to, is accomplished via +/// implicit reference-pointer coercion and raw pointer equality via [`ptr::eq`], while +/// [`PartialEq`] compares values. +/// +/// [`ptr::eq`]: ptr/fn.eq.html +/// [`PartialEq`]: cmp/trait.PartialEq.html +/// +/// ``` +/// use std::ptr; +/// +/// let five = 5; +/// let other_five = 5; +/// let five_ref = &five; +/// let same_five_ref = &five; +/// let other_five_ref = &other_five; +/// +/// assert!(five_ref == same_five_ref); +/// assert!(five_ref == other_five_ref); +/// +/// assert!(ptr::eq(five_ref, same_five_ref)); +/// assert!(!ptr::eq(five_ref, other_five_ref)); +/// ``` +/// /// For more information on how to use references, see [the book's section on "References and /// Borrowing"][book-refs]. /// /// [book-refs]: ../book/second-edition/ch04-02-references-and-borrowing.html /// +/// # Trait implementations +/// /// The following traits are implemented for all `&T`, regardless of the type of its referent: /// /// * [`Copy`] diff --git a/src/libstd/sync/once.rs b/src/libstd/sync/once.rs index 17cb614ba11ff..98845e457b25c 100644 --- a/src/libstd/sync/once.rs +++ b/src/libstd/sync/once.rs @@ -329,7 +329,7 @@ impl Once { /// assert!(handle.join().is_err()); /// assert_eq!(INIT.is_completed(), false); /// ``` - #[unstable(feature = "once_is_completed", issue = "42")] + #[unstable(feature = "once_is_completed", issue = "54890")] #[inline] pub fn is_completed(&self) -> bool { // An `Acquire` load is enough because that makes all the initialization diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 24ee24640558e..4ddbaee5aa443 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -433,9 +433,6 @@ declare_features! ( // #[doc(alias = "...")] (active, doc_alias, "1.27.0", Some(50146), None), - // Scoped lints - (active, tool_lints, "1.28.0", Some(44690), None), - // Allows irrefutable patterns in if-let and while-let statements (RFC 2086) (active, irrefutable_let_patterns, "1.27.0", Some(44495), None), @@ -679,6 +676,8 @@ declare_features! ( (accepted, pattern_parentheses, "1.31.0", Some(51087), None), // Allows the definition of `const fn` functions. (accepted, min_const_fn, "1.31.0", Some(53555), None), + // Scoped lints + (accepted, tool_lints, "1.31.0", Some(44690), None), ); // If you change this, please modify src/doc/unstable-book as well. You must diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index d653ed819fddd..3b6cad0dbf7b0 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1430,6 +1430,23 @@ impl<'a> Parser<'a> { attrs.extend(inner_attrs.iter().cloned()); Some(body) } + token::Interpolated(ref nt) => { + match &nt.0 { + token::NtBlock(..) => { + *at_end = true; + let (inner_attrs, body) = self.parse_inner_attrs_and_block()?; + attrs.extend(inner_attrs.iter().cloned()); + Some(body) + } + _ => { + let token_str = self.this_token_to_string(); + let mut err = self.fatal(&format!("expected `;` or `{{`, found `{}`", + token_str)); + err.span_label(self.span, "expected `;` or `{`"); + return Err(err); + } + } + } _ => { let token_str = self.this_token_to_string(); let mut err = self.fatal(&format!("expected `;` or `{{`, found `{}`", diff --git a/src/test/run-pass/macros/macro-as-fn-body.rs b/src/test/run-pass/macros/macro-as-fn-body.rs new file mode 100644 index 0000000000000..8c3c9fdc66df2 --- /dev/null +++ b/src/test/run-pass/macros/macro-as-fn-body.rs @@ -0,0 +1,42 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +// +// run-pass +// +// Description - ensure Interpolated blocks can act as valid function bodies +// Covered cases: free functions, struct methods, and default trait functions + +macro_rules! def_fn { + ($body:block) => { + fn bar() $body + } +} + +trait Foo { + def_fn!({ println!("foo"); }); +} + +struct Baz {} + +impl Foo for Baz {} + +struct Qux {} + +impl Qux { + def_fn!({ println!("qux"); }); +} + +def_fn!({ println!("quux"); }); + +pub fn main() { + Baz::bar(); + Qux::bar(); + bar(); +} diff --git a/src/test/run-pass/tool_lints.rs b/src/test/run-pass/tool_lints.rs index 24ec43b12f60e..2705c03598a0d 100644 --- a/src/test/run-pass/tool_lints.rs +++ b/src/test/run-pass/tool_lints.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(tool_lints)] + #![deny(unknown_lints)] #[allow(clippy::almost_swapped)] diff --git a/src/test/run-pass/tool_lints_2018_preview.rs b/src/test/run-pass/tool_lints_2018_preview.rs index 6cd57eaa19595..57df3e072a8dc 100644 --- a/src/test/run-pass/tool_lints_2018_preview.rs +++ b/src/test/run-pass/tool_lints_2018_preview.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(tool_lints)] + #![feature(rust_2018_preview)] #![deny(unknown_lints)] diff --git a/src/test/ui-fulldeps/lint_tool_test.rs b/src/test/ui-fulldeps/lint_tool_test.rs index ebe10b3714f20..11b70d1d7809c 100644 --- a/src/test/ui-fulldeps/lint_tool_test.rs +++ b/src/test/ui-fulldeps/lint_tool_test.rs @@ -11,8 +11,8 @@ // aux-build:lint_tool_test.rs // ignore-stage1 // compile-flags: --cfg foo + #![feature(plugin)] -#![feature(tool_lints)] #![plugin(lint_tool_test)] #![allow(dead_code)] #![cfg_attr(foo, warn(test_lint))] diff --git a/src/test/ui/asm/asm-out-assign-imm.nll.stderr b/src/test/ui/asm/asm-out-assign-imm.nll.stderr index 7fefb6672c76b..40a36dd895f77 100644 --- a/src/test/ui/asm/asm-out-assign-imm.nll.stderr +++ b/src/test/ui/asm/asm-out-assign-imm.nll.stderr @@ -1,5 +1,5 @@ error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/asm-out-assign-imm.rs:34:9 + --> $DIR/asm-out-assign-imm.rs:34:34 | LL | let x: isize; | - help: make this binding mutable: `mut x` @@ -7,7 +7,7 @@ LL | x = 1; | ----- first assignment to `x` ... LL | asm!("mov $1, $0" : "=r"(x) : "r"(5)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable + | ^ cannot assign twice to immutable variable error: aborting due to previous error diff --git a/src/test/ui/asm/asm-out-assign-imm.stderr b/src/test/ui/asm/asm-out-assign-imm.stderr index 83cb8092e16a2..51933cac39692 100644 --- a/src/test/ui/asm/asm-out-assign-imm.stderr +++ b/src/test/ui/asm/asm-out-assign-imm.stderr @@ -1,11 +1,11 @@ error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/asm-out-assign-imm.rs:34:9 + --> $DIR/asm-out-assign-imm.rs:34:34 | LL | x = 1; | ----- first assignment to `x` ... LL | asm!("mov $1, $0" : "=r"(x) : "r"(5)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable + | ^ cannot assign twice to immutable variable error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-asm.ast.nll.stderr b/src/test/ui/borrowck/borrowck-asm.ast.nll.stderr index b0f0535b9f6c7..0cec1975db880 100644 --- a/src/test/ui/borrowck/borrowck-asm.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-asm.ast.nll.stderr @@ -22,7 +22,7 @@ LL | let z = y; | - borrow later used here error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/borrowck-asm.rs:54:13 + --> $DIR/borrowck-asm.rs:54:31 | LL | let x = 3; | - @@ -31,10 +31,10 @@ LL | let x = 3; | help: make this binding mutable: `mut x` LL | unsafe { LL | asm!("nop" : "=r"(x)); //[ast]~ ERROR cannot assign twice - | ^^^^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable + | ^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/borrowck-asm.rs:70:13 + --> $DIR/borrowck-asm.rs:70:31 | LL | let x = 3; | - @@ -43,22 +43,22 @@ LL | let x = 3; | help: make this binding mutable: `mut x` LL | unsafe { LL | asm!("nop" : "+r"(x)); //[ast]~ ERROR cannot assign twice - | ^^^^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable + | ^ cannot assign twice to immutable variable error[E0381]: use of possibly uninitialized variable: `x` - --> $DIR/borrowck-asm.rs:78:13 + --> $DIR/borrowck-asm.rs:78:32 | LL | asm!("nop" : "=*r"(x)); //[ast]~ ERROR use of possibly uninitialized variable - | ^^^^^^^^^^^^^^^^^^^^^^^ use of possibly uninitialized `x` + | ^ use of possibly uninitialized `x` error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/borrowck-asm.rs:87:13 + --> $DIR/borrowck-asm.rs:87:31 | LL | let y = &*x; | --- borrow of `x` occurs here LL | unsafe { LL | asm!("nop" : "+r"(x)); //[ast]~ ERROR cannot assign to `x` because it is borrowed - | ^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `x` occurs here + | ^ assignment to borrowed `x` occurs here ... LL | let z = y; | - borrow later used here diff --git a/src/test/ui/borrowck/borrowck-asm.ast.stderr b/src/test/ui/borrowck/borrowck-asm.ast.stderr index e2e54aa9b8ad9..5856a1b0790b2 100644 --- a/src/test/ui/borrowck/borrowck-asm.ast.stderr +++ b/src/test/ui/borrowck/borrowck-asm.ast.stderr @@ -19,31 +19,31 @@ LL | asm!("nop" : : "r"(x)); //[ast]~ ERROR cannot use | ^ use of borrowed `x` error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/borrowck-asm.rs:54:13 + --> $DIR/borrowck-asm.rs:54:31 | LL | let x = 3; | - first assignment to `x` LL | unsafe { LL | asm!("nop" : "=r"(x)); //[ast]~ ERROR cannot assign twice - | ^^^^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable + | ^ cannot assign twice to immutable variable error[E0506]: cannot assign to `a` because it is borrowed - --> $DIR/borrowck-asm.rs:60:13 + --> $DIR/borrowck-asm.rs:60:31 | LL | let b = &*a; | -- borrow of `a` occurs here LL | unsafe { LL | asm!("nop" : "=r"(a)); //[ast]~ ERROR cannot assign to `a` because it is borrowed - | ^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `a` occurs here + | ^ assignment to borrowed `a` occurs here error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/borrowck-asm.rs:70:13 + --> $DIR/borrowck-asm.rs:70:31 | LL | let x = 3; | - first assignment to `x` LL | unsafe { LL | asm!("nop" : "+r"(x)); //[ast]~ ERROR cannot assign twice - | ^^^^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable + | ^ cannot assign twice to immutable variable error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/borrowck-asm.rs:78:32 @@ -52,13 +52,13 @@ LL | asm!("nop" : "=*r"(x)); //[ast]~ ERROR use of possibly uninitia | ^ use of possibly uninitialized `x` error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/borrowck-asm.rs:87:13 + --> $DIR/borrowck-asm.rs:87:31 | LL | let y = &*x; | -- borrow of `x` occurs here LL | unsafe { LL | asm!("nop" : "+r"(x)); //[ast]~ ERROR cannot assign to `x` because it is borrowed - | ^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `x` occurs here + | ^ assignment to borrowed `x` occurs here error[E0382]: use of moved value: `x` --> $DIR/borrowck-asm.rs:96:40 diff --git a/src/test/ui/borrowck/borrowck-asm.mir.stderr b/src/test/ui/borrowck/borrowck-asm.mir.stderr index b0f0535b9f6c7..0cec1975db880 100644 --- a/src/test/ui/borrowck/borrowck-asm.mir.stderr +++ b/src/test/ui/borrowck/borrowck-asm.mir.stderr @@ -22,7 +22,7 @@ LL | let z = y; | - borrow later used here error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/borrowck-asm.rs:54:13 + --> $DIR/borrowck-asm.rs:54:31 | LL | let x = 3; | - @@ -31,10 +31,10 @@ LL | let x = 3; | help: make this binding mutable: `mut x` LL | unsafe { LL | asm!("nop" : "=r"(x)); //[ast]~ ERROR cannot assign twice - | ^^^^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable + | ^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/borrowck-asm.rs:70:13 + --> $DIR/borrowck-asm.rs:70:31 | LL | let x = 3; | - @@ -43,22 +43,22 @@ LL | let x = 3; | help: make this binding mutable: `mut x` LL | unsafe { LL | asm!("nop" : "+r"(x)); //[ast]~ ERROR cannot assign twice - | ^^^^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable + | ^ cannot assign twice to immutable variable error[E0381]: use of possibly uninitialized variable: `x` - --> $DIR/borrowck-asm.rs:78:13 + --> $DIR/borrowck-asm.rs:78:32 | LL | asm!("nop" : "=*r"(x)); //[ast]~ ERROR use of possibly uninitialized variable - | ^^^^^^^^^^^^^^^^^^^^^^^ use of possibly uninitialized `x` + | ^ use of possibly uninitialized `x` error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/borrowck-asm.rs:87:13 + --> $DIR/borrowck-asm.rs:87:31 | LL | let y = &*x; | --- borrow of `x` occurs here LL | unsafe { LL | asm!("nop" : "+r"(x)); //[ast]~ ERROR cannot assign to `x` because it is borrowed - | ^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `x` occurs here + | ^ assignment to borrowed `x` occurs here ... LL | let z = y; | - borrow later used here diff --git a/src/test/ui/feature-gates/feature-gate-tool_lints-fail.rs b/src/test/ui/feature-gates/feature-gate-tool_lints-fail.rs deleted file mode 100644 index c311eb7ed7ae1..0000000000000 --- a/src/test/ui/feature-gates/feature-gate-tool_lints-fail.rs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#[warn(clippy::assign_ops)] //~ ERROR scoped lint `clippy::assign_ops` is experimental -fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-tool_lints-fail.stderr b/src/test/ui/feature-gates/feature-gate-tool_lints-fail.stderr deleted file mode 100644 index 33ee79cd2011a..0000000000000 --- a/src/test/ui/feature-gates/feature-gate-tool_lints-fail.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0658]: scoped lint `clippy::assign_ops` is experimental (see issue #44690) - --> $DIR/feature-gate-tool_lints-fail.rs:11:8 - | -LL | #[warn(clippy::assign_ops)] //~ ERROR scoped lint `clippy::assign_ops` is experimental - | ^^^^^^^^^^^^^^^^^^ - | - = help: add #![feature(tool_lints)] to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gates/feature-gate-tool_lints.rs b/src/test/ui/feature-gates/feature-gate-tool_lints.rs deleted file mode 100644 index 3ef67982be9a4..0000000000000 --- a/src/test/ui/feature-gates/feature-gate-tool_lints.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#[warn(clippy::decimal_literal_representation)] -//~^ ERROR scoped lint `clippy::decimal_literal_representation` is experimental -fn main() { - let a = 65_535; -} diff --git a/src/test/ui/feature-gates/feature-gate-tool_lints.stderr b/src/test/ui/feature-gates/feature-gate-tool_lints.stderr deleted file mode 100644 index 8019b1e6a28f6..0000000000000 --- a/src/test/ui/feature-gates/feature-gate-tool_lints.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0658]: scoped lint `clippy::decimal_literal_representation` is experimental (see issue #44690) - --> $DIR/feature-gate-tool_lints.rs:11:8 - | -LL | #[warn(clippy::decimal_literal_representation)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: add #![feature(tool_lints)] to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/fn_must_use.stderr b/src/test/ui/fn_must_use.stderr index b5bad22f3dc78..08d8e11ed898d 100644 --- a/src/test/ui/fn_must_use.stderr +++ b/src/test/ui/fn_must_use.stderr @@ -1,4 +1,4 @@ -warning: unused return value of `need_to_use_this_value` which must be used +warning: unused return value of `need_to_use_this_value` that must be used --> $DIR/fn_must_use.rs:60:5 | LL | need_to_use_this_value(); //~ WARN unused return value @@ -11,13 +11,13 @@ LL | #![warn(unused_must_use)] | ^^^^^^^^^^^^^^^ = note: it's important -warning: unused return value of `MyStruct::need_to_use_this_method_value` which must be used +warning: unused return value of `MyStruct::need_to_use_this_method_value` that must be used --> $DIR/fn_must_use.rs:65:5 | LL | m.need_to_use_this_method_value(); //~ WARN unused return value | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: unused return value of `EvenNature::is_even` which must be used +warning: unused return value of `EvenNature::is_even` that must be used --> $DIR/fn_must_use.rs:66:5 | LL | m.is_even(); // trait method! @@ -25,25 +25,25 @@ LL | m.is_even(); // trait method! | = note: no side effects -warning: unused return value of `std::cmp::PartialEq::eq` which must be used +warning: unused return value of `std::cmp::PartialEq::eq` that must be used --> $DIR/fn_must_use.rs:72:5 | LL | 2.eq(&3); //~ WARN unused return value | ^^^^^^^^^ -warning: unused return value of `std::cmp::PartialEq::eq` which must be used +warning: unused return value of `std::cmp::PartialEq::eq` that must be used --> $DIR/fn_must_use.rs:73:5 | LL | m.eq(&n); //~ WARN unused return value | ^^^^^^^^^ -warning: unused comparison which must be used +warning: unused comparison that must be used --> $DIR/fn_must_use.rs:76:5 | LL | 2 == 3; //~ WARN unused comparison | ^^^^^^ -warning: unused comparison which must be used +warning: unused comparison that must be used --> $DIR/fn_must_use.rs:77:5 | LL | m == n; //~ WARN unused comparison diff --git a/src/test/ui/lint/must-use-ops.stderr b/src/test/ui/lint/must-use-ops.stderr index 5703536ef48fd..0f8bd97525187 100644 --- a/src/test/ui/lint/must-use-ops.stderr +++ b/src/test/ui/lint/must-use-ops.stderr @@ -1,4 +1,4 @@ -warning: unused comparison which must be used +warning: unused comparison that must be used --> $DIR/must-use-ops.rs:22:5 | LL | val == 1; @@ -10,121 +10,121 @@ note: lint level defined here LL | #![warn(unused_must_use)] | ^^^^^^^^^^^^^^^ -warning: unused comparison which must be used +warning: unused comparison that must be used --> $DIR/must-use-ops.rs:23:5 | LL | val < 1; | ^^^^^^^ -warning: unused comparison which must be used +warning: unused comparison that must be used --> $DIR/must-use-ops.rs:24:5 | LL | val <= 1; | ^^^^^^^^ -warning: unused comparison which must be used +warning: unused comparison that must be used --> $DIR/must-use-ops.rs:25:5 | LL | val != 1; | ^^^^^^^^ -warning: unused comparison which must be used +warning: unused comparison that must be used --> $DIR/must-use-ops.rs:26:5 | LL | val >= 1; | ^^^^^^^^ -warning: unused comparison which must be used +warning: unused comparison that must be used --> $DIR/must-use-ops.rs:27:5 | LL | val > 1; | ^^^^^^^ -warning: unused arithmetic operation which must be used +warning: unused arithmetic operation that must be used --> $DIR/must-use-ops.rs:30:5 | LL | val + 2; | ^^^^^^^ -warning: unused arithmetic operation which must be used +warning: unused arithmetic operation that must be used --> $DIR/must-use-ops.rs:31:5 | LL | val - 2; | ^^^^^^^ -warning: unused arithmetic operation which must be used +warning: unused arithmetic operation that must be used --> $DIR/must-use-ops.rs:32:5 | LL | val / 2; | ^^^^^^^ -warning: unused arithmetic operation which must be used +warning: unused arithmetic operation that must be used --> $DIR/must-use-ops.rs:33:5 | LL | val * 2; | ^^^^^^^ -warning: unused arithmetic operation which must be used +warning: unused arithmetic operation that must be used --> $DIR/must-use-ops.rs:34:5 | LL | val % 2; | ^^^^^^^ -warning: unused logical operation which must be used +warning: unused logical operation that must be used --> $DIR/must-use-ops.rs:37:5 | LL | true && true; | ^^^^^^^^^^^^ -warning: unused logical operation which must be used +warning: unused logical operation that must be used --> $DIR/must-use-ops.rs:38:5 | LL | false || true; | ^^^^^^^^^^^^^ -warning: unused bitwise operation which must be used +warning: unused bitwise operation that must be used --> $DIR/must-use-ops.rs:41:5 | LL | 5 ^ val; | ^^^^^^^ -warning: unused bitwise operation which must be used +warning: unused bitwise operation that must be used --> $DIR/must-use-ops.rs:42:5 | LL | 5 & val; | ^^^^^^^ -warning: unused bitwise operation which must be used +warning: unused bitwise operation that must be used --> $DIR/must-use-ops.rs:43:5 | LL | 5 | val; | ^^^^^^^ -warning: unused bitwise operation which must be used +warning: unused bitwise operation that must be used --> $DIR/must-use-ops.rs:44:5 | LL | 5 << val; | ^^^^^^^^ -warning: unused bitwise operation which must be used +warning: unused bitwise operation that must be used --> $DIR/must-use-ops.rs:45:5 | LL | 5 >> val; | ^^^^^^^^ -warning: unused unary operation which must be used +warning: unused unary operation that must be used --> $DIR/must-use-ops.rs:48:5 | LL | !val; | ^^^^ -warning: unused unary operation which must be used +warning: unused unary operation that must be used --> $DIR/must-use-ops.rs:49:5 | LL | -val; | ^^^^ -warning: unused unary operation which must be used +warning: unused unary operation that must be used --> $DIR/must-use-ops.rs:50:5 | LL | *val_pointer; diff --git a/src/test/ui/tool_lints-fail.rs b/src/test/ui/tool_lints-fail.rs index ea1efab4cb6f8..4134fca1ce6ca 100644 --- a/src/test/ui/tool_lints-fail.rs +++ b/src/test/ui/tool_lints-fail.rs @@ -10,7 +10,7 @@ // Don't allow tool_lints, which aren't scoped -#![feature(tool_lints)] + #![deny(unknown_lints)] #![deny(clippy)] //~ ERROR: unknown lint: `clippy` diff --git a/src/test/ui/tool_lints.rs b/src/test/ui/tool_lints.rs index 71f90b17c18fc..001f2f11e5cb3 100644 --- a/src/test/ui/tool_lints.rs +++ b/src/test/ui/tool_lints.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(tool_lints)] + #[warn(foo::bar)] //~^ ERROR an unknown tool name found in scoped lint: `foo::bar` diff --git a/src/test/ui/unknown-lint-tool-name.rs b/src/test/ui/unknown-lint-tool-name.rs index 78b736edcebe6..a1d6c27e518e5 100644 --- a/src/test/ui/unknown-lint-tool-name.rs +++ b/src/test/ui/unknown-lint-tool-name.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(tool_lints)] + #![deny(foo::bar)] //~ ERROR an unknown tool name found in scoped lint: `foo::bar` diff --git a/src/test/ui/unused/unused-result.rs b/src/test/ui/unused/unused-result.rs index 363ab6220bd6e..69d226ef1d0ed 100644 --- a/src/test/ui/unused/unused-result.rs +++ b/src/test/ui/unused/unused-result.rs @@ -28,8 +28,8 @@ fn qux() -> MustUseMsg { return foo::(); } #[allow(unused_results)] fn test() { foo::(); - foo::(); //~ ERROR: unused `MustUse` which must be used - foo::(); //~ ERROR: unused `MustUseMsg` which must be used + foo::(); //~ ERROR: unused `MustUse` that must be used + foo::(); //~ ERROR: unused `MustUseMsg` that must be used //~^ NOTE: some message } @@ -42,8 +42,8 @@ fn test2() { fn main() { foo::(); //~ ERROR: unused result - foo::(); //~ ERROR: unused `MustUse` which must be used - foo::(); //~ ERROR: unused `MustUseMsg` which must be used + foo::(); //~ ERROR: unused `MustUse` that must be used + foo::(); //~ ERROR: unused `MustUseMsg` that must be used //~^ NOTE: some message let _ = foo::(); diff --git a/src/test/ui/unused/unused-result.stderr b/src/test/ui/unused/unused-result.stderr index e6ca7b8fab8fd..156ec889387b0 100644 --- a/src/test/ui/unused/unused-result.stderr +++ b/src/test/ui/unused/unused-result.stderr @@ -1,7 +1,7 @@ -error: unused `MustUse` which must be used +error: unused `MustUse` that must be used --> $DIR/unused-result.rs:31:5 | -LL | foo::(); //~ ERROR: unused `MustUse` which must be used +LL | foo::(); //~ ERROR: unused `MustUse` that must be used | ^^^^^^^^^^^^^^^^^ | note: lint level defined here @@ -10,10 +10,10 @@ note: lint level defined here LL | #![deny(unused_results, unused_must_use)] | ^^^^^^^^^^^^^^^ -error: unused `MustUseMsg` which must be used +error: unused `MustUseMsg` that must be used --> $DIR/unused-result.rs:32:5 | -LL | foo::(); //~ ERROR: unused `MustUseMsg` which must be used +LL | foo::(); //~ ERROR: unused `MustUseMsg` that must be used | ^^^^^^^^^^^^^^^^^^^^ | = note: some message @@ -30,16 +30,16 @@ note: lint level defined here LL | #![deny(unused_results, unused_must_use)] | ^^^^^^^^^^^^^^ -error: unused `MustUse` which must be used +error: unused `MustUse` that must be used --> $DIR/unused-result.rs:45:5 | -LL | foo::(); //~ ERROR: unused `MustUse` which must be used +LL | foo::(); //~ ERROR: unused `MustUse` that must be used | ^^^^^^^^^^^^^^^^^ -error: unused `MustUseMsg` which must be used +error: unused `MustUseMsg` that must be used --> $DIR/unused-result.rs:46:5 | -LL | foo::(); //~ ERROR: unused `MustUseMsg` which must be used +LL | foo::(); //~ ERROR: unused `MustUseMsg` that must be used | ^^^^^^^^^^^^^^^^^^^^ | = note: some message