Skip to content

Commit 6231e1c

Browse files
authored
Rollup merge of rust-lang#145095 - tiif:unstable_const_param, r=BoxyUwU
Migrate `UnsizedConstParamTy` to unstable impl of `ConstParamTy_` Now that we have ``#[unstable_feature_bound]``, we can remove ``UnsizedConstParamTy`` that was meant to be an unstable impl of stable type and ``ConstParamTy_`` trait. r? `@BoxyUwU`
2 parents 675defb + ed17ab5 commit 6231e1c

File tree

3 files changed

+10
-39
lines changed

3 files changed

+10
-39
lines changed

core/src/marker.rs

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,7 @@ pub trait Tuple {}
10831083
// We name this differently than the derive macro so that the `adt_const_params` can
10841084
// be used independently of `unsized_const_params` without requiring a full path
10851085
// to the derive macro every time it is used. This should be renamed on stabilization.
1086-
pub trait ConstParamTy_: UnsizedConstParamTy + StructuralPartialEq + Eq {}
1086+
pub trait ConstParamTy_: StructuralPartialEq + Eq {}
10871087

10881088
/// Derive macro generating an impl of the trait `ConstParamTy`.
10891089
#[rustc_builtin_macro]
@@ -1093,23 +1093,6 @@ pub macro ConstParamTy($item:item) {
10931093
/* compiler built-in */
10941094
}
10951095

1096-
#[lang = "unsized_const_param_ty"]
1097-
#[unstable(feature = "unsized_const_params", issue = "95174")]
1098-
#[diagnostic::on_unimplemented(message = "`{Self}` can't be used as a const parameter type")]
1099-
/// A marker for types which can be used as types of `const` generic parameters.
1100-
///
1101-
/// Equivalent to [`ConstParamTy_`] except that this is used by
1102-
/// the `unsized_const_params` to allow for fake unstable impls.
1103-
pub trait UnsizedConstParamTy: StructuralPartialEq + Eq {}
1104-
1105-
/// Derive macro generating an impl of the trait `ConstParamTy`.
1106-
#[rustc_builtin_macro]
1107-
#[allow_internal_unstable(unsized_const_params)]
1108-
#[unstable(feature = "unsized_const_params", issue = "95174")]
1109-
pub macro UnsizedConstParamTy($item:item) {
1110-
/* compiler built-in */
1111-
}
1112-
11131096
// FIXME(adt_const_params): handle `ty::FnDef`/`ty::Closure`
11141097
marker_impls! {
11151098
#[unstable(feature = "adt_const_params", issue = "95174")]
@@ -1124,17 +1107,11 @@ marker_impls! {
11241107

11251108
marker_impls! {
11261109
#[unstable(feature = "unsized_const_params", issue = "95174")]
1127-
UnsizedConstParamTy for
1128-
usize, u8, u16, u32, u64, u128,
1129-
isize, i8, i16, i32, i64, i128,
1130-
bool,
1131-
char,
1132-
(),
1133-
{T: UnsizedConstParamTy, const N: usize} [T; N],
1134-
1110+
#[unstable_feature_bound(unsized_const_params)]
1111+
ConstParamTy_ for
11351112
str,
1136-
{T: UnsizedConstParamTy} [T],
1137-
{T: UnsizedConstParamTy + ?Sized} &T,
1113+
{T: ConstParamTy_} [T],
1114+
{T: ConstParamTy_ + ?Sized} &T,
11381115
}
11391116

11401117
/// A common trait implemented by all function pointers.

core/src/mem/transmutability.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::marker::{ConstParamTy_, UnsizedConstParamTy};
1+
use crate::marker::ConstParamTy_;
22

33
/// Marks that `Src` is transmutable into `Self`.
44
///
@@ -83,6 +83,7 @@ use crate::marker::{ConstParamTy_, UnsizedConstParamTy};
8383
/// Furthermore, stability does not imply portability. For example, the size of
8484
/// `usize` is stable, but not portable.
8585
#[unstable(feature = "transmutability", issue = "99571")]
86+
#[unstable_feature_bound(transmutability)]
8687
#[lang = "transmute_trait"]
8788
#[rustc_deny_explicit_impl]
8889
#[rustc_do_not_implement_via_object]
@@ -288,9 +289,8 @@ pub struct Assume {
288289
}
289290

290291
#[unstable(feature = "transmutability", issue = "99571")]
292+
#[unstable_feature_bound(transmutability)]
291293
impl ConstParamTy_ for Assume {}
292-
#[unstable(feature = "transmutability", issue = "99571")]
293-
impl UnsizedConstParamTy for Assume {}
294294

295295
impl Assume {
296296
/// With this, [`TransmuteFrom`] does not assume you have ensured any safety

core/src/tuple.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// See core/src/primitive_docs.rs for documentation.
22

33
use crate::cmp::Ordering::{self, *};
4-
use crate::marker::{ConstParamTy_, StructuralPartialEq, UnsizedConstParamTy};
4+
use crate::marker::{ConstParamTy_, StructuralPartialEq};
55
use crate::ops::ControlFlow::{self, Break, Continue};
66

77
// Recursive macro for implementing n-ary tuple functions and operations
@@ -47,17 +47,11 @@ macro_rules! tuple_impls {
4747
maybe_tuple_doc! {
4848
$($T)+ @
4949
#[unstable(feature = "adt_const_params", issue = "95174")]
50+
#[unstable_feature_bound(unsized_const_params)]
5051
impl<$($T: ConstParamTy_),+> ConstParamTy_ for ($($T,)+)
5152
{}
5253
}
5354

54-
maybe_tuple_doc! {
55-
$($T)+ @
56-
#[unstable(feature = "unsized_const_params", issue = "95174")]
57-
impl<$($T: UnsizedConstParamTy),+> UnsizedConstParamTy for ($($T,)+)
58-
{}
59-
}
60-
6155
maybe_tuple_doc! {
6256
$($T)+ @
6357
#[unstable(feature = "structural_match", issue = "31434")]

0 commit comments

Comments
 (0)