Skip to content

Conversation

compiler-errors
Copy link
Member

See the comment I left inline in compiler/rustc_trait_selection/src/traits/normalize.rs.

Fixes #133868

r? lcnr

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 18, 2025
@rustbot
Copy link
Collaborator

rustbot commented Apr 18, 2025

This PR changes a file inside tests/crashes. If a crash was fixed, please move into the corresponding ui subdir and add 'Fixes #' to the PR description to autoclose the issue upon merge.

Comment on lines 78 to 82
let mut errors = fulfill_cx.select_all_or_error(self.infcx);
// Drain pending obligations too, since deep normalization may happen
// in a loop and we don't want to trigger the assertion on the next
// iteration due to pending obligations we've left over.
errors.extend(fulfill_cx.collect_remaining_errors(self.infcx));
Copy link
Contributor

Choose a reason for hiding this comment

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

hmm, fn select_all_or_error is currently implemented as

    fn select_all_or_error(&mut self, infcx: &InferCtxt<'tcx>) -> Vec<E> {
        let errors = self.select_where_possible(infcx);
        if !errors.is_empty() {
            return errors;
        }

        self.collect_remaining_errors(infcx)
    }

it feels a bit footgunny to not add the overflowing obligations if there are other errors. I think changing the if errors.is_empty() branch to also add the remaining errors would be better 🤔

Copy link
Contributor

@lcnr lcnr Apr 19, 2025

Choose a reason for hiding this comment

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

or no, in case select_where_possible returns an error, we want to ignore overflow and ambiguity errors. I think we also want to ignore these ambiguity errors here, so maybe change this to

            let errors = fulfill_cx.select_all_or_error(self.infcx);
            if errors.is_empty() {
                Ok(self.infcx.resolve_vars_if_possible(value))
            } else {
                // In case normalization resulted in an error, we want to
                // drain any still ambiguous goal to avoid triggering the
                // assertion on the next iteration.
                let _ = fulfill_cx.collect_remaining_errors(self.infcx));
                Err(errors)
            }

Copy link
Contributor

@lcnr lcnr Apr 19, 2025

Choose a reason for hiding this comment

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

alternatively we could drop the remaining obligations in the !errors.is_empty() branch in select_all_or_error itself? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

alternatively we could drop the remaining obligations in the !errors.is_empty() branch in select_all_or_error itself? 🤔

Hm, feels like a much larger and more subtle change. I'd rather keep it located to deep normalization.

Copy link
Member Author

Choose a reason for hiding this comment

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

or no, in case select_where_possible returns an error, we want to ignore overflow and ambiguity errors. I think we also want to ignore these ambiguity errors here, so maybe change this to [...]

Functionally equivalent to what I have right now, but I guess alright.

Copy link
Member Author

Choose a reason for hiding this comment

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

Functionally equivalent to what I have right now, but I guess alright.

Correction -- not functionally equivalent, but doesn't matter for UI tests. I originally had let _ = fulfill_cx.collect_remaining_errors(self.infcx)) on the good path of deep norm too, but it felt spooky. I guess it's fine though.

@lcnr
Copy link
Contributor

lcnr commented Apr 19, 2025

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Apr 19, 2025

📌 Commit 47911eb has been approved by lcnr

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 Apr 19, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 20, 2025
…lcnr

Don't ICE on pending obligations from deep normalization in a loop

See the comment I left inline in `compiler/rustc_trait_selection/src/traits/normalize.rs`.

Fixes rust-lang#133868

r? lcnr
@bors
Copy link
Collaborator

bors commented Apr 20, 2025

⌛ Testing commit 47911eb with merge 318f0f7...

@rust-log-analyzer
Copy link
Collaborator

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

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

---- [assembly] tests\assembly\targets\targets-pe.rs#x86_64_unknown_uefi stdout ----

error in revision `x86_64_unknown_uefi`: auxiliary build of D:\a\rust\rust\tests\auxiliary\minicore.rs failed to compile: 
status: exit code: 1
command: PATH="D:\a\rust\rust\build\i686-pc-windows-msvc\stage2\bin;C:\Program Files (x86)\Windows Kits\10\bin\x64;C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.43.34808\bin\HostX64\x64;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.43.34808\bin\HostX64\x86;D:\a\rust\rust\build\i686-pc-windows-msvc\stage0-bootstrap-tools\i686-pc-windows-msvc\release\deps;D:\a\rust\rust\build\i686-pc-windows-msvc\stage0\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\runneradmin\bin;D:\a\rust\rust\ninja;D:\a\rust\rust\sccache;C:\Program Files\MongoDB\Server\5.0\bin;C:\aliyun-cli;C:\vcpkg;C:\Program Files (x86)\NSIS;C:\tools\zstd;C:\Program Files\Mercurial;C:\hostedtoolcache\windows\stack\3.5.1\x64;C:\cabal\bin;C:\ghcup\bin;C:\mingw64\bin;C:\Program Files\dotnet;C:\Program Files\MySQL\MySQL Server 8.0\bin;C:\Program Files\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.21.13\x64\bin;C:\hostedtoolcache\windows\Python\3.9.13\x64\Scripts;C:\hostedtoolcache\windows\Python\3.9.13\x64;C:\hostedtoolcache\windows\Ruby\3.0.7\x64\bin;C:\Program Files\OpenSSL\bin;C:\tools\kotlinc\bin;C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\8.0.442-6\x64\bin;C:\Program Files\ImageMagick-7.1.1-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\dotnet;C:\Program Files\PowerShell\7;C:\Program Files\Microsoft\Web Platform Installer;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn;C:\Program Files\Microsoft SQL Server\150\Tools\Binn;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit;C:\Program Files (x86)\WiX Toolset v3.14\bin;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:\ProgramData\chocolatey\lib\maven\apache-maven-3.9.9\bin;C:\Program Files\Microsoft Service Fabric\bin\Fabric\Fabric.Code;C:\Program Files\Microsoft SDKs\Service Fabric\Tools\ServiceFabricLocalClusterManager;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\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:\Program Files\LLVM\bin;C:\Users\runneradmin\.dotnet\tools;C:\Users\runneradmin\.cargo\bin;C:\Users\runneradmin\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.43.34808\bin\HostX64\x86" "D:\\a\\rust\\rust\\build\\i686-pc-windows-msvc\\stage2\\bin\\rustc.exe" "D:\\a\\rust\\rust\\tests\\auxiliary\\minicore.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=C:\\Users\\runneradmin\\.cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=D:\\a\\rust\\rust\\vendor" "--sysroot" "D:\\a\\rust\\rust\\build\\i686-pc-windows-msvc\\stage2" "--cfg" "x86_64_unknown_uefi" "--check-cfg" "cfg(test,FALSE,aarch64_pc_windows_msvc,aarch64_pc_windows_gnullvm,aarch64_unknown_uefi,aarch64_uwp_windows_msvc,arm64ec_pc_windows_msvc,avr_none,bpfeb_unknown_none,bpfel_unknown_none,i686_pc_windows_gnu,i686_pc_windows_msvc,i686_pc_windows_gnullvm,i686_uwp_windows_gnu,i686_win7_windows_gnu,i686_unknown_uefi,i686_uwp_windows_msvc,i686_win7_windows_msvc,powerpc64_ibm_aix,thumbv7a_uwp_windows_msvc,thumbv7a_pc_windows_msvc,x86_64_pc_windows_gnu,x86_64_pc_windows_gnullvm,x86_64_pc_windows_msvc,x86_64_unknown_uefi,x86_64_uwp_windows_gnu,x86_64_win7_windows_gnu,x86_64_uwp_windows_msvc,x86_64_win7_windows_msvc,x86_64_pc_cygwin)" "-O" "-Cdebug-assertions=no" "-C" "prefer-dynamic" "-o" "D:\\a\\rust\\rust\\build\\i686-pc-windows-msvc\\test\\assembly\\targets\\targets-pe.x86_64_unknown_uefi\\libminicore.rlib" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "--target" "x86_64-unknown-uefi" "-Cpanic=abort" "--crate-type" "rlib" "-Cpanic=abort"
stdout: none
--- stderr -------------------------------
error: couldn't create a temp dir: Access is denied. (os error 5) at path "C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\rustcn3zyao"

error: aborting due to 1 previous error
------------------------------------------


---
test result: FAILED. 468 passed; 1 failed; 70 ignored; 0 measured; 0 filtered out; finished in 25.96s

Some tests failed in compiletest suite=assembly mode=assembly host=i686-pc-windows-msvc target=i686-pc-windows-msvc
Build completed unsuccessfully in 1:42:21
make: *** [Makefile:113: ci-msvc-py] Error 1
  local time: Sun Apr 20 09:21:11 CUT 2025
  network time: Sun, 20 Apr 2025 09:21:11 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 Apr 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 Apr 20, 2025
@compiler-errors
Copy link
Member Author

spurious

@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 Apr 20, 2025
jhpratt added a commit to jhpratt/rust that referenced this pull request Apr 21, 2025
…r=lcnr

Don't ICE on pending obligations from deep normalization in a loop

See the comment I left inline in `compiler/rustc_trait_selection/src/traits/normalize.rs`.

Fixes rust-lang#133868

r? lcnr
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 21, 2025
Rollup of 11 pull requests

Successful merges:

 - rust-lang#139795 (Clarify why SGX code specifies linkage/symbol names for certain statics)
 - rust-lang#139946 (fix missing word in comment)
 - rust-lang#139982 (SystemTime doc tweaks)
 - rust-lang#140009 (docs(LocalKey<T>): clarify that T's Drop shouldn't panic)
 - rust-lang#140021 (Don't ICE on pending obligations from deep normalization in a loop)
 - rust-lang#140036 (Advent of `tests/ui` (misc cleanups and improvements) [4/N])
 - rust-lang#140047 (remove a couple clones)
 - rust-lang#140052 (Fix error when an intra doc link is trying to resolve an empty associated item)
 - rust-lang#140074 (rustdoc-json: Improve test for auto-trait impls)
 - rust-lang#140076 (jsondocck: Require command is at start of line)
 - rust-lang#140081 (Update `libc` to 0.2.172)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 21, 2025
Rollup of 11 pull requests

Successful merges:

 - rust-lang#139795 (Clarify why SGX code specifies linkage/symbol names for certain statics)
 - rust-lang#139946 (fix missing word in comment)
 - rust-lang#139982 (SystemTime doc tweaks)
 - rust-lang#140009 (docs(LocalKey<T>): clarify that T's Drop shouldn't panic)
 - rust-lang#140021 (Don't ICE on pending obligations from deep normalization in a loop)
 - rust-lang#140036 (Advent of `tests/ui` (misc cleanups and improvements) [4/N])
 - rust-lang#140047 (remove a couple clones)
 - rust-lang#140052 (Fix error when an intra doc link is trying to resolve an empty associated item)
 - rust-lang#140074 (rustdoc-json: Improve test for auto-trait impls)
 - rust-lang#140076 (jsondocck: Require command is at start of line)
 - rust-lang#140081 (Update `libc` to 0.2.172)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 21, 2025
Rollup of 11 pull requests

Successful merges:

 - rust-lang#139795 (Clarify why SGX code specifies linkage/symbol names for certain statics)
 - rust-lang#139946 (fix missing word in comment)
 - rust-lang#139982 (SystemTime doc tweaks)
 - rust-lang#140009 (docs(LocalKey<T>): clarify that T's Drop shouldn't panic)
 - rust-lang#140021 (Don't ICE on pending obligations from deep normalization in a loop)
 - rust-lang#140036 (Advent of `tests/ui` (misc cleanups and improvements) [4/N])
 - rust-lang#140047 (remove a couple clones)
 - rust-lang#140052 (Fix error when an intra doc link is trying to resolve an empty associated item)
 - rust-lang#140074 (rustdoc-json: Improve test for auto-trait impls)
 - rust-lang#140076 (jsondocck: Require command is at start of line)
 - rust-lang#140081 (Update `libc` to 0.2.172)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 21, 2025
…enton

Rollup of 8 pull requests

Successful merges:

 - rust-lang#139946 (fix missing word in comment)
 - rust-lang#139982 (SystemTime doc tweaks)
 - rust-lang#140009 (docs(LocalKey<T>): clarify that T's Drop shouldn't panic)
 - rust-lang#140021 (Don't ICE on pending obligations from deep normalization in a loop)
 - rust-lang#140029 (Relocate tests in `tests/ui`)
 - rust-lang#140030 (Fix autodiff debug builds)
 - rust-lang#140120 (Use `output_base_dir` for `mir_dump_dir`)
 - rust-lang#140121 (Document why CodeStats::type_sizes is public)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit f79eef9 into rust-lang:master Apr 21, 2025
6 of 7 checks passed
@rustbot rustbot added this to the 1.88.0 milestone Apr 21, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Apr 21, 2025
Rollup merge of rust-lang#140021 - compiler-errors:no-deep-norm-ice, r=lcnr

Don't ICE on pending obligations from deep normalization in a loop

See the comment I left inline in `compiler/rustc_trait_selection/src/traits/normalize.rs`.

Fixes rust-lang#133868

r? lcnr
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. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ICE: deeply_normalize should not be called with pending obligations
5 participants