From 79ec275e2d513d5f1b8a685a20476b9b700674fe Mon Sep 17 00:00:00 2001 From: Asuna Date: Wed, 14 Jan 2026 17:00:22 +0100 Subject: [PATCH 1/3] Support primitives in type info reflection Support {bool,char,int,uint,float,str} primitive types for feature `type_info` reflection. --- .../src/const_eval/type_info.rs | 84 +++++++- compiler/rustc_span/src/symbol.rs | 8 +- library/core/src/mem/type_info.rs | 75 ++++++- library/coretests/tests/mem/type_info.rs | 39 +++- .../const_prop/invalid_constant.main.GVN.diff | 2 +- .../invalid_constant.main.RemoveZsts.diff | 2 +- tests/ui/lint/recommend-literal.rs | 2 + tests/ui/lint/recommend-literal.stderr | 22 ++- tests/ui/reflection/dump.bit32.run.stdout | 186 ++++++++++++++++++ tests/ui/reflection/dump.bit64.run.stdout | 186 ++++++++++++++++++ tests/ui/reflection/dump.rs | 31 ++- tests/ui/reflection/dump.run.stdout | 31 --- ...stion-when-stmt-and-expr-span-equal.stderr | 4 +- tests/ui/traits/issue-77982.stderr | 2 +- tests/ui/try-trait/bad-interconversion.stderr | 2 +- 15 files changed, 611 insertions(+), 65 deletions(-) create mode 100644 tests/ui/reflection/dump.bit32.run.stdout create mode 100644 tests/ui/reflection/dump.bit64.run.stdout delete mode 100644 tests/ui/reflection/dump.run.stdout diff --git a/compiler/rustc_const_eval/src/const_eval/type_info.rs b/compiler/rustc_const_eval/src/const_eval/type_info.rs index 814c81278a104..fc3378275be25 100644 --- a/compiler/rustc_const_eval/src/const_eval/type_info.rs +++ b/compiler/rustc_const_eval/src/const_eval/type_info.rs @@ -35,6 +35,7 @@ impl<'tcx> InterpCx<'tcx, CompileTimeMachine<'tcx>> { interp_ok((variant_id, self.project_downcast(&field_dest, variant_id)?)) }; + let ptr_bit_width = || self.tcx.data_layout.pointer_size().bits(); match field.name { sym::kind => { let variant_index = match ty.kind() { @@ -64,13 +65,60 @@ impl<'tcx> InterpCx<'tcx, CompileTimeMachine<'tcx>> { variant } - // For now just merge all primitives into one `Leaf` variant with no data - ty::Uint(_) | ty::Int(_) | ty::Float(_) | ty::Char | ty::Bool => { - downcast(sym::Leaf)?.0 + ty::Bool => { + let (variant, variant_place) = downcast(sym::Bool)?; + let place = self.project_field(&variant_place, FieldIdx::ZERO)?; + self.write_primitive_type_info(place, ty, None)?; + variant + } + ty::Char => { + let (variant, variant_place) = downcast(sym::Char)?; + let place = self.project_field(&variant_place, FieldIdx::ZERO)?; + self.write_primitive_type_info(place, ty, None)?; + variant + } + ty::Int(int_ty) => { + let (variant, variant_place) = downcast(sym::Int)?; + let place = self.project_field(&variant_place, FieldIdx::ZERO)?; + self.write_primitive_type_info( + place, + ty, + Some( + int_ty + .bit_width() + .unwrap_or_else(/* isize */ ptr_bit_width), + ), + )?; + variant + } + ty::Uint(uint_ty) => { + let (variant, variant_place) = downcast(sym::Uint)?; + let place = self.project_field(&variant_place, FieldIdx::ZERO)?; + self.write_primitive_type_info( + place, + ty, + Some( + uint_ty + .bit_width() + .unwrap_or_else(/* usize */ ptr_bit_width), + ), + )?; + variant + } + ty::Float(float_ty) => { + let (variant, variant_place) = downcast(sym::Float)?; + let place = self.project_field(&variant_place, FieldIdx::ZERO)?; + self.write_primitive_type_info(place, ty, Some(float_ty.bit_width()))?; + variant + } + ty::Str => { + let (variant, variant_place) = downcast(sym::Str)?; + let place = self.project_field(&variant_place, FieldIdx::ZERO)?; + self.write_primitive_type_info(place, ty, None)?; + variant } ty::Adt(_, _) | ty::Foreign(_) - | ty::Str | ty::Pat(_, _) | ty::Slice(_) | ty::RawPtr(..) @@ -203,4 +251,32 @@ impl<'tcx> InterpCx<'tcx, CompileTimeMachine<'tcx>> { interp_ok(()) } + + // This method always writes to field `ty`. + // If field `bit_width` is present, it also writes to it (in which case parameter `write_bit_width` must be `Some`). + fn write_primitive_type_info( + &mut self, + place: impl Writeable<'tcx, CtfeProvenance>, + ty: Ty<'tcx>, + write_bit_width: Option, + ) -> InterpResult<'tcx> { + for (field_idx, field) in + place.layout().ty.ty_adt_def().unwrap().non_enum_variant().fields.iter_enumerated() + { + let field_place = self.project_field(&place, field_idx)?; + match field.name { + sym::ty => self.write_type_id(ty, &field_place)?, + sym::bit_width => { + let bit_width = write_bit_width + .expect("type info struct needs a `bit_width` but none was provided"); + self.write_scalar( + ScalarInt::try_from_target_usize(bit_width, self.tcx.tcx).unwrap(), + &field_place, + )? + } + other => span_bug!(self.tcx.def_span(field.did), "unimplemented field {other}"), + } + } + interp_ok(()) + } } diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 34804160ed398..4c19fa83fd3a5 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -190,6 +190,7 @@ symbols! { BTreeMap, BTreeSet, BinaryHeap, + Bool, Borrow, BorrowMut, Break, @@ -202,6 +203,7 @@ symbols! { Capture, Cell, Center, + Char, Child, Cleanup, Clone, @@ -238,6 +240,7 @@ symbols! { Error, File, FileType, + Float, FmtArgumentsNew, FmtWrite, Fn, @@ -263,6 +266,7 @@ symbols! { IndexOutput, Input, Instant, + Int, Into, IntoFuture, IntoIterator, @@ -285,7 +289,6 @@ symbols! { IteratorItem, IteratorMap, Layout, - Leaf, Left, LinkedList, LintDiagnostic, @@ -363,6 +366,7 @@ symbols! { Some, SpanCtxt, Stdin, + Str, String, StructuralPartialEq, SubdiagMessage, @@ -387,6 +391,7 @@ symbols! { Ty, TyCtxt, TyKind, + Uint, Unknown, Unsize, UnsizedConstParamTy, @@ -584,6 +589,7 @@ symbols! { binaryheap_iter, bind_by_move_pattern_guards, bindings_after_at, + bit_width, bitand, bitand_assign, bitor, diff --git a/library/core/src/mem/type_info.rs b/library/core/src/mem/type_info.rs index e4ccc408f1c65..7db4f3b001233 100644 --- a/library/core/src/mem/type_info.rs +++ b/library/core/src/mem/type_info.rs @@ -45,9 +45,18 @@ pub enum TypeKind { Tuple(Tuple), /// Arrays. Array(Array), - /// Primitives - /// FIXME(#146922): disambiguate further - Leaf, + /// Primitive boolean type. + Bool(Bool), + /// Primitive character type. + Char(Char), + /// Primitive signed integer type. + Int(Int), + /// Primitive unsigned integer type. + Uint(Uint), + /// Primitive floating-point type. + Float(Float), + /// String slice type. + Str(Str), /// FIXME(#146922): add all the common types Other, } @@ -82,3 +91,63 @@ pub struct Array { /// The length of the array. pub len: usize, } + +/// Compile-time type information about `bool`. +#[derive(Debug)] +#[non_exhaustive] +#[unstable(feature = "type_info", issue = "146922")] +pub struct Bool { + /// The type id of `bool`. + pub ty: TypeId, +} + +/// Compile-time type information about `char`. +#[derive(Debug)] +#[non_exhaustive] +#[unstable(feature = "type_info", issue = "146922")] +pub struct Char { + /// The type id of `char`. + pub ty: TypeId, +} + +/// Compile-time type information about signed integer types. +#[derive(Debug)] +#[non_exhaustive] +#[unstable(feature = "type_info", issue = "146922")] +pub struct Int { + /// The type id of signed integer type. + pub ty: TypeId, + /// The bit width of the signed integer type. + pub bit_width: usize, +} + +/// Compile-time type information about unsigned integer types. +#[derive(Debug)] +#[non_exhaustive] +#[unstable(feature = "type_info", issue = "146922")] +pub struct Uint { + /// The type id of unsigned integer type. + pub ty: TypeId, + /// The bit width of the unsigned integer type. + pub bit_width: usize, +} + +/// Compile-time type information about floating-point types. +#[derive(Debug)] +#[non_exhaustive] +#[unstable(feature = "type_info", issue = "146922")] +pub struct Float { + /// The type id of floating-point type. + pub ty: TypeId, + /// The bit width of the floating-point type. + pub bit_width: usize, +} + +/// Compile-time type information about string slice types. +#[derive(Debug)] +#[non_exhaustive] +#[unstable(feature = "type_info", issue = "146922")] +pub struct Str { + /// The type id of `str`. + pub ty: TypeId, +} diff --git a/library/coretests/tests/mem/type_info.rs b/library/coretests/tests/mem/type_info.rs index b3b8d96d49b00..5dd8f4034d114 100644 --- a/library/coretests/tests/mem/type_info.rs +++ b/library/coretests/tests/mem/type_info.rs @@ -46,7 +46,10 @@ fn test_tuples() { assert!(b.offset == 1); match (a.ty.info().kind, b.ty.info().kind) { - (TypeKind::Leaf, TypeKind::Leaf) => {} + (TypeKind::Uint(a), TypeKind::Uint(b)) => { + assert!(a.bit_width == 8); + assert!(b.bit_width == 8); + } _ => unreachable!(), } } @@ -54,3 +57,37 @@ fn test_tuples() { } } } + +#[test] +fn test_primitives() { + use TypeKind::*; + + let Type { kind: Bool(_ty), size, .. } = (const { Type::of::() }) else { panic!() }; + assert_eq!(size, Some(1)); + + let Type { kind: Char(_ty), size, .. } = (const { Type::of::() }) else { panic!() }; + assert_eq!(size, Some(4)); + + let Type { kind: Int(ty), size, .. } = (const { Type::of::() }) else { panic!() }; + assert_eq!(size, Some(4)); + assert_eq!(ty.bit_width, 32); + + let Type { kind: Int(ty), size, .. } = (const { Type::of::() }) else { panic!() }; + assert_eq!(size, Some(size_of::())); + assert_eq!(ty.bit_width, size_of::() * 8); + + let Type { kind: Uint(ty), size, .. } = (const { Type::of::() }) else { panic!() }; + assert_eq!(size, Some(4)); + assert_eq!(ty.bit_width, 32); + + let Type { kind: Uint(ty), size, .. } = (const { Type::of::() }) else { panic!() }; + assert_eq!(size, Some(size_of::())); + assert_eq!(ty.bit_width, size_of::() * 8); + + let Type { kind: Float(ty), size, .. } = (const { Type::of::() }) else { panic!() }; + assert_eq!(size, Some(4)); + assert_eq!(ty.bit_width, 32); + + let Type { kind: Str(_ty), size, .. } = (const { Type::of::() }) else { panic!() }; + assert_eq!(size, None); +} diff --git a/tests/mir-opt/const_prop/invalid_constant.main.GVN.diff b/tests/mir-opt/const_prop/invalid_constant.main.GVN.diff index 20923d0352cd5..3dc6fc9e3f65b 100644 --- a/tests/mir-opt/const_prop/invalid_constant.main.GVN.diff +++ b/tests/mir-opt/const_prop/invalid_constant.main.GVN.diff @@ -19,7 +19,7 @@ debug _enum_without_variants => const [ZeroSized: Empty]; let _9: main::Str<"���">; scope 4 { - debug _non_utf8_str => const Str::<"���">; + debug _non_utf8_str => const main::Str::<"���">; } } } diff --git a/tests/mir-opt/const_prop/invalid_constant.main.RemoveZsts.diff b/tests/mir-opt/const_prop/invalid_constant.main.RemoveZsts.diff index 6593b329756c2..c16cbaf4c0f27 100644 --- a/tests/mir-opt/const_prop/invalid_constant.main.RemoveZsts.diff +++ b/tests/mir-opt/const_prop/invalid_constant.main.RemoveZsts.diff @@ -21,7 +21,7 @@ let _9: main::Str<"���">; scope 4 { - debug _non_utf8_str => _9; -+ debug _non_utf8_str => const Str::<"���">; ++ debug _non_utf8_str => const main::Str::<"���">; } } } diff --git a/tests/ui/lint/recommend-literal.rs b/tests/ui/lint/recommend-literal.rs index 45f9ae0a7bdfb..be074c1114532 100644 --- a/tests/ui/lint/recommend-literal.rs +++ b/tests/ui/lint/recommend-literal.rs @@ -1,3 +1,5 @@ +//~vv HELP consider importing this struct + type Real = double; //~^ ERROR cannot find type `double` in this scope //~| HELP perhaps you intended to use this type diff --git a/tests/ui/lint/recommend-literal.stderr b/tests/ui/lint/recommend-literal.stderr index 6b6dd134e1d29..01e993df17a98 100644 --- a/tests/ui/lint/recommend-literal.stderr +++ b/tests/ui/lint/recommend-literal.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find type `double` in this scope - --> $DIR/recommend-literal.rs:1:13 + --> $DIR/recommend-literal.rs:3:13 | LL | type Real = double; | ^^^^^^ @@ -8,7 +8,7 @@ LL | type Real = double; | help: perhaps you intended to use this type: `f64` error[E0425]: cannot find type `long` in this scope - --> $DIR/recommend-literal.rs:7:12 + --> $DIR/recommend-literal.rs:9:12 | LL | let y: long = 74802374902374923; | ^^^^ @@ -17,7 +17,7 @@ LL | let y: long = 74802374902374923; | help: perhaps you intended to use this type: `i64` error[E0425]: cannot find type `Boolean` in this scope - --> $DIR/recommend-literal.rs:10:13 + --> $DIR/recommend-literal.rs:12:13 | LL | let v1: Boolean = true; | ^^^^^^^ @@ -26,7 +26,7 @@ LL | let v1: Boolean = true; | help: perhaps you intended to use this type: `bool` error[E0425]: cannot find type `Bool` in this scope - --> $DIR/recommend-literal.rs:13:13 + --> $DIR/recommend-literal.rs:15:13 | LL | let v2: Bool = true; | ^^^^ @@ -41,9 +41,13 @@ help: perhaps you intended to use this type LL - let v2: Bool = true; LL + let v2: bool = true; | +help: consider importing this struct + | +LL + use std::mem::type_info::Bool; + | error[E0425]: cannot find type `boolean` in this scope - --> $DIR/recommend-literal.rs:19:9 + --> $DIR/recommend-literal.rs:21:9 | LL | fn z(a: boolean) { | ^^^^^^^ @@ -52,7 +56,7 @@ LL | fn z(a: boolean) { | help: perhaps you intended to use this type: `bool` error[E0425]: cannot find type `byte` in this scope - --> $DIR/recommend-literal.rs:24:11 + --> $DIR/recommend-literal.rs:26:11 | LL | fn a() -> byte { | ^^^^ @@ -61,7 +65,7 @@ LL | fn a() -> byte { | help: perhaps you intended to use this type: `u8` error[E0425]: cannot find type `float` in this scope - --> $DIR/recommend-literal.rs:31:12 + --> $DIR/recommend-literal.rs:33:12 | LL | width: float, | ^^^^^ @@ -70,7 +74,7 @@ LL | width: float, | help: perhaps you intended to use this type: `f32` error[E0425]: cannot find type `int` in this scope - --> $DIR/recommend-literal.rs:34:19 + --> $DIR/recommend-literal.rs:36:19 | LL | depth: Option, | ^^^ not found in this scope @@ -86,7 +90,7 @@ LL | struct Data { | +++++ error[E0425]: cannot find type `short` in this scope - --> $DIR/recommend-literal.rs:40:16 + --> $DIR/recommend-literal.rs:42:16 | LL | impl Stuff for short {} | ^^^^^ diff --git a/tests/ui/reflection/dump.bit32.run.stdout b/tests/ui/reflection/dump.bit32.run.stdout new file mode 100644 index 0000000000000..d747ee2102040 --- /dev/null +++ b/tests/ui/reflection/dump.bit32.run.stdout @@ -0,0 +1,186 @@ +Type { + kind: Tuple( + Tuple { + fields: [ + Field { + ty: TypeId(0x0596b48cc04376e64d5c788c2aa46bdb), + offset: 0, + }, + Field { + ty: TypeId(0x0596b48cc04376e64d5c788c2aa46bdb), + offset: 1, + }, + Field { + ty: TypeId(0x41223169ff28813ba79b7268a2a968d9), + offset: 2, + }, + ], + }, + ), + size: Some( + 2, + ), +} +Type { + kind: Array( + Array { + element_ty: TypeId(0x0596b48cc04376e64d5c788c2aa46bdb), + len: 2, + }, + ), + size: Some( + 2, + ), +} +Type { + kind: Int( + Int { + ty: TypeId(0x12427c993eca190c841e0d92c5b7a45d), + bit_width: 8, + }, + ), + size: Some( + 1, + ), +} +Type { + kind: Int( + Int { + ty: TypeId(0x56ced5e4a15bd89050bb9674fa2df013), + bit_width: 32, + }, + ), + size: Some( + 4, + ), +} +Type { + kind: Int( + Int { + ty: TypeId(0xae6c4318bb07632e00428affbea41961), + bit_width: 64, + }, + ), + size: Some( + 8, + ), +} +Type { + kind: Int( + Int { + ty: TypeId(0xc7164498f3902dde0d8194a7b9733e79), + bit_width: 128, + }, + ), + size: Some( + 16, + ), +} +Type { + kind: Int( + Int { + ty: TypeId(0x1e5f92831c560aac8658b980a22e60b0), + bit_width: 32, + }, + ), + size: Some( + 4, + ), +} +Type { + kind: Uint( + Uint { + ty: TypeId(0x0596b48cc04376e64d5c788c2aa46bdb), + bit_width: 8, + }, + ), + size: Some( + 1, + ), +} +Type { + kind: Uint( + Uint { + ty: TypeId(0x1378bb1c0a0202683eb65e7c11f2e4d7), + bit_width: 32, + }, + ), + size: Some( + 4, + ), +} +Type { + kind: Uint( + Uint { + ty: TypeId(0x9ed91be891e304132cb86891e578f4a5), + bit_width: 64, + }, + ), + size: Some( + 8, + ), +} +Type { + kind: Uint( + Uint { + ty: TypeId(0x7bf7411d57d603e9fb393892a9c3f362), + bit_width: 128, + }, + ), + size: Some( + 16, + ), +} +Type { + kind: Uint( + Uint { + ty: TypeId(0x763d199bccd319899208909ed1a860c6), + bit_width: 32, + }, + ), + size: Some( + 4, + ), +} +Type { + kind: Other, + size: Some( + 4, + ), +} +Type { + kind: Other, + size: Some( + 12, + ), +} +Type { + kind: Other, + size: Some( + 8, + ), +} +Type { + kind: Other, + size: Some( + 8, + ), +} +Type { + kind: Other, + size: Some( + 8, + ), +} +Type { + kind: Str( + Str { + ty: TypeId(0x474ccf3b5db264ef53916706f7d7bb2c), + }, + ), + size: None, +} +Type { + kind: Other, + size: None, +} diff --git a/tests/ui/reflection/dump.bit64.run.stdout b/tests/ui/reflection/dump.bit64.run.stdout new file mode 100644 index 0000000000000..180a6e2882d75 --- /dev/null +++ b/tests/ui/reflection/dump.bit64.run.stdout @@ -0,0 +1,186 @@ +Type { + kind: Tuple( + Tuple { + fields: [ + Field { + ty: TypeId(0x0596b48cc04376e64d5c788c2aa46bdb), + offset: 0, + }, + Field { + ty: TypeId(0x0596b48cc04376e64d5c788c2aa46bdb), + offset: 1, + }, + Field { + ty: TypeId(0x41223169ff28813ba79b7268a2a968d9), + offset: 2, + }, + ], + }, + ), + size: Some( + 2, + ), +} +Type { + kind: Array( + Array { + element_ty: TypeId(0x0596b48cc04376e64d5c788c2aa46bdb), + len: 2, + }, + ), + size: Some( + 2, + ), +} +Type { + kind: Int( + Int { + ty: TypeId(0x12427c993eca190c841e0d92c5b7a45d), + bit_width: 8, + }, + ), + size: Some( + 1, + ), +} +Type { + kind: Int( + Int { + ty: TypeId(0x56ced5e4a15bd89050bb9674fa2df013), + bit_width: 32, + }, + ), + size: Some( + 4, + ), +} +Type { + kind: Int( + Int { + ty: TypeId(0xae6c4318bb07632e00428affbea41961), + bit_width: 64, + }, + ), + size: Some( + 8, + ), +} +Type { + kind: Int( + Int { + ty: TypeId(0xc7164498f3902dde0d8194a7b9733e79), + bit_width: 128, + }, + ), + size: Some( + 16, + ), +} +Type { + kind: Int( + Int { + ty: TypeId(0x1e5f92831c560aac8658b980a22e60b0), + bit_width: 64, + }, + ), + size: Some( + 8, + ), +} +Type { + kind: Uint( + Uint { + ty: TypeId(0x0596b48cc04376e64d5c788c2aa46bdb), + bit_width: 8, + }, + ), + size: Some( + 1, + ), +} +Type { + kind: Uint( + Uint { + ty: TypeId(0x1378bb1c0a0202683eb65e7c11f2e4d7), + bit_width: 32, + }, + ), + size: Some( + 4, + ), +} +Type { + kind: Uint( + Uint { + ty: TypeId(0x9ed91be891e304132cb86891e578f4a5), + bit_width: 64, + }, + ), + size: Some( + 8, + ), +} +Type { + kind: Uint( + Uint { + ty: TypeId(0x7bf7411d57d603e9fb393892a9c3f362), + bit_width: 128, + }, + ), + size: Some( + 16, + ), +} +Type { + kind: Uint( + Uint { + ty: TypeId(0x763d199bccd319899208909ed1a860c6), + bit_width: 64, + }, + ), + size: Some( + 8, + ), +} +Type { + kind: Other, + size: Some( + 4, + ), +} +Type { + kind: Other, + size: Some( + 24, + ), +} +Type { + kind: Other, + size: Some( + 16, + ), +} +Type { + kind: Other, + size: Some( + 16, + ), +} +Type { + kind: Other, + size: Some( + 16, + ), +} +Type { + kind: Str( + Str { + ty: TypeId(0x474ccf3b5db264ef53916706f7d7bb2c), + }, + ), + size: None, +} +Type { + kind: Other, + size: None, +} diff --git a/tests/ui/reflection/dump.rs b/tests/ui/reflection/dump.rs index 0adcda481b5a8..584b7c8ed4ae8 100644 --- a/tests/ui/reflection/dump.rs +++ b/tests/ui/reflection/dump.rs @@ -1,6 +1,11 @@ -#![feature(type_info)] +// Some types whose length depends on the target pointer length will be dumped. +//@ revisions: bit32 bit64 +//@[bit32] only-32bit +//@[bit64] only-64bit //@ run-pass //@ check-run-results + +#![feature(type_info)] #![allow(dead_code)] use std::mem::type_info::Type; @@ -20,14 +25,20 @@ struct Unsized { s: str, } +macro_rules! dump_types { + ($($ty:ty),+ $(,)?) => { + $(println!("{:#?}", const { Type::of::<$ty>() });)+ + }; +} + fn main() { - println!("{:#?}", const { Type::of::<(u8, u8, ())>() }.kind); - println!("{:#?}", const { Type::of::<[u8; 2]>() }.kind); - println!("{:#?}", const { Type::of::() }.kind); - println!("{:#?}", const { Type::of::() }.kind); - println!("{:#?}", const { Type::of::<&Unsized>() }.kind); - println!("{:#?}", const { Type::of::<&str>() }.kind); - println!("{:#?}", const { Type::of::<&[u8]>() }.kind); - println!("{:#?}", const { Type::of::() }.kind); - println!("{:#?}", const { Type::of::<[u8]>() }.kind); + dump_types! { + (u8, u8, ()), + [u8; 2], + i8, i32, i64, i128, isize, + u8, u32, u64, u128, usize, + Foo, Bar, + &Unsized, &str, &[u8], + str, [u8], + } } diff --git a/tests/ui/reflection/dump.run.stdout b/tests/ui/reflection/dump.run.stdout deleted file mode 100644 index dfd128664e2d9..0000000000000 --- a/tests/ui/reflection/dump.run.stdout +++ /dev/null @@ -1,31 +0,0 @@ -Tuple( - Tuple { - fields: [ - Field { - ty: TypeId(0x0596b48cc04376e64d5c788c2aa46bdb), - offset: 0, - }, - Field { - ty: TypeId(0x0596b48cc04376e64d5c788c2aa46bdb), - offset: 1, - }, - Field { - ty: TypeId(0x41223169ff28813ba79b7268a2a968d9), - offset: 2, - }, - ], - }, -) -Array( - Array { - element_ty: TypeId(0x0596b48cc04376e64d5c788c2aa46bdb), - len: 2, - }, -) -Other -Other -Other -Other -Other -Other -Other diff --git a/tests/ui/suggestions/semi-suggestion-when-stmt-and-expr-span-equal.stderr b/tests/ui/suggestions/semi-suggestion-when-stmt-and-expr-span-equal.stderr index aa96159aacf57..9f34d27478814 100644 --- a/tests/ui/suggestions/semi-suggestion-when-stmt-and-expr-span-equal.stderr +++ b/tests/ui/suggestions/semi-suggestion-when-stmt-and-expr-span-equal.stderr @@ -21,14 +21,14 @@ LL | .collect::(); | = help: the trait `FromIterator<()>` is not implemented for `String` = help: the following other types implement trait `FromIterator`: - `String` implements `FromIterator<&Char>` `String` implements `FromIterator<&char>` + `String` implements `FromIterator<&std::ascii::Char>` `String` implements `FromIterator<&str>` `String` implements `FromIterator>` - `String` implements `FromIterator` `String` implements `FromIterator>` `String` implements `FromIterator` `String` implements `FromIterator` + `String` implements `FromIterator` note: the method call chain might not have had the expected associated types --> $DIR/semi-suggestion-when-stmt-and-expr-span-equal.rs:20:10 | diff --git a/tests/ui/traits/issue-77982.stderr b/tests/ui/traits/issue-77982.stderr index 4bc24e81215a0..b1baabc4394b0 100644 --- a/tests/ui/traits/issue-77982.stderr +++ b/tests/ui/traits/issue-77982.stderr @@ -44,10 +44,10 @@ LL | let ips: Vec<_> = (0..100_000).map(|_| u32::from(0u32.into())).collect( | type must be known at this point | = note: multiple `impl`s satisfying `u32: From<_>` found in the `core` crate: - - impl From for u32; - impl From for u32; - impl From for u32; - impl From for u32; + - impl From for u32; - impl From for u32; - impl From for u32; help: try using a fully qualified path to specify the expected types diff --git a/tests/ui/try-trait/bad-interconversion.stderr b/tests/ui/try-trait/bad-interconversion.stderr index 61fecaf89917c..f8c0deba99ba6 100644 --- a/tests/ui/try-trait/bad-interconversion.stderr +++ b/tests/ui/try-trait/bad-interconversion.stderr @@ -18,7 +18,7 @@ help: the following other types implement trait `From` = note: in this macro invocation --> $SRC_DIR/core/src/ascii/ascii_char.rs:LL:COL | - = note: `u8` implements `From` + = note: `u8` implements `From` ::: $SRC_DIR/core/src/ascii/ascii_char.rs:LL:COL | = note: in this macro invocation From 5c057ad89617b3872de836f6658f53db2a6c6e3a Mon Sep 17 00:00:00 2001 From: Asuna Date: Thu, 15 Jan 2026 21:12:04 +0100 Subject: [PATCH 2/3] Remove their own `TypeId` from type info for primitives --- .../src/const_eval/type_info.rs | 52 +++++-------------- library/core/src/mem/type_info.rs | 15 ++---- tests/ui/reflection/dump.bit32.run.stdout | 14 +---- tests/ui/reflection/dump.bit64.run.stdout | 14 +---- 4 files changed, 19 insertions(+), 76 deletions(-) diff --git a/compiler/rustc_const_eval/src/const_eval/type_info.rs b/compiler/rustc_const_eval/src/const_eval/type_info.rs index fc3378275be25..1e4b72d0ddac2 100644 --- a/compiler/rustc_const_eval/src/const_eval/type_info.rs +++ b/compiler/rustc_const_eval/src/const_eval/type_info.rs @@ -66,55 +66,39 @@ impl<'tcx> InterpCx<'tcx, CompileTimeMachine<'tcx>> { variant } ty::Bool => { - let (variant, variant_place) = downcast(sym::Bool)?; - let place = self.project_field(&variant_place, FieldIdx::ZERO)?; - self.write_primitive_type_info(place, ty, None)?; + let (variant, _variant_place) = downcast(sym::Bool)?; variant } ty::Char => { - let (variant, variant_place) = downcast(sym::Char)?; - let place = self.project_field(&variant_place, FieldIdx::ZERO)?; - self.write_primitive_type_info(place, ty, None)?; + let (variant, _variant_place) = downcast(sym::Char)?; variant } ty::Int(int_ty) => { let (variant, variant_place) = downcast(sym::Int)?; let place = self.project_field(&variant_place, FieldIdx::ZERO)?; - self.write_primitive_type_info( + self.write_int_float_type_info( place, - ty, - Some( - int_ty - .bit_width() - .unwrap_or_else(/* isize */ ptr_bit_width), - ), + int_ty.bit_width().unwrap_or_else(/* isize */ ptr_bit_width), )?; variant } ty::Uint(uint_ty) => { let (variant, variant_place) = downcast(sym::Uint)?; let place = self.project_field(&variant_place, FieldIdx::ZERO)?; - self.write_primitive_type_info( + self.write_int_float_type_info( place, - ty, - Some( - uint_ty - .bit_width() - .unwrap_or_else(/* usize */ ptr_bit_width), - ), + uint_ty.bit_width().unwrap_or_else(/* usize */ ptr_bit_width), )?; variant } ty::Float(float_ty) => { let (variant, variant_place) = downcast(sym::Float)?; let place = self.project_field(&variant_place, FieldIdx::ZERO)?; - self.write_primitive_type_info(place, ty, Some(float_ty.bit_width()))?; + self.write_int_float_type_info(place, float_ty.bit_width())?; variant } ty::Str => { - let (variant, variant_place) = downcast(sym::Str)?; - let place = self.project_field(&variant_place, FieldIdx::ZERO)?; - self.write_primitive_type_info(place, ty, None)?; + let (variant, _variant_place) = downcast(sym::Str)?; variant } ty::Adt(_, _) @@ -252,28 +236,20 @@ impl<'tcx> InterpCx<'tcx, CompileTimeMachine<'tcx>> { interp_ok(()) } - // This method always writes to field `ty`. - // If field `bit_width` is present, it also writes to it (in which case parameter `write_bit_width` must be `Some`). - fn write_primitive_type_info( + fn write_int_float_type_info( &mut self, place: impl Writeable<'tcx, CtfeProvenance>, - ty: Ty<'tcx>, - write_bit_width: Option, + bit_width: u64, ) -> InterpResult<'tcx> { for (field_idx, field) in place.layout().ty.ty_adt_def().unwrap().non_enum_variant().fields.iter_enumerated() { let field_place = self.project_field(&place, field_idx)?; match field.name { - sym::ty => self.write_type_id(ty, &field_place)?, - sym::bit_width => { - let bit_width = write_bit_width - .expect("type info struct needs a `bit_width` but none was provided"); - self.write_scalar( - ScalarInt::try_from_target_usize(bit_width, self.tcx.tcx).unwrap(), - &field_place, - )? - } + sym::bit_width => self.write_scalar( + ScalarInt::try_from_target_usize(bit_width, self.tcx.tcx).unwrap(), + &field_place, + )?, other => span_bug!(self.tcx.def_span(field.did), "unimplemented field {other}"), } } diff --git a/library/core/src/mem/type_info.rs b/library/core/src/mem/type_info.rs index 7db4f3b001233..e02e07ae3b4ac 100644 --- a/library/core/src/mem/type_info.rs +++ b/library/core/src/mem/type_info.rs @@ -97,8 +97,7 @@ pub struct Array { #[non_exhaustive] #[unstable(feature = "type_info", issue = "146922")] pub struct Bool { - /// The type id of `bool`. - pub ty: TypeId, + // No additional information to provide for now. } /// Compile-time type information about `char`. @@ -106,8 +105,7 @@ pub struct Bool { #[non_exhaustive] #[unstable(feature = "type_info", issue = "146922")] pub struct Char { - /// The type id of `char`. - pub ty: TypeId, + // No additional information to provide for now. } /// Compile-time type information about signed integer types. @@ -115,8 +113,6 @@ pub struct Char { #[non_exhaustive] #[unstable(feature = "type_info", issue = "146922")] pub struct Int { - /// The type id of signed integer type. - pub ty: TypeId, /// The bit width of the signed integer type. pub bit_width: usize, } @@ -126,8 +122,6 @@ pub struct Int { #[non_exhaustive] #[unstable(feature = "type_info", issue = "146922")] pub struct Uint { - /// The type id of unsigned integer type. - pub ty: TypeId, /// The bit width of the unsigned integer type. pub bit_width: usize, } @@ -137,8 +131,6 @@ pub struct Uint { #[non_exhaustive] #[unstable(feature = "type_info", issue = "146922")] pub struct Float { - /// The type id of floating-point type. - pub ty: TypeId, /// The bit width of the floating-point type. pub bit_width: usize, } @@ -148,6 +140,5 @@ pub struct Float { #[non_exhaustive] #[unstable(feature = "type_info", issue = "146922")] pub struct Str { - /// The type id of `str`. - pub ty: TypeId, + // No additional information to provide for now. } diff --git a/tests/ui/reflection/dump.bit32.run.stdout b/tests/ui/reflection/dump.bit32.run.stdout index d747ee2102040..c6df7b00bf4a1 100644 --- a/tests/ui/reflection/dump.bit32.run.stdout +++ b/tests/ui/reflection/dump.bit32.run.stdout @@ -35,7 +35,6 @@ Type { Type { kind: Int( Int { - ty: TypeId(0x12427c993eca190c841e0d92c5b7a45d), bit_width: 8, }, ), @@ -46,7 +45,6 @@ Type { Type { kind: Int( Int { - ty: TypeId(0x56ced5e4a15bd89050bb9674fa2df013), bit_width: 32, }, ), @@ -57,7 +55,6 @@ Type { Type { kind: Int( Int { - ty: TypeId(0xae6c4318bb07632e00428affbea41961), bit_width: 64, }, ), @@ -68,7 +65,6 @@ Type { Type { kind: Int( Int { - ty: TypeId(0xc7164498f3902dde0d8194a7b9733e79), bit_width: 128, }, ), @@ -79,7 +75,6 @@ Type { Type { kind: Int( Int { - ty: TypeId(0x1e5f92831c560aac8658b980a22e60b0), bit_width: 32, }, ), @@ -90,7 +85,6 @@ Type { Type { kind: Uint( Uint { - ty: TypeId(0x0596b48cc04376e64d5c788c2aa46bdb), bit_width: 8, }, ), @@ -101,7 +95,6 @@ Type { Type { kind: Uint( Uint { - ty: TypeId(0x1378bb1c0a0202683eb65e7c11f2e4d7), bit_width: 32, }, ), @@ -112,7 +105,6 @@ Type { Type { kind: Uint( Uint { - ty: TypeId(0x9ed91be891e304132cb86891e578f4a5), bit_width: 64, }, ), @@ -123,7 +115,6 @@ Type { Type { kind: Uint( Uint { - ty: TypeId(0x7bf7411d57d603e9fb393892a9c3f362), bit_width: 128, }, ), @@ -134,7 +125,6 @@ Type { Type { kind: Uint( Uint { - ty: TypeId(0x763d199bccd319899208909ed1a860c6), bit_width: 32, }, ), @@ -174,9 +164,7 @@ Type { } Type { kind: Str( - Str { - ty: TypeId(0x474ccf3b5db264ef53916706f7d7bb2c), - }, + Str, ), size: None, } diff --git a/tests/ui/reflection/dump.bit64.run.stdout b/tests/ui/reflection/dump.bit64.run.stdout index 180a6e2882d75..0f39e3e4c6b02 100644 --- a/tests/ui/reflection/dump.bit64.run.stdout +++ b/tests/ui/reflection/dump.bit64.run.stdout @@ -35,7 +35,6 @@ Type { Type { kind: Int( Int { - ty: TypeId(0x12427c993eca190c841e0d92c5b7a45d), bit_width: 8, }, ), @@ -46,7 +45,6 @@ Type { Type { kind: Int( Int { - ty: TypeId(0x56ced5e4a15bd89050bb9674fa2df013), bit_width: 32, }, ), @@ -57,7 +55,6 @@ Type { Type { kind: Int( Int { - ty: TypeId(0xae6c4318bb07632e00428affbea41961), bit_width: 64, }, ), @@ -68,7 +65,6 @@ Type { Type { kind: Int( Int { - ty: TypeId(0xc7164498f3902dde0d8194a7b9733e79), bit_width: 128, }, ), @@ -79,7 +75,6 @@ Type { Type { kind: Int( Int { - ty: TypeId(0x1e5f92831c560aac8658b980a22e60b0), bit_width: 64, }, ), @@ -90,7 +85,6 @@ Type { Type { kind: Uint( Uint { - ty: TypeId(0x0596b48cc04376e64d5c788c2aa46bdb), bit_width: 8, }, ), @@ -101,7 +95,6 @@ Type { Type { kind: Uint( Uint { - ty: TypeId(0x1378bb1c0a0202683eb65e7c11f2e4d7), bit_width: 32, }, ), @@ -112,7 +105,6 @@ Type { Type { kind: Uint( Uint { - ty: TypeId(0x9ed91be891e304132cb86891e578f4a5), bit_width: 64, }, ), @@ -123,7 +115,6 @@ Type { Type { kind: Uint( Uint { - ty: TypeId(0x7bf7411d57d603e9fb393892a9c3f362), bit_width: 128, }, ), @@ -134,7 +125,6 @@ Type { Type { kind: Uint( Uint { - ty: TypeId(0x763d199bccd319899208909ed1a860c6), bit_width: 64, }, ), @@ -174,9 +164,7 @@ Type { } Type { kind: Str( - Str { - ty: TypeId(0x474ccf3b5db264ef53916706f7d7bb2c), - }, + Str, ), size: None, } From b2a7b18ec4c93ef11eb51cb2dccbe5f257993bd1 Mon Sep 17 00:00:00 2001 From: Asuna Date: Thu, 15 Jan 2026 22:17:43 +0100 Subject: [PATCH 3/3] Merge type info variant `Uint` into `Int` --- .../src/const_eval/type_info.rs | 36 +++++++++++++++---- compiler/rustc_span/src/symbol.rs | 2 +- library/core/src/mem/type_info.rs | 17 +++------ library/coretests/tests/mem/type_info.rs | 16 +++++---- tests/ui/reflection/dump.bit32.run.stdout | 30 ++++++++++------ tests/ui/reflection/dump.bit64.run.stdout | 30 ++++++++++------ 6 files changed, 85 insertions(+), 46 deletions(-) diff --git a/compiler/rustc_const_eval/src/const_eval/type_info.rs b/compiler/rustc_const_eval/src/const_eval/type_info.rs index 1e4b72d0ddac2..5d37db06d76ac 100644 --- a/compiler/rustc_const_eval/src/const_eval/type_info.rs +++ b/compiler/rustc_const_eval/src/const_eval/type_info.rs @@ -1,6 +1,6 @@ use rustc_abi::FieldIdx; use rustc_hir::LangItem; -use rustc_middle::mir::interpret::CtfeProvenance; +use rustc_middle::mir::interpret::{CtfeProvenance, Scalar}; use rustc_middle::span_bug; use rustc_middle::ty::layout::TyAndLayout; use rustc_middle::ty::{self, Const, ScalarInt, Ty}; @@ -76,25 +76,27 @@ impl<'tcx> InterpCx<'tcx, CompileTimeMachine<'tcx>> { ty::Int(int_ty) => { let (variant, variant_place) = downcast(sym::Int)?; let place = self.project_field(&variant_place, FieldIdx::ZERO)?; - self.write_int_float_type_info( + self.write_int_type_info( place, int_ty.bit_width().unwrap_or_else(/* isize */ ptr_bit_width), + true, )?; variant } ty::Uint(uint_ty) => { - let (variant, variant_place) = downcast(sym::Uint)?; + let (variant, variant_place) = downcast(sym::Int)?; let place = self.project_field(&variant_place, FieldIdx::ZERO)?; - self.write_int_float_type_info( + self.write_int_type_info( place, uint_ty.bit_width().unwrap_or_else(/* usize */ ptr_bit_width), + false, )?; variant } ty::Float(float_ty) => { let (variant, variant_place) = downcast(sym::Float)?; let place = self.project_field(&variant_place, FieldIdx::ZERO)?; - self.write_int_float_type_info(place, float_ty.bit_width())?; + self.write_float_type_info(place, float_ty.bit_width())?; variant } ty::Str => { @@ -236,7 +238,29 @@ impl<'tcx> InterpCx<'tcx, CompileTimeMachine<'tcx>> { interp_ok(()) } - fn write_int_float_type_info( + fn write_int_type_info( + &mut self, + place: impl Writeable<'tcx, CtfeProvenance>, + bit_width: u64, + signed: bool, + ) -> InterpResult<'tcx> { + for (field_idx, field) in + place.layout().ty.ty_adt_def().unwrap().non_enum_variant().fields.iter_enumerated() + { + let field_place = self.project_field(&place, field_idx)?; + match field.name { + sym::bit_width => self.write_scalar( + ScalarInt::try_from_target_usize(bit_width, self.tcx.tcx).unwrap(), + &field_place, + )?, + sym::signed => self.write_scalar(Scalar::from_bool(signed), &field_place)?, + other => span_bug!(self.tcx.def_span(field.did), "unimplemented field {other}"), + } + } + interp_ok(()) + } + + fn write_float_type_info( &mut self, place: impl Writeable<'tcx, CtfeProvenance>, bit_width: u64, diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 4c19fa83fd3a5..6aa6ce2695174 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -391,7 +391,6 @@ symbols! { Ty, TyCtxt, TyKind, - Uint, Unknown, Unsize, UnsizedConstParamTy, @@ -2066,6 +2065,7 @@ symbols! { shr_assign, sig_dfl, sig_ign, + signed, simd, simd_add, simd_and, diff --git a/library/core/src/mem/type_info.rs b/library/core/src/mem/type_info.rs index e02e07ae3b4ac..2e3bdb45ce052 100644 --- a/library/core/src/mem/type_info.rs +++ b/library/core/src/mem/type_info.rs @@ -49,10 +49,8 @@ pub enum TypeKind { Bool(Bool), /// Primitive character type. Char(Char), - /// Primitive signed integer type. + /// Primitive signed and unsigned integer type. Int(Int), - /// Primitive unsigned integer type. - Uint(Uint), /// Primitive floating-point type. Float(Float), /// String slice type. @@ -108,22 +106,15 @@ pub struct Char { // No additional information to provide for now. } -/// Compile-time type information about signed integer types. +/// Compile-time type information about signed and unsigned integer types. #[derive(Debug)] #[non_exhaustive] #[unstable(feature = "type_info", issue = "146922")] pub struct Int { /// The bit width of the signed integer type. pub bit_width: usize, -} - -/// Compile-time type information about unsigned integer types. -#[derive(Debug)] -#[non_exhaustive] -#[unstable(feature = "type_info", issue = "146922")] -pub struct Uint { - /// The bit width of the unsigned integer type. - pub bit_width: usize, + /// Whether the integer type is signed. + pub signed: bool, } /// Compile-time type information about floating-point types. diff --git a/library/coretests/tests/mem/type_info.rs b/library/coretests/tests/mem/type_info.rs index 5dd8f4034d114..fc13637a5574c 100644 --- a/library/coretests/tests/mem/type_info.rs +++ b/library/coretests/tests/mem/type_info.rs @@ -38,7 +38,7 @@ fn test_tuples() { assert_tuple_arity::<(u8, u8), 2>(); const { - match Type::of::<(u8, u8)>().kind { + match Type::of::<(i8, u8)>().kind { TypeKind::Tuple(tup) => { let [a, b] = tup.fields else { unreachable!() }; @@ -46,9 +46,9 @@ fn test_tuples() { assert!(b.offset == 1); match (a.ty.info().kind, b.ty.info().kind) { - (TypeKind::Uint(a), TypeKind::Uint(b)) => { - assert!(a.bit_width == 8); - assert!(b.bit_width == 8); + (TypeKind::Int(a), TypeKind::Int(b)) => { + assert!(a.bit_width == 8 && a.signed); + assert!(b.bit_width == 8 && !b.signed); } _ => unreachable!(), } @@ -71,18 +71,22 @@ fn test_primitives() { let Type { kind: Int(ty), size, .. } = (const { Type::of::() }) else { panic!() }; assert_eq!(size, Some(4)); assert_eq!(ty.bit_width, 32); + assert!(ty.signed); let Type { kind: Int(ty), size, .. } = (const { Type::of::() }) else { panic!() }; assert_eq!(size, Some(size_of::())); assert_eq!(ty.bit_width, size_of::() * 8); + assert!(ty.signed); - let Type { kind: Uint(ty), size, .. } = (const { Type::of::() }) else { panic!() }; + let Type { kind: Int(ty), size, .. } = (const { Type::of::() }) else { panic!() }; assert_eq!(size, Some(4)); assert_eq!(ty.bit_width, 32); + assert!(!ty.signed); - let Type { kind: Uint(ty), size, .. } = (const { Type::of::() }) else { panic!() }; + let Type { kind: Int(ty), size, .. } = (const { Type::of::() }) else { panic!() }; assert_eq!(size, Some(size_of::())); assert_eq!(ty.bit_width, size_of::() * 8); + assert!(!ty.signed); let Type { kind: Float(ty), size, .. } = (const { Type::of::() }) else { panic!() }; assert_eq!(size, Some(4)); diff --git a/tests/ui/reflection/dump.bit32.run.stdout b/tests/ui/reflection/dump.bit32.run.stdout index c6df7b00bf4a1..483efdbbd12ab 100644 --- a/tests/ui/reflection/dump.bit32.run.stdout +++ b/tests/ui/reflection/dump.bit32.run.stdout @@ -36,6 +36,7 @@ Type { kind: Int( Int { bit_width: 8, + signed: true, }, ), size: Some( @@ -46,6 +47,7 @@ Type { kind: Int( Int { bit_width: 32, + signed: true, }, ), size: Some( @@ -56,6 +58,7 @@ Type { kind: Int( Int { bit_width: 64, + signed: true, }, ), size: Some( @@ -66,6 +69,7 @@ Type { kind: Int( Int { bit_width: 128, + signed: true, }, ), size: Some( @@ -76,6 +80,7 @@ Type { kind: Int( Int { bit_width: 32, + signed: true, }, ), size: Some( @@ -83,9 +88,10 @@ Type { ), } Type { - kind: Uint( - Uint { + kind: Int( + Int { bit_width: 8, + signed: false, }, ), size: Some( @@ -93,9 +99,10 @@ Type { ), } Type { - kind: Uint( - Uint { + kind: Int( + Int { bit_width: 32, + signed: false, }, ), size: Some( @@ -103,9 +110,10 @@ Type { ), } Type { - kind: Uint( - Uint { + kind: Int( + Int { bit_width: 64, + signed: false, }, ), size: Some( @@ -113,9 +121,10 @@ Type { ), } Type { - kind: Uint( - Uint { + kind: Int( + Int { bit_width: 128, + signed: false, }, ), size: Some( @@ -123,9 +132,10 @@ Type { ), } Type { - kind: Uint( - Uint { + kind: Int( + Int { bit_width: 32, + signed: false, }, ), size: Some( diff --git a/tests/ui/reflection/dump.bit64.run.stdout b/tests/ui/reflection/dump.bit64.run.stdout index 0f39e3e4c6b02..681e81b71d56b 100644 --- a/tests/ui/reflection/dump.bit64.run.stdout +++ b/tests/ui/reflection/dump.bit64.run.stdout @@ -36,6 +36,7 @@ Type { kind: Int( Int { bit_width: 8, + signed: true, }, ), size: Some( @@ -46,6 +47,7 @@ Type { kind: Int( Int { bit_width: 32, + signed: true, }, ), size: Some( @@ -56,6 +58,7 @@ Type { kind: Int( Int { bit_width: 64, + signed: true, }, ), size: Some( @@ -66,6 +69,7 @@ Type { kind: Int( Int { bit_width: 128, + signed: true, }, ), size: Some( @@ -76,6 +80,7 @@ Type { kind: Int( Int { bit_width: 64, + signed: true, }, ), size: Some( @@ -83,9 +88,10 @@ Type { ), } Type { - kind: Uint( - Uint { + kind: Int( + Int { bit_width: 8, + signed: false, }, ), size: Some( @@ -93,9 +99,10 @@ Type { ), } Type { - kind: Uint( - Uint { + kind: Int( + Int { bit_width: 32, + signed: false, }, ), size: Some( @@ -103,9 +110,10 @@ Type { ), } Type { - kind: Uint( - Uint { + kind: Int( + Int { bit_width: 64, + signed: false, }, ), size: Some( @@ -113,9 +121,10 @@ Type { ), } Type { - kind: Uint( - Uint { + kind: Int( + Int { bit_width: 128, + signed: false, }, ), size: Some( @@ -123,9 +132,10 @@ Type { ), } Type { - kind: Uint( - Uint { + kind: Int( + Int { bit_width: 64, + signed: false, }, ), size: Some(