File tree Expand file tree Collapse file tree 5 files changed +67
-16
lines changed Expand file tree Collapse file tree 5 files changed +67
-16
lines changed Original file line number Diff line number Diff line change @@ -2325,6 +2325,10 @@ impl<'tcx> Clean<Item> for ty::AssociatedItem {
23252325 } else {
23262326 hir:: Constness :: NotConst
23272327 } ;
2328+ let defaultness = match self . container {
2329+ ty:: ImplContainer ( _) => Some ( self . defaultness ) ,
2330+ ty:: TraitContainer ( _) => None ,
2331+ } ;
23282332 MethodItem ( Method {
23292333 generics,
23302334 decl,
@@ -2334,7 +2338,7 @@ impl<'tcx> Clean<Item> for ty::AssociatedItem {
23342338 constness,
23352339 asyncness : hir:: IsAsync :: NotAsync ,
23362340 } ,
2337- defaultness : Some ( self . defaultness ) ,
2341+ defaultness,
23382342 all_types,
23392343 ret_types,
23402344 } )
Original file line number Diff line number Diff line change 1+ #![ feature( specialization) ]
2+
3+ // @has default_trait_method/trait.Item.html
4+ // @has - '//*[@id="tymethod.foo"]' 'fn foo()'
5+ // @!has - '//*[@id="tymethod.foo"]' 'default fn foo()'
6+ // @has - '//*[@id="tymethod.bar"]' 'fn bar()'
7+ // @!has - '//*[@id="tymethod.bar"]' 'default fn bar()'
8+ // @has - '//*[@id="method.baz"]' 'fn baz()'
9+ // @!has - '//*[@id="method.baz"]' 'default fn baz()'
10+ pub trait Item {
11+ fn foo ( ) ;
12+ fn bar ( ) ;
13+ fn baz ( ) { }
14+ }
15+
16+ // @has default_trait_method/struct.Foo.html
17+ // @has - '//*[@id="method.foo"]' 'default fn foo()'
18+ // @has - '//*[@id="method.bar"]' 'fn bar()'
19+ // @!has - '//*[@id="method.bar"]' 'default fn bar()'
20+ // @has - '//*[@id="method.baz"]' 'fn baz()'
21+ // @!has - '//*[@id="method.baz"]' 'default fn baz()'
22+ pub struct Foo ;
23+ impl Item for Foo {
24+ default fn foo ( ) { }
25+ fn bar ( ) { }
26+ }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ #![ feature( specialization) ]
2+
3+ #![ crate_name = "foo" ]
4+
5+ pub trait Item {
6+ fn foo ( ) ;
7+ fn bar ( ) ;
8+ fn baz ( ) { }
9+ }
10+
11+ pub struct Foo ;
12+
13+ impl Item for Foo {
14+ default fn foo ( ) { }
15+ fn bar ( ) { }
16+ }
Original file line number Diff line number Diff line change 1+ // aux-build:default-trait-method.rs
2+
3+ extern crate foo;
4+
5+ // @has default_trait_method/trait.Item.html
6+ // @has - '//*[@id="tymethod.foo"]' 'fn foo()'
7+ // @!has - '//*[@id="tymethod.foo"]' 'default fn foo()'
8+ // @has - '//*[@id="tymethod.bar"]' 'fn bar()'
9+ // @!has - '//*[@id="tymethod.bar"]' 'default fn bar()'
10+ // @has - '//*[@id="method.baz"]' 'fn baz()'
11+ // @!has - '//*[@id="method.baz"]' 'default fn baz()'
12+ pub use foo:: Item ;
13+
14+ // @has default_trait_method/struct.Foo.html
15+ // @has - '//*[@id="method.foo"]' 'default fn foo()'
16+ // @has - '//*[@id="method.bar"]' 'fn bar()'
17+ // @!has - '//*[@id="method.bar"]' 'default fn bar()'
18+ // @has - '//*[@id="method.baz"]' 'fn baz()'
19+ // @!has - '//*[@id="method.baz"]' 'default fn baz()'
20+ pub use foo:: Foo ;
You can’t perform that action at this time.
0 commit comments