Skip to content

Non-tail recursive call note in testcase_linked_list.md #1924

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 29, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/custom_types/enum/testcase_linked_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down