about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2024-11-20 03:00:58 +0000
committerEsteban Küber <esteban@kuber.com.ar>2024-12-04 20:29:36 +0000
commitc0f00086f85ae1fff34dd2daf6a11850e5bfc2f0 (patch)
tree9477fd545dd22cb58a101887f807fc12dd36f129 /tests
parentcc492edc9d65125a25a42446bbffefb8087dedf1 (diff)
downloadrust-c0f00086f85ae1fff34dd2daf6a11850e5bfc2f0.tar.gz
rust-c0f00086f85ae1fff34dd2daf6a11850e5bfc2f0.zip
Tweak ptr in pattern error
Conform to error style guide.
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/consts/const_in_pattern/issue-34784-match-on-non-int-raw-ptr.stderr24
-rw-r--r--tests/ui/consts/const_in_pattern/issue-44333.stderr12
-rw-r--r--tests/ui/pattern/usefulness/consts-opaque.stderr48
-rw-r--r--tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/fn-ptr-is-not-structurally-matchable.stderr60
-rw-r--r--tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.stderr12
5 files changed, 104 insertions, 52 deletions
diff --git a/tests/ui/consts/const_in_pattern/issue-34784-match-on-non-int-raw-ptr.stderr b/tests/ui/consts/const_in_pattern/issue-34784-match-on-non-int-raw-ptr.stderr
index cc7ec771e6c..0453a88e43d 100644
--- a/tests/ui/consts/const_in_pattern/issue-34784-match-on-non-int-raw-ptr.stderr
+++ b/tests/ui/consts/const_in_pattern/issue-34784-match-on-non-int-raw-ptr.stderr
@@ -1,38 +1,46 @@
-error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon
   --> $DIR/issue-34784-match-on-non-int-raw-ptr.rs:9:9
    |
 LL | const C: *const u8 = &0;
    | ------------------ constant defined here
 ...
 LL |         C => {}
-   |         ^
+   |         ^ can't be used in patterns
+   |
+   = note: see https://github.com/rust-lang/rust/issues/70861 for details
 
-error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon
   --> $DIR/issue-34784-match-on-non-int-raw-ptr.rs:16:9
    |
 LL | const C_INNER: (*const u8, u8) = (C, 0);
    | ------------------------------ constant defined here
 ...
 LL |         C_INNER => {}
-   |         ^^^^^^^
+   |         ^^^^^^^ can't be used in patterns
+   |
+   = note: see https://github.com/rust-lang/rust/issues/70861 for details
 
-error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon
   --> $DIR/issue-34784-match-on-non-int-raw-ptr.rs:27:9
    |
 LL | const D: *const [u8; 4] = b"abcd";
    | ----------------------- constant defined here
 ...
 LL |         D => {}
-   |         ^
+   |         ^ can't be used in patterns
+   |
+   = note: see https://github.com/rust-lang/rust/issues/70861 for details
 
-error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon
   --> $DIR/issue-34784-match-on-non-int-raw-ptr.rs:32:9
    |
 LL | const STR: *const str = "abcd";
    | --------------------- constant defined here
 ...
 LL |         STR => {}
-   |         ^^^
+   |         ^^^ can't be used in patterns
+   |
+   = note: see https://github.com/rust-lang/rust/issues/70861 for details
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/consts/const_in_pattern/issue-44333.stderr b/tests/ui/consts/const_in_pattern/issue-44333.stderr
index 81393952f0f..61b45377c76 100644
--- a/tests/ui/consts/const_in_pattern/issue-44333.stderr
+++ b/tests/ui/consts/const_in_pattern/issue-44333.stderr
@@ -1,20 +1,24 @@
-error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon
   --> $DIR/issue-44333.rs:15:9
    |
 LL | const FOO: Func = foo;
    | --------------- constant defined here
 ...
 LL |         FOO => println!("foo"),
-   |         ^^^
+   |         ^^^ can't be used in patterns
+   |
+   = note: see https://github.com/rust-lang/rust/issues/70861 for details
 
-error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon
   --> $DIR/issue-44333.rs:16:9
    |
 LL | const BAR: Func = bar;
    | --------------- constant defined here
 ...
 LL |         BAR => println!("bar"),
-   |         ^^^
+   |         ^^^ can't be used in patterns
+   |
+   = note: see https://github.com/rust-lang/rust/issues/70861 for details
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/pattern/usefulness/consts-opaque.stderr b/tests/ui/pattern/usefulness/consts-opaque.stderr
index 15aa1769662..d52451d9438 100644
--- a/tests/ui/pattern/usefulness/consts-opaque.stderr
+++ b/tests/ui/pattern/usefulness/consts-opaque.stderr
@@ -1,74 +1,90 @@
-error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon
   --> $DIR/consts-opaque.rs:96:9
    |
 LL |     const QUUX: Quux = quux;
    |     ---------------- constant defined here
 ...
 LL |         QUUX => {}
-   |         ^^^^
+   |         ^^^^ can't be used in patterns
+   |
+   = note: see https://github.com/rust-lang/rust/issues/70861 for details
 
-error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon
   --> $DIR/consts-opaque.rs:97:9
    |
 LL |     const QUUX: Quux = quux;
    |     ---------------- constant defined here
 ...
 LL |         QUUX => {}
-   |         ^^^^
+   |         ^^^^ can't be used in patterns
+   |
+   = note: see https://github.com/rust-lang/rust/issues/70861 for details
 
-error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon
   --> $DIR/consts-opaque.rs:106:9
    |
 LL |     const WRAPQUUX: Wrap<Quux> = Wrap(quux);
    |     -------------------------- constant defined here
 ...
 LL |         WRAPQUUX => {}
-   |         ^^^^^^^^
+   |         ^^^^^^^^ can't be used in patterns
+   |
+   = note: see https://github.com/rust-lang/rust/issues/70861 for details
 
-error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon
   --> $DIR/consts-opaque.rs:107:9
    |
 LL |     const WRAPQUUX: Wrap<Quux> = Wrap(quux);
    |     -------------------------- constant defined here
 ...
 LL |         WRAPQUUX => {}
-   |         ^^^^^^^^
+   |         ^^^^^^^^ can't be used in patterns
+   |
+   = note: see https://github.com/rust-lang/rust/issues/70861 for details
 
-error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon
   --> $DIR/consts-opaque.rs:113:9
    |
 LL |     const WRAPQUUX: Wrap<Quux> = Wrap(quux);
    |     -------------------------- constant defined here
 ...
 LL |         WRAPQUUX => {}
-   |         ^^^^^^^^
+   |         ^^^^^^^^ can't be used in patterns
+   |
+   = note: see https://github.com/rust-lang/rust/issues/70861 for details
 
-error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon
   --> $DIR/consts-opaque.rs:121:9
    |
 LL |     const WRAPQUUX: Wrap<Quux> = Wrap(quux);
    |     -------------------------- constant defined here
 ...
 LL |         WRAPQUUX => {}
-   |         ^^^^^^^^
+   |         ^^^^^^^^ can't be used in patterns
+   |
+   = note: see https://github.com/rust-lang/rust/issues/70861 for details
 
-error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon
   --> $DIR/consts-opaque.rs:132:9
    |
 LL |     const WHOKNOWSQUUX: WhoKnows<Quux> = WhoKnows::Yay(quux);
    |     ---------------------------------- constant defined here
 ...
 LL |         WHOKNOWSQUUX => {}
-   |         ^^^^^^^^^^^^
+   |         ^^^^^^^^^^^^ can't be used in patterns
+   |
+   = note: see https://github.com/rust-lang/rust/issues/70861 for details
 
-error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon
   --> $DIR/consts-opaque.rs:134:9
    |
 LL |     const WHOKNOWSQUUX: WhoKnows<Quux> = WhoKnows::Yay(quux);
    |     ---------------------------------- constant defined here
 ...
 LL |         WHOKNOWSQUUX => {}
-   |         ^^^^^^^^^^^^
+   |         ^^^^^^^^^^^^ can't be used in patterns
+   |
+   = note: see https://github.com/rust-lang/rust/issues/70861 for details
 
 error: unreachable pattern
   --> $DIR/consts-opaque.rs:48:9
diff --git a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/fn-ptr-is-not-structurally-matchable.stderr b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/fn-ptr-is-not-structurally-matchable.stderr
index ee6f44a364d..cdbe72ca48f 100644
--- a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/fn-ptr-is-not-structurally-matchable.stderr
+++ b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/fn-ptr-is-not-structurally-matchable.stderr
@@ -1,92 +1,112 @@
-error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon
   --> $DIR/fn-ptr-is-not-structurally-matchable.rs:41:14
    |
 LL |     const CFN1: Wrap<fn()> = Wrap(trivial);
    |     ---------------------- constant defined here
 ...
 LL |         Wrap(CFN1) => count += 1,
-   |              ^^^^
+   |              ^^^^ can't be used in patterns
+   |
+   = note: see https://github.com/rust-lang/rust/issues/70861 for details
 
-error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon
   --> $DIR/fn-ptr-is-not-structurally-matchable.rs:49:14
    |
 LL |     const CFN2: Wrap<fn(SM)> = Wrap(sm_to);
    |     ------------------------ constant defined here
 ...
 LL |         Wrap(CFN2) => count += 1,
-   |              ^^^^
+   |              ^^^^ can't be used in patterns
+   |
+   = note: see https://github.com/rust-lang/rust/issues/70861 for details
 
-error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon
   --> $DIR/fn-ptr-is-not-structurally-matchable.rs:57:14
    |
 LL |     const CFN3: Wrap<fn() -> SM> = Wrap(to_sm);
    |     ---------------------------- constant defined here
 ...
 LL |         Wrap(CFN3) => count += 1,
-   |              ^^^^
+   |              ^^^^ can't be used in patterns
+   |
+   = note: see https://github.com/rust-lang/rust/issues/70861 for details
 
-error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon
   --> $DIR/fn-ptr-is-not-structurally-matchable.rs:65:14
    |
 LL |     const CFN4: Wrap<fn(NotSM)> = Wrap(not_sm_to);
    |     --------------------------- constant defined here
 ...
 LL |         Wrap(CFN4) => count += 1,
-   |              ^^^^
+   |              ^^^^ can't be used in patterns
+   |
+   = note: see https://github.com/rust-lang/rust/issues/70861 for details
 
-error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon
   --> $DIR/fn-ptr-is-not-structurally-matchable.rs:73:14
    |
 LL |     const CFN5: Wrap<fn() -> NotSM> = Wrap(to_not_sm);
    |     ------------------------------- constant defined here
 ...
 LL |         Wrap(CFN5) => count += 1,
-   |              ^^^^
+   |              ^^^^ can't be used in patterns
+   |
+   = note: see https://github.com/rust-lang/rust/issues/70861 for details
 
-error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon
   --> $DIR/fn-ptr-is-not-structurally-matchable.rs:81:14
    |
 LL |     const CFN6: Wrap<fn(&SM)> = Wrap(r_sm_to);
    |     ------------------------- constant defined here
 ...
 LL |         Wrap(CFN6) => count += 1,
-   |              ^^^^
+   |              ^^^^ can't be used in patterns
+   |
+   = note: see https://github.com/rust-lang/rust/issues/70861 for details
 
-error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon
   --> $DIR/fn-ptr-is-not-structurally-matchable.rs:89:14
    |
 LL |     const CFN7: Wrap<fn(&()) -> &SM> = Wrap(r_to_r_sm);
    |     -------------------------------- constant defined here
 ...
 LL |         Wrap(CFN7) => count += 1,
-   |              ^^^^
+   |              ^^^^ can't be used in patterns
+   |
+   = note: see https://github.com/rust-lang/rust/issues/70861 for details
 
-error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon
   --> $DIR/fn-ptr-is-not-structurally-matchable.rs:97:14
    |
 LL |     const CFN8: Wrap<fn(&NotSM)> = Wrap(r_not_sm_to);
    |     ---------------------------- constant defined here
 ...
 LL |         Wrap(CFN8) => count += 1,
-   |              ^^^^
+   |              ^^^^ can't be used in patterns
+   |
+   = note: see https://github.com/rust-lang/rust/issues/70861 for details
 
-error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon
   --> $DIR/fn-ptr-is-not-structurally-matchable.rs:105:14
    |
 LL |     const CFN9: Wrap<fn(&()) -> &NotSM> = Wrap(r_to_r_not_sm);
    |     ----------------------------------- constant defined here
 ...
 LL |         Wrap(CFN9) => count += 1,
-   |              ^^^^
+   |              ^^^^ can't be used in patterns
+   |
+   = note: see https://github.com/rust-lang/rust/issues/70861 for details
 
-error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon
   --> $DIR/fn-ptr-is-not-structurally-matchable.rs:127:9
    |
 LL |     const CFOO: Foo = Foo {
    |     --------------- constant defined here
 ...
 LL |         CFOO => count += 1,
-   |         ^^^^
+   |         ^^^^ can't be used in patterns
+   |
+   = note: see https://github.com/rust-lang/rust/issues/70861 for details
 
 error: aborting due to 10 previous errors
 
diff --git a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.stderr b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.stderr
index be735ccab0a..ea6121839be 100644
--- a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.stderr
+++ b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.stderr
@@ -1,20 +1,24 @@
-error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon
   --> $DIR/issue-63479-match-fnptr.rs:32:7
    |
 LL | const TEST: Fn = my_fn;
    | -------------- constant defined here
 ...
 LL |     B(TEST) => println!("matched"),
-   |       ^^^^
+   |       ^^^^ can't be used in patterns
+   |
+   = note: see https://github.com/rust-lang/rust/issues/70861 for details
 
-error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon. See https://github.com/rust-lang/rust/issues/70861 for details.
+error: function pointers and raw pointers not derived from integers in patterns behave unpredictably and should not be relied upon
   --> $DIR/issue-63479-match-fnptr.rs:37:5
    |
 LL | const TEST2: (Fn, u8) = (TEST, 0);
    | --------------------- constant defined here
 ...
 LL |     TEST2 => println!("matched"),
-   |     ^^^^^
+   |     ^^^^^ can't be used in patterns
+   |
+   = note: see https://github.com/rust-lang/rust/issues/70861 for details
 
 error: aborting due to 2 previous errors