Skip to content

regression: "the parameter type T may not live long enough" in offset_of! #150465

@cuviper

Description

@cuviper
[INFO] [stdout] error[E0310]: the parameter type `T` may not live long enough
[INFO] [stdout]    --> src/report/data.rs:310:24
[INFO] [stdout]     |
[INFO] [stdout] 310 |             assert_eq!(offset_of!(ReportData<T>, vtable), 0);
[INFO] [stdout]     |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [stdout]     |                        |
[INFO] [stdout]     |                        the parameter type `T` must be valid for the static lifetime...
[INFO] [stdout]     |                        ...so that the type `T` will meet its required lifetime bounds
[INFO] [stdout]     |
[INFO] [stdout]     = note: this error originates in the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info)
[INFO] [stdout] help: consider adding an explicit lifetime bound
[INFO] [stdout]     |
[INFO] [stdout] 308 |         fn check<T: 'static>() {
[INFO] [stdout]     |                   +++++++++

(and several more in the same log)

https://crater-reports.s3.amazonaws.com/beta-1.93-3/beta-2025-12-09/reg/rootcause-internals-0.11.0/log.txt

@rustbot modify labels: +regression-from-stable-to-beta -regression-untriaged

Note: the type definition is struct ReportData<C: 'static>, and the test fn check<T> doesn't require 'static but is only used with static types. Still, this doesn't error on stable 1.92.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-borrow-checkerArea: The borrow checkerC-bugCategory: This is a bug.P-mediumMedium priorityS-has-bisectionStatus: A bisection has been found for this issueS-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-typesRelevant to the types team, which will review and decide on the PR/issue.disposition-closeThis PR / issue is in PFCP or FCP with a disposition to close it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.to-announceAnnounce this issue on triage meeting

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions