summaryrefslogtreecommitdiffstats
path: root/tests/ui/methods/field-method-suggestion-using-return-ty.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/methods/field-method-suggestion-using-return-ty.rs')
-rw-r--r--tests/ui/methods/field-method-suggestion-using-return-ty.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/ui/methods/field-method-suggestion-using-return-ty.rs b/tests/ui/methods/field-method-suggestion-using-return-ty.rs
new file mode 100644
index 000000000..07b975c44
--- /dev/null
+++ b/tests/ui/methods/field-method-suggestion-using-return-ty.rs
@@ -0,0 +1,18 @@
+struct Wrapper<T>(T);
+
+impl Wrapper<Option<i32>> {
+ fn inner_mut(&self) -> Option<&mut i32> {
+ self.as_mut()
+ //~^ ERROR no method named `as_mut` found for reference `&Wrapper<Option<i32>>` in the current scope
+ //~| HELP one of the expressions' fields has a method of the same name
+ //~| HELP items from traits can only be used if
+ }
+
+ fn inner_mut_bad(&self) -> Option<&mut u32> {
+ self.as_mut()
+ //~^ ERROR no method named `as_mut` found for reference `&Wrapper<Option<i32>>` in the current scope
+ //~| HELP items from traits can only be used if
+ }
+}
+
+fn main() {}