Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 8 pull requests #94521

Closed
wants to merge 28 commits into from
Closed

Conversation

Dylan-DPC
Copy link
Member

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

Amanieu and others added 28 commits February 24, 2022 22:37
Support can be determined by checking for the "d32" LLVM feature.
Only point at the end of the crate. We could try making it point at the
beginning of the crate, but that is confused with `DUMMY_SP`, causing
the output to be *worse*.

This change will make it so that VSCode will *not* underline the whole
file when `main` is missing, so other errors will be visible.
Add `rustc_middle::ty::suggest_constraining_type_params` that suggests
adding multiple constraints.

`suggest_constraining_type_param` now just forwards params to this new
function.
Previously we've only suggested adding `Copy` bounds when the type being
moved/copied is a type parameter (generic). With this commit we also
suggest adding bounds when a type
- Can be copy
- All predicates that need to be satisfied for that are based on type
  params

i.e. we will suggest `T: Copy` for `Option<T>`, but won't suggest
anything for `Option<String>`.

Future work: it would be nice to also suggest adding `.clone()` calls
Modify the tier 3 non-ARM targets to show the standard library will no longer build for these and there is no work being done to change that.
Do not point at whole file missing `fn main`

Only point at the end of the crate. We could try making it point at the
beginning of the crate, but that is confused with `DUMMY_SP`, causing
the output to be *worse*.

This change will make it so that VSCode will *not* underline the whole
file when `main` is missing, so other errors will be visible.
Ensure stability directives are checked in all cases

Split off  rust-lang#93017

Stability and deprecation were not checked in all cases, for instance if a type error happened.
This PR moves the check earlier in the pipeline to ensure the errors are emitted in all cases.

r? ``@lcnr``
…imulacrum

Enable conditional compilation checking on the Rust codebase

This pull-request enable conditional compilation checking on every rust project build by the `bootstrap` tool.

To be more specific, this PR only enable well known names checking + extra names (bootstrap, parallel_compiler, ...).

r? ``@Mark-Simulacrum``
ARM: Only allow using d16-d31 with asm! when supported by the target

Support can be determined by checking for the "d32" LLVM feature.

r? ```@nagisa```
…ebank

Adt copy suggestions

Previously we've only suggested adding `Copy` bounds when the type being moved/copied is a type parameter (generic). With this PR we also suggest adding bounds when a type
- Can be copy
- All predicates that need to be satisfied for that are based on type params

i.e. we will suggest `T: Copy` for `Option<T>`, but won't suggest anything for `Option<String>`.

An example:
```rust
fn duplicate<T>(t: Option<T>) -> (Option<T>, Option<T>) {
    (t, t)
}
```
New error (current compiler doesn't provide `help`:):
```text
error[E0382]: use of moved value: `t`
 --> t.rs:2:9
  |
1 | fn duplicate<T>(t: Option<T>) -> (Option<T>, Option<T>) {
  |                 - move occurs because `t` has type `Option<T>`, which does not implement the `Copy` trait
2 |     (t, t)
  |      -  ^ value used here after move
  |      |
  |      value moved here
  |
help: consider restricting type parameter `T`
  |
1 | fn duplicate<T: Copy>(t: Option<T>) -> (Option<T>, Option<T>) {
  |               ++++++
```

Fixes rust-lang#93623
r? ```@estebank```
```@rustbot``` label +A-diagnostics +A-suggestion-diagnostics +C-enhancement

----

I'm not at all sure if this is the right implementation for this kind of suggestion, but it seems to work :')
…henkov

Improve allowness of the unexpected_cfgs lint

This pull-request improve the allowness (`#[allow(...)]`) of the `unexpected_cfgs` lint.

Before this PR only crate level `#![allow(unexpected_cfgs)]` worked, now with this PR it also work when put around `cfg!` or if it is in a upper level. Making it work ~for the attributes `cfg`, `cfg_attr`, ...~ for the same level is awkward as the current code is design to give "Some parent node that is close to this macro call" (cf. https://doc.rust-lang.org/nightly/nightly-rustc/rustc_expand/base/struct.ExpansionData.html) meaning that allow on the same line as an attribute won't work. I'm note even sure if this would be possible.

Found while working on rust-lang#94298.
r? ````@petrochenkov````
Documentation was missed when demoting Windows XP to no_std only

After a quick discussion on rust-lang#81250 which removed special casing for mutexes added [here](rust-lang@10b103a) to support Windows XP, we can't say that the standard library can build for it.

This change modifies the tier 3 non-ARM targets to show the standard library will no longer build for these and there is no work being done to change that.
Miri/CTFE: properly treat overflow in (signed) division/rem as UB

To my surprise, it looks like LLVM treats overflow of signed div/rem as UB. From what I can tell, MIR `Div`/`Rem` directly lowers to the corresponding LLVM operation, so to make that correct we also have to consider these overflows UB in the CTFE/Miri interpreter engine.

r? ``@oli-obk``
@rustbot rustbot added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Mar 2, 2022
@Dylan-DPC
Copy link
Member Author

@bors r+ rollup=never p=5

@bors
Copy link
Contributor

bors commented Mar 2, 2022

📌 Commit 61925ca has been approved by Dylan-DPC

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Mar 2, 2022
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-12 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
   Compiling stacker v0.1.14
   Compiling rustc_llvm v0.0.0 (/checkout/compiler/rustc_llvm)
   Compiling ena v0.14.0
   Compiling polonius-engine v0.13.0
error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: failed to process buffered lint here (dummy = false)
   --> /cargo/registry/src/github.com-1ecc6299db9ec823/crossbeam-utils-0.8.6/src/atomic/atomic_cell.rs:347:23
297 | / macro_rules! impl_arithmetic {
297 | / macro_rules! impl_arithmetic {
298 | |     ($t:ty, fallback, $example:tt) => {
299 | |         impl AtomicCell<$t> {
300 | |             /// Increments the current value by `val` and returns the previous value.
...   |
347 | |                 #[cfg(crossbeam_loom)]
...   |
546 | |     };
547 | | }
    | |_- in this expansion of `impl_arithmetic!`
    | |_- in this expansion of `impl_arithmetic!`
...
567 |   impl_arithmetic!(i128, fallback, "let a = AtomicCell::new(7i128);");
    |
    = note: delayed at /checkout/compiler/rustc_lint/src/early.rs:463:18


error: internal compiler error: failed to process buffered lint here (dummy = false)
   --> /cargo/registry/src/github.com-1ecc6299db9ec823/crossbeam-utils-0.8.6/src/atomic/atomic_cell.rs:316:23
297 | / macro_rules! impl_arithmetic {
297 | / macro_rules! impl_arithmetic {
298 | |     ($t:ty, fallback, $example:tt) => {
299 | |         impl AtomicCell<$t> {
300 | |             /// Increments the current value by `val` and returns the previous value.
...   |
316 | |                 #[cfg(crossbeam_loom)]
...   |
546 | |     };
547 | | }
    | |_- in this expansion of `impl_arithmetic!`
    | |_- in this expansion of `impl_arithmetic!`
...
567 |   impl_arithmetic!(i128, fallback, "let a = AtomicCell::new(7i128);");
    |
    = note: delayed at /checkout/compiler/rustc_lint/src/early.rs:463:18


error: internal compiler error: failed to process buffered lint here (dummy = false)
   --> /cargo/registry/src/github.com-1ecc6299db9ec823/crossbeam-utils-0.8.6/src/atomic/atomic_cell.rs:405:23
297 | / macro_rules! impl_arithmetic {
297 | / macro_rules! impl_arithmetic {
298 | |     ($t:ty, fallback, $example:tt) => {
299 | |         impl AtomicCell<$t> {
300 | |             /// Increments the current value by `val` and returns the previous value.
...   |
405 | |                 #[cfg(crossbeam_loom)]
...   |
546 | |     };
547 | | }
    | |_- in this expansion of `impl_arithmetic!`
    | |_- in this expansion of `impl_arithmetic!`
...
566 |   impl_arithmetic!(u128, fallback, "let a = AtomicCell::new(7u128);");
    |
    = note: delayed at /checkout/compiler/rustc_lint/src/early.rs:463:18


error: internal compiler error: failed to process buffered lint here (dummy = false)
   --> /cargo/registry/src/github.com-1ecc6299db9ec823/crossbeam-utils-0.8.6/src/atomic/atomic_cell.rs:434:23
297 | / macro_rules! impl_arithmetic {
297 | / macro_rules! impl_arithmetic {
298 | |     ($t:ty, fallback, $example:tt) => {
299 | |         impl AtomicCell<$t> {
300 | |             /// Increments the current value by `val` and returns the previous value.
...   |
434 | |                 #[cfg(crossbeam_loom)]
...   |
546 | |     };
547 | | }
    | |_- in this expansion of `impl_arithmetic!`
    | |_- in this expansion of `impl_arithmetic!`
...
567 |   impl_arithmetic!(i128, fallback, "let a = AtomicCell::new(7i128);");
    |
    = note: delayed at /checkout/compiler/rustc_lint/src/early.rs:463:18


error: internal compiler error: failed to process buffered lint here (dummy = false)
   --> /cargo/registry/src/github.com-1ecc6299db9ec823/crossbeam-utils-0.8.6/src/atomic/atomic_cell.rs:376:23
297 | / macro_rules! impl_arithmetic {
297 | / macro_rules! impl_arithmetic {
298 | |     ($t:ty, fallback, $example:tt) => {
299 | |         impl AtomicCell<$t> {
300 | |             /// Increments the current value by `val` and returns the previous value.
...   |
376 | |                 #[cfg(crossbeam_loom)]
...   |
546 | |     };
547 | | }
    | |_- in this expansion of `impl_arithmetic!`
    | |_- in this expansion of `impl_arithmetic!`
...
566 |   impl_arithmetic!(u128, fallback, "let a = AtomicCell::new(7u128);");
    |
    = note: delayed at /checkout/compiler/rustc_lint/src/early.rs:463:18


error: internal compiler error: failed to process buffered lint here (dummy = false)
   --> /cargo/registry/src/github.com-1ecc6299db9ec823/crossbeam-utils-0.8.6/src/atomic/atomic_cell.rs:347:23
297 | / macro_rules! impl_arithmetic {
297 | / macro_rules! impl_arithmetic {
298 | |     ($t:ty, fallback, $example:tt) => {
299 | |         impl AtomicCell<$t> {
300 | |             /// Increments the current value by `val` and returns the previous value.
...   |
347 | |                 #[cfg(crossbeam_loom)]
...   |
546 | |     };
547 | | }
    | |_- in this expansion of `impl_arithmetic!`
    | |_- in this expansion of `impl_arithmetic!`
...
566 |   impl_arithmetic!(u128, fallback, "let a = AtomicCell::new(7u128);");
    |
    = note: delayed at /checkout/compiler/rustc_lint/src/early.rs:463:18


error: internal compiler error: failed to process buffered lint here (dummy = false)
   --> /cargo/registry/src/github.com-1ecc6299db9ec823/crossbeam-utils-0.8.6/src/atomic/atomic_cell.rs:316:23
297 | / macro_rules! impl_arithmetic {
297 | / macro_rules! impl_arithmetic {
298 | |     ($t:ty, fallback, $example:tt) => {
299 | |         impl AtomicCell<$t> {
300 | |             /// Increments the current value by `val` and returns the previous value.
...   |
316 | |                 #[cfg(crossbeam_loom)]
...   |
546 | |     };
547 | | }
    | |_- in this expansion of `impl_arithmetic!`
    | |_- in this expansion of `impl_arithmetic!`
...
566 |   impl_arithmetic!(u128, fallback, "let a = AtomicCell::new(7u128);");
    |
    = note: delayed at /checkout/compiler/rustc_lint/src/early.rs:463:18


error: internal compiler error: failed to process buffered lint here (dummy = false)
   --> /cargo/registry/src/github.com-1ecc6299db9ec823/crossbeam-utils-0.8.6/src/atomic/atomic_cell.rs:405:23
297 | / macro_rules! impl_arithmetic {
297 | / macro_rules! impl_arithmetic {
298 | |     ($t:ty, fallback, $example:tt) => {
299 | |         impl AtomicCell<$t> {
300 | |             /// Increments the current value by `val` and returns the previous value.
...   |
405 | |                 #[cfg(crossbeam_loom)]
...   |
546 | |     };
547 | | }
    | |_- in this expansion of `impl_arithmetic!`
    | |_- in this expansion of `impl_arithmetic!`
...
567 |   impl_arithmetic!(i128, fallback, "let a = AtomicCell::new(7i128);");
    |
    = note: delayed at /checkout/compiler/rustc_lint/src/early.rs:463:18


error: internal compiler error: failed to process buffered lint here (dummy = false)
   --> /cargo/registry/src/github.com-1ecc6299db9ec823/crossbeam-utils-0.8.6/src/atomic/atomic_cell.rs:434:23
297 | / macro_rules! impl_arithmetic {
297 | / macro_rules! impl_arithmetic {
298 | |     ($t:ty, fallback, $example:tt) => {
299 | |         impl AtomicCell<$t> {
300 | |             /// Increments the current value by `val` and returns the previous value.
...   |
434 | |                 #[cfg(crossbeam_loom)]
...   |
546 | |     };
547 | | }
    | |_- in this expansion of `impl_arithmetic!`
    | |_- in this expansion of `impl_arithmetic!`
...
566 |   impl_arithmetic!(u128, fallback, "let a = AtomicCell::new(7u128);");
    |
    = note: delayed at /checkout/compiler/rustc_lint/src/early.rs:463:18


error: internal compiler error: failed to process buffered lint here (dummy = false)
   --> /cargo/registry/src/github.com-1ecc6299db9ec823/crossbeam-utils-0.8.6/src/atomic/atomic_cell.rs:376:23
297 | / macro_rules! impl_arithmetic {
297 | / macro_rules! impl_arithmetic {
298 | |     ($t:ty, fallback, $example:tt) => {
299 | |         impl AtomicCell<$t> {
300 | |             /// Increments the current value by `val` and returns the previous value.
...   |
376 | |                 #[cfg(crossbeam_loom)]
...   |
546 | |     };
547 | | }
    | |_- in this expansion of `impl_arithmetic!`
    | |_- in this expansion of `impl_arithmetic!`
...
567 |   impl_arithmetic!(i128, fallback, "let a = AtomicCell::new(7i128);");
    |
    = note: delayed at /checkout/compiler/rustc_lint/src/early.rs:463:18

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1188:13
thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1188:13
stack backtrace:
   0:     0x7fc4d33c85ac - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h641e0a65e2615a08
   1:     0x7fc4d34354ae - core::fmt::write::h39191aa5431a5380
   2:     0x7fc4d33b77a1 - std::io::Write::write_fmt::hb1861dc9906df921
   3:     0x7fc4d33c83db - std::sys_common::backtrace::print::h0ae42f20033c9262
   4:     0x7fc4d33ccbf4 - std::panicking::default_hook::{{closure}}::hd2976bf86056b49a
   5:     0x7fc4d33cc7d6 - std::panicking::default_hook::hd02e8d479b982aaa
   Compiling tracing-log v0.1.2
   6:     0x7fc4d3e1fe21 - rustc_driver[1687b6f54ec85a2d]::DEFAULT_HOOK::{closure#0}::{closure#0}
   7:     0x7fc4d33cd303 - std::panicking::rust_panic_with_hook::hbbba1d0bbca4f6bf
   8:     0x7fc4d6642bc3 - std[9f788053d5631f34]::panicking::begin_panic::<rustc_errors[9531b398d7fbf46a]::ExplicitBug>::{closure#0}
   9:     0x7fc4d6642a26 - std[9f788053d5631f34]::sys_common::backtrace::__rust_end_short_backtrace::<std[9f788053d5631f34]::panicking::begin_panic<rustc_errors[9531b398d7fbf46a]::ExplicitBug>::{closure#0}, !>
  10:     0x7fc4d3de616f - std[9f788053d5631f34]::panicking::begin_panic::<rustc_errors[9531b398d7fbf46a]::ExplicitBug>
  11:     0x7fc4d6679846 - std[9f788053d5631f34]::panic::panic_any::<rustc_errors[9531b398d7fbf46a]::ExplicitBug>
  12:     0x7fc4d66729e1 - <rustc_errors[9531b398d7fbf46a]::HandlerInner as core[8382fcd636289ab6]::ops::drop::Drop>::drop
  13:     0x7fc4d3e33985 - core[8382fcd636289ab6]::ptr::drop_in_place::<rustc_session[ff90c9fddf4ef87c]::parse::ParseSess>
  14:     0x7fc4d3e38e47 - <alloc[75caa6313e26ebc1]::rc::Rc<rustc_session[ff90c9fddf4ef87c]::session::Session> as core[8382fcd636289ab6]::ops::drop::Drop>::drop
  15:     0x7fc4d3e8618c - core[8382fcd636289ab6]::ptr::drop_in_place::<rustc_interface[e9a32af1e3f110c9]::interface::Compiler>
  16:     0x7fc4d3e8bbc9 - rustc_interface[e9a32af1e3f110c9]::interface::create_compiler_and_run::<core[8382fcd636289ab6]::result::Result<(), rustc_errors[9531b398d7fbf46a]::ErrorReported>, rustc_driver[1687b6f54ec85a2d]::run_compiler::{closure#1}>
  17:     0x7fc4d3e45c59 - std[9f788053d5631f34]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[e9a32af1e3f110c9]::util::run_in_thread_pool_with_globals<rustc_interface[e9a32af1e3f110c9]::interface::run_compiler<core[8382fcd636289ab6]::result::Result<(), rustc_errors[9531b398d7fbf46a]::ErrorReported>, rustc_driver[1687b6f54ec85a2d]::run_compiler::{closure#1}>::{closure#0}, core[8382fcd636289ab6]::result::Result<(), rustc_errors[9531b398d7fbf46a]::ErrorReported>>::{closure#0}, core[8382fcd636289ab6]::result::Result<(), rustc_errors[9531b398d7fbf46a]::ErrorReported>>
  18:     0x7fc4d3e98b5e - std[9f788053d5631f34]::panic::catch_unwind::<core[8382fcd636289ab6]::panic::unwind_safe::AssertUnwindSafe<<std[9f788053d5631f34]::thread::Builder>::spawn_unchecked_<rustc_interface[e9a32af1e3f110c9]::util::run_in_thread_pool_with_globals<rustc_interface[e9a32af1e3f110c9]::interface::run_compiler<core[8382fcd636289ab6]::result::Result<(), rustc_errors[9531b398d7fbf46a]::ErrorReported>, rustc_driver[1687b6f54ec85a2d]::run_compiler::{closure#1}>::{closure#0}, core[8382fcd636289ab6]::result::Result<(), rustc_errors[9531b398d7fbf46a]::ErrorReported>>::{closure#0}, core[8382fcd636289ab6]::result::Result<(), rustc_errors[9531b398d7fbf46a]::ErrorReported>>::{closure#1}::{closure#0}>, core[8382fcd636289ab6]::result::Result<(), rustc_errors[9531b398d7fbf46a]::ErrorReported>>
  19:     0x7fc4d3e3bb10 - <<std[9f788053d5631f34]::thread::Builder>::spawn_unchecked_<rustc_interface[e9a32af1e3f110c9]::util::run_in_thread_pool_with_globals<rustc_interface[e9a32af1e3f110c9]::interface::run_compiler<core[8382fcd636289ab6]::result::Result<(), rustc_errors[9531b398d7fbf46a]::ErrorReported>, rustc_driver[1687b6f54ec85a2d]::run_compiler::{closure#1}>::{closure#0}, core[8382fcd636289ab6]::result::Result<(), rustc_errors[9531b398d7fbf46a]::ErrorReported>>::{closure#0}, core[8382fcd636289ab6]::result::Result<(), rustc_errors[9531b398d7fbf46a]::ErrorReported>>::{closure#1} as core[8382fcd636289ab6]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  20:     0x7fc4d33dc293 - std::sys::unix::thread::Thread::new::thread_start::hd363d8910f104f91
  21:     0x7fc4cd74e609 - start_thread
  22:     0x7fc4d3245293 - clone
  23:                0x0 - <unknown>
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.61.0-nightly (8adaa740c 2022-03-02) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C opt-level=3 -C embed-bitcode=no -C debuginfo=0 -C debug-assertions=on -C symbol-mangling-version=v0 -Z unstable-options -Z macro-backtrace -C link-args=-Wl,-z,origin -C link-args=-Wl,-rpath,$ORIGIN/../lib -Z tls-model=initial-exec -Z unstable-options -C prefer-dynamic -C llvm-args=-import-instr-limit=10 -Z binary-dep-depinfo -Z force-unstable-if-unmarked
note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack

@Dylan-DPC Dylan-DPC mentioned this pull request Mar 2, 2022
@Dylan-DPC
Copy link
Member Author

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 2, 2022
@Dylan-DPC Dylan-DPC closed this Mar 3, 2022
@Dylan-DPC Dylan-DPC deleted the rollup-vcg8qy8 branch March 3, 2022 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rollup A PR which is a rollup S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.