Skip to content

Commit 8b35be7

Browse files
committed
consistency rename: language item -> lang item
1 parent d101971 commit 8b35be7

32 files changed

+72
-72
lines changed

compiler/rustc_error_codes/src/error_codes/E0522.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Erroneous code example:
66
#![feature(lang_items)]
77
88
#[lang = "cookie"]
9-
fn cookie() -> ! { // error: definition of an unknown language item: `cookie`
9+
fn cookie() -> ! { // error: definition of an unknown lang item: `cookie`
1010
loop {}
1111
}
1212
```

compiler/rustc_feature/src/builtin_attrs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
798798
// ==========================================================================
799799
gated!(
800800
lang, Normal, template!(NameValueStr: "name"), DuplicatesOk, EncodeCrossCrate::No, lang_items,
801-
"language items are subject to change",
801+
"lang items are subject to change",
802802
),
803803
rustc_attr!(
804804
rustc_pass_by_value, Normal, template!(Word), ErrorFollowing,

compiler/rustc_hir/src/lang_items.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Defines language items.
1+
//! Defines lang items.
22
//!
33
//! Language items are items that represent concepts intrinsic to the language
44
//! itself. Examples are:
@@ -16,7 +16,7 @@ use rustc_macros::HashStable_Generic;
1616
use rustc_span::symbol::{kw, sym, Symbol};
1717
use rustc_span::Span;
1818

19-
/// All of the language items, defined or not.
19+
/// All of the lang items, defined or not.
2020
/// Defined lang items can come from the current crate or its dependencies.
2121
#[derive(HashStable_Generic, Debug)]
2222
pub struct LanguageItems {
@@ -57,7 +57,7 @@ macro_rules! language_item_table {
5757
) => {
5858

5959
enum_from_u32! {
60-
/// A representation of all the valid language items in Rust.
60+
/// A representation of all the valid lang items in Rust.
6161
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Encodable, Decodable)]
6262
pub enum LangItem {
6363
$(
@@ -165,7 +165,7 @@ language_item_table! {
165165
CoerceUnsized, sym::coerce_unsized, coerce_unsized_trait, Target::Trait, GenericRequirement::Minimum(1);
166166
DispatchFromDyn, sym::dispatch_from_dyn, dispatch_from_dyn_trait, Target::Trait, GenericRequirement::Minimum(1);
167167

168-
// language items relating to transmutability
168+
// lang items relating to transmutability
169169
TransmuteOpts, sym::transmute_opts, transmute_opts, Target::Struct, GenericRequirement::Exact(0);
170170
TransmuteTrait, sym::transmute_trait, transmute_trait, Target::Trait, GenericRequirement::Exact(2);
171171

@@ -291,7 +291,7 @@ language_item_table! {
291291
OwnedBox, sym::owned_box, owned_box, Target::Struct, GenericRequirement::Minimum(1);
292292
GlobalAlloc, sym::global_alloc_ty, global_alloc_ty, Target::Struct, GenericRequirement::None;
293293

294-
// Experimental language item for Miri
294+
// Experimental lang item for Miri
295295
PtrUnique, sym::ptr_unique, ptr_unique, Target::Struct, GenericRequirement::Exact(1);
296296

297297
PhantomData, sym::phantom_data, phantom_data, Target::Struct, GenericRequirement::Exact(1);

compiler/rustc_hir_analysis/src/check/intrinsic.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -534,20 +534,20 @@ pub fn check_intrinsic_type(
534534

535535
sym::va_start | sym::va_end => match mk_va_list_ty(hir::Mutability::Mut) {
536536
Some((va_list_ref_ty, _)) => (0, 0, vec![va_list_ref_ty], Ty::new_unit(tcx)),
537-
None => bug!("`va_list` language item needed for C-variadic intrinsics"),
537+
None => bug!("`va_list` lang item needed for C-variadic intrinsics"),
538538
},
539539

540540
sym::va_copy => match mk_va_list_ty(hir::Mutability::Not) {
541541
Some((va_list_ref_ty, va_list_ty)) => {
542542
let va_list_ptr_ty = Ty::new_mut_ptr(tcx, va_list_ty);
543543
(0, 0, vec![va_list_ptr_ty, va_list_ref_ty], Ty::new_unit(tcx))
544544
}
545-
None => bug!("`va_list` language item needed for C-variadic intrinsics"),
545+
None => bug!("`va_list` lang item needed for C-variadic intrinsics"),
546546
},
547547

548548
sym::va_arg => match mk_va_list_ty(hir::Mutability::Mut) {
549549
Some((va_list_ref_ty, _)) => (1, 0, vec![va_list_ref_ty], param(0)),
550-
None => bug!("`va_list` language item needed for C-variadic intrinsics"),
550+
None => bug!("`va_list` lang item needed for C-variadic intrinsics"),
551551
},
552552

553553
sym::nontemporal_store => {

compiler/rustc_metadata/src/rmeta/decoder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1208,7 +1208,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
12081208
tcx.arena.alloc_from_iter(self.root.stability_implications.decode(self))
12091209
}
12101210

1211-
/// Iterates over the language items in the given crate.
1211+
/// Iterates over the lang items in the given crate.
12121212
fn get_lang_items(self, tcx: TyCtxt<'tcx>) -> &'tcx [(DefId, LangItem)] {
12131213
tcx.arena.alloc_from_iter(
12141214
self.root

compiler/rustc_middle/src/middle/lang_items.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Detecting language items.
1+
//! Detecting lang items.
22
//!
33
//! Language items are items that represent concepts intrinsic to the language
44
//! itself. Examples are:

compiler/rustc_mir_transform/src/deduce_param_attrs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ pub fn deduced_param_attrs<'tcx>(
160160
return &[];
161161
}
162162

163-
// If the Freeze language item isn't present, then don't bother.
163+
// If the Freeze lang item isn't present, then don't bother.
164164
if tcx.lang_items().freeze_trait().is_none() {
165165
return &[];
166166
}

compiler/rustc_mir_transform/src/lower_slice_len.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ impl<'tcx> MirPass<'tcx> for LowerSliceLenCalls {
2121
pub fn lower_slice_len_calls<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
2222
let language_items = tcx.lang_items();
2323
let Some(slice_len_fn_item_def_id) = language_items.slice_len_fn() else {
24-
// there is no language item to compare to :)
24+
// there is no lang item to compare to :)
2525
return;
2626
};
2727

compiler/rustc_passes/messages.ftl

+6-6
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ passes_incorrect_meta_item = expected a quoted string literal
353353
passes_incorrect_meta_item_suggestion = consider surrounding this with quotes
354354
355355
passes_incorrect_target =
356-
`{$name}` language item must be applied to a {$kind} with {$at_least ->
356+
`{$name}` lang item must be applied to a {$kind} with {$at_least ->
357357
[true] at least {$num}
358358
*[false] {$num}
359359
} generic {$num ->
@@ -396,7 +396,7 @@ passes_invalid_macro_export_arguments_too_many_items = `#[macro_export]` can onl
396396
397397
passes_lang_item_fn = {$name ->
398398
[panic_impl] `#[panic_handler]`
399-
*[other] `{$name}` language item
399+
*[other] `{$name}` lang item
400400
} function
401401
402402
passes_lang_item_fn_with_target_feature =
@@ -408,7 +408,7 @@ passes_lang_item_fn_with_track_caller =
408408
.label = {passes_lang_item_fn} is not allowed to have `#[target_feature]`
409409
410410
passes_lang_item_on_incorrect_target =
411-
`{$name}` language item must be applied to a {$expected_target}
411+
`{$name}` lang item must be applied to a {$expected_target}
412412
.label = attribute should be applied to a {$expected_target}, not a {$actual_target}
413413
414414
passes_layout_abi =
@@ -464,7 +464,7 @@ passes_missing_const_stab_attr =
464464
{$descr} has missing const stability attribute
465465
466466
passes_missing_lang_item =
467-
language item required, but not found: `{$name}`
467+
lang item required, but not found: `{$name}`
468468
.note = this can occur when a binary crate with `#![no_std]` is compiled for a target where `{$name}` is defined in the standard library
469469
.help = you may be able to compile for a target that doesn't need `{$name}`, specify a target with `--target` or in `.cargo/config`
470470
@@ -705,8 +705,8 @@ passes_unknown_feature =
705705
unknown feature `{$feature}`
706706
707707
passes_unknown_lang_item =
708-
definition of an unknown language item: `{$name}`
709-
.label = definition of unknown language item `{$name}`
708+
definition of an unknown lang item: `{$name}`
709+
.label = definition of unknown lang item `{$name}`
710710
711711
passes_unlabeled_cf_in_while_condition =
712712
`break` or `continue` with no label in the condition of a `while` loop

compiler/rustc_passes/src/check_attr.rs

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

compiler/rustc_passes/src/lang_items.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Detecting language items.
1+
//! Detecting lang items.
22
//!
33
//! Language items are items that represent concepts intrinsic to the language
44
//! itself. Examples are:

compiler/rustc_passes/src/weak_lang_items.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use crate::errors::{
1414
};
1515

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

compiler/rustc_resolve/src/lib.rs

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

tests/ui/assoc-lang-items.stderr

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
error[E0522]: definition of an unknown language item: `dummy_lang_item_1`
1+
error[E0522]: definition of an unknown lang item: `dummy_lang_item_1`
22
--> $DIR/assoc-lang-items.rs:4:5
33
|
44
LL | #[lang = "dummy_lang_item_1"]
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition of unknown language item `dummy_lang_item_1`
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition of unknown lang item `dummy_lang_item_1`
66

7-
error[E0522]: definition of an unknown language item: `dummy_lang_item_2`
7+
error[E0522]: definition of an unknown lang item: `dummy_lang_item_2`
88
--> $DIR/assoc-lang-items.rs:7:5
99
|
1010
LL | #[lang = "dummy_lang_item_2"]
11-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition of unknown language item `dummy_lang_item_2`
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition of unknown lang item `dummy_lang_item_2`
1212

13-
error[E0522]: definition of an unknown language item: `dummy_lang_item_3`
13+
error[E0522]: definition of an unknown lang item: `dummy_lang_item_3`
1414
--> $DIR/assoc-lang-items.rs:10:5
1515
|
1616
LL | #[lang = "dummy_lang_item_3"]
17-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition of unknown language item `dummy_lang_item_3`
17+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition of unknown lang item `dummy_lang_item_3`
1818

19-
error[E0522]: definition of an unknown language item: `dummy_lang_item_4`
19+
error[E0522]: definition of an unknown lang item: `dummy_lang_item_4`
2020
--> $DIR/assoc-lang-items.rs:17:5
2121
|
2222
LL | #[lang = "dummy_lang_item_4"]
23-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition of unknown language item `dummy_lang_item_4`
23+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition of unknown lang item `dummy_lang_item_4`
2424

2525
error: aborting due to 4 previous errors
2626

tests/ui/error-codes/E0522.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#[lang = "cookie"]
44
fn cookie() -> ! {
5-
//~^^ ERROR definition of an unknown language item: `cookie` [E0522]
5+
//~^^ ERROR definition of an unknown lang item: `cookie` [E0522]
66
loop {}
77
}
88

tests/ui/error-codes/E0522.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error[E0522]: definition of an unknown language item: `cookie`
1+
error[E0522]: definition of an unknown lang item: `cookie`
22
--> $DIR/E0522.rs:3:1
33
|
44
LL | #[lang = "cookie"]
5-
| ^^^^^^^^^^^^^^^^^^ definition of unknown language item `cookie`
5+
| ^^^^^^^^^^^^^^^^^^ definition of unknown lang item `cookie`
66

77
error: aborting due to 1 previous error
88

tests/ui/error-codes/E0718.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![feature(lang_items)]
22

33
// Box is expected to be a struct, so this will error.
4-
#[lang = "owned_box"] //~ ERROR language item must be applied to a struct
4+
#[lang = "owned_box"] //~ ERROR lang item must be applied to a struct
55
static X: u32 = 42;
66

77
fn main() {}

tests/ui/error-codes/E0718.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0718]: `owned_box` language item must be applied to a struct
1+
error[E0718]: `owned_box` lang item must be applied to a struct
22
--> $DIR/E0718.rs:4:1
33
|
44
LL | #[lang = "owned_box"]
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#[lang = "foo"] //~ ERROR language items are subject to change
2-
//~^ ERROR definition of an unknown language item: `foo`
1+
#[lang = "foo"] //~ ERROR lang items are subject to change
2+
//~^ ERROR definition of an unknown lang item: `foo`
33
trait Foo {}
44

55
fn main() {}

tests/ui/feature-gates/feature-gate-lang-items.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0658]: language items are subject to change
1+
error[E0658]: lang items are subject to change
22
--> $DIR/feature-gate-lang-items.rs:1:1
33
|
44
LL | #[lang = "foo"]
@@ -7,11 +7,11 @@ LL | #[lang = "foo"]
77
= help: add `#![feature(lang_items)]` to the crate attributes to enable
88
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
99

10-
error[E0522]: definition of an unknown language item: `foo`
10+
error[E0522]: definition of an unknown lang item: `foo`
1111
--> $DIR/feature-gate-lang-items.rs:1:1
1212
|
1313
LL | #[lang = "foo"]
14-
| ^^^^^^^^^^^^^^^ definition of unknown language item `foo`
14+
| ^^^^^^^^^^^^^^^ definition of unknown lang item `foo`
1515

1616
error: aborting due to 2 previous errors
1717

tests/ui/lang-items/issue-83471.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
#![no_core]
66

77
#[lang = "sized"]
8-
//~^ ERROR: language items are subject to change [E0658]
8+
//~^ ERROR: lang items are subject to change [E0658]
99
trait Sized {}
1010

1111
#[lang = "fn"]
12-
//~^ ERROR: language items are subject to change [E0658]
13-
//~| ERROR: `fn` language item must be applied to a trait with 1 generic argument
12+
//~^ ERROR: lang items are subject to change [E0658]
13+
//~| ERROR: `fn` lang item must be applied to a trait with 1 generic argument
1414
trait Fn {
1515
fn call(export_name);
1616
//~^ ERROR: expected type

tests/ui/lang-items/issue-83471.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0573]: expected type, found built-in attribute `export_name`
44
LL | fn call(export_name);
55
| ^^^^^^^^^^^ not a type
66

7-
error[E0658]: language items are subject to change
7+
error[E0658]: lang items are subject to change
88
--> $DIR/issue-83471.rs:7:1
99
|
1010
LL | #[lang = "sized"]
@@ -13,7 +13,7 @@ LL | #[lang = "sized"]
1313
= help: add `#![feature(lang_items)]` to the crate attributes to enable
1414
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
1515

16-
error[E0658]: language items are subject to change
16+
error[E0658]: lang items are subject to change
1717
--> $DIR/issue-83471.rs:11:1
1818
|
1919
LL | #[lang = "fn"]
@@ -32,7 +32,7 @@ LL | fn call(export_name);
3232
= note: for more information, see issue #41686 <https://github.com/rust-lang/rust/issues/41686>
3333
= note: `#[warn(anonymous_parameters)]` on by default
3434

35-
error[E0718]: `fn` language item must be applied to a trait with 1 generic argument
35+
error[E0718]: `fn` lang item must be applied to a trait with 1 generic argument
3636
--> $DIR/issue-83471.rs:11:1
3737
|
3838
LL | #[lang = "fn"]

tests/ui/lang-items/issue-87573.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ trait Sync {}
1818
impl Sync for bool {}
1919

2020
#[lang = "drop_in_place"]
21-
//~^ ERROR: `drop_in_place` language item must be applied to a function with at least 1 generic argument
21+
//~^ ERROR: `drop_in_place` lang item must be applied to a function with at least 1 generic argument
2222
fn drop_fn() {
2323
while false {}
2424
}
2525

2626
#[lang = "start"]
27-
//~^ ERROR: `start` language item must be applied to a function with 1 generic argument
27+
//~^ ERROR: `start` lang item must be applied to a function with 1 generic argument
2828
fn start(){}

tests/ui/lang-items/issue-87573.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0718]: `drop_in_place` language item must be applied to a function with at least 1 generic argument
1+
error[E0718]: `drop_in_place` lang item must be applied to a function with at least 1 generic argument
22
--> $DIR/issue-87573.rs:20:1
33
|
44
LL | #[lang = "drop_in_place"]
@@ -7,7 +7,7 @@ LL |
77
LL | fn drop_fn() {
88
| - this function has 0 generic arguments
99

10-
error[E0718]: `start` language item must be applied to a function with 1 generic argument
10+
error[E0718]: `start` lang item must be applied to a function with 1 generic argument
1111
--> $DIR/issue-87573.rs:26:1
1212
|
1313
LL | #[lang = "start"]

0 commit comments

Comments
 (0)