Skip to content

Commit 065a29b

Browse files
committed
Implement #[define_opaque] attribute for functions.
1 parent 0b6a207 commit 065a29b

File tree

4 files changed

+33
-0
lines changed

4 files changed

+33
-0
lines changed

core/src/macros/mod.rs

+15
Original file line numberDiff line numberDiff line change
@@ -1743,6 +1743,21 @@ pub(crate) mod builtin {
17431743
/* compiler built-in */
17441744
}
17451745

1746+
/// Provide a list of type aliases and other opaque-type-containing type definitions.
1747+
/// This list will be used in the body of the item it is applied to to define opaque
1748+
/// types' hidden types.
1749+
/// Can only be applied to things that have bodies.
1750+
#[unstable(
1751+
feature = "type_alias_impl_trait",
1752+
issue = "63063",
1753+
reason = "`type_alias_impl_trait` has open design concerns"
1754+
)]
1755+
#[rustc_builtin_macro]
1756+
#[cfg(not(bootstrap))]
1757+
pub macro define_opaque($($tt:tt)*) {
1758+
/* compiler built-in */
1759+
}
1760+
17461761
/// Unstable placeholder for type ascription.
17471762
#[allow_internal_unstable(builtin_syntax)]
17481763
#[unstable(

core/src/prelude/v1.rs

+8
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,11 @@ pub use crate::macros::builtin::type_ascribe;
111111
reason = "placeholder syntax for deref patterns"
112112
)]
113113
pub use crate::macros::builtin::deref;
114+
115+
#[unstable(
116+
feature = "type_alias_impl_trait",
117+
issue = "63063",
118+
reason = "`type_alias_impl_trait` has open design concerns"
119+
)]
120+
#[cfg(not(bootstrap))]
121+
pub use crate::macros::builtin::define_opaque;

std/src/backtrace.rs

+1
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,7 @@ mod helper {
432432
use super::*;
433433
pub(super) type LazyResolve = impl (FnOnce() -> Capture) + Send + Sync + UnwindSafe;
434434

435+
#[cfg_attr(not(bootstrap), define_opaque(LazyResolve))]
435436
pub(super) fn lazy_resolve(mut capture: Capture) -> LazyResolve {
436437
move || {
437438
// Use the global backtrace lock to synchronize this as it's a

std/src/prelude/v1.rs

+9
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,15 @@ pub use core::prelude::v1::type_ascribe;
103103
)]
104104
pub use core::prelude::v1::deref;
105105

106+
// Do not `doc(no_inline)` either.
107+
#[unstable(
108+
feature = "type_alias_impl_trait",
109+
issue = "63063",
110+
reason = "`type_alias_impl_trait` has open design concerns"
111+
)]
112+
#[cfg(not(bootstrap))]
113+
pub use core::prelude::v1::define_opaque;
114+
106115
// The file so far is equivalent to core/src/prelude/v1.rs. It is duplicated
107116
// rather than glob imported because we want docs to show these re-exports as
108117
// pointing to within `std`.

0 commit comments

Comments
 (0)