Rollup merge of #92918 - compiler-errors:gat-expr-lifetime-elision, r=jackh726
Allow eliding GATs in expression position Thoughts on whether this is worthwhile? Fixes #92836 r? ``@jackh726``
This commit is contained in:
commit
55d5513662
4 changed files with 88 additions and 2 deletions
|
@ -445,7 +445,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
let named_type_param_count =
|
||||
param_counts.types - has_self as usize - synth_type_param_count;
|
||||
let infer_lifetimes =
|
||||
gen_pos != GenericArgPosition::Type && !gen_args.has_lifetime_params();
|
||||
(gen_pos != GenericArgPosition::Type || infer_args) && !gen_args.has_lifetime_params();
|
||||
|
||||
if gen_pos != GenericArgPosition::Type && !gen_args.bindings.is_empty() {
|
||||
Self::prohibit_assoc_ty_binding(tcx, gen_args.bindings[0].span);
|
||||
|
|
|
@ -482,7 +482,20 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
) -> subst::GenericArg<'tcx> {
|
||||
let tcx = self.astconv.tcx();
|
||||
match param.kind {
|
||||
GenericParamDefKind::Lifetime => tcx.lifetimes.re_static.into(),
|
||||
GenericParamDefKind::Lifetime => self
|
||||
.astconv
|
||||
.re_infer(Some(param), self.span)
|
||||
.unwrap_or_else(|| {
|
||||
debug!(?param, "unelided lifetime in signature");
|
||||
|
||||
// This indicates an illegal lifetime in a non-assoc-trait position
|
||||
tcx.sess.delay_span_bug(self.span, "unelided lifetime in signature");
|
||||
|
||||
// Supply some dummy value. We don't have an
|
||||
// `re_error`, annoyingly, so use `'static`.
|
||||
tcx.lifetimes.re_static
|
||||
})
|
||||
.into(),
|
||||
GenericParamDefKind::Type { has_default, .. } => {
|
||||
if !infer_args && has_default {
|
||||
// No type parameter provided, but a default exists.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue