Add a lang item to allow impl [u8] {…} in the standard library
This commit is contained in:
parent
8a4fa742a1
commit
9e441c76f7
3 changed files with 11 additions and 0 deletions
|
|
@ -211,6 +211,7 @@ language_item_table! {
|
|||
CharImplItem, "char", char_impl;
|
||||
StrImplItem, "str", str_impl;
|
||||
SliceImplItem, "slice", slice_impl;
|
||||
SliceU8ImplItem, "slice_u8", slice_u8_impl;
|
||||
ConstPtrImplItem, "const_ptr", const_ptr_impl;
|
||||
MutPtrImplItem, "mut_ptr", mut_ptr_impl;
|
||||
I8ImplItem, "i8", i8_impl;
|
||||
|
|
|
|||
|
|
@ -431,6 +431,9 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
|
|||
ty::TySlice(_) => {
|
||||
let lang_def_id = lang_items.slice_impl();
|
||||
self.assemble_inherent_impl_for_primitive(lang_def_id);
|
||||
|
||||
let lang_def_id = lang_items.slice_u8_impl();
|
||||
self.assemble_inherent_impl_for_primitive(lang_def_id);
|
||||
}
|
||||
ty::TyRawPtr(ty::TypeAndMut { ty: _, mutbl: hir::MutImmutable }) => {
|
||||
let lang_def_id = lang_items.const_ptr_impl();
|
||||
|
|
|
|||
|
|
@ -137,6 +137,13 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for InherentCollect<'a, 'tcx> {
|
|||
"str",
|
||||
item.span);
|
||||
}
|
||||
ty::TySlice(slice_item) if slice_item == self.tcx.types.u8 => {
|
||||
self.check_primitive_impl(def_id,
|
||||
lang_items.slice_u8_impl(),
|
||||
"slice_u8",
|
||||
"[u8]",
|
||||
item.span);
|
||||
}
|
||||
ty::TySlice(_) => {
|
||||
self.check_primitive_impl(def_id,
|
||||
lang_items.slice_impl(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue