rust icon indicating copy to clipboard operation
rust copied to clipboard

Implement intrinsics with fallback bodies

Open oli-obk opened this issue 5 months ago • 26 comments

fixes #93145 (though we can port many more intrinsics) fixes #63585

The way this works is that the backend logic for generating custom code for intrinsics has been made fallible. The only failure path is "this intrinsic is unknown". The Instance (that was InstanceDef::Intrinsic) then gets converted to InstanceDef::Item, which represents the fallback body. A regular function call to that body is then codegenned. This is currently implemented for

  • codegen_ssa (so llvm and gcc)
  • codegen_cranelift

other backends will need to adjust, but they can just keep doing what they were doing if they prefer (though adding new intrinsics to the compiler will then require them to implement them, instead of getting the fallback body).

cc @scottmcm @WaffleLapkin

todo

  • [ ] miri support
  • [x] default intrinsic name to name of function instead of requiring it to be specified in attribute
  • [x] make sure that the bodies are always available (must be collected for metadata)

oli-obk avatar Jan 30 '24 16:01 oli-obk

r? @Mark-Simulacrum

(rustbot has picked a reviewer for you, use r? to override)

rustbot avatar Jan 30 '24 16:01 rustbot

Some changes occurred in compiler/rustc_codegen_gcc

cc @antoyo, @GuillaumeGomez

Some changes occurred in compiler/rustc_codegen_cranelift

cc @bjorn3

Some changes occurred to the CTFE / Miri engine

cc @rust-lang/miri

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

rustbot avatar Jan 30 '24 16:01 rustbot

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
#13 3.622 Building wheels for collected packages: reuse
#13 3.622   Building wheel for reuse (pyproject.toml): started
#13 3.951   Building wheel for reuse (pyproject.toml): finished with status 'done'
#13 3.951   Created wheel for reuse: filename=reuse-1.1.0-cp310-cp310-manylinux_2_35_x86_64.whl size=180123 sha256=f323ccf11d14c5b11f6d5e70edb46e391f4b49a5df5c7d922224477ad8ee15c5
#13 3.952   Stored in directory: /tmp/pip-ephem-wheel-cache-zo8ag8hi/wheels/c2/3c/b9/1120c2ab4bd82694f7e6f0537dc5b9a085c13e2c69a8d0c76d
#13 3.954 Installing collected packages: boolean-py, binaryornot, setuptools, reuse, python-debian, markupsafe, license-expression, jinja2, chardet
#13 3.976   Attempting uninstall: setuptools
#13 3.976     Found existing installation: setuptools 59.6.0
#13 3.977     Not uninstalling setuptools at /usr/lib/python3/dist-packages, outside environment /usr
---
    library/core/src/intrinsics.rs - intrinsics::is_val_statically_known (line 2551)

test result: FAILED. 4539 passed; 2 failed; 42 ignored; 0 measured; 0 filtered out; finished in 140.76s

error: doctest failed, to rerun pass `-p core --doc`
  local time: Tue Jan 30 17:07:27 UTC 2024
  network time: Tue, 30 Jan 2024 17:07:27 GMT
##[error]Process completed with exit code 1.
Post job cleanup.

rust-log-analyzer avatar Jan 30 '24 17:01 rust-log-analyzer

The job x86_64-gnu-llvm-16 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
#12 writing image sha256:74d040f5a70796f7c004c2fb07b3c102c104519e1c8a61a8789d9d356bb4e6dc done
#12 naming to docker.io/library/rust-ci done
#12 DONE 10.1s
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-16]
##[group]Clock drift check
  local time: Tue Jan 30 17:37:08 UTC 2024
  network time: Tue, 30 Jan 2024 17:37:08 GMT
  network time: Tue, 30 Jan 2024 17:37:08 GMT
##[endgroup]
sccache: Starting the server...
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-16', '--enable-llvm-link-shared', '--set', 'rust.thin-lto-import-instr-limit=10', '--set', 'change-id=99999999', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'build.optimized-compiler-builtins', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--enable-new-symbol-mangling']
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-16/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.thin-lto-import-instr-limit := 10
configure: change-id            := 99999999
---
##[endgroup]
Testing GCC stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
   Compiling y v0.1.0 (/checkout/compiler/rustc_codegen_gcc/build_system)
    Finished release [optimized] target(s) in 1.41s
     Running `/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-codegen/x86_64-unknown-linux-gnu/release/y test --use-system-gcc --use-backend gcc --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/cg_gcc --release --no-default-features --mini-tests --std-tests`
Using system GCC
Using system GCC
[BUILD] example
[AOT] mini_core_hello_world
/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/cg_gcc/mini_core_hello_world
abc
---
---- [run-make] tests/run-make-fulldeps/hotplug_codegen_backend stdout ----

error: make failed
status: exit status: 2
command: cd "/checkout/tests/run-make-fulldeps/hotplug_codegen_backend" && env -u CARGO_MAKEFLAGS -u MAKEFLAGS -u MFLAGS -u RUSTFLAGS AR="ar" CC="cc -ffunction-sections -fdata-sections -fPIC -m64" CXX="c++ -ffunction-sections -fdata-sections -fPIC -m64" HOST_RPATH_DIR="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" LD_LIB_PATH_ENVVAR="LD_LIBRARY_PATH" LLVM_BIN_DIR="/usr/lib/llvm-16/bin" LLVM_COMPONENTS="aarch64 aarch64asmparser aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils aggressiveinstcombine all all-targets amdgpu amdgpuasmparser amdgpucodegen amdgpudesc amdgpudisassembler amdgpuinfo amdgputargetmca amdgpuutils analysis arm armasmparser armcodegen armdesc armdisassembler arminfo armutils asmparser asmprinter avr avrasmparser avrcodegen avrdesc avrdisassembler avrinfo binaryformat bitreader bitstreamreader bitwriter bpf bpfasmparser bpfcodegen bpfdesc bpfdisassembler bpfinfo cfguard codegen core coroutines coverage debuginfocodeview debuginfodwarf debuginfogsym debuginfologicalview debuginfomsf debuginfopdb demangle dlltooldriver dwarflinker dwarflinkerparallel dwp engine executionengine extensions filecheck frontendhlsl frontendopenacc frontendopenmp fuzzercli fuzzmutate globalisel hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo instcombine instrumentation interfacestub interpreter ipo irprinter irreader jitlink lanai lanaiasmparser lanaicodegen lanaidesc lanaidisassembler lanaiinfo libdriver lineeditor linker loongarch loongarchasmparser loongarchcodegen loongarchdesc loongarchdisassembler loongarchinfo lto m68k m68kasmparser m68kcodegen m68kdesc m68kdisassembler m68kinfo mc mca mcdisassembler mcjit mcparser mips mipsasmparser mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430 msp430asmparser msp430codegen msp430desc msp430disassembler msp430info native nativecodegen nvptx nvptxcodegen nvptxdesc nvptxinfo objcarcopts objcopy object objectyaml option orcjit orcshared orctargetprocess passes perfjitevents powerpc powerpcasmparser powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata remarks riscv riscvasmparser riscvcodegen riscvdesc riscvdisassembler riscvinfo riscvtargetmca runtimedyld scalaropts selectiondag sparc sparcasmparser sparccodegen sparcdesc sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target targetparser textapi transformutils ve veasmparser vecodegen vectorize vedesc vedisassembler veinfo webassembly webassemblyasmparser webassemblycodegen webassemblydesc webassemblydisassembler webassemblyinfo webassemblyutils windowsdriver windowsmanifest x86 x86asmparser x86codegen x86desc x86disassembler x86info x86targetmca xcore xcorecodegen xcoredesc xcoredisassembler xcoreinfo xray" LLVM_FILECHECK="/usr/lib/llvm-16/bin/FileCheck" NODE="/usr/bin/node" PYTHON="/usr/bin/python3" RUSTC="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" RUSTDOC="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc" RUST_BUILD_STAGE="stage2-x86_64-unknown-linux-gnu" S="/checkout" TARGET="x86_64-unknown-linux-gnu" TARGET_RPATH_DIR="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" TMPDIR="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/hotplug_codegen_backend/hotplug_codegen_backend" "make"
--- stdout -------------------------------
LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/hotplug_codegen_backend/hotplug_codegen_backend:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/hotplug_codegen_backend/hotplug_codegen_backend -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/hotplug_codegen_backend/hotplug_codegen_backend  -Ainternal_features the_backend.rs --crate-name the_backend --crate-type dylib \
 -o /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/hotplug_codegen_backend/hotplug_codegen_backend/the_backend.dylib
--- stderr -------------------------------
warning: ignoring --out-dir flag due to -o flag

error[E0412]: cannot find type `Symbol` in this scope
error[E0412]: cannot find type `Symbol` in this scope
Build completed unsuccessfully in 0:31:55
##[error]  --> the_backend.rs:92:50
   |
92 |     fn overridden_intrinsics(&self) -> &'static [Symbol] {
   |
help: consider importing this struct
   |
16 + use rustc_span::Symbol;

rust-log-analyzer avatar Jan 30 '24 18:01 rust-log-analyzer

Thanks for working on this, Oli! I'm really excited 🎉

scottmcm avatar Jan 30 '24 19:01 scottmcm

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
    Checking rustdoc v0.0.0 (/checkout/src/librustdoc)
error[E0308]: mismatched types
   --> src/librustdoc/clean/types.rs:646:59
    |
646 |                         intrinsic_operation_unsafety(tcx, self.def_id().unwrap())
    |                         ----------------------------      ^^^^^^^^^^^^^^^^^^^^^^ expected `LocalDefId`, found `DefId`
    |                         arguments to this function are incorrect
    |
note: function defined here
   --> /checkout/compiler/rustc_hir_analysis/src/check/intrinsic.rs:73:8
   --> /checkout/compiler/rustc_hir_analysis/src/check/intrinsic.rs:73:8
    |
73  | pub fn intrinsic_operation_unsafety(tcx: TyCtxt<'_>, intrinsic_id: LocalDefId) -> hir::Unsafety {

For more information about this error, try `rustc --explain E0308`.
error: could not compile `rustdoc` (lib) due to 1 previous error
Build completed unsuccessfully in 0:02:12

rust-log-analyzer avatar Jan 31 '24 14:01 rust-log-analyzer

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
#13 3.784 Building wheels for collected packages: reuse
#13 3.785   Building wheel for reuse (pyproject.toml): started
#13 4.110   Building wheel for reuse (pyproject.toml): finished with status 'done'
#13 4.111   Created wheel for reuse: filename=reuse-1.1.0-cp310-cp310-manylinux_2_35_x86_64.whl size=180123 sha256=f323ccf11d14c5b11f6d5e70edb46e391f4b49a5df5c7d922224477ad8ee15c5
#13 4.111   Stored in directory: /tmp/pip-ephem-wheel-cache-db6wrqjr/wheels/c2/3c/b9/1120c2ab4bd82694f7e6f0537dc5b9a085c13e2c69a8d0c76d
#13 4.114 Installing collected packages: boolean-py, binaryornot, setuptools, reuse, python-debian, markupsafe, license-expression, jinja2, chardet
#13 4.137   Attempting uninstall: setuptools
#13 4.138     Found existing installation: setuptools 59.6.0
#13 4.139     Not uninstalling setuptools at /usr/lib/python3/dist-packages, outside environment /usr
---
    Checking rustdoc v0.0.0 (/checkout/src/librustdoc)
error[E0308]: mismatched types
   --> src/librustdoc/clean/types.rs:646:59
    |
646 |                         intrinsic_operation_unsafety(tcx, self.def_id().unwrap())
    |                         ----------------------------      ^^^^^^^^^^^^^^^^^^^^^^ expected `LocalDefId`, found `DefId`
    |                         arguments to this function are incorrect
    |
note: function defined here
   --> /checkout/compiler/rustc_hir_analysis/src/check/intrinsic.rs:73:8
   --> /checkout/compiler/rustc_hir_analysis/src/check/intrinsic.rs:73:8
    |
73  | pub fn intrinsic_operation_unsafety(tcx: TyCtxt<'_>, intrinsic_id: LocalDefId) -> hir::Unsafety {

For more information about this error, try `rustc --explain E0308`.
error: could not compile `rustdoc` (lib) due to 1 previous error
Build completed unsuccessfully in 0:02:03

rust-log-analyzer avatar Jan 31 '24 14:01 rust-log-analyzer

Some changes occurred in src/librustdoc/clean/types.rs

cc @camelid

rustbot avatar Jan 31 '24 15:01 rustbot

The job x86_64-gnu-llvm-16 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
#12 writing image sha256:94e1ae93a84a1dc7c8009b48339a4a79a0f509e88fe1195df05cd59dc70c5f7d done
#12 naming to docker.io/library/rust-ci done
#12 DONE 10.1s
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-16]
##[group]Clock drift check
  local time: Wed Jan 31 15:14:39 UTC 2024
  network time: Wed, 31 Jan 2024 15:14:39 GMT
  network time: Wed, 31 Jan 2024 15:14:39 GMT
##[endgroup]
sccache: Starting the server...
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-16', '--enable-llvm-link-shared', '--set', 'rust.thin-lto-import-instr-limit=10', '--set', 'change-id=99999999', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'build.optimized-compiler-builtins', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--enable-new-symbol-mangling']
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-16/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.thin-lto-import-instr-limit := 10
configure: change-id            := 99999999
---
##[endgroup]
Testing GCC stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
   Compiling y v0.1.0 (/checkout/compiler/rustc_codegen_gcc/build_system)
    Finished release [optimized] target(s) in 1.39s
     Running `/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-codegen/x86_64-unknown-linux-gnu/release/y test --use-system-gcc --use-backend gcc --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/cg_gcc --release --no-default-features --mini-tests --std-tests`
Using system GCC
Using system GCC
[BUILD] example
[AOT] mini_core_hello_world
/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/cg_gcc/mini_core_hello_world
abc
---
##[endgroup]
##[group]Testing stage2 book unstable-book (x86_64-unknown-linux-gnu)


command did not execute successfully: CFG_RELEASE_CHANNEL="nightly" RUSTC_BOOTSTRAP="1" RUSTC_STAGE="2" RUSTC_SYSROOT="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" RUSTDOC_LIBDIR="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" RUSTDOC_REAL="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc" RUST_TEST_THREADS="16" "/checkout/obj/build/bootstrap/debug/rustdoc" "-Wrustdoc::invalid_codeblock_attributes" "-Dwarnings" "-Znormalize-docs" "-Z" "unstable-options" "--test" "/checkout/src/doc/unstable-book/src/language-features/intrinsics.md" "--test-args" ""
expected success, got: exit status: 101

stdout ----


running 2 tests
test /checkout/src/doc/unstable-book/src/language-features/intrinsics.md - The_tracking_issue_for_this_feature_is__None_::Intrinsics_with_fallback_logic (line 18) ... FAILED
test /checkout/src/doc/unstable-book/src/language-features/intrinsics.md - The_tracking_issue_for_this_feature_is__None_::Intrinsics_without_fallback_logic (line 44) ... ok

failures:

---- /checkout/src/doc/unstable-book/src/language-features/intrinsics.md - The_tracking_issue_for_this_feature_is__None_::Intrinsics_with_fallback_logic (line 18) stdout ----
error[E0658]: the `#[rustc_intrinsic]` attribute is used to declare intrinsics with function bodies
  |
5 | #[rustc_intrinsic]
  | ^^^^^^^^^^^^^^^^^^
  |

rust-log-analyzer avatar Jan 31 '24 15:01 rust-log-analyzer

Should finally be ready. We don't need miri support from the get go, so I'd rather do it in a separate PR.

oli-obk avatar Jan 31 '24 21:01 oli-obk

cg_clif changes LGTM

bjorn3 avatar Feb 01 '24 10:02 bjorn3

The job x86_64-gnu-llvm-16 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
#12 writing image sha256:a540f073d96d2505df7bb961c1d6f53eba09ffc5d0ed437fd680cced3bac488d done
#12 naming to docker.io/library/rust-ci done
#12 DONE 10.1s
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-16]
##[group]Clock drift check
  local time: Thu Feb  1 21:43:50 UTC 2024
  network time: Thu, 01 Feb 2024 21:43:50 GMT
  network time: Thu, 01 Feb 2024 21:43:50 GMT
##[endgroup]
sccache: Starting the server...
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-16', '--enable-llvm-link-shared', '--set', 'rust.thin-lto-import-instr-limit=10', '--set', 'change-id=99999999', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'build.optimized-compiler-builtins', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--enable-new-symbol-mangling']
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-16/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.thin-lto-import-instr-limit := 10
configure: change-id            := 99999999
---
##[endgroup]
Testing GCC stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
   Compiling y v0.1.0 (/checkout/compiler/rustc_codegen_gcc/build_system)
    Finished release [optimized] target(s) in 1.36s
     Running `/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-codegen/x86_64-unknown-linux-gnu/release/y test --use-system-gcc --use-backend gcc --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/cg_gcc --release --no-default-features --mini-tests --std-tests`
Using system GCC
Using system GCC
[BUILD] example
[AOT] mini_core_hello_world
/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/cg_gcc/mini_core_hello_world
abc
---
##[endgroup]
##[group]Testing stage2 book unstable-book (x86_64-unknown-linux-gnu)


command did not execute successfully: CFG_RELEASE_CHANNEL="nightly" RUSTC_BOOTSTRAP="1" RUSTC_STAGE="2" RUSTC_SYSROOT="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" RUSTDOC_LIBDIR="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" RUSTDOC_REAL="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc" RUST_TEST_THREADS="16" "/checkout/obj/build/bootstrap/debug/rustdoc" "-Wrustdoc::invalid_codeblock_attributes" "-Dwarnings" "-Znormalize-docs" "-Z" "unstable-options" "--test" "/checkout/src/doc/unstable-book/src/language-features/intrinsics.md" "--test-args" ""
Build completed unsuccessfully in 0:31:47

stdout ----

rust-log-analyzer avatar Feb 01 '24 22:02 rust-log-analyzer

The Miri subtree was changed

cc @rust-lang/miri

rustbot avatar Feb 02 '24 14:02 rustbot

@bors r=WaffleLapkin

oli-obk avatar Feb 02 '24 14:02 oli-obk

:pushpin: Commit 585e76a78cca40677c5045189a0d607c82e514cd has been approved by WaffleLapkin

It is now in the queue for this repository.

bors avatar Feb 02 '24 14:02 bors

:evergreen_tree: The tree is currently closed for pull requests below priority 100. This pull request will be tested once the tree is reopened.

bors avatar Feb 02 '24 14:02 bors

@bors r=WaffleLapkin

oli-obk avatar Feb 02 '24 16:02 oli-obk

:pushpin: Commit 9ba77d706b6af6d6cb0e8f57d4fb82672430b152 has been approved by WaffleLapkin

It is now in the queue for this repository.

bors avatar Feb 02 '24 16:02 bors

:evergreen_tree: The tree is currently closed for pull requests below priority 100. This pull request will be tested once the tree is reopened.

bors avatar Feb 02 '24 16:02 bors

Miri support is still marked as todo in the PR description. What does the interpreter do when encountering a call to such an intrinsic?

RalfJung avatar Feb 02 '24 18:02 RalfJung

The job x86_64-gnu-llvm-16 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
#12 writing image sha256:fadd99c94adc89fc5b3d7d5771ffdc32f544f5004be330c1373b718b44fc19f8 done
#12 naming to docker.io/library/rust-ci done
#12 DONE 10.2s
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-16]
##[group]Clock drift check
  local time: Fri Feb  2 19:34:06 UTC 2024
  network time: Fri, 02 Feb 2024 19:34:06 GMT
  network time: Fri, 02 Feb 2024 19:34:06 GMT
##[endgroup]
sccache: Starting the server...
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-16', '--enable-llvm-link-shared', '--set', 'rust.thin-lto-import-instr-limit=10', '--set', 'change-id=99999999', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'build.optimized-compiler-builtins', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--enable-new-symbol-mangling']
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-16/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.thin-lto-import-instr-limit := 10
configure: change-id            := 99999999
---
##[endgroup]
Testing GCC stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
   Compiling y v0.1.0 (/checkout/compiler/rustc_codegen_gcc/build_system)
    Finished release [optimized] target(s) in 1.38s
     Running `/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-codegen/x86_64-unknown-linux-gnu/release/y test --use-system-gcc --use-backend gcc --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/cg_gcc --release --no-default-features --mini-tests --std-tests`
Using system GCC
Using system GCC
[BUILD] example
[AOT] mini_core_hello_world
/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/cg_gcc/mini_core_hello_world
abc
---
##[endgroup]
##[group]Testing stage2 book unstable-book (x86_64-unknown-linux-gnu)


command did not execute successfully: CFG_RELEASE_CHANNEL="nightly" RUSTC_BOOTSTRAP="1" RUSTC_STAGE="2" RUSTC_SYSROOT="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" RUSTDOC_LIBDIR="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" RUSTDOC_REAL="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc" RUST_TEST_THREADS="16" "/checkout/obj/build/bootstrap/debug/rustdoc" "-Wrustdoc::invalid_codeblock_attributes" "-Dwarnings" "-Znormalize-docs" "-Z" "unstable-options" "--test" "/checkout/src/doc/unstable-book/src/language-features/intrinsics.md" "--test-args" ""
Build completed unsuccessfully in 0:32:18

stdout ----

---
---- /checkout/src/doc/unstable-book/src/language-features/intrinsics.md - The_tracking_issue_for_this_feature_is__None_::Intrinsics_with_fallback_logic (line 28) stdout ----
error[E0015]: cannot call non-const formatting macro in constant functions
##[error]  --> /checkout/src/doc/unstable-book/src/language-features/intrinsics.md:38:41
   |
12 |         eprintln!("noisy const dealloc: {ptr:p}, {size}, {align}")
   |
   = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
   = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `eprintln` (in Nightly builds, run with -Z macro-backtrace for more info)


error[E0015]: cannot call non-const formatting macro in constant functions
##[error]  --> /checkout/src/doc/unstable-book/src/language-features/intrinsics.md:38:50
   |
12 |         eprintln!("noisy const dealloc: {ptr:p}, {size}, {align}")
   |
   = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
   = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `eprintln` (in Nightly builds, run with -Z macro-backtrace for more info)


error[E0015]: cannot call non-const formatting macro in constant functions
##[error]  --> /checkout/src/doc/unstable-book/src/language-features/intrinsics.md:38:58
   |
12 |         eprintln!("noisy const dealloc: {ptr:p}, {size}, {align}")
   |
   = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
   = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `eprintln` (in Nightly builds, run with -Z macro-backtrace for more info)


error[E0015]: cannot call non-const fn `Arguments::<'_>::new_v1` in constant functions
   |
   |
12 |         eprintln!("noisy const dealloc: {ptr:p}, {size}, {align}")
   |
   = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
   = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `eprintln` (in Nightly builds, run with -Z macro-backtrace for more info)


error[E0015]: cannot call non-const fn `_eprint` in constant functions
   |
   |
12 |         eprintln!("noisy const dealloc: {ptr:p}, {size}, {align}")
   |
   = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
   = note: this error originates in the macro `eprintln` (in Nightly builds, run with -Z macro-backtrace for more info)

rust-log-analyzer avatar Feb 02 '24 20:02 rust-log-analyzer

@bors r-

oli-obk avatar Feb 02 '24 20:02 oli-obk

@bors r=WaffleLapkin

oli-obk avatar Feb 02 '24 20:02 oli-obk

:pushpin: Commit 91aaa2a4455391487826a7a62cbe456bcc049308 has been approved by WaffleLapkin

It is now in the queue for this repository.

bors avatar Feb 02 '24 20:02 bors

:evergreen_tree: The tree is currently closed for pull requests below priority 100. This pull request will be tested once the tree is reopened.

bors avatar Feb 02 '24 20:02 bors

Miri support is still marked as todo in the PR description. What does the interpreter do when encountering a call to such an intrinsic?

nothing changed. If a new intrinsic with a fallback body is added, we'll error out like we do with any new intrinsic. We need to explicitly add support for invoking the fallback body

oli-obk avatar Feb 02 '24 21:02 oli-obk

The job x86_64-gnu-llvm-16 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
#12 writing image sha256:69617730b923065626626fb16deddf5256fc18c45880716b9a111f559d4f95d5 done
#12 naming to docker.io/library/rust-ci done
#12 DONE 10.1s
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-16]
##[group]Clock drift check
  local time: Fri Feb  2 21:00:05 UTC 2024
  network time: Fri, 02 Feb 2024 21:00:05 GMT
  network time: Fri, 02 Feb 2024 21:00:05 GMT
##[endgroup]
sccache: Starting the server...
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-16', '--enable-llvm-link-shared', '--set', 'rust.thin-lto-import-instr-limit=10', '--set', 'change-id=99999999', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'build.optimized-compiler-builtins', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--enable-new-symbol-mangling']
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-16/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.thin-lto-import-instr-limit := 10
configure: change-id            := 99999999
---
##[endgroup]
Testing GCC stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
   Compiling y v0.1.0 (/checkout/compiler/rustc_codegen_gcc/build_system)
    Finished release [optimized] target(s) in 1.35s
     Running `/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-codegen/x86_64-unknown-linux-gnu/release/y test --use-system-gcc --use-backend gcc --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/cg_gcc --release --no-default-features --mini-tests --std-tests`
Using system GCC
Using system GCC
[BUILD] example
[AOT] mini_core_hello_world
/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/cg_gcc/mini_core_hello_world
abc
---
##[endgroup]
##[group]Testing stage2 book unstable-book (x86_64-unknown-linux-gnu)


command did not execute successfully: CFG_RELEASE_CHANNEL="nightly" RUSTC_BOOTSTRAP="1" RUSTC_STAGE="2" RUSTC_SYSROOT="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" RUSTDOC_LIBDIR="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" RUSTDOC_REAL="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc" RUST_TEST_THREADS="16" "/checkout/obj/build/bootstrap/debug/rustdoc" "-Wrustdoc::invalid_codeblock_attributes" "-Dwarnings" "-Znormalize-docs" "-Z" "unstable-options" "--test" "/checkout/src/doc/unstable-book/src/language-features/intrinsics.md" "--test-args" ""
expected success, got: exit status: 101

stdout ----

---
---- /checkout/src/doc/unstable-book/src/language-features/intrinsics.md - The_tracking_issue_for_this_feature_is__None_::Intrinsics_with_fallback_logic (line 28) stdout ----
error: `Arguments::<'a>::new_const` is not yet stable as a const fn
##[error]  --> /checkout/src/doc/unstable-book/src/language-features/intrinsics.md:38:9
   |
12 |         eprintln!("noisy const dealloc")
   |
   = help: add `#![feature(const_fmt_arguments_new)]` to the crate attributes to enable
   = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `eprintln` (in Nightly builds, run with -Z macro-backtrace for more info)


error[E0015]: cannot call non-const fn `_eprint` in constant functions
   |
   |
12 |         eprintln!("noisy const dealloc")
   |
   = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
   = note: this error originates in the macro `eprintln` (in Nightly builds, run with -Z macro-backtrace for more info)

rust-log-analyzer avatar Feb 02 '24 21:02 rust-log-analyzer

@bors r-

oli-obk avatar Feb 02 '24 22:02 oli-obk

@oli-obk are you sure this fixes https://github.com/rust-lang/rust/issues/63585? For me it looks like that issue is about removing the need for extern "rust-intrinsic" { ... } at all. As currently written this provides an alternative, but it can only be used if you have a fallback, so for cases where there is no fallback, you still have to use extern "rust-intrinsic" { ... }...

WaffleLapkin avatar Feb 03 '24 16:02 WaffleLapkin

In principle we could use this scheme and make those intrinsics that have no fallback loop, recurse, panic or abort. This is proposed in the issue. The only issue is that the body may get executed if a backend forgets an impl (instead of getting a compile time error/ICE)

oli-obk avatar Feb 03 '24 17:02 oli-obk