Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion compiler/rustc_mir_transform/src/ctfe_limit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ impl<'tcx> crate::MirPass<'tcx> for CtfeLimit {
.basic_blocks
.iter_enumerated()
.filter_map(|(node, node_data)| {
if matches!(node_data.terminator().kind, TerminatorKind::Call { .. })
if matches!(node_data.terminator().kind, TerminatorKind::Call { .. } | TerminatorKind::TailCall { .. })
// Back edges in a CFG indicate loops
|| has_back_edge(doms, node, node_data)
{
Expand Down
10 changes: 10 additions & 0 deletions tests/ui/explicit-tail-calls/infinite-recursion-in-ctfe.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#![feature(explicit_tail_calls)]
#![expect(incomplete_features)]

const _: () = f();

const fn f() {
become f(); //~ error: constant evaluation is taking a long time
}

fn main() {}
17 changes: 17 additions & 0 deletions tests/ui/explicit-tail-calls/infinite-recursion-in-ctfe.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
error: constant evaluation is taking a long time
--> $DIR/infinite-recursion-in-ctfe.rs:7:5
|
LL | become f();
| ^^^^^^^^^^
|
= note: this lint makes sure the compiler doesn't get stuck due to infinite loops in const eval.
If your compilation actually takes a long time, you can safely allow the lint.
help: the constant being evaluated
--> $DIR/infinite-recursion-in-ctfe.rs:4:1
|
LL | const _: () = f();
| ^^^^^^^^^^^
= note: `#[deny(long_running_const_eval)]` on by default

error: aborting due to 1 previous error

Loading