summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_error_codes/src/error_codes/E0055.md
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /compiler/rustc_error_codes/src/error_codes/E0055.md
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_error_codes/src/error_codes/E0055.md')
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0055.md28
1 files changed, 28 insertions, 0 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0055.md b/compiler/rustc_error_codes/src/error_codes/E0055.md
new file mode 100644
index 000000000..223ba4000
--- /dev/null
+++ b/compiler/rustc_error_codes/src/error_codes/E0055.md
@@ -0,0 +1,28 @@
+During a method call, a value is automatically dereferenced as many times as
+needed to make the value's type match the method's receiver. The catch is that
+the compiler will only attempt to dereference a number of times up to the
+recursion limit (which can be set via the `recursion_limit` attribute).
+
+For a somewhat artificial example:
+
+```compile_fail,E0055
+#![recursion_limit="4"]
+
+struct Foo;
+
+impl Foo {
+ fn foo(&self) {}
+}
+
+fn main() {
+ let foo = Foo;
+ let ref_foo = &&&&&Foo;
+
+ // error, reached the recursion limit while auto-dereferencing `&&&&&Foo`
+ ref_foo.foo();
+}
+```
+
+One fix may be to increase the recursion limit. Note that it is possible to
+create an infinite recursion of dereferencing, in which case the only fix is to
+somehow break the recursion.