about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2024-12-08coverage: Use a query to find counters/expressions that must be zeroZalathar-117/+117
This query (`coverage_ids_info`) already determines which counter/expression IDs are unused, so it only takes a little extra effort to also determine which counters/expressions must have a value of zero.
2024-12-08coverage: Move `CoverageIdsInfo` into `mir::coverage`Zalathar-35/+34
2024-12-08Auto merge of #133988 - weihanglo:update-cargo, r=weihanglobors-0/+0
Update cargo 6 commits in 05f54fdc34310f458033af8a63ce1d699fae8bf6..20a443231846b81c7b909691ec3f15eb173f2b18 2024-12-03 03:14:12 +0000 to 2024-12-06 21:56:56 +0000 - fix(fingerprint): Don't throwaway the cache on RUSTFLAGS changes (rust-lang/cargo#14830) - fix(build-rs)!: Remove meaningless 'cargo_cfg_debug_assertions' (rust-lang/cargo#14901) - docs(fingerprint): cargo-rustc extra flags do not affect the metadata (rust-lang/cargo#14898) - fix(add): Don't select yanked versions when normalizing names (rust-lang/cargo#14895) - fix(fix): Migrate workspace dependencies (rust-lang/cargo#14890) - test(build-std): make mock-std closer to real world (rust-lang/cargo#14896)
2024-12-07Auto merge of #133978 - matthiaskrgr:rollup-6gh1iho, r=matthiaskrgrbors-231/+290
Rollup of 7 pull requests Successful merges: - #130209 (Stabilize `std::io::ErrorKind::CrossesDevices`) - #130254 (Stabilize `std::io::ErrorKind::QuotaExceeded`) - #132187 (Add Extend impls for tuples of arity 1 through 12) - #133875 (handle `--json-output` properly) - #133934 (Do not implement unsafe auto traits for types with unsafe fields) - #133954 (Hide errors whose suggestions would contain error constants or types) - #133960 (rustdoc: remove eq for clean::Attributes) r? `@ghost` `@rustbot` modify labels: rollup
2024-12-07Auto merge of #133897 - oli-obk:push-lsxrqtqqwmpt, r=jieyouxubors-24/+0
Remove a lit_to_const call We have so many special cases of `match expr.kind { Lit() => {}, Unary(Neg, Lit()) => {} }`... I'm trying to figure out how to get these all unified, but outright removing some is good, too. So let's try it. Tho we don't have many `const {}` blocks in the perf test suite... But I also don't know how common `const { 42 }` blocks are, I'd expect these to occur mostly from macros (like `thread_local!`)
2024-12-07Auto merge of #133883 - saethlin:remove-polymorphization, r=compiler-errorsbors-2643/+59
Remove polymorphization This PR removes the flag `-Zpolymorphize` and all the infrastructure in the compiler that exists only to support it, per https://github.com/rust-lang/compiler-team/issues/810.
2024-12-06Update cargoWeihang Lo-0/+0
2024-12-06Auto merge of #118159 - EliasHolzmann:formatting_options, r=m-ou-sebors-93/+374
Implementation of `fmt::FormattingOptions` Tracking issue: #118117 Public API: ```rust #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub struct FormattingOptions { … } #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub enum Sign { Plus, Minus } #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub enum DebugAsHex { Lower, Upper } impl FormattingOptions { pub fn new() -> Self; pub fn sign(&mut self, sign: Option<Sign>) -> &mut Self; pub fn sign_aware_zero_pad(&mut self, sign_aware_zero_pad: bool) -> &mut Self; pub fn alternate(&mut self, alternate: bool) -> &mut Self; pub fn fill(&mut self, fill: char) -> &mut Self; pub fn align(&mut self, alignment: Option<Alignment>) -> &mut Self; pub fn width(&mut self, width: Option<usize>) -> &mut Self; pub fn precision(&mut self, precision: Option<usize>) -> &mut Self; pub fn debug_as_hex(&mut self, debug_as_hex: Option<DebugAsHex>) -> &mut Self; pub fn get_sign(&self) -> Option<Sign>; pub fn get_sign_aware_zero_pad(&self) -> bool; pub fn get_alternate(&self) -> bool; pub fn get_fill(&self) -> char; pub fn get_align(&self) -> Option<Alignment>; pub fn get_width(&self) -> Option<usize>; pub fn get_precision(&self) -> Option<usize>; pub fn get_debug_as_hex(&self) -> Option<DebugAsHex>; pub fn create_formatter<'a>(self, write: &'a mut (dyn Write + 'a)) -> Formatter<'a>; } impl<'a> Formatter<'a> { pub fn new(write: &'a mut (dyn Write + 'a), options: FormattingOptions) -> Self; pub fn with_options<'b>(&'b mut self, options: FormattingOptions) -> Formatter<'b>; pub fn sign(&self) -> Option<Sign>; pub fn options(&self) -> FormattingOptions; } ``` Relevant changes from the public API in the tracking issue (I'm leaving out some stuff I consider obvious mistakes, like missing `#[derive(..)]`s and `pub` specifiers): - `enum DebugAsHex`/`FormattingOptions::debug_as_hex`/`FormattingOptions::get_debug_as_hex`: To support `{:x?}` as well as `{:X?}`. I had completely missed these options in the ACP. I'm open for any and all bikeshedding, not married to the name. - `fill`/`get_fill` now takes/returns `char` instead of `Option<char>`. This simply mirrors what `Formatter::fill` returns (with default being `' '`). - Changed `zero_pad`/`get_zero_pad` to `sign_aware_zero_pad`/`get_sign_aware_zero_pad`. This also mirrors `Formatter::sign_aware_zero_pad`. While I'm not a fan of this quite verbose name, I do believe that having the interface of `Formatter` and `FormattingOptions` be compatible is more important. - For the same reason, renamed `alignment`/`get_alignment` to `aling`/`get_align`. - Deviating from my initial idea, `Formatter::with_options` returns a `Formatter` which has the lifetime of the `self` reference as its generic lifetime parameter (in the original API spec, the generic lifetime of the returned `Formatter` was the generic lifetime used by `self` instead). Otherwise, one could construct two `Formatter`s that both mutably borrow the same underlying buffer, which would be unsound. This solution still has performance benefits over simply using `Formatter::new`, so I believe it is worthwhile to keep this method.
2024-12-06Remove polymorphizationBen Kimock-2643/+59
2024-12-06Rollup merge of #133960 - jdonszelmann:remove-eq-on-attributes, r=notriddleMatthias Krüger-13/+0
rustdoc: remove eq for clean::Attributes This change removes the `PartialEq` and `Eq` implementations from `Attributes`. This implementation was not used, and whether the implementation is useful at all is questionable. I care about removing it, because I'm working #131229. While simplifying the representation of attributes, I intend to remove attr ids from attributes where possible. They're actually rarely useful. This piece of code uses them, but for no real reason, so I think simply removing the implementation makes most sense. Let me know if there are major objections to this.
2024-12-06Rollup merge of #133954 - oli-obk:push-lxrmszqzszzu, r=jieyouxuMatthias Krüger-82/+12
Hide errors whose suggestions would contain error constants or types best reviewed commit-by-commit. This is work towards cleaning up everything around `lit_to_const` and its mir equivalent. fixes #123809
2024-12-06Rollup merge of #133934 - jswrenn:unsafe-fields-auto-traits, r=compiler-errorsMatthias Krüger-0/+95
Do not implement unsafe auto traits for types with unsafe fields If a type has unsafe fields, its safety invariants are not simply the conjunction of its field types' safety invariants. Consequently, it's invalid to reason about the safety properties of these types in a purely structural manner — i.e., the manner in which `auto` traits are implemented. Consequently, auto implementations of unsafe auto traits should not be generated for types with unsafe fields. Tracking: #132922 r? `@compiler-errors`
2024-12-06Rollup merge of #133875 - onur-ozkan:early-return-rustfmt, r=jieyouxuMatthias Krüger-11/+26
handle `--json-output` properly Because `rustfmt` doesn't support JSON output, `x test --json-output` doesn't respect the `--json-output` flag during formatting step. This change makes that `x test` skips the formatting step if `--json-output` is specified. In addition, resolves #133855 with the 2nd commit.
2024-12-06Rollup merge of #132187 - shahn:extend_more_tuples, r=dtolnayMatthias Krüger-110/+142
Add Extend impls for tuples of arity 1 through 12
2024-12-06Rollup merge of #130254 - GrigorenkoPV:QuotaExceeded, r=dtolnayMatthias Krüger-14/+14
Stabilize `std::io::ErrorKind::QuotaExceeded` Also drop "Filesystem" from its name. See #130190 for more info. FCP in #130190 cc #86442 r? `@dtolnay`
2024-12-06Rollup merge of #130209 - GrigorenkoPV:CrossesDevices, r=dtolnayMatthias Krüger-1/+1
Stabilize `std::io::ErrorKind::CrossesDevices` FCP in #130191 cc #86442 See #130191 for more info and a recap of what has happened up until now. TLDR: This had been FCP'd in December 2022 with some other `ErrorKind`s, but the stabilization got postponed due to some concerns voiced about several of the variants. However, the only concern ever voiced for this variant in particular was a wish to rename this to `NotSameDevice` analogous to Windows's `ERROR_NOT_SAME_DEVICE` (as opposed to Unix's `EXDEV`). This suggestion did not receive any support. So let's try to FCP this as is. r? libs-api
2024-12-06Auto merge of #133089 - eholk:stabilize-noop-waker, r=dtolnaybors-132/+104
Stabilize noop_waker Tracking Issue: #98286 This is a handy feature that's been used widely in tests and example async code and it'd be nice to make it available to users. cc `@rust-lang/wg-async`
2024-12-06Auto merge of #133956 - bjorn3:sync_cg_clif-2024-12-06, r=bjorn3bors-428/+398
Sync cg clif 2024 12 06 The main highlights this time are a Cranelift update disabling the clif ir verifier by default for better performance. r? `@ghost` `@rustbot` label +A-codegen +A-cranelift +T-compiler
2024-12-06remove eq for attributesJonathan Dönszelmann-13/+0
2024-12-06Cargo decided to add serde to cg_clif's lockfile despite serde support in ↵bjorn3-0/+2
Cranelift being disabled
2024-12-06Merge commit '57845a397ec15e4e6a561ed2c4bfa3dcf49144fb' into ↵bjorn3-428/+396
sync_cg_clif-2024-12-06
2024-12-06Rustup to rustc 1.85.0-nightly (c94848c04 2024-12-05)bjorn3-1/+1
2024-12-06Hide errors whose suggestions would contain error constants or typesOli Scherer-6/+3
2024-12-06Silence follow-up errors from `lit_to_const`Oli Scherer-78/+11
2024-12-06Auto merge of #133950 - matthiaskrgr:rollup-b7g5p73, r=matthiaskrgrbors-113/+821
Rollup of 5 pull requests Successful merges: - #130777 (rust_for_linux: -Zreg-struct-return commandline flag for X86 (#116973)) - #133211 (Extend Miri to correctly pass mutable pointers through FFI) - #133790 (Improve documentation for Vec::extend_from_within) - #133930 (rustbook: update to use new mdbook-trpl package from The Book) - #133931 (Only allow PassMode::Direct for aggregates on wasm when using the C ABI) r? `@ghost` `@rustbot` modify labels: rollup
2024-12-06Rollup merge of #133931 - bjorn3:even_stricter_fn_abi_sanity_checking, ↵Matthias Krüger-10/+20
r=nnethercote Only allow PassMode::Direct for aggregates on wasm when using the C ABI For the Rust ABI we don't have any ABI compat reasons to allow PassMode::Direct for aggregates.
2024-12-06Rollup merge of #133930 - chriskrycho:mdbook-trpl-package, r=ehussMatthias Krüger-29/+32
rustbook: update to use new mdbook-trpl package from The Book Updates to the latest merge from `rust-lang/book` and simplifies the dependency chain there. There are now three preprocessors, but only one package, so everything is a lot nicer to deal with from the consuming POV (i.e. here).
2024-12-06Rollup merge of #133790 - HypheX:improve-vec-docs, r=harudagondi,workingjubileeMatthias Krüger-11/+14
Improve documentation for Vec::extend_from_within This closes #104762. It rephrases some of the explanations, and greatly improves the clarity of the example. Based on this PR and its discussions: https://github.com/rust-lang/rust/pull/105030/files#r1059808792
2024-12-06Rollup merge of #133211 - Strophox:miri-correct-state-update-ffi, r=RalfJungMatthias Krüger-59/+476
Extend Miri to correctly pass mutable pointers through FFI Based off of https://github.com/rust-lang/rust/pull/129684, this PR further extends Miri to execute native calls that make use of pointers to *mutable* memory. We adapt Miri's bookkeeping of internal state upon any FFI call that gives external code permission to mutate memory. Native code may now possibly write and therefore initialize and change the pointer provenance of bytes it has access to: Such memory is assumed to be *initialized* afterwards and bytes are given *arbitrary (wildcard) provenance*. This enables programs that correctly use mutating FFI calls to run Miri without errors, at the cost of possibly missing Undefined Behaviour caused by incorrect usage of mutating FFI. > <details> > > <summary> Simple example </summary> > > ```rust > extern "C" { > fn init_int(ptr: *mut i32); > } > > fn main() { > let mut x = std::mem::MaybeUninit::<i32>::uninit(); > let x = unsafe { > init_int(x.as_mut_ptr()); > x.assume_init() > }; > > println!("C initialized my memory to: {x}"); > } > ``` > ```c > void init_int(int *ptr) { > *ptr = 42; > } > ``` > should now show `C initialized my memory to: 42`. > > </details> r? ``@RalfJung``
2024-12-06Rollup merge of #130777 - azhogin:azhogin/reg-struct-return, r=workingjubileeMatthias Krüger-4/+279
rust_for_linux: -Zreg-struct-return commandline flag for X86 (#116973) Command line flag `-Zreg-struct-return` for X86 (32-bit) for rust-for-linux. This flag enables the same behavior as the `abi_return_struct_as_int` target spec key. - Tracking issue: https://github.com/rust-lang/rust/issues/116973
2024-12-06Only allow PassMode::Direct for aggregates on wasm when using the C ABIbjorn3-10/+20
For the Rust ABI we don't have any ABI compat reasons to allow PassMode::Direct for aggregates.
2024-12-06handle `json_output` in `test::run_cargo_test`onur-ozkan-0/+5
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-12-06skip formatting when `--json-output` is usedonur-ozkan-11/+21
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-12-06Auto merge of #133559 - ↵bors-50/+62
compiler-errors:structurally-resolve-adjust-for-branch, r=lcnr Structurally resolve in `adjust_for_branches` r? lcnr
2024-12-05do not implement unsafe auto traits for types with unsafe fieldsJack Wrenn-0/+95
If a type has unsafe fields, its safety invariants are not simply the conjunction of its field types' safety invariants. Consequently, it's invalid to reason about the safety properties of these types in a purely structural manner — i.e., the manner in which `auto` traits are implemented. Makes progress towards #132922.
2024-12-05Auto merge of #133940 - GuillaumeGomez:rollup-nm1cz5j, r=GuillaumeGomezbors-1158/+2774
Rollup of 8 pull requests Successful merges: - #132155 (Always display first line of impl blocks even when collapsed) - #133256 (CI: use free runners for i686-gnu jobs) - #133607 (implement checks for tail calls) - #133821 (Replace black with ruff in `tidy`) - #133827 (CI: rfl: move job forward to Linux v6.13-rc1) - #133910 (Normalize target-cpus.rs stdout test for LLVM changes) - #133921 (Adapt codegen tests for NUW inference) - #133936 (Avoid fetching the anon const hir node that is already available) r? `@ghost` `@rustbot` modify labels: rollup
2024-12-05Rollup merge of #133936 - oli-obk:push-qmvqsmwqrtqr, r=lqdGuillaume Gomez-16/+10
Avoid fetching the anon const hir node that is already available
2024-12-05Rollup merge of #133921 - TimNN:nuw-infer, r=nikicGuillaume Gomez-15/+15
Adapt codegen tests for NUW inference These were broken by https://github.com/llvm/llvm-project/commit/462cb3cd6cecd0511ecaf0e3ebcaba455ece587d Let me know if you think we should have a FIXME / tracking issue to update the tests after the LLVM 20 upgrade to make these required. `@rustbot` label: +llvm-main r? `@nikic`
2024-12-05Rollup merge of #133910 - TimNN:llvm-target-cpus, r=jieyouxuGuillaume Gomez-0/+6
Normalize target-cpus.rs stdout test for LLVM changes LLVM has recently added support for the `lime1` CPU in https://github.com/llvm/llvm-project/commit/35cce408eef1a253df12c0023c993d78b180b1f3, so the `target-cpus.rs` test currently produces different output depending on the LLVM version. This CL adds a normalization directive, to remove the new CPU from the output list. Alternatives fixes I can think of: * Add two revisions of the test (one per LLVM version) * Ignore the test on one of the LLVM versions * I dislike this, because it's possible that the test won't get updated for the next LLVM version. I don't think the exact list of target CPUs is relevant for this test, so it shouldn't be too bad if the normalization sticks around longer than necessary. `@rustbot` label: +llvm-main
2024-12-05Rollup merge of #133827 - ojeda:ci-rfl, r=lqdGuillaume Gomez-2/+2
CI: rfl: move job forward to Linux v6.13-rc1 Linux v6.13-rc1 contains commit 28e848386b92 ("rust: block: fix formatting of `kernel::block::mq::request` module"), which in turn contains commit c95bbb59a9b2 ("rust: enable arbitrary_self_types and remove `Receiver`"), which is why we had a hash rather than a tag. r? ```@Kobzol``` ```@lqd``` try-job: x86_64-rust-for-linux ```@rustbot``` label A-rust-for-linux ```@bors``` try
2024-12-05Rollup merge of #133821 - Kobzol:replace-black-with-ruff, r=onur-ozkanGuillaume Gomez-1029/+1563
Replace black with ruff in `tidy` `ruff` can both lint and format Python code (in fact, it should be a mostly drop-in replacement for `black` in terms of formatting), so it's not needed to use `black` anymore. This PR removes `black` and replaces it with `ruff`, to get rid of one Python dependency, and also to make Python formatting faster (although that's a small thing). If we decide to merge this, we'll need to "reformat the world" - `ruff` is not perfectly compatible with `black`, and it also looks like `black` was actually ignoring some files before. I tried it locally (`./x test tidy --extra-checks=py:fmt --bless`) and it also reformatted some code in subtrees (e.g. `clippy` or `rustc_codegen_gcc`) - I'm not sure how to handle that.
2024-12-05Rollup merge of #133607 - WaffleLapkin:tail-call-checks, r=compiler-errorsGuillaume Gomez-12/+859
implement checks for tail calls Quoting the [RFC draft](https://github.com/phi-go/rfcs/blob/guaranteed-tco/text/0000-explicit-tail-calls.md): > The argument to become is a function (or method) call, that exactly matches the function signature and calling convention of the callee. The intent is to ensure a matching ABI. Note that lifetimes may differ as long as they pass borrow checking, see [below](https://github.com/phi-go/rfcs/blob/guaranteed-tco/text/0000-explicit-tail-calls.md#return-type-coercion) for specifics on the return type. > Tail calling closures and tail calling from closures is not allowed. This is due to the high implementation effort, see below, this restriction can be lifted by a future RFC. > Invocations of operators were considered as valid targets but were rejected on grounds of being too error-prone. In any case, these can still be called as methods. > Tail calling [variadic functions](https://doc.rust-lang.org/beta/unstable-book/language-features/c-variadic.html) and tail calling from variadic functions is not allowed. As support for variadic function is stabilized on a per target level, support for tail-calls regarding variadic functions would need to follow a similar approach. To avoid this complexity and to minimize implementation effort for backends, this interaction is currently not allowed but support can be added with a future RFC. ----- The checks are implemented as a query, similarly to `check_unsafety`. The code is cherry-picked straight out of #112657 which was written more than a year ago, so I expect we might need to change some things ^^"
2024-12-05Rollup merge of #133256 - MarcoIeni:use-linux-free-runners, r=KobzolGuillaume Gomez-26/+77
CI: use free runners for i686-gnu jobs try-job: i686-gnu-1 try-job: i686-gnu-2 try-job: i686-gnu-nopt-1 try-job: i686-gnu-nopt-2
2024-12-05Rollup merge of #132155 - GuillaumeGomez:impl-block-doc, r=rustdocGuillaume Gomez-58/+242
Always display first line of impl blocks even when collapsed Fixes https://github.com/rust-lang/rust/issues/130612. It the line is too long, only the beginning will be visible: ![Screenshot from 2024-10-25 17-21-41](https://github.com/user-attachments/assets/dd2d912c-ad55-4410-8195-1d66a0a99ad4) Otherwise, it looks like this: ![image](https://github.com/user-attachments/assets/1f40b9e0-2143-4b9d-a4b0-338a0cd740df) Can be tested [here](https://rustdoc.crud.net/imperio/impl-block-doc/foo/struct.ImplDoc.html). r? `@notriddle`
2024-12-05Stabilize noop_wakerEric Holk-132/+104
Co-authored-by: zachs18 <8355914+zachs18@users.noreply.github.com>
2024-12-05Update GUI test after rebaseGuillaume Gomez-7/+3
2024-12-05Improve positioning of "..." in collapsed impl blockGuillaume Gomez-5/+41
2024-12-05Use text ellipsis instead of bottom blurringGuillaume Gomez-11/+16
2024-12-05Turn `markdown_split_summary_and_content` into a method of `Markdown`Guillaume Gomez-49/+52
2024-12-05Update GUI testsGuillaume Gomez-2/+2