Skip to content

Commit 4210966

Browse files
committed
Add unstable type_ascribe macro
This macro serves as a placeholder for future type ascription syntax to make sure that the semantic implementation keeps working.
1 parent 321f015 commit 4210966

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

core/src/macros/mod.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,6 +1546,29 @@ pub(crate) mod builtin {
15461546
/* compiler built-in */
15471547
}
15481548

1549+
/// Unstable placeholder for type ascription.
1550+
#[rustc_builtin_macro]
1551+
#[unstable(
1552+
feature = "type_ascription",
1553+
issue = "23416",
1554+
reason = "placeholder syntax for type ascription"
1555+
)]
1556+
#[cfg(not(bootstrap))]
1557+
pub macro type_ascribe($expr:expr, $ty:ty) {
1558+
/* compiler built-in */
1559+
}
1560+
1561+
/// Unstable placeholder for type ascription.
1562+
#[unstable(
1563+
feature = "type_ascription",
1564+
issue = "23416",
1565+
reason = "placeholder syntax for type ascription"
1566+
)]
1567+
#[cfg(bootstrap)]
1568+
pub macro type_ascribe($expr:expr, $ty:ty) {
1569+
$expr: $ty
1570+
}
1571+
15491572
/// Unstable implementation detail of the `rustc` compiler, do not use.
15501573
#[rustc_builtin_macro]
15511574
#[stable(feature = "rust1", since = "1.0.0")]

core/src/prelude/v1.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,10 @@ pub use crate::macros::builtin::cfg_accessible;
9898
reason = "`cfg_eval` is a recently implemented feature"
9999
)]
100100
pub use crate::macros::builtin::cfg_eval;
101+
102+
#[unstable(
103+
feature = "type_ascription",
104+
issue = "23416",
105+
reason = "placeholder syntax for type ascription"
106+
)]
107+
pub use crate::macros::builtin::type_ascribe;

std/src/prelude/v1.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,14 @@ pub use core::prelude::v1::cfg_accessible;
8585
)]
8686
pub use core::prelude::v1::cfg_eval;
8787

88+
// Do not `doc(no_inline)` either.
89+
#[unstable(
90+
feature = "type_ascription",
91+
issue = "23416",
92+
reason = "placeholder syntax for type ascription"
93+
)]
94+
pub use core::prelude::v1::type_ascribe;
95+
8896
// The file so far is equivalent to src/libcore/prelude/v1.rs,
8997
// and below to src/liballoc/prelude.rs.
9098
// Those files are duplicated rather than using glob imports

0 commit comments

Comments
 (0)