Commit Graph

206251 Commits

Author SHA1 Message Date
fee1-dead
0cee03dfff
Rollup merge of #102178 - RalfJung:bootstrap-backtrace, r=Mark-Simulacrum
bootstrap: the backtrace feature is stable, no need to allow it any more
2022-09-26 13:09:42 +08:00
fee1-dead
0adf293f87
Rollup merge of #102143 - Rageking8:fix-101540, r=TaKO8Ki
Recover from struct nested in struct

Fixes #101540

r? `@TaKO8Ki`

Not sure If I have done it right.
2022-09-26 13:09:41 +08:00
woppopo
e4b08ab241 Allow ~const bounds on non-const functions 2022-09-26 05:00:31 +00:00
bors
fe217c28ff Auto merge of #102292 - fee1-dead-contrib:rollup-61ptdkt, r=fee1-dead
Rollup of 4 pull requests

Successful merges:

 - #101851 (Clean up (sub)diagnostic derives)
 - #102244 (Only generate closure def id for async fns with body)
 - #102263 (Clarify Iterator::rposition code example)
 - #102280 (rustdoc: clean up `.out-of-band`/`.in-band` CSS)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-26 02:45:13 +00:00
fee1-dead
a7d45de322
Rollup merge of #102280 - notriddle:notriddle/band, r=GuillaumeGomez
rustdoc: clean up `.out-of-band`/`.in-band` CSS

|        | method | impl
|--------|--------|------
| before | ![image](https://user-images.githubusercontent.com/1593513/192164603-dea9befb-0f5f-4bd5-a44d-1f8328e27955.png) | ![image](https://user-images.githubusercontent.com/1593513/192164642-06f958cb-8fd5-4b73-bdb7-d2778f358f80.png)
| after  | ![image](https://user-images.githubusercontent.com/1593513/192164612-f72ee8db-c87c-477c-99e8-283b1cf0c14b.png) | ![image](https://user-images.githubusercontent.com/1593513/192164653-8e628dc3-5bf3-4ce8-829b-06e27a90fe06.png)

* Remove the `float: right` fallback from the main header, which hasn't been needed since IE11 support was dropped.

* Remove `in-band` from low-level headers, which hasn't been needed since `.rightside` switched to `float: right` in 593d6d1cb1

* Remove unreachable `.in-band > code, .in-band > .code-header` CSS, since the `in-band` class was attached to the `code-header` itself, not nested directly below it.

* Use `rem` instead of `em` for code header margins.

* This results in a slight change in spacing around impls and item-info, but since it makes it more consistent with the way methods are presented, it's probably fine.

Preview: http://notriddle.com/notriddle-rustdoc-demos/band/std/fs/struct.File.html
2022-09-26 09:27:38 +08:00
fee1-dead
beb224084d
Rollup merge of #102263 - GuillaumeGomez:iterator-rposition-example, r=thomcc
Clarify Iterator::rposition code example

Fixes #101095.

r? `@thomcc`
2022-09-26 09:27:37 +08:00
fee1-dead
c807277382
Rollup merge of #102244 - compiler-errors:issue-102219, r=cjgillot
Only generate closure def id for async fns with body

Fixes #102219
2022-09-26 09:27:37 +08:00
fee1-dead
1a93028bcc
Rollup merge of #101851 - Xiretza:diagnostic-derive-cleanups, r=davidtwco
Clean up (sub)diagnostic derives

The biggest chunk of this is unifying the parsing of subdiagnostic attributes (`#[error]`, `#[suggestion(...)]`, `#[label(...)]`, etc) between `Subdiagnostic` and `Diagnostic` type attributes as well as `Diagnostic` field attributes.

It also improves a number of proc macro diagnostics.

Waiting for #101558.
2022-09-26 09:27:36 +08:00
bors
3288d3a305 Auto merge of #101785 - jyn514:query-struct-fn-ptrs, r=cjgillot
Use function pointers instead of macro-unrolled loops in rustc_query_impl

By making these standalone functions, we
a) allow making them extensible in the future with a new `QueryStruct`
b) greatly decrease the amount of code in each individual function, avoiding exponential blowup in llvm

Helps with https://github.com/rust-lang/rust/issues/96524. Based on https://github.com/rust-lang/rust/pull/101173; only the last commit is relevant.

r? `@cjgillot`
2022-09-26 00:17:59 +00:00
yukang
672e3f4d77 fix #102087, Suggest Default::default() when binding isn't initialized 2022-09-26 07:56:26 +08:00
Michael Goulet
e99f6fee44 Only lower async fn body if it actually has a body 2022-09-25 23:03:15 +00:00
Michael Goulet
730ead8047 Only generate closure def id for async fns with body 2022-09-25 23:03:15 +00:00
Michael Goulet
4d0d688a3c Recover some items that expect braces and don't take semicolons 2022-09-25 22:34:25 +00:00
Michael Howell
a50081e102 Round offset to whole integer 2022-09-25 14:58:49 -07:00
bors
ff40f2ec95 Auto merge of #101710 - jyn514:move-dep-kind-node, r=cjgillot
Move DepKindStruct from rustc_middle to rustc_query_system

Helps with https://github.com/rust-lang/rust/issues/96524. cc https://rust-lang.zulipchat.com/#narrow/stream/241847-t-compiler.2Fwg-incr-comp/topic/Moving.20.60DepKindStruct.60.20to.20rustc_query_system.20.2396524

r? `@cjgillot`
2022-09-25 21:37:10 +00:00
Michael Howell
4ba40314e1 rustdoc: update test cases now that code-header is used without in-band 2022-09-25 13:52:26 -07:00
Michael Howell
a7c25b2957 rustdoc: clean up .out-of-band/.in-band CSS
* Remove the `float: right` fallback from the main header, which hasn't
  been needed since IE11 support was dropped.

* Remove `in-band` from low-level headers, which hasn't been needed since
  `.rightside` switched to `float: right` in
  593d6d1cb1

* Remove unreachable `.in-band > code, .in-band > .code-header` CSS, since
  the `in-band` class was attached to the `code-header` itself, not nested
  directly below it.

* Use `rem` instead of `em` for code header margins.

* This results in a slight change in spacing around impls and item-info,
  but since it makes it more consistent with the way methods are presented,
  it's probably fine.
2022-09-25 13:48:17 -07:00
bors
f5193a9fcc Auto merge of #95474 - oli-obk:tait_ub, r=jackh726
Neither require nor imply lifetime bounds on opaque type for well formedness

The actual hidden type can live arbitrarily longer than any individual lifetime and arbitrarily shorter than all but one of the lifetimes.

fixes #86218
fixes #84305

This is a **breaking change** but it is a necessary soundness fix
2022-09-25 19:15:26 +00:00
Joshua Nelson
00cde6d4b9 Move the codegen_unit debug assert from rustc_query_system to query_impl
This allows removing a function from the `DepKind` trait.
2022-09-25 12:08:36 -05:00
Joshua Nelson
ccc8d000f2 Move some more code from rustc_middle to rustc_query_system 2022-09-25 12:08:36 -05:00
Joshua Nelson
f3f91bb514 Move functions on DepKindStruct from rustc_middle to rustc_query_system 2022-09-25 12:07:17 -05:00
Joshua Nelson
93a0fb190e Move DepKindStruct from rustc_middle to rustc_query_system 2022-09-25 11:56:23 -05:00
bors
f3fafbb006 Auto merge of #102266 - Mark-Simulacrum:fix-custom-rustc, r=jyn514
Support overriding initial rustc and cargo paths

This restores functionality broken by #98483. Unfortunately, it doesn't add a test to verify this works, but in this case we notice pretty quickly as perf uses this functionality and so reports breakage immediately after merging.

r? `@jyn514`

cc https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap/topic/rustc.20and.20cargo.20option.20broken.20in.20config.2Etoml, https://rust-lang.zulipchat.com/#narrow/stream/247081-t-compiler.2Fperformance/topic/Rustc.20benchmark.20broken
2022-09-25 16:52:49 +00:00
Nilstrieb
ddf7982741 Remove benches from rustc_middle
These benches benchmark rust langauge features and not the compiler,
so they seem to be in the wrong place here. They also all take <1ns,
making them pretty useless. Looking at their git history, they just
seem to have been carried around for many, many years. This commit
ends their journey.
2022-09-25 18:35:43 +02:00
Joshua Nelson
7a8369096c Use function pointers instead of macro-unrolled loops in rustc_query_impl
By making these standalone functions, we
a) allow making them extensible in the future with a new `QueryStruct`
b) greatly decrease the amount of code in each individual function, avoiding exponential blowup in llvm
2022-09-25 11:27:12 -05:00
Joshua Nelson
41ac87dd38 Don't set RUSTC in the bootstrap build script
We no longer use this for anything since https://github.com/rust-lang/rust/pull/98483/files#diff-7eddc76f1be9eca2599a9ae58c65ffe247fbdff9b02ef687439894cab9afe749L781.
Remove it, so that we spuriously rebuild bootstrap fewer times on Windows (where PATH changes often).
2022-09-25 09:42:01 -05:00
bors
17e8752aca Auto merge of #102265 - fee1-dead-contrib:rollup-a7fccbg, r=fee1-dead
Rollup of 8 pull requests

Successful merges:

 - #98111 (Clarify `[T]::select_nth_unstable*` return values)
 - #101431 (Look at move place's type when suggesting mutable reborrow)
 - #101800 (Constify slice.split_at_mut(_unchecked))
 - #101997 (Remove support for legacy PM)
 - #102194 (Note the type when unable to drop values in compile time)
 - #102200 (Constify Default impl's for Arrays and Tuples.)
 - #102245 (Constify cmp_min_max_by.)
 - #102259 (Type-annotate and simplify documentation of Option::unwrap_or_default)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-25 14:28:04 +00:00
Mark Rousskov
439597bc1b Support overriding initial rustc and cargo paths
This restores functionality broken by #98483. Unfortunately, it doesn't
add a test to verify this works, but in this case we notice pretty
quickly as perf uses this functionality and so reports breakage
immediately after merging.
2022-09-25 10:23:33 -04:00
fee1-dead
c50303ca1f
Rollup merge of #102259 - gimbles:patch-1, r=joshtriplett
Type-annotate and simplify documentation of Option::unwrap_or_default

Part of #100054
2022-09-25 22:06:41 +08:00
fee1-dead
b00b918f28
Rollup merge of #102245 - ink-feather-org:const_cmp_by, r=fee1-dead
Constify cmp_min_max_by.

Constifies `core::cmp::{min, max}_by[_key]` behind the `const_cmp` #92391 feature gate, using `const_closure`.
2022-09-25 22:06:40 +08:00
fee1-dead
69aa41b000
Rollup merge of #102200 - ink-feather-org:const_default_impls, r=fee1-dead
Constify Default impl's for Arrays and Tuples.

Allows to create arrays and tuples in const Context using the ~const Default implementation of the inner type.
2022-09-25 22:06:40 +08:00
fee1-dead
b7d9de72ac
Rollup merge of #102194 - fee1-dead-contrib:improve-const-drop, r=oli-obk
Note the type when unable to drop values in compile time
2022-09-25 22:06:39 +08:00
fee1-dead
07467c5308
Rollup merge of #101997 - cuviper:drop-legacy-pm, r=nikic
Remove support for legacy PM

This removes support for optimizing with LLVM's legacy pass manager, as well as the unstable `-Znew-llvm-pass-manager` option. We have been defaulting to the new PM since LLVM 13 (except for s390x that waited for 14), and LLVM 15 removed support altogether. The only place we still use the legacy PM is for writing the output file, just like `llc` does.

cc #74705
r? ``@nikic``
2022-09-25 22:06:38 +08:00
fee1-dead
da884d25da
Rollup merge of #101800 - chriss0612:feat/const_split_at_mut, r=fee1-dead
Constify slice.split_at_mut(_unchecked)

Tracking Issue: [Tracking Issue for const_slice_split_at_mut](https://github.com/rust-lang/rust/issues/101804)

Feature gate: `#![feature(const_slice_split_at_mut)]`

Still requires const_mut_refs to be actually used, but this feature removes the need to manually re implement these functions in a user crate.
2022-09-25 22:06:38 +08:00
fee1-dead
084029f39d
Rollup merge of #101431 - compiler-errors:move-place-ty-for-move-place-sugg, r=cjgillot
Look at move place's type when suggesting mutable reborrow

Not sure why we are looking at the use site's ty instead of the move site's ty in order to suggest reborrowing the move site, but it was suppressing a perfectly valid reborrow suggestion.

r? `@estebank` who i think touched this last in 520461f1fb, though that was quite a while ago so feel free to reassign.
2022-09-25 22:06:37 +08:00
fee1-dead
033f93fbb9
Rollup merge of #98111 - eggyal:issue-97982, r=GuillaumeGomez
Clarify `[T]::select_nth_unstable*` return values

In cases where the nth element is not unique within the slice, it is not
correct to say that the values in the returned triplet include ones for
"all elements" less/greater than that at the given index: indeed one (or
more) such values would then also contain elements equal to that at
the given index.

The text proposed here clarifies exactly what is returned, but in so
doing it is also documenting an implementation detail that previously
wasn't detailed: namely that the returned slices are slices into the
reordered slice.  I don't think this can be contentious, because the
lifetimes of those returned slices are bound to that of the original
(now reordered) slice—so there really isn't any other reasonable
implementation that could have this behaviour; but nevertheless it's
probably best if `@rust-lang/libs-api` give it a nod?

Fixes #97982
r? `@m-ou-se`

`@rustbot` label +A-docs +C-bug +T-libs-api -T-libs
2022-09-25 22:06:36 +08:00
Guillaume Gomez
a20672c919 Clarify Iterator::rposition code example 2022-09-25 14:09:41 +02:00
bors
4652f5eb25 Auto merge of #100865 - compiler-errors:parent-substs-still, r=cjgillot
Don't drop parent substs when we have no generic parameters in `create_substs_for_ast_path`

This bug is being shadowed by an explicit check for `generics.params.is_empty()` in the only parent caller that could trigger it (`create_substs_for_associated_item`). I triggered it on another branch where I'm messing around with astconv stuff.

Also, the second commit simplifies `create_substs_for_associated_item`. Removing that explicit check I mentioned above^ and also the special case call to `Astconv::prohibit_generics` causes the UI test `src/test/ui/structs/struct-path-associated-type.stderr` to change, but I think that it's clearer now. The suggestion to remove the generics is actually useful.
2022-09-25 12:00:37 +00:00
Gimgim
4411d5fcc7
Update option.rs 2022-09-25 15:48:08 +05:30
bors
6f6010b08b Auto merge of #102254 - matthiaskrgr:rollup-gitu6li, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #102016 (implied_bounds: deal with inference vars)
 - #102161 (Resolve async fn signature even without body (e.g., in trait))
 - #102216 (rustdoc: Stabilize --diagnostic-width)
 - #102240 (rustdoc: remove unused CSS `#main-content > .line-numbers`)
 - #102242 (rustdoc: remove unused CSS `.summary`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-25 09:33:57 +00:00
Camille GILLOT
73c52bc4dc Fix scoping for let-else. 2022-09-25 11:30:49 +02:00
Matthias Krüger
c6870ccc5c
Rollup merge of #102242 - notriddle:notriddle/summary, r=GuillaumeGomez
rustdoc: remove unused CSS `.summary`

It was added in 4d16de01d0 as part of a stability dashboard that was removed in 0a46933c4d.
2022-09-25 09:32:10 +02:00
Matthias Krüger
d870b93a7d
Rollup merge of #102240 - notriddle:notriddle/main-line-numbers, r=GuillaumeGomez
rustdoc: remove unused CSS `#main-content > .line-numbers`

This selector was added in 10b9370286. It became unreachable when 09150f8193 made it so that `.line-numbers` are always nested below `.example-wrap`, even on source pages.
2022-09-25 09:32:09 +02:00
Matthias Krüger
094f09e26a
Rollup merge of #102216 - ehuss:rustdoc-diagnostic-width, r=notriddle
rustdoc: Stabilize --diagnostic-width

This stabilizes the `--diagnostic-width` flag for rustdoc. This flag was stabilized in rustc in #95635, but it isn't clear from the discussion there why it wasn't stabilized in rustdoc. I believe this flag works as expected, following the same behavior as rustc.

I'd like to stabilize this so that the same support can be stabilized in cargo, and it would help simplify things if both rustc and rustdoc supported it.
2022-09-25 09:32:09 +02:00
Matthias Krüger
11b4510202
Rollup merge of #102161 - compiler-errors:issue-102138, r=tmandry
Resolve async fn signature even without body (e.g., in trait)

Fixes #102138

This "bail if no body" behavior was introduced in #69539 to fix #69401, but that ICE does not reproduce any more. The error message changes a bit, but that's all, and I don't think it's a particularly diagnostic bad regression.
2022-09-25 09:32:08 +02:00
Matthias Krüger
16de1fddee
Rollup merge of #102016 - lcnr:given-OutlivesEnvironment, r=jackh726
implied_bounds: deal with inference vars

fixes #101951

while computing implied bounds for `<<T as ConstructionFirm>::Builder as BuilderFn<'_>>::Output` normalization replaces a projection with an inference var (adding a `Projection` obligation). Until we prove that obligation, this inference var remains unknown, which caused us to miss an implied bound necessary to prove that the unnormalized projection from the trait method signature is wf.

r? types
2022-09-25 09:32:07 +02:00
bors
8e9c93df46 Auto merge of #99609 - workingjubilee:lossy-unix-strerror, r=thomcc
Recover error strings on Unix from_lossy_utf8

Some language settings can result in unreliable UTF-8 being produced.
This can result in failing to emit the error string, panicking instead.
from_lossy_utf8 allows us to assume these strings usually will be fine.

This fixes rust-lang#99535.
2022-09-25 06:53:14 +00:00
bors
e20fabb0d0 Auto merge of #98457 - japaric:gh98378, r=m-ou-se
make Condvar, Mutex, RwLock const constructors work with the `unsupported` impl

applying this patch locally to the `rust-src` component fixes #98378

however, the solution seems wrong to me because PR #97791 didn't add any `rustc_const_stable` attribute to underlying implementations like `std::sys::unix::futex`, so I must be missing something about how const-stability is checked ... maybe the `restricted_std` feature (gate?) has an effect?

fixes #98378
fixes #98293 (probably)
2022-09-25 04:12:30 +00:00
bors
e58621a4a3 Auto merge of #102169 - scottmcm:constify-some-conditions, r=thomcc
Make ZST checks in core/alloc more readable

There's a bunch of these checks because of special handing for ZSTs in various unsafe implementations of stuff.

This lets them be `T::IS_ZST` instead of `mem::size_of::<T>() == 0` every time, making them both more readable and more terse.

*Not* proposed for stabilization.  Would be `pub(crate)` except `alloc` wants to use it too.

(And while it doesn't matter now, if we ever get something like #85836 making it a const can help codegen be simpler.)
2022-09-25 01:20:11 +00:00
bors
d0ece44cfa Auto merge of #102040 - TaKO8Ki:separate-definitions-and-hir-owners, r=cjgillot
Separate definitions and HIR owners in the type system

Fixes #83158

r? `@cjgillot`
2022-09-24 22:42:07 +00:00