Skip to content

Commit

Permalink
Deny unused_lifetimes through rustbuild
Browse files Browse the repository at this point in the history
  • Loading branch information
petrochenkov committed Jul 28, 2019
1 parent 4341521 commit 676d282
Show file tree
Hide file tree
Showing 38 changed files with 23 additions and 59 deletions.
2 changes: 1 addition & 1 deletion src/bootstrap/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
3 changes: 2 additions & 1 deletion src/bootstrap/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/bin/rustdoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/build_helper/lib.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
2 changes: 2 additions & 0 deletions src/liballoc/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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[..]) }
Expand All @@ -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[..]) }
Expand Down
2 changes: 0 additions & 2 deletions src/libarena/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
10 changes: 5 additions & 5 deletions src/libcore/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<A, B, const N: usize> PartialEq<[A; N]> for [B]
where
B: PartialEq<A>,
[A; N]: LengthAtMost32,
Expand All @@ -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<B>,
[A; N]: LengthAtMost32,
Expand All @@ -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>,
[A; N]: LengthAtMost32,
Expand All @@ -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<B>,
[A; N]: LengthAtMost32,
Expand All @@ -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>,
[A; N]: LengthAtMost32,
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/pin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ where
{}

#[stable(feature = "pin", since = "1.33.0")]
impl<'a, P, U> DispatchFromDyn<Pin<U>> for Pin<P>
impl<P, U> DispatchFromDyn<Pin<U>> for Pin<P>
where
P: DispatchFromDyn<U>,
{}
2 changes: 1 addition & 1 deletion src/libcore/ptr/unique.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ impl<T: ?Sized> From<&T> for Unique<T> {
}

#[unstable(feature = "ptr_internals", issue = "0")]
impl<'a, T: ?Sized> From<NonNull<T>> for Unique<T> {
impl<T: ?Sized> From<NonNull<T>> for Unique<T> {
#[inline]
fn from(p: NonNull<T>) -> Self {
unsafe { Unique::new_unchecked(p.as_ptr()) }
Expand Down
2 changes: 0 additions & 2 deletions src/libfmt_macros/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
1 change: 1 addition & 0 deletions src/libproc_macro/bridge/scoped_cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 0 additions & 2 deletions src/librustc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
1 change: 0 additions & 1 deletion src/librustc_ast_borrowck/lib.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
1 change: 0 additions & 1 deletion src/librustc_codegen_llvm/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion src/librustc_codegen_ssa/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#![feature(nll)]
#![feature(trusted_len)]
#![feature(mem_take)]
#![deny(unused_lifetimes)]

#![recursion_limit="256"]

Expand Down
2 changes: 0 additions & 2 deletions src/librustc_codegen_utils/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

#![recursion_limit="256"]

#![deny(unused_lifetimes)]

#[macro_use]
extern crate rustc;

Expand Down
2 changes: 2 additions & 0 deletions src/librustc_data_structures/graph/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ where
}
}

#[allow(unused_lifetimes)]
pub trait GraphSuccessors<'graph> {
type Item;
type Iter: Iterator<Item = Self::Item>;
Expand All @@ -54,6 +55,7 @@ where
) -> <Self as GraphPredecessors<'_>>::Iter;
}

#[allow(unused_lifetimes)]
pub trait GraphPredecessors<'graph> {
type Item;
type Iter: Iterator<Item = Self::Item>;
Expand Down
3 changes: 3 additions & 0 deletions src/librustc_data_structures/owning_ref/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ impl<T> Erased for T {}
/// Helper trait for erasing the concrete type of what an owner dereferences to,
/// for example `Box<T> -> Box<Erased>`. 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;
Expand All @@ -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<T> -> Box<Erased + Send>`. 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;
Expand All @@ -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<T> -> Box<Erased + Send + Sync>`. 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;
Expand Down
2 changes: 0 additions & 2 deletions src/librustc_driver/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

#![recursion_limit="256"]

#![deny(unused_lifetimes)]

pub extern crate getopts;
#[cfg(unix)]
extern crate libc;
Expand Down
1 change: 0 additions & 1 deletion src/librustc_errors/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#![cfg_attr(unix, feature(libc))]
#![feature(nll)]
#![feature(optin_builtin_traits)]
#![deny(unused_lifetimes)]

pub use emitter::ColorConfig;

Expand Down
2 changes: 0 additions & 2 deletions src/librustc_incremental/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

#![recursion_limit="256"]

#![deny(unused_lifetimes)]

#[macro_use] extern crate rustc;
#[macro_use] extern crate log;

Expand Down
2 changes: 0 additions & 2 deletions src/librustc_interface/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
#![feature(generators)]
#![cfg_attr(unix, feature(libc))]

#![deny(unused_lifetimes)]

#![recursion_limit="256"]

#[cfg(unix)]
Expand Down
2 changes: 0 additions & 2 deletions src/librustc_lint/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

#![recursion_limit="256"]

#![deny(unused_lifetimes)]

#[macro_use]
extern crate rustc;

Expand Down
2 changes: 0 additions & 2 deletions src/librustc_metadata/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

#![recursion_limit="256"]

#![deny(unused_lifetimes)]

extern crate libc;
extern crate proc_macro;

Expand Down
2 changes: 0 additions & 2 deletions src/librustc_mir/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions src/librustc_passes/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

#![recursion_limit="256"]

#![deny(unused_lifetimes)]

#[macro_use]
extern crate rustc;

Expand Down
2 changes: 0 additions & 2 deletions src/librustc_privacy/lib.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
2 changes: 0 additions & 2 deletions src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

#![recursion_limit="256"]

#![deny(unused_lifetimes)]

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

use Determinacy::*;
Expand Down
2 changes: 0 additions & 2 deletions src/librustc_save_analysis/lib.rs
Original file line number Diff line number Diff line change
@@ -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]
Expand Down
2 changes: 0 additions & 2 deletions src/librustc_target/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
#![feature(nll)]
#![feature(slice_patterns)]

#![deny(unused_lifetimes)]

#[macro_use] extern crate log;

pub mod abi;
Expand Down
2 changes: 0 additions & 2 deletions src/librustc_traits/lib.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
2 changes: 0 additions & 2 deletions src/librustc_typeck/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 0 additions & 2 deletions src/librustdoc/lib.rs
Original file line number Diff line number Diff line change
@@ -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/")]

Expand Down
1 change: 1 addition & 0 deletions src/libstd/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 0 additions & 2 deletions src/libsyntax/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
Loading

0 comments on commit 676d282

Please sign in to comment.