about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/rustdoc-ui/intra-doc/import-inline-merge.rs16
-rw-r--r--tests/rustdoc/async-fn-opaque-item.rs15
-rw-r--r--tests/ui/lexer/issue-108019-bad-emoji-recovery.rs45
-rw-r--r--tests/ui/lexer/issue-108019-bad-emoji-recovery.stderr86
-rw-r--r--tests/ui/mir/issue-109743.rs51
-rw-r--r--tests/ui/parser/numeric-lifetime.rs4
-rw-r--r--tests/ui/parser/numeric-lifetime.stderr4
7 files changed, 86 insertions, 135 deletions
diff --git a/tests/rustdoc-ui/intra-doc/import-inline-merge.rs b/tests/rustdoc-ui/intra-doc/import-inline-merge.rs
new file mode 100644
index 00000000000..31fef032b0f
--- /dev/null
+++ b/tests/rustdoc-ui/intra-doc/import-inline-merge.rs
@@ -0,0 +1,16 @@
+// Import for `A` is inlined and doc comments on the import and `A` itself are merged.
+// After the merge they still have correct parent scopes to resolve both `[A]` and `[B]`.
+
+// check-pass
+
+#![allow(rustdoc::private_intra_doc_links)]
+
+mod m {
+    /// [B]
+    pub struct A {}
+
+    pub struct B {}
+}
+
+/// [A]
+pub use m::A;
diff --git a/tests/rustdoc/async-fn-opaque-item.rs b/tests/rustdoc/async-fn-opaque-item.rs
new file mode 100644
index 00000000000..a73e84f3fdc
--- /dev/null
+++ b/tests/rustdoc/async-fn-opaque-item.rs
@@ -0,0 +1,15 @@
+// compile-flags: --document-private-items --crate-type=lib
+// edition: 2021
+
+// Issue 109931 -- test against accidentally documenting the `impl Future`
+// that comes from an async fn desugaring.
+
+// Check that we don't document an unnamed opaque type
+// @!has async_fn_opaque_item/opaque..html
+
+// Checking there is only a "Functions" header and no "Opaque types".
+// @has async_fn_opaque_item/index.html
+// @count - '//*[@class="small-section-header"]' 1
+// @has - '//*[@class="small-section-header"]' 'Functions'
+
+pub async fn test() {}
diff --git a/tests/ui/lexer/issue-108019-bad-emoji-recovery.rs b/tests/ui/lexer/issue-108019-bad-emoji-recovery.rs
deleted file mode 100644
index f0f86224560..00000000000
--- a/tests/ui/lexer/issue-108019-bad-emoji-recovery.rs
+++ /dev/null
@@ -1,45 +0,0 @@
-#![allow(unused_labels)]
-
-// FIXME(#108019): outdated Unicode table
-// fn foo() {
-//     '🥺 loop {
-//         break
-//     }
-// }
-
-fn bar() {
-    '🐱 loop {
-    //~^ ERROR labeled expression must be followed by `:`
-    //~| ERROR lifetimes or labels cannot contain emojis
-        break
-    }
-}
-
-fn qux() {
-    'a🐱 loop {
-    //~^ ERROR labeled expression must be followed by `:`
-    //~| ERROR lifetimes or labels cannot contain emojis
-        break
-    }
-}
-
-fn quux() {
-    '1🐱 loop {
-    //~^ ERROR labeled expression must be followed by `:`
-    //~| ERROR lifetimes or labels cannot start with a number
-        break
-    }
-}
-
-fn x<'🐱>() -> &'🐱 () {
-    //~^ ERROR lifetimes or labels cannot contain emojis
-    //~| ERROR lifetimes or labels cannot contain emojis
-    &()
-}
-
-fn y() {
-    'a🐱: loop {}
-    //~^ ERROR lifetimes or labels cannot contain emojis
-}
-
-fn main() {}
diff --git a/tests/ui/lexer/issue-108019-bad-emoji-recovery.stderr b/tests/ui/lexer/issue-108019-bad-emoji-recovery.stderr
deleted file mode 100644
index be77ffdea34..00000000000
--- a/tests/ui/lexer/issue-108019-bad-emoji-recovery.stderr
+++ /dev/null
@@ -1,86 +0,0 @@
-error: labeled expression must be followed by `:`
-  --> $DIR/issue-108019-bad-emoji-recovery.rs:11:5
-   |
-LL |       '🐱 loop {
-   |       ^--- help: add `:` after the label
-   |       |
-   |  _____the label
-   | |
-LL | |
-LL | |
-LL | |         break
-LL | |     }
-   | |_____^
-   |
-   = note: labels are used before loops and blocks, allowing e.g., `break 'label` to them
-
-error: labeled expression must be followed by `:`
-  --> $DIR/issue-108019-bad-emoji-recovery.rs:19:5
-   |
-LL |       'a🐱 loop {
-   |       ^---- help: add `:` after the label
-   |       |
-   |  _____the label
-   | |
-LL | |
-LL | |
-LL | |         break
-LL | |     }
-   | |_____^
-   |
-   = note: labels are used before loops and blocks, allowing e.g., `break 'label` to them
-
-error: labeled expression must be followed by `:`
-  --> $DIR/issue-108019-bad-emoji-recovery.rs:27:5
-   |
-LL |       '1🐱 loop {
-   |       ^---- help: add `:` after the label
-   |       |
-   |  _____the label
-   | |
-LL | |
-LL | |
-LL | |         break
-LL | |     }
-   | |_____^
-   |
-   = note: labels are used before loops and blocks, allowing e.g., `break 'label` to them
-
-error: lifetimes or labels cannot contain emojis
-  --> $DIR/issue-108019-bad-emoji-recovery.rs:11:5
-   |
-LL |     '🐱 loop {
-   |     ^^^
-
-error: lifetimes or labels cannot contain emojis
-  --> $DIR/issue-108019-bad-emoji-recovery.rs:19:5
-   |
-LL |     'a🐱 loop {
-   |     ^^^^
-
-error: lifetimes or labels cannot start with a number
-  --> $DIR/issue-108019-bad-emoji-recovery.rs:27:5
-   |
-LL |     '1🐱 loop {
-   |     ^^^^
-
-error: lifetimes or labels cannot contain emojis
-  --> $DIR/issue-108019-bad-emoji-recovery.rs:34:6
-   |
-LL | fn x<'🐱>() -> &'🐱 () {
-   |      ^^^
-
-error: lifetimes or labels cannot contain emojis
-  --> $DIR/issue-108019-bad-emoji-recovery.rs:34:16
-   |
-LL | fn x<'🐱>() -> &'🐱 () {
-   |                 ^^^
-
-error: lifetimes or labels cannot contain emojis
-  --> $DIR/issue-108019-bad-emoji-recovery.rs:41:5
-   |
-LL |     'a🐱: loop {}
-   |     ^^^^
-
-error: aborting due to 9 previous errors
-
diff --git a/tests/ui/mir/issue-109743.rs b/tests/ui/mir/issue-109743.rs
new file mode 100644
index 00000000000..73f3405e3ad
--- /dev/null
+++ b/tests/ui/mir/issue-109743.rs
@@ -0,0 +1,51 @@
+// build-pass
+// compile-flags: --crate-type=lib
+
+use std::marker::PhantomData;
+
+pub trait StreamOnce {
+    type Token;
+}
+
+impl StreamOnce for &str {
+    type Token = ();
+}
+
+pub trait Parser<Input: StreamOnce> {
+    type PartialState: Default;
+    fn parse_mode(&self, _state: &Self::PartialState) {}
+    fn parse_mode_impl() {}
+}
+
+pub fn parse_bool<'a>() -> impl Parser<&'a str> {
+    pub struct TokensCmp<C, Input>
+    where
+        Input: StreamOnce,
+    {
+        _cmp: C,
+        _marker: PhantomData<Input>,
+    }
+
+    impl<Input, C> Parser<Input> for TokensCmp<C, Input>
+    where
+        C: FnMut(Input::Token),
+        Input: StreamOnce,
+    {
+        type PartialState = ();
+    }
+
+    TokensCmp { _cmp: |_| (), _marker: PhantomData }
+}
+
+pub struct ParseBool;
+
+impl<'a> Parser<&'a str> for ParseBool
+where
+    &'a str: StreamOnce,
+{
+    type PartialState = ();
+
+    fn parse_mode_impl() {
+        parse_bool().parse_mode(&Default::default())
+    }
+}
diff --git a/tests/ui/parser/numeric-lifetime.rs b/tests/ui/parser/numeric-lifetime.rs
index a082a8a44df..2d82354c62c 100644
--- a/tests/ui/parser/numeric-lifetime.rs
+++ b/tests/ui/parser/numeric-lifetime.rs
@@ -1,6 +1,6 @@
 struct S<'1> { s: &'1 usize }
-//~^ ERROR lifetimes or labels cannot start with a number
-//~| ERROR lifetimes or labels cannot start with a number
+//~^ ERROR lifetimes cannot start with a number
+//~| ERROR lifetimes cannot start with a number
 fn main() {
     // verify that the parse error doesn't stop type checking
     let x: usize = "";
diff --git a/tests/ui/parser/numeric-lifetime.stderr b/tests/ui/parser/numeric-lifetime.stderr
index 66e35dca923..7c1bcb72631 100644
--- a/tests/ui/parser/numeric-lifetime.stderr
+++ b/tests/ui/parser/numeric-lifetime.stderr
@@ -6,13 +6,13 @@ LL |     let x: usize = "";
    |            |
    |            expected due to this
 
-error: lifetimes or labels cannot start with a number
+error: lifetimes cannot start with a number
   --> $DIR/numeric-lifetime.rs:1:10
    |
 LL | struct S<'1> { s: &'1 usize }
    |          ^^
 
-error: lifetimes or labels cannot start with a number
+error: lifetimes cannot start with a number
   --> $DIR/numeric-lifetime.rs:1:20
    |
 LL | struct S<'1> { s: &'1 usize }