| author | bors <bors@rust-lang.org> 2024-08-31 20:59:27 UTC |
| committer | bors <bors@rust-lang.org> 2024-08-31 20:59:27 UTC |
| log | a7399ba69d37b019677a9c47fe89ceb8dd82db2d |
| tree | 70cd4cf67b0b0ed7570e293f29e1992dfd7e861c |
| parent | d571ae851d93541bef826c3c48c1e9ad99da77d6 |
| parent | 4151fd407e41bfdcd166ebe07ed06d8303921c6c |
Rollup of 11 pull requests
Successful merges:
- #128523 (Add release notes for 1.81.0)
- #129605 (Add missing `needs-llvm-components` directives for run-make tests that need target-specific codegen)
- #129650 (Clean up `library/profiler_builtins/build.rs`)
- #129651 (skip stage 0 target check if `BOOTSTRAP_SKIP_TARGET_SANITY` is set)
- #129684 (Enable Miri to pass pointers through FFI)
- #129762 (Update the `wasm-component-ld` binary dependency)
- #129782 (couple more crash tests)
- #129816 (tidy: say which feature gate has a stability issue mismatch)
- #129818 (make the const-unstable-in-stable error more clear)
- #129824 (Fix code examples buttons not appearing on click on mobile)
- #129826 (library: Fix typo in `core::mem`)
r? `@ghost`
`@rustbot` modify labels: rollup41 files changed, 645 insertions(+), 187 deletions(-)
Cargo.lock+32-23| ... | ... | @@ -2463,7 +2463,7 @@ dependencies = [ |
| 2463 | 2463 | "indexmap", |
| 2464 | 2464 | "memchr", |
| 2465 | 2465 | "ruzstd 0.7.0", |
| 2466 | "wasmparser", | |
| 2466 | "wasmparser 0.215.0", | |
| 2467 | 2467 | ] |
| 2468 | 2468 | |
| 2469 | 2469 | [[package]] |
| ... | ... | @@ -3133,7 +3133,7 @@ dependencies = [ |
| 3133 | 3133 | "regex", |
| 3134 | 3134 | "serde_json", |
| 3135 | 3135 | "similar", |
| 3136 | "wasmparser", | |
| 3136 | "wasmparser 0.216.0", | |
| 3137 | 3137 | ] |
| 3138 | 3138 | |
| 3139 | 3139 | [[package]] |
| ... | ... | @@ -5779,9 +5779,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" |
| 5779 | 5779 | |
| 5780 | 5780 | [[package]] |
| 5781 | 5781 | name = "wasi-preview1-component-adapter-provider" |
| 5782 | version = "23.0.2" | |
| 5782 | version = "24.0.0" | |
| 5783 | 5783 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 5784 | checksum = "f91d3d13afef569b9fc80cfbb807c87c16ef49bd3ac1a93285ea6a264b600d2d" | |
| 5784 | checksum = "36e6cadfa74538edd5409b6f8c79628436529138e9618b7373bec7aae7805835" | |
| 5785 | 5785 | |
| 5786 | 5786 | [[package]] |
| 5787 | 5787 | name = "wasm-bindgen" |
| ... | ... | @@ -5840,16 +5840,16 @@ checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" |
| 5840 | 5840 | |
| 5841 | 5841 | [[package]] |
| 5842 | 5842 | name = "wasm-component-ld" |
| 5843 | version = "0.5.6" | |
| 5843 | version = "0.5.7" | |
| 5844 | 5844 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 5845 | checksum = "51449c63d1ce69f92b8465a084ed5b91f1a7eb583fa95796650a6bfcffc4f9cb" | |
| 5845 | checksum = "13261270d3ac58ffae0219ae34f297a7e24f9ee3b13b29be579132c588a83519" | |
| 5846 | 5846 | dependencies = [ |
| 5847 | 5847 | "anyhow", |
| 5848 | 5848 | "clap", |
| 5849 | 5849 | "lexopt", |
| 5850 | 5850 | "tempfile", |
| 5851 | 5851 | "wasi-preview1-component-adapter-provider", |
| 5852 | "wasmparser", | |
| 5852 | "wasmparser 0.216.0", | |
| 5853 | 5853 | "wat", |
| 5854 | 5854 | "wit-component", |
| 5855 | 5855 | "wit-parser", |
| ... | ... | @@ -5864,19 +5864,19 @@ dependencies = [ |
| 5864 | 5864 | |
| 5865 | 5865 | [[package]] |
| 5866 | 5866 | name = "wasm-encoder" |
| 5867 | version = "0.215.0" | |
| 5867 | version = "0.216.0" | |
| 5868 | 5868 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 5869 | checksum = "4fb56df3e06b8e6b77e37d2969a50ba51281029a9aeb3855e76b7f49b6418847" | |
| 5869 | checksum = "04c23aebea22c8a75833ae08ed31ccc020835b12a41999e58c31464271b94a88" | |
| 5870 | 5870 | dependencies = [ |
| 5871 | 5871 | "leb128", |
| 5872 | "wasmparser", | |
| 5872 | "wasmparser 0.216.0", | |
| 5873 | 5873 | ] |
| 5874 | 5874 | |
| 5875 | 5875 | [[package]] |
| 5876 | 5876 | name = "wasm-metadata" |
| 5877 | version = "0.215.0" | |
| 5877 | version = "0.216.0" | |
| 5878 | 5878 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 5879 | checksum = "0c6bb07c5576b608f7a2a9baa2294c1a3584a249965d695a9814a496cb6d232f" | |
| 5879 | checksum = "47c8154d703a6b0e45acf6bd172fa002fc3c7058a9f7615e517220aeca27c638" | |
| 5880 | 5880 | dependencies = [ |
| 5881 | 5881 | "anyhow", |
| 5882 | 5882 | "indexmap", |
| ... | ... | @@ -5885,7 +5885,7 @@ dependencies = [ |
| 5885 | 5885 | "serde_json", |
| 5886 | 5886 | "spdx", |
| 5887 | 5887 | "wasm-encoder", |
| 5888 | "wasmparser", | |
| 5888 | "wasmparser 0.216.0", | |
| 5889 | 5889 | ] |
| 5890 | 5890 | |
| 5891 | 5891 | [[package]] |
| ... | ... | @@ -5893,6 +5893,15 @@ name = "wasmparser" |
| 5893 | 5893 | version = "0.215.0" |
| 5894 | 5894 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 5895 | 5895 | checksum = "53fbde0881f24199b81cf49b6ff8f9c145ac8eb1b7fc439adb5c099734f7d90e" |
| 5896 | dependencies = [ | |
| 5897 | "bitflags 2.6.0", | |
| 5898 | ] | |
| 5899 | ||
| 5900 | [[package]] | |
| 5901 | name = "wasmparser" | |
| 5902 | version = "0.216.0" | |
| 5903 | source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 5904 | checksum = "bcdee6bea3619d311fb4b299721e89a986c3470f804b6d534340e412589028e3" | |
| 5896 | 5905 | dependencies = [ |
| 5897 | 5906 | "ahash", |
| 5898 | 5907 | "bitflags 2.6.0", |
| ... | ... | @@ -5904,9 +5913,9 @@ dependencies = [ |
| 5904 | 5913 | |
| 5905 | 5914 | [[package]] |
| 5906 | 5915 | name = "wast" |
| 5907 | version = "215.0.0" | |
| 5916 | version = "216.0.0" | |
| 5908 | 5917 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 5909 | checksum = "1ff1d00d893593249e60720be04a7c1f42f1c4dc3806a2869f4e66ab61eb54cb" | |
| 5918 | checksum = "f7eb1f2eecd913fdde0dc6c3439d0f24530a98ac6db6cb3d14d92a5328554a08" | |
| 5910 | 5919 | dependencies = [ |
| 5911 | 5920 | "bumpalo", |
| 5912 | 5921 | "leb128", |
| ... | ... | @@ -5917,9 +5926,9 @@ dependencies = [ |
| 5917 | 5926 | |
| 5918 | 5927 | [[package]] |
| 5919 | 5928 | name = "wat" |
| 5920 | version = "1.215.0" | |
| 5929 | version = "1.216.0" | |
| 5921 | 5930 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 5922 | checksum = "670bf4d9c8cf76ae242d70ded47c546525b6dafaa6871f9bcb065344bf2b4e3d" | |
| 5931 | checksum = "ac0409090fb5154f95fb5ba3235675fd9e579e731524d63b6a2f653e1280c82a" | |
| 5923 | 5932 | dependencies = [ |
| 5924 | 5933 | "wast", |
| 5925 | 5934 | ] |
| ... | ... | @@ -6206,9 +6215,9 @@ dependencies = [ |
| 6206 | 6215 | |
| 6207 | 6216 | [[package]] |
| 6208 | 6217 | name = "wit-component" |
| 6209 | version = "0.215.0" | |
| 6218 | version = "0.216.0" | |
| 6210 | 6219 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 6211 | checksum = "f725e3885fc5890648be5c5cbc1353b755dc932aa5f1aa7de968b912a3280743" | |
| 6220 | checksum = "7e2ca3ece38ea2447a9069b43074ba73d96dde1944cba276c54e41371745f9dc" | |
| 6212 | 6221 | dependencies = [ |
| 6213 | 6222 | "anyhow", |
| 6214 | 6223 | "bitflags 2.6.0", |
| ... | ... | @@ -6219,15 +6228,15 @@ dependencies = [ |
| 6219 | 6228 | "serde_json", |
| 6220 | 6229 | "wasm-encoder", |
| 6221 | 6230 | "wasm-metadata", |
| 6222 | "wasmparser", | |
| 6231 | "wasmparser 0.216.0", | |
| 6223 | 6232 | "wit-parser", |
| 6224 | 6233 | ] |
| 6225 | 6234 | |
| 6226 | 6235 | [[package]] |
| 6227 | 6236 | name = "wit-parser" |
| 6228 | version = "0.215.0" | |
| 6237 | version = "0.216.0" | |
| 6229 | 6238 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 6230 | checksum = "935a97eaffd57c3b413aa510f8f0b550a4a9fe7d59e79cd8b89a83dcb860321f" | |
| 6239 | checksum = "a4d108165c1167a4ccc8a803dcf5c28e0a51d6739fd228cc7adce768632c764c" | |
| 6231 | 6240 | dependencies = [ |
| 6232 | 6241 | "anyhow", |
| 6233 | 6242 | "id-arena", |
| ... | ... | @@ -6238,7 +6247,7 @@ dependencies = [ |
| 6238 | 6247 | "serde_derive", |
| 6239 | 6248 | "serde_json", |
| 6240 | 6249 | "unicode-xid", |
| 6241 | "wasmparser", | |
| 6250 | "wasmparser 0.216.0", | |
| 6242 | 6251 | ] |
| 6243 | 6252 | |
| 6244 | 6253 | [[package]] |
RELEASES.md+114| ... | ... | @@ -1,3 +1,117 @@ |
| 1 | Version 1.81.0 (2024-09-05) | |
| 2 | ========================== | |
| 3 | ||
| 4 | <a id="1.81.0-Language"></a> | |
| 5 | ||
| 6 | Language | |
| 7 | -------- | |
| 8 | ||
| 9 | - [Abort on uncaught panics in `extern "C"` functions.](https://github.com/rust-lang/rust/pull/116088/) | |
| 10 | - [Fix ambiguous cases of multiple `&` in elided self lifetimes.](https://github.com/rust-lang/rust/pull/117967/) | |
| 11 | - [Stabilize `#[expect]` for lints (RFC 2383),](https://github.com/rust-lang/rust/pull/120924/) like `#[allow]` with a warning if the lint is _not_ fulfilled. | |
| 12 | - [Change method resolution to constrain hidden types instead of rejecting method candidates.](https://github.com/rust-lang/rust/pull/123962/) | |
| 13 | - [Bump `elided_lifetimes_in_associated_constant` to deny.](https://github.com/rust-lang/rust/pull/124211/) | |
| 14 | - [`offset_from`: always allow pointers to point to the same address.](https://github.com/rust-lang/rust/pull/124921/) | |
| 15 | - [Allow constraining opaque types during subtyping in the trait system.](https://github.com/rust-lang/rust/pull/125447/) | |
| 16 | - [Allow constraining opaque types during various unsizing casts.](https://github.com/rust-lang/rust/pull/125610/) | |
| 17 | - [Deny keyword lifetimes pre-expansion.](https://github.com/rust-lang/rust/pull/126762/) | |
| 18 | ||
| 19 | <a id="1.81.0-Compiler"></a> | |
| 20 | ||
| 21 | Compiler | |
| 22 | -------- | |
| 23 | ||
| 24 | - [Make casts of pointers to trait objects stricter.](https://github.com/rust-lang/rust/pull/120248/) | |
| 25 | - [Check alias args for well-formedness even if they have escaping bound vars.](https://github.com/rust-lang/rust/pull/123737/) | |
| 26 | - [Deprecate no-op codegen option `-Cinline-threshold=...`.](https://github.com/rust-lang/rust/pull/124712/) | |
| 27 | - [Re-implement a type-size based limit.](https://github.com/rust-lang/rust/pull/125507/) | |
| 28 | - [Properly account for alignment in `transmute` size checks.](https://github.com/rust-lang/rust/pull/125740/) | |
| 29 | - [Remove the `box_pointers` lint.](https://github.com/rust-lang/rust/pull/126018/) | |
| 30 | - [Ensure the interpreter checks bool/char for validity when they are used in a cast.](https://github.com/rust-lang/rust/pull/126265/) | |
| 31 | - [Improve coverage instrumentation for functions containing nested items.](https://github.com/rust-lang/rust/pull/127199/) | |
| 32 | - Target changes: | |
| 33 | - [Add Tier 3 `no_std` Xtensa targets:](https://github.com/rust-lang/rust/pull/125141/) `xtensa-esp32-none-elf`, `xtensa-esp32s2-none-elf`, `xtensa-esp32s3-none-elf` | |
| 34 | - [Add Tier 3 `std` Xtensa targets:](https://github.com/rust-lang/rust/pull/126380/) `xtensa-esp32-espidf`, `xtensa-esp32s2-espidf`, `xtensa-esp32s3-espidf` | |
| 35 | - [Add Tier 3 i686 Redox OS target:](https://github.com/rust-lang/rust/pull/126192/) `i686-unknown-redox` | |
| 36 | - [Promote `arm64ec-pc-windows-msvc` to Tier 2.](https://github.com/rust-lang/rust/pull/126039/) | |
| 37 | - [Promote `wasm32-wasip2` to Tier 2.](https://github.com/rust-lang/rust/pull/126967/) | |
| 38 | - [Promote `loongarch64-unknown-linux-musl` to Tier 2 with host tools.](https://github.com/rust-lang/rust/pull/126298/) | |
| 39 | - [Enable full tools and profiler for LoongArch Linux targets.](https://github.com/rust-lang/rust/pull/127078/) | |
| 40 | - [Unconditionally warn on usage of `wasm32-wasi`.](https://github.com/rust-lang/rust/pull/126662/) (see compatibility note below) | |
| 41 | - Refer to Rust's [platform support page][platform-support-doc] for more information on Rust's tiered platform support. | |
| 42 | ||
| 43 | <a id="1.81.0-Libraries"></a> | |
| 44 | ||
| 45 | Libraries | |
| 46 | --------- | |
| 47 | ||
| 48 | - [Split core's `PanicInfo` and std's `PanicInfo`.](https://github.com/rust-lang/rust/pull/115974/) (see compatibility note below) | |
| 49 | - [Generalize `{Rc,Arc}::make_mut()` to unsized types.](https://github.com/rust-lang/rust/pull/116113/) | |
| 50 | - [Replace sort implementations with stable `driftsort` and unstable `ipnsort`.](https://github.com/rust-lang/rust/pull/124032/) All `slice::sort*` and `slice::select_nth*` methods are expected to see significant performance improvements. See the [research project](https://github.com/Voultapher/sort-research-rs) for more details. | |
| 51 | - [Document behavior of `create_dir_all` with respect to empty paths.](https://github.com/rust-lang/rust/pull/125112/) | |
| 52 | - [Fix interleaved output in the default panic hook when multiple threads panic simultaneously.](https://github.com/rust-lang/rust/pull/127397/) | |
| 53 | ||
| 54 | <a id="1.81.0-Stabilized-APIs"></a> | |
| 55 | ||
| 56 | Stabilized APIs | |
| 57 | --------------- | |
| 58 | ||
| 59 | - [`core::error`](https://doc.rust-lang.org/stable/core/error/index.html) | |
| 60 | - [`hint::assert_unchecked`](https://doc.rust-lang.org/stable/core/hint/fn.assert_unchecked.html) | |
| 61 | - [`fs::exists`](https://doc.rust-lang.org/stable/std/fs/fn.exists.html) | |
| 62 | - [`AtomicBool::fetch_not`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicBool.html#method.fetch_not) | |
| 63 | - [`Duration::abs_diff`](https://doc.rust-lang.org/stable/core/time/struct.Duration.html#method.abs_diff) | |
| 64 | - [`IoSlice::advance`](https://doc.rust-lang.org/stable/std/io/struct.IoSlice.html#method.advance) | |
| 65 | - [`IoSlice::advance_slices`](https://doc.rust-lang.org/stable/std/io/struct.IoSlice.html#method.advance_slices) | |
| 66 | - [`IoSliceMut::advance`](https://doc.rust-lang.org/stable/std/io/struct.IoSliceMut.html#method.advance) | |
| 67 | - [`IoSliceMut::advance_slices`](https://doc.rust-lang.org/stable/std/io/struct.IoSliceMut.html#method.advance_slices) | |
| 68 | - [`PanicHookInfo`](https://doc.rust-lang.org/stable/std/panic/struct.PanicHookInfo.html) | |
| 69 | - [`PanicInfo::message`](https://doc.rust-lang.org/stable/core/panic/struct.PanicInfo.html#method.message) | |
| 70 | - [`PanicMessage`](https://doc.rust-lang.org/stable/core/panic/struct.PanicMessage.html) | |
| 71 | ||
| 72 | These APIs are now stable in const contexts: | |
| 73 | ||
| 74 | - [`char::from_u32_unchecked`](https://doc.rust-lang.org/stable/core/char/fn.from_u32_unchecked.html) (function) | |
| 75 | - [`char::from_u32_unchecked`](https://doc.rust-lang.org/stable/core/primitive.char.html#method.from_u32_unchecked) (method) | |
| 76 | - [`CStr::count_bytes`](https://doc.rust-lang.org/stable/core/ffi/c_str/struct.CStr.html#method.count_bytes) | |
| 77 | - [`CStr::from_ptr`](https://doc.rust-lang.org/stable/core/ffi/c_str/struct.CStr.html#method.from_ptr) | |
| 78 | ||
| 79 | <a id="1.81.0-Cargo"></a> | |
| 80 | ||
| 81 | Cargo | |
| 82 | ----- | |
| 83 | ||
| 84 | - [Generated `.cargo_vcs_info.json` is always included, even when `--allow-dirty` is passed.](https://github.com/rust-lang/cargo/pull/13960/) | |
| 85 | - [Disallow `package.license-file` and `package.readme` pointing to non-existent files during packaging.](https://github.com/rust-lang/cargo/pull/13921/) | |
| 86 | - [Disallow passing `--release`/`--debug` flag along with the `--profile` flag.](https://github.com/rust-lang/cargo/pull/13971/) | |
| 87 | - [Remove `lib.plugin` key support in `Cargo.toml`. Rust plugin support has been deprecated for four years and was removed in 1.75.0.](https://github.com/rust-lang/cargo/pull/13902/) | |
| 88 | ||
| 89 | <a id="1.81.0-Compatibility-Notes"></a> | |
| 90 | ||
| 91 | Compatibility Notes | |
| 92 | ------------------- | |
| 93 | ||
| 94 | * Usage of the `wasm32-wasi` target will now issue a compiler warning and request users switch to the `wasm32-wasip1` target instead. Both targets are the same, `wasm32-wasi` is only being renamed, and this [change to the WASI target](https://blog.rust-lang.org/2024/04/09/updates-to-rusts-wasi-targets.html) is being done to enable removing `wasm32-wasi` in January 2025. | |
| 95 | ||
| 96 | * We have renamed `std::panic::PanicInfo` to `std::panic::PanicHookInfo`. The old name will continue to work as an alias, but will result in a deprecation warning starting in Rust 1.82.0. | |
| 97 | ||
| 98 | `core::panic::PanicInfo` will remain unchanged, however, as this is now a *different type*. | |
| 99 | ||
| 100 | The reason is that these types have different roles: `std::panic::PanicHookInfo` is the argument to the [panic hook](https://doc.rust-lang.org/stable/std/panic/fn.set_hook.html) in std context (where panics can have an arbitrary payload), while `core::panic::PanicInfo` is the argument to the [`#[panic_handler]`](https://doc.rust-lang.org/nomicon/panic-handler.html) in no_std context (where panics always carry a formatted *message*). Separating these types allows us to add more useful methods to these types, such as `std::panic::PanicHookInfo::payload_as_str()` and `core::panic::PanicInfo::message()`. | |
| 101 | ||
| 102 | * The new sort implementations may panic if a type's implementation of [`Ord`](https://doc.rust-lang.org/std/cmp/trait.Ord.html) (or the given comparison function) does not implement a [total order](https://en.wikipedia.org/wiki/Total_order) as the trait requires. `Ord`'s supertraits (`PartialOrd`, `Eq`, and `PartialEq`) must also be consistent. The previous implementations would not "notice" any problem, but the new implementations have a good chance of detecting inconsistencies, throwing a panic rather than returning knowingly unsorted data. | |
| 103 | ||
| 104 | <a id="1.81.0-Internal-Changes"></a> | |
| 105 | ||
| 106 | Internal Changes | |
| 107 | ---------------- | |
| 108 | ||
| 109 | These changes do not affect any public interfaces of Rust, but they represent | |
| 110 | significant improvements to the performance or internals of rustc and related | |
| 111 | tools. | |
| 112 | ||
| 113 | - [Add a Rust-for Linux `auto` CI job to check kernel builds.](https://github.com/rust-lang/rust/pull/125209/) | |
| 114 | ||
| 1 | 115 | Version 1.80.0 (2024-07-25) |
| 2 | 116 | ========================== |
| 3 | 117 |
compiler/rustc_codegen_ssa/Cargo.toml+1-1| ... | ... | @@ -41,7 +41,7 @@ tempfile = "3.2" |
| 41 | 41 | thin-vec = "0.2.12" |
| 42 | 42 | thorin-dwp = "0.7" |
| 43 | 43 | tracing = "0.1" |
| 44 | wasm-encoder = "0.215.0" | |
| 44 | wasm-encoder = "0.216.0" | |
| 45 | 45 | # tidy-alphabetical-end |
| 46 | 46 | |
| 47 | 47 | [target.'cfg(unix)'.dependencies] |
compiler/rustc_const_eval/messages.ftl+2-2| ... | ... | @@ -415,8 +415,8 @@ const_eval_unstable_const_fn = `{$def_path}` is not yet stable as a const fn |
| 415 | 415 | |
| 416 | 416 | const_eval_unstable_in_stable = |
| 417 | 417 | const-stable function cannot use `#[feature({$gate})]` |
| 418 | .unstable_sugg = if it is not part of the public API, make this function unstably const | |
| 419 | .bypass_sugg = otherwise `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (but requires team approval) | |
| 418 | .unstable_sugg = if the function is not (yet) meant to be stable, make this function unstably const | |
| 419 | .bypass_sugg = otherwise, as a last resort `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (but requires team approval) | |
| 420 | 420 | |
| 421 | 421 | const_eval_unterminated_c_string = |
| 422 | 422 | reading a null-terminated string starting at {$pointer} with no null found before end of allocation |
compiler/rustc_const_eval/src/interpret/machine.rs+1-11| ... | ... | @@ -362,17 +362,7 @@ pub trait Machine<'tcx>: Sized { |
| 362 | 362 | ecx: &InterpCx<'tcx, Self>, |
| 363 | 363 | id: AllocId, |
| 364 | 364 | alloc: &'b Allocation, |
| 365 | ) -> InterpResult<'tcx, Cow<'b, Allocation<Self::Provenance, Self::AllocExtra, Self::Bytes>>> | |
| 366 | { | |
| 367 | // The default implementation does a copy; CTFE machines have a more efficient implementation | |
| 368 | // based on their particular choice for `Provenance`, `AllocExtra`, and `Bytes`. | |
| 369 | let kind = Self::GLOBAL_KIND | |
| 370 | .expect("if GLOBAL_KIND is None, adjust_global_allocation must be overwritten"); | |
| 371 | let alloc = alloc.adjust_from_tcx(&ecx.tcx, |ptr| ecx.global_root_pointer(ptr))?; | |
| 372 | let extra = | |
| 373 | Self::init_alloc_extra(ecx, id, MemoryKind::Machine(kind), alloc.size(), alloc.align)?; | |
| 374 | Ok(Cow::Owned(alloc.with_extra(extra))) | |
| 375 | } | |
| 365 | ) -> InterpResult<'tcx, Cow<'b, Allocation<Self::Provenance, Self::AllocExtra, Self::Bytes>>>; | |
| 376 | 366 | |
| 377 | 367 | /// Initialize the extra state of an allocation. |
| 378 | 368 | /// |
compiler/rustc_middle/src/mir/interpret/allocation.rs+2-1| ... | ... | @@ -358,10 +358,11 @@ impl Allocation { |
| 358 | 358 | pub fn adjust_from_tcx<Prov: Provenance, Bytes: AllocBytes, Err>( |
| 359 | 359 | &self, |
| 360 | 360 | cx: &impl HasDataLayout, |
| 361 | mut alloc_bytes: impl FnMut(&[u8], Align) -> Result<Bytes, Err>, | |
| 361 | 362 | mut adjust_ptr: impl FnMut(Pointer<CtfeProvenance>) -> Result<Pointer<Prov>, Err>, |
| 362 | 363 | ) -> Result<Allocation<Prov, (), Bytes>, Err> { |
| 363 | 364 | // Copy the data. |
| 364 | let mut bytes = Bytes::from_bytes(Cow::Borrowed(&*self.bytes), self.align); | |
| 365 | let mut bytes = alloc_bytes(&*self.bytes, self.align)?; | |
| 365 | 366 | // Adjust provenance of pointers stored in this allocation. |
| 366 | 367 | let mut new_provenance = Vec::with_capacity(self.provenance.ptrs().len()); |
| 367 | 368 | let ptr_size = cx.data_layout().pointer_size.bytes_usize(); |
compiler/rustc_passes/src/stability.rs+1-2| ... | ... | @@ -544,9 +544,8 @@ impl<'tcx> MissingStabilityAnnotations<'tcx> { |
| 544 | 544 | let is_stable = |
| 545 | 545 | self.tcx.lookup_stability(def_id).is_some_and(|stability| stability.level.is_stable()); |
| 546 | 546 | let missing_const_stability_attribute = self.tcx.lookup_const_stability(def_id).is_none(); |
| 547 | let is_reachable = self.effective_visibilities.is_reachable(def_id); | |
| 548 | 547 | |
| 549 | if is_const && is_stable && missing_const_stability_attribute && is_reachable { | |
| 548 | if is_const && is_stable && missing_const_stability_attribute { | |
| 550 | 549 | let descr = self.tcx.def_descr(def_id.to_def_id()); |
| 551 | 550 | self.tcx.dcx().emit_err(errors::MissingConstStabAttr { span, descr }); |
| 552 | 551 | } |
library/core/src/mem/mod.rs+1-1| ... | ... | @@ -612,7 +612,7 @@ pub const fn needs_drop<T: ?Sized>() -> bool { |
| 612 | 612 | /// |
| 613 | 613 | /// There is no guarantee that an all-zero byte-pattern represents a valid value |
| 614 | 614 | /// of some type `T`. For example, the all-zero byte-pattern is not a valid value |
| 615 | /// for reference types (`&T`, `&mut T`) and functions pointers. Using `zeroed` | |
| 615 | /// for reference types (`&T`, `&mut T`) and function pointers. Using `zeroed` | |
| 616 | 616 | /// on such types causes immediate [undefined behavior][ub] because [the Rust |
| 617 | 617 | /// compiler assumes][inv] that there always is a valid value in a variable it |
| 618 | 618 | /// considers initialized. |
library/profiler_builtins/build.rs+32-28| ... | ... | @@ -1,14 +1,15 @@ |
| 1 | 1 | //! Compiles the profiler part of the `compiler-rt` library. |
| 2 | 2 | //! |
| 3 | //! See the build.rs for libcompiler_builtins crate for details. | |
| 3 | //! Loosely based on: | |
| 4 | //! - LLVM's `compiler-rt/lib/profile/CMakeLists.txt` | |
| 5 | //! - <https://github.com/rust-lang/compiler-builtins/blob/master/build.rs>. | |
| 4 | 6 | |
| 5 | 7 | use std::env; |
| 6 | 8 | use std::path::PathBuf; |
| 7 | 9 | |
| 8 | 10 | fn main() { |
| 9 | println!("cargo:rerun-if-env-changed=LLVM_PROFILER_RT_LIB"); | |
| 10 | if let Ok(rt) = env::var("LLVM_PROFILER_RT_LIB") { | |
| 11 | println!("cargo:rustc-link-lib=static:+verbatim={rt}"); | |
| 11 | if let Ok(rt) = tracked_env_var("LLVM_PROFILER_RT_LIB") { | |
| 12 | println!("cargo::rustc-link-lib=static:+verbatim={rt}"); | |
| 12 | 13 | return; |
| 13 | 14 | } |
| 14 | 15 | |
| ... | ... | @@ -16,13 +17,13 @@ fn main() { |
| 16 | 17 | let target_env = env::var("CARGO_CFG_TARGET_ENV").expect("CARGO_CFG_TARGET_ENV was not set"); |
| 17 | 18 | let cfg = &mut cc::Build::new(); |
| 18 | 19 | |
| 19 | // FIXME: `rerun-if-changed` directives are not currently emitted and the build script | |
| 20 | // will not rerun on changes in these source files or headers included into them. | |
| 21 | let mut profile_sources = vec![ | |
| 20 | let profile_sources = vec![ | |
| 21 | // tidy-alphabetical-start | |
| 22 | 22 | "GCDAProfiling.c", |
| 23 | 23 | "InstrProfiling.c", |
| 24 | 24 | "InstrProfilingBuffer.c", |
| 25 | 25 | "InstrProfilingFile.c", |
| 26 | "InstrProfilingInternal.c", | |
| 26 | 27 | "InstrProfilingMerge.c", |
| 27 | 28 | "InstrProfilingMergeFile.c", |
| 28 | 29 | "InstrProfilingNameVar.c", |
| ... | ... | @@ -37,15 +38,13 @@ fn main() { |
| 37 | 38 | "InstrProfilingValue.c", |
| 38 | 39 | "InstrProfilingVersionVar.c", |
| 39 | 40 | "InstrProfilingWriter.c", |
| 40 | // These files were added in LLVM 11. | |
| 41 | "InstrProfilingInternal.c", | |
| 42 | "InstrProfilingBiasVar.c", | |
| 41 | "WindowsMMap.c", | |
| 42 | // tidy-alphabetical-end | |
| 43 | 43 | ]; |
| 44 | 44 | |
| 45 | 45 | if target_env == "msvc" { |
| 46 | 46 | // Don't pull in extra libraries on MSVC |
| 47 | 47 | cfg.flag("/Zl"); |
| 48 | profile_sources.push("WindowsMMap.c"); | |
| 49 | 48 | cfg.define("strdup", Some("_strdup")); |
| 50 | 49 | cfg.define("open", Some("_open")); |
| 51 | 50 | cfg.define("fdopen", Some("_fdopen")); |
| ... | ... | @@ -60,8 +59,6 @@ fn main() { |
| 60 | 59 | if target_os != "windows" { |
| 61 | 60 | cfg.flag("-fvisibility=hidden"); |
| 62 | 61 | cfg.define("COMPILER_RT_HAS_UNAME", Some("1")); |
| 63 | } else { | |
| 64 | profile_sources.push("WindowsMMap.c"); | |
| 65 | 62 | } |
| 66 | 63 | } |
| 67 | 64 | |
| ... | ... | @@ -80,26 +77,33 @@ fn main() { |
| 80 | 77 | } |
| 81 | 78 | |
| 82 | 79 | // Get the LLVM `compiler-rt` directory from bootstrap. |
| 83 | println!("cargo:rerun-if-env-changed=RUST_COMPILER_RT_FOR_PROFILER"); | |
| 84 | let root = PathBuf::from(env::var("RUST_COMPILER_RT_FOR_PROFILER").unwrap_or_else(|_| { | |
| 85 | let path = "../../src/llvm-project/compiler-rt"; | |
| 86 | println!("RUST_COMPILER_RT_FOR_PROFILER was not set; falling back to {path:?}"); | |
| 87 | path.to_owned() | |
| 88 | })); | |
| 80 | let root = PathBuf::from(tracked_env_var_or_fallback( | |
| 81 | "RUST_COMPILER_RT_FOR_PROFILER", | |
| 82 | "../../src/llvm-project/compiler-rt", | |
| 83 | )); | |
| 89 | 84 | |
| 90 | 85 | let src_root = root.join("lib").join("profile"); |
| 91 | 86 | assert!(src_root.exists(), "profiler runtime source directory not found: {src_root:?}"); |
| 92 | let mut n_sources_found = 0u32; | |
| 93 | for src in profile_sources { | |
| 94 | let path = src_root.join(src); | |
| 95 | if path.exists() { | |
| 96 | cfg.file(path); | |
| 97 | n_sources_found += 1; | |
| 98 | } | |
| 87 | println!("cargo::rerun-if-changed={}", src_root.display()); | |
| 88 | for file in profile_sources { | |
| 89 | cfg.file(src_root.join(file)); | |
| 99 | 90 | } |
| 100 | assert!(n_sources_found > 0, "couldn't find any profiler runtime source files in {src_root:?}"); | |
| 101 | 91 | |
| 102 | cfg.include(root.join("include")); | |
| 92 | let include = root.join("include"); | |
| 93 | println!("cargo::rerun-if-changed={}", include.display()); | |
| 94 | cfg.include(include); | |
| 95 | ||
| 103 | 96 | cfg.warnings(false); |
| 104 | 97 | cfg.compile("profiler-rt"); |
| 105 | 98 | } |
| 99 | ||
| 100 | fn tracked_env_var(key: &str) -> Result<String, env::VarError> { | |
| 101 | println!("cargo::rerun-if-env-changed={key}"); | |
| 102 | env::var(key) | |
| 103 | } | |
| 104 | fn tracked_env_var_or_fallback(key: &str, fallback: &str) -> String { | |
| 105 | tracked_env_var(key).unwrap_or_else(|_| { | |
| 106 | println!("cargo::warning={key} was not set; falling back to {fallback:?}"); | |
| 107 | fallback.to_owned() | |
| 108 | }) | |
| 109 | } |
src/bootstrap/src/core/sanity.rs+2-7| ... | ... | @@ -8,9 +8,7 @@ |
| 8 | 8 | //! In theory if we get past this phase it's a bug if a build fails, but in |
| 9 | 9 | //! practice that's likely not true! |
| 10 | 10 | |
| 11 | use std::collections::HashMap; | |
| 12 | #[cfg(not(feature = "bootstrap-self-test"))] | |
| 13 | use std::collections::HashSet; | |
| 11 | use std::collections::{HashMap, HashSet}; | |
| 14 | 12 | use std::ffi::{OsStr, OsString}; |
| 15 | 13 | use std::path::PathBuf; |
| 16 | 14 | use std::{env, fs}; |
| ... | ... | @@ -34,7 +32,6 @@ pub struct Finder { |
| 34 | 32 | // it might not yet be included in stage0. In such cases, we handle the targets missing from stage0 in this list. |
| 35 | 33 | // |
| 36 | 34 | // Targets can be removed from this list once they are present in the stage0 compiler (usually by updating the beta compiler of the bootstrap). |
| 37 | #[cfg(not(feature = "bootstrap-self-test"))] | |
| 38 | 35 | const STAGE0_MISSING_TARGETS: &[&str] = &[ |
| 39 | 36 | // just a dummy comment so the list doesn't get onelined |
| 40 | 37 | ]; |
| ... | ... | @@ -205,7 +202,6 @@ than building it. |
| 205 | 202 | .map(|p| cmd_finder.must_have(p)) |
| 206 | 203 | .or_else(|| cmd_finder.maybe_have("reuse")); |
| 207 | 204 | |
| 208 | #[cfg(not(feature = "bootstrap-self-test"))] | |
| 209 | 205 | let stage0_supported_target_list: HashSet<String> = crate::utils::helpers::output( |
| 210 | 206 | command(&build.config.initial_rustc).args(["--print", "target-list"]).as_command_mut(), |
| 211 | 207 | ) |
| ... | ... | @@ -234,8 +230,7 @@ than building it. |
| 234 | 230 | } |
| 235 | 231 | |
| 236 | 232 | // Ignore fake targets that are only used for unit tests in bootstrap. |
| 237 | #[cfg(not(feature = "bootstrap-self-test"))] | |
| 238 | { | |
| 233 | if cfg!(not(feature = "bootstrap-self-test")) && !skip_target_sanity { | |
| 239 | 234 | let mut has_target = false; |
| 240 | 235 | let target_str = target.to_string(); |
| 241 | 236 |
src/librustdoc/html/static/js/main.js+8-2| ... | ... | @@ -1878,9 +1878,15 @@ href="https://doc.rust-lang.org/${channel}/rustdoc/read-documentation/search.htm |
| 1878 | 1878 | if (elem === null) { |
| 1879 | 1879 | return; |
| 1880 | 1880 | } |
| 1881 | const buttons = elem.querySelector(".button-holder"); | |
| 1881 | let buttons = elem.querySelector(".button-holder"); | |
| 1882 | 1882 | if (buttons === null) { |
| 1883 | return; | |
| 1883 | // On mobile, you can't hover an element so buttons need to be created on click | |
| 1884 | // if they're not already there. | |
| 1885 | addCopyButton(event); | |
| 1886 | buttons = elem.querySelector(".button-holder"); | |
| 1887 | if (buttons === null) { | |
| 1888 | return; | |
| 1889 | } | |
| 1884 | 1890 | } |
| 1885 | 1891 | buttons.classList.toggle("keep-visible"); |
| 1886 | 1892 | } |
src/tools/miri/src/alloc_addresses/mod.rs+67-1| ... | ... | @@ -42,6 +42,11 @@ pub struct GlobalStateInner { |
| 42 | 42 | /// they do not have an `AllocExtra`. |
| 43 | 43 | /// This is the inverse of `int_to_ptr_map`. |
| 44 | 44 | base_addr: FxHashMap<AllocId, u64>, |
| 45 | /// Temporarily store prepared memory space for global allocations the first time their memory | |
| 46 | /// address is required. This is used to ensure that the memory is allocated before Miri assigns | |
| 47 | /// it an internal address, which is important for matching the internal address to the machine | |
| 48 | /// address so FFI can read from pointers. | |
| 49 | prepared_alloc_bytes: FxHashMap<AllocId, MiriAllocBytes>, | |
| 45 | 50 | /// A pool of addresses we can reuse for future allocations. |
| 46 | 51 | reuse: ReusePool, |
| 47 | 52 | /// Whether an allocation has been exposed or not. This cannot be put |
| ... | ... | @@ -59,6 +64,7 @@ impl VisitProvenance for GlobalStateInner { |
| 59 | 64 | let GlobalStateInner { |
| 60 | 65 | int_to_ptr_map: _, |
| 61 | 66 | base_addr: _, |
| 67 | prepared_alloc_bytes: _, | |
| 62 | 68 | reuse: _, |
| 63 | 69 | exposed: _, |
| 64 | 70 | next_base_addr: _, |
| ... | ... | @@ -78,6 +84,7 @@ impl GlobalStateInner { |
| 78 | 84 | GlobalStateInner { |
| 79 | 85 | int_to_ptr_map: Vec::default(), |
| 80 | 86 | base_addr: FxHashMap::default(), |
| 87 | prepared_alloc_bytes: FxHashMap::default(), | |
| 81 | 88 | reuse: ReusePool::new(config), |
| 82 | 89 | exposed: FxHashSet::default(), |
| 83 | 90 | next_base_addr: stack_addr, |
| ... | ... | @@ -166,7 +173,39 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> { |
| 166 | 173 | assert!(!matches!(kind, AllocKind::Dead)); |
| 167 | 174 | |
| 168 | 175 | // This allocation does not have a base address yet, pick or reuse one. |
| 169 | let base_addr = if let Some((reuse_addr, clock)) = global_state.reuse.take_addr( | |
| 176 | let base_addr = if ecx.machine.native_lib.is_some() { | |
| 177 | // In native lib mode, we use the "real" address of the bytes for this allocation. | |
| 178 | // This ensures the interpreted program and native code have the same view of memory. | |
| 179 | match kind { | |
| 180 | AllocKind::LiveData => { | |
| 181 | let ptr = if ecx.tcx.try_get_global_alloc(alloc_id).is_some() { | |
| 182 | // For new global allocations, we always pre-allocate the memory to be able use the machine address directly. | |
| 183 | let prepared_bytes = MiriAllocBytes::zeroed(size, align) | |
| 184 | .unwrap_or_else(|| { | |
| 185 | panic!("Miri ran out of memory: cannot create allocation of {size:?} bytes") | |
| 186 | }); | |
| 187 | let ptr = prepared_bytes.as_ptr(); | |
| 188 | // Store prepared allocation space to be picked up for use later. | |
| 189 | global_state.prepared_alloc_bytes.try_insert(alloc_id, prepared_bytes).unwrap(); | |
| 190 | ptr | |
| 191 | } else { | |
| 192 | ecx.get_alloc_bytes_unchecked_raw(alloc_id)? | |
| 193 | }; | |
| 194 | // Ensure this pointer's provenance is exposed, so that it can be used by FFI code. | |
| 195 | ptr.expose_provenance().try_into().unwrap() | |
| 196 | } | |
| 197 | AllocKind::Function | AllocKind::VTable => { | |
| 198 | // Allocate some dummy memory to get a unique address for this function/vtable. | |
| 199 | let alloc_bytes = MiriAllocBytes::from_bytes(&[0u8; 1], Align::from_bytes(1).unwrap()); | |
| 200 | // We don't need to expose these bytes as nobody is allowed to access them. | |
| 201 | let addr = alloc_bytes.as_ptr().addr().try_into().unwrap(); | |
| 202 | // Leak the underlying memory to ensure it remains unique. | |
| 203 | std::mem::forget(alloc_bytes); | |
| 204 | addr | |
| 205 | } | |
| 206 | AllocKind::Dead => unreachable!() | |
| 207 | } | |
| 208 | } else if let Some((reuse_addr, clock)) = global_state.reuse.take_addr( | |
| 170 | 209 | &mut *rng, |
| 171 | 210 | size, |
| 172 | 211 | align, |
| ... | ... | @@ -318,6 +357,33 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { |
| 318 | 357 | Ok(base_ptr.wrapping_offset(offset, ecx)) |
| 319 | 358 | } |
| 320 | 359 | |
| 360 | // This returns some prepared `MiriAllocBytes`, either because `addr_from_alloc_id` reserved | |
| 361 | // memory space in the past, or by doing the pre-allocation right upon being called. | |
| 362 | fn get_global_alloc_bytes(&self, id: AllocId, kind: MemoryKind, bytes: &[u8], align: Align) -> InterpResult<'tcx, MiriAllocBytes> { | |
| 363 | let ecx = self.eval_context_ref(); | |
| 364 | Ok(if ecx.machine.native_lib.is_some() { | |
| 365 | // In native lib mode, MiriAllocBytes for global allocations are handled via `prepared_alloc_bytes`. | |
| 366 | // This additional call ensures that some `MiriAllocBytes` are always prepared. | |
| 367 | ecx.addr_from_alloc_id(id, kind)?; | |
| 368 | let mut global_state = ecx.machine.alloc_addresses.borrow_mut(); | |
| 369 | // The memory we need here will have already been allocated during an earlier call to | |
| 370 | // `addr_from_alloc_id` for this allocation. So don't create a new `MiriAllocBytes` here, instead | |
| 371 | // fetch the previously prepared bytes from `prepared_alloc_bytes`. | |
| 372 | let mut prepared_alloc_bytes = global_state | |
| 373 | .prepared_alloc_bytes | |
| 374 | .remove(&id) | |
| 375 | .unwrap_or_else(|| panic!("alloc bytes for {id:?} have not been prepared")); | |
| 376 | // Sanity-check that the prepared allocation has the right size and alignment. | |
| 377 | assert!(prepared_alloc_bytes.as_ptr().is_aligned_to(align.bytes_usize())); | |
| 378 | assert_eq!(prepared_alloc_bytes.len(), bytes.len()); | |
| 379 | // Copy allocation contents into prepared memory. | |
| 380 | prepared_alloc_bytes.copy_from_slice(bytes); | |
| 381 | prepared_alloc_bytes | |
| 382 | } else { | |
| 383 | MiriAllocBytes::from_bytes(std::borrow::Cow::Borrowed(&*bytes), align) | |
| 384 | }) | |
| 385 | } | |
| 386 | ||
| 321 | 387 | /// When a pointer is used for a memory access, this computes where in which allocation the |
| 322 | 388 | /// access is going. |
| 323 | 389 | fn ptr_get_alloc( |
src/tools/miri/src/concurrency/thread.rs+1-1| ... | ... | @@ -889,7 +889,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { |
| 889 | 889 | let alloc = this.ctfe_query(|tcx| tcx.eval_static_initializer(def_id))?; |
| 890 | 890 | // We make a full copy of this allocation. |
| 891 | 891 | let mut alloc = |
| 892 | alloc.inner().adjust_from_tcx(&this.tcx, |ptr| this.global_root_pointer(ptr))?; | |
| 892 | alloc.inner().adjust_from_tcx(&this.tcx, |bytes, align| Ok(MiriAllocBytes::from_bytes(std::borrow::Cow::Borrowed(bytes), align)), |ptr| this.global_root_pointer(ptr))?; | |
| 893 | 893 | // This allocation will be deallocated when the thread dies, so it is not in read-only memory. |
| 894 | 894 | alloc.mutability = Mutability::Mut; |
| 895 | 895 | // Create a fresh allocation with this content. |
src/tools/miri/src/lib.rs+3| ... | ... | @@ -12,6 +12,9 @@ |
| 12 | 12 | #![feature(let_chains)] |
| 13 | 13 | #![feature(trait_upcasting)] |
| 14 | 14 | #![feature(strict_overflow_ops)] |
| 15 | #![feature(strict_provenance)] | |
| 16 | #![feature(exposed_provenance)] | |
| 17 | #![feature(pointer_is_aligned_to)] | |
| 15 | 18 | // Configure clippy and other lints |
| 16 | 19 | #![allow( |
| 17 | 20 | clippy::collapsible_else_if, |
src/tools/miri/src/machine.rs+25| ... | ... | @@ -1,6 +1,7 @@ |
| 1 | 1 | //! Global machine state as well as implementation of the interpreter engine |
| 2 | 2 | //! `Machine` trait. |
| 3 | 3 | |
| 4 | use std::borrow::Cow; | |
| 4 | 5 | use std::cell::RefCell; |
| 5 | 6 | use std::collections::hash_map::Entry; |
| 6 | 7 | use std::fmt; |
| ... | ... | @@ -1261,6 +1262,30 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> { |
| 1261 | 1262 | }) |
| 1262 | 1263 | } |
| 1263 | 1264 | |
| 1265 | /// Called to adjust global allocations to the Provenance and AllocExtra of this machine. | |
| 1266 | /// | |
| 1267 | /// If `alloc` contains pointers, then they are all pointing to globals. | |
| 1268 | /// | |
| 1269 | /// This should avoid copying if no work has to be done! If this returns an owned | |
| 1270 | /// allocation (because a copy had to be done to adjust things), machine memory will | |
| 1271 | /// cache the result. (This relies on `AllocMap::get_or` being able to add the | |
| 1272 | /// owned allocation to the map even when the map is shared.) | |
| 1273 | fn adjust_global_allocation<'b>( | |
| 1274 | ecx: &InterpCx<'tcx, Self>, | |
| 1275 | id: AllocId, | |
| 1276 | alloc: &'b Allocation, | |
| 1277 | ) -> InterpResult<'tcx, Cow<'b, Allocation<Self::Provenance, Self::AllocExtra, Self::Bytes>>> | |
| 1278 | { | |
| 1279 | let kind = Self::GLOBAL_KIND.unwrap().into(); | |
| 1280 | let alloc = alloc.adjust_from_tcx(&ecx.tcx, | |
| 1281 | |bytes, align| ecx.get_global_alloc_bytes(id, kind, bytes, align), | |
| 1282 | |ptr| ecx.global_root_pointer(ptr), | |
| 1283 | )?; | |
| 1284 | let extra = | |
| 1285 | Self::init_alloc_extra(ecx, id, kind, alloc.size(), alloc.align)?; | |
| 1286 | Ok(Cow::Owned(alloc.with_extra(extra))) | |
| 1287 | } | |
| 1288 | ||
| 1264 | 1289 | #[inline(always)] |
| 1265 | 1290 | fn before_memory_read( |
| 1266 | 1291 | _tcx: TyCtxtAt<'tcx>, |
src/tools/miri/src/shims/native_lib.rs+13| ... | ... | @@ -194,6 +194,8 @@ enum CArg { |
| 194 | 194 | UInt64(u64), |
| 195 | 195 | /// usize. |
| 196 | 196 | USize(usize), |
| 197 | /// Raw pointer, stored as C's `void*`. | |
| 198 | RawPtr(*mut std::ffi::c_void), | |
| 197 | 199 | } |
| 198 | 200 | |
| 199 | 201 | impl<'a> CArg { |
| ... | ... | @@ -210,6 +212,7 @@ impl<'a> CArg { |
| 210 | 212 | CArg::UInt32(i) => ffi::arg(i), |
| 211 | 213 | CArg::UInt64(i) => ffi::arg(i), |
| 212 | 214 | CArg::USize(i) => ffi::arg(i), |
| 215 | CArg::RawPtr(i) => ffi::arg(i), | |
| 213 | 216 | } |
| 214 | 217 | } |
| 215 | 218 | } |
| ... | ... | @@ -234,6 +237,16 @@ fn imm_to_carg<'tcx>(v: ImmTy<'tcx>, cx: &impl HasDataLayout) -> InterpResult<'t |
| 234 | 237 | ty::Uint(UintTy::U64) => CArg::UInt64(v.to_scalar().to_u64()?), |
| 235 | 238 | ty::Uint(UintTy::Usize) => |
| 236 | 239 | CArg::USize(v.to_scalar().to_target_usize(cx)?.try_into().unwrap()), |
| 240 | ty::RawPtr(_, mutability) => { | |
| 241 | // Arbitrary mutable pointer accesses are not currently supported in Miri. | |
| 242 | if mutability.is_mut() { | |
| 243 | throw_unsup_format!("unsupported mutable pointer type for native call: {}", v.layout.ty); | |
| 244 | } else { | |
| 245 | let s = v.to_scalar().to_pointer(cx)?.addr(); | |
| 246 | // This relies on the `expose_provenance` in `addr_from_alloc_id`. | |
| 247 | CArg::RawPtr(std::ptr::with_exposed_provenance_mut(s.bytes_usize())) | |
| 248 | } | |
| 249 | }, | |
| 237 | 250 | _ => throw_unsup_format!("unsupported argument type for native call: {}", v.layout.ty), |
| 238 | 251 | }) |
| 239 | 252 | } |
src/tools/miri/tests/native-lib/libtest.map deleted-12| ... | ... | @@ -1,12 +0,0 @@ |
| 1 | CODEABI_1.0 { | |
| 2 | # Define which symbols to export. | |
| 3 | global: | |
| 4 | add_one_int; | |
| 5 | printer; | |
| 6 | test_stack_spill; | |
| 7 | get_unsigned_int; | |
| 8 | add_int16; | |
| 9 | add_short_to_long; | |
| 10 | # The rest remains private. | |
| 11 | local: *; | |
| 12 | }; |
src/tools/miri/tests/native-lib/native-lib.map created+20| ... | ... | @@ -0,0 +1,20 @@ |
| 1 | CODEABI_1.0 { | |
| 2 | # Define which symbols to export. | |
| 3 | global: | |
| 4 | # scalar_arguments.c | |
| 5 | add_one_int; | |
| 6 | printer; | |
| 7 | test_stack_spill; | |
| 8 | get_unsigned_int; | |
| 9 | add_int16; | |
| 10 | add_short_to_long; | |
| 11 | ||
| 12 | # ptr_read_access.c | |
| 13 | print_pointer; | |
| 14 | access_simple; | |
| 15 | access_nested; | |
| 16 | access_static; | |
| 17 | ||
| 18 | # The rest remains private. | |
| 19 | local: *; | |
| 20 | }; |
src/tools/miri/tests/native-lib/pass/call_extern_c_fn.rs deleted-46| ... | ... | @@ -1,46 +0,0 @@ |
| 1 | //@only-target-linux | |
| 2 | //@only-on-host | |
| 3 | ||
| 4 | extern "C" { | |
| 5 | fn add_one_int(x: i32) -> i32; | |
| 6 | fn add_int16(x: i16) -> i16; | |
| 7 | fn test_stack_spill( | |
| 8 | a: i32, | |
| 9 | b: i32, | |
| 10 | c: i32, | |
| 11 | d: i32, | |
| 12 | e: i32, | |
| 13 | f: i32, | |
| 14 | g: i32, | |
| 15 | h: i32, | |
| 16 | i: i32, | |
| 17 | j: i32, | |
| 18 | k: i32, | |
| 19 | l: i32, | |
| 20 | ) -> i32; | |
| 21 | fn add_short_to_long(x: i16, y: i64) -> i64; | |
| 22 | fn get_unsigned_int() -> u32; | |
| 23 | fn printer(); | |
| 24 | } | |
| 25 | ||
| 26 | fn main() { | |
| 27 | unsafe { | |
| 28 | // test function that adds 2 to a provided int | |
| 29 | assert_eq!(add_one_int(1), 3); | |
| 30 | ||
| 31 | // test function that takes the sum of its 12 arguments | |
| 32 | assert_eq!(test_stack_spill(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12), 78); | |
| 33 | ||
| 34 | // test function that adds 3 to a 16 bit int | |
| 35 | assert_eq!(add_int16(-1i16), 2i16); | |
| 36 | ||
| 37 | // test function that adds an i16 to an i64 | |
| 38 | assert_eq!(add_short_to_long(-1i16, 123456789123i64), 123456789122i64); | |
| 39 | ||
| 40 | // test function that returns -10 as an unsigned int | |
| 41 | assert_eq!(get_unsigned_int(), (-10i32) as u32); | |
| 42 | ||
| 43 | // test void function that prints from C | |
| 44 | printer(); | |
| 45 | } | |
| 46 | } |
src/tools/miri/tests/native-lib/pass/call_extern_c_fn.stdout deleted-1| ... | ... | @@ -1 +0,0 @@ |
| 1 | printing from C |
src/tools/miri/tests/native-lib/pass/ptr_read_access.rs created+82| ... | ... | @@ -0,0 +1,82 @@ |
| 1 | //@only-target-linux | |
| 2 | //@only-on-host | |
| 3 | ||
| 4 | fn main() { | |
| 5 | test_pointer(); | |
| 6 | ||
| 7 | test_simple(); | |
| 8 | ||
| 9 | test_nested(); | |
| 10 | ||
| 11 | test_static(); | |
| 12 | } | |
| 13 | ||
| 14 | // Test void function that dereferences a pointer and prints its contents from C. | |
| 15 | fn test_pointer() { | |
| 16 | extern "C" { | |
| 17 | fn print_pointer(ptr: *const i32); | |
| 18 | } | |
| 19 | ||
| 20 | let x = 42; | |
| 21 | ||
| 22 | unsafe { print_pointer(&x) }; | |
| 23 | } | |
| 24 | ||
| 25 | // Test function that dereferences a simple struct pointer and accesses a field. | |
| 26 | fn test_simple() { | |
| 27 | #[repr(C)] | |
| 28 | struct Simple { | |
| 29 | field: i32 | |
| 30 | } | |
| 31 | ||
| 32 | extern "C" { | |
| 33 | fn access_simple(s_ptr: *const Simple) -> i32; | |
| 34 | } | |
| 35 | ||
| 36 | let simple = Simple { field: -42 }; | |
| 37 | ||
| 38 | assert_eq!(unsafe { access_simple(&simple) }, -42); | |
| 39 | } | |
| 40 | ||
| 41 | // Test function that dereferences nested struct pointers and accesses fields. | |
| 42 | fn test_nested() { | |
| 43 | use std::ptr::NonNull; | |
| 44 | ||
| 45 | #[derive(Debug, PartialEq, Eq)] | |
| 46 | #[repr(C)] | |
| 47 | struct Nested { | |
| 48 | value: i32, | |
| 49 | next: Option<NonNull<Nested>>, | |
| 50 | } | |
| 51 | ||
| 52 | extern "C" { | |
| 53 | fn access_nested(n_ptr: *const Nested) -> i32; | |
| 54 | } | |
| 55 | ||
| 56 | let mut nested_0 = Nested { value: 97, next: None }; | |
| 57 | let mut nested_1 = Nested { value: 98, next: NonNull::new(&mut nested_0) }; | |
| 58 | let nested_2 = Nested { value: 99, next: NonNull::new(&mut nested_1) }; | |
| 59 | ||
| 60 | assert_eq!(unsafe { access_nested(&nested_2) }, 97); | |
| 61 | } | |
| 62 | ||
| 63 | // Test function that dereferences static struct pointers and accesses fields. | |
| 64 | fn test_static() { | |
| 65 | ||
| 66 | #[repr(C)] | |
| 67 | struct Static { | |
| 68 | value: i32, | |
| 69 | recurse: &'static Static, | |
| 70 | } | |
| 71 | ||
| 72 | extern "C" { | |
| 73 | fn access_static(n_ptr: *const Static) -> i32; | |
| 74 | } | |
| 75 | ||
| 76 | static STATIC: Static = Static { | |
| 77 | value: 9001, | |
| 78 | recurse: &STATIC, | |
| 79 | }; | |
| 80 | ||
| 81 | assert_eq!(unsafe { access_static(&STATIC) }, 9001); | |
| 82 | } |
src/tools/miri/tests/native-lib/pass/ptr_read_access.stdout created+1| ... | ... | @@ -0,0 +1 @@ |
| 1 | printing pointer dereference from C: 42 |
src/tools/miri/tests/native-lib/pass/scalar_arguments.rs created+46| ... | ... | @@ -0,0 +1,46 @@ |
| 1 | //@only-target-linux | |
| 2 | //@only-on-host | |
| 3 | ||
| 4 | extern "C" { | |
| 5 | fn add_one_int(x: i32) -> i32; | |
| 6 | fn add_int16(x: i16) -> i16; | |
| 7 | fn test_stack_spill( | |
| 8 | a: i32, | |
| 9 | b: i32, | |
| 10 | c: i32, | |
| 11 | d: i32, | |
| 12 | e: i32, | |
| 13 | f: i32, | |
| 14 | g: i32, | |
| 15 | h: i32, | |
| 16 | i: i32, | |
| 17 | j: i32, | |
| 18 | k: i32, | |
| 19 | l: i32, | |
| 20 | ) -> i32; | |
| 21 | fn add_short_to_long(x: i16, y: i64) -> i64; | |
| 22 | fn get_unsigned_int() -> u32; | |
| 23 | fn printer(); | |
| 24 | } | |
| 25 | ||
| 26 | fn main() { | |
| 27 | unsafe { | |
| 28 | // test function that adds 2 to a provided int | |
| 29 | assert_eq!(add_one_int(1), 3); | |
| 30 | ||
| 31 | // test function that takes the sum of its 12 arguments | |
| 32 | assert_eq!(test_stack_spill(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12), 78); | |
| 33 | ||
| 34 | // test function that adds 3 to a 16 bit int | |
| 35 | assert_eq!(add_int16(-1i16), 2i16); | |
| 36 | ||
| 37 | // test function that adds an i16 to an i64 | |
| 38 | assert_eq!(add_short_to_long(-1i16, 123456789123i64), 123456789122i64); | |
| 39 | ||
| 40 | // test function that returns -10 as an unsigned int | |
| 41 | assert_eq!(get_unsigned_int(), (-10i32) as u32); | |
| 42 | ||
| 43 | // test void function that prints from C | |
| 44 | printer(); | |
| 45 | } | |
| 46 | } |
src/tools/miri/tests/native-lib/pass/scalar_arguments.stdout created+1| ... | ... | @@ -0,0 +1 @@ |
| 1 | printing from C |
src/tools/miri/tests/native-lib/ptr_read_access.c created+47| ... | ... | @@ -0,0 +1,47 @@ |
| 1 | #include <stdio.h> | |
| 2 | ||
| 3 | /* Test: test_pointer */ | |
| 4 | ||
| 5 | void print_pointer(const int *ptr) { | |
| 6 | printf("printing pointer dereference from C: %d\n", *ptr); | |
| 7 | } | |
| 8 | ||
| 9 | /* Test: test_simple */ | |
| 10 | ||
| 11 | typedef struct Simple { | |
| 12 | int field; | |
| 13 | } Simple; | |
| 14 | ||
| 15 | int access_simple(const Simple *s_ptr) { | |
| 16 | return s_ptr->field; | |
| 17 | } | |
| 18 | ||
| 19 | /* Test: test_nested */ | |
| 20 | ||
| 21 | typedef struct Nested { | |
| 22 | int value; | |
| 23 | struct Nested *next; | |
| 24 | } Nested; | |
| 25 | ||
| 26 | // Returns the innermost/last value of a Nested pointer chain. | |
| 27 | int access_nested(const Nested *n_ptr) { | |
| 28 | // Edge case: `n_ptr == NULL` (i.e. first Nested is None). | |
| 29 | if (!n_ptr) { return 0; } | |
| 30 | ||
| 31 | while (n_ptr->next) { | |
| 32 | n_ptr = n_ptr->next; | |
| 33 | } | |
| 34 | ||
| 35 | return n_ptr->value; | |
| 36 | } | |
| 37 | ||
| 38 | /* Test: test_static */ | |
| 39 | ||
| 40 | typedef struct Static { | |
| 41 | int value; | |
| 42 | struct Static *recurse; | |
| 43 | } Static; | |
| 44 | ||
| 45 | int access_static(const Static *s_ptr) { | |
| 46 | return s_ptr->recurse->recurse->value; | |
| 47 | } |
src/tools/miri/tests/native-lib/scalar_arguments.c created+27| ... | ... | @@ -0,0 +1,27 @@ |
| 1 | #include <stdio.h> | |
| 2 | ||
| 3 | int add_one_int(int x) { | |
| 4 | return 2 + x; | |
| 5 | } | |
| 6 | ||
| 7 | void printer() { | |
| 8 | printf("printing from C\n"); | |
| 9 | } | |
| 10 | ||
| 11 | // function with many arguments, to test functionality when some args are stored | |
| 12 | // on the stack | |
| 13 | int test_stack_spill(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l) { | |
| 14 | return a+b+c+d+e+f+g+h+i+j+k+l; | |
| 15 | } | |
| 16 | ||
| 17 | unsigned int get_unsigned_int() { | |
| 18 | return -10; | |
| 19 | } | |
| 20 | ||
| 21 | short add_int16(short x) { | |
| 22 | return x + 3; | |
| 23 | } | |
| 24 | ||
| 25 | long add_short_to_long(short x, long y) { | |
| 26 | return x + y; | |
| 27 | } |
src/tools/miri/tests/native-lib/test.c deleted-27| ... | ... | @@ -1,27 +0,0 @@ |
| 1 | #include <stdio.h> | |
| 2 | ||
| 3 | int add_one_int(int x) { | |
| 4 | return 2 + x; | |
| 5 | } | |
| 6 | ||
| 7 | void printer() { | |
| 8 | printf("printing from C\n"); | |
| 9 | } | |
| 10 | ||
| 11 | // function with many arguments, to test functionality when some args are stored | |
| 12 | // on the stack | |
| 13 | int test_stack_spill(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l) { | |
| 14 | return a+b+c+d+e+f+g+h+i+j+k+l; | |
| 15 | } | |
| 16 | ||
| 17 | unsigned int get_unsigned_int() { | |
| 18 | return -10; | |
| 19 | } | |
| 20 | ||
| 21 | short add_int16(short x) { | |
| 22 | return x + 3; | |
| 23 | } | |
| 24 | ||
| 25 | long add_short_to_long(short x, long y) { | |
| 26 | return x + y; | |
| 27 | } |
src/tools/miri/tests/ui.rs+10-3| ... | ... | @@ -36,18 +36,25 @@ fn build_native_lib() -> PathBuf { |
| 36 | 36 | // Create the directory if it does not already exist. |
| 37 | 37 | std::fs::create_dir_all(&so_target_dir) |
| 38 | 38 | .expect("Failed to create directory for shared object file"); |
| 39 | let so_file_path = so_target_dir.join("libtestlib.so"); | |
| 39 | let so_file_path = so_target_dir.join("native-lib.so"); | |
| 40 | 40 | let cc_output = Command::new(cc) |
| 41 | 41 | .args([ |
| 42 | 42 | "-shared", |
| 43 | 43 | "-o", |
| 44 | 44 | so_file_path.to_str().unwrap(), |
| 45 | "tests/native-lib/test.c", | |
| 45 | // FIXME: Automate gathering of all relevant C source files in the directory. | |
| 46 | "tests/native-lib/scalar_arguments.c", | |
| 47 | "tests/native-lib/ptr_read_access.c", | |
| 46 | 48 | // Only add the functions specified in libcode.version to the shared object file. |
| 47 | 49 | // This is to avoid automatically adding `malloc`, etc. |
| 48 | 50 | // Source: https://anadoxin.org/blog/control-over-symbol-exports-in-gcc.html/ |
| 49 | 51 | "-fPIC", |
| 50 | "-Wl,--version-script=tests/native-lib/libtest.map", | |
| 52 | "-Wl,--version-script=tests/native-lib/native-lib.map", | |
| 53 | // Ensure we notice serious problems in the C code. | |
| 54 | "-Wall", | |
| 55 | "-Wextra", | |
| 56 | "-Wpedantic", | |
| 57 | "-Werror", | |
| 51 | 58 | ]) |
| 52 | 59 | .output() |
| 53 | 60 | .expect("failed to generate shared object file for testing native function calls"); |
src/tools/opt-dist/src/tests.rs+7-1| ... | ... | @@ -102,7 +102,13 @@ llvm-config = "{llvm_config}" |
| 102 | 102 | for test_path in env.skipped_tests() { |
| 103 | 103 | args.extend(["--skip", test_path]); |
| 104 | 104 | } |
| 105 | cmd(&args).env("COMPILETEST_FORCE_STAGE0", "1").run().context("Cannot execute tests") | |
| 105 | cmd(&args) | |
| 106 | .env("COMPILETEST_FORCE_STAGE0", "1") | |
| 107 | // Above we override the stage 0 compiler with previously compiled compiler, | |
| 108 | // which can cause confusion in bootstrap's target sanity checks. | |
| 109 | .env("BOOTSTRAP_SKIP_TARGET_SANITY", "1") | |
| 110 | .run() | |
| 111 | .context("Cannot execute tests") | |
| 106 | 112 | } |
| 107 | 113 | |
| 108 | 114 | /// Tries to find the version of the dist artifacts (either nightly, beta, or 1.XY.Z). |
src/tools/run-make-support/Cargo.toml+1-1| ... | ... | @@ -7,7 +7,7 @@ edition = "2021" |
| 7 | 7 | bstr = "1.6.0" |
| 8 | 8 | object = "0.36.2" |
| 9 | 9 | similar = "2.5.0" |
| 10 | wasmparser = { version = "0.215", default-features = false, features = ["std"] } | |
| 10 | wasmparser = { version = "0.216", default-features = false, features = ["std"] } | |
| 11 | 11 | regex = "1.8" # 1.8 to avoid memchr 2.6.0, as 2.5.0 is pinned in the workspace |
| 12 | 12 | gimli = "0.31.0" |
| 13 | 13 | build_helper = { path = "../build_helper" } |
src/tools/tidy/src/features.rs+2-1| ... | ... | @@ -455,9 +455,10 @@ fn get_and_check_lib_features( |
| 455 | 455 | if f.tracking_issue != s.tracking_issue && f.level != Status::Accepted { |
| 456 | 456 | tidy_error!( |
| 457 | 457 | bad, |
| 458 | "{}:{}: `issue` \"{}\" mismatches the {} `issue` of \"{}\"", | |
| 458 | "{}:{}: feature gate {} has inconsistent `issue`: \"{}\" mismatches the {} `issue` of \"{}\"", | |
| 459 | 459 | file.display(), |
| 460 | 460 | line, |
| 461 | name, | |
| 461 | 462 | f.tracking_issue_display(), |
| 462 | 463 | display, |
| 463 | 464 | s.tracking_issue_display(), |
src/tools/tidy/src/target_specific_tests.rs+8-2| ... | ... | @@ -36,8 +36,8 @@ struct RevisionInfo<'a> { |
| 36 | 36 | llvm_components: Option<Vec<&'a str>>, |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | pub fn check(path: &Path, bad: &mut bool) { | |
| 40 | crate::walk::walk(path, |path, _is_dir| filter_not_rust(path), &mut |entry, content| { | |
| 39 | pub fn check(tests_path: &Path, bad: &mut bool) { | |
| 40 | crate::walk::walk(tests_path, |path, _is_dir| filter_not_rust(path), &mut |entry, content| { | |
| 41 | 41 | let file = entry.path().display(); |
| 42 | 42 | let mut header_map = BTreeMap::new(); |
| 43 | 43 | iter_header(content, &mut |HeaderLine { revision, directive, .. }| { |
| ... | ... | @@ -65,6 +65,12 @@ pub fn check(path: &Path, bad: &mut bool) { |
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | }); |
| 68 | ||
| 69 | // Skip run-make tests as revisions are not supported. | |
| 70 | if entry.path().strip_prefix(tests_path).is_ok_and(|rest| rest.starts_with("run-make")) { | |
| 71 | return; | |
| 72 | } | |
| 73 | ||
| 68 | 74 | for (rev, RevisionInfo { target_arch, llvm_components }) in &header_map { |
| 69 | 75 | let rev = rev.unwrap_or("[unspecified]"); |
| 70 | 76 | match (target_arch, llvm_components) { |
tests/crashes/129425.rs created+6| ... | ... | @@ -0,0 +1,6 @@ |
| 1 | //@ known-bug: rust-lang/rust#129425 | |
| 2 | ||
| 3 | //@compile-flags: --crate-type=lib | |
| 4 | ||
| 5 | #![feature(generic_const_exprs)] | |
| 6 | fn foo<'a, T: 'a>(_: [(); std::mem::offset_of!((T,), 0)]) {} |
tests/crashes/129444.rs created+15| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | //@ known-bug: rust-lang/rust#129444 | |
| 2 | ||
| 3 | //@ compile-flags: -Znext-solver=coherence | |
| 4 | ||
| 5 | trait Trait { | |
| 6 | type Assoc; | |
| 7 | } | |
| 8 | ||
| 9 | struct W<T: Trait>(*mut T); | |
| 10 | impl<T: ?Trait> Trait for W<W<W<T>>> {} | |
| 11 | ||
| 12 | trait NoOverlap {} | |
| 13 | impl<T: Trait<W<T>>> NoOverlap for T {} | |
| 14 | ||
| 15 | impl<T: Trait<Assoc = u32>> NoOverlap for W<T> {} |
tests/crashes/129503.rs created+7| ... | ... | @@ -0,0 +1,7 @@ |
| 1 | //@ known-bug: rust-lang/rust#129503 | |
| 2 | ||
| 3 | use std::arch::asm; | |
| 4 | ||
| 5 | unsafe fn f6() { | |
| 6 | asm!(concat!(r#"lJ�.�"#, "r} {}")); | |
| 7 | } |
tests/crashes/129556.rs created+26| ... | ... | @@ -0,0 +1,26 @@ |
| 1 | //@ known-bug: rust-lang/rust#129556 | |
| 2 | ||
| 3 | #![feature(adt_const_params)] | |
| 4 | #![feature(generic_const_exprs)] | |
| 5 | ||
| 6 | use core::marker::ConstParamTy; | |
| 7 | ||
| 8 | // #[derive(ConstParamTy, PartialEq, Eq)] | |
| 9 | // struct StructOrEnum; | |
| 10 | ||
| 11 | #[derive(ConstParamTy, PartialEq, Eq)] | |
| 12 | enum StructOrEnum { | |
| 13 | A, | |
| 14 | } | |
| 15 | ||
| 16 | trait TraitParent<const SMTH: StructOrEnum = { StructOrEnum::A }> {} | |
| 17 | ||
| 18 | trait TraitChild<const SMTH: StructOrEnum = { StructOrEnum::A }>: TraitParent<SMTH> {} | |
| 19 | ||
| 20 | impl TraitParent for StructOrEnum {} | |
| 21 | ||
| 22 | // ICE occurs | |
| 23 | impl TraitChild for StructOrEnum {} | |
| 24 | ||
| 25 | // ICE does not occur | |
| 26 | // impl TraitChild<{ StructOrEnum::A }> for StructOrEnum {} |
tests/run-make/print-cfg/rmake.rs+5| ... | ... | @@ -5,6 +5,11 @@ |
| 5 | 5 | //! |
| 6 | 6 | //! It also checks that some targets have the correct set cfgs. |
| 7 | 7 | |
| 8 | // ignore-tidy-linelength | |
| 9 | //@ needs-llvm-components: arm x86 | |
| 10 | // Note: without the needs-llvm-components it will fail on LLVM built without the required | |
| 11 | // components listed above. | |
| 12 | ||
| 8 | 13 | use std::collections::HashSet; |
| 9 | 14 | use std::iter::FromIterator; |
| 10 | 15 | use std::path::PathBuf; |
tests/run-make/print-target-list/rmake.rs+9-4| ... | ... | @@ -1,10 +1,15 @@ |
| 1 | // Checks that all the targets returned by `rustc --print target-list` are valid | |
| 2 | // target specifications | |
| 1 | // Checks that all the targets returned by `rustc --print target-list` are valid target | |
| 2 | // specifications. | |
| 3 | ||
| 4 | // ignore-tidy-linelength | |
| 5 | //@ needs-llvm-components: aarch64 arm avr bpf csky hexagon loongarch m68k mips msp430 nvptx powerpc riscv sparc systemz webassembly x86 | |
| 6 | // FIXME(jieyouxu): there has to be a better way to do this, without the needs-llvm-components it | |
| 7 | // will fail on LLVM built without all of the components listed above. | |
| 3 | 8 | |
| 4 | 9 | use run_make_support::bare_rustc; |
| 5 | 10 | |
| 6 | // FIXME(127877): certain experimental targets fail with creating a 'LLVM TargetMachine' | |
| 7 | // in CI, so we skip them | |
| 11 | // FIXME(#127877): certain experimental targets fail with creating a 'LLVM TargetMachine' in CI, so | |
| 12 | // we skip them. | |
| 8 | 13 | const EXPERIMENTAL_TARGETS: &[&str] = &["avr", "m68k", "csky", "xtensa"]; |
| 9 | 14 | |
| 10 | 15 | fn main() { |
tests/run-make/print-to-output/rmake.rs+8-2| ... | ... | @@ -1,5 +1,11 @@ |
| 1 | //! This checks the output of some `--print` options when | |
| 2 | //! output to a file (instead of stdout) | |
| 1 | //! This checks the output of some `--print` options when output to a file (instead of stdout) | |
| 2 | ||
| 3 | // ignore-tidy-linelength | |
| 4 | //@ needs-llvm-components: aarch64 arm avr bpf csky hexagon loongarch m68k mips msp430 nvptx powerpc riscv sparc systemz webassembly x86 | |
| 5 | // FIXME(jieyouxu): there has to be a better way to do this, without the needs-llvm-components it | |
| 6 | // will fail on LLVM built without all of the components listed above. If adding a new target that | |
| 7 | // relies on a llvm component not listed above, it will need to be added to the required llvm | |
| 8 | // components above. | |
| 3 | 9 | |
| 4 | 10 | use std::path::PathBuf; |
| 5 | 11 |
tests/run-make/target-without-atomic-cas/rmake.rs+10-5| ... | ... | @@ -1,8 +1,13 @@ |
| 1 | // ARM Cortex-M are a class of processors supported by the rust compiler. However, | |
| 2 | // they cannot support any atomic features, such as Arc. This test simply prints | |
| 3 | // the configuration details of one Cortex target, and checks that the compiler | |
| 4 | // does not falsely list atomic support. | |
| 5 | // See https://github.com/rust-lang/rust/pull/36874 | |
| 1 | // ARM Cortex-M are a class of processors supported by the rust compiler. However, they cannot | |
| 2 | // support any atomic features, such as Arc. This test simply prints the configuration details of | |
| 3 | // one Cortex target, and checks that the compiler does not falsely list atomic support. | |
| 4 | // See <https://github.com/rust-lang/rust/pull/36874>. | |
| 5 | ||
| 6 | // ignore-tidy-linelength | |
| 7 | //@ needs-llvm-components: arm | |
| 8 | // Note: without the needs-llvm-components it will fail on LLVM built without all of the components | |
| 9 | // listed above. If any new targets are added, please double-check their respective llvm components | |
| 10 | // are specified above. | |
| 6 | 11 | |
| 7 | 12 | use run_make_support::rustc; |
| 8 | 13 |
tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr+2-2| ... | ... | @@ -20,12 +20,12 @@ error: const-stable function cannot use `#[feature(const_refs_to_cell)]` |
| 20 | 20 | LL | x.get(); |
| 21 | 21 | | ^ |
| 22 | 22 | | |
| 23 | help: if it is not part of the public API, make this function unstably const | |
| 23 | help: if the function is not (yet) meant to be stable, make this function unstably const | |
| 24 | 24 | | |
| 25 | 25 | LL + #[rustc_const_unstable(feature = "...", issue = "...")] |
| 26 | 26 | LL | const fn bar3() -> u32 { |
| 27 | 27 | | |
| 28 | help: otherwise `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (but requires team approval) | |
| 28 | help: otherwise, as a last resort `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (but requires team approval) | |
| 29 | 29 | | |
| 30 | 30 | LL + #[rustc_allow_const_fn_unstable(const_refs_to_cell)] |
| 31 | 31 | LL | const fn bar3() -> u32 { |