From 76cac7d05f71b1c57ba9465cb833416f002523d8 Mon Sep 17 00:00:00 2001 From: ViggoC Date: Mon, 28 Apr 2025 00:20:49 +0800 Subject: [PATCH] Non-tail recursive call note in testcase_linked_list --- src/custom_types/enum/testcase_linked_list.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/custom_types/enum/testcase_linked_list.md b/src/custom_types/enum/testcase_linked_list.md index cd4e3e6202..8c41ed7c63 100644 --- a/src/custom_types/enum/testcase_linked_list.md +++ b/src/custom_types/enum/testcase_linked_list.md @@ -38,6 +38,7 @@ impl List { match *self { // Can't take ownership of the tail, because `self` is borrowed; // instead take a reference to the tail + // And it'a a non-tail recursive call which may cause stack overflow for long lists. Cons(_, ref tail) => 1 + tail.len(), // Base Case: An empty list has zero length Nil => 0