224985 Commits

Author SHA1 Message Date
bors
8ede3aae28 Auto merge of #113602 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum
[stable] 1.71.0 release, backports

This PR adds a last-minute backport of:

- #112343: Prevent emitting `missing_docs` for `pub extern crate`
- no beta/mainline PR -- dropping empty section from relnotes
1.71.0
2023-07-12 03:31:10 +00:00
Mark Rousskov
20f5748a95 Drop empty sections from release notes 2023-07-11 21:47:22 -04:00
Guillaume Gomez
d412f06eff Add regression test for #112308 2023-07-11 21:45:29 -04:00
Guillaume Gomez
288476298b Prevent emitting missing_docs for pub extern crate 2023-07-11 21:45:29 -04:00
bors
7bb61853ad Auto merge of #113541 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum
[stable] Prepare 1.71.0 stable release

r? `@Mark-Simulacrum`
2023-07-10 15:07:21 +00:00
Mark Rousskov
9df351b1c1 Prepare 1.71.0 stable release 2023-07-10 10:45:24 -04:00
bors
01b5c40dc1 Auto merge of #113483 - Mark-Simulacrum:beta-backport, r=Mark-Simulacrum
[beta] backport

This PR backports:
- #113334: Revert the lexing of `c"…"` string literals
- #113231: Fix `dropping_copy_types` lint from linting in match-arm with side-effects
- #112794: Fix linker failures when #[global_allocator] is used in a dependency

r? `@Mark-Simulacrum`
2023-07-08 23:20:14 +00:00
Mark Rousskov
df2ddb75bf Downgrade addr2line
This prevents #113238 from hitting stable while we sort out options for avoiding it. The downgrade
is expected to not affect any users on stable, since it primarily affects tier 3 targets.
2023-07-08 10:58:48 -04:00
bjorn3
b1fcea06f4 Fix linker failures when #[global_allocator] is used in a dependency 2023-07-08 09:43:19 -04:00
Urgau
971831da24 Fix dropping_copy_types lint from linting in match-arm with side-effects 2023-07-08 09:42:55 -04:00
León Orell Valerian Liehr
dedc4550ba Revert the lexing of c_str_literals 2023-07-08 09:32:30 -04:00
León Orell Valerian Liehr
892a91f531 Add regression test 2023-07-08 09:32:24 -04:00
bors
f06c1b82f2 Auto merge of #113417 - flip1995:clippy_beta_backport, r=Manishearth
[beta] Clippy beta backport

Backported PRs:

- https://github.com/rust-lang/rust-clippy/pull/10813
- https://github.com/rust-lang/rust-clippy/pull/10865
- https://github.com/rust-lang/rust-clippy/pull/10873
- https://github.com/rust-lang/rust-clippy/pull/10992

Those address bugs, that were either introduced with 1.71 and that we would like to address before they get into stable or bugs that were introduced in 1.70 and that we would like to be fixed in 1.71 already.

Detailed arguments for the backports of those PRs are in the PRs (mostly).

r? `@Mark-Simulacrum`
2023-07-06 21:48:13 +00:00
blyxyas
8cde275446
Ignore in-proc-macros items 2023-07-06 19:43:58 +02:00
Alex Macleod
cbadffc158
Move redundant_clone to nursery 2023-07-06 19:42:56 +02:00
bors
f25839a64d
Auto merge of #10865 - Centri3:let_with_type_underscore_tracing, r=Jarcho
[`let_with_type_underscore`]: Don't emit on locals from procedural macros

closes #10498

changelog: [`let_with_type_underscore`]: Don't emit on locals from procedural macros
2023-07-06 19:40:54 +02:00
y21
490cd94817
[default_constructed_unit_structs]: do not lint type aliases 2023-07-06 19:37:59 +02:00
bors
dbf31f17d0 Auto merge of #113000 - Mark-Simulacrum:beta-backport, r=Mark-Simulacrum
[beta] backport

This PR backports:

- #112684: Disable alignment checks on i686-pc-windows-msvc
- #112581: [rustdoc] Fix URL encoding of % sign
- #112312: Update to LLVM 16.0.5
- #112266: Fix type-inference regression in #112225
- #112062: Make struct layout not depend on unsizeable tail

r? `@Mark-Simulacrum`
2023-06-24 17:24:00 +00:00
Wesley Wiser
f8052fca83 Add test case for unsizing with niche 2023-06-24 10:18:47 -04:00
The 8472
f667eebd94 disable some layout optimizations for unsizable structs 2023-06-24 10:18:47 -04:00
Lukas Markeffsky
4f237bf5ae Make struct layout not depend on unsizeable tail 2023-06-24 10:18:47 -04:00
Arpad Borsos
d1aad9ea76 Fix type-inference regression in #112225
The type inference of argument-position closures and async blocks
regressed in 1.70 as the evaluation order of async blocks changed, as
they are not implicitly wrapped in an identity-function anymore.

Fixes #112225 by making sure the evaluation order stays the same as it
used to.
2023-06-24 10:18:37 -04:00
Nikita Popov
ec910f4194 Update to LLVM 16.0.5 2023-06-24 10:18:30 -04:00
TumoiYorozu
613630d02f Fix URL encoding of % sign in Rust Doc. 2023-06-24 10:18:17 -04:00
Wesley Wiser
c516249c84 Update compiler/rustc_mir_transform/src/check_alignment.rs 2023-06-24 10:17:57 -04:00
Ben Kimock
8881d01b3f Disable alignment checks on i686-pc-windows-msvc 2023-06-24 10:17:57 -04:00
bors
78a6ac0a86 Auto merge of #112421 - weihanglo:update-beta-cargo, r=weihanglo
[beta-1.71] cargo backport

1 commits in 64fb38c97ac4d3a327fc9032c862dd28c8833b17..cfd3bbd8fe4fd92074dfad04b7eb9a923646839f
2023-05-23 18:53:23 +0000 to 2023-06-08 08:44:47 +0000
- [beta-1.70] backport rust-lang/cargo#12234 (rust-lang/cargo#12242)

r? `@ghost`
2023-06-08 16:33:53 +00:00
Weihang Lo
27a6bdd8a0
[beta-1.71] cargo backport 2023-06-08 12:06:30 +01:00
bors
4e8c9e8e37 Auto merge of #112246 - Mark-Simulacrum:beta-next, r=Mark-Simulacrum
[beta] backports + stage0 bump

This bumps the beta branch to use 1.70 as the bootstrap compiler, and backports:

* https://github.com/rust-lang/rust/pull/112070

r? `@Mark-Simulacrum`
2023-06-04 06:52:23 +00:00
lcnr
8bc8defeee add FIXME 2023-06-03 12:17:58 -04:00
lcnr
6aba7e8c43 add tests 2023-06-03 12:17:53 -04:00
lcnr
29b922d523 unique borrows are mutating uses 2023-06-03 12:17:46 -04:00
Mark Rousskov
769f6cc24c Bump to released 1.70 stable 2023-06-03 12:17:13 -04:00
bors
eff24c06d8 Auto merge of #112066 - Mark-Simulacrum:beta-next, r=Mark-Simulacrum
[beta] 1.71.0 branch

* Swap out CURRENT_RUSTC_VERSION markers
* Bump CI channel
* Backport https://github.com/rust-lang/rust/pull/112026

r? `@Mark-Simulacrum`
2023-05-29 19:57:03 +00:00
Ben Kimock
f4e937955c Exclude Rvalue::AddressOf for raw pointer deref alignment checks 2023-05-29 10:35:23 -04:00
Ben Kimock
3af6f2eeef Add a test for misaligned pointer derefs inside addr_of! 2023-05-29 10:35:23 -04:00
Mark Rousskov
fe18edca5e Switch to beta channel 2023-05-29 10:34:01 -04:00
Mark Rousskov
d302f61b8a Swap out CURRENT_RUSTC_VERSION to 1.71.0 2023-05-29 10:33:37 -04:00
bors
cca7ee5811 Auto merge of #112025 - matthiaskrgr:rollup-j693v67, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #108630 (Fix docs for `alloc::realloc`)
 - #109084 (rustc driver: Remove argument 0 before at-expansion to prevent ICE)
 - #111181 (fix(parse): return unpected when current token is EOF)
 - #111656 (Use an unbounded lifetime in `String::leak`.)
 - #111946 (rustdoc: Add `ItemTemplate` trait and related functions to avoid repetitively wrapping existing functions)
 - #112018 (Clean up usage of `cx.tcx` when `tcx` is already set into a variable)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-05-27 20:27:23 +00:00
Matthias Krüger
9f5dce7d75
Rollup merge of #112018 - GuillaumeGomez:cleanup-tcx, r=notriddle
Clean up usage of `cx.tcx` when `tcx` is already set into a variable

I discovered a few cases where `cx.tcx` (and equivalents) was used whereas `tcx` was already stored into a variable. In those cases, better to just use `tcx` directly.

r? `@notriddle`
2023-05-27 20:40:29 +02:00
Matthias Krüger
9a4fce978d
Rollup merge of #111946 - nicklimmm:askama-item-template-trait, r=GuillaumeGomez
rustdoc: Add `ItemTemplate` trait and related functions to avoid repetitively wrapping existing functions

Context: https://github.com/rust-lang/rust/pull/111430#discussion_r1200672507

This trait will be used extensively in performing migrations to Askama templates (tracking issue: https://github.com/rust-lang/rust/issues/108868)
2023-05-27 20:40:29 +02:00
Matthias Krüger
5a4c04cc2c
Rollup merge of #111656 - finnbear:string_leak_unbounded_lifetime, r=Amanieu
Use an unbounded lifetime in `String::leak`.

Using `'a` instead of `'static` is predicted to make the process of making `String` generic over an allocator easier/less of a breaking change.

See:
- https://github.com/rust-lang/rust/pull/109814#issuecomment-1550164195
- https://github.com/rust-lang/rust/pull/109814#issuecomment-1550250163

ACP: https://github.com/rust-lang/libs-team/issues/109
2023-05-27 20:40:29 +02:00
Matthias Krüger
97fae38bf9
Rollup merge of #111181 - bvanjoi:fix-issue-111148, r=davidtwco
fix(parse): return unpected when current token is EOF

close https://github.com/rust-lang/rust/issues/111148

#111148 panic occurred because [FatalError.raise()](https://github.com/bvanjoi/rust/blob/master/compiler/rustc_parse/src/parser/mod.rs#LL540C3-L540C3) was encountered which caused by `Eof` and `Pound`(the last token) had same span, when parsing `#` in `fn a<<i<Y<w<>#`.

<img width="825" alt="image" src="https://user-images.githubusercontent.com/30187863/236612589-9e2c6a0b-18cd-408c-b636-c12a51cbcf1c.png">

There are a few ways to solve this problem:

- Change the action assign for [self.last_unexpected_token_span](https://github.com/rust-lang/rust/blob/master/compiler/rustc_parse/src/parser/diagnostics.rs#L592), for example, if current token is `Eof`, then return Error directly.
- Avoid triggering the `FatalError` when the current token is `Eof`.

I have chosen the second option because executing `expected_one_of_not_found` when the token is `Eof` but not in `ediable` seems reasonable.
2023-05-27 20:40:28 +02:00
Matthias Krüger
0b300a7bfa
Rollup merge of #109084 - dekrain:fix-panic-arg0-expansion, r=petrochenkov
rustc driver: Remove argument 0 before at-expansion to prevent ICE

Under Unix-based operating systems, when I execute rustc by setting argv0 to ``@/dev/null`,` it will expand command-line arguments from this file, leading to an empty arglist, which then triggers an ICE by trying to remove first argument.

The panic message is this:
```
thread 'main' panicked at 'range start index 1 out of range for slice of length 0', compiler/rustc_driver/src/lib.rs:972:17
```

My fix is to remove the first argument before expanding arguments.

<details>
<summary>Full backtrace</summary>

```sh
% (exec -a `@/dev/null` `rustup which rustc`)
thread 'main' panicked at 'range start index 1 out of range for slice of length 0', compiler/rustc_driver/src/lib.rs:972:17
stack backtrace:
   0:     0x7fcec776659a - std::backtrace_rs::backtrace::libunwind::trace::h595f06c70adcc478
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fcec776659a - std::backtrace_rs::backtrace::trace_unsynchronized::h177a0149c76cdde9
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fcec776659a - std::sys_common::backtrace::_print_fmt::hc0701fd2c3530c58
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7fcec776659a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd4cd115d8750fd6c
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fcec77c839e - core::fmt::write::h93e2f5923c7eca08
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/core/src/fmt/mod.rs:1213:17
   5:     0x7fcec7756be5 - std::io::Write::write_fmt::h8162dbb45f0b9e62
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/io/mod.rs:1682:15
   6:     0x7fcec7766365 - std::sys_common::backtrace::_print::h1835ef8a8f9066da
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7fcec7766365 - std::sys_common::backtrace::print::hcb5e6388b9235f41
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7fcec776912f - std::panicking::default_hook::{{closure}}::h9c084969ccf9a722
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/panicking.rs:267:22
   9:     0x7fcec7768e6b - std::panicking::default_hook::h68fa2ba3c3c6c12f
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/panicking.rs:286:9
  10:     0x7fcecaab56e4 - <rustc_driver[f4ad927b3c57833d]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[d16e85342ea223d9]::ops::function::FnOnce<(&core[d16e85342ea223d9]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7fcec776996a - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h4e6ced11e07d8b24
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/alloc/src/boxed.rs:2002:9
  12:     0x7fcec776996a - std::panicking::rust_panic_with_hook::h8d5c434518ef298c
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/panicking.rs:692:13
  13:     0x7fcec77696e9 - std::panicking::begin_panic_handler::{{closure}}::hf33414f5dabf6faf
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/panicking.rs:579:13
  14:     0x7fcec7766a4c - std::sys_common::backtrace::__rust_end_short_backtrace::hc50389427413bb75
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/sys_common/backtrace.rs:137:18
  15:     0x7fcec77693f2 - rust_begin_unwind
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/panicking.rs:575:5
  16:     0x7fcec77c4d43 - core::panicking::panic_fmt::h2de7a7938f816de8
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/core/src/panicking.rs:64:14
  17:     0x7fcec77cb492 - core::slice::index::slice_start_index_len_fail_rt::h0c87d85ce11d10f6
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/core/src/slice/index.rs:53:5
  18:     0x7fcec77cb416 - core::slice::index::slice_start_index_len_fail::h504609f2a6b168d1
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/core/src/slice/index.rs:41:9
  19:     0x7fceca0eca1f - rustc_driver[f4ad927b3c57833d]::handle_options
  20:     0x7fceca0e037f - <rustc_driver[f4ad927b3c57833d]::RunCompiler>::run
  21:     0x7fceca0dfd0d - <core[d16e85342ea223d9]::panic::unwind_safe::AssertUnwindSafe<rustc_driver[f4ad927b3c57833d]::main::{closure#0}> as core[d16e85342ea223d9]::ops::function::FnOnce<()>>::call_once
  22:     0x7fceca17ce89 - rustc_driver[f4ad927b3c57833d]::main
  23:     0x564f5f008a87 - rustc_main[f164605d1302e295]::main
  24:     0x564f5f008973 - std[3da461b304582a2c]::sys_common::backtrace::__rust_begin_short_backtrace::<fn(), ()>
  25:     0x564f5f008969 - <std[3da461b304582a2c]::rt::lang_start<()>::{closure#0} as core[d16e85342ea223d9]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  26:     0x7fcec774795c - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h699977d052768608
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/core/src/ops/function.rs:287:13
  27:     0x7fcec774795c - std::panicking::try::do_call::h4e121e623c70f903
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/panicking.rs:483:40
  28:     0x7fcec774795c - std::panicking::try::hf9d919e062bc178a
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/panicking.rs:447:19
  29:     0x7fcec774795c - std::panic::catch_unwind::h7a7b12272684cb97
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/panic.rs:140:14
  30:     0x7fcec774795c - std::rt::lang_start_internal::{{closure}}::hd96b0eb4844b8762
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/rt.rs:148:48
  31:     0x7fcec774795c - std::panicking::try::do_call::h1af1f88f4f92a22c
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/panicking.rs:483:40
  32:     0x7fcec774795c - std::panicking::try::hf20d7abea7f0f097
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/panicking.rs:447:19
  33:     0x7fcec774795c - std::panic::catch_unwind::hb0e084c3a9c042e4
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/panic.rs:140:14
  34:     0x7fcec774795c - std::rt::lang_start_internal::hca9d5c7277f5b67c
                               at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/rt.rs:148:20
  35:     0x564f5f008ab7 - main
  36:     0x7fcec74a1790 - <unknown>
  37:     0x7fcec74a184a - __libc_start_main
  38:     0x564f5f00899e - <unknown>
  39:                0x0 - <unknown>

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.68.0 (2c8cc3432 2023-03-06) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack
```
</details>

I also checked if I can trigger a similar problem by passing empty argument list to `execve`, but at least under Linux, it seems to always insert an empty first argument if there are none.
2023-05-27 20:40:27 +02:00
Matthias Krüger
1d06bb9612
Rollup merge of #108630 - overlookmotel:realloc-docs-fix, r=Amanieu
Fix docs for `alloc::realloc`

Fixes #108546.

Corrects the docs for `alloc::realloc` to bring the safety constraints into line with `Layout::from_size_align_unchecked`'s constraints.
2023-05-27 20:40:27 +02:00
bors
bc428f82f5 Auto merge of #111006 - Mark-Simulacrum:relnotes, r=Mark-Simulacrum
1.70.0 release notes

r? `@cuviper` `@rust-lang/release`
2023-05-27 17:50:37 +00:00
Mark Rousskov
89b9b25cfa 1.70.0 release notes 2023-05-27 13:42:45 -04:00
dekrain
6240d45189 Fix ICE caused by at-expanding argument 0 instead of removing it early 2023-05-27 18:00:43 +02:00
bors
f91b634643 Auto merge of #110975 - Amanieu:panic_count, r=joshtriplett
Rework handling of recursive panics

This PR makes 2 changes to how recursive panics works (a panic while handling a panic).

1. The panic count is no longer used to determine whether to force an immediate abort. This allows code like the following to work without aborting the process immediately:

```rust
struct Double;

impl Drop for Double {
    fn drop(&mut self) {
        // 2 panics are active at once, but this is fine since it is caught.
        std::panic::catch_unwind(|| panic!("twice"));
    }
}

let _d = Double;

panic!("once");
```

Rustc already generates appropriate code so that any exceptions escaping out of a `Drop` called in the unwind path will immediately abort the process.

2. Any panics while the panic hook is executing will force an immediate abort. This is necessary to avoid potential deadlocks like #110771 where a panic happens while holding the backtrace lock. We don't even try to print the panic message in this case since the panic may have been caused by `Display` impls.

Fixes #110771
2023-05-27 15:12:24 +00:00
Amanieu d'Antras
de607f1b5c Add support for nested panics to miri 2023-05-27 16:35:16 +02:00