Warn against redundant use<...>
This commit is contained in:
parent
f3fb727b08
commit
1529c661e4
10 changed files with 276 additions and 118 deletions
|
@ -2631,7 +2631,7 @@ pub struct OpaqueTy<'hir> {
|
|||
/// lowered as an associated type.
|
||||
pub in_trait: bool,
|
||||
/// List of arguments captured via `impl use<'a, P, ...> Trait` syntax.
|
||||
pub precise_capturing_args: Option<&'hir [PreciseCapturingArg<'hir>]>,
|
||||
pub precise_capturing_args: Option<(&'hir [PreciseCapturingArg<'hir>], Span)>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||
|
@ -2641,6 +2641,15 @@ pub enum PreciseCapturingArg<'hir> {
|
|||
Param(PreciseCapturingNonLifetimeArg),
|
||||
}
|
||||
|
||||
impl PreciseCapturingArg<'_> {
|
||||
pub fn hir_id(self) -> HirId {
|
||||
match self {
|
||||
PreciseCapturingArg::Lifetime(lt) => lt.hir_id,
|
||||
PreciseCapturingArg::Param(param) => param.hir_id,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// We need to have a [`Node`] for the [`HirId`] that we attach the type/const param
|
||||
/// resolution to. Lifetimes don't have this problem, and for them, it's actually
|
||||
/// kind of detrimental to use a custom node type versus just using [`Lifetime`],
|
||||
|
|
|
@ -533,7 +533,7 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item<'v>) -> V::
|
|||
try_visit!(visitor.visit_id(item.hir_id()));
|
||||
try_visit!(walk_generics(visitor, generics));
|
||||
walk_list!(visitor, visit_param_bound, bounds);
|
||||
if let Some(precise_capturing_args) = precise_capturing_args {
|
||||
if let Some((precise_capturing_args, _)) = precise_capturing_args {
|
||||
for arg in precise_capturing_args {
|
||||
try_visit!(visitor.visit_precise_capturing_arg(arg));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue