Skip to content

Commit 85dad03

Browse files
committed
wip with boxy
1 parent 262cf11 commit 85dad03

File tree

6 files changed

+12
-9
lines changed

6 files changed

+12
-9
lines changed

compiler/rustc_hir/src/lang_items.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,6 @@ language_item_table! {
369369
CoercePointeeValidated, sym::coerce_pointee_validated, coerce_pointee_validated_trait, Target::Trait, GenericRequirement::Exact(0);
370370

371371
ConstParamTy, sym::const_param_ty, const_param_ty_trait, Target::Trait, GenericRequirement::Exact(0);
372-
UnsizedConstParamTy, sym::unsized_const_param_ty, unsized_const_param_ty_trait, Target::Trait, GenericRequirement::Exact(0);
373372

374373
Poll, sym::Poll, poll, Target::Enum, GenericRequirement::None;
375374
PollReady, sym::Ready, poll_ready_variant, Target::Variant, GenericRequirement::None;

compiler/rustc_hir_analysis/src/check/wfcheck.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,7 @@ fn check_param_wf(tcx: TyCtxt<'_>, param: &ty::GenericParamDef) -> Result<(), Er
819819
let span = tcx.def_span(param.def_id);
820820
let def_id = param.def_id.expect_local();
821821

822-
if tcx.features().adt_const_params() || tcx.features().unsized_const_params() {
822+
if tcx.features().adt_const_params() {
823823
// fixme: should we get rid of the check for LangItem::ConstParamTy? If yes, how should we check
824824
// if the trait is implemented.
825825
enter_wf_checking_ctxt(tcx, tcx.local_parent(def_id), |wfcx| {

library/core/src/marker.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,12 +1078,13 @@ pub trait Tuple {}
10781078
/// that all fields are also `ConstParamTy`, which implies that recursively, all fields
10791079
/// are `StructuralPartialEq`.
10801080
#[lang = "const_param_ty"]
1081+
#[unstable(feature = "unsized_const_params", issue = "95174")]
10811082
#[diagnostic::on_unimplemented(message = "`{Self}` can't be used as a const parameter type")]
10821083
#[allow(multiple_supertrait_upcastable)]
10831084
// We name this differently than the derive macro so that the `adt_const_params` can
10841085
// be used independently of `unsized_const_params` without requiring a full path
10851086
// to the derive macro every time it is used. This should be renamed on stabilization.
1086-
pub trait ConstParamTy: StructuralPartialEq + Eq {}
1087+
pub trait ConstParamTy_: StructuralPartialEq + Eq {}
10871088

10881089
/// Derive macro generating an impl of the trait `ConstParamTy`.
10891090
#[rustc_builtin_macro]
@@ -1096,7 +1097,6 @@ pub macro ConstParamTy($item:item) {
10961097
// FIXME(adt_const_params): handle `ty::FnDef`/`ty::Closure`
10971098
marker_impls! {
10981099
#[unstable(feature = "adt_const_params", issue = "95174")]
1099-
#[unstable_feature_bound(adt_const_params)]
11001100
ConstParamTy for
11011101
usize, u8, u16, u32, u64, u128,
11021102
isize, i8, i16, i32, i64, i128,

tests/ui/const-generics/adt_const_params/auxiliary/unsized_const_param.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![feature(adt_const_params, unsized_const_params)]
22

3-
#[derive(std::marker::UnsizedConstParamTy, Eq, PartialEq)]
3+
#[derive(std::marker::ConstParamTy, Eq, PartialEq)]
44
pub struct Foo([u8]);
55

66
#[derive(std::marker::ConstParamTy, Eq, PartialEq)]

tests/ui/const-generics/adt_const_params/unsized_field-1.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,8 @@ struct B(&'static [u8]);
1717
//~^ ERROR: the trait `ConstParamTy_` cannot be implemented for this type
1818
struct C(unsized_const_param::Foo);
1919

20+
#[derive(std::marker::ConstParamTy, Eq, PartialEq)]
21+
//~^ ERROR: the trait `ConstParamTy_` cannot be implemented for this type
22+
struct D(unsized_const_param::GenericNotUnsizedParam<&'static [u8]>);
23+
2024
fn main() {}

tests/ui/const-generics/adt_const_params/unsized_field-2.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
#![feature(adt_const_params, unsized_const_params)]
33
//~^ WARN: the feature `unsized_const_params` is incomplete
44

5+
6+
// TODO: remove test
7+
58
extern crate unsized_const_param;
69

7-
#[derive(std::marker::ConstParamTy, Eq, PartialEq)]
8-
//~^ ERROR: the trait `ConstParamTy_` cannot be implemented for this type
9-
struct A(unsized_const_param::GenericNotUnsizedParam<&'static [u8]>);
1010

11-
#[derive(std::marker::UnsizedConstParamTy, Eq, PartialEq)]
11+
#[derive(std::marker::ConstParamTy, Eq, PartialEq)]
1212
struct B(unsized_const_param::GenericNotUnsizedParam<&'static [u8]>);
1313

1414
fn main() {}

0 commit comments

Comments
 (0)