This commit adds basic support for FFI callbacks by registering a shim function
via libffi. This shim function currently only exits with an error. The main
motivation for this is to prevent miri segfaulting as described in
[4639](https://github.com/rust-lang/miri/issues/4639).
In the future miri could try to continue execution in the registered
callback, although as far as I understand Ralf that is no easy problem.
refactor `destructure_const`
r? BoxyUwU
as you suggested yesterday (will add more context like links when it stops being a draft)
tried to split this into some meaningful commits hope it help ^^
Add more `unbounded_sh[lr]` examples
Inspired by rust-lang/rust#149837, which added more stuff to `wrapping_sh[lr]`, including a cross-reference to these methods.
Fix ICE by rejecting const blocks in patterns during AST lowering (closes#148138)
This PR fixes the ICE reported in rust-lang/rust#148138.
The root cause is that `const` blocks aren’t allowed in pattern position, but the AST lowering logic still attempted to create `PatExprKind::ConstBlock`, allowing invalid HIR to reach type checking and trigger a `span_bug!`.
Following the discussion in the issue, this patch removes the `ConstBlock` lowering path from `lower_expr_within_pat`. Any `ExprKind::ConstBlock` inside a pattern is now handled consistently with other invalid pattern expressions.
A new UI test is included to ensure the compiler reports a proper error and to prevent regressions.
Closesrust-lang/rust#148138.
std: sys: fs: uefi: Implement readdir
- Tested on OVMF.
- Add path field to uefi file since this will also be required in
implementing Debug for rust File.
``@rustbot`` label +O-UEFI
parser/lexer: bump to Unicode 17, use faster unicode-ident
Hello,
Bump the unicode version used by lexer/parser to 17.0.0 by updating:
- `unicode-normalization` to 0.1.25
- `unicode-properties` to 0.1.4
- `unicode-width` to 0.2.2
and by replacing `unicode-xid` with `unicode-ident` which is also 6 times faster.
I think it might be worth to run the benchmarks to double check.
(`unicode-ident` is already in `src/tools/tidy/src/deps.rs`)
Thanks!
Implement round-ties-to-even for Duration Debug for consistency with f64
## Summary
This PR proposes a fix for rust-lang/rust#103747 implementing IEEE-754 S4.3 roundTiesToEven for Duration Debug implementation.
## Testing
Added new test in `time.rs` for validating roundTiesToEven behavior in Duration formatting. Reran all debug formatting tests in `time.rs` with `./x test library/coretests --test-args time::debug_formatting`.
Fix `LinkedList::CursorMut::pop_front` to correctly update index
When `pop_front` was called while the cursor pointed to the front element, `move_next` incremented the index but it was never decremented afterwards, causing the index to incorrectly report 1 instead of 0.
Always decrement the index after popping from front using `saturating_sub` to handle edge cases safely.
Fixesrust-lang/rust#147616
Rollup of 3 pull requests
Successful merges:
- rust-lang/rust#148533 (Split LLVM intrinsic abi handling from the rest of the abi handling)
- rust-lang/rust#150358 (fix rustfmt on `const impl Ty {}`)
- rust-lang/rust#150434 (Add test for never type fallback in try blocks with `Into<!>`)
r? `@ghost`
`@rustbot` modify labels: rollup
Add test for never type fallback in try blocks with `Into<!>`
### Summary
Adds UI tests for issue rust-lang/rust#125364, which involves the interaction between
never type fallback, try blocks, and `From`/`Into` trait bounds.
### Changes
- Added `tests/ui/never_type/try-block-never-type-fallback.rs`
- Tests both edition 2021 (where the issue manifests) and edition 2024 (where it's fixed)
### Issue
Closesrust-lang/rust#125364
### Testing
```bash
./x test tests/ui/never_type/try-block-never-type-fallback.rs
```
Both test variants pass:
e2021: Correctly fails with expected error
e2024: Compiles successfully (check-pass)
### Notes
This test documents the edition-dependent behavior of never type fallback in try blocks, as requested in the original issue.
cc `@WaffleLapkin`
Split LLVM intrinsic abi handling from the rest of the abi handling
LLVM intrinsics have weird requirements like requiring the fake "unadjusted" abi, not being callable through function pointers and for all codegen backends other than cg_llvm requiring special cases to redirect them to the correct backend specific intrinsic (or directly codegen their implementation inline without any intrinsic call). By splitting the LLVM intrinsic handling it becomes easier for backends to special case them and should in the future allow getting rid of the abi calculation for `extern "unadjusted"` in favor of computing the correct abi directly in the backend without depending on the exact way cg_ssa lowers types.