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

rustdoc: Create an attribute version of --extern-html-root-url #96533

Closed
Closed
Changes from 1 commit
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
Prev Previous commit
Add test for new attribute extern_html_root_url
GuillaumeGomez committed May 21, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit cd2a21a9c0477c5f7e4a92dd72de4df96fd2545c
18 changes: 18 additions & 0 deletions src/test/rustdoc-ui/extern_html_root_url.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#![crate_type = "lib"]

#![doc(extern_html_root_url)]
//~^ ERROR
#![doc(extern_html_root_url = "a")]
//~^ ERROR
#![doc(extern_html_root_url(a))]
//~^ ERROR
#![doc(extern_html_root_url(a()))]
//~^ ERROR
#![doc(extern_html_root_url(a = 1))]
//~^ ERROR
#![doc(extern_html_root_url(a = ""))]
//~^ ERROR
#![doc(extern_html_root_url(a = "1"))] // This one is supposed to work.
#![doc(extern_html_root_url(b = "2", c = "3"))] // This one is supposed to work.

pub fn foo() {}
38 changes: 38 additions & 0 deletions src/test/rustdoc-ui/extern_html_root_url.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
error: extern_html_root_url only accepts this form: `extern_html_root_url(crate = "url")`
--> $DIR/extern_html_root_url.rs:3:8
|
LL | #![doc(extern_html_root_url)]
| ^^^^^^^^^^^^^^^^^^^^

error: extern_html_root_url only accepts this form: `extern_html_root_url(crate = "url")`
--> $DIR/extern_html_root_url.rs:5:8
|
LL | #![doc(extern_html_root_url = "a")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^

error: extern_html_root_url() only accepts `crate_name = "url"`
--> $DIR/extern_html_root_url.rs:7:29
|
LL | #![doc(extern_html_root_url(a))]
| ^

error: extern_html_root_url() only accepts `crate_name = "url"`
--> $DIR/extern_html_root_url.rs:9:29
|
LL | #![doc(extern_html_root_url(a()))]
| ^^^

error: extern_html_root_url() only accepts `crate_name = "url"`
--> $DIR/extern_html_root_url.rs:11:29
|
LL | #![doc(extern_html_root_url(a = 1))]
| ^^^^^

error: URL cannot be empty
--> $DIR/extern_html_root_url.rs:13:29
|
LL | #![doc(extern_html_root_url(a = ""))]
| ^^^^^^

error: aborting due to 6 previous errors

6 changes: 6 additions & 0 deletions src/test/rustdoc/extern_html_root_url.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#![crate_name = "foo"]
#![doc(extern_html_root_url(std = "https://doc.rust-lang.org/nightly"))]

// @has 'foo/index.html'
// @has - '//a[@class="mod"]/@href' 'https://doc.rust-lang.org/nightly/std/index.html'
pub use std as other;