about summary refs log tree commit diff
path: root/tests/ui/consts
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2025-04-11 10:10:06 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2025-04-11 11:03:08 +1000
commit7e8184fa2a712356f1827c8abc01bafcd359b122 (patch)
tree2a9d6c6ed41d01a277877631565179171725c5fa /tests/ui/consts
parent2205455d444f5f9da3a52e50f43c0306480218fb (diff)
downloadrust-7e8184fa2a712356f1827c8abc01bafcd359b122.tar.gz
rust-7e8184fa2a712356f1827c8abc01bafcd359b122.zip
Improve `AssocItem::descr`.
The commit adds "associated" to the description of associated types and
associated consts, to match the description of associated functions.
This increases error message precision and consistency with
`AssocKind::fmt`.

The commit also notes an imperfection in `AssocKind::fmt`; fixing this
imperfection is possible but beyond the scope of this PR.
Diffstat (limited to 'tests/ui/consts')
-rw-r--r--tests/ui/consts/static-default-lifetime/elided-lifetime.rs2
-rw-r--r--tests/ui/consts/static-default-lifetime/elided-lifetime.stderr6
-rw-r--r--tests/ui/consts/static-default-lifetime/static-trait-impl.rs2
-rw-r--r--tests/ui/consts/static-default-lifetime/static-trait-impl.stderr6
4 files changed, 8 insertions, 8 deletions
diff --git a/tests/ui/consts/static-default-lifetime/elided-lifetime.rs b/tests/ui/consts/static-default-lifetime/elided-lifetime.rs
index ccf63f86fcf..d60fe7d409a 100644
--- a/tests/ui/consts/static-default-lifetime/elided-lifetime.rs
+++ b/tests/ui/consts/static-default-lifetime/elided-lifetime.rs
@@ -16,7 +16,7 @@ impl Bar for Foo<'_> {
     const STATIC: &str = "";
     //~^ ERROR `&` without an explicit lifetime name cannot be used here
     //~| WARN this was previously accepted by the compiler but is being phased out
-    //~| ERROR lifetime parameters or bounds on const `STATIC` do not match the trait declaration
+    //~| ERROR lifetime parameters or bounds on associated const `STATIC` do not match the trait declaration
 }
 
 fn main() {}
diff --git a/tests/ui/consts/static-default-lifetime/elided-lifetime.stderr b/tests/ui/consts/static-default-lifetime/elided-lifetime.stderr
index 33873f5c5a5..bb8365b0ae5 100644
--- a/tests/ui/consts/static-default-lifetime/elided-lifetime.stderr
+++ b/tests/ui/consts/static-default-lifetime/elided-lifetime.stderr
@@ -39,14 +39,14 @@ help: use the `'static` lifetime
 LL |     const STATIC: &'static str = "";
    |                    +++++++
 
-error[E0195]: lifetime parameters or bounds on const `STATIC` do not match the trait declaration
+error[E0195]: lifetime parameters or bounds on associated const `STATIC` do not match the trait declaration
   --> $DIR/elided-lifetime.rs:16:17
    |
 LL |     const STATIC: &str;
-   |                 - lifetimes in impl do not match this const in trait
+   |                 - lifetimes in impl do not match this associated const in trait
 ...
 LL |     const STATIC: &str = "";
-   |                 ^ lifetimes do not match const in trait
+   |                 ^ lifetimes do not match associated const in trait
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/consts/static-default-lifetime/static-trait-impl.rs b/tests/ui/consts/static-default-lifetime/static-trait-impl.rs
index 1e12259e483..85746df146f 100644
--- a/tests/ui/consts/static-default-lifetime/static-trait-impl.rs
+++ b/tests/ui/consts/static-default-lifetime/static-trait-impl.rs
@@ -9,7 +9,7 @@ impl Bar<'_> for A {
     const STATIC: &str = "";
     //~^ ERROR `&` without an explicit lifetime name cannot be used here
     //~| WARN this was previously accepted by the compiler but is being phased out
-    //~| ERROR lifetime parameters or bounds on const `STATIC` do not match the trait declaration
+    //~| ERROR lifetime parameters or bounds on associated const `STATIC` do not match the trait declaration
 }
 
 struct B;
diff --git a/tests/ui/consts/static-default-lifetime/static-trait-impl.stderr b/tests/ui/consts/static-default-lifetime/static-trait-impl.stderr
index 116f28e8484..38d24db1317 100644
--- a/tests/ui/consts/static-default-lifetime/static-trait-impl.stderr
+++ b/tests/ui/consts/static-default-lifetime/static-trait-impl.stderr
@@ -21,14 +21,14 @@ help: use the `'static` lifetime
 LL |     const STATIC: &'static str = "";
    |                    +++++++
 
-error[E0195]: lifetime parameters or bounds on const `STATIC` do not match the trait declaration
+error[E0195]: lifetime parameters or bounds on associated const `STATIC` do not match the trait declaration
   --> $DIR/static-trait-impl.rs:9:17
    |
 LL |     const STATIC: &'a str;
-   |                 - lifetimes in impl do not match this const in trait
+   |                 - lifetimes in impl do not match this associated const in trait
 ...
 LL |     const STATIC: &str = "";
-   |                 ^ lifetimes do not match const in trait
+   |                 ^ lifetimes do not match associated const in trait
 
 error: aborting due to 2 previous errors