about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2023-08-28Update windows ffi bindingsChris Denton-127/+104
2023-08-28Auto merge of #115050 - khei4:khei4/codegen-move-before-nocapture, r=nikicbors-0/+22
add codegen test for the move before passing to nocapture, by shared-ref arg This PR adds codegen test for https://github.com/rust-lang/rust/issues/107436#issuecomment-1685792517 (It seems like this works from llvm-16?) Fixes #107436
2023-08-28Auto merge of #114774 - Enselic:less-move-size-noise, r=oli-obkbors-56/+50
Avoid duplicate `large_assignments` lints By checking for overlapping spans. This PR does the "reduce noisiness" task in #83518. r? `@oli-obk` who added E-mentor and E-help-wanted and wrote the initial code. (The fix itself is in https://github.com/rust-lang/rust/pull/114774/commits/dc82736677a134a1b52def496db111681c053e82. The two commits before that are just small refactorings.)
2023-08-28Auto merge of #114848 - michaelvanstraten:spawn_with_attributes, r=ChrisDentonbors-2/+306
Add ability to spawn Windows process with Proc Thread Attributes | Take 2 This is the second attempt to merge pull request #88193 into the standard library. This PR implements the ability to add arbitrary attributes to a command on Windows targets using a new `raw_attribute` method on the [`CommandExt`](https://doc.rust-lang.org/stable/std/os/windows/process/trait.CommandExt.html) trait. `@TyPR124` and my main motivation behind adding this feature is to enable the support of pseudo terminals in the std library, but there are many more applications. A good starting point to get into this topic is to head over to the [`Win32 API documentation`](https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-updateprocthreadattribute).
2023-08-28Auto merge of #103836 - H4x5:extra-float-constants, r=thomccbors-0/+40
Add additional float constants Initial implementation of this ACP: https://github.com/rust-lang/libs-team/issues/119. [Accepted] Tracking issue: #103883 The values for the constants are copied from the [`libstdc++` source code](https://github.com/gcc-mirror/gcc/blob/16e2427f50c208dfe07d07f18009969502c25dc8/libstdc%2B%2B-v3/include/std/numbers#L57-L120).
2023-08-28Auto merge of #115303 - matthiaskrgr:rollup-iohs8a5, r=matthiaskrgrbors-39/+134
Rollup of 6 pull requests Successful merges: - #109660 (Document that SystemTime does not count leap seconds) - #114238 (Fix implementation of `Duration::checked_div`) - #114512 (std/tests: disable ancillary tests on freebsd since the feature itsel…) - #114919 (style-guide: Add guidance for defining formatting for specific macros) - #115278 (tell people what to do when removing an error code) - #115280 (avoid triple-backtrace due to panic-during-cleanup) r? `@ghost` `@rustbot` modify labels: rollup
2023-08-28Rollup merge of #115280 - RalfJung:panic-cleanup-triple-backtrace, r=AmanieuMatthias Krüger-31/+90
avoid triple-backtrace due to panic-during-cleanup Supersedes https://github.com/rust-lang/rust/pull/115020 Cc https://github.com/rust-lang/rust/issues/114954 r? ``@Amanieu``
2023-08-28Rollup merge of #115278 - RalfJung:removed-error-codes, r=GuillaumeGomezMatthias Krüger-2/+8
tell people what to do when removing an error code Currently tidy and CI send developers on a wild goose chase: - you edit the code - CI/tidy tells you that an error code is gone, so you remove it from the list - CI/tidy tells you that the markdown file is stale, so you remove that as well - CI (but not tidy) tells you not to remove an error description and copy what E0001 does Let's be nice to people and directly tell them what to do rather than making them follow misleading breadcrumbs. r? ``@GuillaumeGomez``
2023-08-28Rollup merge of #114919 - joshtriplett:style-guide-macros, r=calebcartwrightMatthias Krüger-1/+6
style-guide: Add guidance for defining formatting for specific macros
2023-08-28Rollup merge of #114512 - devnexen:fix_tests_fbsd, r=thomccMatthias Krüger-1/+1
std/tests: disable ancillary tests on freebsd since the feature itsel… …f is.
2023-08-28Rollup merge of #114238 - jhpratt:fix-duration-div, r=thomccMatthias Krüger-4/+5
Fix implementation of `Duration::checked_div` I ran across this while running some sanity checks on `time`. Quickcheck immediately found a bug, and as I'd modified the code from `std` I knew there was a bug here as well. tl;dr this code fails ([playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=1189a3efcdfc192c27d6d87815359353)) ```rust use std::time::Duration; fn main() { assert_eq!( Duration::new(1, 1).checked_div(7), Some(Duration::new(0, 142_857_143)), ); } ``` The existing code determines that 1/7 = 0 (seconds), 1/7 = 0 (nanoseconds), 1 billion / 7 = 142,857,142 (extra nanoseconds). The billion comes from multiplying the remainder of the seconds (1) by the number of nanoseconds in a second. However, **this wrongly ignores any remaining nanoseconds**. This PR takes that into consideration, adds a test, and also changes the roundabout way of calculating the remainder into directly computing it. Note: This is _not_ a rounding error. This result divides evenly. `@rustbot` label +A-time +C-bug +S-waiting-on-reviewer +T-libs
2023-08-28Rollup merge of #109660 - ijackson:leap, r=thomccMatthias Krüger-0/+24
Document that SystemTime does not count leap seconds Fixes #77994 This may not be entirely uncontroversial. I know that `@Ekleog` is going to disagree. However, in support of this docs change: This documents the current behaviour. The alternative would be to plan to *change* the behaviour. There are many programs which need to get a POSIX time (a `time_t`). Right now, `duration_since(UNIX_EPOCH)` is the only facility in std that does that. So, that is what programs use. Changing the behaviour would break[1] all of those programs. We would need to define a new API that can be used to get a POSIX time, and get everyone to use it. This seems highly unpalatable. And, even if we wanted to do that, time with leap seconds is a lot less easy to work with. We would need to arrange to have a leap seconds table available to `std` somehow, and make sure that it was kept up to date. Currently we don't offer to do that for timezone data, which has similar needs. There are other complications. So it seems it would be awkwarrd to *implement* a facility that provides time including leap seconds, and the resulting value would be hard for applications to work with. Therefore, I think it's clear that we don't want to plan to ever change `SystemTime`. We should plan to keep it the way it is. Providing TAI (for example) should be left to external crates, or additional APIs we may add in the future. For more discussion see #77994 and in particular `@fanf2's` https://github.com/rust-lang/rust/issues/77994#issuecomment-1409448174 [1] Of course, by "break" we really only mean *future* breakage in the case where there is, in fact, ever another leap second. There may well not be: they are in the process of being abolished (although this is of course being contested). But if we decide that `SystemTime::now().duraton_since(UNIX_EPOCH)` counts leap seconds, it would start to return `Durations`s that are 27s different to the current answers. That's clearly unacceptable. And we can hardly change `UNIX_EPOCH` by 27s.
2023-08-28Auto merge of #115296 - saethlin:dont-duplicate-allocs, r=jackh726bors-5/+20
Load include_bytes! directly into an Lrc This PR deletes an innocent-looking `.into()` that was converting from a `Vec<u8>` to `Lrc<[u8]>`. This has significant runtime and memory overhead when using `include_bytes!` to pull in a large binary file.
2023-08-28Auto merge of #115267 - nikic:revert-elf-relaxation, r=compiler-errorsbors-2/+3
Revert relax_elf_relocations default change This reverts commit 441086879821d554ecdfde391e767d1a954fd5e2 (#106511). The change caused linker failures with the binutils version used by cross (#115239), as well as miscompilations when using the mold linker (https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/SIGILL.20in.20build-script-build.20with.20nightly-2023-08-25/near/387506479).
2023-08-28Auto merge of #115287 - saethlin:more-specialer, r=cjgillotbors-0/+7
Add a specialization for encoding byte arrays in rmeta This specialization already exists for FileEncoder, but since EncodeContext is implemented by forwarding down to FileEncoder, using EncodeContext used to bypass the specialization.
2023-08-27Load include_bytes! directly into an LrcBen Kimock-5/+20
2023-08-28Auto merge of #115254 - cuviper:aligned_alloc-size, r=thomccbors-1/+5
wasi: round up the size for `aligned_alloc` C11 `aligned_alloc` requires that the size be a multiple of the alignment. This is enforced in the wasi-libc emmalloc implementation, which always returns NULL if the size is not a multiple. (The default `MALLOC_IMPL=dlmalloc` does not currently check this.)
2023-08-27Add a specialization for encoding byte arrays in rmetaBen Kimock-0/+7
2023-08-27Auto merge of #115281 - GuillaumeGomez:rollup-yr05a54, r=GuillaumeGomezbors-18/+21
Rollup of 3 pull requests Successful merges: - #114974 (Add an (perma-)unstable option to disable vtable vptr) - #115261 (replace outdated github username 'ozkanonur') - #115266 (Unify CSS color formats a bit more) r? `@ghost` `@rustbot` modify labels: rollup
2023-08-27also ignore doctestsRalf Jung-1/+2
2023-08-27Rollup merge of #115266 - GuillaumeGomez:unify-css-color-formats, r=notriddleGuillaume Gomez-14/+14
Unify CSS color formats a bit more When `rgb` format doesn't have an `rgba` equivalent, I turned it into hex format. I also "decapitalized" hex formats. r? `@notriddle`
2023-08-27Rollup merge of #115261 - onur-ozkan:replace-old-username, r=Mark-SimulacrumGuillaume Gomez-3/+3
replace outdated github username 'ozkanonur'
2023-08-27Rollup merge of #114974 - nbdd0121:vtable, r=b-naberGuillaume Gomez-1/+4
Add an (perma-)unstable option to disable vtable vptr This flag is intended for evaluation of trait upcasting space cost for embedded use cases. Compared to the approach in #112355, this option provides a way to evaluate end-to-end cost of trait upcasting. Rationale: https://github.com/rust-lang/rust/issues/112355#issuecomment-1658207769 ## How this flag should be used (after merge) Build your project with and without `-Zno-trait-vptr` flag. If you are using cargo, set `RUSTFLAGS="-Zno-trait-vptr"` in the environment variable. You probably also want to use `-Zbuild-std` or the binary built may be broken. Save both binaries somewhere. ### Evaluate the space cost The option has a direct and indirect impact on vtable space usage. Directly, it gets rid of the trait vptr entry needed to store a pointer to a vtable of a supertrait. (IMO) this is a small saving usually. The larger saving usually comes with the indirect saving by eliminating the vtable of the supertrait (and its parent). Both impacts only affects vtables (notably the number of functions monomorphized should , however where vtable reside can depend on your relocation model. If the relocation model is static, then vtable is rodata (usually stored in Flash/ROM together with text in embedded scenario). If the binary is relocatable, however, the vtable will live in `.data` (more specifically, `.data.rel.ro`), and this will need to reside in RAM (which may be a more scarce resource in some cases), together with dynamic relocation info living in readonly segment. For evaluation, you should run `size` on both binaries, with and without the flag. `size` would output three columns, `text`, `data`, `bss` and the sum `dec` (and it's hex version). As explained above, both `text` and `data` may change. `bss` shouldn't usually change. It'll be useful to see: * Percentage change in text + data (indicating required flash/ROM size) * Percentage change in data + bss (indicating required RAM size)
2023-08-27avoid triple-backtrace due to panic-during-cleanupRalf Jung-31/+90
2023-08-27Auto merge of #115231 - saethlin:dont-ignore-wasm, r=Mark-Simulacrumbors-22/+18
Remove some wasm/emscripten ignores I'm planning on landing a few PRs like this that remove ignores that aren't required. This just covers mir-opt and codegen tests.
2023-08-27tell people what to do when removing an error codeRalf Jung-2/+7
2023-08-27Auto merge of #115226 - RalfJung:debug-abi, r=compiler-errorsbors-29/+422
add rustc_abi debugging attribute This is the call ABI equivalent of `rustc_layout(debug)`. Fixes https://github.com/rust-lang/rust/issues/115168 r? `@bjorn3`
2023-08-27Auto merge of #115139 - cjgillot:llvm-fragment, r=nikicbors-9/+105
Do not forget to pass DWARF fragment information to LLVM. Fixes https://github.com/rust-lang/rust/issues/115113 for the rustc part
2023-08-27Auto merge of #115263 - matthiaskrgr:rollup-taqu2h0, r=matthiaskrgrbors-145/+163
Rollup of 6 pull requests Successful merges: - #114924 (coverage: Tidy up `run-coverage` tests in several small ways) - #114927 (CI: add more debug logging to Docker caching) - #114957 (tests: Fix tests for LoongArch64) - #115007 (Correct and expand documentation of `handle_alloc_error` and `set_alloc_error_hook`.) - #115098 (rust-gdbgui: remove excessive quotes) - #115111 (compile rust-anaylzer with `x check` if it's enabled) r? `@ghost` `@rustbot` modify labels: rollup
2023-08-27Auto merge of #115079 - cuviper:unused-mcinfo, r=Mark-Simulacrumbors-1/+1
Move a local to the `#if` block where it is used For other cases (LLVM < 17), this was complaining under `-Wall`: ``` warning: llvm-wrapper/PassWrapper.cpp: In function ‘void LLVMRustPrintTargetCPUs(LLVMTargetMachineRef, const char*)’: warning: llvm-wrapper/PassWrapper.cpp:311:26: warning: unused variable ‘MCInfo’ [-Wunused-variable] warning: 311 | const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo(); warning: | ^~~~~~ ```
2023-08-27add rustc_abi debugging attributeRalf Jung-29/+422
2023-08-27Revert "Auto merge of #106511 - MaskRay:gotpcrelx, r=nikic"Nikita Popov-2/+3
This reverts commit 441086879821d554ecdfde391e767d1a954fd5e2, reversing changes made to 249595b7523fc07a99c1adee90b1947739ca0e5b. This causes linker failures with the binutils version used by cross (#115239), as well as miscompilations when using the mold linker.
2023-08-27Unify CSS color formats a bit moreGuillaume Gomez-14/+14
2023-08-27Rollup merge of #115111 - ozkanonur:check-rust-analyzer-if-enabled, ↵Matthias Krüger-2/+9
r=Mark-Simulacrum compile rust-anaylzer with `x check` if it's enabled By default, `x check` doesn't compile the rust-analyzer. But when it's enabled in the config's tools section, there's no reason not to do it. This change allows `x check` to compile rust-analyzer if it's enabled in config's tools section. Helps to #115031
2023-08-27Rollup merge of #115098 - real-eren:rust-gdbgui-gdbargs-syntax-fix, ↵Matthias Krüger-3/+3
r=Mark-Simulacrum rust-gdbgui: remove excessive quotes Removes the extra quotes introduced in commit https://github.com/rust-lang/rust/commit/8dd0ec6de7c8473e5730972c4e6206d5fb47b4e6. Modified script tested and now works on Ubuntu w/ `dash`. Fixes https://github.com/rust-lang/rust/issues/115097
2023-08-27Rollup merge of #115007 - kpreid:alloc, r=Mark-SimulacrumMatthias Krüger-12/+39
Correct and expand documentation of `handle_alloc_error` and `set_alloc_error_hook`. The primary goal of this change is to remove the false claim that `handle_alloc_error` always aborts; instead, code should be prepared for `handle_alloc_error` to possibly unwind, and be sound under that condition. I saw other opportunities for improvement, so I have added all the following information: * `handle_alloc_error` may panic instead of aborting. (Fixes #114898) * What happens if a hook returns rather than diverging. * A hook may panic. (This was already demonstrated in an example, but not stated in prose.) * A hook must be sound to call — it cannot assume that it is only called by the runtime, since its function pointer can be retrieved by safe code. I've checked these statements against the source code of `alloc` and `std`, but there may be nuances I haven't caught, so a careful review is welcome.
2023-08-27Rollup merge of #114957 - loongarch-rs:fix-tests, r=Mark-SimulacrumMatthias Krüger-2/+2
tests: Fix tests for LoongArch64 This PR fixes `lp64d abi` tests for LoongArch64.
2023-08-27Rollup merge of #114927 - Kobzol:ci-docker-caching-log, r=Mark-SimulacrumMatthias Krüger-4/+10
CI: add more debug logging to Docker caching Seems like the trouble with the Docker update continues, and rustup has some problems with downloading cached Docker layers from S3 (https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/rustup.20CI.20fails.20to.20install.20Docker.20images.20for.20armv7-linux). This PR adds more logging to Docker caching and busts the cache to rebuild all images.
2023-08-27Rollup merge of #114924 - Zalathar:tidy-tests, r=Mark-SimulacrumMatthias Krüger-122/+100
coverage: Tidy up `run-coverage` tests in several small ways Prior to #114875 (anonymized line numbers), these tests were very sensitive to lines being added/removed, since doing so would change the line numbers in every subsequent line of output. Therefore they ended up with a few small style issues that weren't worth the hassle of fixing. Now that we can freely rearrange lines without needing to re-bless the entire output, we can tidy up the tests in various trivial ways.
2023-08-27Auto merge of #114969 - kpreid:dropdoc, r=Mark-Simulacrumbors-2/+8
Go into more detail about panicking in drop. This patch was sitting around in my drafts. I don't recall the motivation, but I think it was someone expressing confusion over “will likely abort” (since, in fact, a panicking drop _not_ caused by dropping while panicking will predictably _not_ abort). I hope that the new text will leave people well-informed about why not to panic and when it is reasonable to panic.
2023-08-27replace outdated github username 'ozkanonur'ozkanonur-3/+3
Signed-off-by: ozkanonur <work@onurozkan.dev>
2023-08-26Restrict test to x86_64.Camille GILLOT-0/+3
2023-08-26Auto merge of #115219 - estebank:issue-105306, r=compiler-errorsbors-203/+263
Point at type parameter that introduced unmet bound instead of full HIR node ``` error[E0277]: the size for values of type `[i32]` cannot be known at compilation time --> $DIR/issue-87199.rs:18:15 | LL | ref_arg::<[i32]>(&[5]); | ^^^^^ doesn't have a size known at compile-time ``` instead of ``` error[E0277]: the size for values of type `[i32]` cannot be known at compilation time --> $DIR/issue-87199.rs:18:22 | LL | ref_arg::<[i32]>(&[5]); | ---------------- ^^^^ doesn't have a size known at compile-time | | | required by a bound introduced by this call ``` ------ ``` error[E0277]: the trait bound `String: Copy` is not satisfied --> $DIR/own-bound-span.rs:14:24 | LL | let _: <S as D>::P<String>; | ^^^^^^ the trait `Copy` is not implemented for `String` | note: required by a bound in `D::P` --> $DIR/own-bound-span.rs:4:15 | LL | type P<T: Copy>; | ^^^^ required by this bound in `D::P` ``` instead of ``` error[E0277]: the trait bound `String: Copy` is not satisfied --> $DIR/own-bound-span.rs:14:12 | LL | let _: <S as D>::P<String>; | ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String` | note: required by a bound in `D::P` --> $DIR/own-bound-span.rs:4:15 | LL | type P<T: Copy>; | ^^^^ required by this bound in `D::P` ``` Fix #105306.
2023-08-26Auto merge of #115224 - spastorino:remove-lub_empty, r=lcnrbors-61/+30
Remove lub_empty from lexical region resolve As of my understanding this method made sense when we had `ReEmpty`. Removed `lub_empty` and made the calling site code equivalent. r? `@lcnr` `@compiler-errors`
2023-08-26Account for `Weak` alias kinds when adding more targetted obligationEsteban Küber-14/+19
2023-08-26Remove unnecessary `select_obligations_where_possible` and redundant errorsEsteban Küber-93/+10
2023-08-26More accurately point at argumentsEsteban Küber-137/+125
2023-08-26wasi: round up the size for `aligned_alloc`Josh Stone-1/+5
C11 `aligned_alloc` requires that the size be a multiple of the alignment. This is enforced in the wasi-libc emmalloc implementation, which always returns NULL if the size is not a multiple. (The default `MALLOC_IMPL=dlmalloc` does not currently check this.)
2023-08-26Do not produce fragment for ZST.Camille GILLOT-15/+49
2023-08-26Merge if and match expressions that don't make sense to have separatedSantiago Pastorino-15/+10