Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rustdoc test directives that were accidentally ignored 🧐 #137099

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions tests/rustdoc/anchor-id-duplicate-method-name-25001.rs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how this makes it "more explicit in what it checks". #25001 is about items with duplicate names (here: quux), so I'm not sure why return types are relevant here?

Copy link
Contributor Author

@yotamofek yotamofek Feb 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found this test was broken when I was messing around with the way the trait implementations for a certain type are ordered.
The //@ has directives for the associated type also make their order doesn't change, not just that there are three unique IDs, since the different types are part of the test. I thought it would be nice if the trait methods acted the same way, not because of the specific issue the test was written for, but just generally so if the order ever changes, it's not accidental.
I don't mind reverting this commit though :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll check and reply later today

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't waste too much time on this, it's completely inconsequential. :)

Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ impl Foo<u32> {
}

impl<T> Bar for Foo<T> {
// @has - '//*[@id="associatedtype.Item"]//h4[@class="code-header"]' 'type Item = T'
//@ has - '//*[@id="associatedtype.Item"]//h4[@class="code-header"]' 'type Item = T'
type Item=T;

//@ has - '//*[@id="method.quux"]//h4[@class="code-header"]' 'fn quux(self)'
fn quux(self) {}
}
impl<'a, T> Bar for &'a Foo<T> {
// @has - '//*[@id="associatedtype.Item-1"]//h4[@class="code-header"]' "type Item = &'a T"
//@ has - '//*[@id="associatedtype.Item-1"]//h4[@class="code-header"]' "type Item = &'a T"
type Item=&'a T;

//@ has - '//*[@id="method.quux-1"]//h4[@class="code-header"]' 'fn quux(self)'
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<li><div class="item-name"><a class="struct" href="struct.CreateSubscriptionPaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransfer.html" title="struct extremely_long_typename::CreateSubscriptionPaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransfer">Create<wbr />Subscription<wbr />Payment<wbr />Settings<wbr />Payment<wbr />Method<wbr />Options<wbr />Customer<wbr />Balance<wbr />Bank<wbr />Transfer<wbr />EuBank<wbr />Transfer</a></div></li>
<dt><a class="struct" href="struct.CreateSubscriptionPaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransfer.html" title="struct extremely_long_typename::CreateSubscriptionPaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransfer">Create<wbr />Subscription<wbr />Payment<wbr />Settings<wbr />Payment<wbr />Method<wbr />Options<wbr />Customer<wbr />Balance<wbr />Bank<wbr />Transfer<wbr />EuBank<wbr />Transfer</a></dt>
2 changes: 1 addition & 1 deletion tests/rustdoc/extremely_long_typename.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
// the item table has it line wrapped.
// There should be some reasonably-placed `<wbr>` tags in the snapshot file.

// @snapshot extremely_long_typename "extremely_long_typename/index.html" '//ul[@class="item-table"]/li'
//@ snapshot extremely_long_typename "extremely_long_typename/index.html" '//dl[@class="item-table"]/dt'
pub struct CreateSubscriptionPaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransfer;
26 changes: 13 additions & 13 deletions tests/rustdoc/unsafe-extern-blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@

#![crate_name = "foo"]

// @has 'foo/index.html'
//@ has 'foo/index.html'

// First we check that both the static and the function have a "sup" element
// to tell they're unsafe.

// @count - '//ul[@class="item-table"]//sup[@title="unsafe static"]' 1
// @has - '//ul[@class="item-table"]//sup[@title="unsafe static"]' '⚠'
// @count - '//ul[@class="item-table"]//sup[@title="unsafe function"]' 1
// @has - '//ul[@class="item-table"]//sup[@title="unsafe function"]' '⚠'
//@ count - '//dl[@class="item-table"]//sup[@title="unsafe static"]' 1
//@ has - '//dl[@class="item-table"]//sup[@title="unsafe static"]' '⚠'
//@ count - '//dl[@class="item-table"]//sup[@title="unsafe function"]' 1
//@ has - '//dl[@class="item-table"]//sup[@title="unsafe function"]' '⚠'

unsafe extern "C" {
// @has 'foo/static.FOO.html'
// @has - '//pre[@class="rust item-decl"]' 'pub static FOO: i32'
//@ has 'foo/static.FOO.html'
//@ has - '//pre[@class="rust item-decl"]' 'pub static FOO: i32'
pub safe static FOO: i32;
// @has 'foo/static.BAR.html'
// @has - '//pre[@class="rust item-decl"]' 'pub unsafe static BAR: i32'
//@ has 'foo/static.BAR.html'
//@ has - '//pre[@class="rust item-decl"]' 'pub unsafe static BAR: i32'
pub static BAR: i32;

// @has 'foo/fn.foo.html'
// @has - '//pre[@class="rust item-decl"]' 'pub extern "C" fn foo()'
//@ has 'foo/fn.foo.html'
//@ has - '//pre[@class="rust item-decl"]' 'pub extern "C" fn foo()'
pub safe fn foo();
// @has 'foo/fn.bar.html'
// @has - '//pre[@class="rust item-decl"]' 'pub unsafe extern "C" fn bar()'
//@ has 'foo/fn.bar.html'
//@ has - '//pre[@class="rust item-decl"]' 'pub unsafe extern "C" fn bar()'
pub fn bar();
}
Loading