Skip to content

support non-defining uses of opaques in borrowck #145244

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

lcnr
Copy link
Contributor

@lcnr lcnr commented Aug 11, 2025

Reimplements the first part of #139587, but limited to only the new solver. To do so I also entirely rewrite the way we handle opaque types in borrowck even on stable. This should not impact behavior however.

We now support revealing uses during MIR borrowck with the new solver:

fn foo<'a>(x: &'a u32) -> impl Sized + use<'a> {
    let local = 1;
    foo::<'_>(&local);
    x
}

How do opaque types work right now

Whenever we use an opaque type during type checking, we remember this use in the opaque_type_storage of the InferCtxt.

Right now, we collect all member constraints at the end of MIR type check by looking at all uses from the opaque_type_storage. We then apply these constraints while computing the region values for each SCC. This does not add actual region constraints but directly updates the final region values.

This means we need to manually handle any constraints from member constraints for diagnostics. We do this by separately tracking applied_member_constraints in the RegionInferenceContext.

After we've finished computing the region values, it is now immutable and we check whether all member constraints hold. If not, we error.

We now map the hidden types of our defining uses to the defining scope. This assumes that all member constraints apply. To handle non-member regions, we simply map any region in the hidden type we fail to map to a choice region to 'erased

let concrete_type = fold_regions(infcx.tcx, concrete_type, |region, _| {
arg_regions
.iter()
.find(|&&(arg_vid, _)| self.eval_equal(region.as_var(), arg_vid))
.map(|&(_, arg_named)| arg_named)
.unwrap_or(infcx.tcx.lifetimes.re_erased)
});

How do we handle opaque types with this PR

MIR type check still works the same by populating the opaque_type_storage whenever we use an opaque type.

We now have a new step fn handle_opaque_type_uses which happens between MIR type check and compute_regions.

This step looks at all opaque type uses in the storage and first checks whether they are defining: are the arguments of the opaque_type_key unique region parameters. With the new solver we silently ignore any non-defining uses here. The old solver emits an errors.

fn compute_concrete_opaque_types: We then collect all member constraints for the defining uses and apply them just like we did before. However, we do it on a temporary region graph which is only used while computing the concrete opaque types. We then use this region graph to compute the concrete type which we then store in the root_cx.

fn apply_computed_concrete_opaque_types: Now that we know the final concrete type of each opaque type and have mapped them to the definition of the opaque. We iterate over all opaque type uses and equate their hidden type with the instantiated final concrete type. This is the step which actually mutates the region graph.

The actual region checking can now entirely ignores opaque types (outside of the ConstraintCategory from checking the opaque type uses).

Diagnostics issue (chill)

Because we now simply use type equality to "apply member constraints" we get ordinary OutlivesConstraints, even if the regions were already related to another.

This is generally not an issue, expect that it can hide the actual region constraints which resulted in the final value of the opaque. The constraints we get from checking against the final opaque type definition relies on constraints we used to compute that definition.

I mostly handle this by updating find_constraint_path_between_regions to first ignore member constraints in its search and only if that does not find a path, retry while considering member constraints.

Diagnostics issue (not chill)

A separate issue is that find_constraint_paths_between_regions currently looks up member constraints by their scc, not by region value:

// Member constraints can also give rise to `'r: 'x` edges that
// were not part of the graph initially, so watch out for those.
// (But they are extremely rare; this loop is very cold.)
for constraint in self.applied_member_constraints(self.constraint_sccs.scc(r)) {
let sub = constraint.min_choice;
let p_c = &self.member_constraints[constraint.member_constraint_index];
handle_trace(sub, Trace::FromMember(r, sub, p_c.definition_span));
}

This means that in the borrowck-4 test, the resulting constraint path is currently

('?2: '?5) due to Single(bb0[5]) (None) (Boring) (ConstraintSccIndex(1): ConstraintSccIndex(1)),
('?5: '?3) due to Single(bb0[6]) (None) (Boring) (ConstraintSccIndex(1): ConstraintSccIndex(1)),
('?3: '?0) due to All(src/main.rs:15:5: 15:6 (#0)) (None) (OpaqueType) (ConstraintSccIndex(1): ConstraintSccIndex(1))

Here '?3 is equal to '?4, but the reason why it's in the opaque is that it's related to '?4. With my PR this will be correctly tracked so we end up with

('?2: '?5) due to Single(bb0[5]) (None) (Boring) (ConstraintSccIndex(1): ConstraintSccIndex(1)),
('?5: '?3) due to Single(bb0[6]) (None) (Boring) (ConstraintSccIndex(1): ConstraintSccIndex(1)),
('?3: '?4) due to Single(bb0[6]) (None) (Assignment) (ConstraintSccIndex(1): ConstraintSccIndex(1)),
('?4: '?0) due to All(src/main.rs:15:5: 15:6 (#0)) (None) (OpaqueType) (ConstraintSccIndex(1): ConstraintSccIndex(1)),

This additional Assignment step then worsens the error message as we stop talking about the fact that the closures is returned from the function. Fixing this is hard. I've looked into this and it's making me sad :< Properly handling this requires some deeper changes to MIR borrowck diagnostics and that seems like too much for this PR. Given that this only impacts a single test, it seems acceptable to me.

r? @ghost

@rustbot rustbot added A-CI Area: Our Github Actions CI A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. labels Aug 11, 2025
@lcnr lcnr force-pushed the handle-opaque-types-before-region-inference branch from 0d7a748 to e276bbf Compare August 11, 2025 11:15
for error in errors {
guar = Some(match error {
DeferredOpaqueTypeError::InvalidOpaqueTypeArgs(err) => err.report(self.infcx),
DeferredOpaqueTypeError::LifetimeMismatchOpaqueParam(err) => {
self.infcx.dcx().emit_err(err)
}
DeferredOpaqueTypeError::UnexpectedHiddenRegion {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just moved from RegionErrorKind::UnexpectedHiddenRegion

@lcnr lcnr force-pushed the handle-opaque-types-before-region-inference branch 3 times, most recently from 14e5264 to 5536a31 Compare August 11, 2025 11:29
@rust-log-analyzer

This comment has been minimized.

@lcnr lcnr force-pushed the handle-opaque-types-before-region-inference branch from 5536a31 to 298629b Compare August 11, 2025 11:55
@rust-log-analyzer

This comment has been minimized.

@lcnr lcnr force-pushed the handle-opaque-types-before-region-inference branch from 298629b to 9af9a2c Compare August 11, 2025 12:17
@rust-log-analyzer

This comment has been minimized.

@lcnr lcnr changed the title Handle opaque types before region inference support revealing uses of opaques in borrowck Aug 11, 2025
// FIXME(-Znext-solver): enable this test
//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idk why I've added this FIXME to these 3 tests, only one of them actually failed with the new solver before.

@BoxyUwU BoxyUwU self-assigned this Aug 11, 2025
@lcnr lcnr changed the title support revealing uses of opaques in borrowck support non-defining uses of opaques in borrowck Aug 11, 2025
rcx.scc_values.add_region(member, min_choice_scc);
}

struct CollectMemberConstraintsVisitor<'a, 'b, 'tcx> {
Copy link
Contributor Author

@lcnr lcnr Aug 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

equiv to existing register_member_constraints

@lcnr lcnr force-pushed the handle-opaque-types-before-region-inference branch 3 times, most recently from 9a309c7 to 30579d4 Compare August 12, 2025 10:30
@lcnr lcnr force-pushed the handle-opaque-types-before-region-inference branch from 86063b3 to c2a0fa8 Compare August 20, 2025 09:10
@rustbot
Copy link
Collaborator

rustbot commented Aug 20, 2025

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@lcnr
Copy link
Contributor Author

lcnr commented Aug 20, 2025

@bors r=BoxyUwU

@bors
Copy link
Collaborator

bors commented Aug 20, 2025

📌 Commit c2a0fa8 has been approved by BoxyUwU

It is now in the queue for this repository.

@bors bors 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 20, 2025
@bors
Copy link
Collaborator

bors commented Aug 20, 2025

⌛ Testing commit c2a0fa8 with merge 951c042...

bors added a commit that referenced this pull request Aug 20, 2025
…nce, r=BoxyUwU

support non-defining uses of opaques in borrowck

Reimplements the first part of #139587, but limited to only the new solver. To do so I also entirely rewrite the way we handle opaque types in borrowck even on stable. This should not impact behavior however.

We now support revealing uses during MIR borrowck with the new solver:
```rust
fn foo<'a>(x: &'a u32) -> impl Sized + use<'a> {
    let local = 1;
    foo::<'_>(&local);
    x
}
```

### How do opaque types work right now

Whenever we use an opaque type during type checking, we remember this use in the `opaque_type_storage` of the `InferCtxt`.

Right now, we collect all *member constraints* at the end of MIR type check by looking at all uses from the `opaque_type_storage`. We then apply these constraints while computing the region values for each SCC. This does not add actual region constraints but directly updates the final region values.

This means we need to manually handle any constraints from member constraints for diagnostics. We do this by separately tracking `applied_member_constraints` in the `RegionInferenceContext`.

After we've finished computing the region values, it is now immutable and we check whether all member constraints hold. If not, we error.

We now map the hidden types of our defining uses to the defining scope. This assumes that all member constraints apply. To handle non-member regions, we simply map any region in the hidden type we fail to map to a choice region to `'erased` https://github.com/rust-lang/rust/blob/b1b26b834d85e84b46aa8f8f3ce210a1627aa85f/compiler/rustc_borrowck/src/region_infer/opaque_types.rs#L126-L132

### How do we handle opaque types with this PR

MIR type check still works the same by populating the `opaque_type_storage` whenever we use an opaque type.

We now have a new step `fn handle_opaque_type_uses` which happens between MIR type check and `compute_regions`.

This step looks at all opaque type uses in the storage and first checks whether they are defining: are the arguments of the `opaque_type_key` unique region parameters. *With the new solver we silently ignore any *non-defining* uses here. The old solver emits an errors.*

`fn compute_concrete_opaque_types`: We then collect all member constraints for the defining uses and apply them just like we did before. However, we do it on a temporary region graph which is only used while computing the concrete opaque types. We then use this region graph to compute the concrete type which we then store in the `root_cx`.

`fn apply_computed_concrete_opaque_types`: Now that we know the final concrete type of each opaque type and have mapped them to the definition of the opaque. We iterate over all opaque type uses and equate their hidden type with the instantiated final concrete type. This is the step which actually mutates the region graph.

The actual region checking can now entirely ignores opaque types (outside of the `ConstraintCategory` from checking the opaque type uses).

### Diagnostics issue (chill)

Because we now simply use type equality to "apply member constraints" we get ordinary `OutlivesConstraint`s, even if the regions were already related to another.

This is generally not an issue, expect that it can *hide* the actual region constraints which resulted in the final value of the opaque. The constraints we get from checking against the final opaque type definition relies on constraints we used to compute that definition.

I mostly handle this by updating `find_constraint_path_between_regions` to first ignore member constraints in its search and only if that does not find a path, retry while considering member constraints.

### Diagnostics issue (not chill)

A separate issue is that `find_constraint_paths_between_regions` currently looks up member constraints by their **scc**, not by region value:
https://github.com/rust-lang/rust/blob/2c1ac85679678dfe5cce7ea8037735b0349ceaf3/compiler/rustc_borrowck/src/region_infer/mod.rs#L1768-L1775

This means that in the `borrowck-4` test, the resulting constraint path is currently
```
('?2: '?5) due to Single(bb0[5]) (None) (Boring) (ConstraintSccIndex(1): ConstraintSccIndex(1)),
('?5: '?3) due to Single(bb0[6]) (None) (Boring) (ConstraintSccIndex(1): ConstraintSccIndex(1)),
('?3: '?0) due to All(src/main.rs:15:5: 15:6 (#0)) (None) (OpaqueType) (ConstraintSccIndex(1): ConstraintSccIndex(1))
```
Here `'?3` is equal to `'?4`, but the reason why it's in the opaque is that it's related to `'?4`. With my PR this will be correctly tracked so we end up with
```
('?2: '?5) due to Single(bb0[5]) (None) (Boring) (ConstraintSccIndex(1): ConstraintSccIndex(1)),
('?5: '?3) due to Single(bb0[6]) (None) (Boring) (ConstraintSccIndex(1): ConstraintSccIndex(1)),
('?3: '?4) due to Single(bb0[6]) (None) (Assignment) (ConstraintSccIndex(1): ConstraintSccIndex(1)),
('?4: '?0) due to All(src/main.rs:15:5: 15:6 (#0)) (None) (OpaqueType) (ConstraintSccIndex(1): ConstraintSccIndex(1)),
```
This additional `Assignment` step then worsens the error message as we stop talking about the fact that the closures is returned from the function. Fixing this is hard. I've looked into this and it's making me sad :< Properly handling this requires some deeper changes to MIR borrowck diagnostics and that seems like too much for this PR. Given that this only impacts a single test, it seems acceptable to me.

r? `@ghost`
@rust-log-analyzer
Copy link
Collaborator

The job aarch64-msvc-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
failures:

---- [debuginfo-cdb] tests\debuginfo\lexical-scope-in-if-let.rs stdout ----

error: check directive(s) from `C:\a\rust\rust\tests\debuginfo\lexical-scope-in-if-let.rs` not found in debugger output. errors:
    (lexical-scope-in-if-let.rs:73) `[...]c = 0n789`
    (lexical-scope-in-if-let.rs:76) `[...]z = 0n10`
the following subset of check directive(s) was found successfully:
    (lexical-scope-in-if-let.rs:55) `              a = 0n123`
    (lexical-scope-in-if-let.rs:59) `              a = 0n123`
    (lexical-scope-in-if-let.rs:60) `              x = 0n42`
    (lexical-scope-in-if-let.rs:64) `              a = 0n123`
    (lexical-scope-in-if-let.rs:65) `              b = 0n456`
    (lexical-scope-in-if-let.rs:66) `              x = 0n42`
    (lexical-scope-in-if-let.rs:67) `              y = true`
    (lexical-scope-in-if-let.rs:71) `              a = 0n123`
    (lexical-scope-in-if-let.rs:72) `              b = 0n456`
    (lexical-scope-in-if-let.rs:74) `              x = 0n42`
    (lexical-scope-in-if-let.rs:75) `              y = true`
status: exit code: 0
command: PATH="C:\a\rust\rust\build\aarch64-pc-windows-msvc\stage2\lib\rustlib\aarch64-pc-windows-msvc\lib;C:\Program Files (x86)\Windows Kits\10\bin\arm64;C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\arm64;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.44.35207\bin\HostARM64\arm64;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.44.35207\bin\HostARM64\arm64;C:\a\rust\rust\build\aarch64-pc-windows-msvc\bootstrap-tools\aarch64-pc-windows-msvc\release\deps;C:\Program Files\Git\clangarm64\bin;C:\Program Files\Git\usr\bin;C:\Users\runneradmin\bin;C:\a\rust\rust\ninja;C:\a\rust\rust\citools\clang-rust\bin;C:\a\rust\rust\sccache;C:\aliyun-cli;C:\vcpkg;C:\Program Files (x86)\NSIS;C:\Program Files\Mercurial;C:\hostedtoolcache\windows\stack\3.7.1\x64;C:\mingw64\bin;C:\Program Files\dotnet;C:\Program Files\MySQL\MySQL Server 8.0\bin;C:\Program Files (x86)\R\R-4.4.2\bin\x64;C:\SeleniumWebDrivers\GeckoDriver;C:\SeleniumWebDrivers\EdgeDriver;C:\SeleniumWebDrivers\ChromeDriver;C:\Program Files (x86)\sbt\bin;C:\Program Files (x86)\GitHub CLI;C:\Program Files\Git\usr\bin;C:\Program Files (x86)\pipx_bin;C:\npm\prefix;C:\hostedtoolcache\windows\go\1.24.5\arm64\bin;C:\hostedtoolcache\windows\Python\3.12.10\arm64\Scripts;C:\hostedtoolcache\windows\Python\3.12.10\arm64;C:\hostedtoolcache\windows\Ruby\3.3.8\x64\bin;C:\Program Files\OpenSSL\bin;C:\tools\kotlinc\bin;C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\21.0.8-9.0\aarch64\bin;C:\Program Files (x86)\ImageMagick-7.1.2-Q16-HDRI;C:\Program Files\Microsoft SDKs\Azure\CLI2\wbin;C:\ProgramData\kind;C:\ProgramData\Chocolatey\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files\PowerShell\7;C:\Program Files\Microsoft\Web Platform Installer;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn;C:\Program Files\Microsoft SQL Server\150\Tools\Binn;C:\Program Files\dotnet;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit;C:\Program Files\Microsoft SQL Server\130\DTS\Binn;C:\Program Files\Microsoft SQL Server\140\DTS\Binn;C:\Program Files\Microsoft SQL Server\150\DTS\Binn;C:\Program Files\Microsoft SQL Server\160\DTS\Binn;C:\Strawberry\c\bin;C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;C:\ProgramData\chocolatey\lib\pulumi\tools\Pulumi\bin;C:\Program Files\CMake\bin;C:\Tools\Ninja;C:\ProgramData\chocolatey\lib\maven\apache-maven-3.9.11\bin;C:\Program Files\LLVM\bin;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\Program Files\Git\clangarm64\bin;C:\Program Files\Git\usr\bin;C:\Program Files\GitHub CLI;C:\tools\php;C:\Program Files (x86)\sbt\bin;C:\Program Files\Amazon\AWSCLIV2;C:\Program Files\Amazon\SessionManagerPlugin\bin;C:\Program Files\Amazon\AWSSAMCLI\bin;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Users\runneradmin\.dotnet\tools;C:\Users\runneradmin\.cargo\bin;C:\Users\runneradmin\AppData\Local\Microsoft\WindowsApps" "C:\\Program Files (x86)\\Windows Kits\\10\\Debuggers\\arm64\\cdb.exe" "-lines" "-cf" "C:\\a\\rust\\rust\\build\\aarch64-pc-windows-msvc\\test\\debuginfo\\lexical-scope-in-if-let.cdb\\lexical-scope-in-if-let.debugger.script" "C:\\a\\rust\\rust\\build\\aarch64-pc-windows-msvc\\test\\debuginfo\\lexical-scope-in-if-let.cdb\\a.exe"
--- stdout -------------------------------

************* Preparing the environment for Debugger Extensions Gallery repositories **************
   ExtensionRepository : Implicit
   UseExperimentalFeatureForNugetShare : true
   AllowNugetExeUpdate : true
   NonInteractiveNuget : true
   AllowNugetMSCredentialProviderInstall : true
   AllowParallelInitializationOfLocalRepositories : true

   EnableRedirectToV8JsProvider : false

   -- Configuring repositories
      ----> Repository : LocalInstalled, Enabled: true
      ----> Repository : UserExtensions, Enabled: true

>>>>>>>>>>>>> Preparing the environment for Debugger Extensions Gallery repositories completed, duration 0.000 seconds

************* Waiting for Debugger Extensions Gallery to Initialize **************

>>>>>>>>>>>>> Waiting for Debugger Extensions Gallery to Initialize completed, duration 0.015 seconds
   ----> Repository : UserExtensions, Enabled: true, Packages count: 0
   ----> Repository : LocalInstalled, Enabled: true, Packages count: 27

Microsoft (R) Windows Debugger Version 10.0.26100.1 ARM64
Copyright (c) Microsoft Corporation. All rights reserved.

CommandLine: C:\a\rust\rust\build\aarch64-pc-windows-msvc\test\debuginfo\lexical-scope-in-if-let.cdb\a.exe

************* Path validation summary **************
Response                         Time (ms)     Location
Deferred                                       srv*
Symbol search path is: srv*
Executable search path is: 
ModLoad: 00007ff7`eefe0000 00007ff7`eefe6000   a.exe   
ModLoad: 00007ffb`e12c0000 00007ffb`e16ec000   ntdll.dll
ModLoad: 00007ffb`e01b0000 00007ffb`e0318000   C:\Windows\System32\KERNEL32.DLL
ModLoad: 00007ffb`dc940000 00007ffb`dcfe2000   C:\Windows\System32\KERNELBASE.dll
ModLoad: 00007ffb`dc010000 00007ffb`dc114000   C:\Windows\SYSTEM32\apphelp.dll
ModLoad: 00007ffb`dd200000 00007ffb`dd428000   C:\Windows\System32\ucrtbase.dll
ModLoad: 00007ffb`c64e0000 00007ffb`c6514000   C:\Windows\SYSTEM32\VCRUNTIME140.dll
ModLoad: 00007ffb`93150000 00007ffb`93b3d000   C:\a\rust\rust\build\aarch64-pc-windows-msvc\stage2\lib\rustlib\aarch64-pc-windows-msvc\lib\std-e7742170563fb129.dll
ModLoad: 00007ffb`df010000 00007ffb`df0d4000   C:\Windows\System32\WS2_32.dll
ModLoad: 00007ffb`dac90000 00007ffb`dace0000   C:\Windows\SYSTEM32\USERENV.dll
ModLoad: 00007ffb`e0450000 00007ffb`e0653000   C:\Windows\System32\RPCRT4.dll
ModLoad: 00007ffb`dd580000 00007ffb`dd660000   C:\Windows\System32\bcryptprimitives.dll
(1540.1c9c): Break instruction exception - code 80000003 (first chance)
ntdll!LdrpDoDebuggerBreak+0x34:
00007ffb`e141beb4 d43e0000 brk         #0xF000
0:000> version
Windows 10 Version 26100 MP (4 procs) Free ARM 64-bit (AArch64)
Product: WinNt, suite: SingleUserTS
Edition build lab: 26100.1.arm64fre.ge_release.240331-1435
Build layer: DesktopEditions -> 26100.1.arm64fre.ge_release.240331-1435
Build layer: OnecoreUAP -> 26100.1.arm64fre.ge_release.240331-1435
Build layer: ShellCommon -> 26100.4656.arm64fre.ge_release_svc_im.250710-2016
Build layer: OSClient   -> 26100.4656.arm64fre.ge_release_svc_im.250710-2016
Debug session time: Wed Aug 20 22:35:14.341 2025 (UTC + 0:00)
System Uptime: 0 days 3:27:54.027
Process Uptime: 0 days 0:00:00.048
  Kernel time: 0 days 0:00:00.000
  User time: 0 days 0:00:00.000
Live user mode: <Local>

Microsoft (R) Windows Debugger Version 10.0.26100.1 ARM64
Copyright (c) Microsoft Corporation. All rights reserved.

command line: '"C:\Program Files (x86)\Windows Kits\10\Debuggers\arm64\cdb.exe" -lines -cf C:\a\rust\rust\build\aarch64-pc-windows-msvc\test\debuginfo\lexical-scope-in-if-let.cdb\lexical-scope-in-if-let.debugger.script C:\a\rust\rust\build\aarch64-pc-windows-msvc\test\debuginfo\lexical-scope-in-if-let.cdb\a.exe'  Debugger Process 0xE48 
dbgeng:  image 10.0.26100.1, 
        [path: C:\Program Files (x86)\Windows Kits\10\Debuggers\arm64\dbgeng.dll]
dbghelp: image 10.0.26100.4188, 
        [path: C:\Program Files (x86)\Windows Kits\10\Debuggers\arm64\dbghelp.dll]
        DIA version: 33140
Extension DLL search Path:
    C:\Program Files (x86)\Windows Kits\10\Debuggers\arm64\WINXP;C:\Program Files (x86)\Windows Kits\10\Debuggers\arm64\winext;C:\Program Files (x86)\Windows Kits\10\Debuggers\arm64\winext\arcade;C:\Program Files (x86)\Windows Kits\10\Debuggers\arm64\pri;C:\Program Files (x86)\Windows Kits\10\Debuggers\arm64;C:\Users\runneradmin\AppData\Local\Dbg\EngineExtensions;C:\Program Files (x86)\Windows Kits\10\Debuggers\arm64;C:\a\rust\rust\build\aarch64-pc-windows-msvc\stage2\lib\rustlib\aarch64-pc-windows-msvc\lib;C:\Program Files (x86)\Windows Kits\10\bin\arm64;C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\arm64;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.44.35207\bin\HostARM64\arm64;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.44.35207\bin\HostARM64\arm64;C:\a\rust\rust\build\aarch64-pc-windows-msvc\bootstrap-tools\aarch64-pc-windows-msvc\release\deps;C:\Program Files\Git\clangarm64\bin;C:\Program Files\Git\usr\bin;C:\Users\runneradmin\bin;C:\a\rust\rust\ninja;C:\a\rust\rust\citools\clang-rust\bin;C:\a\rust\rust\sccache;C:\aliyun-cli;C:\vcpkg;C:\Program Files (x86)\NSIS;C:\Program Files\Mercurial;C:\hostedtoolcache\windows\stack\3.7.1\x64;C:\mingw64\bin;C:\Program Files\dotnet;C:\Program Files\MySQL\MySQL Server 8.0\bin;C:\Program Files (x86)\R\R-4.4.2\bin\x64;C:\SeleniumWebDrivers\GeckoDriver;C:\SeleniumWebDrivers\EdgeDriver;C:\SeleniumWebDrivers\ChromeDriver;C:\Program Files (x86)\sbt\bin;C:\Program Files (x86)\GitHub CLI;C:\Program Files\Git\usr\bin;C:\Program Files (x86)\pipx_bin;C:\npm\prefix;C:\hostedtoolcache\windows\go\1.24.5\arm64\bin;C:\hostedtoolcache\windows\Python\3.12.10\arm64\Scripts;C:\hostedtoolcache\windows\Python\3.12.10\arm64;C:\hostedtoolcache\windows\Ruby\3.3.8\x64\bin;C:\Program Files\OpenSSL\bin;C:\tools\kotlinc\bin;C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\21.0.8-9.0\aarch64\bin;C:\Program Files (x86)\ImageMagick-7.1.2-Q16-HDRI;C:\Program Files\Microsoft SDKs\Azure\CLI2\wbin;C:\ProgramData\kind;C:\ProgramData\Chocolatey\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files\PowerShell\7;C:\Program Files\Microsoft\Web Platform Installer;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn;C:\Program Files\Microsoft SQL Server\150\Tools\Binn;C:\Program Files\dotnet;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit;C:\Program Files\Microsoft SQL Server\130\DTS\Binn;C:\Program Files\Microsoft SQL Server\140\DTS\Binn;C:\Program Files\Microsoft SQL Server\150\DTS\Binn;C:\Program Files\Microsoft SQL Server\160\DTS\Binn;C:\Strawberry\c\bin;C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;C:\ProgramData\chocolatey\lib\pulumi\tools\Pulumi\bin;C:\Program Files\CMake\bin;C:\Tools\Ninja;C:\ProgramData\chocolatey\lib\maven\apache-maven-3.9.11\bin;C:\Program Files\LLVM\bin;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\Program Files\Git\clangarm64\bin;C:\Program Files\Git\usr\bin;C:\Program Files\GitHub CLI;C:\tools\php;C:\Program Files (x86)\sbt\bin;C:\Program Files\Amazon\AWSCLIV2;C:\Program Files\Amazon\SessionManagerPlugin\bin;C:\Program Files\Amazon\AWSSAMCLI\bin;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Users\runneradmin\.dotnet\tools;C:\Users\runneradmin\.cargo\bin;C:\Users\runneradmin\AppData\Local\Microsoft\WindowsApps
Extension DLL chain:
    dbghelp: image 10.0.26100.4188, API 10.0.6, 
        [path: C:\Program Files (x86)\Windows Kits\10\Debuggers\arm64\dbghelp.dll]
    exts: image 10.0.26100.1, API 1.0.0, 
        [path: C:\Program Files (x86)\Windows Kits\10\Debuggers\arm64\WINXP\exts.dll]
    uext: image 10.0.26100.1, API 1.0.0, 
        [path: C:\Program Files (x86)\Windows Kits\10\Debuggers\arm64\winext\uext.dll]
    ntsdexts: image 10.0.26100.1, API 1.0.0, 
        [path: C:\Program Files (x86)\Windows Kits\10\Debuggers\arm64\WINXP\ntsdexts.dll]
0:000> .nvlist
Loaded NatVis Files:
    <None Loaded>
0:000> bp `lexical-scope-in-if-let.rs:81`
*** WARNING: Unable to verify checksum for a.exe
0:000> bp `lexical-scope-in-if-let.rs:84`
0:000> bp `lexical-scope-in-if-let.rs:89`
0:000> bp `lexical-scope-in-if-let.rs:94`
0:000>  g
Breakpoint 0 hit
a!lexical_scope_in_if_let::main+0x18:
00007ff7`eefe1018 9400003c bl          a!lexical_scope_in_if_let::zzz (00007ff7`eefe1108)
0:000>  dv /n
              a = 0n123
              b = <value unavailable>
              x = <value unavailable>
              y = <value unavailable>
0:000>  g
Breakpoint 1 hit
a!lexical_scope_in_if_let::main+0x4c:
00007ff7`eefe104c 9400002f bl          a!lexical_scope_in_if_let::zzz (00007ff7`eefe1108)
0:000>  dv /n
              a = 0n123
              b = <value unavailable>
              x = 0n42
              y = <value unavailable>
0:000>  g
Breakpoint 2 hit
a!lexical_scope_in_if_let::main+0x98:
00007ff7`eefe1098 9400001c bl          a!lexical_scope_in_if_let::zzz (00007ff7`eefe1108)
0:000>  dv /n
              a = 0n123
              b = 0n456
              x = 0n42
              y = true
0:000>  g
Breakpoint 2 hit
a!lexical_scope_in_if_let::main+0x98:
00007ff7`eefe1098 9400001c bl          a!lexical_scope_in_if_let::zzz (00007ff7`eefe1108)
0:000>  dv /n
              a = 0n123
              b = 0n456
              x = 0n42
              y = true
0:000> qq
quit:
NatVis script unloaded from 'C:\Program Files (x86)\Windows Kits\10\Debuggers\arm64\Visualizers\atlmfc.natvis'
NatVis script unloaded from 'C:\Program Files (x86)\Windows Kits\10\Debuggers\arm64\Visualizers\ObjectiveC.natvis'
NatVis script unloaded from 'C:\Program Files (x86)\Windows Kits\10\Debuggers\arm64\Visualizers\concurrency.natvis'
NatVis script unloaded from 'C:\Program Files (x86)\Windows Kits\10\Debuggers\arm64\Visualizers\cpp_rest.natvis'
NatVis script unloaded from 'C:\Program Files (x86)\Windows Kits\10\Debuggers\arm64\Visualizers\stl.natvis'
NatVis script unloaded from 'C:\Program Files (x86)\Windows Kits\10\Debuggers\arm64\Visualizers\Windows.Data.Json.natvis'
NatVis script unloaded from 'C:\Program Files (x86)\Windows Kits\10\Debuggers\arm64\Visualizers\Windows.Devices.Geolocation.natvis'
NatVis script unloaded from 'C:\Program Files (x86)\Windows Kits\10\Debuggers\arm64\Visualizers\Windows.Devices.Sensors.natvis'
NatVis script unloaded from 'C:\Program Files (x86)\Windows Kits\10\Debuggers\arm64\Visualizers\Windows.Media.natvis'
NatVis script unloaded from 'C:\Program Files (x86)\Windows Kits\10\Debuggers\arm64\Visualizers\windows.natvis'
NatVis script unloaded from 'C:\Program Files (x86)\Windows Kits\10\Debuggers\arm64\Visualizers\winrt.natvis'
------------------------------------------
stderr: none



---

Some tests failed in compiletest suite=debuginfo mode=debuginfo host=aarch64-pc-windows-msvc target=aarch64-pc-windows-msvc
Bootstrap failed while executing `test --stage 2 --skip=compiler --skip=src`
Build completed unsuccessfully in 1:11:32
make: *** [Makefile:112: ci-msvc-py] Error 1
  local time: Wed Aug 20 22:35:29 CUT 2025
  network time: Wed, 20 Aug 2025 22:35:30 GMT
##[error]Process completed with exit code 2.
Post job cleanup.
[command]"C:\Program Files\Git\bin\git.exe" version

@bors
Copy link
Collaborator

bors commented Aug 20, 2025

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 20, 2025
@BoxyUwU
Copy link
Member

BoxyUwU commented Aug 21, 2025

@bors retry

@bors bors 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 21, 2025
@bors
Copy link
Collaborator

bors commented Aug 21, 2025

⌛ Testing commit c2a0fa8 with merge 922958c...

@bors
Copy link
Collaborator

bors commented Aug 21, 2025

☀️ Test successful - checks-actions
Approved by: BoxyUwU
Pushing 922958c to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 21, 2025
@bors bors merged commit 922958c into rust-lang:master Aug 21, 2025
11 checks passed
@rustbot rustbot added this to the 1.91.0 milestone Aug 21, 2025
Copy link
Contributor

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing 125ff8a (parent) -> 922958c (this PR)

Test differences

Show 41 test diffs

Stage 1

  • [ui] tests/ui/impl-trait/member-constraints/apply_member_constraint-no-req-eq.rs: pass -> [missing] (J1)
  • [ui] tests/ui/impl-trait/member-constraints/apply_member_constraint-no-req-eq.rs#current: [missing] -> pass (J1)
  • [ui] tests/ui/impl-trait/member-constraints/apply_member_constraint-no-req-eq.rs#next: [missing] -> pass (J1)
  • [ui] tests/ui/impl-trait/member-constraints/nested-impl-trait-pass.rs: pass -> [missing] (J1)
  • [ui] tests/ui/impl-trait/member-constraints/nested-impl-trait-pass.rs#current: [missing] -> pass (J1)
  • [ui] tests/ui/impl-trait/member-constraints/nested-impl-trait-pass.rs#next: [missing] -> pass (J1)
  • [ui] tests/ui/impl-trait/no-anonymize-regions.rs: pass -> [missing] (J1)
  • [ui] tests/ui/impl-trait/no-anonymize-regions.rs#current: [missing] -> pass (J1)
  • [ui] tests/ui/impl-trait/no-anonymize-regions.rs#next: [missing] -> pass (J1)

Stage 2

  • [ui] tests/ui/impl-trait/member-constraints/apply_member_constraint-no-req-eq.rs: pass -> [missing] (J0)
  • [ui] tests/ui/impl-trait/member-constraints/apply_member_constraint-no-req-eq.rs#current: [missing] -> pass (J0)
  • [ui] tests/ui/impl-trait/member-constraints/apply_member_constraint-no-req-eq.rs#next: [missing] -> pass (J0)
  • [ui] tests/ui/impl-trait/member-constraints/nested-impl-trait-pass.rs: pass -> [missing] (J0)
  • [ui] tests/ui/impl-trait/member-constraints/nested-impl-trait-pass.rs#current: [missing] -> pass (J0)
  • [ui] tests/ui/impl-trait/member-constraints/nested-impl-trait-pass.rs#next: [missing] -> pass (J0)
  • [ui] tests/ui/impl-trait/no-anonymize-regions.rs: pass -> [missing] (J0)
  • [ui] tests/ui/impl-trait/no-anonymize-regions.rs#current: [missing] -> pass (J0)
  • [ui] tests/ui/impl-trait/no-anonymize-regions.rs#next: [missing] -> pass (J0)

Additionally, 23 doctest diffs were found. These are ignored, as they are noisy.

Job group index

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 922958cffe059e9c156835df19d199ccd861c36a --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. dist-aarch64-apple: 5390.9s -> 6316.2s (17.2%)
  2. x86_64-gnu-llvm-20-1: 3227.5s -> 3703.8s (14.8%)
  3. x86_64-rust-for-linux: 2560.1s -> 2918.0s (14.0%)
  4. dist-x86_64-apple: 8134.3s -> 7021.6s (-13.7%)
  5. aarch64-apple: 5137.3s -> 5662.9s (10.2%)
  6. dist-aarch64-msvc: 6130.5s -> 5518.5s (-10.0%)
  7. dist-various-1: 4265.6s -> 3841.0s (-10.0%)
  8. aarch64-gnu-llvm-19-2: 2230.4s -> 2410.9s (8.1%)
  9. pr-check-1: 1371.4s -> 1476.7s (7.7%)
  10. dist-powerpc-linux: 5435.0s -> 5080.1s (-6.5%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (922958c): comparison URL.

Overall result: ❌ regressions - no action needed

@rustbot label: -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.7% [0.6%, 0.7%] 6
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary 2.9%, secondary -1.0%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.9% [1.1%, 6.1%] 3
Regressions ❌
(secondary)
0.8% [0.8%, 0.8%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.8% [-2.8%, -2.8%] 1
All ❌✅ (primary) 2.9% [1.1%, 6.1%] 3

Cycles

Results (secondary -4.0%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-4.0% [-4.0%, -4.0%] 1
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 471.807s -> 471.588s (-0.05%)
Artifact size: 378.19 MiB -> 378.39 MiB (0.05%)

@rustbot rustbot removed the perf-regression Performance regression. label Aug 21, 2025
@lcnr
Copy link
Contributor Author

lcnr commented Aug 21, 2025

I think recomputing the best_blame_path is causing an actual very minor regression here. It is minor enough and acceptable to me. We could look into optimizing this a bit but borrowck is generally in flux rn for a bit as both me and @amandasystems are touching this area of the code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-types Relevant to the types team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants