Skip to content

type-alias-impl-trait implicitly captures lifetime params #96996

Closed
@aliemjay

Description

@aliemjay
#![feature(type_alias_impl_trait)]
trait Service {
    type Output;
    fn call(self) -> Self::Output;
}
impl<'a> Service for &'a str {
    type Output = impl Sized;
    fn call(self) -> Self::Output { self }
}

This compiles now but it shouldn't. Explicit annotation for captured lifetimes in the opaque type impl Sized + 'a is required by the RFC.

I guess this is the root cause of #91601.

@rustbot label F-type_alias_impl_trait T-compiler

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-type_alias_impl_trait`#[feature(type_alias_impl_trait)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-typesRelevant to the types team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions