implement nits
This commit is contained in:
parent
236689d6eb
commit
604bc876e0
4 changed files with 16 additions and 11 deletions
|
@ -2210,7 +2210,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||||
.attrs
|
.attrs
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|attr| self.sess.check_name(attr, sym::rustc_synthetic))
|
.filter(|attr| self.sess.check_name(attr, sym::rustc_synthetic))
|
||||||
.map(|_| hir::SyntheticTyParamKind::Rustc)
|
.map(|_| hir::SyntheticTyParamKind::FromAttr)
|
||||||
.next(),
|
.next(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -509,7 +509,7 @@ impl Generics<'hir> {
|
||||||
pub enum SyntheticTyParamKind {
|
pub enum SyntheticTyParamKind {
|
||||||
ImplTrait,
|
ImplTrait,
|
||||||
// Created by the `#[rustc_synthetic]` attribute.
|
// Created by the `#[rustc_synthetic]` attribute.
|
||||||
Rustc,
|
FromAttr,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A where-clause in a definition.
|
/// A where-clause in a definition.
|
||||||
|
|
|
@ -170,7 +170,8 @@ impl<'a, 'hir> intravisit::Visitor<'hir> for HirIdValidator<'a, 'hir> {
|
||||||
..
|
..
|
||||||
} = param.kind
|
} = 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 {
|
} else {
|
||||||
intravisit::walk_generic_param(self, param);
|
intravisit::walk_generic_param(self, param);
|
||||||
}
|
}
|
||||||
|
|
|
@ -548,14 +548,18 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||||
generics: &ty::Generics,
|
generics: &ty::Generics,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
let explicit = !seg.infer_args;
|
let explicit = !seg.infer_args;
|
||||||
let impl_trait = generics.params.iter().any(|param| match param.kind {
|
let impl_trait =
|
||||||
ty::GenericParamDefKind::Type {
|
generics.params.iter().any(|param| match param.kind {
|
||||||
synthetic:
|
ty::GenericParamDefKind::Type {
|
||||||
Some(hir::SyntheticTyParamKind::ImplTrait | hir::SyntheticTyParamKind::Rustc),
|
synthetic:
|
||||||
..
|
Some(
|
||||||
} => true,
|
hir::SyntheticTyParamKind::ImplTrait
|
||||||
_ => false,
|
| hir::SyntheticTyParamKind::FromAttr,
|
||||||
});
|
),
|
||||||
|
..
|
||||||
|
} => true,
|
||||||
|
_ => false,
|
||||||
|
});
|
||||||
|
|
||||||
if explicit && impl_trait {
|
if explicit && impl_trait {
|
||||||
let spans = seg
|
let spans = seg
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue