about summary refs log tree commit diff
path: root/library
AgeCommit message (Collapse)AuthorLines
2023-06-16Apply changes to fix python linting errorsTrevor Gross-1/+1
2023-06-16[libs] Simplify `unchecked_{shl,shr}`Scott McMurray-12/+5
There's no need for the `const_eval_select` dance here. And while I originally wrote the `.try_into().unwrap_unchecked()` implementation here, it's kinda a mess in MIR -- this new one is substantially simpler, as shown by the old one being above the inlining threshold but the new one being below it.
2023-06-16remove box_free and replace with drop implDrMeepster-21/+28
2023-06-16Rollup merge of #112662 - Vanille-N:symbol_unique, r=RalfJungMichael Goulet-0/+2
`#[lang_item]` for `core::ptr::Unique` Tree Borrows is about to introduce experimental special handling of `core::ptr::Unique` in Miri to give it a semantics. As of now there does not seem to be a clean way (i.e. other than `&format!("{adt:?}") == "std::ptr::Unique"`) to check if an `AdtDef` represents a `Unique`. r? `@RalfJung` Draft: making a lang item
2023-06-16Rollup merge of #112226 - devnexen:netbsd_affinity, r=cuviperMichael Goulet-0/+23
std: available_parallelism using native netbsd api first before falling back to existing code paths like FreeBSD does.
2023-06-16Rollup merge of #111074 - WaffleLapkin:🌟unsizes_your_buf_reader🌟, ↵Michael Goulet-111/+118
r=Amanieu Relax implicit `T: Sized` bounds on `BufReader<T>`, `BufWriter<T>` and `LineWriter<T>` TL;DR: ```diff,rust -pub struct BufReader<R> { /* ... */ } +pub struct BufReader<R: ?Sized> { /* ... */ } -pub struct BufWriter<W: Write> { /* ... */ } +pub struct BufWriter<W: ?Sized + Write> { /* ... */ } -pub struct LineWriter<W: Write> { /* ... */ } +pub struct LineWriter<W: ?Sized + Write> { /* ... */ } ``` This allows using `&mut BufReader<dyn Read>`, for example. **This is an insta-stable change**.
2023-06-16`#[lang_item]` for `core::ptr::Unique`Neven Villani-0/+2
2023-06-16Launch a non-unwinding panic for misaligned pointer derefBen Kimock-2/+3
2023-06-16slice::from_raw_parts: mention no-wrap-around conditionRalf Jung-10/+14
2023-06-16Remove `#[cfg(all())]` workarounds from `c_char`Alex Macleod-10/+0
2023-06-16Rollup merge of #112579 - MikaelUrankar:freebsd_docs, r=cuviperDylan DPC-0/+1
Fix building libstd documentation on FreeBSD. It fixes the following error: ``` error[E0412]: cannot find type `sockcred2` in module `libc` --> library/std/src/os/unix/net/ancillary.rs:211:29 | 211 | pub struct SocketCred(libc::sockcred2); | ^^^^^^^^^ not found in `libc` ```
2023-06-16Rollup merge of #112535 - RalfJung:miri-test-libstd, r=cuviperDylan DPC-11/+12
reorder attributes to make miri-test-libstd work again Fixes fallout from https://github.com/rust-lang/rust/pull/110141
2023-06-16Add more comprehensive tests for is_sorted and friends+merlan #flirora-1/+58
See #53485 and #55045.
2023-06-15std: only depend on dlmalloc for wasm*-unknownJosh Stone-1/+1
It was already filtered out for emscripten, but wasi doesn't need dlmalloc either since it reuses `unix/alloc.rs`.
2023-06-15Rollup merge of #112529 - jieyouxu:block-expr-unused-must-use, r=oli-obkGuillaume Gomez-3/+3
Extend `unused_must_use` to cover block exprs Given code like ```rust #[must_use] fn foo() -> i32 { 42 } fn warns() { { foo(); } } fn does_not_warn() { { foo() }; } fn main() { warns(); does_not_warn(); } ``` ### Before This PR ``` warning: unused return value of `foo` that must be used --> test.rs:8:9 | 8 | foo(); | ^^^^^ | = note: `#[warn(unused_must_use)]` on by default help: use `let _ = ...` to ignore the resulting value | 8 | let _ = foo(); | +++++++ warning: 1 warning emitted ``` ### After This PR ``` warning: unused return value of `foo` that must be used --> test.rs:8:9 | 8 | foo(); | ^^^^^ | = note: `#[warn(unused_must_use)]` on by default help: use `let _ = ...` to ignore the resulting value | 8 | let _ = foo(); | +++++++ warning: unused return value of `foo` that must be used --> test.rs:14:9 | 14 | foo() | ^^^^^ | help: use `let _ = ...` to ignore the resulting value | 14 | let _ = foo(); | +++++++ + warning: 2 warnings emitted ``` Fixes #104253.
2023-06-15remove unused fieldThe 8472-9/+1
since DrainFilter no longer continues draining when it's dropped the panic tracking is no longer needed.
2023-06-15privacy: Do not mark items reachable farther than their nominal visibilityVadim Petrochenkov-6/+6
This commit reverts a change made in #111425. It was believed that this change was necessary for implementing type privacy lints, but #111801 showed that it was not necessary. Quite opposite, the revert fixes some issues.
2023-06-15Rollup merge of #112621 - GrigorenkoPV:env, r=jyn514Matthias Krüger-0/+2
Mention `env!` in `option_env!`'s docs `env!` mentions that there is an alternative that returns an `Option<...>` instead of emitting a compile error. Now `option_env!` also mentions that there is an alternative that emits a compile error instead of returning an `Option<...>`.
2023-06-15Extend `unused_must_use` to cover block exprs许杰友 Jieyou Xu (Joe)-3/+3
2023-06-15Auto merge of #106343 - the8472:slice-iter-fold, r=scottmcmbors-0/+42
optimize slice::Iter::fold Fixes 2 of 4 cases from #106288 ``` OLD: test slice::fold_to_last ... bench: 248 ns/iter (+/- 3) NEW: test slice::fold_to_last ... bench: 0 ns/iter (+/- 0) ```
2023-06-15Correct types in method descriptions of `NonZero*` typeszica-9/+12
2023-06-15Auto merge of #104455 - the8472:dont-drain-on-drop, r=Amanieubors-534/+399
Don't drain-on-drop in DrainFilter impls of various collections. This removes drain-on-drop behavior from various unstable DrainFilter impls (not yet for HashSet/Map) because that behavior [is problematic](https://github.com/rust-lang/rust/issues/43244#issuecomment-641638196) (because it can lead to panic-in-drop when user closures panic) and may become forbidden if [this draft RFC passes](https://github.com/rust-lang/rfcs/pull/3288). closes #101122 [ACP](https://github.com/rust-lang/libs-team/issues/136) affected tracking issues * #43244 * #70530 * #59618 Related hashbrown update: https://github.com/rust-lang/hashbrown/pull/374
2023-06-14use indexed loop instead of ptr bumpingThe 8472-10/+20
this seems to produce less IR
2023-06-14Auto merge of #112625 - matthiaskrgr:rollup-jcobj3g, r=matthiaskrgrbors-1/+1
Rollup of 7 pull requests Successful merges: - #112584 (loongarch64-none*: Remove environment component from llvm target) - #112600 (Introduce a `Stable` trait to translate MIR to SMIR) - #112605 (Improve docs/clean up negative overlap functions) - #112611 (Error on unconstrained lifetime in RPITIT) - #112612 (Fix explicit-outlives-requirements lint span) - #112613 (Fix rustdoc-gui tests on Windows) - #112620 (Fix small typo) r? `@ghost` `@rustbot` modify labels: rollup
2023-06-14Fix `SocketAddrV6: Display` testsltdk-2/+2
2023-06-14Fix `Ipv6Addr: Display` testsltdk-3/+3
2023-06-14Auto merge of #112624 - matthiaskrgr:rollup-db6ta1b, r=matthiaskrgrbors-28/+62
Rollup of 6 pull requests Successful merges: - #98202 (Implement `TryFrom<&OsStr>` for `&str`) - #107619 (Specify behavior of HashSet::insert) - #109814 (Stabilize String::leak) - #111974 (Update runtime guarantee for `select_nth_unstable`) - #112109 (Don't print unsupported split-debuginfo modes with `-Zunstable-options`) - #112506 (Properly check associated consts for infer placeholders) r? `@ghost` `@rustbot` modify labels: rollup
2023-06-14Rollup merge of #111974 - Sp00ph:update_guarantees, r=AmanieuMatthias Krüger-6/+4
Update runtime guarantee for `select_nth_unstable` #106933 changed the runtime guarantee for `select_nth_unstable` from O(n) to O(n log n), since the old guarantee wasn't actually met by the implementation at the time. Now with #107522, `select_nth_unstable` should be truly linear in runtime, so we can revert its runtime guarantee to O(n). Since #106933 was considered a bug fix, this will probably need an FCP because it counts as a new API guarantee. r? `@Amanieu`
2023-06-14Rollup merge of #109814 - est31:stabilize_string_leak, r=AmanieuMatthias Krüger-7/+8
Stabilize String::leak Stabilizes the following API: ```Rust impl String { pub fn leak(self) -> &'static mut str; } ``` closes #102929 blocked by having an FCP for stabilization.
2023-06-14Rollup merge of #107619 - stepancheg:hash-set-insert, r=AmanieuMatthias Krüger-1/+23
Specify behavior of HashSet::insert `HashSet::insert` does not replace the value with equal value. Fixes #107581.
2023-06-14Rollup merge of #98202 - aticu:impl_tryfrom_osstr_for_str, r=AmanieuMatthias Krüger-14/+27
Implement `TryFrom<&OsStr>` for `&str` Recently when trying to work with `&OsStr` I was surprised to find this `impl` missing. Since the `to_str` method already existed the actual implementation is fairly non-controversial, except for maybe the choice of the error type. I chose an opaque error here instead of something like `std::str::Utf8Error`, since that would already make a number of assumption about the underlying implementation of `OsStr`. As this is a trait implementation, it is insta-stable, if I'm not mistaken? Either way this will need an FCP. I chose "1.64.0" as the version, since this is unlikely to land before the beta cut-off. `@rustbot` modify labels: +T-libs-api API Change Proposal: rust-lang/rust#99031 (accepted)
2023-06-14Mention `env!` in `option_env!`'s docsPavel Grigorenko-0/+2
2023-06-14Fix typoAntonios Barotsis-1/+1
2023-06-14Auto merge of #112418 - ferrocene:pa-mir-opt-panic, r=ozkanonur,saethlinbors-0/+2
Add support for targets without unwinding in `mir-opt`, and improve `--bless` for it The main goal of this PR is to add support for targets without unwinding support in the `mir-opt` test suite, by adding the `EMIT_MIR_FOR_EACH_PANIC_STRATEGY` comment. Similarly to 32bit vs 64bit, when that comment is present, blessed output files will have the `.panic-unwind` or `.panic-abort` suffix, and the right one will be chosen depending on the target's panic strategy. The `EMIT_MIR_FOR_EACH_PANIC_STRATEGY` comment replaced all the `ignore-wasm32` comments in the `mir-opt` test suite, as those comments were added due to `wasm32` being a target without unwinding support. The comment was also added on other tests that were only executed on x86 but were still panic strategy dependent. The `mir-opt` suite was then blessed, which caused a ton of churn as most of the existing output files had to be renamed and (mostly) duplicated with the abort strategy. --- After [asking on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/mir-opt.20tests.20and.20panic.3Dabort), the main concern about this change is it'd make blessing the `mir-opt` suite even harder, as you'd need to both bless it with an unwinding target and an aborting target. This exacerbated the current situation, where you'd need to bless it with a 32bit and a 64bit target already. Because of that, this PR also makes significant enhancements to `--bless` for the `mir-opt` suite, where it will automatically bless the suite four times with different targets, while requiring minimal cross-compilation. To handle the 32bit vs 64bit blessing, there is now an hardcoded list of target mapping between 32bit and 64bit. The goal of the list is to find a related target that will *probably* work without requiring additional cross-compilation toolchains on the system. If a mapping is found, bootstrap will bless the suite with both targets, otherwise just with the current target. To handle the panic strategy blessing (abort vs unwind), I had to resort to what I call "synthetic targets". For each of the target we're blessing (so either the current one, or a 32bit and a 64bit depending on the previous paragraph), bootstrap will extract the JSON spec of the target and change it to include `"panic-strategy": "abort"`. It will then build the standard library with this synthetic target, and bless the `mir-opt` suite with it. As a result of these changes, blessing the `mir-opt` suite will actually bless it two or four times with different targets, ensuring all possible variants are actually blessed. --- This PR is best reviewed commit-by-commit. r? `@jyn514` cc `@saethlin` `@oli-obk`
2023-06-14update hashbrown and replace Hash{Set,Map}::DrainFilter with ExtractIfThe 8472-74/+77
2023-06-14s/drain_filter/extract_if/ for Vec, Btree{Map,Set} and LinkedListThe 8472-189/+184
2023-06-14remove drain-on-drop behavior from linked_list::DrainFilter and add #[must_use]The 8472-30/+14
2023-06-14remove drain-on-drop behavior from BTree{Set,Map}::DrainFilter and add ↵The 8472-58/+40
#[must_use]
2023-06-14remove drain-on-drop behavior from vec::DrainFilter and add #[must_use]The 8472-121/+22
2023-06-13Bump stdarchScott McMurray-0/+0
2023-06-13Alter `Display` for `Ipv6Addr` for IPv4-compatible addressesltdk-8/+2
2023-06-13fix: get the l4re target working againHenrik Böving-3/+23
2023-06-13Auto merge of #112314 - ferrocene:pa-core-alloc-abort, r=bjorn3bors-12/+42
Ignore `core`, `alloc` and `test` tests that require unwinding on `-C panic=abort` Some of the tests for `core` and `alloc` require unwinding through their use of `catch_unwind`. These tests fail when testing using `-C panic=abort` (in my case through a target without unwinding support, and `-Z panic-abort-tests`), while they should be ignored as they don't indicate a failure. This PR marks all of these tests with this attribute: ```rust #[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")] ``` I'm not aware of a way to test this on rust-lang/rust's CI, as we don't test any target with `-C panic=abort`, but I tested this locally on a Ferrocene target and it does indeed make the test suite pass.
2023-06-13ignore core, alloc and test tests that require unwinding on panic=abortPietro Albini-12/+42
2023-06-13Fix building the documentation on FreeBSD.MikaelUrankar-0/+1
It fixes the following error: error[E0412]: cannot find type `sockcred2` in module `libc` --> library/std/src/os/unix/net/ancillary.rs:211:29 | 211 | pub struct SocketCred(libc::sockcred2); | ^^^^^^^^^ not found in `libc`
2023-06-13Auto merge of #112575 - matthiaskrgr:rollup-7a8d7tg, r=matthiaskrgrbors-1/+1
Rollup of 2 pull requests Successful merges: - #111885 (Don't ICE on unsized `extern "rust-call"` call) - #112558 (Fix typo in mod.rs) r? `@ghost` `@rustbot` modify labels: rollup
2023-06-13Rollup merge of #112558 - eltociear:patch-21, r=thomccMatthias Krüger-1/+1
Fix typo in mod.rs assoicated -> associated
2023-06-13Auto merge of #99339 - yanchith:binary-heap-ta, r=Amanieubors-63/+175
Make BinaryHeap parametric over Allocator Tracking issue: #32838 Related: https://github.com/rust-lang/wg-allocators/issues/7 This parametrizes `BinaryHeap` with `A`, similarly to how other collections are parametrized. A couple things I left out: ``` BinaryHeap::append Currently requires both structures to have the same allocator type. Could change, but depends on Vec::append, which has the same constraints. impl<T: Ord> Default for BinaryHeap<T> Not parametrized, because there's nowhere to conjure the allocator from. impl<T: Ord> FromIterator<T> for BinaryHeap<T> Not parametrized, because there's nowhere to conjure the allocator from. impl<T: Ord, const N: usize> From<[T; N]> for BinaryHeap<T> Not parametrized, because there's nowhere to conjure the allocator from. unsafe impl<I> AsVecIntoIter for IntoIter<I> AsVecIntoIter is not allocator aware, and I didn't dare change it without guidance. Is this something important? ``` I've seen very few tests for allocator_api in general, but I'd like to at least test this on some usage code in my projects before moving forward. EDIT: Updated the list of impls and functions that are not affected by this. `BinaryHeap` no longer has a `SpecExtend` impl, and prior work made implementing `Extend` possible.
2023-06-13Fix typo in mod.rsIkko Eltociear Ashimine-1/+1
assoicated -> associated
2023-06-12Add comment for arm_shim in generate-windows-sysbdbai-0/+3