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

Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
cf5e4a7
Add explicit references to the BuildHasher trait
Mark-Simulacrum Apr 29, 2020
d80ac14
Extend rustdoc-js tester to allow to test multiple queries in one file
GuillaumeGomez Apr 30, 2020
7590c39
Improve doc alias JS code
GuillaumeGomez Apr 30, 2020
cf41b1d
Improve doc alias discovery
GuillaumeGomez Apr 30, 2020
3a0727e
Add more tests for doc aliases
GuillaumeGomez Apr 30, 2020
9697c46
Update std tests
GuillaumeGomez Apr 30, 2020
f581cf7
Merge aliases and search-index
GuillaumeGomez May 4, 2020
32a46e9
add test case for issue-61076
csmoe May 6, 2020
2e2aac4
add try trait as lang item
csmoe May 6, 2020
114cd00
normalize Future::Ouput
csmoe May 9, 2020
627f473
suggest await before try when performing trait selection
csmoe May 10, 2020
c7e64f5
remove try_trait lang item
csmoe May 10, 2020
a1104b4
bless ui tests
csmoe May 10, 2020
ce915f5
remove extra space from crate-level doctest names
euclio May 13, 2020
883c177
Move doc alias discovery into the Attributes struct and some code imp…
GuillaumeGomez May 4, 2020
c4d9318
Make current crate aliases go first
GuillaumeGomez May 7, 2020
e17ac66
* Update aliases data struct from HashMap to BTreeMap to have more de…
GuillaumeGomez May 13, 2020
8954379
make sure even unleashed miri does not do pointer stuff
RalfJung May 14, 2020
e84b379
[const-prop] Don't replace Rvalues that are already constants
wesleywiser Apr 23, 2020
257e377
doc: add links to rotate_(left|right)
tesuji May 15, 2020
10d7da4
implement type_implments_trait query
csmoe May 14, 2020
00268be
Remove lang_items\(\).*\.unwrap\(\)
cofibrant May 14, 2020
9f0e5c4
Rollup merge of #71677 - Mark-Simulacrum:hasher-docs, r=Amanieu
Dylan-DPC May 15, 2020
bc84eb4
Rollup merge of #71724 - GuillaumeGomez:doc-alias-improvements, r=oll…
Dylan-DPC May 15, 2020
6f0b2b7
Rollup merge of #71948 - csmoe:issue-61076, r=oli-obk
Dylan-DPC May 15, 2020
471d6d3
Rollup merge of #72180 - euclio:rustdoc-test-extra-space, r=Dylan-DPC
Dylan-DPC May 15, 2020
ccc62c8
Rollup merge of #72216 - doctorn:require-lang-item, r=lcnr
Dylan-DPC May 15, 2020
d3ec126
Rollup merge of #72218 - RalfJung:test-unleashed-ptrs, r=oli-obk
Dylan-DPC May 15, 2020
2a63411
Rollup merge of #72220 - wesleywiser:const_prop_eval_consts, r=oli-obk
Dylan-DPC May 15, 2020
e0f924f
Rollup merge of #72224 - lzutao:links, r=Dylan-DPC
Dylan-DPC May 15, 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
Prev Previous commit
Next Next commit
Add more tests for doc aliases
  • Loading branch information
GuillaumeGomez committed May 7, 2020
commit 3a0727e84e29318ee41eb63bac27bfc1a379bfc5
237 changes: 237 additions & 0 deletions src/test/rustdoc-js/doc-alias.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
// exact-check

const QUERY = [
'StructItem',
'StructFieldItem',
'StructMethodItem',
'ImplTraitItem',
'ImplAssociatedConstItem',
'ImplTraitFunction',
'EnumItem',
'VariantItem',
'EnumMethodItem',
'TypedefItem',
'TraitItem',
'TraitTypeItem',
'AssociatedConstItem',
'TraitFunctionItem',
'FunctionItem',
'ModuleItem',
'ConstItem',
'StaticItem',
'UnionItem',
'UnionFieldItem',
'UnionMethodItem',
'MacroItem',
];

const EXPECTED = [
{
'others': [
{
'path': 'doc_alias',
'name': 'Struct',
'alias': 'StructItem',
'href': '../doc_alias/struct.Struct.html'
},
],
},
{
'others': [
{
'path': 'doc_alias::Struct',
'name': 'field',
'alias': 'StructFieldItem',
'href': '../doc_alias/struct.Struct.html#structfield.field'
},
],
},
{
'others': [
{
'path': 'doc_alias::Struct',
'name': 'method',
'alias': 'StructMethodItem',
'href': '../doc_alias/struct.Struct.html#method.method'
},
],
},
{
// ImplTraitItem
'others': [],
},
{
// ImplAssociatedConstItem
'others': [],
},
{
// ImplTraitFunction
'others': [],
},
{
'others': [
{
'path': 'doc_alias',
'name': 'Enum',
'alias': 'EnumItem',
'href': '../doc_alias/enum.Enum.html'
},
],
},
{
'others': [
{
'path': 'doc_alias::Enum',
'name': 'Variant',
'alias': 'VariantItem',
'href': '../doc_alias/enum.Enum.html#variant.Variant'
},
],
},
{
'others': [
{
'path': 'doc_alias::Enum',
'name': 'method',
'alias': 'EnumMethodItem',
'href': '../doc_alias/enum.Enum.html#method.method'
},
],
},
{
'others': [
{
'path': 'doc_alias',
'name': 'Typedef',
'alias': 'TypedefItem',
'href': '../doc_alias/type.Typedef.html'
},
],
},
{
'others': [
{
'path': 'doc_alias',
'name': 'Trait',
'alias': 'TraitItem',
'href': '../doc_alias/trait.Trait.html'
},
],
},
{
'others': [
{
'path': 'doc_alias::Trait',
'name': 'Target',
'alias': 'TraitTypeItem',
'href': '../doc_alias/trait.Trait.html#associatedtype.Target'
},
],
},
{
'others': [
{
'path': 'doc_alias::Trait',
'name': 'AssociatedConst',
'alias': 'AssociatedConstItem',
'href': '../doc_alias/trait.Trait.html#associatedconstant.AssociatedConst'
},
],
},
{
'others': [
{
'path': 'doc_alias::Trait',
'name': 'function',
'alias': 'TraitFunctionItem',
'href': '../doc_alias/trait.Trait.html#tymethod.function'
},
],
},
{
'others': [
{
'path': 'doc_alias',
'name': 'function',
'alias': 'FunctionItem',
'href': '../doc_alias/fn.function.html'
},
],
},
{
'others': [
{
'path': 'doc_alias',
'name': 'Module',
'alias': 'ModuleItem',
'href': '../doc_alias/Module/index.html'
},
],
},
{
'others': [
{
'path': 'doc_alias',
'name': 'Const',
'alias': 'ConstItem',
'href': '../doc_alias/constant.Const.html'
},
],
},
{
'others': [
{
'path': 'doc_alias',
'name': 'Static',
'alias': 'StaticItem',
'href': '../doc_alias/static.Static.html'
},
],
},
{
'others': [
{
'path': 'doc_alias',
'name': 'Union',
'alias': 'UnionItem',
'href': '../doc_alias/union.Union.html'
},
// Not an alias!
{
'path': 'doc_alias::Union',
'name': 'union_item',
'href': '../doc_alias/union.Union.html#structfield.union_item'
},
],
},
{
'others': [
{
'path': 'doc_alias::Union',
'name': 'union_item',
'alias': 'UnionFieldItem',
'href': '../doc_alias/union.Union.html#structfield.union_item'
},
],
},
{
'others': [
{
'path': 'doc_alias::Union',
'name': 'method',
'alias': 'UnionMethodItem',
'href': '../doc_alias/union.Union.html#method.method'
},
],
},
{
'others': [
{
'path': 'doc_alias',
'name': 'Macro',
'alias': 'MacroItem',
'href': '../doc_alias/macro.Macro.html'
},
],
},
];
80 changes: 80 additions & 0 deletions src/test/rustdoc-js/doc-alias.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#![feature(doc_alias)]

#[doc(alias = "StructItem")]
pub struct Struct {
#[doc(alias = "StructFieldItem")]
pub field: u32,
}

impl Struct {
#[doc(alias = "StructMethodItem")]
pub fn method(&self) {}
}

impl Trait for Struct {
// Shouldn't be listed in aliases!
#[doc(alias = "ImplTraitItem")]
type Target = u32;
// Shouldn't be listed in aliases!
#[doc(alias = "ImplAssociatedConstItem")]
const AssociatedConst: i32 = 12;

// Shouldn't be listed in aliases!
#[doc(alias = "ImplTraitFunction")]
fn function() -> Self::Target { 0 }
}

#[doc(alias = "EnumItem")]
pub enum Enum {
#[doc(alias = "VariantItem")]
Variant,
}

impl Enum {
#[doc(alias = "EnumMethodItem")]
pub fn method(&self) {}
}

#[doc(alias = "TypedefItem")]
pub type Typedef = i32;

#[doc(alias = "TraitItem")]
pub trait Trait {
#[doc(alias = "TraitTypeItem")]
type Target;
#[doc(alias = "AssociatedConstItem")]
const AssociatedConst: i32;

#[doc(alias = "TraitFunctionItem")]
fn function() -> Self::Target;
}

#[doc(alias = "FunctionItem")]
pub fn function() {}

#[doc(alias = "ModuleItem")]
pub mod Module {}

#[doc(alias = "ConstItem")]
pub const Const: u32 = 0;

#[doc(alias = "StaticItem")]
pub static Static: u32 = 0;

#[doc(alias = "UnionItem")]
pub union Union {
#[doc(alias = "UnionFieldItem")]
pub union_item: u32,
pub y: f32,
}

impl Union {
#[doc(alias = "UnionMethodItem")]
pub fn method(&self) {}
}

#[doc(alias = "MacroItem")]
#[macro_export]
macro_rules! Macro {
() => {}
}