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
type_needs_drop returns true for *mut T during generic specialization re-check (is_copy simultaneously true) #898
Instrumenting the D32 field-move funnel and checking a program that
instantiates arena_vec_push[i32] (std.alloc's ArenaVec[T], ephemeral,
field arena: *mut Arena):
kind 13 = TY_PTR, is_copy = 1 — yet the branch is gated on type_needs_drop(field_ty) != 0, so type_needs_drop(*mut Arena)
returned TRUE in the specialization re-check of the generic body. In the
ordinary (non-specialization) pass the same query returns false — a local
copy of the same fn checked standalone does not trip the gate.
Repro
use std.alloc
fn main:
var arena = arena_new(64)
var xs: ArenaVec[i32] = ArenaVec { arena: &raw mut arena as *mut Arena, ptr: 0 as *mut i32, len_value: 0, cap_value: 0 }
let xsp = &raw mut xs as *mut ArenaVec[i32]
unsafe:
arena_vec_push(xsp, 10)
Before the D32 funnel was re-gated on is_copy this produced a spurious
"a field never moves out implicitly" error inside <embedded-std>/std/alloc.w
(let arena = (*xs).arena). The D32 gate now uses is_copy == 0 as the
durable move discriminator, so the user-visible symptom is fixed — but the
needs_drop/is_copy disagreement for pointer types under substitution
remains and any other consumer of type_needs_drop in a specialization
context may mis-schedule drops for Copy pointer fields.
Expected
type_needs_drop(*mut T) is false in every checking context.
Triage 2026-10-25, with v0.15.3.0 (main a261b65): not reproduced at the surface. The evidence here came from instrumenting the D32 field-move funnel; no observable program behavior was recorded, and a program instantiating ArenaVec[i32] (std.alloc) builds and runs today. Confirming it needs the same instrumentation or an lldb breakpoint on Sema.type_needs_drop for a TY_PTR argument during specialization re-check, which is a debugging session, not triage. Left open for whoever takes the D32 funnel next.
Not a ruling: this needs a debugger session on Sema.type_needs_drop for a TY_PTR argument during specialization re-check, which is mine. Label removed.
Root cause, for the record: type_has_drop_impl named the pointee of a pointer type (get_type_name), so in a specialization *mut T read as having its pointee's Drop impl and type_needs_drop answered true. The guard at the top of type_has_drop_impl (added for #1492: a reference or raw pointer owns nothing) removed that for every caller. The issue's own repro no longer exists (ArenaVec is gone from std.alloc), so behav_898_pointer_field_in_specialization_owns_nothing (#3501) reads a *mut Loud field twice inside a generic body at two instantiations: the pointee drops once and the debug allocator reports no leak.
Activity
D32 round 2: checker refinements, tail-materializer narrowing, and th…
ehartford commentedon Oct 25, 2026
Triage 2026-10-25,
with v0.15.3.0(main a261b65): not reproduced at the surface. The evidence here came from instrumenting the D32 field-move funnel; no observable program behavior was recorded, and a program instantiatingArenaVec[i32](std.alloc) builds and runs today. Confirming it needs the same instrumentation or an lldb breakpoint onSema.type_needs_dropfor aTY_PTRargument during specialization re-check, which is a debugging session, not triage. Left open for whoever takes the D32 funnel next.ehartford commentedon Nov 18, 2026
Not a ruling: this needs a debugger session on
Sema.type_needs_dropfor aTY_PTRargument during specialization re-check, which is mine. Label removed.A package's interface records what was inferred: a view's origins, a …
ehartford commentedon Nov 21, 2026
Root cause, for the record:
type_has_drop_implnamed the pointee of a pointer type (get_type_name), so in a specialization*mut Tread as having its pointee's Drop impl andtype_needs_dropanswered true. The guard at the top oftype_has_drop_impl(added for #1492: a reference or raw pointer owns nothing) removed that for every caller. The issue's own repro no longer exists (ArenaVecis gone from std.alloc), sobehav_898_pointer_field_in_specialization_owns_nothing(#3501) reads a*mut Loudfield twice inside a generic body at two instantiations: the pointee drops once and the debug allocator reports no leak.