Skip to content

miri subtree update - #160634

Open
RalfJung wants to merge 50 commits into
rust-lang:mainfrom
RalfJung:miri
Open

miri subtree update#160634
RalfJung wants to merge 50 commits into
rust-lang:mainfrom
RalfJung:miri

Conversation

@RalfJung

@RalfJung RalfJung commented Aug 6, 2026

Copy link
Copy Markdown
Member

Subtree update of miri to rust-lang/miri@13801c6.

Created using https://github.com/rust-lang/josh-sync.

r? @ghost

RalfJung and others added 30 commits August 3, 2026 12:22
don't force intrinsic results into memory
This updates the rust-version file to 7218ebe.
Move command-result printing into a helper and keep CLI loop control at the call site.
Consume Priroda's --dap flag before handing arguments to rustc_driver::run_compiler, then dispatch the freshly-created PrirodaContext to either the existing CLI loop or a new DAP loop stub.
Add FirstUserSourceLocation ResumeMode variant that stops when the
interpreter reaches a user-relevant frame with a source location.
This gives the DAP frontend an entry-stop primitive that skips
Miri-internal and std frames.
Wire `next` and `stepIn` DAP requests to Priroda's existing source-line
step.  Both commands use the same `handle_step` handler for now; true
step-over vs step-in semantics are deferred.

Add `stopped_reason` to map `StepResult` variants to DAP
`StoppedEventReason` so the editor can distinguish a manual step from a
breakpoint hit.  Add a `handle_disconnect` handler that sends the
`terminated` event and exits the session cleanly.

Document the `SourceLocation` span-storage rationale and refine the
`SourceLine` resume-mode comment to be clearer about the "no source
location → first mapped location" semantics.
When the session receives an unsupported DAP request, return
`DispatchOutcome::Continue` instead of `Exit` so the debug adapter keeps
running after sending the error response.  Remove the `eprintln!` side
channel from `handle_unsupported_request` since the framed DAP error
response is the single authoritative error-reporting path.

Include the command name in the error message string so the DAP client
sees which request was rejected.
Replace `unreachable!()` with `bug!(...)` at the four dispatch-guaranteed
invariant sites so they produce a meaningful message when the guard fails
instead of a bare panic.  Also switch the DAP error print to Debug format
so transport errors include their chain.
Call `span.source_callsite()` in `resolve_current_location` so
breakpoints and source reporting use the user-visible macro call site
instead of the expanded macro body for lines generated by `println!`,
`assert_eq!`, and similar macros.
Add the `continue` command handler, reusing the existing source-line
stepping and breakpoint infrastructure.  The `handle_continue` method
follows the same `ExecutionOutcome` dispatch pattern as `handle_step`.

Include `Command::Continue` in `require_thread_id` validation so the
request passes the thread-id guard, and widen the fallback from
`unreachable!()` to `true` so any future request with a thread-id field
passes validation rather than panicking.
moabo3li and others added 19 commits August 5, 2026 14:45
Mark `supportsSingleThreadExecutionRequests: true` so that VS Code sends
the `singleThread` flag on step/continue requests.  This lets the editor
drive the single-threaded prototype without protocol errors.

Remove the `MAX_REQUEST_COUNT` guard and the `for 0..MAX_REQUEST_COUNT`
loop, replacing them with a simple `loop {}`.  The debug adapter now
handles an unbounded number of requests, terminating only on disconnect
or an explicit exit event.

Set `source_reference: Some(0)` on stack frames so the editor does not
request source content through `source` requests: the file is on disk
and the editor can read it directly.

Update all DAP `.stdout` fixture files to reflect the new capability
field in the `initialize` response body.
DAP Content-Length headers embed the byte count of the following JSON,
which drifts after path normalisation replaces the real manifest dir
with {MANIFEST_DIR}.  Replace Content-Length values with a
{CONTENT_LENGTH} placeholder so path-length differences between
machines do not cause spurious Content-Length mismatches in CI.
List every Command variant in dispatch_request and display_command
instead of a `_ =>` catch-all.  

New variants added upstream then fail to compile here instead of silently falling through the unsupported arm.
…ts path guard

Pull the inner arguments out of request.command at dispatch time and
pass them by value into handle_scopes / handle_variables /
handle_set_breakpoints, so the handlers no longer re-match on
request.command.  require_frame_id and require_variables_reference
take the extracted value; the bug! fallback for the dispatch-only
command in handle_variables is gone.

Replace the inline DapState::Fresh check in dispatch_request with a
require_initialized predicate, mirroring the other require_* guards.

Reject setBreakpoints with an error when source.path is missing --
Priroda only resolves file-based breakpoints.
The Locals scope carried no source/line/column, so the editor could not anchor the variables view to the stopped frame.  

Pull them from session.current_location when present and bless the dap_scopes_variables* fixtures to the new fields.
Convert every require_* and reject_after_termination predicate from
ServerResult<bool> eager-respond to pure Result<(), &str>, add DispatchOutcome::Rejected(&str), and change handlers to return
Result<DispatchOutcome, ServerError>.  

Once predicates stop eagerly responding, Rejected carries their errors out -- and vice versa.

dispatch_request return type becomes InterpResult<Result<DispatchOutcome, ServerError>>.  

run_requests clones the request before dispatch so the original stays available for request.error(msg) when a Rejected bubbles up.  

Handlers rebuilt to if let Err(msg) = ...{ return Ok(Rejected(msg)); } + Ok(DispatchOutcome::Continue) endings; and_then chains in the execution handlers map to DispatchOutcome::Continue, and respond_error is gone from the happy path.
A bunch of reject_after_termination calls sat before a state check that already excludes Terminated, so the reject was dead.  
Dropped those.

check_configuration_done_request and check_step_request collapse to their actual predicate -- require_state(Launched) on the first, require_stopped + require_thread_id on the second.  

The"configurationDone may only be sent once" arm is gone since require_state(Launched) already rejects Stopped.

Updated dap_rejects_repeated_configuration_done.stdout to the new "configurationDone requires launch" message.
Dropped DispatchOutcome::Rejected in favor of HandlerError, which has
Reject and Transport variants.  Predicates stay Result<(), &str>;
callers do .map_err(HandlerError::Reject)?.

With From<ServerError> for HandlerError, self.server.respond(..)? in
handlers just works.  run_requests now sends request.error(msg) for
rejections and bubbles transport errors out — one send per request.

This addresses the feedback about Result<bool, E> and predicates
eagerly reporting inside the require methods.
require_thread_id now takes i64.  Callers already know which command
they are handling, so they pull thread_id directly.  
This was the last predicate that took &Request.

Inlined require_initialized at its one callsite, single matches! check, no point keeping it separate.

The dispatch extraction arms use bug!("wrong command") for the impossible fallback, matching the existing bug! style in the file.
Handlers no longer take Request or call request.success/error themselves; they return HandlerSuccess { response, state, events, outcome } and run_requests is the single send site for both success and error responses, applying state transitions and forwarding events in emitted order.

Drop respond_terminated and respond_execution_error -- their response/event construction moves inline at the ExecutionOutcome match arms. send_stopped_event becomes stopped_event_body (pure).

dispatch_request takes &Request instead of owning+cloning; handlers receive already-destructured args.  handle_unsupported_request takes &Command. HandlerError is gone; handlers return Result<HandlerSuccess, &'static str> so predicate errors bubble via plain ?.

Note: state mutations now happen after the response send, not before. If a transport write fails, state is left untouched rather than half-mutated.  Wire output is unchanged for the success path.
[Priroda] Add minimal DAP frontend with single-thread stepping demo
Lookup exported statics when encountering an unsupported imported static
This updates the rust-version file to f73951d.
[Priroda] CI: add clippy check for priroda
@rustbot

rustbot commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

miri is developed in its own repository. If the Miri part of this change can be broken out, consider making this change to rust-lang/miri instead. However, if Miri needs adjusting for rustc changes, just ignore this message.

cc @rust-lang/miri

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 6, 2026
@RalfJung

RalfJung commented Aug 6, 2026

Copy link
Copy Markdown
Member Author

@bors r+

@rust-bors

rust-bors Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

📌 Commit d68ddd0 has been approved by RalfJung

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 6, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 6, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants