1
Fork 0

consistency rename: language item -> lang item

This commit is contained in:
Ralf Jung 2024-04-17 12:30:45 +02:00
parent d101971ab1
commit 8b35be741f
32 changed files with 72 additions and 72 deletions

View file

@ -6,7 +6,7 @@ Erroneous code example:
#![feature(lang_items)] #![feature(lang_items)]
#[lang = "cookie"] #[lang = "cookie"]
fn cookie() -> ! { // error: definition of an unknown language item: `cookie` fn cookie() -> ! { // error: definition of an unknown lang item: `cookie`
loop {} loop {}
} }
``` ```

View file

@ -798,7 +798,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
// ========================================================================== // ==========================================================================
gated!( gated!(
lang, Normal, template!(NameValueStr: "name"), DuplicatesOk, EncodeCrossCrate::No, lang_items, lang, Normal, template!(NameValueStr: "name"), DuplicatesOk, EncodeCrossCrate::No, lang_items,
"language items are subject to change", "lang items are subject to change",
), ),
rustc_attr!( rustc_attr!(
rustc_pass_by_value, Normal, template!(Word), ErrorFollowing, rustc_pass_by_value, Normal, template!(Word), ErrorFollowing,

View file

@ -1,4 +1,4 @@
//! Defines language items. //! Defines lang items.
//! //!
//! Language items are items that represent concepts intrinsic to the language //! Language items are items that represent concepts intrinsic to the language
//! itself. Examples are: //! itself. Examples are:
@ -16,7 +16,7 @@ use rustc_macros::HashStable_Generic;
use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::symbol::{kw, sym, Symbol};
use rustc_span::Span; 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. /// Defined lang items can come from the current crate or its dependencies.
#[derive(HashStable_Generic, Debug)] #[derive(HashStable_Generic, Debug)]
pub struct LanguageItems { pub struct LanguageItems {
@ -57,7 +57,7 @@ macro_rules! language_item_table {
) => { ) => {
enum_from_u32! { 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)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Encodable, Decodable)]
pub enum LangItem { pub enum LangItem {
$( $(
@ -165,7 +165,7 @@ language_item_table! {
CoerceUnsized, sym::coerce_unsized, coerce_unsized_trait, Target::Trait, GenericRequirement::Minimum(1); 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); 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); TransmuteOpts, sym::transmute_opts, transmute_opts, Target::Struct, GenericRequirement::Exact(0);
TransmuteTrait, sym::transmute_trait, transmute_trait, Target::Trait, GenericRequirement::Exact(2); TransmuteTrait, sym::transmute_trait, transmute_trait, Target::Trait, GenericRequirement::Exact(2);
@ -291,7 +291,7 @@ language_item_table! {
OwnedBox, sym::owned_box, owned_box, Target::Struct, GenericRequirement::Minimum(1); OwnedBox, sym::owned_box, owned_box, Target::Struct, GenericRequirement::Minimum(1);
GlobalAlloc, sym::global_alloc_ty, global_alloc_ty, Target::Struct, GenericRequirement::None; 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); PtrUnique, sym::ptr_unique, ptr_unique, Target::Struct, GenericRequirement::Exact(1);
PhantomData, sym::phantom_data, phantom_data, Target::Struct, GenericRequirement::Exact(1); PhantomData, sym::phantom_data, phantom_data, Target::Struct, GenericRequirement::Exact(1);

View file

@ -534,7 +534,7 @@ pub fn check_intrinsic_type(
sym::va_start | sym::va_end => match mk_va_list_ty(hir::Mutability::Mut) { sym::va_start | sym::va_end => match mk_va_list_ty(hir::Mutability::Mut) {
Some((va_list_ref_ty, _)) => (0, 0, vec![va_list_ref_ty], Ty::new_unit(tcx)), Some((va_list_ref_ty, _)) => (0, 0, vec![va_list_ref_ty], Ty::new_unit(tcx)),
None => bug!("`va_list` language item needed for C-variadic intrinsics"), None => bug!("`va_list` lang item needed for C-variadic intrinsics"),
}, },
sym::va_copy => match mk_va_list_ty(hir::Mutability::Not) { sym::va_copy => match mk_va_list_ty(hir::Mutability::Not) {
@ -542,12 +542,12 @@ pub fn check_intrinsic_type(
let va_list_ptr_ty = Ty::new_mut_ptr(tcx, va_list_ty); let va_list_ptr_ty = Ty::new_mut_ptr(tcx, va_list_ty);
(0, 0, vec![va_list_ptr_ty, va_list_ref_ty], Ty::new_unit(tcx)) (0, 0, vec![va_list_ptr_ty, va_list_ref_ty], Ty::new_unit(tcx))
} }
None => bug!("`va_list` language item needed for C-variadic intrinsics"), None => bug!("`va_list` lang item needed for C-variadic intrinsics"),
}, },
sym::va_arg => match mk_va_list_ty(hir::Mutability::Mut) { sym::va_arg => match mk_va_list_ty(hir::Mutability::Mut) {
Some((va_list_ref_ty, _)) => (1, 0, vec![va_list_ref_ty], param(0)), Some((va_list_ref_ty, _)) => (1, 0, vec![va_list_ref_ty], param(0)),
None => bug!("`va_list` language item needed for C-variadic intrinsics"), None => bug!("`va_list` lang item needed for C-variadic intrinsics"),
}, },
sym::nontemporal_store => { sym::nontemporal_store => {

View file

@ -1208,7 +1208,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
tcx.arena.alloc_from_iter(self.root.stability_implications.decode(self)) tcx.arena.alloc_from_iter(self.root.stability_implications.decode(self))
} }
/// Iterates over the language items in the given crate. /// Iterates over the lang items in the given crate.
fn get_lang_items(self, tcx: TyCtxt<'tcx>) -> &'tcx [(DefId, LangItem)] { fn get_lang_items(self, tcx: TyCtxt<'tcx>) -> &'tcx [(DefId, LangItem)] {
tcx.arena.alloc_from_iter( tcx.arena.alloc_from_iter(
self.root self.root

View file

@ -1,4 +1,4 @@
//! Detecting language items. //! Detecting lang items.
//! //!
//! Language items are items that represent concepts intrinsic to the language //! Language items are items that represent concepts intrinsic to the language
//! itself. Examples are: //! itself. Examples are:

View file

@ -160,7 +160,7 @@ pub fn deduced_param_attrs<'tcx>(
return &[]; 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() { if tcx.lang_items().freeze_trait().is_none() {
return &[]; 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>) { pub fn lower_slice_len_calls<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
let language_items = tcx.lang_items(); let language_items = tcx.lang_items();
let Some(slice_len_fn_item_def_id) = language_items.slice_len_fn() else { 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; return;
}; };

View file

@ -353,7 +353,7 @@ passes_incorrect_meta_item = expected a quoted string literal
passes_incorrect_meta_item_suggestion = consider surrounding this with quotes passes_incorrect_meta_item_suggestion = consider surrounding this with quotes
passes_incorrect_target = passes_incorrect_target =
`{$name}` language item must be applied to a {$kind} with {$at_least -> `{$name}` lang item must be applied to a {$kind} with {$at_least ->
[true] at least {$num} [true] at least {$num}
*[false] {$num} *[false] {$num}
} generic {$num -> } generic {$num ->
@ -396,7 +396,7 @@ passes_invalid_macro_export_arguments_too_many_items = `#[macro_export]` can onl
passes_lang_item_fn = {$name -> passes_lang_item_fn = {$name ->
[panic_impl] `#[panic_handler]` [panic_impl] `#[panic_handler]`
*[other] `{$name}` language item *[other] `{$name}` lang item
} function } function
passes_lang_item_fn_with_target_feature = passes_lang_item_fn_with_target_feature =
@ -408,7 +408,7 @@ passes_lang_item_fn_with_track_caller =
.label = {passes_lang_item_fn} is not allowed to have `#[target_feature]` .label = {passes_lang_item_fn} is not allowed to have `#[target_feature]`
passes_lang_item_on_incorrect_target = passes_lang_item_on_incorrect_target =
`{$name}` language item must be applied to a {$expected_target} `{$name}` lang item must be applied to a {$expected_target}
.label = attribute should be applied to a {$expected_target}, not a {$actual_target} .label = attribute should be applied to a {$expected_target}, not a {$actual_target}
passes_layout_abi = passes_layout_abi =
@ -464,7 +464,7 @@ passes_missing_const_stab_attr =
{$descr} has missing const stability attribute {$descr} has missing const stability attribute
passes_missing_lang_item = passes_missing_lang_item =
language item required, but not found: `{$name}` lang item required, but not found: `{$name}`
.note = this can occur when a binary crate with `#![no_std]` is compiled for a target where `{$name}` is defined in the standard library .note = this can occur when a binary crate with `#![no_std]` is compiled for a target where `{$name}` is defined in the standard library
.help = you may be able to compile for a target that doesn't need `{$name}`, specify a target with `--target` or in `.cargo/config` .help = you may be able to compile for a target that doesn't need `{$name}`, specify a target with `--target` or in `.cargo/config`
@ -705,8 +705,8 @@ passes_unknown_feature =
unknown feature `{$feature}` unknown feature `{$feature}`
passes_unknown_lang_item = passes_unknown_lang_item =
definition of an unknown language item: `{$name}` definition of an unknown lang item: `{$name}`
.label = definition of unknown language item `{$name}` .label = definition of unknown lang item `{$name}`
passes_unlabeled_cf_in_while_condition = passes_unlabeled_cf_in_while_condition =
`break` or `continue` with no label in the condition of a `while` loop `break` or `continue` with no label in the condition of a `while` loop

View file

@ -621,7 +621,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
) -> bool { ) -> bool {
match target { match target {
Target::Fn => { Target::Fn => {
// `#[target_feature]` is not allowed in language items. // `#[target_feature]` is not allowed in lang items.
if let Some((lang_item, _)) = hir::lang_items::extract(attrs) if let Some((lang_item, _)) = hir::lang_items::extract(attrs)
// Calling functions with `#[target_feature]` is // Calling functions with `#[target_feature]` is
// not unsafe on WASM, see #84988 // not unsafe on WASM, see #84988

View file

@ -1,4 +1,4 @@
//! Detecting language items. //! Detecting lang items.
//! //!
//! Language items are items that represent concepts intrinsic to the language //! Language items are items that represent concepts intrinsic to the language
//! itself. Examples are: //! itself. Examples are:

View file

@ -14,7 +14,7 @@ use crate::errors::{
}; };
/// Checks the crate for usage of weak lang items, returning a vector of all the /// Checks the crate for usage of weak lang items, returning a vector of all the
/// language items required by this crate, but not defined yet. /// lang items required by this crate, but not defined yet.
pub fn check_crate(tcx: TyCtxt<'_>, items: &mut lang_items::LanguageItems, krate: &ast::Crate) { pub fn check_crate(tcx: TyCtxt<'_>, items: &mut lang_items::LanguageItems, krate: &ast::Crate) {
// These are never called by user code, they're generated by the compiler. // These are never called by user code, they're generated by the compiler.
// They will never implicitly be added to the `missing` array unless we do // They will never implicitly be added to the `missing` array unless we do

View file

@ -1042,7 +1042,7 @@ pub struct Resolver<'a, 'tcx> {
block_map: NodeMap<Module<'a>>, block_map: NodeMap<Module<'a>>,
/// A fake module that contains no definition and no prelude. Used so that /// A fake module that contains no definition and no prelude. Used so that
/// some AST passes can generate identifiers that only resolve to local or /// some AST passes can generate identifiers that only resolve to local or
/// language items. /// lang items.
empty_module: Module<'a>, empty_module: Module<'a>,
module_map: FxHashMap<DefId, Module<'a>>, module_map: FxHashMap<DefId, Module<'a>>,
binding_parent_modules: FxHashMap<NameBinding<'a>, Module<'a>>, binding_parent_modules: FxHashMap<NameBinding<'a>, Module<'a>>,

View file

@ -1,26 +1,26 @@
error[E0522]: definition of an unknown language item: `dummy_lang_item_1` error[E0522]: definition of an unknown lang item: `dummy_lang_item_1`
--> $DIR/assoc-lang-items.rs:4:5 --> $DIR/assoc-lang-items.rs:4:5
| |
LL | #[lang = "dummy_lang_item_1"] LL | #[lang = "dummy_lang_item_1"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition of unknown language item `dummy_lang_item_1` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition of unknown lang item `dummy_lang_item_1`
error[E0522]: definition of an unknown language item: `dummy_lang_item_2` error[E0522]: definition of an unknown lang item: `dummy_lang_item_2`
--> $DIR/assoc-lang-items.rs:7:5 --> $DIR/assoc-lang-items.rs:7:5
| |
LL | #[lang = "dummy_lang_item_2"] LL | #[lang = "dummy_lang_item_2"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition of unknown language item `dummy_lang_item_2` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition of unknown lang item `dummy_lang_item_2`
error[E0522]: definition of an unknown language item: `dummy_lang_item_3` error[E0522]: definition of an unknown lang item: `dummy_lang_item_3`
--> $DIR/assoc-lang-items.rs:10:5 --> $DIR/assoc-lang-items.rs:10:5
| |
LL | #[lang = "dummy_lang_item_3"] LL | #[lang = "dummy_lang_item_3"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition of unknown language item `dummy_lang_item_3` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition of unknown lang item `dummy_lang_item_3`
error[E0522]: definition of an unknown language item: `dummy_lang_item_4` error[E0522]: definition of an unknown lang item: `dummy_lang_item_4`
--> $DIR/assoc-lang-items.rs:17:5 --> $DIR/assoc-lang-items.rs:17:5
| |
LL | #[lang = "dummy_lang_item_4"] LL | #[lang = "dummy_lang_item_4"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition of unknown language item `dummy_lang_item_4` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition of unknown lang item `dummy_lang_item_4`
error: aborting due to 4 previous errors error: aborting due to 4 previous errors

View file

@ -2,7 +2,7 @@
#[lang = "cookie"] #[lang = "cookie"]
fn cookie() -> ! { fn cookie() -> ! {
//~^^ ERROR definition of an unknown language item: `cookie` [E0522] //~^^ ERROR definition of an unknown lang item: `cookie` [E0522]
loop {} loop {}
} }

View file

@ -1,8 +1,8 @@
error[E0522]: definition of an unknown language item: `cookie` error[E0522]: definition of an unknown lang item: `cookie`
--> $DIR/E0522.rs:3:1 --> $DIR/E0522.rs:3:1
| |
LL | #[lang = "cookie"] LL | #[lang = "cookie"]
| ^^^^^^^^^^^^^^^^^^ definition of unknown language item `cookie` | ^^^^^^^^^^^^^^^^^^ definition of unknown lang item `cookie`
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -1,7 +1,7 @@
#![feature(lang_items)] #![feature(lang_items)]
// Box is expected to be a struct, so this will error. // Box is expected to be a struct, so this will error.
#[lang = "owned_box"] //~ ERROR language item must be applied to a struct #[lang = "owned_box"] //~ ERROR lang item must be applied to a struct
static X: u32 = 42; static X: u32 = 42;
fn main() {} fn main() {}

View file

@ -1,4 +1,4 @@
error[E0718]: `owned_box` language item must be applied to a struct error[E0718]: `owned_box` lang item must be applied to a struct
--> $DIR/E0718.rs:4:1 --> $DIR/E0718.rs:4:1
| |
LL | #[lang = "owned_box"] LL | #[lang = "owned_box"]

View file

@ -1,5 +1,5 @@
#[lang = "foo"] //~ ERROR language items are subject to change #[lang = "foo"] //~ ERROR lang items are subject to change
//~^ ERROR definition of an unknown language item: `foo` //~^ ERROR definition of an unknown lang item: `foo`
trait Foo {} trait Foo {}
fn main() {} fn main() {}

View file

@ -1,4 +1,4 @@
error[E0658]: language items are subject to change error[E0658]: lang items are subject to change
--> $DIR/feature-gate-lang-items.rs:1:1 --> $DIR/feature-gate-lang-items.rs:1:1
| |
LL | #[lang = "foo"] LL | #[lang = "foo"]
@ -7,11 +7,11 @@ LL | #[lang = "foo"]
= help: add `#![feature(lang_items)]` to the crate attributes to enable = help: add `#![feature(lang_items)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0522]: definition of an unknown language item: `foo` error[E0522]: definition of an unknown lang item: `foo`
--> $DIR/feature-gate-lang-items.rs:1:1 --> $DIR/feature-gate-lang-items.rs:1:1
| |
LL | #[lang = "foo"] LL | #[lang = "foo"]
| ^^^^^^^^^^^^^^^ definition of unknown language item `foo` | ^^^^^^^^^^^^^^^ definition of unknown lang item `foo`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -5,12 +5,12 @@
#![no_core] #![no_core]
#[lang = "sized"] #[lang = "sized"]
//~^ ERROR: language items are subject to change [E0658] //~^ ERROR: lang items are subject to change [E0658]
trait Sized {} trait Sized {}
#[lang = "fn"] #[lang = "fn"]
//~^ ERROR: language items are subject to change [E0658] //~^ ERROR: lang items are subject to change [E0658]
//~| ERROR: `fn` language item must be applied to a trait with 1 generic argument //~| ERROR: `fn` lang item must be applied to a trait with 1 generic argument
trait Fn { trait Fn {
fn call(export_name); fn call(export_name);
//~^ ERROR: expected type //~^ ERROR: expected type

View file

@ -4,7 +4,7 @@ error[E0573]: expected type, found built-in attribute `export_name`
LL | fn call(export_name); LL | fn call(export_name);
| ^^^^^^^^^^^ not a type | ^^^^^^^^^^^ not a type
error[E0658]: language items are subject to change error[E0658]: lang items are subject to change
--> $DIR/issue-83471.rs:7:1 --> $DIR/issue-83471.rs:7:1
| |
LL | #[lang = "sized"] LL | #[lang = "sized"]
@ -13,7 +13,7 @@ LL | #[lang = "sized"]
= help: add `#![feature(lang_items)]` to the crate attributes to enable = help: add `#![feature(lang_items)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: language items are subject to change error[E0658]: lang items are subject to change
--> $DIR/issue-83471.rs:11:1 --> $DIR/issue-83471.rs:11:1
| |
LL | #[lang = "fn"] LL | #[lang = "fn"]
@ -32,7 +32,7 @@ LL | fn call(export_name);
= note: for more information, see issue #41686 <https://github.com/rust-lang/rust/issues/41686> = note: for more information, see issue #41686 <https://github.com/rust-lang/rust/issues/41686>
= note: `#[warn(anonymous_parameters)]` on by default = note: `#[warn(anonymous_parameters)]` on by default
error[E0718]: `fn` language item must be applied to a trait with 1 generic argument error[E0718]: `fn` lang item must be applied to a trait with 1 generic argument
--> $DIR/issue-83471.rs:11:1 --> $DIR/issue-83471.rs:11:1
| |
LL | #[lang = "fn"] LL | #[lang = "fn"]

View file

@ -18,11 +18,11 @@ trait Sync {}
impl Sync for bool {} impl Sync for bool {}
#[lang = "drop_in_place"] #[lang = "drop_in_place"]
//~^ ERROR: `drop_in_place` language item must be applied to a function with at least 1 generic argument //~^ ERROR: `drop_in_place` lang item must be applied to a function with at least 1 generic argument
fn drop_fn() { fn drop_fn() {
while false {} while false {}
} }
#[lang = "start"] #[lang = "start"]
//~^ ERROR: `start` language item must be applied to a function with 1 generic argument //~^ ERROR: `start` lang item must be applied to a function with 1 generic argument
fn start(){} fn start(){}

View file

@ -1,4 +1,4 @@
error[E0718]: `drop_in_place` language item must be applied to a function with at least 1 generic argument error[E0718]: `drop_in_place` lang item must be applied to a function with at least 1 generic argument
--> $DIR/issue-87573.rs:20:1 --> $DIR/issue-87573.rs:20:1
| |
LL | #[lang = "drop_in_place"] LL | #[lang = "drop_in_place"]
@ -7,7 +7,7 @@ LL |
LL | fn drop_fn() { LL | fn drop_fn() {
| - this function has 0 generic arguments | - this function has 0 generic arguments
error[E0718]: `start` language item must be applied to a function with 1 generic argument error[E0718]: `start` lang item must be applied to a function with 1 generic argument
--> $DIR/issue-87573.rs:26:1 --> $DIR/issue-87573.rs:26:1
| |
LL | #[lang = "start"] LL | #[lang = "start"]

View file

@ -9,30 +9,30 @@ trait MySized {}
#[lang = "add"] #[lang = "add"]
trait MyAdd<'a, T> {} trait MyAdd<'a, T> {}
//~^^ ERROR: `add` language item must be applied to a trait with 1 generic argument [E0718] //~^^ ERROR: `add` lang item must be applied to a trait with 1 generic argument [E0718]
#[lang = "drop_in_place"] #[lang = "drop_in_place"]
//~^ ERROR `drop_in_place` language item must be applied to a function with at least 1 generic //~^ ERROR `drop_in_place` lang item must be applied to a function with at least 1 generic
fn my_ptr_drop() {} fn my_ptr_drop() {}
#[lang = "index"] #[lang = "index"]
trait MyIndex<'a, T> {} trait MyIndex<'a, T> {}
//~^^ ERROR: `index` language item must be applied to a trait with 1 generic argument [E0718] //~^^ ERROR: `index` lang item must be applied to a trait with 1 generic argument [E0718]
#[lang = "phantom_data"] #[lang = "phantom_data"]
//~^ ERROR `phantom_data` language item must be applied to a struct with 1 generic argument //~^ ERROR `phantom_data` lang item must be applied to a struct with 1 generic argument
struct MyPhantomData<T, U>; struct MyPhantomData<T, U>;
//~^ ERROR `T` is never used //~^ ERROR `T` is never used
//~| ERROR `U` is never used //~| ERROR `U` is never used
#[lang = "owned_box"] #[lang = "owned_box"]
//~^ ERROR `owned_box` language item must be applied to a struct with at least 1 generic argument //~^ ERROR `owned_box` lang item must be applied to a struct with at least 1 generic argument
struct Foo; struct Foo;
// When the `start` lang item is missing generics very odd things can happen, especially when // When the `start` lang item is missing generics very odd things can happen, especially when
// it comes to cross-crate monomorphization // it comes to cross-crate monomorphization
#[lang = "start"] #[lang = "start"]
//~^ ERROR `start` language item must be applied to a function with 1 generic argument [E0718] //~^ ERROR `start` lang item must be applied to a function with 1 generic argument [E0718]
fn start(_: *const u8, _: isize, _: *const *const u8) -> isize { fn start(_: *const u8, _: isize, _: *const *const u8) -> isize {
0 0
} }

View file

@ -1,4 +1,4 @@
error[E0718]: `add` language item must be applied to a trait with 1 generic argument error[E0718]: `add` lang item must be applied to a trait with 1 generic argument
--> $DIR/lang-item-generic-requirements.rs:10:1 --> $DIR/lang-item-generic-requirements.rs:10:1
| |
LL | #[lang = "add"] LL | #[lang = "add"]
@ -6,7 +6,7 @@ LL | #[lang = "add"]
LL | trait MyAdd<'a, T> {} LL | trait MyAdd<'a, T> {}
| ------- this trait has 2 generic arguments | ------- this trait has 2 generic arguments
error[E0718]: `drop_in_place` language item must be applied to a function with at least 1 generic argument error[E0718]: `drop_in_place` lang item must be applied to a function with at least 1 generic argument
--> $DIR/lang-item-generic-requirements.rs:14:1 --> $DIR/lang-item-generic-requirements.rs:14:1
| |
LL | #[lang = "drop_in_place"] LL | #[lang = "drop_in_place"]
@ -15,7 +15,7 @@ LL |
LL | fn my_ptr_drop() {} LL | fn my_ptr_drop() {}
| - this function has 0 generic arguments | - this function has 0 generic arguments
error[E0718]: `index` language item must be applied to a trait with 1 generic argument error[E0718]: `index` lang item must be applied to a trait with 1 generic argument
--> $DIR/lang-item-generic-requirements.rs:18:1 --> $DIR/lang-item-generic-requirements.rs:18:1
| |
LL | #[lang = "index"] LL | #[lang = "index"]
@ -23,7 +23,7 @@ LL | #[lang = "index"]
LL | trait MyIndex<'a, T> {} LL | trait MyIndex<'a, T> {}
| ------- this trait has 2 generic arguments | ------- this trait has 2 generic arguments
error[E0718]: `phantom_data` language item must be applied to a struct with 1 generic argument error[E0718]: `phantom_data` lang item must be applied to a struct with 1 generic argument
--> $DIR/lang-item-generic-requirements.rs:22:1 --> $DIR/lang-item-generic-requirements.rs:22:1
| |
LL | #[lang = "phantom_data"] LL | #[lang = "phantom_data"]
@ -32,7 +32,7 @@ LL |
LL | struct MyPhantomData<T, U>; LL | struct MyPhantomData<T, U>;
| ------ this struct has 2 generic arguments | ------ this struct has 2 generic arguments
error[E0718]: `owned_box` language item must be applied to a struct with at least 1 generic argument error[E0718]: `owned_box` lang item must be applied to a struct with at least 1 generic argument
--> $DIR/lang-item-generic-requirements.rs:28:1 --> $DIR/lang-item-generic-requirements.rs:28:1
| |
LL | #[lang = "owned_box"] LL | #[lang = "owned_box"]
@ -41,7 +41,7 @@ LL |
LL | struct Foo; LL | struct Foo;
| - this struct has 0 generic arguments | - this struct has 0 generic arguments
error[E0718]: `start` language item must be applied to a function with 1 generic argument error[E0718]: `start` lang item must be applied to a function with 1 generic argument
--> $DIR/lang-item-generic-requirements.rs:34:1 --> $DIR/lang-item-generic-requirements.rs:34:1
| |
LL | #[lang = "start"] LL | #[lang = "start"]

View file

@ -11,7 +11,7 @@ pub trait Sized {}
#[lang = "start"] #[lang = "start"]
#[target_feature(enable = "avx2")] #[target_feature(enable = "avx2")]
//~^ ERROR `start` language item function is not allowed to have `#[target_feature]` //~^ ERROR `start` lang item function is not allowed to have `#[target_feature]`
fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize { fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize {
0 0
} }

View file

@ -1,11 +1,11 @@
error: `start` language item function is not allowed to have `#[target_feature]` error: `start` lang item function is not allowed to have `#[target_feature]`
--> $DIR/start_lang_item_with_target_feature.rs:13:1 --> $DIR/start_lang_item_with_target_feature.rs:13:1
| |
LL | #[target_feature(enable = "avx2")] LL | #[target_feature(enable = "avx2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | LL |
LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize { LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize {
| ------------------------------------------------------------------------------------------- `start` language item function is not allowed to have `#[target_feature]` | ------------------------------------------------------------------------------------------- `start` lang item function is not allowed to have `#[target_feature]`
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -3,6 +3,6 @@
#![no_std] #![no_std]
#![no_main] #![no_main]
#[panic_handler] //~ ERROR `panic_impl` language item must be applied to a function #[panic_handler] //~ ERROR `panic_impl` lang item must be applied to a function
#[no_mangle] #[no_mangle]
static X: u32 = 42; static X: u32 = 42;

View file

@ -1,4 +1,4 @@
error[E0718]: `panic_impl` language item must be applied to a function error[E0718]: `panic_impl` lang item must be applied to a function
--> $DIR/panic-handler-wrong-location.rs:6:1 --> $DIR/panic-handler-wrong-location.rs:6:1
| |
LL | #[panic_handler] LL | #[panic_handler]

View file

@ -3,7 +3,7 @@
#[lang = "foo"] #[lang = "foo"]
fn bar() -> ! { fn bar() -> ! {
//~^^ ERROR definition of an unknown language item: `foo` //~^^ ERROR definition of an unknown lang item: `foo`
loop {} loop {}
} }

View file

@ -1,8 +1,8 @@
error[E0522]: definition of an unknown language item: `foo` error[E0522]: definition of an unknown lang item: `foo`
--> $DIR/unknown-language-item.rs:4:1 --> $DIR/unknown-language-item.rs:4:1
| |
LL | #[lang = "foo"] LL | #[lang = "foo"]
| ^^^^^^^^^^^^^^^ definition of unknown language item `foo` | ^^^^^^^^^^^^^^^ definition of unknown lang item `foo`
error: aborting due to 1 previous error error: aborting due to 1 previous error