mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 01:04:03 +00:00
Fix primitive blanket impls not showing up
This commit is contained in:
parent
4aba7de2a7
commit
8301081c90
@ -65,9 +65,9 @@ impl<'a, 'tcx, 'rcx> BlanketImplFinder <'a, 'tcx, 'rcx> {
|
||||
);
|
||||
return impls;
|
||||
}
|
||||
if self.cx.access_levels.borrow().is_doc_reachable(def_id) {
|
||||
let ty = self.cx.tcx.type_of(def_id);
|
||||
if self.cx.access_levels.borrow().is_doc_reachable(def_id) || ty.is_primitive() {
|
||||
let generics = self.cx.tcx.generics_of(def_id);
|
||||
let ty = self.cx.tcx.type_of(def_id);
|
||||
let real_name = name.clone().map(|name| Ident::from_str(&name));
|
||||
let param_env = self.cx.tcx.param_env(def_id);
|
||||
for &trait_def_id in self.cx.all_traits.iter() {
|
||||
@ -84,8 +84,8 @@ impl<'a, 'tcx, 'rcx> BlanketImplFinder <'a, 'tcx, 'rcx> {
|
||||
let trait_ref = infcx.tcx.impl_trait_ref(impl_def_id)
|
||||
.expect("Cannot get impl trait");
|
||||
|
||||
match infcx.tcx.type_of(impl_def_id).sty {
|
||||
::rustc::ty::TypeVariants::TyParam(_) => {},
|
||||
match trait_ref.self_ty().sty {
|
||||
ty::TypeVariants::TyParam(_) => {},
|
||||
_ => return,
|
||||
}
|
||||
|
||||
@ -153,7 +153,6 @@ impl<'a, 'tcx, 'rcx> BlanketImplFinder <'a, 'tcx, 'rcx> {
|
||||
.clean(self.cx)),
|
||||
}),
|
||||
});
|
||||
debug!("{:?} => {}", trait_ref, may_apply);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
18
src/test/rustdoc/primitive-generic-impl.rs
Normal file
18
src/test/rustdoc/primitive-generic-impl.rs
Normal file
@ -0,0 +1,18 @@
|
||||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![crate_name = "foo"]
|
||||
|
||||
// we need to reexport something from libstd so that `all_trait_implementations` is called.
|
||||
pub use std::string::String;
|
||||
|
||||
include!("primitive/primitive-generic-impl.rs");
|
||||
|
||||
// @has foo/primitive.i32.html '//h3[@id="impl-ToString"]//code' 'impl<T> ToString for T'
|
13
src/test/rustdoc/primitive/primitive-generic-impl.rs
Normal file
13
src/test/rustdoc/primitive/primitive-generic-impl.rs
Normal file
@ -0,0 +1,13 @@
|
||||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#[doc(primitive = "i32")]
|
||||
/// Some useless docs, wouhou!
|
||||
mod i32 {}
|
Loading…
Reference in New Issue
Block a user