Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
efe703a
[self-profiling] Include the estimated size of each cgu in the profile
wesleywiser Nov 3, 2020
279bf29
Get rid of `Class::None`
jyn514 Nov 15, 2020
74d5466
update rustfmt to v1.4.27
calebcartwright Nov 17, 2020
b3f9795
Get rid of clean::TyMethod
jyn514 Nov 17, 2020
2a991e1
Get rid of clean::Method
jyn514 Nov 17, 2020
5903163
Remove duplicate `Trait::auto` field
jyn514 Nov 17, 2020
a1cdf72
Fix exhaustiveness in case a byte string literal is used at slice type
oli-obk Nov 15, 2020
5f2a627
extend macro braces test
lcnr Nov 17, 2020
96a6a5f
Add color in rustdoc --test output
GuillaumeGomez Jul 13, 2020
54e8216
Update error code detection in compile_fail doctests
GuillaumeGomez Jul 14, 2020
57bab5e
Add check to get windows console type to decide to use colors or not
GuillaumeGomez Jul 16, 2020
704001b
Update lock file
GuillaumeGomez Jul 16, 2020
32d64ed
Simplfy color availability check
GuillaumeGomez Nov 11, 2020
fd4a33c
Update doctest tests
GuillaumeGomez Nov 11, 2020
95ee1fc
Correctly detect color support
GuillaumeGomez Nov 12, 2020
63785c8
Add comment explaining why we can't split on `error[{}]: ` because of…
GuillaumeGomez Nov 13, 2020
ec10824
Remove unused import
GuillaumeGomez Nov 15, 2020
81f9feb
Rollup merge of #74293 - GuillaumeGomez:rustdoc-test-compiler-output-…
m-ou-se Nov 17, 2020
fa45fce
Rollup merge of #78702 - wesleywiser:self_profile_cgu_sizes, r=Mark-S…
m-ou-se Nov 17, 2020
dda4798
Rollup merge of #79069 - jyn514:class-none, r=GuillaumeGomez
m-ou-se Nov 17, 2020
b6f5241
Rollup merge of #79072 - oli-obk:byte_str_pat, r=estebank
m-ou-se Nov 17, 2020
53ddb73
Rollup merge of #79120 - calebcartwright:update-rustfmt, r=Mark-Simul…
m-ou-se Nov 17, 2020
3d63f25
Rollup merge of #79125 - jyn514:fewer-types, r=GuillaumeGomez
m-ou-se Nov 17, 2020
ca38bd4
Rollup merge of #79126 - jyn514:auto, r=GuillaumeGomez
m-ou-se Nov 17, 2020
f698505
Rollup merge of #79130 - lcnr:extend-tes, r=varkor
m-ou-se Nov 17, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions src/librustdoc/clean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -883,14 +883,12 @@ impl<'a, 'tcx> Clean<Generics> for (&'a ty::Generics, ty::GenericPredicates<'tcx
}
}

impl<'a> Clean<Method>
for (&'a hir::FnSig<'a>, &'a hir::Generics<'a>, hir::BodyId, Option<hir::Defaultness>)
{
fn clean(&self, cx: &DocContext<'_>) -> Method {
impl<'a> Clean<Function> for (&'a hir::FnSig<'a>, &'a hir::Generics<'a>, hir::BodyId) {
fn clean(&self, cx: &DocContext<'_>) -> Function {
let (generics, decl) =
enter_impl_trait(cx, || (self.1.clean(cx), (&*self.0.decl, self.2).clean(cx)));
let (all_types, ret_types) = get_all_types(&generics, &decl, cx);
Method { decl, generics, header: self.0.header, defaultness: self.3, all_types, ret_types }
Function { decl, generics, header: self.0.header, all_types, ret_types }
}
}

Expand Down Expand Up @@ -1107,20 +1105,20 @@ impl Clean<Item> for hir::TraitItem<'_> {
AssocConstItem(ty.clean(cx), default.map(|e| print_const_expr(cx, e)))
}
hir::TraitItemKind::Fn(ref sig, hir::TraitFn::Provided(body)) => {
let mut m = (sig, &self.generics, body, None).clean(cx);
let mut m = (sig, &self.generics, body).clean(cx);
if m.header.constness == hir::Constness::Const
&& is_unstable_const_fn(cx.tcx, local_did.to_def_id()).is_some()
{
m.header.constness = hir::Constness::NotConst;
}
MethodItem(m)
MethodItem(m, None)
}
hir::TraitItemKind::Fn(ref sig, hir::TraitFn::Required(ref names)) => {
let (generics, decl) = enter_impl_trait(cx, || {
(self.generics.clean(cx), (&*sig.decl, &names[..]).clean(cx))
});
let (all_types, ret_types) = get_all_types(&generics, &decl, cx);
let mut t = TyMethod { header: sig.header, decl, generics, all_types, ret_types };
let mut t = Function { header: sig.header, decl, generics, all_types, ret_types };
if t.header.constness == hir::Constness::Const
&& is_unstable_const_fn(cx.tcx, local_did.to_def_id()).is_some()
{
Expand Down Expand Up @@ -1153,13 +1151,13 @@ impl Clean<Item> for hir::ImplItem<'_> {
AssocConstItem(ty.clean(cx), Some(print_const_expr(cx, expr)))
}
hir::ImplItemKind::Fn(ref sig, body) => {
let mut m = (sig, &self.generics, body, Some(self.defaultness)).clean(cx);
let mut m = (sig, &self.generics, body).clean(cx);
if m.header.constness == hir::Constness::Const
&& is_unstable_const_fn(cx.tcx, local_did.to_def_id()).is_some()
{
m.header.constness = hir::Constness::NotConst;
}
MethodItem(m)
MethodItem(m, Some(self.defaultness))
}
hir::ImplItemKind::TyAlias(ref ty) => {
let type_ = ty.clean(cx);
Expand Down Expand Up @@ -1235,21 +1233,23 @@ impl Clean<Item> for ty::AssocItem {
ty::ImplContainer(_) => Some(self.defaultness),
ty::TraitContainer(_) => None,
};
MethodItem(Method {
generics,
decl,
header: hir::FnHeader {
unsafety: sig.unsafety(),
abi: sig.abi(),
constness,
asyncness,
MethodItem(
Function {
generics,
decl,
header: hir::FnHeader {
unsafety: sig.unsafety(),
abi: sig.abi(),
constness,
asyncness,
},
all_types,
ret_types,
},
defaultness,
all_types,
ret_types,
})
)
} else {
TyMethodItem(TyMethod {
TyMethodItem(Function {
generics,
decl,
header: hir::FnHeader {
Expand Down
31 changes: 4 additions & 27 deletions src/librustdoc/clean/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,8 @@ impl Item {

crate fn is_default(&self) -> bool {
match self.kind {
ItemKind::MethodItem(ref meth) => {
if let Some(defaultness) = meth.defaultness {
defaultness.has_value() && !defaultness.is_final()
} else {
false
}
ItemKind::MethodItem(_, Some(defaultness)) => {
defaultness.has_value() && !defaultness.is_final()
}
_ => false,
}
Expand Down Expand Up @@ -264,9 +260,9 @@ crate enum ItemKind {
ImplItem(Impl),
/// A method signature only. Used for required methods in traits (ie,
/// non-default-methods).
TyMethodItem(TyMethod),
TyMethodItem(Function),
/// A method with a body.
MethodItem(Method),
MethodItem(Function, Option<hir::Defaultness>),
StructFieldItem(Type),
VariantItem(Variant),
/// `fn`s from an extern block
Expand Down Expand Up @@ -910,25 +906,6 @@ crate struct Generics {
crate where_predicates: Vec<WherePredicate>,
}

#[derive(Clone, Debug)]
crate struct Method {
crate generics: Generics,
crate decl: FnDecl,
crate header: hir::FnHeader,
crate defaultness: Option<hir::Defaultness>,
crate all_types: Vec<(Type, TypeKind)>,
crate ret_types: Vec<(Type, TypeKind)>,
}

#[derive(Clone, Debug)]
crate struct TyMethod {
crate header: hir::FnHeader,
crate decl: FnDecl,
crate generics: Generics,
crate all_types: Vec<(Type, TypeKind)>,
crate ret_types: Vec<(Type, TypeKind)>,
}

#[derive(Clone, Debug)]
crate struct Function {
crate decl: FnDecl,
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/render/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ crate fn build_index(krate: &clean::Crate, cache: &mut Cache) -> String {
crate fn get_index_search_type(item: &clean::Item) -> Option<IndexItemFunctionType> {
let (all_types, ret_types) = match item.kind {
clean::FunctionItem(ref f) => (&f.all_types, &f.ret_types),
clean::MethodItem(ref m) => (&m.all_types, &m.ret_types),
clean::MethodItem(ref m, _) => (&m.all_types, &m.ret_types),
clean::TyMethodItem(ref m) => (&m.all_types, &m.ret_types),
_ => return None,
};
Expand Down
13 changes: 8 additions & 5 deletions src/librustdoc/html/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2589,7 +2589,9 @@ fn item_trait(w: &mut Buffer, cx: &Context, it: &clean::Item, t: &clean::Trait,
for (pos, m) in provided.iter().enumerate() {
render_assoc_item(w, m, AssocItemLink::Anchor(None), ItemType::Trait);
match m.kind {
clean::MethodItem(ref inner) if !inner.generics.where_predicates.is_empty() => {
clean::MethodItem(ref inner, _)
if !inner.generics.where_predicates.is_empty() =>
{
write!(w, ",\n {{ ... }}\n");
}
_ => {
Expand Down Expand Up @@ -2968,7 +2970,9 @@ fn render_assoc_item(
match item.kind {
clean::StrippedItem(..) => {}
clean::TyMethodItem(ref m) => method(w, item, m.header, &m.generics, &m.decl, link, parent),
clean::MethodItem(ref m) => method(w, item, m.header, &m.generics, &m.decl, link, parent),
clean::MethodItem(ref m, _) => {
method(w, item, m.header, &m.generics, &m.decl, link, parent)
}
clean::AssocConstItem(ref ty, ref default) => assoc_const(
w,
item,
Expand Down Expand Up @@ -3545,7 +3549,7 @@ fn render_deref_methods(

fn should_render_item(item: &clean::Item, deref_mut_: bool) -> bool {
let self_type_opt = match item.kind {
clean::MethodItem(ref method) => method.decl.self_type(),
clean::MethodItem(ref method, _) => method.decl.self_type(),
clean::TyMethodItem(ref method) => method.decl.self_type(),
_ => None,
};
Expand Down Expand Up @@ -3752,8 +3756,7 @@ fn render_impl(
(true, " hidden")
};
match item.kind {
clean::MethodItem(clean::Method { .. })
| clean::TyMethodItem(clean::TyMethod { .. }) => {
clean::MethodItem(..) | clean::TyMethodItem(_) => {
// Only render when the method is not static or we allow static methods
if render_method_item {
let id = cx.derive_id(format!("{}.{}", item_type, name));
Expand Down