(param_name, kind)
}
GenericParamKind::Type { ref default, .. } => {
- // Don't expose `Self` (recovered "keyword used as ident" parse error).
- // `rustc::ty` expects `Self` to be only used for a trait's `Self`.
- // Instead, use `gensym("Self")` to create a distinct name that looks the same.
- let ident = if param.ident.name == kw::SelfUpper {
- param.ident.gensym()
- } else {
- param.ident
- };
-
let add_bounds = add_bounds.get(¶m.id).map_or(&[][..], |x| &x);
if !add_bounds.is_empty() {
let params = self.lower_param_bounds(add_bounds, itctx.reborrow()).into_iter();
.next(),
};
- (hir::ParamName::Plain(ident), kind)
+ (hir::ParamName::Plain(param.ident), kind)
}
GenericParamKind::Const { ref ty } => {
(hir::ParamName::Plain(param.ident), hir::GenericParamKind::Const {
synthetic,
..
} => {
- if param.name.ident().name == kw::SelfUpper {
- span_bug!(
- param.span,
- "`Self` should not be the name of a regular parameter"
- );
- }
-
if !allow_defaults && default.is_some() {
if !tcx.features().default_type_parameter_fallback {
tcx.lint_hir(
}
}
GenericParamKind::Const { .. } => {
- if param.name.ident().name == kw::SelfUpper {
- span_bug!(
- param.span,
- "`Self` should not be the name of a regular parameter",
- );
- }
-
ty::GenericParamDefKind::Const
}
_ => return None,
&format!(
"defining opaque type use restricts opaque \
type by using the generic parameter `{}` twice",
- p.name
+ p,
),
);
return;