diff options
| author | Folkert de Vries <folkert@folkertdev.nl> | 2025-07-10 16:12:05 +0200 |
|---|---|---|
| committer | Folkert de Vries <folkert@folkertdev.nl> | 2025-07-15 20:20:46 +0200 |
| commit | f8de93acbe41241d6a17c6ba9cba663f9588fe43 (patch) | |
| tree | 9c4a63e739f0ebeb5a54d8410a7ae75a8bab5423 /library/stdarch/crates/stdarch-test | |
| parent | 36340cd77453b783f22139a64ff008cc1b71034a (diff) | |
| download | rust-f8de93acbe41241d6a17c6ba9cba663f9588fe43.tar.gz rust-f8de93acbe41241d6a17c6ba9cba663f9588fe43.zip | |
`stdarch-test`: error if only part of an instruction matched
Diffstat (limited to 'library/stdarch/crates/stdarch-test')
| -rw-r--r-- | library/stdarch/crates/stdarch-test/src/lib.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/library/stdarch/crates/stdarch-test/src/lib.rs b/library/stdarch/crates/stdarch-test/src/lib.rs index 98f44f745fd..317b4641059 100644 --- a/library/stdarch/crates/stdarch-test/src/lib.rs +++ b/library/stdarch/crates/stdarch-test/src/lib.rs @@ -92,7 +92,13 @@ pub fn assert(shim_addr: usize, fnname: &str, expected: &str) { }; // Check whether the given instruction is part of the disassemblied body. - let found = expected == "nop" || instrs.iter().any(|s| s.starts_with(expected)); + let found = expected == "nop" + || instrs.iter().any(|instruction| { + // Check that the next character is non-alphabetic. This prevents false negatives + // when e.g. `fminnm` was used but `fmin` was expected. + instruction.starts_with(expected) + && !instruction[expected.len()..].starts_with(|c: char| c.is_ascii_alphabetic()) + }); // Look for subroutine call instructions in the disassembly to detect whether // inlining failed: all intrinsics are `#[inline(always)]`, so calling one |
