Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
2c752bc
Undeprecate env::home_dir
arlosi Feb 20, 2025
b340545
[illumos] attempt to use posix_spawn to spawn processes
sunshowers Feb 11, 2025
a7bd4a3
Add DWARF test case for non-C-like `repr128` enums
beetrees Feb 25, 2025
c4d6426
Set target_vendor = "openwrt"
madsmtm Mar 1, 2025
ea13ff7
add exclude to config.toml
Shourya742 Feb 16, 2025
d9ceab9
add test for exclude feature
Shourya742 Feb 16, 2025
9206960
Add change info to change tracker
Shourya742 Feb 16, 2025
86aae8e
uefi: Add Service Binding Protocol abstraction
Ayush1325 Feb 23, 2025
3998690
compiletest: remove legacy `Makefile`-based `run-make` support
jieyouxu Feb 5, 2025
413b824
run-make: remove `tools.mk`
jieyouxu Feb 5, 2025
9b17c98
run-make: update test suite README
jieyouxu Feb 5, 2025
ed168e7
run-make-support: remove outdated comments
jieyouxu Mar 1, 2025
efec638
tidy: remove legacy `Makefile` checks
jieyouxu Feb 5, 2025
b0d6a84
rustc-dev-guide: remove mentions of legacy `Makefile` run-make infra
jieyouxu Feb 5, 2025
95b030f
triagebot: stop backlinking to the test porting tracking issue
jieyouxu Feb 5, 2025
c97225b
`librustdoc`: 2024 edition! 🎊
yotamofek Feb 27, 2025
74c783c
Adapt `librustdoc` to 2024 edition lifetieme capture rules
yotamofek Feb 27, 2025
7e0a2fc
compiletest: change `TEST_BUILD_DIR` to maximally normalize
jieyouxu Feb 11, 2025
8342914
tests: remove explicit long type filename hash normalization from som…
jieyouxu Feb 11, 2025
12cd0f1
tests: rebless some tests as a side-effect of `TEST_BUILD_DIR` changes
jieyouxu Feb 11, 2025
4f2a3dc
tests: manually rebless `tests/ui-fulldeps/codegen-backend/hotplug.rs`
jieyouxu Feb 11, 2025
133705c
[rustdoc] hide item that is not marked as doc(inline) and whose src i…
xizheyin Feb 27, 2025
53ee696
Update MSVC INSTALL.md instructions to recommend VS 2022 + recent Win…
jieyouxu Mar 3, 2025
ab31129
Point of macro expansion from call expr if it involves macro var
compiler-errors Feb 24, 2025
e4dfca8
Point out macro expansion ident in resolver errors too
compiler-errors Feb 24, 2025
0607246
Fix associated type errors too
compiler-errors Feb 24, 2025
4fdc1b5
Construct MIR error body for global_asm correctly
compiler-errors Feb 23, 2025
dc9d559
Exclude global_asm from mir_keys
compiler-errors Feb 23, 2025
09e5846
Also note struct access, and fix macro expansion from foreign crates
compiler-errors Feb 24, 2025
f5bc2a9
Rollup merge of #136581 - jieyouxu:makefile-be-gone, r=Kobzol
jhpratt Mar 4, 2025
85642e0
Rollup merge of #136865 - jieyouxu:long-type-path-compare-mode, r=lqd
jhpratt Mar 4, 2025
6299dc6
Rollup merge of #137147 - Shourya742:2025-02-16-support-exclude-in-co…
jhpratt Mar 4, 2025
da4245f
Rollup merge of #137327 - arlosi:home-dir, r=Mark-Simulacrum
jhpratt Mar 4, 2025
8c7ad4d
Rollup merge of #137463 - sunshowers:illumos-posix-spawn, r=Mark-Simu…
jhpratt Mar 4, 2025
41faffc
Rollup merge of #137477 - Ayush1325:uefi-service-binding, r=Noratrieb
jhpratt Mar 4, 2025
129b5bd
Rollup merge of #137502 - compiler-errors:global-asm-aint-mir-body, r…
jhpratt Mar 4, 2025
db71de0
Rollup merge of #137534 - xizheyin:issue-137342, r=GuillaumeGomez
jhpratt Mar 4, 2025
ccb019a
Rollup merge of #137565 - compiler-errors:macro-ex, r=estebank
jhpratt Mar 4, 2025
175d191
Rollup merge of #137643 - beetrees:repr128-dwarf-variant-test, r=jiey…
jhpratt Mar 4, 2025
d9a357e
Rollup merge of #137722 - yotamofek:pr/rustdoc/edition-2024, r=notriddle
jhpratt Mar 4, 2025
ac73454
Rollup merge of #137836 - madsmtm:openwrt-target-vendor, r=jieyouxu
jhpratt Mar 4, 2025
d254423
Rollup merge of #137949 - jieyouxu:update-install, r=ChrisDenton
jhpratt Mar 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add DWARF test case for non-C-like repr128 enums
  • Loading branch information
beetrees committed Feb 25, 2025
commit a7bd4a309c2d154ab4bafee9b575d4196b5d3222
25 changes: 25 additions & 0 deletions tests/run-make/repr128-dwarf/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,33 @@ pub enum I128Enum {
I128D = i128::MAX.to_le(),
}

#[cfg(not(old_llvm))]
#[repr(u128)]
pub enum U128VariantEnum {
VariantU128A(u8) = 0_u128.to_le(),
VariantU128B = 1_u128.to_le(),
VariantU128C = (u64::MAX as u128 + 1).to_le(),
VariantU128D = u128::MAX.to_le(),
}

#[cfg(not(old_llvm))]
#[repr(i128)]
pub enum I128VariantEnum {
VariantI128A(u8) = 0_i128.to_le(),
VariantI128B = (-1_i128).to_le(),
VariantI128C = i128::MIN.to_le(),
VariantI128D = i128::MAX.to_le(),
}

pub fn f(_: U128Enum, _: I128Enum) {}

#[cfg(not(old_llvm))]
pub fn g(_: U128VariantEnum, _: I128VariantEnum) {}

fn main() {
f(U128Enum::U128A, I128Enum::I128A);
#[cfg(not(old_llvm))]
{
g(U128VariantEnum::VariantU128A(1), I128VariantEnum::VariantI128A(2));
}
}
115 changes: 94 additions & 21 deletions tests/run-make/repr128-dwarf/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,32 @@ use std::collections::HashMap;
use std::path::PathBuf;
use std::rc::Rc;

use gimli::read::DebuggingInformationEntry;
use gimli::{AttributeValue, EndianRcSlice, Reader, RunTimeEndian};
use object::{Object, ObjectSection};
use run_make_support::{gimli, object, rfs, rustc};

fn main() {
// Before LLVM 20, 128-bit enums with variants didn't emit debuginfo correctly.
// This check can be removed once Rust no longer supports LLVM 18 and 19.
let llvm_version = rustc()
.verbose()
.arg("--version")
.run()
.stdout_utf8()
.lines()
.filter_map(|line| line.strip_prefix("LLVM version: "))
.map(|version| version.split(".").next().unwrap().parse::<u32>().unwrap())
.next()
.unwrap();
let is_old_llvm = llvm_version < 20;

let output = PathBuf::from("repr128");
rustc().input("main.rs").output(&output).arg("-Cdebuginfo=2").run();
let mut rustc = rustc();
if is_old_llvm {
rustc.cfg("old_llvm");
}
rustc.input("main.rs").output(&output).arg("-Cdebuginfo=2").run();
// Mach-O uses packed debug info
let dsym_location = output
.with_extension("dSYM")
Expand All @@ -29,7 +48,8 @@ fn main() {
})
.unwrap();
let mut iter = dwarf.units();
let mut still_to_find = HashMap::from([

let mut enumerators_to_find = HashMap::from([
("U128A", 0_u128),
("U128B", 1_u128),
("U128C", u64::MAX as u128 + 1),
Expand All @@ -39,35 +59,88 @@ fn main() {
("I128C", i128::MIN as u128),
("I128D", i128::MAX as u128),
]);
let mut variants_to_find = HashMap::from([
("VariantU128A", 0_u128),
("VariantU128B", 1_u128),
("VariantU128C", u64::MAX as u128 + 1),
("VariantU128D", u128::MAX),
("VariantI128A", 0_i128 as u128),
("VariantI128B", (-1_i128) as u128),
("VariantI128C", i128::MIN as u128),
("VariantI128D", i128::MAX as u128),
]);

while let Some(header) = iter.next().unwrap() {
let unit = dwarf.unit(header).unwrap();
let mut cursor = unit.entries();

let get_name = |entry: &DebuggingInformationEntry<'_, '_, _>| {
let name = dwarf
.attr_string(
&unit,
entry.attr(gimli::constants::DW_AT_name).unwrap().unwrap().value(),
)
.unwrap();
name.to_string().unwrap().to_string()
};

while let Some((_, entry)) = cursor.next_dfs().unwrap() {
if entry.tag() == gimli::constants::DW_TAG_enumerator {
let name = dwarf
.attr_string(
&unit,
entry.attr(gimli::constants::DW_AT_name).unwrap().unwrap().value(),
)
.unwrap();
let name = name.to_string().unwrap();
if let Some(expected) = still_to_find.remove(name.as_ref()) {
match entry.attr(gimli::constants::DW_AT_const_value).unwrap().unwrap().value()
match entry.tag() {
gimli::constants::DW_TAG_variant if !is_old_llvm => {
let value = match entry
.attr(gimli::constants::DW_AT_discr_value)
.unwrap()
.unwrap()
.value()
{
AttributeValue::Block(value) => {
assert_eq!(
value.to_slice().unwrap(),
expected.to_le_bytes().as_slice(),
"{name}"
);
AttributeValue::Block(value) => value.to_slice().unwrap().to_vec(),
value => panic!("unexpected DW_AT_discr_value of {value:?}"),
};
// The `DW_TAG_member` that is a child of `DW_TAG_variant` will contain the
// variant's name.
let Some((1, child_entry)) = cursor.next_dfs().unwrap() else {
panic!("Missing child of DW_TAG_variant");
};
assert_eq!(child_entry.tag(), gimli::constants::DW_TAG_member);
let name = get_name(child_entry);
if let Some(expected) = variants_to_find.remove(name.as_str()) {
// This test uses LE byte order is used for consistent values across
// architectures.
assert_eq!(value.as_slice(), expected.to_le_bytes().as_slice(), "{name}");
}
}

gimli::constants::DW_TAG_enumerator => {
let name = get_name(entry);
if let Some(expected) = enumerators_to_find.remove(name.as_str()) {
match entry
.attr(gimli::constants::DW_AT_const_value)
.unwrap()
.unwrap()
.value()
{
AttributeValue::Block(value) => {
// This test uses LE byte order is used for consistent values across
// architectures.
assert_eq!(
value.to_slice().unwrap(),
expected.to_le_bytes().as_slice(),
"{name}"
);
}
value => panic!("{name}: unexpected DW_AT_const_value of {value:?}"),
}
value => panic!("{name}: unexpected DW_AT_const_value of {value:?}"),
}
}

_ => {}
}
}
}
if !still_to_find.is_empty() {
panic!("Didn't find debug entries for {still_to_find:?}");
if !enumerators_to_find.is_empty() {
panic!("Didn't find debug enumerator entries for {enumerators_to_find:?}");
}
if !is_old_llvm && !variants_to_find.is_empty() {
panic!("Didn't find debug variant entries for {variants_to_find:?}");
}
}
Loading