Add a sealed::Sealed trait to core, like that in std

This allows traits in `core` to be sealed as well.

This could be the same trait as `std` via a re-export, but that would
require `core::sealed` to be `pub` (even if unstable). Keep them as
separate traits for now.
This commit is contained in:
Josh Triplett
2026-03-24 20:23:48 -07:00
parent 63154b7b47
commit e3aba17ef1
+9
View File
@@ -110,6 +110,7 @@
#![feature(offset_of_enum)]
#![feature(panic_internals)]
#![feature(pattern_type_macro)]
#![feature(sealed)]
#![feature(ub_checks)]
// tidy-alphabetical-end
//
@@ -216,6 +217,14 @@ pub mod from {
pub use crate::macros::builtin::From;
}
mod sealed {
/// This trait being unreachable from outside the crate
/// prevents outside implementations of our extension traits.
/// This allows adding more trait methods in the future.
#[unstable(feature = "sealed", issue = "none")]
pub trait Sealed {}
}
// We don't export this through #[macro_export] for now, to avoid breakage.
#[unstable(feature = "autodiff", issue = "124509")]
/// Unstable module containing the unstable `autodiff` macro.