summaryrefslogtreecommitdiffstats
path: root/tests/ui/methods/field-method-suggestion-using-return-ty.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/methods/field-method-suggestion-using-return-ty.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/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() {}