Avoid symbol interning in `file_metadata`.
This commit changes `created_files` so it uses strings directly as keys,
rather than symbols derived from the strings. This avoids the cost of
having to do the hash table lookups to produce the symbols from the
strings.
The commit also uses `entry` to avoid doing a repeated hash table lookup
(`get` + `insert`).
Note that PR #60467 improved this code somewhat; this is a further
improvement.
r? @davidtwco
Update boxed::Box docs on memory layout
The existing docs for the `Box` type state that "the way `Box` allocates and releases memory is unspecified", and that therefore the only valid pointer to pass to `Box::from_raw` is one obtained from `Box::into_raw`. This is inconsistent with the module-level docs which specify,
> It is valid to convert both ways between a Box and a raw pointer allocated with the Global allocator, given that the Layout used with the allocator is correct for the type. More precisely, a value: *mut T that has been allocated with the Global allocator with Layout::for_value(&*value) may be converted into a box using Box::<T>::from_raw(value). Conversely, the memory backing a value: *mut T obtained from Box::<T>::into_raw may be deallocated using the Global allocator with Layout::for_value(&*value).
This pull request updates the docs for `Box` to make them consistent with the module-level docs and adds some examples of how to use the global allocator in conjunction with `Box::from_raw` and `Box::into_raw`.
debuginfo: Revert to old/more verbose behavior for -Cdebuginfo=1
https://github.com/rust-lang/rust/commit/cff075009 made LLVM emit less debuginfo when compiling with "line-tables-only". The change was essentially correct but the reduced amount of debuginfo broke
a number of tools.
This commit reverts the change so we get back the old behavior, until we figure out how to do this properly and give external tools to adapt to the new format.
See https://github.com/rust-lang/rust/issues/60020 for more info.
r? @cuviper
cc @jrmuizel & @froydnj
https://github.com/rust-lang/rust/commit/cff075009 made LLVM emit
less debuginfo when compiling with "line-tables-only". The change
was essentially correct but the reduced amount of debuginfo broke
a number of tools.
This commit reverts the change so we get back the old behavior,
until we figure out how to do this properly and give external
tools to adapt to the new format.
See https://github.com/rust-lang/rust/issues/60020 for more info.
Move gensym operations from `Symbol` to `Ident`
Gensyms are always at the `Ident` level, and long-term we probably want to record gensym-ness in hygiene data.
r? @petrochenkov
Set -funwind-tables and -fno-exceptions unconditionally for LLVM's libunwind
These are required otherwise libunwind will end up with undefined
references to __gxx_personality_v0 which is provided by C++ ABI
library and that's undesirable.
remove confusing remarks about mixed volatile and non-volatile accesses
These comments were originally added by @ecstatic-morse in 911d35f0bf and then later edited by me. The intention, I think, was to make sure people do both their reads and writes with these methods if the affected memory really is used for communication with external devices.
However, [people read this as saying that mixed volatile/non-volatile accesses are UB](https://github.com/rust-lang/rust/issues/58599#issuecomment-493791130), which -- to my knowledge -- they are not. So better remove this.
Cc @rkruppe @rust-lang/wg-unsafe-code-guidelines
rustc: Improve type size assertions
Now they
- Tell what the new size is, when it changes
- Do not require passing an identifier
```
::: src\libsyntax\parse\token.rs:223:1
|
223 | static_assert_size!(Token, 123);
| -------------------------------- in this macro invocation
|
= note: expected type `[(); 123]`
found type `[(); 16]`
```
Document BinaryHeap time complexity
I went into some detail on the time complexity of `push` because it is relevant for using BinaryHeap efficiently -- specifically that you should avoid pushing many elements in ascending order when possible.
r? @Amanieu
Closes#47976. Closes#59698.
stable hashing: Remove unused field and add documentation.
This PR removes the `bytes_hashed` field from `StableHasher` which in the past has been used for collecting some statistics but has gone unused for quite a while (months at least) now.
The PR also tries to document some requirements for `HashStable` implementations that haven't been written down explicitly anywhere.
Fix intra-doc link resolution failure on re-exporting libstd
Currently, re-exporting libstd items as below will [occur a lot of failures](https://gist.github.com/taiki-e/e33e0e8631ef47f65a74a3b69f456366).
```rust
pub use std::*;
```
Until the underlying issue (#56922) fixed, we can fix that so they don't propagate to downstream crates.
Related: https://github.com/rust-lang/rust/pull/56941 (That PR fixed failures that occur when re-exporting from libcore to libstd.)
r? @QuietMisdreavus
Fix search sidebar width when no crate select is present
Fixes#60480.
I also fixed the box-shadow that seemed to have been kind of removed?
r? @QuietMisdreavus
These are required otherwise libunwind will end up with undefined
references to __gxx_personality_v0 which is provided by C++ ABI
library and that's undesirable.
stabilize core parts of MaybeUninit
and deprecate mem::uninitialized in the future (1.40.0). This is part of implementing https://github.com/rust-lang/rfcs/pull/1892.
Also expand the documentation a bit.
This type is currently primarily useful when dealing with partially initialized arrays. In libstd, it is used e.g. in `BTreeMap` (with some unstable APIs that however can all be replaced, less ergonomically, by stable ones). What we stabilize should also be enough for `SmallVec` (Cc @bluss).
Making this useful for structs requires https://github.com/rust-lang/rfcs/pull/2582 or a commitment that references to uninitialized data are not insta-UB.
This commit changes `created_files` so it uses strings directly as keys,
rather than symbols derived from the strings. This avoids the cost of
having to do the hash table lookups to produce the symbols from the
strings.
The commit also uses `entry` to avoid doing a repeated hash table lookup
(`get` + `insert`).
Note that PR #60467 improved this code somewhat; this is a further
improvement.
Remove the unstable and deprecated mpsc_select
This removes macro `select!` and `std::sync::mpsc::{Handle, Select}`,
which were all unstable and have been deprecated since 1.32.
Closes#27800
r? @SimonSapin
Note that the `is_gensymed` call on `primitive_types` is unnecessary
because that table only contains the name of primitive types (e.g.
`i32`) and never contains gensyms.
Use `Symbol` even more
These patches simplify the code a bit (fewer conversions) and also speed things up a bit (fewer `with_interner` calls).
r? @petrochenkov
Rollup of 6 pull requests
Successful merges:
- #60590 (Test interaction of unions with non-zero/niche-filling optimization)
- #60745 (Perform constant propagation into terminators)
- #60895 (Enable thumbv7a-pc-windows-msvc target build end to end in rust/master)
- #60908 (Fix lints handling in rustdoc)
- #60960 (Stop using gensyms in HIR lowering)
- #60962 (Fix data types indication)
Failed merges:
r? @ghost
`LocalInternedString::intern(x)` is preferable to
`Symbol::intern(x).as_str()`, because the former involves one call to
`with_interner` while the latter involves two.
`InternedString::intern(x)` is preferable to
`Symbol::intern(x).as_interned_str()`, because the former involves one
call to `with_interner` while the latter involves two.
The case within InternedString::decode() is particularly hot, and this
change reduces the number of `with_interner` calls by up to 13%.
Fix data types indication
Fix the data types indication in basic examples of the Trait std::fmt::LowerExp and std::fmt::UpperExp.
Since there aren’t any type annotation on the let statement using the number 42.0, they are of type f64 according to The Book:
https://doc.rust-lang.org/book/ch03-02-data-types.html#floating-point-types