Commit Graph

24103 Commits

Author SHA1 Message Date
John Bobbo
618841b815
Use NonNull::new_unchecked and NonNull::len in
`rustc_arena`.
2023-04-27 19:48:37 -07:00
bors
1a6ae3d692 Auto merge of #110916 - matthiaskrgr:rollup-g3c33zc, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #105745 (docs(std): clarify remove_dir_all errors)
 - #106456 (Correct `std::prelude` comment)
 - #106599 (Change memory ordering in System wrapper example)
 - #110838 (More `Typefoldable`/`TypeVisitable` cleanups)
 - #110851 (compiletest: emit assembly-output header in error)
 - #110853 (compiletest: add bpf-linker assembly support)
 - #110878 (Add `known-bug` tests for 4 unsound issues)
 - #110886 (`DepGraph` cleanups)
 - #110905 (Remove invalid value from scraped-examples.md)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-27 20:42:46 +00:00
Matthias Krüger
50ccd17db6
Rollup merge of #110886 - nnethercote:dep-graph-cleanups, r=cjgillot
`DepGraph` cleanups

r? `@cjgillot`
2023-04-27 21:34:17 +02:00
Matthias Krüger
57e9a4be48
Rollup merge of #110838 - nnethercote:more-Folder-Visitable-cleanups, r=lcnr
More `Typefoldable`/`TypeVisitable` cleanups

r? ``@lcnr``
2023-04-27 21:34:14 +02:00
bors
c14882f74e Auto merge of #107782 - Zoxc:worker-local, r=cjgillot
Move the WorkerLocal type from the rustc-rayon fork into rustc_data_structures

This PR moves the definition of the `WorkerLocal` type from `rustc-rayon` into `rustc_data_structures`. This is enabled by the introduction of the `Registry` type which allows you to group up threads to be used by `WorkerLocal` which is basically just an array with an per thread index. The `Registry` type mirrors the one in Rayon and each Rayon worker thread is also registered with the new `Registry`. Safety for `WorkerLocal` is ensured by having it keep a reference to the registry and checking on each access that we're still on the group of threads associated with the registry used to construct it.

Accessing a `WorkerLocal` is micro-optimized due to it being hot since it's used for most arena allocations.

Performance is slightly improved for the parallel compiler:
<table><tr><td rowspan="2">Benchmark</td><td colspan="1"><b>Before</b></th><td colspan="2"><b>After</b></th></tr><tr><td align="right">Time</td><td align="right">Time</td><td align="right">%</th></tr><tr><td>🟣 <b>clap</b>:check</td><td align="right">1.9992s</td><td align="right">1.9949s</td><td align="right"> -0.21%</td></tr><tr><td>🟣 <b>hyper</b>:check</td><td align="right">0.2977s</td><td align="right">0.2970s</td><td align="right"> -0.22%</td></tr><tr><td>🟣 <b>regex</b>:check</td><td align="right">1.1335s</td><td align="right">1.1315s</td><td align="right"> -0.18%</td></tr><tr><td>🟣 <b>syn</b>:check</td><td align="right">1.8235s</td><td align="right">1.8171s</td><td align="right"> -0.35%</td></tr><tr><td>🟣 <b>syntex_syntax</b>:check</td><td align="right">6.9047s</td><td align="right">6.8930s</td><td align="right"> -0.17%</td></tr><tr><td>Total</td><td align="right">12.1586s</td><td align="right">12.1336s</td><td align="right"> -0.21%</td></tr><tr><td>Summary</td><td align="right">1.0000s</td><td align="right">0.9977s</td><td align="right"> -0.23%</td></tr></table>

cc `@SparrowLii`
2023-04-27 17:43:09 +00:00
Matthias Krüger
52d550b20e
Rollup merge of #110872 - Jules-Bertholet:err-67981, r=wesleywiser
Nicer ICE for #67981

Provides a slightly nicer ICE for #67981, documenting the problem. A proper fix will be necessary before `#![feature(unsized_fn_params)]` can be stabilized.

The problem is that the design of the `"rust-call"` ABI is fundamentally not compatible with `unsized_fn_params`. `"rust-call"` functions need to collect their arguments into a tuple, but if the arguments are not `Sized`, said tuple is potentially not even a valid type—and if it is, it requires `alloca` to create.

``@rustbot`` label +A-abi +A-codegen +F-unboxed_closures +F-unsized_fn_params
2023-04-27 15:10:56 +02:00
Matthias Krüger
563eb04c5d
Rollup merge of #110864 - compiler-errors:into-future-stable, r=jackh726
`IntoFuture::into_future` is no longer unstable

We don't need to gate the `IntoFuture::into_future` call in `.await` lowering anymore.

``@bors`` rollup
2023-04-27 15:10:55 +02:00
Matthias Krüger
63fbb05839
Rollup merge of #110816 - clubby789:rustc-passes-diagnostics, r=compiler-errors
Migrate `rustc_passes` to translatable diagnostics

cc #100717
2023-04-27 15:10:54 +02:00
Matthias Krüger
b1ff6e3e10
Rollup merge of #110814 - WaffleLapkin:sprinkle_#inline, r=Nilstrieb
Sprinkle some `#[inline]` in `rustc_data_structures::tagged_ptr`

This is based on `nm --demangle (rustc +a --print sysroot)/lib/librustc_driver-*.so | rg CopyTaggedPtr` which shows many methods that should probably be inlined. May fix the regression in https://github.com/rust-lang/rust/pull/110795.

r? ```@Nilstrieb```
2023-04-27 15:10:53 +02:00
bors
6ce22733b9 Auto merge of #110882 - BoxyUwU:rename-some-ty-flags, r=compiler-errors
rename `NEEDS_SUBST` and `NEEDS_INFER`

implements rust-lang/compiler-team#617
2023-04-27 09:55:37 +00:00
Nicholas Nethercote
793b2ffb67 Factor out common code in intern_node.
There are three very similar blocks in this function.
2023-04-27 17:50:02 +10:00
Nicholas Nethercote
207cec017f Clean up with_task.
Currently it creates an `Option` and then does `map`/`unwrap_or` and
`map_or_else` on it, which is hard to read.

This commit simplifies things by moving more code into the two arms of
the if/else.
2023-04-27 17:48:15 +10:00
Boxy
842419712a rename needs_subst to has_param 2023-04-27 08:35:19 +01:00
Boxy
f04b8fe0af rename needs_infer to has_infer 2023-04-27 08:35:19 +01:00
Nicholas Nethercote
4b85aa99ad Add a comment about TypeFoldable and slices. 2023-04-27 16:21:20 +10:00
bors
8b8110e146 Auto merge of #110728 - cjgillot:no-false-optes, r=oli-obk
Do not bother optimizing impossible functions.

This is currently checked by `ConstProp`, but I see no reason to restrict it to ConstProp only.
2023-04-27 04:29:49 +00:00
Jules Bertholet
5b6e747f37
Nicer ICE for #67981 2023-04-26 19:46:10 -04:00
Michael Goulet
c18e7b765f IntoFuture::into_future is no longer unstable 2023-04-26 22:44:18 +00:00
bors
1c42cb4ef0 Auto merge of #110852 - matthiaskrgr:rollup-jz3eosr, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #108760 (Add lint to deny diagnostics composed of static strings)
 - #109444 (Change tidy error message for TODOs)
 - #110419 (Spelling library)
 - #110550 (Suggest deref on comparison binop RHS even if type is not Copy)
 - #110641 (Add new rustdoc book chapter to describe in-doc settings)
 - #110798 (pass `unused_extern_crates` in `librustdoc::doctest::make_test`)
 - #110819 (simplify TrustedLen impls)
 - #110825 (diagnostics: add test case for already-solved issue)
 - #110835 (Make some region folders a little stricter.)
 - #110847 (rustdoc-json: Time serialization.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-26 18:32:57 +00:00
Matthias Krüger
e47562c674
Rollup merge of #110835 - nnethercote:strict-region-folders-2, r=compiler-errors
Make some region folders a little stricter.

Because certain regions cannot occur in them.

r? ``@compiler-errors``
2023-04-26 18:51:44 +02:00
Matthias Krüger
8e6fffcbaa
Rollup merge of #110550 - compiler-errors:deref-on-binop-rhs, r=wesleywiser
Suggest deref on comparison binop RHS even if type is not Copy

Fixes #110500
2023-04-26 18:51:41 +02:00
Matthias Krüger
309496cf29
Rollup merge of #108760 - clubby789:autolintstuff, r=wesleywiser
Add lint to deny diagnostics composed of static strings

r? ghost

I'm hoping to have a lint that semi-automatically converts simple diagnostics such as `struct_span_err(span, "msg").help("msg").span_note(span2, "msg").emit()` to typed session diagnostics. It's quite hacky and not entirely working because of problems with `x fix` but should hopefully help reduce some of the work.
I'm going to start trying to apply what I can from this, but opening this as a draft in case anyone wants to develop on it.

cc #100717
2023-04-26 18:51:40 +02:00
bors
9c044d77a3 Auto merge of #110822 - scottmcm:lower-offset-to-mir, r=compiler-errors
Lower `intrinsics::offset` to `mir::BinOp::Offset`

They're [semantically the same](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/enum.Rvalue.html#variant.BinaryOp), so this means the backends don't need to handle the intrinsic and means fewer MIR basic blocks in pointer arithmetic code.
2023-04-26 15:52:33 +00:00
bors
8763965a2c Auto merge of #97368 - tmandry:coverage-underflow, r=jyn514
coverage: Don't underflow column number

I noticed this when running coverage on a debug build of rustc. There
may be other places that do this but I'm just fixing the one I hit.

r? `@wesleywiser` `@richkadel`
2023-04-26 12:03:13 +00:00
clubby789
6a41cfe095 Migrate rustc_passes to translatable diagnostics 2023-04-26 11:40:21 +01:00
jyn
62b5beaf93
Rollup merge of #110594 - infdahai:cfg_chore, r=jyn514
`rustc --help` add `--cfg` SPEC declaration.

1. fixes #110462
2. add spec arguments based on https://doc.rust-lang.org/reference/conditional-compilation.html
2023-04-26 01:55:52 -05:00
Nicholas Nethercote
a82ad2fed4 Derive Type{Foldable,Visitable} for UserTypeProjection.
Because the derived versions are good enough.
2023-04-26 15:19:51 +10:00
Nicholas Nethercote
671de6d62a Remove unused TypeFoldable/TypeVisitable impls. 2023-04-26 15:19:50 +10:00
clundro
27c0d92f1d add cfg SPEC declaration.
use name[=value] syntax.

Signed-off-by: clundro <859287553@qq.com>
2023-04-26 13:19:09 +08:00
bors
adaac6b166 Auto merge of #110634 - saethlin:pointy-decoder, r=cjgillot
Rewrite MemDecoder around pointers not a slice

This is basically https://github.com/rust-lang/rust/pull/109910 but I'm being a lot more aggressive. The pointer-based structure means that it makes a lot more sense to absorb more complexity into `MemDecoder`, most of the diff is just complexity moving from one place to another.

The primary argument for this structure is that we only incur a single bounds check when doing multi-byte reads from a `MemDecoder`. With the slice-based implementation we need to do those with `data[position..position + len]` , which needs to account for `position + len` wrapping. It would be possible to dodge the first bounds check if we stored a slice that starts at `position`, but that would require updating the pointer and length on every read.

This PR also embeds the failure path in a separate function, which means that this PR should subsume all the perf wins observed in https://github.com/rust-lang/rust/pull/109867.
2023-04-26 02:36:42 +00:00
Scott McMurray
05a665f21a Lower intrinsics::offset to mir::BinOp::Offset
They're semantically the same, so this means the backends don't need to handle the intrinsic and means fewer MIR basic blocks in pointer arithmetic code.
2023-04-25 19:23:45 -07:00
Nicholas Nethercote
8216b7f229 Make some region folders a little stricter.
Because certain regions cannot occur in them.
2023-04-26 10:14:16 +10:00
bors
f33379b0a6 Auto merge of #110811 - compiler-errors:vars-are-question-mark, r=WaffleLapkin
Use `?0` notation for ty/ct/int/float/region vars

Aligns the notation for infer vars that T-types and friends most often uses for inference variables with the notation in the compiler (which is kinda a sigil nightmare IMO: `_#`) by adopting `?0` style infer vars.

This mostly affects debug output since verbose infer vars shouldn't show up in user-facing places.

Does this need an MCP? It's debug output, so I'm thinking no, but happy to open one. 🤔

r? types
2023-04-25 22:11:09 +00:00
Michael Goulet
bb99cdc7cd vars are ? 2023-04-25 19:53:09 +00:00
Matthias Krüger
f5a3039add
Rollup merge of #110783 - dtolnay:safeprint, r=petrochenkov
Fix ICE on --print=... i/o errors

`rustc --print=cfg > /dev/full`

**Before:** ICE (see below)

**After:** exits quietly with code 1.

```console
thread 'rustc' panicked at 'failed printing to stdout: No space left on device (os error 28)', library/std/src/io/stdio.rs:1019:9
stack backtrace:
   0:     0x7ffa84d68f33 - std::backtrace_rs::backtrace::libunwind::trace::h527d8d64d53ade2d
                               at /rustc/7f94b314cead7059a71a265a8b64905ef2511796/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7ffa84d68f33 - std::backtrace_rs::backtrace::trace_unsynchronized::hfb55b01517dd6379
                               at /rustc/7f94b314cead7059a71a265a8b64905ef2511796/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7ffa84d68f33 - std::sys_common::backtrace::_print_fmt::hd134e914eea0bd97
                               at /rustc/7f94b314cead7059a71a265a8b64905ef2511796/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7ffa84d68f33 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h1480db11ec399d77
                               at /rustc/7f94b314cead7059a71a265a8b64905ef2511796/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7ffa84dc9d4f - core::fmt::write::h67ec4c4171c92b26
                               at /rustc/7f94b314cead7059a71a265a8b64905ef2511796/library/core/src/fmt/mod.rs:1247:17
   5:     0x7ffa84d5bed1 - std::io::Write::write_fmt::h3b12aef0fff2463b
                               at /rustc/7f94b314cead7059a71a265a8b64905ef2511796/library/std/src/io/mod.rs:1712:15
   6:     0x7ffa84d68d45 - std::sys_common::backtrace::_print::h584400135abdbd51
                               at /rustc/7f94b314cead7059a71a265a8b64905ef2511796/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7ffa84d68d45 - std::sys_common::backtrace::print::hce41d3c8bd91096b
                               at /rustc/7f94b314cead7059a71a265a8b64905ef2511796/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7ffa84d6b84f - std::panicking::default_hook::{{closure}}::h2043b657a3791225
   9:     0x7ffa84d6b507 - std::panicking::default_hook::h99252b8d3dd5719c
                               at /rustc/7f94b314cead7059a71a265a8b64905ef2511796/library/std/src/panicking.rs:293:9
  10:     0x7ffa87fdf915 - <rustc_driver_impl[d30cd2737d9d343a]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[cc19a662f3570270]::ops::function::FnOnce<(&core[cc19a662f3570270]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7ffa84d6c005 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h222a2b674b9f4762
                               at /rustc/7f94b314cead7059a71a265a8b64905ef2511796/library/alloc/src/boxed.rs:1976:9
  12:     0x7ffa84d6c005 - std::panicking::rust_panic_with_hook::h7f49b36bf7f8ff77
                               at /rustc/7f94b314cead7059a71a265a8b64905ef2511796/library/std/src/panicking.rs:704:13
  13:     0x7ffa84d6bd73 - std::panicking::begin_panic_handler::{{closure}}::haa23a7352589e31e
                               at /rustc/7f94b314cead7059a71a265a8b64905ef2511796/library/std/src/panicking.rs:595:13
  14:     0x7ffa84d69376 - std::sys_common::backtrace::__rust_end_short_backtrace::h3d0cf6e3c96e3fe9
                               at /rustc/7f94b314cead7059a71a265a8b64905ef2511796/library/std/src/sys_common/backtrace.rs:150:18
  15:     0x7ffa84d6ba72 - rust_begin_unwind
                               at /rustc/7f94b314cead7059a71a265a8b64905ef2511796/library/std/src/panicking.rs:584:5
  16:     0x7ffa84dc5fe3 - core::panicking::panic_fmt::hf4b4ea11e3fdb110
                               at /rustc/7f94b314cead7059a71a265a8b64905ef2511796/library/core/src/panicking.rs:67:14
  17:     0x7ffa84d5aa07 - std::io::stdio::print_to::h55760b9ede306280
                               at /rustc/7f94b314cead7059a71a265a8b64905ef2511796/library/std/src/io/stdio.rs:1019:9
  18:     0x7ffa84d5aa07 - std::io::stdio::_print::h93deb6099db33eab
                               at /rustc/7f94b314cead7059a71a265a8b64905ef2511796/library/std/src/io/stdio.rs:1095:5
  19:     0x7ffa871e163b - rustc_driver_impl[d30cd2737d9d343a]::print_crate_info
  20:     0x7ffa87fb8e01 - rustc_span[9551eaa044f53f4f]::set_source_map::<(), rustc_interface[c2b70c9b1dae0906]::interface::run_compiler<(), rustc_driver_impl[d30cd2737d9d343a]::run_compiler::{closure#0}>::{closure#0}::{closure#0}>
  21:     0x7ffa87fb6d59 - std[71a32ca0600a6a04]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[c2b70c9b1dae0906]::util::run_in_thread_pool_with_globals<rustc_interface[c2b70c9b1dae0906]::interface::run_compiler<(), rustc_driver_impl[d30cd2737d9d343a]::run_compiler::{closure#0}>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  22:     0x7ffa87fe25b4 - std[71a32ca0600a6a04]::panicking::try::<(), core[cc19a662f3570270]::panic::unwind_safe::AssertUnwindSafe<<std[71a32ca0600a6a04]:🧵:Builder>::spawn_unchecked_<rustc_interface[c2b70c9b1dae0906]::util::run_in_thread_pool_with_globals<rustc_interface[c2b70c9b1dae0906]::interface::run_compiler<(), rustc_driver_impl[d30cd2737d9d343a]::run_compiler::{closure#0}>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1}::{closure#0}>>
  23:     0x7ffa87fb0cf1 - <<std[71a32ca0600a6a04]:🧵:Builder>::spawn_unchecked_<rustc_interface[c2b70c9b1dae0906]::util::run_in_thread_pool_with_globals<rustc_interface[c2b70c9b1dae0906]::interface::run_compiler<(), rustc_driver_impl[d30cd2737d9d343a]::run_compiler::{closure#0}>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[cc19a662f3570270]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  24:     0x7ffa84d763e5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hf15d802f31f86225
                               at /rustc/7f94b314cead7059a71a265a8b64905ef2511796/library/alloc/src/boxed.rs:1962:9
  25:     0x7ffa84d763e5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hac564355b46c52d6
                               at /rustc/7f94b314cead7059a71a265a8b64905ef2511796/library/alloc/src/boxed.rs:1962:9
  26:     0x7ffa84d763e5 - std::sys::unix:🧵:Thread:🆕:thread_start::h86fb3aedb7811f07
                               at /rustc/7f94b314cead7059a71a265a8b64905ef2511796/library/std/src/sys/unix/thread.rs:108:17
  27:     0x7ffa84a94b43 - start_thread
                               at ./nptl/pthread_create.c:442:8
  28:     0x7ffa84b26a00 - clone3
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
  29:                0x0 - <unknown>

error: 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.71.0-nightly (7f94b314c 2023-04-23) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack
```
2023-04-25 21:06:34 +02:00
Matthias Krüger
95e9f68eb5
Rollup merge of #110671 - compiler-errors:polarity, r=lcnr
Consider polarity in new solver

It's kinda ugly to have a polarity check in all of the builtin impls -- I guess I could consider the polarity at the top of assemble-builtin but that would require adding a polarity fn to `GoalKind`...

🤷 putting this up just so i dont forget, since it's needed to bootstrap core during coherence (this alone does not allow core to bootstrap though, additional work is needed!)

r? ``@lcnr``
2023-04-25 21:06:34 +02:00
Matthias Krüger
8d00a8d11e
Rollup merge of #110615 - WaffleLapkin:impl_tag, r=cjgillot
Add `impl_tag!` macro to implement `Tag` for tagged pointer easily

r? `@Nilstrieb`

This should also lifts the need to think about safety from the callers (`impl_tag!` is robust (ish, see the macro issue)) and removes the possibility of making a "weird" `Tag` impl.
2023-04-25 21:06:33 +02:00
Matthias Krüger
297b222066
Rollup merge of #110556 - kylematsuda:earlybinder-explicit-item-bounds, r=compiler-errors
Switch to `EarlyBinder` for `explicit_item_bounds`

Part of the work to finish https://github.com/rust-lang/rust/issues/105779.

This PR adds `EarlyBinder` to the return type of the `explicit_item_bounds` query and removes `bound_explicit_item_bounds`.

r? `@compiler-errors` (hope it's okay to request you, since you reviewed #110299 and #110498 😃)
2023-04-25 21:06:32 +02:00
clubby789
0138513635 Fix static string lints 2023-04-25 18:59:55 +01:00
clubby789
eeb527602a Add deny lint to prevent untranslatable diagnostics using static strings 2023-04-25 18:44:49 +01:00
Maybe Waffle
bec7ce4824 Add #[inline] in impl_tag 2023-04-25 17:37:12 +00:00
Maybe Waffle
021a12c00d Sprinkle some #[inline] in rustc_data_structures::tagged_ptr 2023-04-25 17:30:05 +00:00
Camille GILLOT
0ee32fb3c7 Move unstatisfaction check earlier. 2023-04-25 17:11:46 +00:00
David Tolnay
040e1b6b5f
Fix ICE on --print=... i/o errors 2023-04-25 08:17:18 -07:00
bors
a7aa20517c Auto merge of #110325 - obeis:hir-analysis-migrate-diagnostics-4, r=davidtwco
Migrate `rustc_hir_analysis` to session diagnostic [Part 4]

Part 4: Finishing `check/mod.rs` file

r? `@compiler-errors`
2023-04-25 13:45:20 +00:00
bors
999e6e5afb Auto merge of #101069 - zhaixiaojuan:loongarch64-inline-asm, r=Amanieu
Add loongarch64 asm! support
2023-04-25 09:18:58 +00:00
zhaixiaojuan
5f2fa4c11d Add loongarch64 asm! support 2023-04-25 14:15:31 +08:00
Matthias Krüger
2d72abc8f2
Rollup merge of #110782 - matthiaskrgr:revert_panic_oom, r=Amanieu
Revert panic oom

This temporarily reverts https://github.com/rust-lang/rust/pull/109507 until https://github.com/rust-lang/rust/issues/110771 is addressed

r? `@Amanieu`
2023-04-25 06:46:50 +02:00
Matthias Krüger
7e143e9043
Rollup merge of #110755 - TimNN:exp-tls, r=durin42
[LLVM17] Adapt to `ExplicitEmulatedTLS` removal.

0d333bf0e3 removed the `ExplicitEmulatedTLS` field from `TargetOptions`.

Before that commit, `TargetMachine::useEmulatedTLS()` fell back to `TheTriple.hasDefaultEmulatedTLS()` if `ExplicitEmulatedTLS` was `false`/unset.

After that commit, `TargetMachine::useEmulatedTLS()` directly returns `Options.EmulatedTLS`, and the fallback to `TheTriple.hasDefaultEmulatedTLS()` was moved to `InitTargetOptionsFromCodeGenFlags`.

Since `rustc` does not use `InitTargetOptionsFromCodeGenFlags` (AFAICT) and instead manually builds `TargetOptions`, this PR initializes `EmulatedTLS` to `TheTriple.hasDefaultEmulatedTLS()`.

(I'm not really familiar with the details of what this option does, or if there are any tests that depend on `hasDefaultEmulatedTLS` being used correctly, so this PR is mostly untested (it does compile against LLVM17, though)).

`@rustbot` label: +llvm-main
2023-04-25 06:46:49 +02:00
Matthias Krüger
5f33a8c026
Rollup merge of #110563 - bryangarza:refactor-trait-selection-error-reporting, r=compiler-errors
Break up long function in trait selection error reporting + clean up nearby code

- Move blocks of code into their own functions
- Replace a few function argument types with their type aliases
- Create "AppendConstMessage" enum to replace a nested `Option`.
2023-04-25 06:46:48 +02:00