about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
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 #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-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
2024-07-28Auto merge of #127799 - Kobzol:bootstrap-cmd-refactor-7, r=onur-ozkanbors-171/+167
Bootstrap command refactoring: make command output API more bulletproof (step 7) Continuation of https://github.com/rust-lang/rust/pull/127680. This PR modifies the API of running commands to make it more explicit when a command is expected to produce programmatically handled output. Now if you call just `run`, you cannot access the stdout/stderr by accident, because it will not be returned to the caller. This API change might be seen as overkill, let me know what do you think. In any case, I'd like to land the second commit, to make it harder to accidentally read stdout/stderr of commands that did not capture output (now you'd get an empty string as a result, but you should probably get a panic instead, if you try to read uncaptured stdout/stderr). Tracking issue: https://github.com/rust-lang/rust/issues/126819 r? `@onur-ozkan` try-job: x86_64-msvc
2024-07-28Add migration lint for 2024 prelude additionsNilstrieb-1/+399
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.
2024-07-28Auto merge of #128298 - matthiaskrgr:rollup-0wdu2wo, r=matthiaskrgrbors-236/+874
Rollup of 5 pull requests Successful merges: - #127853 (`#[naked]`: report incompatible attributes) - #128276 (Add a README to rustbook to explain its purpose) - #128279 (Stabilize `is_sorted`) - #128282 (bitwise and bytewise methods on `NonZero`) - #128285 (rustc book: document how the RUST_TARGET_PATH variable is used) r? `@ghost` `@rustbot` modify labels: rollup
2024-07-28Rollup merge of #128285 - lolbinarycat:rustc-custom-targets, r=jieyouxuMatthias Krüger-0/+13
rustc book: document how the RUST_TARGET_PATH variable is used based on the module comment in rust/compiler/rustc_target/src/spec/mod.rs Fixes #128280
2024-07-28Rollup merge of #128282 - pitaj:nonzero_bitwise, r=workingjubileeMatthias Krüger-3/+430
bitwise and bytewise methods on `NonZero` Implementation for `nonzero_bitwise` Tracking issue #128281 ACP https://github.com/rust-lang/libs-team/issues/413
2024-07-28Rollup merge of #128279 - slanterns:is_sorted, r=dtolnayMatthias Krüger-106/+21
Stabilize `is_sorted` Closes: https://github.com/rust-lang/rust/issues/53485. ~~Question: does~~ https://github.com/rust-lang/rust/blob/8fe0c753f23e7050b87a444b6622caf4d2272d5d/compiler/rustc_lint_defs/src/builtin.rs#L1986-L1994 ~~need a new example?~~ edit: It causes a test failure and needs to be changed anyway. ``@rustbot`` label: +T-libs-api r? libs-api
2024-07-28Rollup merge of #128276 - ehuss:rustbook-readme, r=KobzolMatthias Krüger-0/+34
Add a README to rustbook to explain its purpose This adds a README to the rustbook tool to help explain what it is for and how to use it.
2024-07-28Rollup merge of #127853 - folkertdev:naked-function-error-messages, r=bjorn3Matthias Krüger-127/+376
`#[naked]`: report incompatible attributes tracking issue: https://github.com/rust-lang/rust/issues/90957 this is a re-implementation of https://github.com/rust-lang/rust/pull/93809 by ``@bstrie`` which was closed 2 years ago due to inactivity. This PR takes some of the final comments into account, specifically providing a little more context in error messages, and using an allow list to determine which attributes are compatible with `#[naked]`. Notable attributes that are incompatible with `#[naked]` are: * `#[inline]` * `#[track_caller]` * ~~`#[target_feature]`~~ (this is now allowed, see PR discussion) * `#[test]`, `#[ignore]`, `#[should_panic]` These attributes just directly conflict with what `#[naked]` should do. Naked functions are still important for systems programming, embedded, and operating systems, so I'd like to move them forward.
2024-07-28Auto merge of #128293 - aDotInTheVoid:github-pls-fix-🏳️‍⚧️, ↵bors-1/+1
r=Noratrieb trans her gender CC https://github.com/rust-lang/team/pull/1511 r? `@Noratrieb`
2024-07-28Auto merge of #128079 - Oneirical:testiges-of-civilization, r=jieyouxubors-73/+94
Migrate `static-dylib-by-default`, `sanitizer-dylib-link`, `sanitizer-cdylib-link` and `sanitizer-staticlib-link` `run-make` tests to rmake Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html). Please try: try-job: x86_64-msvc try-job: armhf-gnu try-job: test-various try-job: i686-msvc try-job: x86_64-mingw try-job: x86_64-gnu-llvm-18
2024-07-27rustc book: document how the RUST_TARGET_PATH variable is usedbinarycat-0/+13
based on the module comment in rust/compiler/rustc_target/src/spec/mod.rs Fixes #128280
2024-07-27trans her genderAlona Enraght-Moony-1/+1
CC https://github.com/rust-lang/team/pull/1511
2024-07-27Auto merge of #128270 - weihanglo:update-cargo, r=weihanglobors-0/+0
Update cargo 14 commits in 5f6b9a92201d78af75dc24f14662c3e2dacbbbe1..b5d44db1daf0469b227a6211b987162a39a54730 2024-07-19 18:09:17 +0000 to 2024-07-26 21:27:12 +0000 - Package workspaces (rust-lang/cargo#13947) - test: migrate messages to snapbox (rust-lang/cargo#14242) - chore: Update dependencies (rust-lang/cargo#14299) - fix: remove rustc probe for `--check-cfg` support (rust-lang/cargo#14302) - Misc test clean up (rust-lang/cargo#14297) - Don't downgrade on prerelease `VersionReq` when update with --breaking. (rust-lang/cargo#14250) - test: Migrate some json tests to snapbox (rust-lang/cargo#14293) - Revert "fix: Ensure dep/feature activates the dependency on 2024" (rust-lang/cargo#14295) - chore: bump cargo-test-support to 0.4.0 (rust-lang/cargo#14286) - Bump to 0.83.0; update changelog (rust-lang/cargo#14285) - Improved error message when `update --breaking` invalid spec. (rust-lang/cargo#14279) - docs(test): Expand documentation of cargo-test-support (rust-lang/cargo#14272) - test: Fix some test based on rustc version (rust-lang/cargo#14282) - Use `Rc` instead of `Arc` for storing rustflags (rust-lang/cargo#14273) r? ghost
2024-07-28stabilize `is_sorted`Slanterns-106/+21
2024-07-27bitwise and bytewise methods on `NonZero`Peter Jaszkowiak-3/+430
2024-07-27Auto merge of #128278 - tgross35:rollup-zv7q0h5, r=tgross35bors-587/+501
Rollup of 8 pull requests Successful merges: - #125897 (from_ref, from_mut: clarify documentation) - #128207 (improve error message when `global_asm!` uses `asm!` options) - #128241 (Remove logic to suggest clone of function output) - #128259 ([illumos/solaris] set MSG_NOSIGNAL while writing to sockets) - #128262 (Delete `SimplifyArmIdentity` and `SimplifyBranchSame` tests) - #128266 (update `rust.channel` default value documentation) - #128267 (Add rustdoc GUI test to check title with and without search) - #128271 (Disable jump threading of float equality) r? `@ghost` `@rustbot` modify labels: rollup
2024-07-27Rollup merge of #128271 - ↵Trevor Gross-0/+137
Nilstrieb:jump-into-a-can-of-worms-called-float-equality, r=compiler-errors Disable jump threading of float equality Jump threading stores values as `u128` (`ScalarInt`) and does its comparisons for equality as integer comparisons. This works great for integers. Sadly, not everything is an integer. Floats famously have wonky equality semantcs, with `NaN!=NaN` and `0.0 == -0.0`. This does not match our beautiful integer bitpattern equality and therefore causes things to go horribly wrong. While jump threading could be extended to support floats by remembering that they're floats in the value state and handling them properly, it's signficantly easier to just disable it for now. fixes #128243
2024-07-27Rollup merge of #128267 - GuillaumeGomez:gui-test-title, r=notriddleTrevor Gross-0/+24
Add rustdoc GUI test to check title with and without search Follow-up of https://github.com/rust-lang/rust/pull/128210. r? `@notriddle`
2024-07-27Rollup merge of #128266 - onur-ozkan:update-channel-doc, r=dtolnayTrevor Gross-1/+9
update `rust.channel` default value documentation self-explanatory Resolves #128258 r? dtolnay
2024-07-27Rollup merge of #128262 - DianQK:remove-unused-tests, r=saethlinTrevor Gross-436/+0
Delete `SimplifyArmIdentity` and `SimplifyBranchSame` tests These two passes have already been deleted in #107256. I'm not sure why tidy didn't catch it. As regression tests, I didn't delete `tests/ui/mir/issue-66851.rs` and `tests/ui/mir/simplify-branch-same.rs`. r? compiler
2024-07-27Rollup merge of #128259 - sunshowers:msg-nosignal, r=Mark-SimulacrumTrevor Gross-0/+5
[illumos/solaris] set MSG_NOSIGNAL while writing to sockets Both these platforms have MSG_NOSIGNAL available, and we should set it for socket writes in the event that the SIGPIPE handler has been reset to SIG_DFL (i.e. terminate the process). I've verified via a quick program at https://github.com/sunshowers/msg-nosignal-test/ that even when the SIGPIPE handler is reset to SIG_DFL, writes to closed TCP sockets now error out with EPIPE. (Under ordinary circumstances UDP writes won't cause MSG_NOSIGNAL.) However, I couldn't find any existing tests which verified the MSG_NOSIGNAL behavior.
2024-07-27Rollup merge of #128241 - compiler-errors:clone-sugg, r=jieyouxuTrevor Gross-37/+14
Remove logic to suggest clone of function output I can't exactly tell, but I believe that this suggestion is operating off of a heuristic that the lifetime of a function's input is correlated with the lifetime of a function's output in such a way that cloning would fix an error. I don't think that actually manages to hit the bar of "actually provides useful suggestions" most of the time. Specifically, I've hit false-positives due to this suggestion *twice* when fixing ICEs in the compiler, so I don't think it's worthwhile having this logic around. Neither of the two affected UI tests are actually fixed by the suggestion.
2024-07-27Rollup merge of #128207 - folkertdev:asm-parser-generalize, r=AmanieuTrevor Gross-105/+224
improve error message when `global_asm!` uses `asm!` options specifically, what was error: expected one of `)`, `att_syntax`, or `raw`, found `preserves_flags` --> $DIR/bad-options.rs:45:25 | LL | global_asm!("", options(preserves_flags)); | ^^^^^^^^^^^^^^^ expected one of `)`, `att_syntax`, or `raw` is now error: the `preserves_flags` option cannot be used with `global_asm!` --> $DIR/bad-options.rs:45:25 | LL | global_asm!("", options(preserves_flags)); | ^^^^^^^^^^^^^^^ the `preserves_flags` option is not meaningful for global-scoped inline assembly mirroring the phrasing of the [reference](https://doc.rust-lang.org/reference/inline-assembly.html#options). This is also a bit of a refactor for a future `naked_asm!` macro (for use in `#[naked]` functions). Currently this sort of error can come up when switching from inline to global asm, or when a user just isn't that experienced with assembly. With `naked_asm!` added to the mix hitting this error is more likely.
2024-07-27Rollup merge of #125897 - RalfJung:from-ref, r=AmanieuTrevor Gross-8/+88
from_ref, from_mut: clarify documentation This was brought up [here](https://github.com/rust-lang/rust/issues/56604#issuecomment-2143193486). The domain of quantification is generally always constrained by the type in the type signature, and I am not sure it's always worth spelling that out explicitly as that makes things exceedingly verbose. But since this was explicitly brought up, let's clarify.
2024-07-27add `needs-asm-support` to `tests/ui/asm/unsupported-option.rs`Folkert-3/+5
2024-07-27fix `tests/ui/asm/naked-functions.rs` for aarch64Folkert-6/+7
2024-07-27update aarch64 asm testsFolkert-47/+61
2024-07-27Auto merge of #128091 - heiher:xz-only, r=Mark-Simulacrumbors-1/+1
build-manifest: Allow building manifests for formats that only have xz compression
2024-07-27Add a README to rustbook to explain its purposeEric Huss-0/+34
2024-07-27Rename require_and_update_submodule to require_submoduleEric Huss-25/+25
Just trying to be a little less verbose here.
2024-07-27Add clarifying documentation to require_and_update_submodule.Eric Huss-1/+4
2024-07-27Change prebuilt_llvm_config to not be required.Eric Huss-1/+2
I misread this one. It is only checking if LLVM needs to be rebuilt. There is code below that handles the case where it is unable to compute the stamp if the source is missing.
2024-07-27Change the blanket submodule update for library submodules to be requiredEric Huss-1/+7
These are required 100% of the time, but they are almost always required for any command that runs Cargo in the main workspace. Ideally, initializing these two standard library submodules would be lazy and only initialized when required (see https://github.com/rust-lang/rust/pull/82653). However, it would require updating these in almost every Step (anything that runs `cargo` in the main workspace).
2024-07-27Consistently use a string to represent a submodule.Eric Huss-11/+11
This makes it easier to call these functions without needing to form a Path.
2024-07-27Add more descriptions to why submodules are required.Eric Huss-5/+13
2024-07-27Fix mistake setting ONLY_HOSTS for Reference.Eric Huss-1/+0
This was a copy/paste mistake.
2024-07-27Disable jump threading of float equalityNilstrieb-0/+137
Jump threading stores values as `u128` (`ScalarInt`) and does its comparisons for equality as integer comparisons. This works great for integers. Sadly, not everything is an integer. Floats famously have wonky equality semantcs, with `NaN!=NaN` and `0.0 == -0.0`. This does not match our beautiful integer bitpattern equality and therefore causes things to go horribly wrong. While jump threading could be extended to support floats by remembering that they're floats in the value state and handling them properly, it's signficantly easier to just disable it for now.
2024-07-27Update cargoWeihang Lo-0/+0
2024-07-27Auto merge of #128006 - tgross35:missing-fragment-specifier-e2024, ↵bors-25/+114
r=petrochenkov Make `missing_fragment_specifier` an error in edition 2024 `missing_fragment_specifier` has been a future compatibility warning since 2017. Uplifting it to an unconditional hard error was attempted in 2020, but eventually reverted due to fallout. Make it an error only in edition >= 2024, leaving the lint for older editions. This change will make it easier to support more macro syntax that relies on usage of `$`. Fixes <https://github.com/rust-lang/rust/issues/40107> --- It is rather late for the edition but since this change is relatively small, it seems worth at least bringing up. This follows a brief [Zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/268952-edition/topic/.60.20DBD.20-.3E.20hard.20error) (cc `@tmandry).` Making this an edition-dependent lint has come up before but there was not a strong motivation. I am proposing it at this time because this would simplify the [named macro capture groups](https://github.com/rust-lang/rfcs/pull/3649) RFC, which has had mildly positive response, and makes use of new `$` syntax in the matcher. The proposed syntax currently parses as metavariables without a fragment specifier; this warning is raised, but there are no errors. It is obviously not known that this specific RFC will eventually be accepted, but forbidding `missing_fragment_specifier` should make it easier to support any new syntax in the future that makes use of `$` in different ways. The syntax conflict is also not impossible to overcome, but making it clear that unnamed metavariables are rejected makes things more straightforward and should allow for better diagnostics. `@Mark-Simulacrum` suggested making this forbid-by-default instead of an error at https://github.com/rust-lang/rust/issues/40107#issuecomment-761727885, but I don't think this would allow the same level of syntax flexibility. It is also possible to reconsider making this an unconditional error since four years have elapsed since the previous attempt, but this seems likely to hit the same pitfalls. (Possibly worth a crater run?) Tracking: - https://github.com/rust-lang/rust/issues/128143
2024-07-27allow `#[target_feature]` on `#[naked]` functionsFolkert-27/+7
2024-07-27switch to an allowlist approachFolkert-65/+185
- merge error codes - use attribute name that is incompatible in error message - add test for conditional incompatible attribute - add `linkage` to the allowlist
2024-07-27Add rustdoc GUI test to check title with and without searchGuillaume Gomez-0/+24
2024-07-27Auto merge of #124905 - reitermarkus:u32-from-char-opt, r=scottmcmbors-57/+114
Allow optimizing `u32::from::<char>`. Extracted from https://github.com/rust-lang/rust/pull/124307. This allows optimizing the panicking branch in the `escape_unicode` function, see https://rust.godbolt.org/z/61YhKrhvP.
2024-07-27Make `missing_fragment_specifier` an error in edition 2024Trevor Gross-25/+114
`missing_fragment_specifier` has been a future compatibility warning since 2017. Uplifting it to an unconditional hard error was attempted in 2020, but eventually reverted due to fallout. Make it an error only in edition >= 2024, leaving the lint for older editions. This change will make it easier to support more macro syntax that relies on usage of `$`. Fixes <https://github.com/rust-lang/rust/issues/40107>
2024-07-27add change entry for `rust.channel` defaultsonur-ozkan-0/+5
Signed-off-by: onur-ozkan <work@onurozkan.dev>