]> git.lizzy.rs Git - rust.git/log
rust.git
18 months agoRollup merge of #106043 - c410-f3r:moar-errors, r=petrochenkov
nils [Fri, 23 Dec 2022 17:02:14 +0000 (18:02 +0100)]
Rollup merge of #106043 - c410-f3r:moar-errors, r=petrochenkov

Move tests

r? ``@petrochenkov``

* 6470 is an ancient LLVM compilation bug
* 22375 to typeck because of https://github.com/rust-lang/rust/pull/23013

18 months agoRollup merge of #105853 - jyn514:prepush-windows, r=Mark-Simulacrum
nils [Fri, 23 Dec 2022 17:02:13 +0000 (18:02 +0100)]
Rollup merge of #105853 - jyn514:prepush-windows, r=Mark-Simulacrum

Make the pre-push script work on directories with spaces

As a secondary benefit, it's also a lot simpler.

cc `@caass` - would love to have a review if you have time :)

18 months agoRollup merge of #105661 - lcnr:evaluate-new, r=compiler-errors
nils [Fri, 23 Dec 2022 17:02:13 +0000 (18:02 +0100)]
Rollup merge of #105661 - lcnr:evaluate-new, r=compiler-errors

implement the skeleton of the updated trait solver

cc ```@rust-lang/initiative-trait-system-refactor```

This is mostly following the architecture discussed in the types team meetup.

After discussing the desired changes for the trait solver, we encountered cyclic dependencies between them. Most notably between changing evaluate to be canonical and returning inference constraints. We cannot canonicalize evaluate without returning inference constraints due to coinductive cycles. However, caching inference constraints also relies on canonicalization. Implementing both of these changes at once in-place is not feasible.

This somewhat closely mirrors the current `evaluate` implementation with the following notable differences:
- it moves `project` into the core solver, allowing us to correctly deal with coinductive projections (will be required for implied bounds, perfect derive)
- it changes trait solver overflow to be non-fatal (required to backcompat breakage from changes to the iteration order of nested goals, deferred projection equality, generally very useful)
- it returns inference constraints and canonicalizes inputs and outputs (required for a lot things, most notably merging fulfill and evaluate, and deferred projection equality)
- it is implemented to work with lazy normalization

A lot of things aren't yet implemented, but the remaining FIXMEs should all be fairly self-contained and parallelizable. If the architecture looks correct and is what we want here, I would like to quickly merge this and then split the work.

r? ```@compiler-errors``` / ```@rust-lang/types``` :3

18 months agoAuto merge of #106053 - compiler-errors:incr-test-revision, r=Mark-Simulacrum
bors [Fri, 23 Dec 2022 13:37:11 +0000 (13:37 +0000)]
Auto merge of #106053 - compiler-errors:incr-test-revision, r=Mark-Simulacrum

Take revision into account in non-incremental-mode `// incremental` tests

A UI test I added in #105983 confusingly [failed](https://github.com/rust-lang/rust/pull/106031#issuecomment-1362558067) in a merge because two different revisions raced with each other for the same incremental directory for a (non-incremental-mode, i.e. `src/test/ui`) UI test.

Let's take the revision name into account when generating an incremental directory so that other UI tests that combine `// incremental` and `// revisions` won't race and cause possible flakiness in CI.

18 months agoMove tests
Caio [Fri, 23 Dec 2022 11:05:00 +0000 (08:05 -0300)]
Move tests

18 months agoAuto merge of #106033 - ChrisDenton:bump-cfg-if, r=Mark-Simulacrum
bors [Fri, 23 Dec 2022 10:46:58 +0000 (10:46 +0000)]
Auto merge of #106033 - ChrisDenton:bump-cfg-if, r=Mark-Simulacrum

Remove old version of `cfg-if` by bumping `packed_simd_2` and `getrandom v0.2` versions

```console
> cargo update --package packed_simd_2 --package getrandom@0.2.0
    Updating crates.io index
    Removing cfg-if v0.1.10
    Updating getrandom v0.2.0 -> v0.2.8
    Updating packed_simd_2 v0.3.4 -> v0.3.8
```

`packed_simd_2` is only used as a dependency of `bytecount` which in turn is only used by `rustfmt`. I can't see any issue with the minor version bump.

The bigger jump is `getrandom@0.2.0` which is used by a number of things, but 0.2.8 is still semver compatible and there doesn't seem to be any worrying changes (see the [changelog](https://github.com/rust-random/getrandom/blob/master/CHANGELOG.md)). The only breaking change are the removal of XP, stdweb and CloudAbi support but these are not host targets and rustc lacks support for them in any case (stdweb development was [abandonded](https://rustsec.org/advisories/RUSTSEC-2020-0056.html), XP is [tier 3 and `no_std`](https://doc.rust-lang.org/beta/rustc/platform-support.html#tier-3) and CloubAbi is [no longer supported](https://github.com/rust-lang/rust/pull/78439)).

Note that this doesn't affect `getrandom@0.1.16` which is what std depends on and which is already using the latest version of `cfg-if` (besides, there are already plans to remove that entirely).

18 months agoAuto merge of #106070 - matthiaskrgr:rollup-jv9ctkl, r=matthiaskrgr
bors [Fri, 23 Dec 2022 02:44:32 +0000 (02:44 +0000)]
Auto merge of #106070 - matthiaskrgr:rollup-jv9ctkl, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #105978 (Mark `proc_macro_decls_static` as always used)
 - #106051 (Allow building std with cranelift)
 - #106056 (Make `sess.bug` much less noisy)
 - #106057 (Give a more helpful error for "trimmed_def_paths constructed")
 - #106058 (Fix the issue number in comment for as_local_call_operand)
 - #106059 (Avoid running the `Profile` step twice on `x setup`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

18 months agoRollup merge of #106059 - jyn514:setup-twice, r=Nilstrieb
Matthias Krüger [Fri, 23 Dec 2022 00:17:52 +0000 (01:17 +0100)]
Rollup merge of #106059 - jyn514:setup-twice, r=Nilstrieb

Avoid running the `Profile` step twice on `x setup`

Prevents runs like the following:
```
$ x setup
Welcome to the Rust project! What do you want to do with x.py?
a) library: Contribute to the standard library
b) compiler: Contribute to the compiler itself
c) codegen: Contribute to the compiler, and also modify LLVM or codegen
d) tools: Contribute to tools which depend on the compiler, but do not modify it directly (e.g. rustdoc, clippy, miri)
e) user: Install Rust from source
Please choose one (a/b/c/d/e): b

To get started, try one of the following commands:
- `x.py check`
- `x.py build`
- `x.py test`
For more suggestions, see https://rustc-dev-guide.rust-lang.org/building/suggested.html
`x.py` will now use the configuration at /home/nilsh/projects/rustfast/src/bootstrap/defaults/config.compiler.toml
Welcome to the Rust project! What do you want to do with x.py?
...
```

r? `@Nilstrieb`

18 months agoRollup merge of #106058 - tmiasko:68304, r=compiler-errors
Matthias Krüger [Fri, 23 Dec 2022 00:17:52 +0000 (01:17 +0100)]
Rollup merge of #106058 - tmiasko:68304, r=compiler-errors

Fix the issue number in comment for as_local_call_operand

18 months agoRollup merge of #106057 - jyn514:trimmed-def-paths-ice, r=compiler-errors
Matthias Krüger [Fri, 23 Dec 2022 00:17:51 +0000 (01:17 +0100)]
Rollup merge of #106057 - jyn514:trimmed-def-paths-ice, r=compiler-errors

Give a more helpful error for "trimmed_def_paths constructed"

cc https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/ice.20debugging/near/315928294, https://github.com/rust-lang/rust/pull/106056

`@mejrs` do you think this would have helped you figure out the problem faster?

18 months agoRollup merge of #106056 - jyn514:quiet-bug, r=compiler-errors
Matthias Krüger [Fri, 23 Dec 2022 00:17:51 +0000 (01:17 +0100)]
Rollup merge of #106056 - jyn514:quiet-bug, r=compiler-errors

Make `sess.bug` much less noisy

cc https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/ice.20debugging/near/315929150

Before:

<details>

```
   Compiling core v0.0.0 (C:\Users\Joshua Nelson\src\rust2\library\core)
error: internal compiler error: no warnings or errors encountered even though `delayed_good_path_bugs` issued

error: internal compiler error: oops
  |
  = note: delayed at    0: std::backtrace_rs::backtrace::trace_unsynchronized
             1: std::backtrace::Backtrace::disabled
             2: std::backtrace::Backtrace::force_capture
             3: <rustc_errors::Handler>::delay_good_path_bug::<&str>
             4: <rustc_interface::passes::QueryContext>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}::{closure#2}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
             5: RINvMs2_NtCsiwHPejSviHg_15rustc_interface7queriesNtNtB8_9interface8Compiler5enterNCNCNvCs7PhwInflpyf_12rustc_driver12run_compilers_0s0_0INtNtCslM5znELOk5i_4core6result6ResultINtNtB2f_6option6OptionNtB6_6LinkerENtCshthk7JDUYGg_12rustc_errors15ErrorGuarante
             6: RINvCs6uSsza6NDuD_10rustc_span15with_source_mapINtNtCslM5znELOk5i_4core6result6ResultuNtCshthk7JDUYGg_12rustc_errors15ErrorGuaranteedENCNCINvNtCsiwHPejSviHg_15rustc_interface9interface12run_compilerBJ_NCNvCs7PhwInflpyf_12rustc_driver12run_compilers_0E00EB
             7: RINvMs_Cs9yvsqs6YnUZ_10scoped_tlsINtB5_9ScopedKeyNtCs6uSsza6NDuD_10rustc_span14SessionGlobalsE3setNCINvNtCsiwHPejSviHg_15rustc_interface9interface12run_compilerINtNtCslM5znELOk5i_4core6result6ResultuNtCshthk7JDUYGg_12rustc_errors15ErrorGuaranteedENCNvCs7P
             8: RINvNtNtCs5xszGlR5JQw_3std10sys_common9backtrace28___rust_begin_short_backtraceNCNCINvNtCsiwHPejSviHg_15rustc_interface4util31run_in_thread_pool_with_globalsNCINvNtB1o_9interface12run_compilerINtNtCslM5znELOk5i_4core6result6ResultuNtCshthk7JDUYGg_12rustc_
             9: RINvNtCs5xszGlR5JQw_3std9panicking3tryINtNtCslM5znELOk5i_4core6result6ResultuNtCshthk7JDUYGg_12rustc_errors15ErrorGuaranteedEINtNtNtBF_5panic11unwind_safe16AssertUnwindSafeNCNCINvMNtB4_6threadNtB2S_7Builder16spawn_unchecked_NCNCINvNtCsiwHPejSviHg_15rustc_
            10: <std::thread::Builder>::spawn_scoped::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver::run_compiler::{closure#0}>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
            11: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
            12: std::sys::windows::thread::Thread::new
            13: BaseThreadInitThunk
            14: RtlUserThreadStart

thread 'rustc' panicked at 'Box<dyn Any>', compiler\rustc_errors\src\lib.rs:1610:13
stack backtrace:
   0:     0x7fffbe935a15 - std::backtrace_rs::backtrace::trace_unsynchronized::h2a29ea0a35c1f799
   1:     0x7fffbe968811 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h5e4ca8af47bfbcc0
   2:     0x7fffbe98aeab - core::fmt::write::h152a9de2569e7dc7
   3:     0x7fffbe961059 - std::io::Write::write_fmt::h2452e19093defac4
   4:     0x7fffbe96866b - std::sys_common::backtrace::print::h550d034f7b77d60a
   5:     0x7fffbe93be1b - std::panicking::default_hook::h3969ead74039b801
   6:     0x7fffbe93bbad - std::panicking::default_hook::h3969ead74039b801
   7:     0x7fffa5f0abe3 - rustc_driver[5b2ae43fbecaf219]::handle_options
   8:     0x7fffbe93c25b - std::panicking::rust_panic_with_hook::h32bbe3ce24999160
   9:     0x7fffa82baee5 - std[4086331e48bff2f6]::sys_common::backtrace::__rust_end_short_backtrace::<std[4086331e48bff2f6]::panicking::begin_panic<&str>::{closure#0}, !>
  10:     0x7fffa82bae89 - std[4086331e48bff2f6]::sys_common::backtrace::__rust_end_short_backtrace::<std[4086331e48bff2f6]::panicking::begin_panic<rustc_errors[cb829533098ec0fe]::ExplicitBug>::{closure#0}, !>
  11:     0x7fffa867ed89 - std[4086331e48bff2f6]::panicking::begin_panic::<rustc_errors[cb829533098ec0fe]::ExplicitBug>
  12:     0x7fffa8298de9 - <alloc[284c8fe3a98c29c4]::string::String as core[fda266aeadfb153a]::fmt::Write>::write_fmt
  13:     0x7fffa829b7e2 - <rustc_errors[cb829533098ec0fe]::HandlerInner>::flush_delayed::<core[fda266aeadfb153a]::iter::adapters::map::Map<alloc[284c8fe3a98c29c4]::vec::into_iter::IntoIter<rustc_errors[cb829533098ec0fe]::DelayedDiagnostic>, <rustc_errors[cb829533098ec0fe]::DelayedDiagnostic>::decorate>, &str>
  14:     0x7fffa8288638 - <rustc_errors[cb829533098ec0fe]::HandlerInner as core[fda266aeadfb153a]::ops::drop::Drop>::drop
  15:     0x7fffa5eb90e1 - core[fda266aeadfb153a]::ptr::drop_in_place::<rustc_errors[cb829533098ec0fe]::Handler>
  16:     0x7fffa5ebe9fd - core[fda266aeadfb153a]::ptr::drop_in_place::<rustc_session[e703468b2407e34a]::cgu_reuse_tracker::CguReuseTracker>
  17:     0x7fffa5ec0d7c - core[fda266aeadfb153a]::ptr::drop_in_place::<rustc_session[e703468b2407e34a]::session::Session>
  18:     0x7fffa5ebe41c - core[fda266aeadfb153a]::ptr::drop_in_place::<rustc_interface[d7cd35f07e7e6ecc]::interface::Compiler>
  19:     0x7fffa5eea05f - RINvCs6uSsza6NDuD_10rustc_span15with_source_mapINtNtCslM5znELOk5i_4core6result6ResultuNtCshthk7JDUYGg_12rustc_errors15ErrorGuaranteedENCNCINvNtCsiwHPejSviHg_15rustc_interface9interface12run_compilerBJ_NCNvCs7PhwInflpyf_12rustc_driver12run_compilers_0E00EB
  20:     0x7fffa5edbe3a - RINvMs_Cs9yvsqs6YnUZ_10scoped_tlsINtB5_9ScopedKeyNtCs6uSsza6NDuD_10rustc_span14SessionGlobalsE3setNCINvNtCsiwHPejSviHg_15rustc_interface9interface12run_compilerINtNtCslM5znELOk5i_4core6result6ResultuNtCshthk7JDUYGg_12rustc_errors15ErrorGuaranteedENCNvCs7P
  21:     0x7fffa5ef4ec9 - RINvNtNtCs5xszGlR5JQw_3std10sys_common9backtrace28___rust_begin_short_backtraceNCNCINvNtCsiwHPejSviHg_15rustc_interface4util31run_in_thread_pool_with_globalsNCINvNtB1o_9interface12run_compilerINtNtCslM5znELOk5i_4core6result6ResultuNtCshthk7JDUYGg_12rustc_
  22:     0x7fffa5ee9935 - RINvNtCs5xszGlR5JQw_3std9panicking3tryINtNtCslM5znELOk5i_4core6result6ResultuNtCshthk7JDUYGg_12rustc_errors15ErrorGuaranteedEINtNtNtBF_5panic11unwind_safe16AssertUnwindSafeNCNCINvMNtB4_6threadNtB2S_7Builder16spawn_unchecked_NCNCINvNtCsiwHPejSviHg_15rustc_
  23:     0x7fffa5f0d770 - <std[4086331e48bff2f6]::thread::Builder>::spawn_scoped::<rustc_interface[d7cd35f07e7e6ecc]::util::run_in_thread_pool_with_globals<rustc_interface[d7cd35f07e7e6ecc]::interface::run_compiler<(), rustc_driver[5b2ae43fbecaf219]::run_compiler::{closure#0}>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  24:     0x7fffbe95b35b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hfcd927f7aebafa45
  25:     0x7fffbe9331d3 - std::sys::windows::thread::Thread::new::hf8f4c920eaebd965
  26:     0x7ff815877614 - BaseThreadInitThunk
  27:     0x7ff8166e26a1 - RtlUserThreadStart

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-dev running on x86_64-pc-windows-msvc

note: compiler flags: --crate-type lib -C opt-level=3 -C embed-bitcode=no -C debuginfo=0 -Z unstable-options -C incremental=[REDACTED] -C symbol-mangling-version=legacy -Z unstable-options -Z unstable-options -Z macro-backtrace -C split-debuginfo=packed -C target-feature=+crt-static -C prefer-dynamic -C embed-bitcode=yes -Z crate-attr=doc(html_root_url="https://doc.rust-lang.org/nightly/") -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
error: could not compile `core`
```

</details>

After:

<details>

```
   Compiling core v0.0.0 (C:\Users\Joshua Nelson\src\rust2\library\core)
error: internal compiler error: no warnings or errors encountered even though `delayed_good_path_bugs` issued

error: internal compiler error: oops
  |
  = note: delayed at    0: std::backtrace_rs::backtrace::trace_unsynchronized
             1: std::backtrace::Backtrace::disabled
             2: std::backtrace::Backtrace::force_capture
             3: <rustc_errors::Handler>::delay_good_path_bug::<&str>
             4: <rustc_interface::passes::QueryContext>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}::{closure#2}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
             5: RINvMs2_NtCsiwHPejSviHg_15rustc_interface7queriesNtNtB8_9interface8Compiler5enterNCNCNvCs7PhwInflpyf_12rustc_driver12run_compilers_0s0_0INtNtCslM5znELOk5i_4core6result6ResultINtNtB2f_6option6OptionNtB6_6LinkerENtCshthk7JDUYGg_12rustc_errors15ErrorGuarante
             6: RINvCs6uSsza6NDuD_10rustc_span15with_source_mapINtNtCslM5znELOk5i_4core6result6ResultuNtCshthk7JDUYGg_12rustc_errors15ErrorGuaranteedENCNCINvNtCsiwHPejSviHg_15rustc_interface9interface12run_compilerBJ_NCNvCs7PhwInflpyf_12rustc_driver12run_compilers_0E00EB
             7: RINvMs_Cs9yvsqs6YnUZ_10scoped_tlsINtB5_9ScopedKeyNtCs6uSsza6NDuD_10rustc_span14SessionGlobalsE3setNCINvNtCsiwHPejSviHg_15rustc_interface9interface12run_compilerINtNtCslM5znELOk5i_4core6result6ResultuNtCshthk7JDUYGg_12rustc_errors15ErrorGuaranteedENCNvCs7P
             8: RINvNtNtCs5xszGlR5JQw_3std10sys_common9backtrace28___rust_begin_short_backtraceNCNCINvNtCsiwHPejSviHg_15rustc_interface4util31run_in_thread_pool_with_globalsNCINvNtB1o_9interface12run_compilerINtNtCslM5znELOk5i_4core6result6ResultuNtCshthk7JDUYGg_12rustc_
             9: RINvNtCs5xszGlR5JQw_3std9panicking3tryINtNtCslM5znELOk5i_4core6result6ResultuNtCshthk7JDUYGg_12rustc_errors15ErrorGuaranteedEINtNtNtBF_5panic11unwind_safe16AssertUnwindSafeNCNCINvMNtB4_6threadNtB2S_7Builder16spawn_unchecked_NCNCINvNtCsiwHPejSviHg_15rustc_
            10: <std::thread::Builder>::spawn_scoped::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver::run_compiler::{closure#0}>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
            11: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
            12: std::sys::windows::thread::Thread::new
            13: BaseThreadInitThunk
            14: RtlUserThreadStart

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-dev running on x86_64-pc-windows-msvc

note: compiler flags: --crate-type lib -C opt-level=3 -C embed-bitcode=no -C debuginfo=0 -Z unstable-options -C incremental=[REDACTED] -C symbol-mangling-version=legacy -Z unstable-options -Z unstable-options -Z macro-backtrace -C split-debuginfo=packed -C target-feature=+crt-static -C prefer-dynamic -C embed-bitcode=yes -Z crate-attr=doc(html_root_url="https://doc.rust-lang.org/nightly/") -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
error: could not compile `core`
```

</details>

18 months agoRollup merge of #106051 - jyn514:cranelift-std, r=bjorn3
Matthias Krüger [Fri, 23 Dec 2022 00:17:50 +0000 (01:17 +0100)]
Rollup merge of #106051 - jyn514:cranelift-std, r=bjorn3

Allow building std with cranelift

- Don't pass llvm-specific args when using cranelift
- Don't use `asm` in compiler_builtins when using cranelift

r? `@bjorn3` cc `@Mark-Simulacrum`

18 months agoRollup merge of #105978 - jyn514:unused_proc_macro_decl, r=tmiasko
Matthias Krüger [Fri, 23 Dec 2022 00:17:50 +0000 (01:17 +0100)]
Rollup merge of #105978 - jyn514:unused_proc_macro_decl, r=tmiasko

Mark `proc_macro_decls_static` as always used

This would have avoided a bug in https://github.com/rust-lang/rust/pull/104860.

In practice this shouldn't matter since nothing uses the query other than the `dead_code` lint, but this isn't documented as an internal-only query so it seems nice for it to be accurate. I think for `dead_code` it doesn't matter because the relevant code is generated by `rustc_builtin_macros` and isn't linted.

I think `@tmiasko` or `@bjorn3` would be a good reviewer?

r? `@tmiasko`

18 months agoAuto merge of #105036 - jyn514:cargo-docs, r=Mark-Simulacrum
bors [Fri, 23 Dec 2022 00:02:15 +0000 (00:02 +0000)]
Auto merge of #105036 - jyn514:cargo-docs, r=Mark-Simulacrum

Support documenting cargo

The primary motivation is to have the cargo docs show up on https://doc.rust-lang.org/nightly/nightly-rustc/cargo, but as a nice side effect this makes `x doc cargo` work locally.

cc `@rust-lang/cargo`

18 months agoAuto merge of #106054 - matthiaskrgr:rollup-38epsfh, r=matthiaskrgr
bors [Thu, 22 Dec 2022 20:48:33 +0000 (20:48 +0000)]
Auto merge of #106054 - matthiaskrgr:rollup-38epsfh, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #105567 (KCFI test: Also support LLVM 16 output)
 - #105847 (Ensure param-env is const before calling `eval_to_valtree`)
 - #105983 (Add a missing early return in drop tracking `handle_uninhabited_return`)
 - #106027 (rustdoc: simplify CSS and DOM for more-scraped-examples)
 - #106035 (Migrate search tab title color to CSS variable)
 - #106037 (Add regression test for #94293)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

18 months agoSupport documenting Cargo
Joshua Nelson [Mon, 28 Nov 2022 23:10:44 +0000 (18:10 -0500)]
Support documenting Cargo

The primary motivation is to have the cargo docs show up on https://doc.rust-lang.org/nightly/nightly-rustc/cargo, but as a nice side effect this makes `x doc cargo` work locally.

18 months agoAvoid running the `Profile` step twice on `x setup`
Joshua Nelson [Thu, 22 Dec 2022 19:21:48 +0000 (13:21 -0600)]
Avoid running the `Profile` step twice on `x setup`

Prevents runs like the following:
```
$ x setup
Welcome to the Rust project! What do you want to do with x.py?
a) library: Contribute to the standard library
b) compiler: Contribute to the compiler itself
c) codegen: Contribute to the compiler, and also modify LLVM or codegen
d) tools: Contribute to tools which depend on the compiler, but do not modify it directly (e.g. rustdoc, clippy, miri)
e) user: Install Rust from source
Please choose one (a/b/c/d/e): b

To get started, try one of the following commands:
- `x.py check`
- `x.py build`
- `x.py test`
For more suggestions, see https://rustc-dev-guide.rust-lang.org/building/suggested.html
`x.py` will now use the configuration at /home/nilsh/projects/rustfast/src/bootstrap/defaults/config.compiler.toml
Welcome to the Rust project! What do you want to do with x.py?
...
```

18 months agoGive a more helpful error for "trimmed_def_paths construted"
Joshua Nelson [Thu, 22 Dec 2022 18:57:47 +0000 (12:57 -0600)]
Give a more helpful error for "trimmed_def_paths construted"

18 months agoFix the issue number in comment for as_local_call_operand
Tomasz Miąsko [Thu, 22 Dec 2022 00:00:00 +0000 (00:00 +0000)]
Fix the issue number in comment for as_local_call_operand

18 months agoMake `sess.bug` much less noisy
Joshua Nelson [Thu, 22 Dec 2022 18:43:27 +0000 (12:43 -0600)]
Make `sess.bug` much less noisy

Before:

```
   Compiling core v0.0.0 (C:\Users\Joshua Nelson\src\rust2\library\core)
error: internal compiler error: no warnings or errors encountered even though `delayed_good_path_bugs` issued

error: internal compiler error: oops
  |
  = note: delayed at    0: std::backtrace_rs::backtrace::trace_unsynchronized
             1: std::backtrace::Backtrace::disabled
             2: std::backtrace::Backtrace::force_capture
             3: <rustc_errors::Handler>::delay_good_path_bug::<&str>
             4: <rustc_interface::passes::QueryContext>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}::{closure#2}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
             5: RINvMs2_NtCsiwHPejSviHg_15rustc_interface7queriesNtNtB8_9interface8Compiler5enterNCNCNvCs7PhwInflpyf_12rustc_driver12run_compilers_0s0_0INtNtCslM5znELOk5i_4core6result6ResultINtNtB2f_6option6OptionNtB6_6LinkerENtCshthk7JDUYGg_12rustc_errors15ErrorGuarante
             6: RINvCs6uSsza6NDuD_10rustc_span15with_source_mapINtNtCslM5znELOk5i_4core6result6ResultuNtCshthk7JDUYGg_12rustc_errors15ErrorGuaranteedENCNCINvNtCsiwHPejSviHg_15rustc_interface9interface12run_compilerBJ_NCNvCs7PhwInflpyf_12rustc_driver12run_compilers_0E00EB
             7: RINvMs_Cs9yvsqs6YnUZ_10scoped_tlsINtB5_9ScopedKeyNtCs6uSsza6NDuD_10rustc_span14SessionGlobalsE3setNCINvNtCsiwHPejSviHg_15rustc_interface9interface12run_compilerINtNtCslM5znELOk5i_4core6result6ResultuNtCshthk7JDUYGg_12rustc_errors15ErrorGuaranteedENCNvCs7P
             8: RINvNtNtCs5xszGlR5JQw_3std10sys_common9backtrace28___rust_begin_short_backtraceNCNCINvNtCsiwHPejSviHg_15rustc_interface4util31run_in_thread_pool_with_globalsNCINvNtB1o_9interface12run_compilerINtNtCslM5znELOk5i_4core6result6ResultuNtCshthk7JDUYGg_12rustc_
             9: RINvNtCs5xszGlR5JQw_3std9panicking3tryINtNtCslM5znELOk5i_4core6result6ResultuNtCshthk7JDUYGg_12rustc_errors15ErrorGuaranteedEINtNtNtBF_5panic11unwind_safe16AssertUnwindSafeNCNCINvMNtB4_6threadNtB2S_7Builder16spawn_unchecked_NCNCINvNtCsiwHPejSviHg_15rustc_
            10: <std::thread::Builder>::spawn_scoped::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver::run_compiler::{closure#0}>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
            11: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
            12: std::sys::windows::thread::Thread::new
            13: BaseThreadInitThunk
            14: RtlUserThreadStart

thread 'rustc' panicked at 'Box<dyn Any>', compiler\rustc_errors\src\lib.rs:1610:13
stack backtrace:
   0:     0x7fffbe935a15 - std::backtrace_rs::backtrace::trace_unsynchronized::h2a29ea0a35c1f799
   1:     0x7fffbe968811 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h5e4ca8af47bfbcc0
   2:     0x7fffbe98aeab - core::fmt::write::h152a9de2569e7dc7
   3:     0x7fffbe961059 - std::io::Write::write_fmt::h2452e19093defac4
   4:     0x7fffbe96866b - std::sys_common::backtrace::print::h550d034f7b77d60a
   5:     0x7fffbe93be1b - std::panicking::default_hook::h3969ead74039b801
   6:     0x7fffbe93bbad - std::panicking::default_hook::h3969ead74039b801
   7:     0x7fffa5f0abe3 - rustc_driver[5b2ae43fbecaf219]::handle_options
   8:     0x7fffbe93c25b - std::panicking::rust_panic_with_hook::h32bbe3ce24999160
   9:     0x7fffa82baee5 - std[4086331e48bff2f6]::sys_common::backtrace::__rust_end_short_backtrace::<std[4086331e48bff2f6]::panicking::begin_panic<&str>::{closure#0}, !>
  10:     0x7fffa82bae89 - std[4086331e48bff2f6]::sys_common::backtrace::__rust_end_short_backtrace::<std[4086331e48bff2f6]::panicking::begin_panic<rustc_errors[cb829533098ec0fe]::ExplicitBug>::{closure#0}, !>
  11:     0x7fffa867ed89 - std[4086331e48bff2f6]::panicking::begin_panic::<rustc_errors[cb829533098ec0fe]::ExplicitBug>
  12:     0x7fffa8298de9 - <alloc[284c8fe3a98c29c4]::string::String as core[fda266aeadfb153a]::fmt::Write>::write_fmt
  13:     0x7fffa829b7e2 - <rustc_errors[cb829533098ec0fe]::HandlerInner>::flush_delayed::<core[fda266aeadfb153a]::iter::adapters::map::Map<alloc[284c8fe3a98c29c4]::vec::into_iter::IntoIter<rustc_errors[cb829533098ec0fe]::DelayedDiagnostic>, <rustc_errors[cb829533098ec0fe]::DelayedDiagnostic>::decorate>, &str>
  14:     0x7fffa8288638 - <rustc_errors[cb829533098ec0fe]::HandlerInner as core[fda266aeadfb153a]::ops::drop::Drop>::drop
  15:     0x7fffa5eb90e1 - core[fda266aeadfb153a]::ptr::drop_in_place::<rustc_errors[cb829533098ec0fe]::Handler>
  16:     0x7fffa5ebe9fd - core[fda266aeadfb153a]::ptr::drop_in_place::<rustc_session[e703468b2407e34a]::cgu_reuse_tracker::CguReuseTracker>
  17:     0x7fffa5ec0d7c - core[fda266aeadfb153a]::ptr::drop_in_place::<rustc_session[e703468b2407e34a]::session::Session>
  18:     0x7fffa5ebe41c - core[fda266aeadfb153a]::ptr::drop_in_place::<rustc_interface[d7cd35f07e7e6ecc]::interface::Compiler>
  19:     0x7fffa5eea05f - RINvCs6uSsza6NDuD_10rustc_span15with_source_mapINtNtCslM5znELOk5i_4core6result6ResultuNtCshthk7JDUYGg_12rustc_errors15ErrorGuaranteedENCNCINvNtCsiwHPejSviHg_15rustc_interface9interface12run_compilerBJ_NCNvCs7PhwInflpyf_12rustc_driver12run_compilers_0E00EB
  20:     0x7fffa5edbe3a - RINvMs_Cs9yvsqs6YnUZ_10scoped_tlsINtB5_9ScopedKeyNtCs6uSsza6NDuD_10rustc_span14SessionGlobalsE3setNCINvNtCsiwHPejSviHg_15rustc_interface9interface12run_compilerINtNtCslM5znELOk5i_4core6result6ResultuNtCshthk7JDUYGg_12rustc_errors15ErrorGuaranteedENCNvCs7P
  21:     0x7fffa5ef4ec9 - RINvNtNtCs5xszGlR5JQw_3std10sys_common9backtrace28___rust_begin_short_backtraceNCNCINvNtCsiwHPejSviHg_15rustc_interface4util31run_in_thread_pool_with_globalsNCINvNtB1o_9interface12run_compilerINtNtCslM5znELOk5i_4core6result6ResultuNtCshthk7JDUYGg_12rustc_
  22:     0x7fffa5ee9935 - RINvNtCs5xszGlR5JQw_3std9panicking3tryINtNtCslM5znELOk5i_4core6result6ResultuNtCshthk7JDUYGg_12rustc_errors15ErrorGuaranteedEINtNtNtBF_5panic11unwind_safe16AssertUnwindSafeNCNCINvMNtB4_6threadNtB2S_7Builder16spawn_unchecked_NCNCINvNtCsiwHPejSviHg_15rustc_
  23:     0x7fffa5f0d770 - <std[4086331e48bff2f6]::thread::Builder>::spawn_scoped::<rustc_interface[d7cd35f07e7e6ecc]::util::run_in_thread_pool_with_globals<rustc_interface[d7cd35f07e7e6ecc]::interface::run_compiler<(), rustc_driver[5b2ae43fbecaf219]::run_compiler::{closure#0}>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  24:     0x7fffbe95b35b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hfcd927f7aebafa45
  25:     0x7fffbe9331d3 - std::sys::windows::thread::Thread::new::hf8f4c920eaebd965
  26:     0x7ff815877614 - BaseThreadInitThunk
  27:     0x7ff8166e26a1 - RtlUserThreadStart

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-dev running on x86_64-pc-windows-msvc

note: compiler flags: --crate-type lib -C opt-level=3 -C embed-bitcode=no -C debuginfo=0 -Z unstable-options -C incremental=[REDACTED] -C symbol-mangling-version=legacy -Z unstable-options -Z unstable-options -Z macro-backtrace -C split-debuginfo=packed -C target-feature=+crt-static -C prefer-dynamic -C embed-bitcode=yes -Z crate-attr=doc(html_root_url="https://doc.rust-lang.org/nightly/") -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
error: could not compile `core`
```

After:
```
   Compiling core v0.0.0 (C:\Users\Joshua Nelson\src\rust2\library\core)
error: internal compiler error: no warnings or errors encountered even though `delayed_good_path_bugs` issued

error: internal compiler error: oops
  |
  = note: delayed at    0: std::backtrace_rs::backtrace::trace_unsynchronized
             1: std::backtrace::Backtrace::disabled
             2: std::backtrace::Backtrace::force_capture
             3: <rustc_errors::Handler>::delay_good_path_bug::<&str>
             4: <rustc_interface::passes::QueryContext>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}::{closure#2}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
             5: RINvMs2_NtCsiwHPejSviHg_15rustc_interface7queriesNtNtB8_9interface8Compiler5enterNCNCNvCs7PhwInflpyf_12rustc_driver12run_compilers_0s0_0INtNtCslM5znELOk5i_4core6result6ResultINtNtB2f_6option6OptionNtB6_6LinkerENtCshthk7JDUYGg_12rustc_errors15ErrorGuarante
             6: RINvCs6uSsza6NDuD_10rustc_span15with_source_mapINtNtCslM5znELOk5i_4core6result6ResultuNtCshthk7JDUYGg_12rustc_errors15ErrorGuaranteedENCNCINvNtCsiwHPejSviHg_15rustc_interface9interface12run_compilerBJ_NCNvCs7PhwInflpyf_12rustc_driver12run_compilers_0E00EB
             7: RINvMs_Cs9yvsqs6YnUZ_10scoped_tlsINtB5_9ScopedKeyNtCs6uSsza6NDuD_10rustc_span14SessionGlobalsE3setNCINvNtCsiwHPejSviHg_15rustc_interface9interface12run_compilerINtNtCslM5znELOk5i_4core6result6ResultuNtCshthk7JDUYGg_12rustc_errors15ErrorGuaranteedENCNvCs7P
             8: RINvNtNtCs5xszGlR5JQw_3std10sys_common9backtrace28___rust_begin_short_backtraceNCNCINvNtCsiwHPejSviHg_15rustc_interface4util31run_in_thread_pool_with_globalsNCINvNtB1o_9interface12run_compilerINtNtCslM5znELOk5i_4core6result6ResultuNtCshthk7JDUYGg_12rustc_
             9: RINvNtCs5xszGlR5JQw_3std9panicking3tryINtNtCslM5znELOk5i_4core6result6ResultuNtCshthk7JDUYGg_12rustc_errors15ErrorGuaranteedEINtNtNtBF_5panic11unwind_safe16AssertUnwindSafeNCNCINvMNtB4_6threadNtB2S_7Builder16spawn_unchecked_NCNCINvNtCsiwHPejSviHg_15rustc_
            10: <std::thread::Builder>::spawn_scoped::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver::run_compiler::{closure#0}>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
            11: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
            12: std::sys::windows::thread::Thread::new
            13: BaseThreadInitThunk
            14: RtlUserThreadStart

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-dev running on x86_64-pc-windows-msvc

note: compiler flags: --crate-type lib -C opt-level=3 -C embed-bitcode=no -C debuginfo=0 -Z unstable-options -C incremental=[REDACTED] -C symbol-mangling-version=legacy -Z unstable-options -Z unstable-options -Z macro-backtrace -C split-debuginfo=packed -C target-feature=+crt-static -C prefer-dynamic -C embed-bitcode=yes -Z crate-attr=doc(html_root_url="https://doc.rust-lang.org/nightly/") -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
error: could not compile `core`
```

18 months agoRollup merge of #106037 - JohnTitor:issue-94293, r=lcnr
Matthias Krüger [Thu, 22 Dec 2022 18:36:15 +0000 (19:36 +0100)]
Rollup merge of #106037 - JohnTitor:issue-94293, r=lcnr

Add regression test for #94293

Closes #94293
r? ```@lcnr```

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
18 months agoRollup merge of #106035 - GuillaumeGomez:migrate-css-var-search-tab-title-color,...
Matthias Krüger [Thu, 22 Dec 2022 18:36:14 +0000 (19:36 +0100)]
Rollup merge of #106035 - GuillaumeGomez:migrate-css-var-search-tab-title-color, r=notriddle

Migrate search tab title color to CSS variable

r? ```@notriddle```

18 months agoRollup merge of #106027 - notriddle:notriddle/more-scraped-examples-inner, r=Guillaum...
Matthias Krüger [Thu, 22 Dec 2022 18:36:14 +0000 (19:36 +0100)]
Rollup merge of #106027 - notriddle:notriddle/more-scraped-examples-inner, r=GuillaumeGomez

rustdoc: simplify CSS and DOM for more-scraped-examples

This gets rid of the more-scraped-examples-inner wrapper, instead nesting the children directly and using absolute positioning for the toggle line.

18 months agoRollup merge of #105983 - compiler-errors:issue-105981, r=tmiasko
Matthias Krüger [Thu, 22 Dec 2022 18:36:13 +0000 (19:36 +0100)]
Rollup merge of #105983 - compiler-errors:issue-105981, r=tmiasko

Add a missing early return in drop tracking `handle_uninhabited_return`

This return is needed so we don't call `Ty::is_inhabited_from` from a type with ty/ct vars in it.

Fixes #105981

18 months agoRollup merge of #105847 - compiler-errors:issue-104396, r=oli-obk
Matthias Krüger [Thu, 22 Dec 2022 18:36:13 +0000 (19:36 +0100)]
Rollup merge of #105847 - compiler-errors:issue-104396, r=oli-obk

Ensure param-env is const before calling `eval_to_valtree`

Other queries call `ParamEnv::with_const` *inside* of the query itself (e.g. `const_eval_global_id_for_typeck`), so this could alternatively be moved into the provider of `eval_to_valtree` instead. I don't have a particularly strong opinion, though *theoretically* caching is better if we make the query keys more constrained.

I'm not exactly sure how this is an effect of the `-Zmir-opt-level=3` flag. Maybe something about the inliner causes us to inline an unevaluated const into a body where it can be evaluated, but where it has not yet been normalized.

This seems likely, since we're inlining `from_fn_1::<{ N / 2 }, _>` in `from_fn_2`, which means that we will need to evaluate that constant during the const prop pass after inlining.

Fixes #104396

18 months agoRollup merge of #105567 - TimNN:kcfi16, r=nikic
Matthias Krüger [Thu, 22 Dec 2022 18:36:12 +0000 (19:36 +0100)]
Rollup merge of #105567 - TimNN:kcfi16, r=nikic

KCFI test: Also support LLVM 16 output

With a regex we can support the LLVM 16 output now already (and there are some third-party build bots that test Rust with LLVM head, like https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds?branch=master).

cc ```@rcvalle```

18 months agoMark `proc_macro_decls_static` as always used
Joshua Nelson [Thu, 22 Dec 2022 17:16:29 +0000 (11:16 -0600)]
Mark `proc_macro_decls_static` as always used

This would have avoided a bug in https://github.com/rust-lang/rust/pull/104860.

In practice this shouldn't matter since nothing uses the query other than the `dead_code` lint,
but this isn't documented as an internal-only query so it seems nice for it to be accurate.
I think for `dead_code` it doesn't matter because the relevant code is generated by `rustc_builtin_macros` and isn't linted.

18 months agoTake revision into account in src/test/ui incremental tests
Michael Goulet [Thu, 22 Dec 2022 17:59:26 +0000 (17:59 +0000)]
Take revision into account in src/test/ui incremental tests

18 months agoUse separate files instead of revisions
Michael Goulet [Thu, 22 Dec 2022 17:51:45 +0000 (17:51 +0000)]
Use separate files instead of revisions

18 months agoAllow building std with cranelift
Joshua Nelson [Thu, 22 Dec 2022 16:34:27 +0000 (10:34 -0600)]
Allow building std with cranelift

- Don't pass llvm-specific args when using cranelift
- Don't use `asm` in compiler_builtins when using cranelift

18 months agoAuto merge of #103957 - JakobDegen:drop-retag, r=RalfJung
bors [Thu, 22 Dec 2022 17:48:43 +0000 (17:48 +0000)]
Auto merge of #103957 - JakobDegen:drop-retag, r=RalfJung

Retag as FnEntry on `drop_in_place`

This commit changes the mir drop shim to always retag its argument as if it were a `&mut`.

cc rust-lang/unsafe-code-guidelines#373

18 months agoAuto merge of #106000 - nikic:lld-build, r=Mark-Simulacrum
bors [Thu, 22 Dec 2022 13:59:15 +0000 (13:59 +0000)]
Auto merge of #106000 - nikic:lld-build, r=Mark-Simulacrum

Make LLD build forward-compatible with LLVM 16

Switch to using the cmake module instead of llvm-config. I believe this also removes the need for llvm-config-wrapper.

18 months agoUse LLVM_CMAKE_DIR for lld build
Nikita Popov [Tue, 20 Dec 2022 16:07:04 +0000 (17:07 +0100)]
Use LLVM_CMAKE_DIR for lld build

LLVM_CONFIG_PATH is no longer supported as of LLVM 16, switch to
using the cmake module instead.

We separately return the llvm-config and cmake directory paths,
because llvm-config always refers to the host binary, while
the cmake directory is for the target triple.

18 months agoAdd regression test for #94293
Yuki Okushi [Thu, 22 Dec 2022 11:29:20 +0000 (20:29 +0900)]
Add regression test for #94293

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
18 months agoAuto merge of #106034 - matthiaskrgr:rollup-2zpql33, r=matthiaskrgr
bors [Thu, 22 Dec 2022 11:06:51 +0000 (11:06 +0000)]
Auto merge of #106034 - matthiaskrgr:rollup-2zpql33, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #104741 (Switch `#[track_caller]` back to a no-op unless feature gate is enabled)
 - #105769 (add function to tell the identical errors for ambiguity_errors)
 - #105843 (Suggest associated const on possible capitalization mistake)
 - #105966 (Re-enable `Fn` trait call notation error for non-tuple argument)
 - #106002 (codegen tests: adapt patterns to also work with v0 symbol mangling)
 - #106010 (Give opaque types a better coherence error)
 - #106016 (rustdoc: simplify link anchor to section expand JS)
 - #106024 (Fix ICE due to `todo!()` in `rustdoc` for `Term`s)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

18 months agoExtend search GUI test to include search tab title color check
Guillaume Gomez [Thu, 22 Dec 2022 10:38:59 +0000 (11:38 +0100)]
Extend search GUI test to include search tab title color check

18 months agoMigrate search tab title color to CSS variable
Guillaume Gomez [Thu, 22 Dec 2022 10:38:39 +0000 (11:38 +0100)]
Migrate search tab title color to CSS variable

18 months agoRollup merge of #106024 - JulianKnodt:add_term_html_docs, r=notriddle
Matthias Krüger [Thu, 22 Dec 2022 10:03:53 +0000 (11:03 +0100)]
Rollup merge of #106024 - JulianKnodt:add_term_html_docs, r=notriddle

Fix ICE due to `todo!()` in `rustdoc` for `Term`s

Left a todo awhile ago (I think), so fill it in to print a const for `Term`s.

Fixes #105952.

Should I add some annotations to the rustdoc test?

18 months agoRollup merge of #106016 - notriddle:notriddle/link-has-onclick, r=GuillaumeGomez
Matthias Krüger [Thu, 22 Dec 2022 10:03:52 +0000 (11:03 +0100)]
Rollup merge of #106016 - notriddle:notriddle/link-has-onclick, r=GuillaumeGomez

rustdoc: simplify link anchor to section expand JS

18 months agoRollup merge of #106010 - oli-obk:tait_coherence_diagnostic, r=compiler-errors
Matthias Krüger [Thu, 22 Dec 2022 10:03:52 +0000 (11:03 +0100)]
Rollup merge of #106010 - oli-obk:tait_coherence_diagnostic, r=compiler-errors

Give opaque types a better coherence error

18 months agoRollup merge of #106002 - krasimirgg:v0sym, r=tmiasko
Matthias Krüger [Thu, 22 Dec 2022 10:03:51 +0000 (11:03 +0100)]
Rollup merge of #106002 - krasimirgg:v0sym, r=tmiasko

codegen tests: adapt patterns to also work with v0 symbol mangling

No functional changes intended.

These tests were failing under `new-symbol-mangling = true`, cf. https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/a.20few.20panic-abort.20tests.20fail.20under.20.60new-symbol-mangling.60.
This adapts the patterns to work in this case.

18 months agoRollup merge of #105966 - compiler-errors:issue-105936, r=eholk
Matthias Krüger [Thu, 22 Dec 2022 10:03:51 +0000 (11:03 +0100)]
Rollup merge of #105966 - compiler-errors:issue-105936, r=eholk

Re-enable `Fn` trait call notation error for non-tuple argument

I have no idea why I delayed this bug... but also there doesn't seem to be a UI test that actually shows a change, so maybe that's why.

Fixes #105936

18 months agoRollup merge of #105843 - compiler-errors:sugg-const, r=lcnr
Matthias Krüger [Thu, 22 Dec 2022 10:03:50 +0000 (11:03 +0100)]
Rollup merge of #105843 - compiler-errors:sugg-const, r=lcnr

Suggest associated const on possible capitalization mistake

Suggest `i32::MAX` if we typed `i32::max` without making a function call.

Fixes #93844

18 months agoRollup merge of #105769 - lyming2007:issue-105177-fix, r=eholk
Matthias Krüger [Thu, 22 Dec 2022 10:03:50 +0000 (11:03 +0100)]
Rollup merge of #105769 - lyming2007:issue-105177-fix, r=eholk

add function to tell the identical errors for ambiguity_errors

if 2 errors of the kind and ident and span of the ident, b1, b2 and misc1 misc2 are the same we call these 2 ambiguity errors identical
prevent identical ambiguity error from pushing into vector of ambiguity_errors this will fix #105177

18 months agoRollup merge of #104741 - bryangarza:bug-104588-async-track-caller, r=compiler-errors
Matthias Krüger [Thu, 22 Dec 2022 10:03:49 +0000 (11:03 +0100)]
Rollup merge of #104741 - bryangarza:bug-104588-async-track-caller, r=compiler-errors

Switch `#[track_caller]` back to a no-op unless feature gate is enabled

This patch fixes a regression, in which `#[track_caller]`, which was previously a no-op, was changed to actually turn on the behavior. This should instead only happen behind the `closure_track_caller` feature gate.

Also, add a warning for the user to understand how their code will compile depending on the feature gate being turned on or not.

Fixes #104588

18 months agoAuto merge of #104889 - GuillaumeGomez:fix-impl-block-in-const-expr, r=notriddle
bors [Thu, 22 Dec 2022 08:37:58 +0000 (08:37 +0000)]
Auto merge of #104889 - GuillaumeGomez:fix-impl-block-in-const-expr, r=notriddle

Fix impl block in const expr

Fixes #83026.

The problem was that we didn't visit block expressions. Considering how big the [walk_expr](https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_hir/intravisit.rs.html#678) function is, I decided to instead implement the `hir` visitor on the struct. It also answers the question which was in a comment for `RustdocVisitor`: we should have used a visitor instead of our ad-hoc implementation.

Adding this visitor also added some extra checks that weren't present before (check changes in `rustdoc-ui` tests).

r? `@notriddle`

18 months agoAuto merge of #106025 - matthiaskrgr:rollup-vz5rqah, r=matthiaskrgr
bors [Thu, 22 Dec 2022 05:30:00 +0000 (05:30 +0000)]
Auto merge of #106025 - matthiaskrgr:rollup-vz5rqah, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #105837 (Don't ICE in `check_must_not_suspend_ty` for mismatched tuple arity)
 - #105932 (Correct branch-protection ModFlagBehavior for Aarch64 on LLVM-15)
 - #105960 (Various cleanups)
 - #105985 (Method chain nitpicks)
 - #105996 (Test that async blocks are `UnwindSafe`)
 - #106012 (Clarify that raw retags are not permitted in Mir)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

18 months agoSuggest associated const on capitalization error
Michael Goulet [Sat, 17 Dec 2022 20:11:29 +0000 (20:11 +0000)]
Suggest associated const on capitalization error

18 months agoAuto merge of #106023 - JohnTitor:rollup-k8mettz, r=JohnTitor
bors [Thu, 22 Dec 2022 02:16:59 +0000 (02:16 +0000)]
Auto merge of #106023 - JohnTitor:rollup-k8mettz, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #105584 (add assert messages if chunks/windows are length 0)
 - #105602 (interpret: add read_machine_[ui]size convenience methods)
 - #105824 (str.lines() docstring: clarify that line endings are not returned)
 - #105980 (Refer to "Waker" rather than "RawWaker" in `drop` comment)
 - #105986 (Fix typo in reading_half_a_pointer.rs)
 - #105995 (Add regression test for #96530)
 - #106008 (Sort lint_groups in no_lint_suggestion)
 - #106014 (Add comment explaining what the scrape-examples-toggle.goml GUI test is about)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

18 months agoChange comment to doc comment
Eric Holk [Thu, 22 Dec 2022 01:28:42 +0000 (17:28 -0800)]
Change comment to doc comment

18 months agoFix ICE
kadmin [Wed, 21 Dec 2022 23:54:29 +0000 (23:54 +0000)]
Fix ICE

Left a todo awhile ago (I think), so fill it in to print a const for `Term`s.

18 months agorustdoc: simplify CSS and DOM for more-scraped-examples
Michael Howell [Thu, 22 Dec 2022 01:03:31 +0000 (18:03 -0700)]
rustdoc: simplify CSS and DOM for more-scraped-examples

This gets rid of the more-scraped-examples-inner wrapper, instead nesting the
children directly and using absolute positioning for the toggle line.

18 months agoDon't run `Drop` terminators on types that do not have drop glue in const eval
Jakob Degen [Wed, 21 Dec 2022 23:22:17 +0000 (15:22 -0800)]
Don't run `Drop` terminators on types that do not have drop glue in const eval

18 months agoRollup merge of #106012 - JakobDegen:retag-raw, r=RalfJung
Matthias Krüger [Thu, 22 Dec 2022 00:01:15 +0000 (01:01 +0100)]
Rollup merge of #106012 - JakobDegen:retag-raw, r=RalfJung

Clarify that raw retags are not permitted in Mir

Not sure when this changed, but documentation and the validator needed to be updated. This also removes raw retags from custom mir.

cc rust-lang/miri#2735

r? `@RalfJung`

18 months agoRollup merge of #105996 - Swatinem:async-is-unwindsafe, r=petrochenkov
Matthias Krüger [Thu, 22 Dec 2022 00:01:14 +0000 (01:01 +0100)]
Rollup merge of #105996 - Swatinem:async-is-unwindsafe, r=petrochenkov

Test that async blocks are `UnwindSafe`

This was a regression from the reverted #105250 which is now covered by a test.

18 months agoRollup merge of #105985 - compiler-errors:method-chain-nitpicks, r=estebank
Matthias Krüger [Thu, 22 Dec 2022 00:01:14 +0000 (01:01 +0100)]
Rollup merge of #105985 - compiler-errors:method-chain-nitpicks, r=estebank

Method chain nitpicks

Just fixing some little things I didn't see in review from that method chain PR.

r? `@estebank`

18 months agoRollup merge of #105960 - oli-obk:effect_cleanup, r=fee1-dead
Matthias Krüger [Thu, 22 Dec 2022 00:01:13 +0000 (01:01 +0100)]
Rollup merge of #105960 - oli-obk:effect_cleanup, r=fee1-dead

Various cleanups

This PR pulls changes out of https://github.com/rust-lang/rust/pull/101900 that can land on master immediately

r? ``@fee1-dead``

18 months agoRollup merge of #105932 - MasterAwesome:aarch64-bti-llvm-15, r=nikic
Matthias Krüger [Thu, 22 Dec 2022 00:01:13 +0000 (01:01 +0100)]
Rollup merge of #105932 - MasterAwesome:aarch64-bti-llvm-15, r=nikic

Correct branch-protection ModFlagBehavior for Aarch64 on LLVM-15

When building with Fat LTO and BTI enabled on aarch64, the BTI is set to `Module::Min` for alloc shim but is set to `Module::Error` for the crate. This was fine when we were using LLVM-14 but LLVM-15 changes it's behaviour to support for compiling with different `mbranch-protection` flags.

Refer:
https://github.com/rust-lang/llvm-project/commit/b0343a38a5910e980bb031e4014655d77cd0c162

fixes https://github.com/rust-lang/rust/issues/102162

18 months agoRollup merge of #105837 - compiler-errors:issue-105728, r=estebank
Matthias Krüger [Thu, 22 Dec 2022 00:01:12 +0000 (01:01 +0100)]
Rollup merge of #105837 - compiler-errors:issue-105728, r=estebank

Don't ICE in `check_must_not_suspend_ty` for mismatched tuple arity

These expressions are just used for their spans, so make it best-effort here.

Fixes #105728

18 months agoRollup merge of #106014 - GuillaumeGomez:add-gui-explanations-scrape-examples-toggle...
Yuki Okushi [Wed, 21 Dec 2022 23:32:13 +0000 (08:32 +0900)]
Rollup merge of #106014 - GuillaumeGomez:add-gui-explanations-scrape-examples-toggle, r=notriddle

Add comment explaining what the scrape-examples-toggle.goml GUI test is about

r? `@notriddle`

18 months agoRollup merge of #106008 - uweigand:s390x-lintgroup-order, r=Nilstrieb
Yuki Okushi [Wed, 21 Dec 2022 23:32:12 +0000 (08:32 +0900)]
Rollup merge of #106008 - uweigand:s390x-lintgroup-order, r=Nilstrieb

Sort lint_groups in no_lint_suggestion

The no_lint_suggestion routine passes a vector of lint group names to find_best_match_for_name.  That routine depends on the sort order of its input vector, which matters in case multiple inputs are at the same Levenshtein distance to the target name.

However, no_lint_suggestion currently just passes lint_groups.keys() as input vector - this is sorted in hash value order, which is not guaranteed to be stable, and in fact differs between big- and little-endian host platforms, causing test failures on s390x.

To fix this, always sort the lint groups before using their names as input to find_best_match_for_name.  In doing so, prefer non- deprecated lint group names over deprecated ones, and then use alphabetical order.

Fixes https://github.com/rust-lang/rust/issues/105379

18 months agoRollup merge of #105995 - JohnTitor:issue-96530, r=compiler-errors
Yuki Okushi [Wed, 21 Dec 2022 23:32:12 +0000 (08:32 +0900)]
Rollup merge of #105995 - JohnTitor:issue-96530, r=compiler-errors

Add regression test for #96530

Closes #96530
r? `@compiler-errors`

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
18 months agoRollup merge of #105986 - eltociear:patch-18, r=RalfJung
Yuki Okushi [Wed, 21 Dec 2022 23:32:11 +0000 (08:32 +0900)]
Rollup merge of #105986 - eltociear:patch-18, r=RalfJung

Fix typo in reading_half_a_pointer.rs

gurantee -> guarantee

18 months agoRollup merge of #105980 - goffrie:waker-drop, r=thomcc
Yuki Okushi [Wed, 21 Dec 2022 23:32:11 +0000 (08:32 +0900)]
Rollup merge of #105980 - goffrie:waker-drop, r=thomcc

Refer to "Waker" rather than "RawWaker" in `drop` comment

In my view this is technically more correct as `Waker` actually implements `Drop` (which calls the `drop` method) whereas `RawWaker` does not.

18 months agoRollup merge of #105824 - zacchiro:patch-1, r=JohnTitor
Yuki Okushi [Wed, 21 Dec 2022 23:32:10 +0000 (08:32 +0900)]
Rollup merge of #105824 - zacchiro:patch-1, r=JohnTitor

str.lines() docstring: clarify that line endings are not returned

Previously, the str.lines() docstring stated that lines are split at line endings, but not whether those were returned or not.  This new version of the docstring states this explicitly, avoiding the need of getting to doctests to get an answer to this FAQ.

18 months agoRollup merge of #105602 - RalfJung:read-convenience, r=oli-obk
Yuki Okushi [Wed, 21 Dec 2022 23:32:10 +0000 (08:32 +0900)]
Rollup merge of #105602 - RalfJung:read-convenience, r=oli-obk

interpret: add read_machine_[ui]size convenience methods

We have `read_pointer`, so it felt inconsistent to not also have these.

r? ```@oli-obk```

18 months agoRollup merge of #105584 - raffimolero:patch-1, r=JohnTitor
Yuki Okushi [Wed, 21 Dec 2022 23:32:09 +0000 (08:32 +0900)]
Rollup merge of #105584 - raffimolero:patch-1, r=JohnTitor

add assert messages if chunks/windows are length 0

18 months agoUpdate track_caller tests; run fmt
Bryan Garza [Wed, 21 Dec 2022 23:22:56 +0000 (23:22 +0000)]
Update track_caller tests; run fmt

18 months agoAuto merge of #105613 - Nilstrieb:rename-assert_uninit_valid, r=RalfJung
bors [Wed, 21 Dec 2022 23:20:04 +0000 (23:20 +0000)]
Auto merge of #105613 - Nilstrieb:rename-assert_uninit_valid, r=RalfJung

Rename `assert_uninit_valid` intrinsic

It's not about "uninit" anymore but about "filling with 0x01 bytes" so the name should at least try to reflect that.

This is actually not fully correct though, as it does still panic for all uninit with `-Zstrict-init-checks`. I'm not sure what the best way is to deal with that not causing confusion. I guess we could just remove the flag? I don't think having it makes a lot of sense anymore with the direction that we have chose to go. It could be relevant again if #100423 lands so removing it may be a bit over eager.

r? `@RalfJung`

18 months agoBless tests
Jakob Degen [Sat, 10 Dec 2022 03:05:49 +0000 (19:05 -0800)]
Bless tests

18 months agoRetag argument to `drop_in_place` unconditionally
Jakob Degen [Tue, 6 Dec 2022 09:18:24 +0000 (01:18 -0800)]
Retag argument to `drop_in_place` unconditionally

18 months agoRetag as FnEntry on `drop_in_place`
Jakob Degen [Fri, 4 Nov 2022 07:05:15 +0000 (00:05 -0700)]
Retag as FnEntry on `drop_in_place`

18 months agorustdoc: simplify link anchor to section expand JS
Michael Howell [Wed, 21 Dec 2022 20:28:42 +0000 (13:28 -0700)]
rustdoc: simplify link anchor to section expand JS

18 months agoAuto merge of #105979 - matthiaskrgr:rollup-2luw3mx, r=matthiaskrgr
bors [Wed, 21 Dec 2022 20:19:22 +0000 (20:19 +0000)]
Auto merge of #105979 - matthiaskrgr:rollup-2luw3mx, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #105791 (docs: add long error explanation for error E0472)
 - #105897 (Fix an opaque type ICE)
 - #105904 (Fix arch flag on i686-apple-darwin)
 - #105949 (Bump `cfg-if` to `1.0` in rustc crates)
 - #105964 (rustdoc: prevent CSS layout of line numbers shrinking into nothing)
 - #105972 (rustdoc: simplify section anchor CSS)
 - #105973 (Avoid going through the happy path in case of non-fn builtin calls)
 - #105976 (Remove unused `check-stage2-T-arm-linux-androideabi-H-x86_64-unknown-linux-gnu` make rule)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

18 months agoForbid `RetagKind::TwoPhase` as well
Jakob Degen [Wed, 21 Dec 2022 19:46:13 +0000 (11:46 -0800)]
Forbid `RetagKind::TwoPhase` as well

18 months agoAdd comment explaining what the scrape-examples-toggle.goml GUI test is about
Guillaume Gomez [Wed, 21 Dec 2022 19:21:31 +0000 (20:21 +0100)]
Add comment explaining what the scrape-examples-toggle.goml GUI test is about

18 months agoClarify that raw retags are not permitted in Mir
Jakob Degen [Wed, 21 Dec 2022 18:30:38 +0000 (10:30 -0800)]
Clarify that raw retags are not permitted in Mir

18 months agoSort lint_groups in no_lint_suggestion
Ulrich Weigand [Wed, 21 Dec 2022 16:27:45 +0000 (17:27 +0100)]
Sort lint_groups in no_lint_suggestion

The no_lint_suggestion routine passes a vector of lint group names
to find_best_match_for_name.  That routine depends on the sort
order of its input vector, which matters in case multiple inputs
are at the same Levenshtein distance to the target name.

However, no_lint_suggestion currently just passes lint_groups.keys()
as input vector - this is sorted in hash value order, which is not
guaranteed to be stable, and in fact differs between big- and
little-endian host platforms, causing test failures on s390x.

To fix this, always sort the lint groups before using their names
as input to find_best_match_for_name.  In addition, deprecated
lint groups should never be suggested, so filter those out.

Fixes https://github.com/rust-lang/rust/issues/105379

18 months agoGive opaque types a better coherence error
Oli Scherer [Wed, 21 Dec 2022 17:44:30 +0000 (17:44 +0000)]
Give opaque types a better coherence error

18 months agoAuto merge of #105812 - ojeda:no-jump-tables, r=nikic
bors [Wed, 21 Dec 2022 17:38:38 +0000 (17:38 +0000)]
Auto merge of #105812 - ojeda:no-jump-tables, r=nikic

Add `-Zno-jump-tables`

This flag mimics GCC/Clang's `-fno-jump-tables` [1][2], which makes the codegen backend avoid generating jump tables when lowering switches.

In the case of LLVM, the `"no-jump-tables"="true"` function attribute is added to every function.

The kernel currently needs it for x86 when enabling IBT [3], as well as for Alpha (plus VDSO objects in MIPS/LoongArch).

[1] https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#index-fno-jump-tables
[2] https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fjump-tables
[3] https://github.com/torvalds/linux/blob/v6.1/arch/x86/Makefile#L75-L83

18 months agocodegen tests: adapt patterns to also work with v0 symbol mangling
Krasimir Georgiev [Wed, 21 Dec 2022 14:19:04 +0000 (14:19 +0000)]
codegen tests: adapt patterns to also work with v0 symbol mangling

No functional changes intended.

These tests were failing under `new-symbol-mangling = true`.
This adapts the patterns to work in this case.

18 months agoAuto merge of #100390 - jhpratt:float-from-bool, r=dtolnay
bors [Wed, 21 Dec 2022 14:27:57 +0000 (14:27 +0000)]
Auto merge of #100390 - jhpratt:float-from-bool, r=dtolnay

Implement `From<bool>` for f32, f64

As is required for trait implementations, these are insta-stable. Given there is a release tomorrow and this needs FCP, I set 1.65 as the stable version.

`@rustbot` label +A-floating-point +C-feature-request +needs-fcp +relnotes +S-waiting-on-review +T-libs-api -T-libs

18 months agoTest that async blocks are UnwindSafe
Arpad Borsos [Wed, 21 Dec 2022 12:41:28 +0000 (13:41 +0100)]
Test that async blocks are UnwindSafe

This was a regression from the reverted #105250 which is now covered by a test.

18 months agoAdd regression test for #96530
Yuki Okushi [Wed, 21 Dec 2022 12:10:30 +0000 (21:10 +0900)]
Add regression test for #96530

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
18 months agoDon't explicitly set C++ standard for lld
Nikita Popov [Tue, 20 Dec 2022 15:02:15 +0000 (16:02 +0100)]
Don't explicitly set C++ standard for lld

LLVM does this itself since 606cb8548a1b7763e0c8489c5efe66803a7ede72,
and 14 is no longer the correct standard when building lld 16,
causing build failures.

18 months agoless specific wording
Ralf Jung [Wed, 21 Dec 2022 10:06:20 +0000 (11:06 +0100)]
less specific wording

18 months agoFix typo in reading_half_a_pointer.rs
Ikko Ashimine [Wed, 21 Dec 2022 06:34:21 +0000 (15:34 +0900)]
Fix typo in reading_half_a_pointer.rs

gurantee -> guarantee

18 months agoDon't call typeck if we have no typeck results
Michael Goulet [Wed, 21 Dec 2022 05:49:12 +0000 (05:49 +0000)]
Don't call typeck if we have no typeck results

This has a 10000000% chance of us causing a cycle if we're not careful

18 months agoCollectAllMismatches relation should respect int/float infer vars
Michael Goulet [Wed, 21 Dec 2022 05:42:48 +0000 (05:42 +0000)]
CollectAllMismatches relation should respect int/float infer vars

18 months agoRename things to be a bit clearer
Michael Goulet [Wed, 21 Dec 2022 05:53:55 +0000 (05:53 +0000)]
Rename things to be a bit clearer

18 months agoSubstitute things correctly
Michael Goulet [Wed, 21 Dec 2022 05:36:26 +0000 (05:36 +0000)]
Substitute things correctly

18 months agoRemove some unnecessary try_map_bound
Michael Goulet [Wed, 21 Dec 2022 05:07:50 +0000 (05:07 +0000)]
Remove some unnecessary try_map_bound

18 months agoforgot a return in drop tracking handle_uninhabited_return
Michael Goulet [Wed, 21 Dec 2022 05:03:11 +0000 (05:03 +0000)]
forgot a return in drop tracking handle_uninhabited_return

18 months agoImprove code based on feedback.
Bryan Garza [Wed, 21 Dec 2022 03:13:28 +0000 (03:13 +0000)]
Improve code based on feedback.

This patch improves the readability of some of the code by using
if-let-chains. Also, make use of the `add_feature_diagnostics` function.

18 months agoAdd lint doc comment
Bryan Garza [Wed, 7 Dec 2022 20:26:56 +0000 (20:26 +0000)]
Add lint doc comment

18 months agoUpdate track_caller logic/lint after rebase
Bryan Garza [Wed, 7 Dec 2022 20:13:22 +0000 (20:13 +0000)]
Update track_caller logic/lint after rebase

18 months agoupdate wording of lint
Bryan Garza [Thu, 24 Nov 2022 03:48:27 +0000 (03:48 +0000)]
update wording of lint

18 months agoUpdate code based on PR comments
Bryan Garza [Thu, 24 Nov 2022 03:39:47 +0000 (03:39 +0000)]
Update code based on PR comments

This patch does the following:
- Refactor some repeated lines into a single one
- Split the `ungated_async_fn_caller` lint into multiple lines, and make
  one of those lines only print out on nightly
- Use test revisions instead of copying an existing test

18 months agoSwitch `#[track_caller]` back to a no-op unless feature gate is enabled
Bryan Garza [Tue, 22 Nov 2022 21:15:27 +0000 (21:15 +0000)]
Switch `#[track_caller]` back to a no-op unless feature gate is enabled

This patch fixes a regression, in which `#[track_caller]`, which was
previously a no-op, was changed to actually turn on the behavior. This
should instead only happen behind the `closure_track_caller` feature
gate.

Also, add a warning for the user to understand how their code will
compile depending on the feature gate being turned on or not.

Fixes #104588

18 months agoRefer to "Waker" rather than "RawWaker" in `drop` comment
Geoffry Song [Tue, 20 Dec 2022 22:51:24 +0000 (14:51 -0800)]
Refer to "Waker" rather than "RawWaker" in `drop` comment