mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
remove now unnecessary lang items
This commit is contained in:
parent
983c12f7f6
commit
afbecc0f68
@ -166,36 +166,6 @@ pub fn extract(attrs: &[ast::Attribute]) -> Option<(Symbol, Span)> {
|
||||
|
||||
language_item_table! {
|
||||
// Variant name, Name, Method name, Target Generic requirements;
|
||||
Bool, sym::bool, bool_impl, Target::Impl, GenericRequirement::None;
|
||||
Char, sym::char, char_impl, Target::Impl, GenericRequirement::None;
|
||||
Str, sym::str, str_impl, Target::Impl, GenericRequirement::None;
|
||||
Array, sym::array, array_impl, Target::Impl, GenericRequirement::None;
|
||||
Slice, sym::slice, slice_impl, Target::Impl, GenericRequirement::None;
|
||||
SliceU8, sym::slice_u8, slice_u8_impl, Target::Impl, GenericRequirement::None;
|
||||
StrAlloc, sym::str_alloc, str_alloc_impl, Target::Impl, GenericRequirement::None;
|
||||
SliceAlloc, sym::slice_alloc, slice_alloc_impl, Target::Impl, GenericRequirement::None;
|
||||
SliceU8Alloc, sym::slice_u8_alloc, slice_u8_alloc_impl, Target::Impl, GenericRequirement::None;
|
||||
ConstPtr, sym::const_ptr, const_ptr_impl, Target::Impl, GenericRequirement::None;
|
||||
MutPtr, sym::mut_ptr, mut_ptr_impl, Target::Impl, GenericRequirement::None;
|
||||
ConstSlicePtr, sym::const_slice_ptr, const_slice_ptr_impl, Target::Impl, GenericRequirement::None;
|
||||
MutSlicePtr, sym::mut_slice_ptr, mut_slice_ptr_impl, Target::Impl, GenericRequirement::None;
|
||||
I8, sym::i8, i8_impl, Target::Impl, GenericRequirement::None;
|
||||
I16, sym::i16, i16_impl, Target::Impl, GenericRequirement::None;
|
||||
I32, sym::i32, i32_impl, Target::Impl, GenericRequirement::None;
|
||||
I64, sym::i64, i64_impl, Target::Impl, GenericRequirement::None;
|
||||
I128, sym::i128, i128_impl, Target::Impl, GenericRequirement::None;
|
||||
Isize, sym::isize, isize_impl, Target::Impl, GenericRequirement::None;
|
||||
U8, sym::u8, u8_impl, Target::Impl, GenericRequirement::None;
|
||||
U16, sym::u16, u16_impl, Target::Impl, GenericRequirement::None;
|
||||
U32, sym::u32, u32_impl, Target::Impl, GenericRequirement::None;
|
||||
U64, sym::u64, u64_impl, Target::Impl, GenericRequirement::None;
|
||||
U128, sym::u128, u128_impl, Target::Impl, GenericRequirement::None;
|
||||
Usize, sym::usize, usize_impl, Target::Impl, GenericRequirement::None;
|
||||
F32, sym::f32, f32_impl, Target::Impl, GenericRequirement::None;
|
||||
F64, sym::f64, f64_impl, Target::Impl, GenericRequirement::None;
|
||||
F32Runtime, sym::f32_runtime, f32_runtime_impl, Target::Impl, GenericRequirement::None;
|
||||
F64Runtime, sym::f64_runtime, f64_runtime_impl, Target::Impl, GenericRequirement::None;
|
||||
|
||||
Sized, sym::sized, sized_trait, Target::Trait, GenericRequirement::Exact(0);
|
||||
Unsize, sym::unsize, unsize_trait, Target::Trait, GenericRequirement::Minimum(1);
|
||||
/// Trait injected by `#[derive(PartialEq)]`, (i.e. "Partial EQ").
|
||||
|
@ -494,11 +494,9 @@ symbols! {
|
||||
const_panic,
|
||||
const_panic_fmt,
|
||||
const_precise_live_drops,
|
||||
const_ptr,
|
||||
const_raw_ptr_deref,
|
||||
const_raw_ptr_to_usize_cast,
|
||||
const_refs_to_cell,
|
||||
const_slice_ptr,
|
||||
const_trait_bound_opt_out,
|
||||
const_trait_impl,
|
||||
const_transmute,
|
||||
@ -655,9 +653,7 @@ symbols! {
|
||||
f,
|
||||
f16c_target_feature,
|
||||
f32,
|
||||
f32_runtime,
|
||||
f64,
|
||||
f64_runtime,
|
||||
fabsf32,
|
||||
fabsf64,
|
||||
fadd_fast,
|
||||
@ -913,8 +909,6 @@ symbols! {
|
||||
mul_with_overflow,
|
||||
must_not_suspend,
|
||||
must_use,
|
||||
mut_ptr,
|
||||
mut_slice_ptr,
|
||||
naked,
|
||||
naked_functions,
|
||||
name,
|
||||
@ -1314,11 +1308,8 @@ symbols! {
|
||||
sized,
|
||||
skip,
|
||||
slice,
|
||||
slice_alloc,
|
||||
slice_len_fn,
|
||||
slice_patterns,
|
||||
slice_u8,
|
||||
slice_u8_alloc,
|
||||
slicing_syntax,
|
||||
soft,
|
||||
specialization,
|
||||
@ -1348,7 +1339,6 @@ symbols! {
|
||||
stop_after_dataflow,
|
||||
store,
|
||||
str,
|
||||
str_alloc,
|
||||
str_split_whitespace,
|
||||
str_trim,
|
||||
str_trim_end,
|
||||
|
@ -281,25 +281,26 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
// There are methods that are defined on the primitive types and won't be
|
||||
// found when exploring `all_traits`, but we also need them to be acurate on
|
||||
// our suggestions (#47759).
|
||||
let fund_assoc = |opt_def_id: Option<DefId>| {
|
||||
opt_def_id.and_then(|id| self.associated_value(id, item_name)).is_some()
|
||||
let found_assoc = |ty: Ty<'tcx>| {
|
||||
simplify_type(tcx, ty, TreatParams::AsPlaceholders).and_then(|simp| {
|
||||
tcx.incoherent_impls(simp)
|
||||
.iter()
|
||||
.find_map(|&id| self.associated_value(id, item_name))
|
||||
}).is_some()
|
||||
};
|
||||
let lang_items = tcx.lang_items();
|
||||
let found_candidate = candidates.next().is_some()
|
||||
|| fund_assoc(lang_items.i8_impl())
|
||||
|| fund_assoc(lang_items.i16_impl())
|
||||
|| fund_assoc(lang_items.i32_impl())
|
||||
|| fund_assoc(lang_items.i64_impl())
|
||||
|| fund_assoc(lang_items.i128_impl())
|
||||
|| fund_assoc(lang_items.u8_impl())
|
||||
|| fund_assoc(lang_items.u16_impl())
|
||||
|| fund_assoc(lang_items.u32_impl())
|
||||
|| fund_assoc(lang_items.u64_impl())
|
||||
|| fund_assoc(lang_items.u128_impl())
|
||||
|| fund_assoc(lang_items.f32_impl())
|
||||
|| fund_assoc(lang_items.f32_runtime_impl())
|
||||
|| fund_assoc(lang_items.f64_impl())
|
||||
|| fund_assoc(lang_items.f64_runtime_impl());
|
||||
|| found_assoc(tcx.types.i8)
|
||||
|| found_assoc(tcx.types.i16)
|
||||
|| found_assoc(tcx.types.i32)
|
||||
|| found_assoc(tcx.types.i64)
|
||||
|| found_assoc(tcx.types.i128)
|
||||
|| found_assoc(tcx.types.u8)
|
||||
|| found_assoc(tcx.types.u16)
|
||||
|| found_assoc(tcx.types.u32)
|
||||
|| found_assoc(tcx.types.u64)
|
||||
|| found_assoc(tcx.types.u128)
|
||||
|| found_assoc(tcx.types.f32)
|
||||
|| found_assoc(tcx.types.f32);
|
||||
if let (true, false, SelfSource::MethodCall(expr), true) = (
|
||||
actual.is_numeric(),
|
||||
actual.has_concrete_skeleton(),
|
||||
|
@ -237,7 +237,7 @@ mod hack {
|
||||
}
|
||||
}
|
||||
|
||||
#[lang = "slice_alloc"]
|
||||
#[cfg_attr(bootstrap, lang = "slice_alloc")]
|
||||
#[cfg(not(test))]
|
||||
impl<T> [T] {
|
||||
/// Sorts the slice.
|
||||
@ -667,7 +667,7 @@ impl<T> [T] {
|
||||
}
|
||||
}
|
||||
|
||||
#[lang = "slice_u8_alloc"]
|
||||
#[cfg_attr(bootstrap, lang = "slice_u8_alloc")]
|
||||
#[cfg(not(test))]
|
||||
impl [u8] {
|
||||
/// Returns a vector containing a copy of this slice where each byte
|
||||
|
@ -235,7 +235,7 @@ impl ToOwned for str {
|
||||
}
|
||||
|
||||
/// Methods for string slices.
|
||||
#[lang = "str_alloc"]
|
||||
#[cfg_attr(bootstrap, lang = "str_alloc")]
|
||||
#[cfg(not(test))]
|
||||
impl str {
|
||||
/// Converts a `Box<str>` into a `Box<[u8]>` without copying or allocating.
|
||||
|
@ -395,7 +395,7 @@ macro_rules! array_impl_default {
|
||||
|
||||
array_impl_default! {32, T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T}
|
||||
|
||||
#[lang = "array"]
|
||||
#[cfg_attr(bootstrap, lang = "array")]
|
||||
impl<T, const N: usize> [T; N] {
|
||||
/// Returns an array of the same size as `self`, with function `f` applied to each element
|
||||
/// in order.
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
use crate::marker::Destruct;
|
||||
|
||||
#[lang = "bool"]
|
||||
#[cfg_attr(bootstrap, lang = "bool")]
|
||||
impl bool {
|
||||
/// Returns `Some(t)` if the `bool` is [`true`](../std/keyword.true.html),
|
||||
/// or `None` otherwise.
|
||||
|
@ -7,7 +7,7 @@ use crate::unicode::{self, conversions};
|
||||
|
||||
use super::*;
|
||||
|
||||
#[lang = "char"]
|
||||
#[cfg_attr(bootstrap, lang = "char")]
|
||||
impl char {
|
||||
/// The highest valid code point a `char` can have, `'\u{10FFFF}'`.
|
||||
///
|
||||
|
@ -370,7 +370,7 @@ pub mod consts {
|
||||
pub const LN_10: f32 = 2.30258509299404568401799145468436421_f32;
|
||||
}
|
||||
|
||||
#[lang = "f32"]
|
||||
#[cfg_attr(bootstrap, lang = "f32")]
|
||||
#[cfg(not(test))]
|
||||
impl f32 {
|
||||
/// The radix or base of the internal representation of `f32`.
|
||||
|
@ -370,7 +370,7 @@ pub mod consts {
|
||||
pub const LN_10: f64 = 2.30258509299404568401799145468436421_f64;
|
||||
}
|
||||
|
||||
#[lang = "f64"]
|
||||
#[cfg_attr(bootstrap, lang = "f64")]
|
||||
#[cfg(not(test))]
|
||||
impl f64 {
|
||||
/// The radix or base of the internal representation of `f64`.
|
||||
|
@ -193,26 +193,26 @@ macro_rules! widening_impl {
|
||||
};
|
||||
}
|
||||
|
||||
#[lang = "i8"]
|
||||
#[cfg_attr(bootstrap, lang = "i8")]
|
||||
impl i8 {
|
||||
int_impl! { i8, i8, u8, 8, 7, -128, 127, 2, "-0x7e", "0xa", "0x12", "0x12", "0x48",
|
||||
"[0x12]", "[0x12]", "", "" }
|
||||
}
|
||||
|
||||
#[lang = "i16"]
|
||||
#[cfg_attr(bootstrap, lang = "i16")]
|
||||
impl i16 {
|
||||
int_impl! { i16, i16, u16, 16, 15, -32768, 32767, 4, "-0x5ffd", "0x3a", "0x1234", "0x3412",
|
||||
"0x2c48", "[0x34, 0x12]", "[0x12, 0x34]", "", "" }
|
||||
}
|
||||
|
||||
#[lang = "i32"]
|
||||
#[cfg_attr(bootstrap, lang = "i32")]
|
||||
impl i32 {
|
||||
int_impl! { i32, i32, u32, 32, 31, -2147483648, 2147483647, 8, "0x10000b3", "0xb301",
|
||||
"0x12345678", "0x78563412", "0x1e6a2c48", "[0x78, 0x56, 0x34, 0x12]",
|
||||
"[0x12, 0x34, 0x56, 0x78]", "", "" }
|
||||
}
|
||||
|
||||
#[lang = "i64"]
|
||||
#[cfg_attr(bootstrap, lang = "i64")]
|
||||
impl i64 {
|
||||
int_impl! { i64, i64, u64, 64, 63, -9223372036854775808, 9223372036854775807, 12,
|
||||
"0xaa00000000006e1", "0x6e10aa", "0x1234567890123456", "0x5634129078563412",
|
||||
@ -220,7 +220,7 @@ impl i64 {
|
||||
"[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]", "", "" }
|
||||
}
|
||||
|
||||
#[lang = "i128"]
|
||||
#[cfg_attr(bootstrap, lang = "i128")]
|
||||
impl i128 {
|
||||
int_impl! { i128, i128, u128, 128, 127, -170141183460469231731687303715884105728,
|
||||
170141183460469231731687303715884105727, 16,
|
||||
@ -233,7 +233,7 @@ impl i128 {
|
||||
}
|
||||
|
||||
#[cfg(target_pointer_width = "16")]
|
||||
#[lang = "isize"]
|
||||
#[cfg_attr(bootstrap, lang = "isize")]
|
||||
impl isize {
|
||||
int_impl! { isize, i16, usize, 16, 15, -32768, 32767, 4, "-0x5ffd", "0x3a", "0x1234",
|
||||
"0x3412", "0x2c48", "[0x34, 0x12]", "[0x12, 0x34]",
|
||||
@ -241,7 +241,7 @@ impl isize {
|
||||
}
|
||||
|
||||
#[cfg(target_pointer_width = "32")]
|
||||
#[lang = "isize"]
|
||||
#[cfg_attr(bootstrap, lang = "isize")]
|
||||
impl isize {
|
||||
int_impl! { isize, i32, usize, 32, 31, -2147483648, 2147483647, 8, "0x10000b3", "0xb301",
|
||||
"0x12345678", "0x78563412", "0x1e6a2c48", "[0x78, 0x56, 0x34, 0x12]",
|
||||
@ -250,7 +250,7 @@ impl isize {
|
||||
}
|
||||
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
#[lang = "isize"]
|
||||
#[cfg_attr(bootstrap, lang = "isize")]
|
||||
impl isize {
|
||||
int_impl! { isize, i64, usize, 64, 63, -9223372036854775808, 9223372036854775807,
|
||||
12, "0xaa00000000006e1", "0x6e10aa", "0x1234567890123456", "0x5634129078563412",
|
||||
@ -262,7 +262,7 @@ impl isize {
|
||||
/// If 6th bit set ascii is upper case.
|
||||
const ASCII_CASE_MASK: u8 = 0b0010_0000;
|
||||
|
||||
#[lang = "u8"]
|
||||
#[cfg_attr(bootstrap, lang = "u8")]
|
||||
impl u8 {
|
||||
uint_impl! { u8, u8, i8, NonZeroU8, 8, 255, 2, "0x82", "0xa", "0x12", "0x12", "0x48", "[0x12]",
|
||||
"[0x12]", "", "" }
|
||||
@ -816,7 +816,7 @@ impl u8 {
|
||||
}
|
||||
}
|
||||
|
||||
#[lang = "u16"]
|
||||
#[cfg_attr(bootstrap, lang = "u16")]
|
||||
impl u16 {
|
||||
uint_impl! { u16, u16, i16, NonZeroU16, 16, 65535, 4, "0xa003", "0x3a", "0x1234", "0x3412", "0x2c48",
|
||||
"[0x34, 0x12]", "[0x12, 0x34]", "", "" }
|
||||
@ -848,14 +848,14 @@ impl u16 {
|
||||
}
|
||||
}
|
||||
|
||||
#[lang = "u32"]
|
||||
#[cfg_attr(bootstrap, lang = "u32")]
|
||||
impl u32 {
|
||||
uint_impl! { u32, u32, i32, NonZeroU32, 32, 4294967295, 8, "0x10000b3", "0xb301", "0x12345678",
|
||||
"0x78563412", "0x1e6a2c48", "[0x78, 0x56, 0x34, 0x12]", "[0x12, 0x34, 0x56, 0x78]", "", "" }
|
||||
widening_impl! { u32, u64, 32, unsigned }
|
||||
}
|
||||
|
||||
#[lang = "u64"]
|
||||
#[cfg_attr(bootstrap, lang = "u64")]
|
||||
impl u64 {
|
||||
uint_impl! { u64, u64, i64, NonZeroU64, 64, 18446744073709551615, 12, "0xaa00000000006e1", "0x6e10aa",
|
||||
"0x1234567890123456", "0x5634129078563412", "0x6a2c48091e6a2c48",
|
||||
@ -865,7 +865,7 @@ impl u64 {
|
||||
widening_impl! { u64, u128, 64, unsigned }
|
||||
}
|
||||
|
||||
#[lang = "u128"]
|
||||
#[cfg_attr(bootstrap, lang = "u128")]
|
||||
impl u128 {
|
||||
uint_impl! { u128, u128, i128, NonZeroU128, 128, 340282366920938463463374607431768211455, 16,
|
||||
"0x13f40000000000000000000000004f76", "0x4f7613f4", "0x12345678901234567890123456789012",
|
||||
@ -878,7 +878,7 @@ impl u128 {
|
||||
}
|
||||
|
||||
#[cfg(target_pointer_width = "16")]
|
||||
#[lang = "usize"]
|
||||
#[cfg_attr(bootstrap, lang = "usize")]
|
||||
impl usize {
|
||||
uint_impl! { usize, u16, isize, NonZeroUsize, 16, 65535, 4, "0xa003", "0x3a", "0x1234", "0x3412", "0x2c48",
|
||||
"[0x34, 0x12]", "[0x12, 0x34]",
|
||||
@ -886,7 +886,7 @@ impl usize {
|
||||
widening_impl! { usize, u32, 16, unsigned }
|
||||
}
|
||||
#[cfg(target_pointer_width = "32")]
|
||||
#[lang = "usize"]
|
||||
#[cfg_attr(bootstrap, lang = "usize")]
|
||||
impl usize {
|
||||
uint_impl! { usize, u32, isize, NonZeroUsize, 32, 4294967295, 8, "0x10000b3", "0xb301", "0x12345678",
|
||||
"0x78563412", "0x1e6a2c48", "[0x78, 0x56, 0x34, 0x12]", "[0x12, 0x34, 0x56, 0x78]",
|
||||
@ -895,7 +895,7 @@ impl usize {
|
||||
}
|
||||
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
#[lang = "usize"]
|
||||
#[cfg_attr(bootstrap, lang = "usize")]
|
||||
impl usize {
|
||||
uint_impl! { usize, u64, isize, NonZeroUsize, 64, 18446744073709551615, 12, "0xaa00000000006e1", "0x6e10aa",
|
||||
"0x1234567890123456", "0x5634129078563412", "0x6a2c48091e6a2c48",
|
||||
|
@ -4,7 +4,7 @@ use crate::intrinsics;
|
||||
use crate::mem;
|
||||
use crate::slice::{self, SliceIndex};
|
||||
|
||||
#[lang = "const_ptr"]
|
||||
#[cfg_attr(bootstrap, lang = "const_ptr")]
|
||||
impl<T: ?Sized> *const T {
|
||||
/// Returns `true` if the pointer is null.
|
||||
///
|
||||
@ -969,7 +969,7 @@ impl<T: ?Sized> *const T {
|
||||
}
|
||||
}
|
||||
|
||||
#[lang = "const_slice_ptr"]
|
||||
#[cfg_attr(bootstrap, lang = "const_slice_ptr")]
|
||||
impl<T> *const [T] {
|
||||
/// Returns the length of a raw slice.
|
||||
///
|
||||
|
@ -3,7 +3,7 @@ use crate::cmp::Ordering::{self, Equal, Greater, Less};
|
||||
use crate::intrinsics;
|
||||
use crate::slice::{self, SliceIndex};
|
||||
|
||||
#[lang = "mut_ptr"]
|
||||
#[cfg_attr(bootstrap, lang = "mut_ptr")]
|
||||
impl<T: ?Sized> *mut T {
|
||||
/// Returns `true` if the pointer is null.
|
||||
///
|
||||
@ -1240,7 +1240,7 @@ impl<T: ?Sized> *mut T {
|
||||
}
|
||||
}
|
||||
|
||||
#[lang = "mut_slice_ptr"]
|
||||
#[cfg_attr(bootstrap, lang = "mut_slice_ptr")]
|
||||
impl<T> *mut [T] {
|
||||
/// Returns the length of a raw slice.
|
||||
///
|
||||
|
@ -6,7 +6,7 @@ use crate::iter;
|
||||
use crate::mem;
|
||||
use crate::ops;
|
||||
|
||||
#[lang = "slice_u8"]
|
||||
#[cfg_attr(bootstrap, lang = "slice_u8")]
|
||||
#[cfg(not(test))]
|
||||
impl [u8] {
|
||||
/// Checks if all bytes in this slice are within the ASCII range.
|
||||
|
@ -109,7 +109,7 @@ enum Direction {
|
||||
Back,
|
||||
}
|
||||
|
||||
#[lang = "slice"]
|
||||
#[cfg_attr(bootstrap, lang = "slice")]
|
||||
#[cfg(not(test))]
|
||||
impl<T> [T] {
|
||||
/// Returns the number of elements in the slice.
|
||||
|
@ -130,7 +130,7 @@ fn slice_error_fail_rt(s: &str, begin: usize, end: usize) -> ! {
|
||||
);
|
||||
}
|
||||
|
||||
#[lang = "str"]
|
||||
#[cfg_attr(bootstrap, lang = "str")]
|
||||
#[cfg(not(test))]
|
||||
impl str {
|
||||
/// Returns the length of `self`.
|
||||
|
@ -28,7 +28,7 @@ pub use core::f32::{
|
||||
};
|
||||
|
||||
#[cfg(not(test))]
|
||||
#[lang = "f32_runtime"]
|
||||
#[cfg_attr(bootstrap, lang = "f32_runtime")]
|
||||
impl f32 {
|
||||
/// Returns the largest integer less than or equal to a number.
|
||||
///
|
||||
|
@ -28,7 +28,7 @@ pub use core::f64::{
|
||||
};
|
||||
|
||||
#[cfg(not(test))]
|
||||
#[lang = "f64_runtime"]
|
||||
#[cfg_attr(bootstrap, lang = "f64_runtime")]
|
||||
impl f64 {
|
||||
/// Returns the largest integer less than or equal to a number.
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user