about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2024-07-29Use `fold` instead of `flat_map`Esteban Küber-10/+8
2024-07-29Change output normalization logic to be linear against size of outputEsteban Küber-46/+54
Scan strings to be normalized for printing in a linear scan and collect the resulting `String` only once. Use a binary search when looking for chars to be replaced, instead of a `HashMap::get`.
2024-07-29Auto merge of #128265 - DianQK:instsimplify-before-inline, r=saethlinbors-182/+226
Perform instsimplify before inline to eliminate some trivial calls I am currently working on #128081. In the current pipeline, we can get the following clone statements ([godbolt](https://rust.godbolt.org/z/931316fhP)): ``` bb0: { StorageLive(_2); _2 = ((*_1).0: i32); StorageLive(_3); _3 = ((*_1).1: u64); _0 = Foo { a: move _2, b: move _3 }; StorageDead(_3); StorageDead(_2); return; } ``` Analyzing such statements will be simple and fast. We don't need to consider branches or some interfering statements. However, this requires us to run `InstSimplify`, `ReferencePropagation`, and `SimplifyCFG` at least once. I can introduce a new pass, but I think the best place for it would be within `InstSimplify`. I put `InstSimplify` before `Inline`, which takes some of the burden away from `Inline`. r? `@saethlin`
2024-07-29Perform instsimplify before inline to eliminate some trivial callsDianQK-182/+226
2024-07-29Auto merge of #128334 - matthiaskrgr:rollup-nhxdt0c, r=matthiaskrgrbors-552/+1240
Rollup of 6 pull requests Successful merges: - #128182 (handle no_std targets on std builds) - #128277 (miri: fix offset_from behavior on wildcard pointers) - #128304 (Isolate the diagnostic code that expects `thir::Pat` to be printable) - #128307 (Clean and enable `rustdoc::unescaped_backticks` for `core/alloc/std/test/proc_macro`) - #128322 (CI: move RFL job forward to v6.11-rc1) - #128333 (Miri subtree update) r? `@ghost` `@rustbot` modify labels: rollup
2024-07-29Rollup merge of #128333 - RalfJung:miri-sync, r=RalfJungMatthias Krüger-204/+807
Miri subtree update r? `@ghost`
2024-07-29Rollup merge of #128322 - ojeda:rfl-ci-update, r=KobzolMatthias Krüger-1/+1
CI: move RFL job forward to v6.11-rc1 The tag has been released today, and since the original hash we had in the Rust CI (which was ~v6.10-rc1), we have accumulated a fair amount of changes and new code. In particular, v6.11-rc1 is the first Linux tag where the kernel is supporting an actual minimum Rust version (1.78.0), rather than a single version. --- Let's try to do the move independently first. r? ``@Kobzol`` try-job: x86_64-rust-for-linux
2024-07-29Rollup merge of #128307 - ojeda:unescaped_backticks, r=GuillaumeGomezMatthias Krüger-4/+9
Clean and enable `rustdoc::unescaped_backticks` for `core/alloc/std/test/proc_macro` I am not sure if the lint is supposed to be "ready enough" (since it is `allow` by default), but it does catch a couple issues in `core` (`alloc`, `std`, `test` and `proc_macro` are already clean), so I propose making it `warn` in all the crates rendered in the website. Cc: `@GuillaumeGomez`
2024-07-29Rollup merge of #128304 - Zalathar:thir-pat-display, r=NadrierilMatthias Krüger-70/+91
Isolate the diagnostic code that expects `thir::Pat` to be printable Currently, `thir::Pat` implements `fmt::Display` (and `IntoDiagArg`) directly, for use by a few diagnostics. That makes it tricky to experiment with alternate representations for THIR patterns, because the patterns currently need to be printable on their own. That immediately rules out possibilities like storing subpatterns as a `PatId` index into a central list (instead of the current directly-owned `Box<Pat>`). This PR therefore takes an incremental step away from that obstacle, by removing `thir::Pat` from diagnostic structs in `rustc_pattern_analysis`, and hiding the pattern-printing process behind a single public `Pat::to_string` method. Doing so makes it easier to identify and update the code that wants to print patterns, and gives a place to pass in additional context in the future if necessary. --- I'm currently not sure whether switching over to `PatId` is actually desirable or not, but I think this change makes sense on its own merits, by reducing the coupling between `thir::Pat` and the pattern-analysis error types.
2024-07-29Rollup merge of #128277 - RalfJung:offset_from_wildcard, r=oli-obkMatthias Krüger-239/+301
miri: fix offset_from behavior on wildcard pointers offset_from wouldn't behave correctly when the "end" pointer was a wildcard pointer (result of an int2ptr cast) just at the end of the allocation. Fix that by expressing the "same allocation" check in terms of two `check_ptr_access_signed` instead of something specific to offset_from, which is both more canonical and works better with wildcard pointers. The second commit just improves diagnostics: I wanted the "pointer is dangling (has no provenance)" message to say how many bytes of memory it expected to see (since if it were 0 bytes, this would actually be legal, so it's good to tell the user that it's not 0 bytes). And then I was annoying that the error looks so different for when you deref a dangling pointer vs an out-of-bounds pointer so I made them more similar. Fixes https://github.com/rust-lang/miri/issues/3767
2024-07-29Rollup merge of #128182 - onur-ozkan:fix-no-std-crates, r=Mark-SimulacrumMatthias Krüger-34/+31
handle no_std targets on std builds This PR unifies the `Step::run_make` logic and improves it by skipping std specific crates for no_std targets. In addition, since we now handle library crates properly, bootstrap is capable of running `x doc library` even for no_std targets as it is able to generate documentation for `alloc` crate from the standard library. Resolves #128027 cc ``@ChrisDenton``
2024-07-29ignore `crates` if running unit testsonur-ozkan-0/+5
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-07-29remove the requirement of `Builder` arg in `doc::Std::new` functiononur-ozkan-18/+2
`crates` field is handled in the `Step::make_run` just like in any other `Std` implementation, so we don't need to resolve them in `Std::new`. Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-07-29allow running `x doc` on std for no_std targetsonur-ozkan-8/+2
Since we now handle library crates properly, there's no need to panic for `no_std` targets anymore. `x doc library` now generates documentation for the `alloc` crate from standard library. Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-07-29handle no_std targets on std buildsonur-ozkan-8/+22
This change unifies the `Step::run_make` logic and improves it by skipping std specific crates for no_std targets. Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-07-29Auto merge of #125016 - nicholasbishop:bishop-cb-112, r=tgross35bors-9/+23
Update compiler_builtins to 0.1.114 The `weak-intrinsics` feature was removed from compiler_builtins in https://github.com/rust-lang/compiler-builtins/pull/598, so dropped the `compiler-builtins-weak-intrinsics` feature from alloc/std/sysroot. In https://github.com/rust-lang/compiler-builtins/pull/593, some builtins for f16/f128 were added. These don't work for all compiler backends, so add a `compiler-builtins-no-f16-f128` feature and disable it for cranelift and gcc.
2024-07-29Auto merge of #128330 - matthiaskrgr:rollup-auairjd, r=matthiaskrgrbors-257/+785
Rollup of 5 pull requests Successful merges: - #109174 (Replace `io::Cursor::{remaining_slice, is_empty}`) - #127290 (Fully document `rustdoc-json-types`) - #128055 (std: unsafe-wrap personality::dwarf::eh) - #128269 (improve cargo invocations on bootstrap) - #128310 (Add missing periods on `BTreeMap` cursor `peek_next` docs) Failed merges: - #127543 (More unsafe attr verification) - #128182 (handle no_std targets on std builds) r? `@ghost` `@rustbot` modify labels: rollup
2024-07-29Rollup merge of #128310 - kmicklas:btree-map-peek-next-docs, r=tgross35Matthias Krüger-3/+3
Add missing periods on `BTreeMap` cursor `peek_next` docs Tracking issue: https://github.com/rust-lang/rust/issues/107540
2024-07-29Rollup merge of #128269 - onur-ozkan:improve-cargo-invocations, ↵Matthias Krüger-117/+151
r=Mark-Simulacrum improve cargo invocations on bootstrap Fixes few of the `FIXME`s on cargo invocations and should be considered as blocker for https://github.com/rust-lang/rust/issues/128180.
2024-07-29Rollup merge of #128055 - ↵Matthias Krüger-53/+61
workingjubilee:deny-unsafe-ops-in-sys-personality-dwarf-eh, r=Amanieu std: unsafe-wrap personality::dwarf::eh Moves the forbiddance up a little. This is another largely whitespace diff, except for hoisting some variable declarations to allow enclosing the `unsafe {}` scope fully and make it clearer where the bounds of some temporaries are.
2024-07-29Rollup merge of #127290 - its-the-shrimp:document_rustdoc_json_types, ↵Matthias Krüger-52/+533
r=aDotInTheVoid Fully document `rustdoc-json-types` 100% of `rustdoc-json-types` is now documented Here's the summary from rustdoc with `-Zunstable-options --show-coverage`: ``` +-------------------------------------+------------+------------+------------+------------+ | File | Documented | Percentage | Examples | Percentage | +-------------------------------------+------------+------------+------------+------------+ | src/rustdoc-json-types/lib.rs | 314 | 100.0% | 23 | 31.9% | +-------------------------------------+------------+------------+------------+------------+ | Total | 314 | 100.0% | 23 | 31.9% | +-------------------------------------+------------+------------+------------+------------+ ```
2024-07-29Rollup merge of #109174 - soerenmeier:cursor_fns, r=dtolnayMatthias Krüger-32/+37
Replace `io::Cursor::{remaining_slice, is_empty}` This is a late follow up to the concerns raised in https://github.com/rust-lang/rust/issues/86369. https://github.com/rust-lang/rust/issues/86369#issuecomment-953096691 > This API seems focussed on the `Read` side of things. When `Seek`ing around and `Write`ing data, `is_empty` becomes confusing and `remaining_slice` is not very useful. When writing, the part of the slice before the cursor is much more interesting. Maybe we should have functions for both? Or a single function that returns both slices? (If we also have a `mut` version, a single function would be useful to allow mutable access to both sides at once.) New feature name: `cursor_remaining` > `cursor_split`. Added functions: ```rust fn split(&self) -> (&[u8], &[u8]); // fn before(&self) -> &[u8]; // fn after(&self) -> &[u8]; fn split_mut(&mut self) -> (&mut [u8], &mut [u8]); // fn before_mut(&mut self) -> &mut [u8]; // fn after_mut(&mut self) -> &mut [u8]; ``` A question was raised in https://github.com/rust-lang/rust/issues/86369#issuecomment-927124211 about whether to return a lifetime that would reflect the lifetime of the underlying bytes (`impl Cursor<&'a [u8]> { fn after(&self) -> &'a [u8] }`). The downside of doing this would be that it would not be possible to implement these functions generically over `T: AsRef<[u8]>`. ## Update Based on the review, before* and after* methods where removed.
2024-07-29Make `thir::Pat` not implement `fmt::Display` directlyZalathar-19/+46
This gives a clearer view of the (diagnostic) code that expects to be able to print THIR patterns, and makes it possible to experiment with requiring some kind of context (for ID lookup) when printing patterns.
2024-07-29Encapsulate the printing of `WitnessPat`Zalathar-16/+18
This hides the fact that we print `WitnessPat` by converting it to `thir::Pat` and then printing that.
2024-07-29Auto merge of #125443 - nnethercote:rustfmt-use-decls, ↵bors-8995/+8167
r=lcnr,cuviper,GuillaumeGomez rustfmt `use` declarations This PR implements https://github.com/rust-lang/compiler-team/issues/750, which changes how `use` declarations are formatted by adding these options to `rustfmt.toml`: ``` group_imports = "StdExternalCrate" imports_granularity = "Module" ``` r? `@ghost`
2024-07-28Update compiler_builtins to 0.1.114Nicholas Bishop-9/+19
The `weak-intrinsics` feature was removed from compiler_builtins in https://github.com/rust-lang/compiler-builtins/pull/598, so dropped the `compiler-builtins-weak-intrinsics` feature from alloc/std/sysroot. In https://github.com/rust-lang/compiler-builtins/pull/593, some builtins for f16/f128 were added. These don't work for all compiler backends, so add a `compiler-builtins-no-f16-f128` feature and disable it for cranelift and gcc. Also disable it for LLVM targets that don't support it.
2024-07-29fully document rustdoc-json-typesschvv31n-52/+533
2024-07-29CI: move RFL job forward to v6.11-rc1Miguel Ojeda-1/+1
The tag has been released today, and since the original hash we had in the Rust CI (which was ~v6.10-rc1), we have accumulated a fair amount of changes and new code. In particular, v6.11-rc1 is the first Linux tag where the kernel is supporting an actual minimum Rust version (1.78.0), rather than a single version. Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2024-07-29Warn on `rustdoc::unescaped_backticks` for `core/alloc/std/test/proc_macro`Miguel Ojeda-0/+5
They are all clean now, so enable the lint to keep them clean going forward. Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2024-07-29Remove spurious backticks detected by `rustdoc::unescaped_backticks`Miguel Ojeda-4/+4
There are only 3 cases across the crates rendered in the website (`core`, `alloc`, `std`, `proc_macro` and `test`), and they are all in `core`. Clean them up, so that the lint can be enabled in the next commit. Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2024-07-29Reformat `use` declarations.Nicholas Nethercote-8995/+8163
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-29Update `use` declarations formatting options.Nicholas Nethercote-0/+4
As decided in rust-lang/compiler-team#750. Use declarations are currently wildly inconsistent because rustfmt is quite unopinionated about how they should be formatted. The `rustfmt.toml` additions makes rustfmt more opinionated, which avoids the need for any decision when adding new use declarations to a file. This commit only updates `rustfmt.toml` and `compiler/rustc_codegen_cranelift/rustfmt.toml`. The next commit will do the reformatting.
2024-07-28Replace `io::Cursor::{remaining_slice, is_empty}` with `io::Cursor::{split, ↵Sören Meier-32/+37
split_mut}`
2024-07-28Auto merge of #128313 - GuillaumeGomez:rollup-kacb489, r=GuillaumeGomezbors-871/+1152
Rollup of 6 pull requests Successful merges: - #125779 ([rustdoc] Add copy code feature) - #127765 (Fix doc nits) - #127860 (deps: dedup object, wasmparser, wasm-encoder) - #128103 (add `is_multiple_of` for unsigned integer types) - #128228 (Stabilize `const_waker`) - #128240 (Add links from `assert_eq!` docs to `debug_assert_eq!`, etc.) r? `@ghost` `@rustbot` modify labels: rollup
2024-07-28Rollup merge of #128240 - mbrubeck:patch-3, r=joboetGuillaume Gomez-0/+18
Add links from `assert_eq!` docs to `debug_assert_eq!`, etc. This adds information and links from the docs for the following macros to their debug-only versions: * `assert_eq!` * `assert_ne!` * `assert_matches!` This matches the existing documentation for the `assert!` macro.
2024-07-28Rollup merge of #128228 - slanterns:const_waker, r=dtolnay,oli-obkGuillaume Gomez-19/+47
Stabilize `const_waker` Closes: https://github.com/rust-lang/rust/issues/102012. For `local_waker` and `context_ext` related things, I just ~~moved them to dedicated feature gates and reused their own tracking issue (maybe it's better to open a new one later, but at least they should not be tracked under https://github.com/rust-lang/rust/issues/102012 from the beginning IMO.)~~ reused their own feature gates as suggested by ``@tgross35.`` ``@rustbot`` label: +T-libs-api r? libs-api
2024-07-28Rollup merge of #128103 - folkertdev:unsigned-int-is-multiple-of, r=AmanieuGuillaume Gomez-0/+38
add `is_multiple_of` for unsigned integer types tracking issue: https://github.com/rust-lang/rust/issues/128101 This adds the `.is_multiple_of` method on unsigned integers. Returns `true` if `self` is an integer multiple of `rhs`, and false otherwise. This function is equivalent to `self % rhs == 0`, except that it will not panic for `rhs == 0`. Instead, `0.is_multiple_of(0) == true`, and for any non-zero `n`, `n.is_multiple_of(0) == false`.
2024-07-28Rollup merge of #127860 - klensy:dedup, r=Mark-SimulacrumGuillaume Gomez-62/+48
deps: dedup object, wasmparser, wasm-encoder * dedups one `object`, additional dupe will be removed, with next `thorin-dwp` update * `wasmparser` pinned to minor versions, so full merge isn't possible * same with `wasm-encoder` Turned off some features for `wasmparser` (see features https://github.com/bytecodealliance/wasm-tools/blob/v1.208.1/crates/wasmparser/Cargo.toml) in `run-make-support`, looks working?
2024-07-28Rollup merge of #127765 - bitfield:fix_stdlib_doc_nits, r=dtolnayGuillaume Gomez-738/+808
Fix doc nits Many tiny changes to stdlib doc comments to make them consistent (for example "Returns foo", rather than "Return foo"), adding missing periods, paragraph breaks, backticks for monospace style, and other minor nits.
2024-07-28Rollup merge of #125779 - GuillaumeGomez:copy-code, r=rustdoc-teamGuillaume Gomez-52/+193
[rustdoc] Add copy code feature This PR adds a "copy code" to code blocks. Since this is a JS only feature, the HTML is generated with JS when the user hovers the code block to prevent generating DOM unless needed. Two things to note: 1. I voluntarily kept the current behaviour of the run button (only when hovering a code block with a mouse) so it doesn't do anything on mobile. I plan to send a follow-up where the buttons would "expandable" or something. Still need to think which approach would be the best. 2. I used a picture and not text like the run button to remain consistent with the "copy path" button. I'd also prefer for the run button to use a picture (like what is used in mdbook) but again, that's something to be discussed later on. The rendering looks like this: ![Screenshot from 2024-06-03 21-29-48](https://github.com/rust-lang/rust/assets/3050060/a0b18f9c-b3dd-4a65-89a7-5a7a303b5c2b) ![Screenshot from 2024-06-03 21-30-20](https://github.com/rust-lang/rust/assets/3050060/b3b084ff-2716-4160-820b-d4774681a961) It can be tested [here](https://guillaume-gomez.fr/rustdoc/bar/struct.Bar.html) (without the run button) and [here](https://guillaume-gomez.fr/rustdoc/foo/struct.Bar.html) (with the run button). Fixes #86851. r? ``@notriddle``
2024-07-28Auto merge of #128246 - GrigorenkoPV:derive-where, r=compiler-errorsbors-203/+6
Don't manually implement `PartialEq` for some types in `rustc_type_ir` > > As a follow-up, we should look at not manually implementing PartialEq for these types but instead going thru a derive > > I will try to tackle this later in a separate PR https://github.com/rust-lang/rust/issues/127042#issuecomment-2218838446
2024-07-28stabilize const_wakerSlanterns-19/+47
2024-07-28Add missing periods on `BTreeMap` cursor `peek_next` docsKen Micklas-3/+3
2024-07-28adopt object changesklensy-15/+17
adopt wasm_encoder changes
2024-07-28dedup objectklensy-47/+31
waiting on thorin-dwp update dedup one wasmparser run-make-support: drop some features for wasmparser dedupe wasm-encoder
2024-07-28Auto merge of #128301 - matthiaskrgr:rollup-9fyf587, r=matthiaskrgrbors-183/+773
Rollup of 3 pull requests Successful merges: - #125889 (Add migration lint for 2024 prelude additions) - #128215 (Update the reference) - #128263 (rustdoc: use strategic ThinVec/Box to shrink `clean::ItemKind`) r? `@ghost` `@rustbot` modify labels: rollup
2024-07-28Don't store `thir::Pat` in error structsZalathar-40/+32
In several cases this avoids the need to clone the underlying pattern, and then print the clone later.
2024-07-28Rollup merge of #128263 - notriddle:notriddle/clean-up-again, r=GuillaumeGomezMatthias Krüger-89/+120
rustdoc: use strategic ThinVec/Box to shrink `clean::ItemKind`
2024-07-28Rollup merge of #128215 - ehuss:update-reference, r=KobzolMatthias Krüger-93/+254
Update the reference This updates the reference to use the new mdbook-spec preprocessor, which is a Cargo library inside the reference submodule. Note that this PR contains a bunch of bootstrap cleanup commits to assist with making sure the submodules are working correctly. All of the cleanup PRs should have a description in their commit. I'd be happy to move those to a separate PR if that makes review easier. The main changes for the reference are: - Move the `doc::Reference` bootstrap step out of the generic macro into a custom step. - This step needs to build rustdoc because the new mdbook-spec plugin uses rustdoc for generating links. - PATH is updated so that the rustdoc binary can be found. - rustbook now includes the mdbook-spec plugin as a dependency. - rustbook enables the mdbook-spec preprocessor. I did a bunch of testing with the various commands and setups, such as: - `submodules=true` and `submodules=false` - having all submodules deinitialized - not in a git repository However, there are probably thousands of different permutations of different commands, settings, and environments, so there is a chance I'm missing something.
2024-07-28Rollup merge of #125889 - Nilstrieb:migrate-into-the-future, r=compiler-errorsMatthias Krüger-1/+399
Add migration lint for 2024 prelude additions This adds the migration lint for the newly ambiguous methods `poll` and `into_future`. When these methods are used on types implementing the respective traits, it will be ambiguous in the future, which can lead to hard errors or behavior changes depending on the exact circumstances. tracked by #121042 <!-- If this PR is related to an unstable feature or an otherwise tracked effort, please link to the relevant tracking issue here. If you don't know of a related tracking issue or there are none, feel free to ignore this. This PR will get automatically assigned to a reviewer. In case you would like a specific user to review your work, you can assign it to them by using r​? <reviewer name> --> r? compiler-errors as the method prober