Skip to content

Commit a35355c

Browse files
committed
Add newtype of [u8] as "str" lang item.
1 parent 3eb1d9d commit a35355c

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/libcore/str/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ pub mod pattern;
2626
#[allow(missing_docs)]
2727
pub mod lossy;
2828

29+
// HACK(eddyb) private and not named `str` to avoid changing name resolution.
30+
#[cfg(not(bootstrap))]
31+
#[lang = "str"]
32+
struct Str([u8]);
33+
2934
/// Parse a value from a string
3035
///
3136
/// `FromStr`'s [`from_str`] method is often used implicitly, through

src/librustc_hir/lang_items.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ language_item_table! {
127127
// Variant name, Name, Method name, Target;
128128
BoolImplItem, "bool", bool_impl, Target::Impl;
129129
CharImplItem, "char", char_impl, Target::Impl;
130+
StrItem, "str", str_type, Target::Struct;
130131
StrImplItem, "str_impl", str_impl, Target::Impl;
131132
SliceImplItem, "slice", slice_impl, Target::Impl;
132133
SliceU8ImplItem, "slice_u8", slice_u8_impl, Target::Impl;

0 commit comments

Comments
 (0)