Skip to content

Commit

Permalink
Rollup merge of #121840 - oli-obk:freeze, r=dtolnay
Browse files Browse the repository at this point in the history
Expose the Freeze trait again (unstably) and forbid implementing it manually

non-emoji version of rust-lang/rust#121501

cc #60715

This trait is useful for generic constants (associated consts of generic traits). See the test (`tests/ui/associated-consts/freeze.rs`) added in this PR for a usage example. The builtin `Freeze` trait is the only way to do it, users cannot work around this issue.

It's also a useful trait for building some very specific abstrations, as shown by the usage by the `zerocopy` crate: google/zerocopy#941

cc ```@RalfJung```

T-lang signed off on reexposing this unstably: rust-lang/rust#121501 (comment)
  • Loading branch information
jhpratt authored Mar 11, 2024
2 parents 0031b21 + 3ca0c59 commit a6202e2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion example/mini_core.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![feature(
no_core, lang_items, intrinsics, unboxed_closures, type_ascription, extern_types,
decl_macro, rustc_attrs, transparent_unions, auto_traits,
decl_macro, rustc_attrs, transparent_unions, auto_traits, freeze_impls,
thread_local
)]
#![no_core]
Expand Down

0 comments on commit a6202e2

Please sign in to comment.