Fix error message about exported symbols from proc-macro crates
Someone forgot to update the error message after `#[proc_macro]` and
`#[proc_macro_attribute]` were stabilized.
make the error message more readable
When I type it wrong e.g. `--stage --bless`, missing a number here, this change would make it more explicit what's going wrong here.
Drop long-section-names linker workaround for windows-gnu
If we can trust objdump Rust doesn't emit sections loaded at runtime longer than 8 characters on windows-gnu (but still does on linux-gnu), debug sections are not affected by that limit.
I've ran tests and built few crates using exactly the same mingw-w64 version as Rusts CI just fine using **x86_64** toolchain.
The motivation for this change is making LLD work (it doesn't support `--enable-long-section-names`) with this target without hacks.
Bit of history:
The behaviour of LD changed in Binutils 2.20 released on 2009-10-16 and `--enable-long-section-names` was added to return to the old non conformant behaviour. Looking at the comment I can only guess there was a bug fixed in newer versions.
This workaround was added in https://github.com/rust-lang/rust/pull/13315 half a decade ago.
remove vestigial comments referring to defunct numeric trait hierarchy
I've been poking around the numeric trait hierarchy and also some of the actual numeric type implementations.
This is a small change but a matter of effective communication. I looked for other related references and saw none.
Refactor slice pattern usefulness checking
As a follow up to https://github.com/rust-lang/rust/pull/65874, this PR changes how variable-length slice patterns are handled in usefulness checking. The objectives are: cleaning up that code to make it easier to understand, and paving the way to handling fixed-length slices more cleverly too, for https://github.com/rust-lang/rust/issues/53820.
Before this, variable-length slice patterns were eagerly expanded into a union of fixed-length slices. Now they have their own special constructor, which allows expanding them a bit more lazily.
As a nice side-effect, this improves diagnostics.
This PR shows a slight performance improvement, mostly due to 149792b608. This will probably have to be reverted in some way when we implement or-patterns.
In bootstrap, we set `RUSTC_INSTALL_BINDIR` to `config.bindir`, so
rustdoc can find rustc relative to the toolchain sysroot. However, if a
distro script like Fedora's `%configure` sets an absolute path, then
rustdoc's `sysroot.join(bin_path)` ignores that sysroot altogether.
That would be OK once the toolchain is actually installed, but it breaks
the in-tree doc tests during the build, since `/usr/bin/rustc` is still
the old version. So now we try to make `RUSTC_INSTALL_BINDIR` relative
to the sysroot prefix in the first place.
An expression like `x[1][{ x = y; 2}]` would perform the bounds check
for the inner index operation before evaluating the outer index. This
would allow out of bounds memory accesses.
This was essentially a "query" previously (with no key, just always run
once when resolving the crate dependencies), and remains so, just now in
a way that isn't on Session. This removes the need for the `Once` as
well.
Use ptr::drop_in_place for VecDeque::truncate and VecDeque::clear
This commit allows `VecDeque::truncate` to take advantage of its (largely) contiguous memory layout and is consistent with the change in #64432 for `Vec`. As with the change to `Vec::truncate`, this changes both:
- the drop order, from back-to-front to front-to-back
- the behavior when dropping an element panics
For consistency, it also changes the behavior when dropping an element panics for `VecDeque::clear`.
These changes in behavior can be observed. This example ([playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=d0b1f2edc123437a2f704cbe8d93d828))
```rust
use std::collections::VecDeque;
fn main() {
struct Bomb(usize);
impl Drop for Bomb {
fn drop(&mut self) {
panic!(format!("{}", self.0));
}
}
let mut v = VecDeque::from(vec![Bomb(0), Bomb(1)]);
std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
v.truncate(0);
}));
std::mem::forget(v);
}
```
panics printing `1` today and succeeds. `v.clear()` panics printing `0` today and succeeds. With the change, `v.clear()`, `v.truncate(0)`, and dropping the `VecDeque` all panic printing `0` first and then abort with a double-panic printing `1`.
The motivation for this was making `VecDeque::truncate` more efficient since it was used in the implementation of `VecDeque::clone_from` (#65069), but it also makes behavior more consistent within the `VecDeque` and with `Vec` if that change is accepted (this probably doesn't make sense to merge if not).
This might need a crater run and an FCP as well.