summaryrefslogtreecommitdiffstats
path: root/tests/ui/suggestions/assoc-ct-for-assoc-method.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:58 +0000
commita4b7ed7a42c716ab9f05e351f003d589124fd55d (patch)
treeb620cd3f223850b28716e474e80c58059dca5dd4 /tests/ui/suggestions/assoc-ct-for-assoc-method.rs
parentAdding upstream version 1.67.1+dfsg1. (diff)
downloadrustc-a4b7ed7a42c716ab9f05e351f003d589124fd55d.tar.xz
rustc-a4b7ed7a42c716ab9f05e351f003d589124fd55d.zip
Adding upstream version 1.68.2+dfsg1.upstream/1.68.2+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/suggestions/assoc-ct-for-assoc-method.rs')
-rw-r--r--tests/ui/suggestions/assoc-ct-for-assoc-method.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/ui/suggestions/assoc-ct-for-assoc-method.rs b/tests/ui/suggestions/assoc-ct-for-assoc-method.rs
new file mode 100644
index 000000000..fe2227769
--- /dev/null
+++ b/tests/ui/suggestions/assoc-ct-for-assoc-method.rs
@@ -0,0 +1,25 @@
+struct MyS;
+
+impl MyS {
+ const FOO: i32 = 1;
+ fn foo() -> MyS {
+ MyS
+ }
+}
+
+fn main() {
+ let x: i32 = MyS::foo;
+ //~^ ERROR mismatched types
+ //~| HELP try referring to the
+
+ let z: i32 = i32::max;
+ //~^ ERROR mismatched types
+ //~| HELP try referring to the
+
+ // This example is still broken though... This is a hard suggestion to make,
+ // because we don't have access to the associated const probing code to make
+ // this suggestion where it's emitted, i.e. in trait selection.
+ let y: i32 = i32::max - 42;
+ //~^ ERROR cannot subtract
+ //~| HELP use parentheses
+}