We just need to call expand_free_alias_tys on the self type in the relevant places in rustc_hir_analysis::coherence::builtin. It's a bit annoying, yh.
Example reproducers:
#![feature(lazy_type_alias)]
#[derive(Clone)]
pub struct Local;
type Alias = Local;
impl Copy for Alias {} //~ ERROR the trait `Copy` cannot be implemented for this type
#![feature(lazy_type_alias)]
pub struct Local;
type Alias = Local;
impl Drop for Alias {} //~ ERROR the `Drop` trait may only be implemented for local structs, enums, and unions
We just need to call
expand_free_alias_tyson the self type in the relevant places inrustc_hir_analysis::coherence::builtin. It's a bit annoying, yh.Example reproducers: