-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #110765 - wackbyte:fix-defaultness-position, r=fmease…
…,GuillaumeGomez rustdoc: fix position of `default` in method rendering With the following code: ```rs #![feature(specialization)] pub trait A { unsafe fn a(); } impl A for () { default unsafe fn a() {} } ``` rustdoc would render the `impl` of `a` as ```rs unsafe default fn a() ``` which is inconsistent with the actual position of `default`. This PR fixes this issue.
- Loading branch information
Showing
2 changed files
with
35 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,45 @@ | ||
#![feature(min_specialization)] | ||
|
||
// @has default_trait_method/trait.Item.html | ||
// @has - '//*[@id="tymethod.foo"]' 'fn foo()' | ||
// @!has - '//*[@id="tymethod.foo"]' 'default fn foo()' | ||
// @has - '//*[@id="tymethod.bar"]' 'fn bar()' | ||
// @!has - '//*[@id="tymethod.bar"]' 'default fn bar()' | ||
// @has - '//*[@id="method.baz"]' 'fn baz()' | ||
// @!has - '//*[@id="method.baz"]' 'default fn baz()' | ||
pub trait Item { | ||
// @has - '//*[@id="tymethod.foo"]' 'fn foo()' | ||
// @!has - '//*[@id="tymethod.foo"]' 'default fn foo()' | ||
fn foo(); | ||
|
||
// @has - '//*[@id="tymethod.bar"]' 'fn bar()' | ||
// @!has - '//*[@id="tymethod.bar"]' 'default fn bar()' | ||
fn bar(); | ||
fn baz() {} | ||
|
||
// @has - '//*[@id="tymethod.baz"]' 'unsafe fn baz()' | ||
// @!has - '//*[@id="tymethod.baz"]' 'default unsafe fn baz()' | ||
unsafe fn baz(); | ||
|
||
// @has - '//*[@id="tymethod.quux"]' 'unsafe fn quux()' | ||
// @!has - '//*[@id="tymethod.quux"]' 'default unsafe fn quux()' | ||
unsafe fn quux(); | ||
|
||
// @has - '//*[@id="method.xyzzy"]' 'fn xyzzy()' | ||
// @!has - '//*[@id="method.xyzzy"]' 'default fn xyzzy()' | ||
fn xyzzy() {} | ||
} | ||
|
||
// @has default_trait_method/struct.Foo.html | ||
// @has - '//*[@id="method.foo"]' 'default fn foo()' | ||
// @has - '//*[@id="method.bar"]' 'fn bar()' | ||
// @!has - '//*[@id="method.bar"]' 'default fn bar()' | ||
// @has - '//*[@id="method.baz"]' 'fn baz()' | ||
// @!has - '//*[@id="method.baz"]' 'default fn baz()' | ||
pub struct Foo; | ||
impl Item for Foo { | ||
// @has - '//*[@id="method.foo"]' 'default fn foo()' | ||
default fn foo() {} | ||
|
||
// @has - '//*[@id="method.bar"]' 'fn bar()' | ||
// @!has - '//*[@id="method.bar"]' 'default fn bar()' | ||
fn bar() {} | ||
|
||
// @has - '//*[@id="method.baz"]' 'default unsafe fn baz()' | ||
default unsafe fn baz() {} | ||
|
||
// @has - '//*[@id="method.quux"]' 'unsafe fn quux()' | ||
// @!has - '//*[@id="method.quux"]' 'default unsafe fn quux()' | ||
unsafe fn quux() {} | ||
|
||
// @has - '//*[@id="method.xyzzy"]' 'fn xyzzy()' | ||
// @!has - '//*[@id="method.xyzzy"]' 'default fn xyzzy()' | ||
} |