Skip to content
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

Don't infer attributes of virtual calls based on the function body #137669

Merged
merged 3 commits into from
Feb 28, 2025

Conversation

DianQK
Copy link
Member

@DianQK DianQK commented Feb 26, 2025

Fixes (after backport) #137646.
Since we don't know the exact implementation of the virtual call, it might write to parameters, we can't infer the readonly attribute.

@rustbot
Copy link
Collaborator

rustbot commented Feb 26, 2025

r? @fmease

rustbot has assigned @fmease.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@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 Feb 26, 2025
@DianQK
Copy link
Member Author

DianQK commented Feb 26, 2025

r? codegen

@@ -648,7 +635,15 @@ fn fn_abi_new_uncached<'tcx>(
conv,
can_unwind: fn_can_unwind(cx.tcx(), fn_def_id, sig.abi),
Copy link
Member

Choose a reason for hiding this comment

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

Do we have the same bug in fn_can_unwind where we are consulting the DefId even if the call is virtual? It sure looks like the same bug to me.

Copy link
Member Author

Choose a reason for hiding this comment

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

I double-checked, and you're right. #[rustc_nounwind] can modify the unwinding behavior. But I think that should be a separate pull request: https://rust.godbolt.org/z/aTWsEMxWq.

Copy link
Member Author

Choose a reason for hiding this comment

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

But I think that should be a separate pull request: https://rust.godbolt.org/z/aTWsEMxWq.

Or we need an explicit semantic on the trait?

Copy link
Member

Choose a reason for hiding this comment

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

Well this is a rustc_ attribute, which in general means it is a hack and not well-designed. So while there is definitely some good design space for declaring non-unwinding, I think just patching up the compiler to make #[rustc_nounwind] sound (which is the idea) is enough for now.

@saethlin
Copy link
Member

Can you squash the commits a little? At least combine the middle two, I think the first and last commits can stand on their own if you want but the middle two are kind of the same thing.

r? saethlin
Then r=me.

@rustbot rustbot assigned saethlin and unassigned workingjubilee Feb 27, 2025
@saethlin saethlin added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Feb 27, 2025
@DianQK
Copy link
Member Author

DianQK commented Feb 27, 2025

I have squashed.

@bors r=saethlin rollup=never p=1
(for beta backport)

@bors
Copy link
Contributor

bors commented Feb 27, 2025

📌 Commit fbe0075 has been approved by saethlin

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 Feb 27, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 27, 2025
Don't infer attributes of virtual calls based on the function body

Fixes (after backport) rust-lang#137646.
Since we don't know the exact implementation of the virtual call, it might write to parameters, we can't infer the readonly attribute.
@bors
Copy link
Contributor

bors commented Feb 27, 2025

⌛ Testing commit fbe0075 with merge b904c2d...

@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)
warning: [email protected]: In file included from llvm-wrapper/PassWrapper.cpp:1:
warning: [email protected]: In file included from llvm-wrapper\LLVMWrapper.h:7:
warning: [email protected]: In file included from D:\a\rust\rust\build\i686-pc-windows-msvc\llvm\include\llvm/Support/raw_ostream.h:16:
warning: [email protected]: In file included from D:\a\rust\rust\build\i686-pc-windows-msvc\llvm\include\llvm/ADT/SmallVector.h:18:
warning: [email protected]: In file included from C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.43.34808\include\algorithm:10:
warning: [email protected]: In file included from C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.43.34808\include\__msvc_heap_algorithms.hpp:11:
warning: [email protected]: In file included from C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.43.34808\include\xutility:15:
warning: [email protected]: In file included from C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.43.34808\include\cwchar:12:
warning: [email protected]: C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\wchar.h(294,13): error: unknown type name '__m128i'
warning: [email protected]:   294 |             __m128i V2 = _mm_set1_epi16((short)_C);
warning: [email protected]:       |             ^
warning: [email protected]: C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\wchar.h(294,26): error: use of undeclared identifier '_mm_set1_epi16'
warning: [email protected]:   294 |             __m128i V2 = _mm_set1_epi16((short)_C);
warning: [email protected]:       |                          ^
warning: [email protected]: C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\wchar.h(298,17): error: unknown type name '__m128i'
warning: [email protected]:   298 |                 __m128i V1 = _mm_loadu_si128((__m128i const*)S);
warning: [email protected]:       |                 ^
warning: [email protected]: C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\wchar.h(298,47): error: use of undeclared identifier '__m128i'
warning: [email protected]:   298 |                 __m128i V1 = _mm_loadu_si128((__m128i const*)S);
warning: [email protected]:       |                                               ^
warning: [email protected]: C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\wchar.h(313,17): error: unknown type name '__m128i'
warning: [email protected]:   313 |                 __m128i V1 = _mm_loadu_si64(S);
warning: [email protected]:       |                 ^
warning: [email protected]: C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\wchar.h(313,30): error: use of undeclared identifier '_mm_loadu_si64'
warning: [email protected]:   313 |                 __m128i V1 = _mm_loadu_si64(S);
warning: [email protected]:       |                              ^
warning: [email protected]: C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\wchar.h(418,13): error: unknown type name '__m128i'
warning: [email protected]:   418 |             __m128i V1 = _mm_loadu_si128((__m128i const*)S1);
warning: [email protected]:       |             ^
warning: [email protected]: C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\wchar.h(418,43): error: use of undeclared identifier '__m128i'
warning: [email protected]:   418 |             __m128i V1 = _mm_loadu_si128((__m128i const*)S1);
warning: [email protected]:       |                                           ^
warning: [email protected]: C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\wchar.h(419,13): error: unknown type name '__m128i'
warning: [email protected]:   419 |             __m128i V2 = _mm_loadu_si128((__m128i const*)S2);
warning: [email protected]:       |             ^
warning: [email protected]: C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\wchar.h(419,43): error: use of undeclared identifier '__m128i'
warning: [email protected]:   419 |             __m128i V2 = _mm_loadu_si128((__m128i const*)S2);
warning: [email protected]:       |                                           ^
warning: [email protected]: C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\wchar.h(436,13): error: unknown type name '__m128i'
warning: [email protected]:   436 |             __m128i V1 = _mm_loadu_si64(S1);
warning: [email protected]:       |             ^
warning: [email protected]: C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\wchar.h(436,26): error: use of undeclared identifier '_mm_loadu_si64'
warning: [email protected]:   436 |             __m128i V1 = _mm_loadu_si64(S1);
warning: [email protected]:       |                          ^
warning: [email protected]: C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\wchar.h(437,13): error: unknown type name '__m128i'
warning: [email protected]:   437 |             __m128i V2 = _mm_loadu_si64(S2);
warning: [email protected]:       |             ^
warning: [email protected]: C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\wchar.h(437,26): error: use of undeclared identifier '_mm_loadu_si64'
warning: [email protected]:   437 |             __m128i V2 = _mm_loadu_si64(S2);
warning: [email protected]: 14 errors generated.
error: failed to run custom build command for `rustc_llvm v0.0.0 (D:\a\rust\rust\compiler\rustc_llvm)`

Caused by:
Caused by:
  process didn't exit successfully: `D:\a\rust\rust\build\i686-pc-windows-msvc\stage0-rustc\release\build\rustc_llvm-3340b85b19977e1c\build-script-build` (exit code: 1)
  --- stdout
  cargo:rustc-check-cfg=cfg(llvm_component,values("ipo"))
  cargo:rustc-check-cfg=cfg(llvm_component,values("bitreader"))
  cargo:rustc-check-cfg=cfg(llvm_component,values("bitwriter"))
  cargo:rustc-check-cfg=cfg(llvm_component,values("linker"))
  cargo:rustc-check-cfg=cfg(llvm_component,values("asmparser"))
  cargo:rustc-check-cfg=cfg(llvm_component,values("lto"))
  cargo:rustc-check-cfg=cfg(llvm_component,values("coverage"))
  cargo:rustc-check-cfg=cfg(llvm_component,values("instrumentation"))
  cargo:rustc-check-cfg=cfg(llvm_component,values("x86"))
  cargo:rustc-check-cfg=cfg(llvm_component,values("arm"))
  cargo:rustc-check-cfg=cfg(llvm_component,values("aarch64"))
  cargo:rustc-check-cfg=cfg(llvm_component,values("amdgpu"))
  cargo:rustc-check-cfg=cfg(llvm_component,values("avr"))
  cargo:rustc-check-cfg=cfg(llvm_component,values("loongarch"))
  cargo:rustc-check-cfg=cfg(llvm_component,values("m68k"))
  cargo:rustc-check-cfg=cfg(llvm_component,values("csky"))
  cargo:rustc-check-cfg=cfg(llvm_component,values("mips"))
  cargo:rustc-check-cfg=cfg(llvm_component,values("powerpc"))
  cargo:rustc-check-cfg=cfg(llvm_component,values("systemz"))
  cargo:rustc-check-cfg=cfg(llvm_component,values("jsbackend"))
  cargo:rustc-check-cfg=cfg(llvm_component,values("webassembly"))
  cargo:rustc-check-cfg=cfg(llvm_component,values("msp430"))
  cargo:rustc-check-cfg=cfg(llvm_component,values("sparc"))
  cargo:rustc-check-cfg=cfg(llvm_component,values("nvptx"))
  cargo:rustc-check-cfg=cfg(llvm_component,values("hexagon"))
  cargo:rustc-check-cfg=cfg(llvm_component,values("riscv"))
  cargo:rustc-check-cfg=cfg(llvm_component,values("xtensa"))
  cargo:rustc-check-cfg=cfg(llvm_component,values("bpf"))
  cargo:rerun-if-env-changed=RUST_CHECK
  cargo:rerun-if-env-changed=REAL_LIBRARY_PATH_VAR
  cargo:rerun-if-env-changed=REAL_LIBRARY_PATH
  cargo:rerun-if-env-changed=LLVM_CONFIG
  cargo:rerun-if-changed=D:\a\rust\rust\build\i686-pc-windows-msvc\llvm\bin\llvm-config.exe
  cargo:rustc-cfg=llvm_component="aarch64"
  cargo:rustc-cfg=llvm_component="amdgpu"
  cargo:rustc-cfg=llvm_component="arm"
  cargo:rustc-cfg=llvm_component="asmparser"
  cargo:rustc-cfg=llvm_component="avr"
  cargo:rustc-cfg=llvm_component="bitreader"
  cargo:rustc-cfg=llvm_component="bitwriter"
  cargo:rustc-cfg=llvm_component="bpf"
  cargo:rustc-cfg=llvm_component="coverage"
  cargo:rustc-cfg=llvm_component="csky"
  cargo:rustc-cfg=llvm_component="hexagon"
  cargo:rustc-cfg=llvm_component="instrumentation"
  cargo:rustc-cfg=llvm_component="ipo"
  cargo:rustc-cfg=llvm_component="linker"
  cargo:rustc-cfg=llvm_component="loongarch"
  cargo:rustc-cfg=llvm_component="lto"
  cargo:rustc-cfg=llvm_component="m68k"
  cargo:rustc-cfg=llvm_component="mips"
  cargo:rustc-cfg=llvm_component="msp430"
  cargo:rustc-cfg=llvm_component="nvptx"
  cargo:rustc-cfg=llvm_component="powerpc"
  cargo:rustc-cfg=llvm_component="riscv"
  cargo:rustc-cfg=llvm_component="sparc"
  cargo:rustc-cfg=llvm_component="systemz"
  cargo:rustc-cfg=llvm_component="webassembly"
  cargo:rustc-cfg=llvm_component="x86"
  cargo:rustc-cfg=llvm_component="xtensa"
  cargo:rerun-if-env-changed=LLVM_ENZYME
  cargo:rerun-if-env-changed=LLVM_RUSTLLVM
  cargo:rerun-if-env-changed=LLVM_ASSERTIONS
  cargo:rerun-if-changed=llvm-wrapper\SymbolWrapper.cpp
  cargo:rerun-if-changed=llvm-wrapper\SuppressLLVMWarnings.h
  cargo:rerun-if-changed=llvm-wrapper\RustWrapper.cpp
  cargo:rerun-if-changed=llvm-wrapper\README
  cargo:rerun-if-changed=llvm-wrapper\PassWrapper.cpp
  cargo:rerun-if-changed=llvm-wrapper\LLVMWrapper.h
  cargo:rerun-if-changed=llvm-wrapper\Linker.cpp
  cargo:rerun-if-changed=llvm-wrapper\CoverageMappingWrapper.cpp
  cargo:rerun-if-changed=llvm-wrapper\ArchiveWrapper.cpp
  cargo:rerun-if-changed=llvm-wrapper\.editorconfig
  OUT_DIR = Some(D:\a\rust\rust\build\i686-pc-windows-msvc\stage0-rustc\i686-pc-windows-msvc\release\build\rustc_llvm-ebdc380be79e4699\out)
  TARGET = Some(i686-pc-windows-msvc)
  cargo:rerun-if-env-changed=VCINSTALLDIR
  VCINSTALLDIR = None
  VCINSTALLDIR = None
  cargo:rerun-if-env-changed=VSTEL_MSBuildProjectFullPath
  VSTEL_MSBuildProjectFullPath = None
  cargo:rerun-if-env-changed=VSCMD_ARG_VCVARS_SPECTRE
  VSCMD_ARG_VCVARS_SPECTRE = None
  cargo:rerun-if-env-changed=WindowsSdkDir
  WindowsSdkDir = None
  cargo:rerun-if-env-changed=WindowsSDKVersion
  WindowsSDKVersion = None
  cargo:rerun-if-env-changed=LIB
  LIB = None
  PATH = Some(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.3.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)
  cargo:rerun-if-env-changed=INCLUDE
  INCLUDE = None
  HOST = Some(i686-pc-windows-msvc)
  cargo:rerun-if-env-changed=CXX_i686-pc-windows-msvc
  CXX_i686-pc-windows-msvc = None
  cargo:rerun-if-env-changed=CXX_i686_pc_windows_msvc
  CXX_i686_pc_windows_msvc = None
  cargo:rerun-if-env-changed=HOST_CXX
  cargo:rerun-if-env-changed=CXX
  CXX = Some(D:/a/rust/rust/citools/clang-rust/bin/clang-cl.exe)
  RUSTC_WRAPPER = Some(D:\a\rust\rust\build\bootstrap\debug\rustc)
  cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
  cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = Some(crt-static,fxsr,sse,sse2,x87)
  cargo:rerun-if-env-changed=CXXFLAGS_i686-pc-windows-msvc
  CXXFLAGS_i686-pc-windows-msvc = None
  cargo:rerun-if-env-changed=CXXFLAGS_i686_pc_windows_msvc
  CXXFLAGS_i686_pc_windows_msvc = None
  CXXFLAGS_i686_pc_windows_msvc = None
  cargo:rerun-if-env-changed=HOST_CXXFLAGS
  HOST_CXXFLAGS = None
  cargo:rerun-if-env-changed=CXXFLAGS
  CXXFLAGS = None
  CARGO_ENCODED_RUSTFLAGS = Some(--cfg=bootstrap--cfg=windows_raw_dylib-Csymbol-mangling-version=v0-Zunstable-options--check-cfg=cfg(bootstrap)--check-cfg=cfg(llvm_enzyme)-Zmacro-backtrace-Csplit-debuginfo=packed-Ctarget-feature=+crt-static-Wrustc::internal-Drustc::symbol_intern_string_literal-Wkeyword_idents_2024-Wunsafe_op_in_unsafe_fn-Alinker-messages-Zon-broken-pipe=kill)
  cargo:warning=In file included from llvm-wrapper/PassWrapper.cpp:1:
  cargo:warning=In file included from llvm-wrapper\LLVMWrapper.h:7:
  cargo:warning=In file included from D:\a\rust\rust\build\i686-pc-windows-msvc\llvm\include\llvm/Support/raw_ostream.h:16:
  cargo:warning=In file included from D:\a\rust\rust\build\i686-pc-windows-msvc\llvm\include\llvm/ADT/SmallVector.h:18:
  cargo:warning=In file included from C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.43.34808\include\algorithm:10:
  cargo:warning=In file included from C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.43.34808\include\__msvc_heap_algorithms.hpp:11:
  cargo:warning=In file included from C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.43.34808\include\xutility:15:
  cargo:warning=In file included from C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.43.34808\include\cwchar:12:
  cargo:warning=C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\wchar.h(294,13): error: unknown type name '__m128i'
  cargo:warning=  294 |             __m128i V2 = _mm_set1_epi16((short)_C);
  cargo:warning=      |             ^
  cargo:warning=C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\wchar.h(294,26): error: use of undeclared identifier '_mm_set1_epi16'
  cargo:warning=  294 |             __m128i V2 = _mm_set1_epi16((short)_C);
  cargo:warning=      |                          ^
  cargo:warning=C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\wchar.h(298,17): error: unknown type name '__m128i'
  cargo:warning=  298 |                 __m128i V1 = _mm_loadu_si128((__m128i const*)S);
  cargo:warning=      |                 ^
  cargo:warning=C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\wchar.h(298,47): error: use of undeclared identifier '__m128i'
  cargo:warning=  298 |                 __m128i V1 = _mm_loadu_si128((__m128i const*)S);
  cargo:warning=      |                                               ^
  cargo:warning=C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\wchar.h(313,17): error: unknown type name '__m128i'
  cargo:warning=  313 |                 __m128i V1 = _mm_loadu_si64(S);
  cargo:warning=      |                 ^
  cargo:warning=C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\wchar.h(313,30): error: use of undeclared identifier '_mm_loadu_si64'
  cargo:warning=  313 |                 __m128i V1 = _mm_loadu_si64(S);
  cargo:warning=      |                              ^
  cargo:warning=C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\wchar.h(418,13): error: unknown type name '__m128i'
  cargo:warning=  418 |             __m128i V1 = _mm_loadu_si128((__m128i const*)S1);
  cargo:warning=      |             ^
  cargo:warning=C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\wchar.h(418,43): error: use of undeclared identifier '__m128i'
  cargo:warning=  418 |             __m128i V1 = _mm_loadu_si128((__m128i const*)S1);
  cargo:warning=      |                                           ^
  cargo:warning=C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\wchar.h(419,13): error: unknown type name '__m128i'
  cargo:warning=  419 |             __m128i V2 = _mm_loadu_si128((__m128i const*)S2);
  cargo:warning=      |             ^
  cargo:warning=C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\wchar.h(419,43): error: use of undeclared identifier '__m128i'
  cargo:warning=  419 |             __m128i V2 = _mm_loadu_si128((__m128i const*)S2);
  cargo:warning=      |                                           ^
  cargo:warning=C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\wchar.h(436,13): error: unknown type name '__m128i'
  cargo:warning=  436 |             __m128i V1 = _mm_loadu_si64(S1);
  cargo:warning=      |             ^
  cargo:warning=C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\wchar.h(436,26): error: use of undeclared identifier '_mm_loadu_si64'
  cargo:warning=  436 |             __m128i V1 = _mm_loadu_si64(S1);
  cargo:warning=      |                          ^
  cargo:warning=C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\wchar.h(437,13): error: unknown type name '__m128i'
  cargo:warning=  437 |             __m128i V2 = _mm_loadu_si64(S2);
  cargo:warning=      |             ^
  cargo:warning=C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\wchar.h(437,26): error: use of undeclared identifier '_mm_loadu_si64'
  cargo:warning=  437 |             __m128i V2 = _mm_loadu_si64(S2);
  cargo:warning=      |                          ^
  cargo:warning=14 errors generated.
  --- stderr



  error occurred in cc-rs: Command "D:/a/rust/rust/citools/clang-rust/bin/clang-cl.exe" "-nologo" "-MT" "-O2" "-Brepro" "-m32" "-arch:IA32" "-ID:\\a\\rust\\rust\\build\\i686-pc-windows-msvc\\llvm\\include" "-std:c++17" "/EHs-c-" "/GR-" "-D_GLIBCXX_ASSERTIONS" "-D_LARGEFILE_SOURCE" "-D_FILE_OFFSET_BITS=64" "-D_CRT_SECURE_NO_DEPRECATE" "-D_CRT_SECURE_NO_WARNINGS" "-D_CRT_NONSTDC_NO_DEPRECATE" "-D_CRT_NONSTDC_NO_WARNINGS" "-D_SCL_SECURE_NO_DEPRECATE" "-D_SCL_SECURE_NO_WARNINGS" "-DUNICODE" "-D_UNICODE" "-D__STDC_CONSTANT_MACROS" "-D__STDC_FORMAT_MACROS" "-D__STDC_LIMIT_MACROS" "-DLLVM_COMPONENT_AARCH64" "-DLLVM_COMPONENT_AMDGPU" "-DLLVM_COMPONENT_ARM" "-DLLVM_COMPONENT_ASMPARSER" "-DLLVM_COMPONENT_AVR" "-DLLVM_COMPONENT_BITREADER" "-DLLVM_COMPONENT_BITWRITER" "-DLLVM_COMPONENT_BPF" "-DLLVM_COMPONENT_COVERAGE" "-DLLVM_COMPONENT_CSKY" "-DLLVM_COMPONENT_HEXAGON" "-DLLVM_COMPONENT_INSTRUMENTATION" "-DLLVM_COMPONENT_IPO" "-DLLVM_COMPONENT_LINKER" "-DLLVM_COMPONENT_LOONGARCH" "-DLLVM_COMPONENT_LTO" "-DLLVM_COMPONENT_M68K" "-DLLVM_COMPONENT_MIPS" "-DLLVM_COMPONENT_MSP430" "-DLLVM_COMPONENT_NVPTX" "-DLLVM_COMPONENT_POWERPC" "-DLLVM_COMPONENT_RISCV" "-DLLVM_COMPONENT_SPARC" "-DLLVM_COMPONENT_SYSTEMZ" "-DLLVM_COMPONENT_WEBASSEMBLY" "-DLLVM_COMPONENT_X86" "-DLLVM_COMPONENT_XTENSA" "-DLLVM_RUSTLLVM" "-FoD:\\a\\rust\\rust\\build\\i686-pc-windows-msvc\\stage0-rustc\\i686-pc-windows-msvc\\release\\build\\rustc_llvm-ebdc380be79e4699\\out\\ef10e86dc40538c1-PassWrapper.o" "-c" "--" "llvm-wrapper/PassWrapper.cpp" with args clang-cl.exe did not execute successfully (status code exit code: 1).

warning: build failed, waiting for other jobs to finish...
[RUSTC-TIMING] rustc_ty_utils test:false 60.972
[RUSTC-TIMING] rustc_lint test:false 104.627
[RUSTC-TIMING] rustc_lint test:false 104.627
[RUSTC-TIMING] rustc_trait_selection test:false 195.793
Build completed unsuccessfully in 0:23:02
make: *** [Makefile:111: ci-msvc-py] Error 1
  network time: Thu, 27 Feb 2025 10:37:22 GMT
##[error]Process completed with exit code 2.
Post job cleanup.
[command]"C:\Program Files\Git\bin\git.exe" version

@bors
Copy link
Contributor

bors commented Feb 27, 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 Feb 27, 2025
can_unwind: fn_can_unwind(cx.tcx(), fn_def_id, sig.abi),
can_unwind: fn_can_unwind(
tcx,
// Since `#[rustc_nounwind]` can change unwinding, we cannot infer unwinding by `fn_def_id` for a virtual call.
Copy link
Member

Choose a reason for hiding this comment

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

If you apply #[rustc_nounwind] on a trait method, it should be fine to assume that all calls of this trait method don't unwind, right? If any of the implementations doesn't use #[rustc_nounwind], that should probably be reported as error.

Copy link
Member Author

@DianQK DianQK Feb 27, 2025

Choose a reason for hiding this comment

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

As it stands, the semantics are somewhat ambiguous; rustc currently only applies this to the annotated function. But I also think the constraint is fine. I will create an issue for it.

Copy link
Member Author

Choose a reason for hiding this comment

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

@DianQK
Copy link
Member Author

DianQK commented Feb 27, 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 Feb 27, 2025
@jieyouxu
Copy link
Member

@bors p=5 (rollup scheduling)

@bors
Copy link
Contributor

bors commented Feb 28, 2025

⌛ Testing commit fbe0075 with merge e6059f5...

@bors
Copy link
Contributor

bors commented Feb 28, 2025

☀️ Test successful - checks-actions
Approved by: saethlin
Pushing e6059f5 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Feb 28, 2025
@bors bors merged commit e6059f5 into rust-lang:master Feb 28, 2025
7 checks passed
@rustbot rustbot added this to the 1.87.0 milestone Feb 28, 2025
@DianQK DianQK deleted the fn-atts-virtual branch February 28, 2025 04:49
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (e6059f5): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

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

Max RSS (memory usage)

Results (secondary -2.4%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

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

Cycles

Results (primary -2.6%, secondary 2.5%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

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

Binary size

Results (primary -0.0%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

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

Bootstrap: 770.19s -> 771.509s (0.17%)
Artifact size: 362.00 MiB -> 361.90 MiB (-0.03%)

@apiraino
Copy link
Contributor

apiraino commented Mar 6, 2025

Beta backport accepted as per compiler team on Zulip. A backport PR will be authored by the release team at the end of the current development cycle. Backport labels handled by them.

@rustbot label +beta-accepted

@rustbot rustbot added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta-accepted Accepted for backporting to the compiler in the beta channel. beta-nominated Nominated for backporting to the compiler in the beta channel. 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.