Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 268374b

Browse files
committedJul 15, 2024·
Split part of adt_const_params into unsized_const_params
1 parent fd94759 commit 268374b

File tree

141 files changed

+1160
-553
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+1160
-553
lines changed
 

‎compiler/rustc_builtin_macros/src/deriving/bounds.rs

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,44 @@ pub(crate) fn expand_deriving_const_param_ty(
3838
) {
3939
let trait_def = TraitDef {
4040
span,
41-
path: path_std!(marker::ConstParamTy),
41+
path: path_std!(marker::ConstParamTy_),
42+
skip_path_as_bound: false,
43+
needs_copy_as_bound_if_packed: false,
44+
additional_bounds: vec![ty::Ty::Path(path_std!(cmp::Eq))],
45+
supports_unions: false,
46+
methods: Vec::new(),
47+
associated_types: Vec::new(),
48+
is_const,
49+
};
50+
51+
trait_def.expand(cx, mitem, item, push);
52+
53+
let trait_def = TraitDef {
54+
span,
55+
path: path_std!(marker::UnsizedConstParamTy),
56+
skip_path_as_bound: false,
57+
needs_copy_as_bound_if_packed: false,
58+
additional_bounds: vec![ty::Ty::Path(path_std!(cmp::Eq))],
59+
supports_unions: false,
60+
methods: Vec::new(),
61+
associated_types: Vec::new(),
62+
is_const,
63+
};
64+
65+
trait_def.expand(cx, mitem, item, push);
66+
}
67+
68+
pub(crate) fn expand_deriving_unsized_const_param_ty(
69+
cx: &ExtCtxt<'_>,
70+
span: Span,
71+
mitem: &MetaItem,
72+
item: &Annotatable,
73+
push: &mut dyn FnMut(Annotatable),
74+
is_const: bool,
75+
) {
76+
let trait_def = TraitDef {
77+
span,
78+
path: path_std!(marker::UnsizedConstParamTy),
4279
skip_path_as_bound: false,
4380
needs_copy_as_bound_if_packed: false,
4481
additional_bounds: vec![ty::Ty::Path(path_std!(cmp::Eq))],

‎compiler/rustc_builtin_macros/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ pub fn register_builtin_macros(resolver: &mut dyn ResolverExpand) {
118118
Clone: clone::expand_deriving_clone,
119119
Copy: bounds::expand_deriving_copy,
120120
ConstParamTy: bounds::expand_deriving_const_param_ty,
121+
UnsizedConstParamTy: bounds::expand_deriving_unsized_const_param_ty,
121122
Debug: debug::expand_deriving_debug,
122123
Default: default::expand_deriving_default,
123124
Eq: eq::expand_deriving_eq,

0 commit comments

Comments
 (0)
Please sign in to comment.