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:
commit
36316df9fe
37 changed files with 141 additions and 78 deletions
|
@ -1,4 +1,4 @@
|
|||
//! Defines language items.
|
||||
//! Defines lang items.
|
||||
//!
|
||||
//! Language items are items that represent concepts intrinsic to the language
|
||||
//! itself. Examples are:
|
||||
|
@ -16,7 +16,7 @@ use rustc_macros::HashStable_Generic;
|
|||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
use rustc_span::Span;
|
||||
|
||||
/// All of the language items, defined or not.
|
||||
/// All of the lang items, defined or not.
|
||||
/// Defined lang items can come from the current crate or its dependencies.
|
||||
#[derive(HashStable_Generic, Debug)]
|
||||
pub struct LanguageItems {
|
||||
|
@ -57,7 +57,7 @@ macro_rules! language_item_table {
|
|||
) => {
|
||||
|
||||
enum_from_u32! {
|
||||
/// A representation of all the valid language items in Rust.
|
||||
/// A representation of all the valid lang items in Rust.
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Encodable, Decodable)]
|
||||
pub enum LangItem {
|
||||
$(
|
||||
|
@ -177,7 +177,7 @@ language_item_table! {
|
|||
CoerceUnsized, sym::coerce_unsized, coerce_unsized_trait, Target::Trait, GenericRequirement::Minimum(1);
|
||||
DispatchFromDyn, sym::dispatch_from_dyn, dispatch_from_dyn_trait, Target::Trait, GenericRequirement::Minimum(1);
|
||||
|
||||
// language items relating to transmutability
|
||||
// lang items relating to transmutability
|
||||
TransmuteOpts, sym::transmute_opts, transmute_opts, Target::Struct, GenericRequirement::Exact(0);
|
||||
TransmuteTrait, sym::transmute_trait, transmute_trait, Target::Trait, GenericRequirement::Exact(2);
|
||||
|
||||
|
@ -304,7 +304,7 @@ language_item_table! {
|
|||
OwnedBox, sym::owned_box, owned_box, Target::Struct, GenericRequirement::Minimum(1);
|
||||
GlobalAlloc, sym::global_alloc_ty, global_alloc_ty, Target::Struct, GenericRequirement::None;
|
||||
|
||||
// Experimental language item for Miri
|
||||
// Experimental lang item for Miri
|
||||
PtrUnique, sym::ptr_unique, ptr_unique, Target::Struct, GenericRequirement::Exact(1);
|
||||
|
||||
PhantomData, sym::phantom_data, phantom_data, Target::Struct, GenericRequirement::Exact(1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue