about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2025-02-21Rollup merge of #137392 - klensy:unused, r=compiler-errorsMatthias Krüger-6/+4
remove few unused fields Remove unused field and convert hashmap to hashset in second commit.
2025-02-21Rollup merge of #137374 - bjorn3:remove_stacker_miri_special_case, ↵Matthias Krüger-16/+4
r=compiler-errors Stacker now handles miri using a noop impl itself Reverts a no longer necessary change from https://github.com/rust-lang/rust/pull/136580.
2025-02-21Rollup merge of #137367 - workingjubilee:remove-stray-line, r=jieyouxuMatthias Krüger-1/+0
Do not exempt nonexistent platforms from platform policy In #137324 I approved the change of the i586-pc-qnx platform to i686 with this extra line included. I noticed it but thought it was a bootstrap problem of some sort. Nonetheless, removing this line doesn't seem to change anything. r? `@Noratrieb`
2025-02-21Rollup merge of #137361 - scottmcm:mcp-838-prep, r=compiler-errorsMatthias Krüger-22/+24
Refactor `OperandRef::extract_field` to prep for MCP838 cc https://github.com/rust-lang/compiler-team/issues/838 This still supports exactly the same cases as it did before, just rearranged a bit to better emphasize what doesn't work.
2025-02-21Rollup merge of #137353 - thaliaarchi:io-optional-methods/wasi-stdin, ↵Matthias Krüger-1/+6
r=alexcrichton Implement `read_buf` for WASI stdin `WasiFd::read_buf` already exists. Simply use it in `Stdin`. cc `@alexcrichton` Tracked in https://github.com/rust-lang/rust/issues/136756
2025-02-21Rollup merge of #137350 - nnethercote:remove-Map-3, r=ZalatharMatthias Krüger-289/+259
Move methods from Map to TyCtxt, part 3. A follow-up to #137162. r? `@Zalathar`
2025-02-21Rollup merge of #137336 - riverbl:stabilise-os-str-display, r=tgross35Matthias Krüger-8/+5
Stabilise `os_str_display` Closes #120048.
2025-02-21Rollup merge of #136609 - mammothbane:master, r=scottmcmMatthias Krüger-0/+60
libcore/net: `IpAddr::as_octets()` [ACP](https://github.com/rust-lang/libs-team/issues/535) [Tracking issue](https://github.com/rust-lang/rust/issues/137259) Adds `const` `core::net::IpAddr{,v4,v6}::as_octets()` methods to provide reference access to IP address contents. The concrete usecase for me is allowing the `IpAddr` to provide an extended lifetime in contexts that want a `&[u8]`: ```rust trait AddrSlice { fn addr_slice(&self) -> &[u8]; } impl AddrSlice for IpAddrV4 { fn addr_slice(&self) -> &[u8] { // self.octets() doesn't help us here, because we can't return a reference to the owned array. // Instead we want the IpAddrV4 to continue owning the memory: self.as_octets() } } ``` (Notably, in this case we can't parameterize `AddrSlice` by a `const N: usize` (such that `fn addr_slice(&self) -> [u8; N]`) and maintain object-safety.)
2025-02-21Rollup merge of #136148 - kpreid:type-str, r=joboetMatthias Krüger-4/+37
Optionally add type names to `TypeId`s. This feature is intended to provide expensive but thorough help for developers who have an unexpected `TypeId` value and need to determine what type it actually is. It causes `impl Debug for TypeId` to print the type name in addition to the opaque ID hash, and in order to do so, adds a name field to `TypeId`. The cost of this is the increased size of `TypeId` and the need to store type names in the binary; therefore, it is an optional feature. It does not expose any new public API, only change the `Debug` implementation. It may be enabled via `cargo -Zbuild-std -Zbuild-std-features=debug_typeid`. (Note that `-Zbuild-std-features` disables default features which you may wish to reenable in addition; see <https://doc.rust-lang.org/cargo/reference/unstable.html#build-std-features>.) Example usage and output: ``` fn main() { use std::any::{Any, TypeId}; dbg!(TypeId::of::<usize>(), drop::<usize>.type_id()); } ``` ``` TypeId::of::<usize>() = TypeId(0x763d199bccd319899208909ed1a860c6 = usize) drop::<usize>.type_id() = TypeId(0xe6a34bd13f8c92dd47806da07b8cca9a = core::mem::drop<usize>) ``` Also added feature declarations for the existing `debug_refcell` feature so it is usable from the `rust.std-features` option of `config.toml`. Related issues: * #68379 * #61533
2025-02-21Rollup merge of #132876 - lolbinarycat:rustdoc-document-hidden-items, ↵Matthias Krüger-4/+23
r=GuillaumeGomez rustdoc book: acknowledge --document-hidden-items
2025-02-21Stacker now handles miri using a noop impl itselfbjorn3-16/+4
2025-02-21convert all_macro_rules from hashmap to hashsetklensy-4/+4
2025-02-21remove unused pred_rcacheklensy-2/+0
2025-02-21Auto merge of #137192 - kornelski:windows-tls-lto, r=ChrisDentonbors-3/+1
Remove obsolete Windows ThinLTO+TLS workaround The bug #109797 has been fixed by #129079, so this workaround is no longer needed.
2025-02-21Do not exempt nonexistent platforms from platform policyJubilee Young-1/+0
2025-02-20Refactor `OperandRef::extract_field` to prep for 838Scott McMurray-22/+24
2025-02-21Move methods from Map to TyCtxt, part 3.Nicholas Nethercote-273/+243
Continuing the work from #137162. Every method gains a `hir_` prefix.
2025-02-21Auto merge of #137346 - workingjubilee:rollup-sxu05ms, r=workingjubileebors-261/+773
Rollup of 12 pull requests Successful merges: - #131651 (Create a generic AVR target: avr-none) - #134340 (Stabilize `num_midpoint_signed` feature) - #136473 (infer linker flavor by linker name if it's sufficiently specific) - #136608 (Pass through of target features to llvm-bitcode-linker and handling them) - #136985 (Do not ignore uninhabited types for function-call ABI purposes. (Remove BackendRepr::Uninhabited)) - #137270 (Fix `*-win7-windows-msvc` target since 26eeac1a1e9fe46ffd80dd0d3dafdd2c2a644306) - #137312 (Update references to cc_detect.rs) - #137318 (Workaround Cranelift not yet properly supporting vectors smaller than 128bit) - #137322 (Update docs for default features of wasm targets) - #137324 (Make x86 QNX target name consistent with other Rust targets) - #137338 (skip submodule updating logics on tarballs) - #137340 (Add a notice about missing GCC sources into source tarballs) r? `@ghost` `@rustbot` modify labels: rollup
2025-02-20Implement read_buf for WASI stdinThalia Archibald-1/+6
2025-02-21Store `TyCtxt` instead of `Map` in some iterators.Nicholas Nethercote-19/+19
2025-02-20rustdoc book: acknowlage --document-hidden-itemsbinarycat-4/+23
2025-02-20Rollup merge of #137340 - Kobzol:bootstrap-dir-check, r=onur-ozkanJubilee-1/+12
Add a notice about missing GCC sources into source tarballs I didn't use `.gitkeep`, because that would be a hidden file that might not be noticed, whereas we want to let people inspecting the archive know why the sources are missing. Inspired by https://github.com/rust-lang/rust/issues/137332. r? `@onur-ozkan`
2025-02-20Rollup merge of #137338 - onur-ozkan:137332, r=KobzolJubilee-1/+5
skip submodule updating logics on tarballs Running submodule logic on tarballs isn't necessary since git isn't available there. Fixes #137332
2025-02-20Rollup merge of #137324 - flba-eb:rename_qnx_target_name_i586, r=workingjubileeJubilee-6/+7
Make x86 QNX target name consistent with other Rust targets Rename target to be consistent with other Rust targets: Use `i686` instead of `i586` See also - #136495 - #109173 CC: `@jonathanpallant` `@japaric` `@gh-tr` `@samkearney`
2025-02-20Rollup merge of #137322 - alexcrichton:update-wasm-docs, r=jieyouxuJubilee-0/+2
Update docs for default features of wasm targets LLVM 20 enabled the `nontrapping-fptoint` and `bulk-memory` features by default, so this updates the corresponding documentation for the `wasm32-*` targets (which all point to `wasm32-unknown-unknown`). Closes #137315 with a doc update for the doc part.
2025-02-20Rollup merge of #137318 - bjorn3:cg_clif_abi_workaround, r=workingjubileeJubilee-1/+3
Workaround Cranelift not yet properly supporting vectors smaller than 128bit While it would technically be possible to workaround this in cg_clif, it quickly becomes very messy and would likely cause correctness issues. Working around it in rustc instead is much simper and won't have any negative impact for code running on stable as vectors smaller than 128bit can only be made on nightly using core::simd or #[repr(simd)].
2025-02-20Rollup merge of #137312 - jmqd:master, r=clubby789Jubilee-2/+2
Update references to cc_detect.rs The locations of these file references have since been changed. This is a simple change to update the references to this `cc_detect.rs` file.
2025-02-20Rollup merge of #137270 - QianNangong:master, r=ChrisDentonJubilee-8/+8
Fix `*-win7-windows-msvc` target since 26eeac1a1e9fe46ffd80dd0d3dafdd2c2a644306 That commit make it failed to build `std` with `*-win7-windows-msvc` so fix it.
2025-02-20Rollup merge of #136985 - zachs18:backend-repr-remove-uninhabited, ↵Jubilee-167/+532
r=workingjubilee Do not ignore uninhabited types for function-call ABI purposes. (Remove BackendRepr::Uninhabited) Accepted MCP: https://github.com/rust-lang/compiler-team/issues/832 Fixes #135802 Do not consider the inhabitedness of a type for function call ABI purposes. * Remove the [`rustc_abi::BackendRepr::Uninhabited`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_abi/enum.BackendRepr.html) variant * Instead calculate the `BackendRepr` of uninhabited types "normally" (as though they were not uninhabited "at the top level", but still considering inhabitedness of variants to determine enum layout, etc) * Add an `uninhabited: bool` field to [`rustc_abi::LayoutData`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_abi/struct.LayoutData.html) so inhabitedness of a `LayoutData` can still be queried when necessary (e.g. when determining if an enum variant needs a tag value allocated to it). This should not affect type layouts (size/align/field offset); this should only affect function call ABI, and only of uninhabited types. cc ``@RalfJung``
2025-02-20Rollup merge of #136608 - kulst:ptx_target_features, r=bjorn3Jubilee-2/+26
Pass through of target features to llvm-bitcode-linker and handling them When using the llvm-bitcode-linker (`linker-flavor=llbc`) target-features are not passed through and are not handled by it. The llvm-bitcode-linker is mainly used as a self contained linker to link llvm bitcode for the nvptx64 target. It uses `llvm-link`, `opt` and `llc` internally. To produce a `.ptx` file of a specific ptx-version it is necessary to pass the version to llc with the `--mattr` option. Without explicitly setting it, the emitted `.ptx`-version is the minimum supported version of the `--target-cpu`. I would like to be able to explicitly set the ptx version as [some llvm problems only occur in earlier `.ptx`-versions](https://github.com/llvm/llvm-project/issues/112998). Therefore this pull request adds support for passing target features to llvm-bitcode-linker and handling them. I was not quite sure if adding these features to `rustc_target/src/target_features.rs` is necessary or not. If so I will gladly add these. r? ``@kjetilkjeka``
2025-02-20Rollup merge of #136473 - usamoi:infer_linker_hints, r=petrochenkovJubilee-8/+12
infer linker flavor by linker name if it's sufficiently specific Fix: `rustc` does not infer `llvm-bitcode-linker` uses `llbc` linker flavor if targeting `nvptx64-nvidia-cuda`.
2025-02-20Rollup merge of #134340 - Urgau:stabilize-num_midpoint_signed, r=scottmcmJubilee-5/+4
Stabilize `num_midpoint_signed` feature This PR proposes that we stabilize the signed variants of [`iN::midpoint`](https://github.com/rust-lang/rust/issues/110840#issue-1684506201), the operation is equivalent to doing `(a + b) / 2` in a sufficiently large number. The stabilized API surface would be: ```rust /// Calculates the middle point of `self` and `rhs`. /// /// `midpoint(a, b)` is `(a + b) / 2` as if it were performed in a /// sufficiently-large signed integer type. This implies that the result is /// always rounded towards zero and that no overflow will ever occur. impl i{8,16,32,64,128,size} { pub const fn midpoint(self, rhs: Self) -> Self; } ``` T-libs-api previously stabilized the unsigned (and float) variants in #131784, the signed variants were left out because of the rounding that should be used in case of negative midpoint. This stabilization proposal proposes that we round towards zero because: - it makes the obvious `(a + b) / 2` in a sufficiently-large number always true - using another rounding for the positive result would be inconsistent with the unsigned variants - it makes `midpoint(-a, -b)` == `-midpoint(a, b)` always true - it is consistent with `midpoint(a as f64, b as f64) as i64` - it makes it possible to always suggest `midpoint` as a replacement for `(a + b) / 2` expressions *(which we may want to do as a future work given the 21.2k hits on [GitHub Search](https://github.com/search?q=lang%3Arust+%2F%5C%28%5Ba-zA-Z_%5D*+%5C%2B+%5Ba-zA-Z_%5D*%5C%29+%5C%2F+2%2F&type=code&p=1))* `@scottmcm` mentioned a drawback in https://github.com/rust-lang/rust/pull/132191#issuecomment-2439891200: > I'm torn, because rounding towards zero makes it "wider" than other values, which `>> 1` avoids -- `(a + b) >> 1` has the nice behaviour that `midpoint(a, b) + 2 == midpoint(a + 2, b + 2)`. > > But I guess overall sticking with `(a + b) / 2` makes sense as well, and I do like the negation property 🤷 Which I think is outweigh by the advantages cited above. Closes #110840 cc `@rust-lang/libs-api` cc `@scottmcm` r? `@dtolnay`
2025-02-20Rollup merge of #131651 - Patryk27:avr-unknown-unknown, r=tgross35Jubilee-60/+160
Create a generic AVR target: avr-none This commit removes the `avr-unknown-gnu-atmega328` target and replaces it with a more generic `avr-none` variant that must be specialized using `-C target-cpu` (e.g. `-C target-cpu=atmega328p`). Seizing the day, I'm adding myself as the maintainer of this target - I've been already fixing the bugs anyway, might as well make it official 🙂 Related discussions: - https://github.com/rust-lang/rust/pull/131171 - https://github.com/rust-lang/compiler-team/issues/800 try-job: x86_64-gnu-debug
2025-02-20Add a notice about missing GCC sources in source tarballsJakub Beránek-0/+11
2025-02-20skip submodule updating logics on tarballsonur-ozkan-1/+5
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-02-20Improve error message when a submodule directory is missing completelyJakub Beránek-1/+1
2025-02-20fine-tune commentRalf Jung-6/+5
2025-02-20Adjust LayoutData::uninhabited doc comment.zachs18-2/+2
Co-authored-by: Jubilee <workingjubilee@gmail.com>
2025-02-20Add test that uninhabited repr(transparent) type has same function return ↵Zachary S-21/+84
ABI as wrapped type. Fix codegen of uninhabited PassMode::Indirect return types. Add codegen test for uninhabited PassMode::Indirect return types. Enable optimizations for uninhabited return type codegen test
2025-02-20Update check to reflect that non-ZST uninhabited types should not be ↵Zachary S-1/+1
PassMode::Ignore.
2025-02-20Update ui tests with `LayoutData { uninhabited: ... }` etcZachary S-26/+349
2025-02-20Remove `BackendRepr::Uninhabited`, replaced with an `uninhabited: bool` ↵Zachary S-113/+93
field in `LayoutData`. Also update comments that refered to BackendRepr::Uninhabited.
2025-02-20Stabilise `os_str_display`riverbl-8/+5
2025-02-20Auto merge of #136771 - scottmcm:poke-slice-iter-next, r=joboetbors-152/+763
Simplify `slice::Iter::next` enough that it inlines Inspired by this zulip conversation: <https://rust-lang.zulipchat.com/#narrow/channel/189540-t-compiler.2Fwg-mir-opt/topic/Feedback.20on.20a.20MIR.20optimization.20idea/near/498579990> ~~Draft for now because it needs #136735 to get the codegen tests to pass.~~
2025-02-20Make x86 QNX target name consistent with other Rust targetsFlorian Bartels-6/+7
2025-02-20Update docs for default features of wasm targetsAlex Crichton-0/+2
LLVM 20 enabled the `nontrapping-fptoint` and `bulk-memory` features by default, so this updates the corresponding documentation for the `wasm32-*` targets (which all point to `wasm32-unknown-unknown`). cc #137315
2025-02-20Workaround Cranelift not yet properly supporting vectors smaller than 128bitbjorn3-1/+3
While it would technically be possible to workaround this in cg_clif, it quickly becomes very messy and would likely cause correctness issues. Working around it in rustc instead is much simper and won't have any negative impact for code running on stable as vectors smaller than 128bit can only be made on nightly using core::simd or #[repr(simd)].
2025-02-20avr-rjmp-offset: Explain `.target_cpu()`Patryk Wychowaniec-0/+4
2025-02-20Auto merge of #137123 - Zalathar:user-type-span, r=oli-obkbors-53/+40
Don't store a redundant span in user-type projections While experimenting with some larger changes, I noticed that storing this span here is unnecessary, because it is also present in the corresponding `CanonicalUserTypeAnnotation` and can be retrieved via the annotation's ID.
2025-02-20infer linker flavor by linker name if it's sufficiently specificusamoi-8/+12