about summary refs log tree commit diff
path: root/tests/ui/const-generics
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-07-04 10:27:00 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-07-11 11:00:15 +0000
commitdce98c52ff3e431d9b1358298fe8da9db545a3e2 (patch)
treeb4651ae12ed3a44a711f5257cdc11a37a6f65aea /tests/ui/const-generics
parent8c39ac9eccdfaeff11bd3b6107817a81fe0a3a43 (diff)
downloadrust-dce98c52ff3e431d9b1358298fe8da9db545a3e2.tar.gz
rust-dce98c52ff3e431d9b1358298fe8da9db545a3e2.zip
Avoid follow-up errors and ICEs after missing lifetime errors on data structures
Diffstat (limited to 'tests/ui/const-generics')
-rw-r--r--tests/ui/const-generics/issues/issue-71381.full.stderr18
-rw-r--r--tests/ui/const-generics/issues/issue-71381.min.stderr20
-rw-r--r--tests/ui/const-generics/issues/issue-71381.rs1
3 files changed, 7 insertions, 32 deletions
diff --git a/tests/ui/const-generics/issues/issue-71381.full.stderr b/tests/ui/const-generics/issues/issue-71381.full.stderr
index 05e847cf4c8..b6460e0017f 100644
--- a/tests/ui/const-generics/issues/issue-71381.full.stderr
+++ b/tests/ui/const-generics/issues/issue-71381.full.stderr
@@ -7,25 +7,13 @@ LL |     pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "
    = note: type parameters may not be used in the type of const parameters
 
 error[E0770]: the type of const parameters must not depend on other generic parameters
-  --> $DIR/issue-71381.rs:24:40
+  --> $DIR/issue-71381.rs:23:40
    |
 LL |         const FN: unsafe extern "C" fn(Args),
    |                                        ^^^^ the type must not depend on the parameter `Args`
    |
    = note: type parameters may not be used in the type of const parameters
 
-error[E0594]: cannot assign to `self.0`, which is behind a `&` reference
-  --> $DIR/issue-71381.rs:17:9
-   |
-LL |         self.0 = Self::trampiline::<Args, IDX, FN> as _
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be written
-   |
-help: consider changing this to be a mutable reference
-   |
-LL |     pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "C" fn(Args)>(&mut self) {
-   |                                                                                         ~~~~~~~~~
-
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
 
-Some errors have detailed explanations: E0594, E0770.
-For more information about an error, try `rustc --explain E0594`.
+For more information about this error, try `rustc --explain E0770`.
diff --git a/tests/ui/const-generics/issues/issue-71381.min.stderr b/tests/ui/const-generics/issues/issue-71381.min.stderr
index 1c30e885d1b..e16d3b7a8a4 100644
--- a/tests/ui/const-generics/issues/issue-71381.min.stderr
+++ b/tests/ui/const-generics/issues/issue-71381.min.stderr
@@ -7,7 +7,7 @@ LL |     pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "
    = note: type parameters may not be used in the type of const parameters
 
 error[E0770]: the type of const parameters must not depend on other generic parameters
-  --> $DIR/issue-71381.rs:24:40
+  --> $DIR/issue-71381.rs:23:40
    |
 LL |         const FN: unsafe extern "C" fn(Args),
    |                                        ^^^^ the type must not depend on the parameter `Args`
@@ -23,25 +23,13 @@ LL |     pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "
    = note: the only supported types are integers, `bool` and `char`
 
 error: using function pointers as const generic parameters is forbidden
-  --> $DIR/issue-71381.rs:24:19
+  --> $DIR/issue-71381.rs:23:19
    |
 LL |         const FN: unsafe extern "C" fn(Args),
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: the only supported types are integers, `bool` and `char`
 
-error[E0594]: cannot assign to `self.0`, which is behind a `&` reference
-  --> $DIR/issue-71381.rs:17:9
-   |
-LL |         self.0 = Self::trampiline::<Args, IDX, FN> as _
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be written
-   |
-help: consider changing this to be a mutable reference
-   |
-LL |     pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "C" fn(Args)>(&mut self) {
-   |                                                                                         ~~~~~~~~~
-
-error: aborting due to 5 previous errors
+error: aborting due to 4 previous errors
 
-Some errors have detailed explanations: E0594, E0770.
-For more information about an error, try `rustc --explain E0594`.
+For more information about this error, try `rustc --explain E0770`.
diff --git a/tests/ui/const-generics/issues/issue-71381.rs b/tests/ui/const-generics/issues/issue-71381.rs
index 166b724a7a3..e472ef31fcd 100644
--- a/tests/ui/const-generics/issues/issue-71381.rs
+++ b/tests/ui/const-generics/issues/issue-71381.rs
@@ -15,7 +15,6 @@ impl Test {
         //~^ ERROR: the type of const parameters must not depend on other generic parameters
         //[min]~^^ ERROR: using function pointers as const generic parameters is forbidden
         self.0 = Self::trampiline::<Args, IDX, FN> as _
-        //~^ ERROR: cannot assign to `self.0`
     }
 
     unsafe extern "C" fn trampiline<