summaryrefslogtreecommitdiffstats
path: root/tests/rustdoc-ui
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
commitc23a457e72abe608715ac76f076f47dc42af07a5 (patch)
tree2772049aaf84b5c9d0ed12ec8d86812f7a7904b6 /tests/rustdoc-ui
parentReleasing progress-linux version 1.73.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-c23a457e72abe608715ac76f076f47dc42af07a5.tar.xz
rustc-c23a457e72abe608715ac76f076f47dc42af07a5.zip
Merging upstream version 1.74.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/rustdoc-ui')
-rw-r--r--tests/rustdoc-ui/custom_code_classes_in_docs-warning.rs83
-rw-r--r--tests/rustdoc-ui/custom_code_classes_in_docs-warning.stderr97
-rw-r--r--tests/rustdoc-ui/custom_code_classes_in_docs-warning3.rs17
-rw-r--r--tests/rustdoc-ui/custom_code_classes_in_docs-warning3.stderr33
-rw-r--r--tests/rustdoc-ui/feature-gate-custom_code_classes_in_docs.rs15
-rw-r--r--tests/rustdoc-ui/feature-gate-custom_code_classes_in_docs.stderr14
-rw-r--r--tests/rustdoc-ui/issue-102467.rs15
-rw-r--r--tests/rustdoc-ui/issue-102467.stderr9
-rw-r--r--tests/rustdoc-ui/issues/issue-91713.stdout2
9 files changed, 285 insertions, 0 deletions
diff --git a/tests/rustdoc-ui/custom_code_classes_in_docs-warning.rs b/tests/rustdoc-ui/custom_code_classes_in_docs-warning.rs
new file mode 100644
index 000000000..5398d5833
--- /dev/null
+++ b/tests/rustdoc-ui/custom_code_classes_in_docs-warning.rs
@@ -0,0 +1,83 @@
+// This test ensures that warnings are working as expected for "custom_code_classes_in_docs"
+// feature.
+
+#![feature(custom_code_classes_in_docs)]
+#![deny(warnings)]
+#![feature(no_core)]
+#![no_core]
+
+/// ```{. }
+/// main;
+/// ```
+//~^^^ ERROR unexpected ` ` character after `.`
+pub fn foo() {}
+
+/// ```{class= a}
+/// main;
+/// ```
+//~^^^ ERROR unexpected ` ` character after `=`
+pub fn foo2() {}
+
+/// ```{#id}
+/// main;
+/// ```
+//~^^^ ERROR unexpected character `#`
+pub fn foo3() {}
+
+/// ```{{
+/// main;
+/// ```
+//~^^^ ERROR unexpected character `{`
+pub fn foo4() {}
+
+/// ```}
+/// main;
+/// ```
+//~^^^ ERROR unexpected character `}`
+pub fn foo5() {}
+
+/// ```)
+/// main;
+/// ```
+//~^^^ ERROR unexpected character `)`
+pub fn foo6() {}
+
+/// ```{class=}
+/// main;
+/// ```
+//~^^^ ERROR unexpected `}` character after `=`
+pub fn foo7() {}
+
+/// ```(
+/// main;
+/// ```
+//~^^^ ERROR unclosed comment: missing `)` at the end
+pub fn foo8() {}
+
+/// ```{class=one=two}
+/// main;
+/// ```
+//~^^^ ERROR unexpected `=` character
+pub fn foo9() {}
+
+/// ```{.one.two}
+/// main;
+/// ```
+pub fn foo10() {}
+
+/// ```{class=(one}
+/// main;
+/// ```
+//~^^^ ERROR unexpected `(` character after `=`
+pub fn foo11() {}
+
+/// ```{class=one.two}
+/// main;
+/// ```
+pub fn foo12() {}
+
+/// ```{(comment)}
+/// main;
+/// ```
+//~^^^ ERROR unexpected character `(`
+pub fn foo13() {}
diff --git a/tests/rustdoc-ui/custom_code_classes_in_docs-warning.stderr b/tests/rustdoc-ui/custom_code_classes_in_docs-warning.stderr
new file mode 100644
index 000000000..14b4b3bab
--- /dev/null
+++ b/tests/rustdoc-ui/custom_code_classes_in_docs-warning.stderr
@@ -0,0 +1,97 @@
+error: unexpected ` ` character after `.`
+ --> $DIR/custom_code_classes_in_docs-warning.rs:9:1
+ |
+LL | / /// ```{. }
+LL | | /// main;
+LL | | /// ```
+ | |_______^
+ |
+note: the lint level is defined here
+ --> $DIR/custom_code_classes_in_docs-warning.rs:5:9
+ |
+LL | #![deny(warnings)]
+ | ^^^^^^^^
+ = note: `#[deny(rustdoc::invalid_codeblock_attributes)]` implied by `#[deny(warnings)]`
+
+error: unexpected ` ` character after `=`
+ --> $DIR/custom_code_classes_in_docs-warning.rs:15:1
+ |
+LL | / /// ```{class= a}
+LL | | /// main;
+LL | | /// ```
+ | |_______^
+
+error: unexpected character `#`
+ --> $DIR/custom_code_classes_in_docs-warning.rs:21:1
+ |
+LL | / /// ```{#id}
+LL | | /// main;
+LL | | /// ```
+ | |_______^
+
+error: unexpected character `{`
+ --> $DIR/custom_code_classes_in_docs-warning.rs:27:1
+ |
+LL | / /// ```{{
+LL | | /// main;
+LL | | /// ```
+ | |_______^
+
+error: unexpected character `}`
+ --> $DIR/custom_code_classes_in_docs-warning.rs:33:1
+ |
+LL | / /// ```}
+LL | | /// main;
+LL | | /// ```
+ | |_______^
+
+error: unexpected character `)`
+ --> $DIR/custom_code_classes_in_docs-warning.rs:39:1
+ |
+LL | / /// ```)
+LL | | /// main;
+LL | | /// ```
+ | |_______^
+
+error: unexpected `}` character after `=`
+ --> $DIR/custom_code_classes_in_docs-warning.rs:45:1
+ |
+LL | / /// ```{class=}
+LL | | /// main;
+LL | | /// ```
+ | |_______^
+
+error: unclosed comment: missing `)` at the end
+ --> $DIR/custom_code_classes_in_docs-warning.rs:51:1
+ |
+LL | / /// ```(
+LL | | /// main;
+LL | | /// ```
+ | |_______^
+
+error: unexpected `=` character
+ --> $DIR/custom_code_classes_in_docs-warning.rs:57:1
+ |
+LL | / /// ```{class=one=two}
+LL | | /// main;
+LL | | /// ```
+ | |_______^
+
+error: unexpected `(` character after `=`
+ --> $DIR/custom_code_classes_in_docs-warning.rs:68:1
+ |
+LL | / /// ```{class=(one}
+LL | | /// main;
+LL | | /// ```
+ | |_______^
+
+error: unexpected character `(`
+ --> $DIR/custom_code_classes_in_docs-warning.rs:79:1
+ |
+LL | / /// ```{(comment)}
+LL | | /// main;
+LL | | /// ```
+ | |_______^
+
+error: aborting due to 11 previous errors
+
diff --git a/tests/rustdoc-ui/custom_code_classes_in_docs-warning3.rs b/tests/rustdoc-ui/custom_code_classes_in_docs-warning3.rs
new file mode 100644
index 000000000..57d9038cb
--- /dev/null
+++ b/tests/rustdoc-ui/custom_code_classes_in_docs-warning3.rs
@@ -0,0 +1,17 @@
+// This test ensures that warnings are working as expected for "custom_code_classes_in_docs"
+// feature.
+
+#![feature(custom_code_classes_in_docs)]
+#![deny(warnings)]
+#![feature(no_core)]
+#![no_core]
+
+/// ```{class="}
+/// main;
+/// ```
+//~^^^ ERROR unclosed quote string
+//~| ERROR unclosed quote string
+/// ```"
+/// main;
+/// ```
+pub fn foo() {}
diff --git a/tests/rustdoc-ui/custom_code_classes_in_docs-warning3.stderr b/tests/rustdoc-ui/custom_code_classes_in_docs-warning3.stderr
new file mode 100644
index 000000000..4f2ded78c
--- /dev/null
+++ b/tests/rustdoc-ui/custom_code_classes_in_docs-warning3.stderr
@@ -0,0 +1,33 @@
+error: unclosed quote string `"`
+ --> $DIR/custom_code_classes_in_docs-warning3.rs:9:1
+ |
+LL | / /// ```{class="}
+LL | | /// main;
+LL | | /// ```
+LL | |
+... |
+LL | | /// main;
+LL | | /// ```
+ | |_______^
+ |
+note: the lint level is defined here
+ --> $DIR/custom_code_classes_in_docs-warning3.rs:5:9
+ |
+LL | #![deny(warnings)]
+ | ^^^^^^^^
+ = note: `#[deny(rustdoc::invalid_codeblock_attributes)]` implied by `#[deny(warnings)]`
+
+error: unclosed quote string `"`
+ --> $DIR/custom_code_classes_in_docs-warning3.rs:9:1
+ |
+LL | / /// ```{class="}
+LL | | /// main;
+LL | | /// ```
+LL | |
+... |
+LL | | /// main;
+LL | | /// ```
+ | |_______^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/rustdoc-ui/feature-gate-custom_code_classes_in_docs.rs b/tests/rustdoc-ui/feature-gate-custom_code_classes_in_docs.rs
new file mode 100644
index 000000000..99263a944
--- /dev/null
+++ b/tests/rustdoc-ui/feature-gate-custom_code_classes_in_docs.rs
@@ -0,0 +1,15 @@
+// check-pass
+
+/// ```{class=language-c}
+/// int main(void) { return 0; }
+/// ```
+//~^^^ WARNING custom classes in code blocks will change behaviour
+//~| NOTE found these custom classes: class=language-c
+//~| NOTE see issue #79483 <https://github.com/rust-lang/rust/issues/79483>
+//~| HELP add `#![feature(custom_code_classes_in_docs)]` to the crate attributes to enable
+pub struct Bar;
+
+/// ```ASN.1
+/// int main(void) { return 0; }
+/// ```
+pub struct Bar2;
diff --git a/tests/rustdoc-ui/feature-gate-custom_code_classes_in_docs.stderr b/tests/rustdoc-ui/feature-gate-custom_code_classes_in_docs.stderr
new file mode 100644
index 000000000..1a2360d9b
--- /dev/null
+++ b/tests/rustdoc-ui/feature-gate-custom_code_classes_in_docs.stderr
@@ -0,0 +1,14 @@
+warning: custom classes in code blocks will change behaviour
+ --> $DIR/feature-gate-custom_code_classes_in_docs.rs:3:1
+ |
+LL | / /// ```{class=language-c}
+LL | | /// int main(void) { return 0; }
+LL | | /// ```
+ | |_______^
+ |
+ = note: see issue #79483 <https://github.com/rust-lang/rust/issues/79483> for more information
+ = help: add `#![feature(custom_code_classes_in_docs)]` to the crate attributes to enable
+ = note: found these custom classes: class=language-c
+
+warning: 1 warning emitted
+
diff --git a/tests/rustdoc-ui/issue-102467.rs b/tests/rustdoc-ui/issue-102467.rs
new file mode 100644
index 000000000..bff876e41
--- /dev/null
+++ b/tests/rustdoc-ui/issue-102467.rs
@@ -0,0 +1,15 @@
+// Regression test for <https://github.com/rust-lang/rust/issues/102467>.
+// It ensures that the expected error is displayed.
+
+#![feature(associated_const_equality)]
+
+trait T {
+ type A: S<C<X = 0i32> = 34>;
+ //~^ ERROR associated type bindings are not allowed here
+}
+
+trait S {
+ const C: i32;
+}
+
+fn main() {}
diff --git a/tests/rustdoc-ui/issue-102467.stderr b/tests/rustdoc-ui/issue-102467.stderr
new file mode 100644
index 000000000..a337293f7
--- /dev/null
+++ b/tests/rustdoc-ui/issue-102467.stderr
@@ -0,0 +1,9 @@
+error[E0229]: associated type bindings are not allowed here
+ --> $DIR/issue-102467.rs:7:17
+ |
+LL | type A: S<C<X = 0i32> = 34>;
+ | ^^^^^^^^ associated type not allowed here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0229`.
diff --git a/tests/rustdoc-ui/issues/issue-91713.stdout b/tests/rustdoc-ui/issues/issue-91713.stdout
index 167835243..bbea7e5c2 100644
--- a/tests/rustdoc-ui/issues/issue-91713.stdout
+++ b/tests/rustdoc-ui/issues/issue-91713.stdout
@@ -1,4 +1,5 @@
Available passes for running rustdoc:
+check-custom-code-classes - check for custom code classes without the feature-gate enabled
check_doc_test_visibility - run various visibility-related lints on doctests
strip-hidden - strips all `#[doc(hidden)]` items from the output
strip-private - strips all private items from a crate which cannot be seen externally, implies strip-priv-imports
@@ -10,6 +11,7 @@ calculate-doc-coverage - counts the number of items with and without documentati
run-lints - runs some of rustdoc's lints
Default passes for rustdoc:
+check-custom-code-classes
collect-trait-impls
check_doc_test_visibility
strip-hidden (when not --document-hidden-items)