1
Fork 0

Rollup merge of #124067 - RalfJung:weak-lang-items, r=davidtwco

weak lang items are not allowed to be #[track_caller]

For instance the panic handler will be called via this import
```rust
        extern "Rust" {
            #[lang = "panic_impl"]
            fn panic_impl(pi: &PanicInfo<'_>) -> !;
        }
```
A `#[track_caller]` would add an extra argument and thus make this the wrong signature.

The 2nd commit is a consistency rename; based on the docs [here](https://doc.rust-lang.org/unstable-book/language-features/lang-items.html) and [here](https://rustc-dev-guide.rust-lang.org/lang-items.html) I figured "lang item" is more widely used. (In the compiler output, "lang item" and "language item" seem to be pretty even.)
This commit is contained in:
Matthias Krüger 2024-04-23 12:10:25 +02:00 committed by GitHub
commit 36316df9fe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
37 changed files with 141 additions and 78 deletions

View file

@ -160,7 +160,7 @@ pub fn deduced_param_attrs<'tcx>(
return &[];
}
// If the Freeze language item isn't present, then don't bother.
// If the Freeze lang item isn't present, then don't bother.
if tcx.lang_items().freeze_trait().is_none() {
return &[];
}

View file

@ -21,7 +21,7 @@ impl<'tcx> MirPass<'tcx> for LowerSliceLenCalls {
pub fn lower_slice_len_calls<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
let language_items = tcx.lang_items();
let Some(slice_len_fn_item_def_id) = language_items.slice_len_fn() else {
// there is no language item to compare to :)
// there is no lang item to compare to :)
return;
};