rustc: deny(unused_lifetimes).
This commit is contained in:
parent
ce0ba38921
commit
774724be3c
@ -589,7 +589,7 @@ struct HirItemLike<T> {
|
||||
hash_bodies: bool,
|
||||
}
|
||||
|
||||
impl<'a, 'hir, T> HashStable<StableHashingContext<'hir>> for HirItemLike<T>
|
||||
impl<'hir, T> HashStable<StableHashingContext<'hir>> for HirItemLike<T>
|
||||
where T: HashStable<StableHashingContext<'hir>>
|
||||
{
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
|
@ -393,7 +393,7 @@ fn hash_stable<W: StableHasherResult>(
|
||||
}
|
||||
}
|
||||
|
||||
pub fn hash_stable_trait_impls<'a, 'gcx, W>(
|
||||
pub fn hash_stable_trait_impls<'a, W>(
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>,
|
||||
blanket_impls: &[DefId],
|
||||
|
@ -135,7 +135,7 @@ fn hash_stable<W: StableHasherResult>(&self,
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'gcx, T> HashStable<StableHashingContext<'a>> for ty::Binder<T>
|
||||
impl<'a, T> HashStable<StableHashingContext<'a>> for ty::Binder<T>
|
||||
where T: HashStable<StableHashingContext<'a>>
|
||||
{
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
@ -192,7 +192,7 @@ fn to_stable_hash_key(&self, _: &StableHashingContext<'a>) -> region::Scope {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'gcx> HashStable<StableHashingContext<'a>>
|
||||
impl<'a> HashStable<StableHashingContext<'a>>
|
||||
for ty::TyVid
|
||||
{
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
@ -204,7 +204,7 @@ fn hash_stable<W: StableHasherResult>(&self,
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'gcx> HashStable<StableHashingContext<'a>>
|
||||
impl<'a> HashStable<StableHashingContext<'a>>
|
||||
for ty::IntVid
|
||||
{
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
@ -216,7 +216,7 @@ fn hash_stable<W: StableHasherResult>(&self,
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'gcx> HashStable<StableHashingContext<'a>>
|
||||
impl<'a> HashStable<StableHashingContext<'a>>
|
||||
for ty::FloatVid
|
||||
{
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
@ -228,7 +228,7 @@ fn hash_stable<W: StableHasherResult>(&self,
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'gcx, T> HashStable<StableHashingContext<'a>>
|
||||
impl<'a, T> HashStable<StableHashingContext<'a>>
|
||||
for ty::steal::Steal<T>
|
||||
where T: HashStable<StableHashingContext<'a>>
|
||||
{
|
||||
|
@ -858,7 +858,7 @@ pub fn to_ty(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Ty<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'gcx, 'tcx> VerifyBound<'tcx> {
|
||||
impl<'tcx> VerifyBound<'tcx> {
|
||||
pub fn must_hold(&self) -> bool {
|
||||
match self {
|
||||
VerifyBound::IfEq(..) => false,
|
||||
|
@ -30,6 +30,7 @@
|
||||
|
||||
#![deny(rust_2018_idioms)]
|
||||
#![deny(internal)]
|
||||
#![deny(unused_lifetimes)]
|
||||
#![allow(explicit_outlives_requirements)]
|
||||
|
||||
#![feature(arbitrary_self_types)]
|
||||
|
@ -566,7 +566,7 @@ impl LintPassObject for EarlyLintPassObject {}
|
||||
|
||||
impl LintPassObject for LateLintPassObject {}
|
||||
|
||||
pub trait LintContext<'tcx>: Sized {
|
||||
pub trait LintContext: Sized {
|
||||
type PassObject: LintPassObject;
|
||||
|
||||
fn sess(&self) -> &Session;
|
||||
@ -700,7 +700,7 @@ fn exit_attrs(&mut self, attrs: &'a [ast::Attribute]) {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> LintContext<'tcx> for LateContext<'a, 'tcx> {
|
||||
impl LintContext for LateContext<'_, '_> {
|
||||
type PassObject = LateLintPassObject;
|
||||
|
||||
/// Gets the overall compiler `Session` object.
|
||||
@ -728,7 +728,7 @@ fn lookup<S: Into<MultiSpan>>(&self,
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> LintContext<'a> for EarlyContext<'a> {
|
||||
impl LintContext for EarlyContext<'_> {
|
||||
type PassObject = EarlyLintPassObject;
|
||||
|
||||
/// Gets the overall compiler `Session` object.
|
||||
|
@ -80,7 +80,7 @@ impl<> for enum $enum_name [ $enum_name ] { $( $variant
|
||||
// We want to use the enum name both in the `impl ... for $enum_name` as well as for
|
||||
// importing all the variants. Unfortunately it seems we have to take the name
|
||||
// twice for this purpose
|
||||
(impl<$($lt:lifetime $(: $lt_bound:lifetime)? ),* $(,)? $($T:ident),* $(,)?>
|
||||
(impl<$($T:ident),* $(,)?>
|
||||
for enum $enum_name:path
|
||||
[ $enum_path:path ]
|
||||
{
|
||||
@ -91,7 +91,7 @@ impl<> for enum $enum_name [ $enum_name ] { $( $variant
|
||||
$( { $($named_field:ident $(-> $named_delegate:tt)?),* } )?
|
||||
),* $(,)?
|
||||
}) => {
|
||||
impl<'a, $($lt $(: $lt_bound)?,)* $($T,)*>
|
||||
impl<$($T,)*>
|
||||
::rustc_data_structures::stable_hasher::HashStable<$crate::ich::StableHashingContext<'a>>
|
||||
for $enum_name
|
||||
where $($T: ::rustc_data_structures::stable_hasher::HashStable<$crate::ich::StableHashingContext<'a>>),*
|
||||
@ -117,13 +117,13 @@ fn hash_stable<W: ::rustc_data_structures::stable_hasher::StableHasherResult>(&s
|
||||
// Structs
|
||||
(struct $struct_name:path { $($field:ident $(-> $delegate:tt)?),* $(,)? }) => {
|
||||
impl_stable_hash_for!(
|
||||
impl<'tcx> for struct $struct_name { $($field $(-> $delegate)?),* }
|
||||
impl<> for struct $struct_name { $($field $(-> $delegate)?),* }
|
||||
);
|
||||
};
|
||||
(impl<$($lt:lifetime $(: $lt_bound:lifetime)? ),* $(,)? $($T:ident),* $(,)?> for struct $struct_name:path {
|
||||
(impl<$($T:ident),* $(,)?> for struct $struct_name:path {
|
||||
$($field:ident $(-> $delegate:tt)?),* $(,)?
|
||||
}) => {
|
||||
impl<'a, $($lt $(: $lt_bound)?,)* $($T,)*>
|
||||
impl<$($T,)*>
|
||||
::rustc_data_structures::stable_hasher::HashStable<$crate::ich::StableHashingContext<'a>> for $struct_name
|
||||
where $($T: ::rustc_data_structures::stable_hasher::HashStable<$crate::ich::StableHashingContext<'a>>),*
|
||||
{
|
||||
@ -143,12 +143,12 @@ fn hash_stable<W: ::rustc_data_structures::stable_hasher::StableHasherResult>(&s
|
||||
// We cannot use normal parentheses here, the parser won't allow it
|
||||
(tuple_struct $struct_name:path { $($field:ident $(-> $delegate:tt)?),* $(,)? }) => {
|
||||
impl_stable_hash_for!(
|
||||
impl<'tcx> for tuple_struct $struct_name { $($field $(-> $delegate)?),* }
|
||||
impl<> for tuple_struct $struct_name { $($field $(-> $delegate)?),* }
|
||||
);
|
||||
};
|
||||
(impl<$($lt:lifetime $(: $lt_bound:lifetime)? ),* $(,)? $($T:ident),* $(,)?>
|
||||
(impl<$($T:ident),* $(,)?>
|
||||
for tuple_struct $struct_name:path { $($field:ident $(-> $delegate:tt)?),* $(,)? }) => {
|
||||
impl<'a, $($lt $(: $lt_bound)?,)* $($T,)*>
|
||||
impl<$($T,)*>
|
||||
::rustc_data_structures::stable_hasher::HashStable<$crate::ich::StableHashingContext<'a>> for $struct_name
|
||||
where $($T: ::rustc_data_structures::stable_hasher::HashStable<$crate::ich::StableHashingContext<'a>>),*
|
||||
{
|
||||
@ -170,7 +170,7 @@ fn hash_stable<W: ::rustc_data_structures::stable_hasher::StableHasherResult>(&s
|
||||
macro_rules! impl_stable_hash_for_spanned {
|
||||
($T:path) => (
|
||||
|
||||
impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for ::syntax::source_map::Spanned<$T>
|
||||
impl HashStable<StableHashingContext<'a>> for ::syntax::source_map::Spanned<$T>
|
||||
{
|
||||
#[inline]
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
|
@ -105,7 +105,7 @@ fn from(alloc_id: AllocId) -> Self {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> Pointer<()> {
|
||||
impl Pointer<()> {
|
||||
#[inline(always)]
|
||||
pub fn new(alloc_id: AllocId, offset: Size) -> Self {
|
||||
Pointer { alloc_id, offset, tag: () }
|
||||
|
@ -146,7 +146,7 @@ fn from(f: Double) -> Self {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> Scalar<()> {
|
||||
impl Scalar<()> {
|
||||
#[inline(always)]
|
||||
fn check_data(data: u128, size: u8) {
|
||||
debug_assert_eq!(truncate(data, Size::from_bytes(size as u64)), data,
|
||||
|
@ -967,7 +967,7 @@ pub enum PlaceContext {
|
||||
NonUse(NonUseContext),
|
||||
}
|
||||
|
||||
impl<'tcx> PlaceContext {
|
||||
impl PlaceContext {
|
||||
/// Returns `true` if this place context represents a drop.
|
||||
pub fn is_drop(&self) -> bool {
|
||||
match *self {
|
||||
|
@ -785,7 +785,7 @@ pub fn $buildfn(matches: &getopts::Matches, error_format: ErrorOutputType) -> $s
|
||||
return op;
|
||||
}
|
||||
|
||||
impl<'a> dep_tracking::DepTrackingHash for $struct_name {
|
||||
impl dep_tracking::DepTrackingHash for $struct_name {
|
||||
fn hash(&self, hasher: &mut DefaultHasher, error_format: ErrorOutputType) {
|
||||
let mut sub_hashes = BTreeMap::new();
|
||||
$({
|
||||
|
@ -270,7 +270,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
|
||||
// the final synthesized generics: we don't want our generated docs page to contain something
|
||||
// like 'T: Copy + Clone', as that's redundant. Therefore, we keep track of a separate
|
||||
// 'user_env', which only holds the predicates that will actually be displayed to the user.
|
||||
fn evaluate_predicates<'b, 'gcx, 'c>(
|
||||
fn evaluate_predicates<'b, 'c>(
|
||||
&self,
|
||||
infcx: &InferCtxt<'b, 'tcx, 'c>,
|
||||
trait_did: DefId,
|
||||
|
@ -1191,7 +1191,7 @@ fn fold_ex_clause_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(
|
||||
folder: &mut F,
|
||||
) -> chalk_engine::ExClause<Self>;
|
||||
|
||||
fn visit_ex_clause_with<'gcx: 'tcx, V: TypeVisitor<'tcx>>(
|
||||
fn visit_ex_clause_with<V: TypeVisitor<'tcx>>(
|
||||
ex_clause: &chalk_engine::ExClause<Self>,
|
||||
visitor: &mut V,
|
||||
) -> bool;
|
||||
|
@ -145,7 +145,7 @@ impl<'tcx, T> Lift<'tcx> for Normalize<T> {
|
||||
}
|
||||
|
||||
impl_stable_hash_for! {
|
||||
impl<'tcx, T> for struct Normalize<T> {
|
||||
impl<T> for struct Normalize<T> {
|
||||
value
|
||||
}
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ pub enum IntercrateAmbiguityCause {
|
||||
impl IntercrateAmbiguityCause {
|
||||
/// Emits notes when the overlap is caused by complex intercrate ambiguities.
|
||||
/// See #23980 for details.
|
||||
pub fn add_intercrate_ambiguity_hint<'a, 'tcx>(
|
||||
pub fn add_intercrate_ambiguity_hint(
|
||||
&self,
|
||||
err: &mut errors::DiagnosticBuilder<'_>,
|
||||
) {
|
||||
@ -2299,7 +2299,7 @@ fn assemble_candidates_for_trait_alias(
|
||||
/// candidates and prefer where-clause candidates.
|
||||
///
|
||||
/// See the comment for "SelectionCandidate" for more details.
|
||||
fn candidate_should_be_dropped_in_favor_of<'o>(
|
||||
fn candidate_should_be_dropped_in_favor_of(
|
||||
&mut self,
|
||||
victim: &EvaluatedCandidate<'tcx>,
|
||||
other: &EvaluatedCandidate<'tcx>,
|
||||
@ -2423,7 +2423,7 @@ fn candidate_should_be_dropped_in_favor_of<'o>(
|
||||
// These cover the traits that are built-in to the language
|
||||
// itself: `Copy`, `Clone` and `Sized`.
|
||||
|
||||
fn assemble_builtin_bound_candidates<'o>(
|
||||
fn assemble_builtin_bound_candidates(
|
||||
&mut self,
|
||||
conditions: BuiltinImplConditions<'tcx>,
|
||||
candidates: &mut SelectionCandidateSet<'tcx>,
|
||||
|
@ -90,13 +90,13 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, N: fmt::Debug> fmt::Debug for traits::VtableBuiltinData<N> {
|
||||
impl<N: fmt::Debug> fmt::Debug for traits::VtableBuiltinData<N> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "VtableBuiltinData(nested={:?})", self.nested)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, N: fmt::Debug> fmt::Debug for traits::VtableAutoImplData<N> {
|
||||
impl<N: fmt::Debug> fmt::Debug for traits::VtableAutoImplData<N> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
|
@ -154,7 +154,7 @@ pub fn map_def<U, F>(self, map: F) -> SimplifiedTypeGen<U>
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'gcx, D> HashStable<StableHashingContext<'a>> for SimplifiedTypeGen<D>
|
||||
impl<'a, D> HashStable<StableHashingContext<'a>> for SimplifiedTypeGen<D>
|
||||
where D: Copy + Debug + Ord + Eq + Hash +
|
||||
HashStable<StableHashingContext<'a>>,
|
||||
{
|
||||
|
@ -442,7 +442,7 @@ fn resolve_associated_item<'a, 'tcx>(
|
||||
}
|
||||
}
|
||||
|
||||
fn needs_fn_once_adapter_shim<'a, 'tcx>(actual_closure_kind: ty::ClosureKind,
|
||||
fn needs_fn_once_adapter_shim(actual_closure_kind: ty::ClosureKind,
|
||||
trait_closure_kind: ty::ClosureKind)
|
||||
-> Result<bool, ()>
|
||||
{
|
||||
|
@ -1678,7 +1678,7 @@ pub fn layout_of(self, param_env_and_ty: ty::ParamEnvAnd<'tcx, Ty<'tcx>>)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx>
|
||||
impl<'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx>
|
||||
where C: LayoutOf<Ty = Ty<'tcx>> + HasTyCtxt<'tcx>,
|
||||
C::TyLayout: MaybeResult<TyLayout<'tcx>>,
|
||||
C: HasParamEnv<'tcx>
|
||||
|
@ -203,7 +203,7 @@ pub fn def_kind(&self) -> DefKind {
|
||||
|
||||
/// Tests whether the associated item admits a non-trivial implementation
|
||||
/// for !
|
||||
pub fn relevant_for_never<'tcx>(&self) -> bool {
|
||||
pub fn relevant_for_never(&self) -> bool {
|
||||
match self.kind {
|
||||
AssocKind::Existential |
|
||||
AssocKind::Const |
|
||||
@ -1614,7 +1614,7 @@ pub struct Placeholder<T> {
|
||||
pub name: T,
|
||||
}
|
||||
|
||||
impl<'a, 'gcx, T> HashStable<StableHashingContext<'a>> for Placeholder<T>
|
||||
impl<'a, T> HashStable<StableHashingContext<'a>> for Placeholder<T>
|
||||
where T: HashStable<StableHashingContext<'a>>
|
||||
{
|
||||
fn hash_stable<W: StableHasherResult>(
|
||||
|
@ -11,6 +11,8 @@
|
||||
|
||||
pub mod obsolete;
|
||||
|
||||
// FIXME(eddyb) false positive, the lifetime parameters are used with `P: Printer<...>`.
|
||||
#[allow(unused_lifetimes)]
|
||||
pub trait Print<'gcx, 'tcx, P> {
|
||||
type Output;
|
||||
type Error;
|
||||
|
@ -17,6 +17,8 @@
|
||||
|
||||
// Query configuration and description traits.
|
||||
|
||||
// FIXME(eddyb) false positive, the lifetime parameter is used for `Key`/`Value`.
|
||||
#[allow(unused_lifetimes)]
|
||||
pub trait QueryConfig<'tcx> {
|
||||
const NAME: QueryName;
|
||||
const CATEGORY: ProfileCategory;
|
||||
|
@ -886,7 +886,7 @@ pub fn dummy<'tcx>(value: T) -> Binder<T>
|
||||
}
|
||||
|
||||
/// Wraps `value` in a binder, binding higher-ranked vars (if any).
|
||||
pub fn bind<'tcx>(value: T) -> Binder<T> {
|
||||
pub fn bind(value: T) -> Binder<T> {
|
||||
Binder(value)
|
||||
}
|
||||
|
||||
@ -988,7 +988,7 @@ pub struct ProjectionTy<'tcx> {
|
||||
pub item_def_id: DefId,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> ProjectionTy<'tcx> {
|
||||
impl<'tcx> ProjectionTy<'tcx> {
|
||||
/// Construct a `ProjectionTy` by searching the trait from `trait_ref` for the
|
||||
/// associated item named `item_name`.
|
||||
pub fn from_ref_and_name(
|
||||
|
@ -3,6 +3,8 @@
|
||||
/// Basically a workaround; see [this comment] for details.
|
||||
///
|
||||
/// [this comment]: https://github.com/rust-lang/rust/issues/34511#issuecomment-373423999
|
||||
// FIXME(eddyb) false positive, the lifetime parameter is "phantom" but needed.
|
||||
#[allow(unused_lifetimes)]
|
||||
pub trait Captures<'a> { }
|
||||
|
||||
impl<'a, T: ?Sized> Captures<'a> for T { }
|
||||
|
Loading…
Reference in New Issue
Block a user