Port #[rustc_layout_scalar_valid_range_start/end] to the new attribute parsing infrastructure
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
This commit is contained in:
@@ -273,6 +273,12 @@ pub enum AttributeKind {
|
||||
/// Represents [`#[repr]`](https://doc.rust-lang.org/stable/reference/type-layout.html#representations).
|
||||
Repr(ThinVec<(ReprAttr, Span)>),
|
||||
|
||||
/// Represents `#[rustc_layout_scalar_valid_range_end]`.
|
||||
RustcLayoutScalarValidRangeEnd(Box<u128>, Span),
|
||||
|
||||
/// Represents `#[rustc_layout_scalar_valid_range_start]`.
|
||||
RustcLayoutScalarValidRangeStart(Box<u128>, Span),
|
||||
|
||||
/// Represents `#[rustc_skip_during_method_dispatch]`.
|
||||
SkipDuringMethodDispatch { array: bool, boxed_slice: bool, span: Span },
|
||||
|
||||
|
||||
@@ -36,6 +36,8 @@ impl AttributeKind {
|
||||
NoMangle(..) => No,
|
||||
Optimize(..) => No,
|
||||
PubTransparent(..) => Yes,
|
||||
RustcLayoutScalarValidRangeEnd(..) => Yes,
|
||||
RustcLayoutScalarValidRangeStart(..) => Yes,
|
||||
SkipDuringMethodDispatch { .. } => No,
|
||||
TrackCaller(..) => Yes,
|
||||
}
|
||||
|
||||
@@ -49,6 +49,16 @@ pub trait PrintAttribute {
|
||||
fn print_attribute(&self, p: &mut Printer);
|
||||
}
|
||||
|
||||
impl PrintAttribute for u128 {
|
||||
fn should_render(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn print_attribute(&self, p: &mut Printer) {
|
||||
p.word(self.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: PrintAttribute> PrintAttribute for &T {
|
||||
fn should_render(&self) -> bool {
|
||||
T::should_render(self)
|
||||
|
||||
Reference in New Issue
Block a user