Replace StrExt with inherent str methods in libcore

This commit is contained in:
Simon Sapin 2018-04-07 21:56:02 +02:00
parent 90f29fbdb1
commit f0705bf033
11 changed files with 1766 additions and 1741 deletions

View file

@ -91,6 +91,7 @@
#![feature(const_fn)]
#![feature(core_intrinsics)]
#![cfg_attr(stage0, feature(core_slice_ext))]
#![cfg_attr(stage0, feature(core_str_ext))]
#![feature(custom_attribute)]
#![feature(dropck_eyepatch)]
#![feature(exact_size_is_empty)]

File diff suppressed because it is too large Load diff

View file

@ -93,6 +93,7 @@
#![feature(rustc_const_unstable)]
#![feature(simd_ffi)]
#![feature(core_slice_ext)]
#![feature(core_str_ext)]
#![feature(specialization)]
#![feature(staged_api)]
#![feature(stmt_expr_attributes)]

View file

@ -62,4 +62,5 @@ pub use result::Result::{self, Ok, Err};
pub use slice::SliceExt;
#[stable(feature = "core_prelude", since = "1.4.0")]
#[doc(no_inline)]
#[cfg(stage0)]
pub use str::StrExt;

File diff suppressed because it is too large Load diff

View file

@ -214,6 +214,7 @@ language_item_table! {
StrImplItem, "str", str_impl;
SliceImplItem, "slice", slice_impl;
SliceU8ImplItem, "slice_u8", slice_u8_impl;
StrAllocImplItem, "str_alloc", str_alloc_impl;
SliceAllocImplItem, "slice_alloc", slice_alloc_impl;
SliceU8AllocImplItem, "slice_u8_alloc", slice_u8_alloc_impl;
ConstPtrImplItem, "const_ptr", const_ptr_impl;

View file

@ -471,6 +471,9 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
ty::TyStr => {
let lang_def_id = lang_items.str_impl();
self.assemble_inherent_impl_for_primitive(lang_def_id);
let lang_def_id = lang_items.str_alloc_impl();
self.assemble_inherent_impl_for_primitive(lang_def_id);
}
ty::TySlice(_) => {
let lang_def_id = lang_items.slice_impl();

View file

@ -122,7 +122,7 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for InherentCollect<'a, 'tcx> {
ty::TyStr => {
self.check_primitive_impl(def_id,
lang_items.str_impl(),
None,
lang_items.str_alloc_impl(),
"str",
"str",
item.span);

View file

@ -290,6 +290,7 @@ pub fn build_impls(cx: &DocContext, did: DefId, auto_traits: bool) -> Vec<clean:
lang_items.str_impl(),
lang_items.slice_impl(),
lang_items.slice_u8_impl(),
lang_items.str_alloc_impl(),
lang_items.slice_alloc_impl(),
lang_items.slice_u8_alloc_impl(),
lang_items.const_ptr_impl(),

View file

@ -15,7 +15,7 @@
#![no_std]
// OK
#[lang = "str"]
#[lang = "str_alloc"]
impl str {}
impl str {

View file

@ -14,7 +14,7 @@
pub mod str {
#![doc(primitive = "str")]
#[lang = "str"]
#[lang = "str_alloc"]
impl str {
// @has search-index.js foo
pub fn foo(&self) {}