diff --git a/src/bootstrap/bin/main.rs b/src/bootstrap/bin/main.rs index da35c971f97..bd1a87c5744 100644 --- a/src/bootstrap/bin/main.rs +++ b/src/bootstrap/bin/main.rs @@ -6,7 +6,7 @@ //! directory in each respective module. // NO-RUSTC-WRAPPER -#![deny(warnings, rust_2018_idioms)] +#![deny(warnings, rust_2018_idioms, unused_lifetimes)] use std::env; diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs index 3888d0ef627..2e9044a8150 100644 --- a/src/bootstrap/bin/rustc.rs +++ b/src/bootstrap/bin/rustc.rs @@ -16,7 +16,7 @@ //! never get replaced. // NO-RUSTC-WRAPPER -#![deny(warnings, rust_2018_idioms)] +#![deny(warnings, rust_2018_idioms, unused_lifetimes)] use std::env; use std::ffi::OsString; @@ -129,6 +129,7 @@ fn main() { env::var_os("RUSTC_EXTERNAL_TOOL").is_none() { cmd.arg("-Dwarnings"); cmd.arg("-Drust_2018_idioms"); + cmd.arg("-Dunused_lifetimes"); // cfg(not(bootstrap)): Remove this during the next stage 0 compiler update. // `-Drustc::internal` is a new feature and `rustc_version` mis-reports the `stage`. let cfg_not_bootstrap = stage != "0" && crate_name != Some("rustc_version"); diff --git a/src/bootstrap/bin/rustdoc.rs b/src/bootstrap/bin/rustdoc.rs index 057daaf2dc4..ff38ee8788f 100644 --- a/src/bootstrap/bin/rustdoc.rs +++ b/src/bootstrap/bin/rustdoc.rs @@ -3,7 +3,7 @@ //! See comments in `src/bootstrap/rustc.rs` for more information. // NO-RUSTC-WRAPPER -#![deny(warnings, rust_2018_idioms)] +#![deny(warnings, rust_2018_idioms, unused_lifetimes)] use std::env; use std::process::Command; diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 0f7e4f6e977..c2e64ef51a7 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -104,7 +104,7 @@ //! also check out the `src/bootstrap/README.md` file for more information. // NO-RUSTC-WRAPPER -#![deny(warnings, rust_2018_idioms)] +#![deny(warnings, rust_2018_idioms, unused_lifetimes)] #![feature(core_intrinsics)] #![feature(drain_filter)] @@ -1313,7 +1313,7 @@ fn chmod(path: &Path, perms: u32) { fn chmod(_path: &Path, _perms: u32) {} -impl<'a> Compiler { +impl Compiler { pub fn with_stage(mut self, stage: u32) -> Compiler { self.stage = stage; self diff --git a/src/build_helper/lib.rs b/src/build_helper/lib.rs index f9371e878ef..c30307f3a1b 100644 --- a/src/build_helper/lib.rs +++ b/src/build_helper/lib.rs @@ -1,5 +1,5 @@ // NO-RUSTC-WRAPPER -#![deny(warnings, rust_2018_idioms)] +#![deny(warnings, rust_2018_idioms, unused_lifetimes)] use std::fs::File; use std::path::{Path, PathBuf}; diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs index 366191e2c85..eca726cd410 100644 --- a/src/liballoc/string.rs +++ b/src/liballoc/string.rs @@ -1838,6 +1838,7 @@ impl PartialEq for String { macro_rules! impl_eq { ($lhs:ty, $rhs: ty) => { #[stable(feature = "rust1", since = "1.0.0")] + #[allow(unused_lifetimes)] impl<'a, 'b> PartialEq<$rhs> for $lhs { #[inline] fn eq(&self, other: &$rhs) -> bool { PartialEq::eq(&self[..], &other[..]) } @@ -1846,6 +1847,7 @@ macro_rules! impl_eq { } #[stable(feature = "rust1", since = "1.0.0")] + #[allow(unused_lifetimes)] impl<'a, 'b> PartialEq<$lhs> for $rhs { #[inline] fn eq(&self, other: &$lhs) -> bool { PartialEq::eq(&self[..], &other[..]) } diff --git a/src/libarena/lib.rs b/src/libarena/lib.rs index 7baec3ed1cf..690d8344acf 100644 --- a/src/libarena/lib.rs +++ b/src/libarena/lib.rs @@ -11,8 +11,6 @@ #![doc(html_root_url = "https://doc.rust-lang.org/nightly/", test(no_crate_inject, attr(deny(warnings))))] -#![deny(unused_lifetimes)] - #![feature(core_intrinsics)] #![feature(dropck_eyepatch)] #![feature(raw_vec_internals)] diff --git a/src/libcore/array.rs b/src/libcore/array.rs index 6ecc0487fae..6023bc21e74 100644 --- a/src/libcore/array.rs +++ b/src/libcore/array.rs @@ -250,7 +250,7 @@ where } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, 'b, A, B, const N: usize> PartialEq<[A; N]> for [B] +impl PartialEq<[A; N]> for [B] where B: PartialEq, [A; N]: LengthAtMost32, @@ -266,7 +266,7 @@ where } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, 'b, A, B, const N: usize> PartialEq<&'b [B]> for [A; N] +impl<'b, A, B, const N: usize> PartialEq<&'b [B]> for [A; N] where A: PartialEq, [A; N]: LengthAtMost32, @@ -282,7 +282,7 @@ where } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, 'b, A, B, const N: usize> PartialEq<[A; N]> for &'b [B] +impl<'b, A, B, const N: usize> PartialEq<[A; N]> for &'b [B] where B: PartialEq, [A; N]: LengthAtMost32, @@ -298,7 +298,7 @@ where } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, 'b, A, B, const N: usize> PartialEq<&'b mut [B]> for [A; N] +impl<'b, A, B, const N: usize> PartialEq<&'b mut [B]> for [A; N] where A: PartialEq, [A; N]: LengthAtMost32, @@ -314,7 +314,7 @@ where } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, 'b, A, B, const N: usize> PartialEq<[A; N]> for &'b mut [B] +impl<'b, A, B, const N: usize> PartialEq<[A; N]> for &'b mut [B] where B: PartialEq, [A; N]: LengthAtMost32, diff --git a/src/libcore/pin.rs b/src/libcore/pin.rs index 2feaab7a09c..88a56174629 100644 --- a/src/libcore/pin.rs +++ b/src/libcore/pin.rs @@ -775,7 +775,7 @@ where {} #[stable(feature = "pin", since = "1.33.0")] -impl<'a, P, U> DispatchFromDyn> for Pin

+impl DispatchFromDyn> for Pin

where P: DispatchFromDyn, {} diff --git a/src/libcore/ptr/unique.rs b/src/libcore/ptr/unique.rs index d2517e51fc5..f0d011fe6b2 100644 --- a/src/libcore/ptr/unique.rs +++ b/src/libcore/ptr/unique.rs @@ -172,7 +172,7 @@ impl From<&T> for Unique { } #[unstable(feature = "ptr_internals", issue = "0")] -impl<'a, T: ?Sized> From> for Unique { +impl From> for Unique { #[inline] fn from(p: NonNull) -> Self { unsafe { Unique::new_unchecked(p.as_ptr()) } diff --git a/src/libfmt_macros/lib.rs b/src/libfmt_macros/lib.rs index d673088fe45..83e24a48ea0 100644 --- a/src/libfmt_macros/lib.rs +++ b/src/libfmt_macros/lib.rs @@ -8,8 +8,6 @@ html_playground_url = "https://play.rust-lang.org/", test(attr(deny(warnings))))] -#![deny(unused_lifetimes)] - #![feature(nll)] #![feature(rustc_private)] #![feature(unicode_internals)] diff --git a/src/libproc_macro/bridge/scoped_cell.rs b/src/libproc_macro/bridge/scoped_cell.rs index 89fb7070015..2cde1f65adf 100644 --- a/src/libproc_macro/bridge/scoped_cell.rs +++ b/src/libproc_macro/bridge/scoped_cell.rs @@ -5,6 +5,7 @@ use std::mem; use std::ops::{Deref, DerefMut}; /// Type lambda application, with a lifetime. +#[allow(unused_lifetimes)] pub trait ApplyL<'a> { type Out; } diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index 9957b173116..4b3fefcd4de 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -28,8 +28,6 @@ #![doc(html_root_url = "https://doc.rust-lang.org/nightly/")] -#![deny(unused_lifetimes)] - #![feature(arbitrary_self_types)] #![feature(box_patterns)] #![feature(box_syntax)] diff --git a/src/librustc_ast_borrowck/lib.rs b/src/librustc_ast_borrowck/lib.rs index 045671e37c0..dc818278a4b 100644 --- a/src/librustc_ast_borrowck/lib.rs +++ b/src/librustc_ast_borrowck/lib.rs @@ -1,7 +1,6 @@ #![doc(html_root_url = "https://doc.rust-lang.org/nightly/")] #![allow(non_camel_case_types)] -#![deny(unused_lifetimes)] #![feature(in_band_lifetimes)] #![feature(nll)] diff --git a/src/librustc_codegen_llvm/lib.rs b/src/librustc_codegen_llvm/lib.rs index 90609d6c85a..a630817fb33 100644 --- a/src/librustc_codegen_llvm/lib.rs +++ b/src/librustc_codegen_llvm/lib.rs @@ -21,7 +21,6 @@ #![feature(static_nobundle)] #![feature(trusted_len)] #![feature(mem_take)] -#![deny(unused_lifetimes)] use back::write::{create_target_machine, create_informational_target_machine}; use syntax_pos::symbol::Symbol; diff --git a/src/librustc_codegen_ssa/lib.rs b/src/librustc_codegen_ssa/lib.rs index 4e2977a011c..73ef16e0091 100644 --- a/src/librustc_codegen_ssa/lib.rs +++ b/src/librustc_codegen_ssa/lib.rs @@ -11,7 +11,6 @@ #![feature(nll)] #![feature(trusted_len)] #![feature(mem_take)] -#![deny(unused_lifetimes)] #![recursion_limit="256"] diff --git a/src/librustc_codegen_utils/lib.rs b/src/librustc_codegen_utils/lib.rs index e3fafc2f2cd..4ea375b59b2 100644 --- a/src/librustc_codegen_utils/lib.rs +++ b/src/librustc_codegen_utils/lib.rs @@ -15,8 +15,6 @@ #![recursion_limit="256"] -#![deny(unused_lifetimes)] - #[macro_use] extern crate rustc; diff --git a/src/librustc_data_structures/graph/mod.rs b/src/librustc_data_structures/graph/mod.rs index e59085a9e3a..749709521e8 100644 --- a/src/librustc_data_structures/graph/mod.rs +++ b/src/librustc_data_structures/graph/mod.rs @@ -39,6 +39,7 @@ where } } +#[allow(unused_lifetimes)] pub trait GraphSuccessors<'graph> { type Item; type Iter: Iterator; @@ -54,6 +55,7 @@ where ) -> >::Iter; } +#[allow(unused_lifetimes)] pub trait GraphPredecessors<'graph> { type Item; type Iter: Iterator; diff --git a/src/librustc_data_structures/owning_ref/mod.rs b/src/librustc_data_structures/owning_ref/mod.rs index a7af615fa50..3b49ce71063 100644 --- a/src/librustc_data_structures/owning_ref/mod.rs +++ b/src/librustc_data_structures/owning_ref/mod.rs @@ -283,6 +283,7 @@ impl Erased for T {} /// Helper trait for erasing the concrete type of what an owner dereferences to, /// for example `Box -> Box`. This would be unneeded with /// higher kinded types support in the language. +#[allow(unused_lifetimes)] pub unsafe trait IntoErased<'a> { /// Owner with the dereference type substituted to `Erased`. type Erased; @@ -293,6 +294,7 @@ pub unsafe trait IntoErased<'a> { /// Helper trait for erasing the concrete type of what an owner dereferences to, /// for example `Box -> Box`. This would be unneeded with /// higher kinded types support in the language. +#[allow(unused_lifetimes)] pub unsafe trait IntoErasedSend<'a> { /// Owner with the dereference type substituted to `Erased + Send`. type Erased: Send; @@ -303,6 +305,7 @@ pub unsafe trait IntoErasedSend<'a> { /// Helper trait for erasing the concrete type of what an owner dereferences to, /// for example `Box -> Box`. This would be unneeded with /// higher kinded types support in the language. +#[allow(unused_lifetimes)] pub unsafe trait IntoErasedSendSync<'a> { /// Owner with the dereference type substituted to `Erased + Send + Sync`. type Erased: Send + Sync; diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index 66739761ef0..77b7ef96d3f 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -16,8 +16,6 @@ #![recursion_limit="256"] -#![deny(unused_lifetimes)] - pub extern crate getopts; #[cfg(unix)] extern crate libc; diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs index f252d0573dc..3f758c2521b 100644 --- a/src/librustc_errors/lib.rs +++ b/src/librustc_errors/lib.rs @@ -8,7 +8,6 @@ #![cfg_attr(unix, feature(libc))] #![feature(nll)] #![feature(optin_builtin_traits)] -#![deny(unused_lifetimes)] pub use emitter::ColorConfig; diff --git a/src/librustc_incremental/lib.rs b/src/librustc_incremental/lib.rs index 0b5eb41605b..b2573111385 100644 --- a/src/librustc_incremental/lib.rs +++ b/src/librustc_incremental/lib.rs @@ -8,8 +8,6 @@ #![recursion_limit="256"] -#![deny(unused_lifetimes)] - #[macro_use] extern crate rustc; #[macro_use] extern crate log; diff --git a/src/librustc_interface/lib.rs b/src/librustc_interface/lib.rs index f4e4612007c..2e593d44155 100644 --- a/src/librustc_interface/lib.rs +++ b/src/librustc_interface/lib.rs @@ -6,8 +6,6 @@ #![feature(generators)] #![cfg_attr(unix, feature(libc))] -#![deny(unused_lifetimes)] - #![recursion_limit="256"] #[cfg(unix)] diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs index 1d3b2b62996..d3975360525 100644 --- a/src/librustc_lint/lib.rs +++ b/src/librustc_lint/lib.rs @@ -19,8 +19,6 @@ #![recursion_limit="256"] -#![deny(unused_lifetimes)] - #[macro_use] extern crate rustc; diff --git a/src/librustc_metadata/lib.rs b/src/librustc_metadata/lib.rs index ce7fb7cdc66..c96d02d9b37 100644 --- a/src/librustc_metadata/lib.rs +++ b/src/librustc_metadata/lib.rs @@ -15,8 +15,6 @@ #![recursion_limit="256"] -#![deny(unused_lifetimes)] - extern crate libc; extern crate proc_macro; diff --git a/src/librustc_mir/lib.rs b/src/librustc_mir/lib.rs index 28e5c5dc99a..20d5e54d2ce 100644 --- a/src/librustc_mir/lib.rs +++ b/src/librustc_mir/lib.rs @@ -26,8 +26,6 @@ Rust MIR: a lowered representation of Rust. Also: an experiment! #![recursion_limit="256"] -#![deny(unused_lifetimes)] - #[macro_use] extern crate log; #[macro_use] extern crate rustc; #[macro_use] extern crate rustc_data_structures; diff --git a/src/librustc_passes/lib.rs b/src/librustc_passes/lib.rs index 6c11d82958b..5614b570b92 100644 --- a/src/librustc_passes/lib.rs +++ b/src/librustc_passes/lib.rs @@ -13,8 +13,6 @@ #![recursion_limit="256"] -#![deny(unused_lifetimes)] - #[macro_use] extern crate rustc; diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 75c98753d31..e291f40ffd2 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -1,7 +1,5 @@ #![doc(html_root_url = "https://doc.rust-lang.org/nightly/")] -#![deny(unused_lifetimes)] - #![feature(in_band_lifetimes)] #![feature(nll)] #![feature(rustc_diagnostic_macros)] diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index c7982b4a396..bc5898fe78d 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -10,8 +10,6 @@ #![recursion_limit="256"] -#![deny(unused_lifetimes)] - pub use rustc::hir::def::{Namespace, PerNS}; use Determinacy::*; diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs index 1e18b34e5c8..9edb4c0fa67 100644 --- a/src/librustc_save_analysis/lib.rs +++ b/src/librustc_save_analysis/lib.rs @@ -1,10 +1,8 @@ #![doc(html_root_url = "https://doc.rust-lang.org/nightly/")] #![feature(nll)] -#![deny(unused_lifetimes)] #![recursion_limit="256"] - mod dumper; mod dump_visitor; #[macro_use] diff --git a/src/librustc_target/lib.rs b/src/librustc_target/lib.rs index 0fc5fbdc6a2..a349dc26e83 100644 --- a/src/librustc_target/lib.rs +++ b/src/librustc_target/lib.rs @@ -13,8 +13,6 @@ #![feature(nll)] #![feature(slice_patterns)] -#![deny(unused_lifetimes)] - #[macro_use] extern crate log; pub mod abi; diff --git a/src/librustc_traits/lib.rs b/src/librustc_traits/lib.rs index ec5a8bc544b..ebe6b7c6138 100644 --- a/src/librustc_traits/lib.rs +++ b/src/librustc_traits/lib.rs @@ -1,8 +1,6 @@ //! New recursive solver modeled on Chalk's recursive solver. Most of //! the guts are broken up into modules; see the comments in those modules. -#![deny(unused_lifetimes)] - #![feature(crate_visibility_modifier)] #![feature(in_band_lifetimes)] #![feature(nll)] diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index 284b1d533d5..a34b137aca9 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -73,8 +73,6 @@ This API is completely unstable and subject to change. #![recursion_limit="256"] -#![deny(unused_lifetimes)] - #[macro_use] extern crate log; #[macro_use] extern crate syntax; diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 74a7b2b9152..a8d7ff4a2eb 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -1,5 +1,3 @@ -#![deny(unused_lifetimes)] - #![doc(html_root_url = "https://doc.rust-lang.org/nightly/", html_playground_url = "https://play.rust-lang.org/")] diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 1390341cf7c..8fd76eabe39 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -210,6 +210,7 @@ #![warn(missing_debug_implementations)] #![deny(intra_doc_link_resolution_failure)] // rustdoc is run without -D warnings #![allow(explicit_outlives_requirements)] +#![allow(unused_lifetimes)] // Tell the compiler to link to either panic_abort or panic_unwind #![needs_panic_runtime] diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 5ef80518b40..1fd20fa0b31 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -7,8 +7,6 @@ #![doc(html_root_url = "https://doc.rust-lang.org/nightly/", test(attr(deny(warnings))))] -#![deny(unused_lifetimes)] - #![feature(bind_by_move_pattern_guards)] #![feature(box_syntax)] #![feature(const_fn)] diff --git a/src/libsyntax_ext/lib.rs b/src/libsyntax_ext/lib.rs index 21031109f2a..da11f2ff23f 100644 --- a/src/libsyntax_ext/lib.rs +++ b/src/libsyntax_ext/lib.rs @@ -3,8 +3,6 @@ #![doc(html_root_url = "https://doc.rust-lang.org/nightly/")] -#![deny(unused_lifetimes)] - #![feature(crate_visibility_modifier)] #![feature(decl_macro)] #![feature(mem_take)] diff --git a/src/libsyntax_pos/lib.rs b/src/libsyntax_pos/lib.rs index bc7be9f34ee..acc13aec402 100644 --- a/src/libsyntax_pos/lib.rs +++ b/src/libsyntax_pos/lib.rs @@ -6,8 +6,6 @@ #![doc(html_root_url = "https://doc.rust-lang.org/nightly/")] -#![deny(unused_lifetimes)] - #![feature(const_fn)] #![feature(crate_visibility_modifier)] #![feature(nll)]