You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
False positive of lint missing_debug_implementations if Debug is implemented for a free alias type that expands to the relevant type #157757
#![feature(lazy_type_alias)]#![deny(missing_debug_implementations)]pubstructLocal;//~ ERROR type does not implement `Debug`; consider adding `#[derive(Debug)]` or a manupubtypeAlias = Local;impl std::fmt::DebugforAlias{fnfmt(&self, _:&mut std::fmt::Formatter<'_>) -> std::fmt::Result{Ok(())}}
For some reason missing_debug_implementations doesn't actually query the trait solver (!) (if the fast path doesn't apply), it literally does
let has_impl = cx
.tcx.non_blanket_impls_for_ty(
debug,
cx.tcx.type_of(item.owner_id).instantiate_identity().skip_norm_wip(),).next().is_some();
but I don't think that function should be used for "correctness" (well, it's a lint), ideally it would only be used as a fast path (barring more specific use cases).
For comparison, lint missing_copy_implementations calls tcx.type_is_copy_modulo_regions() which has a fast path but then queries the trait solver.
A temporarily solution would be to call expand_free_alias_tys inside non_blanket_impls_for_ty and friends? I haven't thought about correctness yet, so not sure.
I don't think we should call expand_free_alias_tys in fast_reject::simplify_type; that ideal feels very iffy and it would probably trash perf.
changed the title [-]False positive for lint `missing_debug_implementations` if `Debug` is implemented for a free alias type that expands to the relevant type[/-][+]False positive of lint `missing_debug_implementations` if `Debug` is implemented for a free alias type that expands to the relevant type[/+]on Jun 11, 2026
Why does that have its own issue instead of being part of parent issue #157758?
Well, it's because this way it's easier to track the potential blockers for LTA_unchecked's stabilization:
Stable code that currently uses eager type aliases in this position would regress if LTA_unchecked became the default.
Activity
[-]False positive for lint `missing_debug_implementations` if `Debug` is implemented for a free alias type that expands to the relevant type[/-][+]False positive of lint `missing_debug_implementations` if `Debug` is implemented for a free alias type that expands to the relevant type[/+]missing_debug_implementationsifDebugis implemented for an alias type (e.g., projection) that can get normalized to the relevant type #157758fmease commentedon Jun 11, 2026
Why does that have its own issue instead of being part of parent issue #157758?
Well, it's because this way it's easier to track the potential blockers for LTA_unchecked's stabilization:
Stable code that currently uses eager type aliases in this position would regress if LTA_unchecked became the default.
Rollup merge of rust-lang#157810 - mu001999-contrib:fix-157758, r=mat…
Rollup merge of rust-lang#157810 - mu001999-contrib:fix-157758, r=mat…
Unrolled build for #157810
Rollup merge of #157810 - mu001999-contrib:fix-157758, r=mati865