Repository navigation
eval_ir_call takes the call builder, and dead AST code goes away - #19462
Merged
Merged
Conversation
fdncred
added a commit
that referenced
this pull request
Nov 23, 2026
## Description This is phase 4 of the AST to IR call migration, after #18808, #18813, #18967, #19351 and #19462. Commands now run only from compiled IR, so `engine::Call` loses its AST variants and the code that handled them goes too. Plain `cal` was the last runtime code that built an `ast::Call`, to run `table --index false`. It now runs `table` through `eval_ir_call`, as `help` does. The rest is deletion: `CallImpl::AstRef`/`AstBox`, `eval_call`, `eval_external`, `impl CallExt for ast::Call`, and the AST branches in `get`, `run`, `run-internal`, known externals and plugin calls. The AST evaluator stays, because `explain` and the parser info of `source`, `source-env` and `run` still use it. Its call arms now return an error, which fixes two `explain` bugs. `explain` evaluates every argument, and a keyword's argument can be a call. For `else if` that call is `if`, whose `run` panics. For `alias x = cmd` it ran `cmd`. Both now show an error value. An argument that holds a subexpression, like `(1 + 2)`, now shows its source text and parsed type instead of an internal debug dump. `explain` doesn't run it, because that would run its commands. The AST `has_flag` was the only check that a builtin's switch got a bool. The parser rejects `ls --all=5`, but `ls --all=$x` with `$x` typed `any` and set to `5` counted as set. Builtins, const calls and custom commands now give the error `%$cmd` already gave. A builtin checks when it reads the switch, so one that never reads it still ignores a bad value. ## User-facing changes (Release notes) - `explain` no longer crashes on `else if`, and no longer runs the command an `alias` points to. - `explain` shows an argument with a subexpression, like `(1 + 2)`, as its source text and parsed type. - Breaking change: a switch given a value that isn't a bool, as in `ls --all=$x` with `$x` set to `5`, is an error. It used to count as set. ## Additional notes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
More of the work to make IR the only thing that runs, plus bug fixes I found while doing it. The refactor changes one sentence of
debug profile --helpand nothing else users can see.eval_ir_callnow takes theCallBuilderby value and removes the call's arguments from the stack itself, on every return. Callers used to runfinish(), run the call, then runleave(), and nothing made them do that last step. The twelve callers get shorter and three of the four manualleaves go.run-internalkeeps one, because its help and error paths never run the call.The rest deletes code that holds AST types and has no callers. The compiler confirmed each one.
Bug fixes
explorewrote command output over its own screen.:nu ^echo hi; 7puthion top of the status bar. Only the last pipeline gets a pipe redirection, so an external in an earlier one fell back to the stack's default output, which is the terminal.:nucouldn't show an external's output.:nu ^echo hishowedFailed to read stream, and a debug build panicked at thedebug_assert!inChildProcess::into_bytes, because an external as the last pipeline keeps stderr on its own pipe.:nunow reads the process directly and previews stdout, then stderr, thenexit code: Nif it failed, so a failing command keeps its message.An external that read the terminal froze
explore. In:nu let x = 1; ^cat; 7,^catwaited on the terminal behind theRunningspinner, andinputdid the same. The pager's stack now also usessuppress_stdin, as completions do, so these finish or fail on their own. The first pipeline was never affected, because it reads the pager's value as its input.:nuand:tryhid why a command failed. A parse error showed onlyParse error, and compile errors weren't checked, so they showedCan't evaluate block in IR mode. Both now show the reason.debug profileleft the profiler running when the closure failed, so everything after it ran through the debugger.try { debug profile { error make {msg: x} } } catch { }made a laterforloop about 10 times slower. The profiler now stops before the error is returned.debug profile --expand-sourcedid nothing. The code looked upexpanded-source, sohas_flagnever found the flag that was passed.User-facing changes (Release notes)
debug profile --expand-sourcenow shows the full source of each instruction. The flag had no effect before.debug profileno longer leaves the profiler running when its closure fails.explore,:nuand:tryno longer write over the screen when a command's output has nowhere to go, as in:nu ^echo hi; 7. That output is discarded.explore,:nunow shows an external's output, including its stderr and a non-zero exit code.:nu ^echo hiused to fail.explore, externals run by:nuand:tryno longer get the terminal, so one that reads input can't freeze the pager.inputnow errors there, and a full-screen program likevimfails instead of drawing over the pager.explore,:nuand:trynow say why a command couldn't be parsed or compiled.Additional notes
Rust API breaks for embedders:
nu_engine::eval_ir_calltakes aCallBuilderinstead of&Call.DebuggerandDebugContextloseenter_elementandleave_element.ProfilerOptionslosescollect_exprs.Pattern::Expression,UnevaluatedCallInfoandCallBuilder::withare gone.get_eval_expression_with_input,get_eval_subexpression,EvalExpressionWithInputFnandEvalSubexpressionFnare gone.