Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
scottmcm committed May 2, 2021
1 parent fe540ae commit 40ffa94
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
15 changes: 9 additions & 6 deletions src/librustdoc/clean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ use rustc_hir::def::{CtorKind, DefKind, Res};
use rustc_hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE};
use rustc_index::vec::{Idx, IndexVec};
use rustc_infer::infer::region_constraints::{Constraint, RegionConstraintData};
use rustc_middle::bug;
use rustc_middle::middle::resolve_lifetime as rl;
use rustc_middle::ty::fold::TypeFolder;
use rustc_middle::ty::subst::{InternalSubsts, Subst};
use rustc_middle::ty::{self, AdtKind, Lift, Ty, TyCtxt};
use rustc_middle::{bug, span_bug};
use rustc_mir::const_eval::{is_const_fn, is_unstable_const_fn};
use rustc_span::hygiene::{AstPass, MacroKind};
use rustc_span::symbol::{kw, sym, Ident, Symbol};
Expand Down Expand Up @@ -157,11 +157,14 @@ impl Clean<GenericBound> for hir::GenericBound<'_> {
impl Clean<Type> for (ty::TraitRef<'_>, &[TypeBinding]) {
fn clean(&self, cx: &mut DocContext<'_>) -> Type {
let (trait_ref, bounds) = *self;
let kind = match cx.tcx.def_kind(trait_ref.def_id) {
DefKind::Trait => ItemType::Trait,
DefKind::TraitAlias => ItemType::TraitAlias,
other => bug!("`TraitRef` had unexpected kind {:?}", other),
};
let kind = cx.tcx.def_kind(trait_ref.def_id).into();
if !matches!(kind, ItemType::Trait | ItemType::TraitAlias) {
span_bug!(
cx.tcx.def_span(trait_ref.def_id),
"`TraitRef` had unexpected kind {:?}",
kind
);
}
inline::record_extern_fqn(cx, trait_ref.def_id, kind);
let path = external_path(
cx,
Expand Down
3 changes: 3 additions & 0 deletions src/test/rustdoc/auxiliary/trait-alias-mention.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#![feature(trait_alias)]

pub trait SomeAlias = std::fmt::Debug + std::marker::Copy;
11 changes: 6 additions & 5 deletions src/test/rustdoc/trait-alias-mention.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#![feature(trait_alias)]
#![feature(ptr_metadata)]
// aux-build:trait-alias-mention.rs
// build-aux-docs

#![crate_name = "foo"]

// @has foo/fn.this_never_panics.html '//a[@title="traitalias core::ptr::metadata::Thin"]' 'Thin'
pub fn this_never_panics<T: std::ptr::Thin>() {
assert_eq!(std::mem::size_of::<&T>(), std::mem::size_of::<usize>())
extern crate trait_alias_mention;

// @has foo/fn.mention_alias_in_bounds.html '//a[@href="../trait_alias_mention/traitalias.SomeAlias.html"]' 'SomeAlias'
pub fn mention_alias_in_bounds<T: trait_alias_mention::SomeAlias>() {
}

0 comments on commit 40ffa94

Please sign in to comment.