Skip to content

Tracking Issue for the Freeze trait #121675

Open
@oli-obk

Description

@oli-obk
Contributor

Feature gate: #![feature(freeze)]

This is a tracking issue for the core::marker::Freeze trait

This trait allows generic code to restrict generic parameters to types without interior mutability.

Public API

use std::marker::Freeze;

trait Trait<T: Freeze + 'static> {
    const VALUE: T;
    const VALUE_REF: &'static T = &Self::VALUE;
}

Steps / History

Unresolved Questions

Footnotes

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html

Activity

added
T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFC
on Feb 27, 2024
added
T-langRelevant to the language team
B-experimentalBlocker: In-tree experiment; RFC pending, not yet approved or unneeded (requires FCP to stabilize).
on Mar 1, 2024
RalfJung

RalfJung commented on May 2, 2024

@RalfJung
Member

@rust-lang/lang -- quick vibe check, do you think this needs an RFC or can it be done with a writeup and FCP in this issue?

nikomatsakis

nikomatsakis commented on May 8, 2024

@nikomatsakis
Contributor
RalfJung

RalfJung commented on May 8, 2024

@RalfJung
Member
nikomatsakis

nikomatsakis commented on May 9, 2024

@nikomatsakis
Contributor
RalfJung

RalfJung commented on May 9, 2024

@RalfJung
Member

Okay, thanks.

So -- if someone wants to help push this towards stabilization, drafting an RFC would be a good next step. :)

p-avital

p-avital commented on May 10, 2024

@p-avital

Here is a stabilization RFC for this feature: rust-lang/rfcs#3633 :)

jdonszelmann

jdonszelmann commented on Sep 28, 2024

@jdonszelmann
Contributor

I found an interesting case in which I needed Freeze. Currently, the diagnostics for this are very confusing (I might follow with a PR that improves that) but @WaffleLapkin said it might be nice to comment this here.

not-working example: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=9939beef497fc78bf2951342b379cf4b

fixed using freeze: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=1efad00dbd416d99abe2da4c9758e2a1

RalfJung

RalfJung commented on Sep 28, 2024

@RalfJung
Member

Yeah that's basically the same case as @p-avital's

NickGeek

NickGeek commented on Nov 19, 2024

@NickGeek
NickGeek

NickGeek commented on Nov 19, 2024

@NickGeek
RalfJung

RalfJung commented on Nov 19, 2024

@RalfJung
NickGeek

NickGeek commented on Nov 19, 2024

@NickGeek
moved this from Exploration to Needs champion in Lang team featureson Feb 21, 2025
moved this from Needs champion to Exploration in Lang team featureson Mar 4, 2025
self-assigned this
on Mar 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

B-experimentalBlocker: In-tree experiment; RFC pending, not yet approved or unneeded (requires FCP to stabilize).C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCF-freeze`#![feature(freeze)]`T-langRelevant to the language teamT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

Type

No type

Projects

Status

Exploration

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @nikomatsakis@RalfJung@oli-obk@traviscross@NickGeek

      Issue actions

        Tracking Issue for the `Freeze` trait · Issue #121675 · rust-lang/rust