You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use std;
fn ack(m: int, n: int) -> int {
if m == 0 {
ret n + 1
} else {
if n == 0 {
ret ack(m - 1, 1)
} else {
ret ack(m - 1, ack(m, n - 1));
}
}
}
fn main(args: [str]) {
// FIXME: #1527
sys::set_min_stack(1000000u);
let n = if vec::len(args) == 2u {
int::from_str(args[1])
} else {
12
};
std::io::println(#fmt("Ack(3,%d): %d\n", n, ack(3, n)));
}
This takes 5.5s:
use std;
fn ack(m: int, n: int) -> int {
if m == 0 {
n + 1
} else {
if n == 0 {
ack(m - 1, 1)
} else {
ack(m - 1, ack(m, n - 1))
}
}
}
fn main(args: [str]) {
// FIXME: #1527
sys::set_min_stack(1000000u);
let n = if vec::len(args) == 2u {
int::from_str(args[1])
} else {
12
};
std::io::println(#fmt("Ack(3,%d): %d\n", n, ack(3, n)));
}
The text was updated successfully, but these errors were encountered:
For now I just moved the reachability code to this new module. As a follow up PR, I am planning to move the unsized coercion related code into a separate module so it can be used to refactor and fix codegen casting logic (related issues rust-lang#1531, rust-lang#566, and rust-lang#1528) .
celinval
added a commit
to celinval/rust-dev
that referenced
this issue
Jun 4, 2024
We currently have a few issues with how we are generating code for casting (rust-lang#566, and rust-lang#1528). The structure of the code is also hard to understand and maintain (see rust-lang#1531 for more details).
This PR is the first part of the fix I developed. This change moves the coercion specific code to its own module and it introduces an iterator that traverses the coercion path.
celinval
added a commit
to celinval/rust-dev
that referenced
this issue
Jun 4, 2024
Fix issues with how we are generating code for casting (rust-lang#566, and rust-lang#1528).
Restructure the unsize casting to be done in one pass instead with deep recursion (rust-lang#1531). This also reuses the code from the reachability analysis, so we don't have to keep two ways of traversing the same structure.
This takes 4.7s:
This takes 5.5s:
The text was updated successfully, but these errors were encountered: