summaryrefslogtreecommitdiffstats
path: root/tests/ui/suggestions/assoc-ct-for-assoc-method.rs
diff options
context:
space:
mode:
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
+}