- 22 3月, 2021 40 次提交
-
-
由 Dylan DPC 提交于
SplitInclusive is public API
-
由 Dylan DPC 提交于
Improve error message for unassigned query provider Fixes: #83122 r? `@jyn514` This implements the change we agreed on. Thanks!
-
由 Dylan DPC 提交于
post-drop-elab check-const: explain why we still check qualifs r? `@oli-obk`
-
由 Dylan DPC 提交于
Fix test for #82270 Fixes a test in #82270 to require the arm llvm component
-
由 Dylan DPC 提交于
Clarify non-exact length in the Iterator::take documentation There's an example which demonstrates incomplete length case, but it'd be best to explain it right from the start.
-
由 Dylan DPC 提交于
Document panicking cases for integer division and remainder This PR documents the cases when integer division and remainder operations panic. These operations panic in two cases: division by zero and overflow. It's surprising that these operations always panic on overflow, unlike most other arithmetic operations, which panic on overflow only when `debug_assertions` is enabled. The panic on overflow for the remainder is also surprising because a return value of `0` would be reasonable in this case. ("Overflow" occurs only for `MIN % -1`.) Since the panics on overflow are somewhat surprising, they should be documented. I guess it's worth asking: is panic on overflow (even when `debug_assertions` is disabled) the intended behavior? If not, what's the best way forward?
-
由 Dylan DPC 提交于
Add license metadata for std dependencies These five crates are in the dependency tree of `std` but lack license metadata: - `alloc` - `core` - `panic_abort` - `panic_unwind` - `unwind` Querying the dependency tree of `std` is a useful thing to be able to do, since these crates will typically be linked into Rust binaries. Tools show the license fields missing, as seen in https://github.com/rust-lang/rust/issues/67014#issuecomment-782704534. This PR adds the license field for the five crates, based on the license of the `std` package and this repo as a whole. I also added the `repository` and `descriptions` fields, since those seem useful. For `description`, I copied text from top-level comments for the respective modules - except for `unwind` which has none. I also note that https://github.com/rust-lang/rust/pull/73530 attempted to add license metadata for all crates in this repo, but was rejected because there was question about some of them. I hope that this smaller change, focusing only on the runtime dependencies, will be easier to review. cc `@Mark-Simulacrum` `@Lokathor`
-
由 bors 提交于
Fix inequality in docs for div_euclid This commit fixes the statement of the inequality that the Euclidean remainder satisfies. (The remainder is guaranteed to be less than abs(rhs), not rhs.) It also rewords the documentation to make it a little easier to read. (You might wonder why I've written `abs(rhs)` instead of `rhs.abs()`. Two reasons: first, the `rem_euclid` docs use `abs(rhs)` instead of `rhs.abs()`, and second, the absolute value here is the mathematical absolute value, not the the `.abs()` operation which may overflow.)
-
由 Alan Egerton 提交于
-
由 bors 提交于
Avoid temporary allocations in `render_assoc_item` `render_assoc_item` came up as very hot in a profile of rustdoc on `bevy`. This avoids some temporary allocations just to calculate the length of the header. This should be a strict improvement, since all string formatting was done twice before. cc #82845
-
由 Rich Kadel 提交于
Fixes: 83122
-
由 bors 提交于
Rollup of 9 pull requests Successful merges: - #80193 (stabilize `feature(osstring_ascii)`) - #80771 (Make NonNull::as_ref (and friends) return refs with unbound lifetimes) - #81607 (Implement TrustedLen and TrustedRandomAccess for Range<integer>, array::IntoIter, VecDequeue's iterators) - #82554 (Fix invalid slice access in String::retain) - #82686 (Move `std::sys::unix::platform` to `std::sys::unix::ext`) - #82771 (slice: Stabilize IterMut::as_slice.) - #83329 (Cleanup LLVM debuginfo module docs) - #83336 (Fix ICE with `use clippy::a::b;`) - #83350 (Download a more recent LLVM version if `src/version` is modified) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
-
由 Dylan DPC 提交于
Download a more recent LLVM version if `src/version` is modified When bumping the bootstrap version, the name of the generated LLVM shared object file is changed, even though it's the same contents as before. If bootstrap tries to use an older version, it will get linking errors: ``` Building rustdoc for stage1 (x86_64-unknown-linux-gnu) Compiling rustdoc-tool v0.0.0 (/home/joshua/rustc/src/tools/rustdoc) error: linking with `cc` failed: exit code: 1 | = note: "cc" "-Wl,--as-needed" ... lots of args ... = note: /usr/bin/ld: cannot find -lLLVM-12-rust-1.53.0-nightly clang: error: linker command failed with exit code 1 (use -v to see invocation) error: could not compile `rustdoc-tool` ``` Helps with https://github.com/rust-lang/rust/issues/81930.
-
由 Dylan DPC 提交于
Fix ICE with `use clippy::a::b;` Fixes #83317.
-
由 Dylan DPC 提交于
Cleanup LLVM debuginfo module docs - Move debuginfo docs from `doc.rs` module to `doc.md` file - Cleanup LLVM debuginfo module docs
-
由 Dylan DPC 提交于
slice: Stabilize IterMut::as_slice. Much like #72584. As per #58957 there's no blocker for this, and I wanted to use this today :-) Closes #58957
-
由 Dylan DPC 提交于
Move `std::sys::unix::platform` to `std::sys::unix::ext` This moves the operating system dependent alias `platform` (`std::os::{linux, android, ...}`) from `std::sys::unix` to `std::sys::unix::ext` (a.k.a. `std::os::unix`), removing the need for compatibility code in `unix_ext` when documenting on another platform. This is also a step in making it possible to properly move `std::sys::unix::ext` to `std::os::unix`, as ideally `std::sys` should not depend on the rest of `std`.
-
由 Dylan DPC 提交于
Fix invalid slice access in String::retain As noted in #78499, the previous fix was technically still unsound because it accessed elements of a slice outside its bounds (even though they were still inside the same allocation). This PR addresses that concern by switching to a dropguard approach.
-
由 Dylan DPC 提交于
Implement TrustedLen and TrustedRandomAccess for Range<integer>, array::IntoIter, VecDequeue's iterators This should make some `FromIterator` and `.zip()` specializations applicable in a few more cases. ``@rustbot`` label libs-impl
-
由 Dylan DPC 提交于
Make NonNull::as_ref (and friends) return refs with unbound lifetimes # Rationale: 1. The documentation for all of these functions claims that this is what the functions already do, as they all come with this comment: > You must enforce Rust's aliasing rules, *since the returned lifetime 'a is arbitrarily chosen* and does not necessarily reflect the actual lifetime of the data... So I think it's just a bug that they weren't this way already. Note that had it not been for this part, I wouldn't be making this PR, so if we decide we won't take this change, I'll follow it up with a docs PR to fix this. 2. This is how the equivalent raw pointer functions behave. They also take `self` and not `&self`/`&mut self`, but that can't be changed compatibly at this point. This is the next best thing. 3. Without this fix, often code that uses these methods will find it has to expand the lifetime of the result. (I can't speak for others but even in unsafe-heavy code, needing to do this unexpectedly is a huge red flag -- if Rust thinks something should have a specific lifetime, I assume it's for a reason) ### Can this cause existing code to be unsound? I'm confident this can't cause new unsoundness since the reference exists for at most its lifetime, but you get a borrow checker error if you do something that would require/allow the reference to exist past its lifetime. Additionally, the aliasing rules of a reference only applies while the reference exists. This *must* be the case, as it is required by the rules used by safe code. (That said, the documentation in this file sort of contradicts it, but I think it's just ambiguity between the lifetime `'a` in `&'a T` and lifetime of the `&'a T` reference itself...) We are increasing the lifetime of these references, but they should already have hard bounds on that lifetime, or they'd have borrow checker errors. (CC ``@RalfJung`` because I have gone and done the mistake where I say something definitive about aliasing in Rust which is honestly outside the group of things I should make definitive comments about). # Caveats 1. This is insta-stable (except for on the unstable functions ofc). I don't think there's any other alternative. 2. I don't believe this is a breaking change in practice. In theory someone could be assigning `NonNull::as_ref` to a function pointer of type `fn(&NonNull<T>) -> &T`. Now they'd need to use a slightly different function pointer type which is (probably) incompatible. This seems pathological, but I guess crater could be used if there are concerns. 3. This has no tests. The old version didn't either that I saw. I could add some stuff that fails to compile without it, if that would be useful. 4. Sometimes the NLL borrow checker gives up and decides lifetimes live till the end of the scope, as opposed to the range where they're used. If this change can cause this to happen more, then my soundness rationale is wrong, and it's likely breaking. In practice this seems super unlikely. Anyway. That was a lot of typing. Fixes https://github.com/rust-lang/rust/issues/80183
-
由 Dylan DPC 提交于
stabilize `feature(osstring_ascii)` This PR stabilizes `feature(osstring_ascii)`. Fixes #70516.
-
由 bors 提交于
Use TrustedRandomAccess for in-place iterators where possible This can speed up in-place iterators containing simple casts and transmutes from `Copy` types to any type of same size. `!Copy` types can't be optimized since `TrustedRandomAccess` isn't implemented for those iterators. ``` name on.b ns/iter o1.b ns/iter diff ns/iter diff % speedup vec::bench_transmute 20 (40000 MB/s) 12 (66666 MB/s) -8 -40.00% x 1.67 ```
-
由 The8472 提交于
-
由 Mara Bos 提交于
-
由 bors 提交于
Enable mutable noalias for LLVM >= 12 Enable mutable noalias by default on LLVM 12, as previously known miscompiles have been resolved. Now it's time to find the next one ;) * The `-Z mutable-noalias` option no longer has an explicit default and accepts `-Z mutable-noalias=yes` and `-Z mutable-noalias=no` to override the LLVM version based default behavior. * The decision on whether to apply the noalias attribute is moved into rustc_codegen_llvm. rustc_middle only provides us with the necessary information to make the decision. * `noalias` is not emitted for types that are `!Unpin`, as a heuristic for self-referential structures (see #54878 and #63818).
-
由 Camelid 提交于
-
由 Ralf Jung 提交于
-
由 Nikita Popov 提交于
In particular this pulls in an update to the auto-deref recursion_limit example, to no longer rely on the Freeze query.
-
由 Nikita Popov 提交于
This saves us both the Freeze/Unpin queries, and avoids placing noalias attributes, which have a compile-time impact on LLVM even in optnone builds (due to always_inline functions).
-
由 The8472 提交于
-
由 The8472 提交于
This allows the optimizer to turn certain iterator pipelines such as ```rust let vec = vec![0usize; 100]; vec.into_iter().map(|e| e as isize).collect::<Vec<_>>() ``` into a noop. The optimization only applies when iterator sources are `T: Copy` since `impl TrustedRandomAccess for IntoIter<T>`. No such requirement applies to the output type (`Iterator::Item`).
-
由 The8472 提交于
-
由 The8472 提交于
-
由 The8472 提交于
-
由 The8472 提交于
-
由 The8472 提交于
-
由 Nikita Popov 提交于
We don't have any known noalias bugs for LLVM 12 ... yet.
-
由 Nikita Popov 提交于
Such structures may contain self-references, in which case the same location may be accessible through a pointer that is not based-on the noalias pointer. This is still grey area as far as language semantics are concerned, but checking for !Unpin as an indicator for self-referential sturctures seems like a good approach for the meantime.
-
由 Nikita Popov 提交于
The default value will dependend on the LLVM version in the future, so don't specify one to start with.
-
由 Nikita Popov 提交于
The frontend shouldn't be deciding whether or not to use mutable noalias attributes, as this is a pure LLVM concern. Only provide the necessary information and do the actual decision in codegen_llvm.
-