mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user