Add "bool" lang item
This commit is contained in:
parent
4894123d21
commit
f0386a10e0
8 changed files with 24 additions and 1 deletions
7
src/libcore/bool/mod.rs
Normal file
7
src/libcore/bool/mod.rs
Normal file
|
@ -0,0 +1,7 @@
|
|||
//! impl bool {}
|
||||
|
||||
#![stable(feature = "core_bool", since = "1.39.0")]
|
||||
|
||||
#[cfg(not(boostrap_stdarch_ignore_this))]
|
||||
#[lang = "bool"]
|
||||
impl bool {}
|
|
@ -198,6 +198,7 @@ pub mod borrow;
|
|||
pub mod any;
|
||||
pub mod array;
|
||||
pub mod ascii;
|
||||
pub mod bool;
|
||||
pub mod sync;
|
||||
pub mod cell;
|
||||
pub mod char;
|
||||
|
|
|
@ -246,6 +246,7 @@ pub fn collect<'tcx>(tcx: TyCtxt<'tcx>) -> LanguageItems {
|
|||
|
||||
language_item_table! {
|
||||
// Variant name, Name, Method name, Target;
|
||||
BoolImplItem, "bool", bool_impl, Target::Impl;
|
||||
CharImplItem, "char", char_impl, Target::Impl;
|
||||
StrImplItem, "str", str_impl, Target::Impl;
|
||||
SliceImplItem, "slice", slice_impl, Target::Impl;
|
||||
|
|
|
@ -578,6 +578,10 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
|
|||
ty::Param(p) => {
|
||||
self.assemble_inherent_candidates_from_param(p);
|
||||
}
|
||||
ty::Bool => {
|
||||
let lang_def_id = lang_items.bool_impl();
|
||||
self.assemble_inherent_impl_for_primitive(lang_def_id);
|
||||
}
|
||||
ty::Char => {
|
||||
let lang_def_id = lang_items.char_impl();
|
||||
self.assemble_inherent_impl_for_primitive(lang_def_id);
|
||||
|
|
|
@ -67,6 +67,14 @@ impl ItemLikeVisitor<'v> for InherentCollect<'tcx> {
|
|||
ty::Dynamic(ref data, ..) if data.principal_def_id().is_some() => {
|
||||
self.check_def_id(item, data.principal_def_id().unwrap());
|
||||
}
|
||||
ty::Bool => {
|
||||
self.check_primitive_impl(def_id,
|
||||
lang_items.bool_impl(),
|
||||
None,
|
||||
"bool",
|
||||
"bool",
|
||||
item.span);
|
||||
}
|
||||
ty::Char => {
|
||||
self.check_primitive_impl(def_id,
|
||||
lang_items.char_impl(),
|
||||
|
|
|
@ -3977,7 +3977,7 @@ fn build_deref_target_impls(cx: &DocContext<'_>,
|
|||
F32 => tcx.lang_items().f32_impl(),
|
||||
F64 => tcx.lang_items().f64_impl(),
|
||||
Char => tcx.lang_items().char_impl(),
|
||||
Bool => None,
|
||||
Bool => tcx.lang_items().bool_impl(),
|
||||
Str => tcx.lang_items().str_impl(),
|
||||
Slice => tcx.lang_items().slice_impl(),
|
||||
Array => tcx.lang_items().slice_impl(),
|
||||
|
|
|
@ -679,6 +679,7 @@ fn primitive_impl(cx: &DocContext<'_>, path_str: &str) -> Option<DefId> {
|
|||
"f32" => tcx.lang_items().f32_impl(),
|
||||
"f64" => tcx.lang_items().f64_impl(),
|
||||
"str" => tcx.lang_items().str_impl(),
|
||||
"bool" => tcx.lang_items().bool_impl(),
|
||||
"char" => tcx.lang_items().char_impl(),
|
||||
_ => None,
|
||||
}
|
||||
|
|
|
@ -53,6 +53,7 @@ pub fn collect_trait_impls(krate: Crate, cx: &DocContext<'_>) -> Crate {
|
|||
lang_items.f64_impl(),
|
||||
lang_items.f32_runtime_impl(),
|
||||
lang_items.f64_runtime_impl(),
|
||||
lang_items.bool_impl(),
|
||||
lang_items.char_impl(),
|
||||
lang_items.str_impl(),
|
||||
lang_items.slice_impl(),
|
||||
|
|
Loading…
Reference in a new issue