mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-29 12:36:35 +03:00
implement nits
This commit is contained in:
@@ -2210,7 +2210,7 @@ fn lower_generic_param(
|
||||
.attrs
|
||||
.iter()
|
||||
.filter(|attr| self.sess.check_name(attr, sym::rustc_synthetic))
|
||||
.map(|_| hir::SyntheticTyParamKind::Rustc)
|
||||
.map(|_| hir::SyntheticTyParamKind::FromAttr)
|
||||
.next(),
|
||||
};
|
||||
|
||||
|
||||
@@ -509,7 +509,7 @@ pub fn spans(&self) -> MultiSpan {
|
||||
pub enum SyntheticTyParamKind {
|
||||
ImplTrait,
|
||||
// Created by the `#[rustc_synthetic]` attribute.
|
||||
Rustc,
|
||||
FromAttr,
|
||||
}
|
||||
|
||||
/// A where-clause in a definition.
|
||||
|
||||
@@ -170,7 +170,8 @@ fn visit_generic_param(&mut self, param: &'hir hir::GenericParam<'hir>) {
|
||||
..
|
||||
} = param.kind
|
||||
{
|
||||
// Do nothing because bodging is fun.
|
||||
// Synthetic impl trait parameters are owned by the node of the desugared type.
|
||||
// This means it is correct for them to have a different owner.
|
||||
} else {
|
||||
intravisit::walk_generic_param(self, param);
|
||||
}
|
||||
|
||||
@@ -548,14 +548,18 @@ pub(crate) fn check_impl_trait(
|
||||
generics: &ty::Generics,
|
||||
) -> bool {
|
||||
let explicit = !seg.infer_args;
|
||||
let impl_trait = generics.params.iter().any(|param| match param.kind {
|
||||
ty::GenericParamDefKind::Type {
|
||||
synthetic:
|
||||
Some(hir::SyntheticTyParamKind::ImplTrait | hir::SyntheticTyParamKind::Rustc),
|
||||
..
|
||||
} => true,
|
||||
_ => false,
|
||||
});
|
||||
let impl_trait =
|
||||
generics.params.iter().any(|param| match param.kind {
|
||||
ty::GenericParamDefKind::Type {
|
||||
synthetic:
|
||||
Some(
|
||||
hir::SyntheticTyParamKind::ImplTrait
|
||||
| hir::SyntheticTyParamKind::FromAttr,
|
||||
),
|
||||
..
|
||||
} => true,
|
||||
_ => false,
|
||||
});
|
||||
|
||||
if explicit && impl_trait {
|
||||
let spans = seg
|
||||
|
||||
Reference in New Issue
Block a user