5

Ignore unwinding edges when checking for unconditional recursion by tmiasko · Pu...

 2 years ago
source link: https://github.com/rust-lang/rust/pull/92889
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Copy link

Contributor

tmiasko commented on Jan 14

edited

The unconditional recursion lint determines if all execution paths
eventually lead to a self-recursive call.

The implementation always follows unwinding edges which limits its
practical utility. For example, it would not lint function f because a
call to g might unwind. It also wouldn't lint function h because an
overflow check preceding the self-recursive call might unwind:

pub fn f() {
    g();
    f();
}

pub fn g() { /* ... */ }

pub fn h(a: usize) {
  h(a + 1);
}

To avoid the issue, assume that terminators that might continue
execution along non-unwinding edges do so.

Fixes #78474.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK