]> git.lizzy.rs Git - rust.git/log
rust.git
20 months agoClean up rustdoc startup.
Nicholas Nethercote [Fri, 7 Oct 2022 02:57:32 +0000 (13:57 +1100)]
Clean up rustdoc startup.

rustc's startup has several layers, including:
- `interface::run_compiler` passes a closure, `f`, to
  `run_in_thread_pool_with_globals`, which creates a thread pool, sets
  up session globals, and passes `f` to `create_compiler_and_run`.
- `create_compiler_and_run` creates a `Session`, a `Compiler`, sets the
  source map, and calls `f`.

rustdoc is a bit different.
- `main_args` calls `main_options` via
  `run_in_thread_pool_with_globals`, which (again) creates a thread pool
  (hardcoded to a single thread!) and sets up session globals.
- `main_options` has four different paths.
  - The second one calls `interface::run_compiler`, which redoes the
    `run_in_thread_pool_with_globals`! This is bad.
  - The fourth one calls `interface::create_compiler_and_run`, which is
    reasonable.
  - The first and third ones don't do anything of note involving the
    above functions, except for some symbol interning which requires
    session globals.

In other words, rustdoc calls into `rustc_interface` at three different
levels. It's a bit confused, and feels like code where functionality has
been added by different people at different times without fully
understanding how the globally accessible stuff is set up.

This commit tidies things up. It removes the
`run_in_thread_pool_with_globals` call in `main_args`, and adjust the
four paths in `main_options` as follows.
- `markdown::test` calls `test::test_main`, which provides its own
  parallelism and so doesn't need a thread pool. It had one small use of
  symbol interning, which required session globals, but the commit
  removes this.
- `doctest::run` already calls `interface::run_compiler`, so it doesn't
  need further adjustment.
- `markdown::render` is simple but needs session globals for interning
  (which can't easily be removed), so it's now wrapped in
  `create_session_globals_then`.
- The fourth path now uses `interface::run_compiler`, which is
  equivalent to the old `run_in_thread_pool_with_globals` +
  `create_compiler_and_run` pairing.

20 months agoAuto merge of #102418 - citrus-it:illumos-strip-debug, r=nagisa
bors [Tue, 18 Oct 2022 16:32:41 +0000 (16:32 +0000)]
Auto merge of #102418 - citrus-it:illumos-strip-debug, r=nagisa

The illumos linker does not support --strip-debug

When building and testing rust 1.64.0 on illumos, we saw a large number of failing tests associated with:

```
   = note: ld: fatal: unrecognized option '--strip-debug'
           ld: fatal: use the -z help option for usage information
           collect2: error: ld returned 1 exit status
```

The illumos linker does not support the `--strip-debug` option (although it does support `--strip-all`).

20 months agoAuto merge of #103188 - JohnTitor:rollup-pwilam1, r=JohnTitor
bors [Tue, 18 Oct 2022 13:35:43 +0000 (13:35 +0000)]
Auto merge of #103188 - JohnTitor:rollup-pwilam1, r=JohnTitor

Rollup of 6 pull requests

Successful merges:

 - #103023 (Adding `fuchsia-ignore` and `needs-unwind` to compiler test cases)
 - #103142 (Make diagnostic for unsatisfied `Termination` bounds more precise)
 - #103154 (Fix typo in `ReverseSearcher` docs)
 - #103159 (Remove the redundant `Some(try_opt!(..))` in `checked_pow`)
 - #103163 (Remove all uses of array_assume_init)
 - #103168 (Stabilize asm_sym)

Failed merges:

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

20 months agoRollup merge of #103168 - Amanieu:stable_asm_sym, r=davidtwco
Yuki Okushi [Tue, 18 Oct 2022 12:21:32 +0000 (21:21 +0900)]
Rollup merge of #103168 - Amanieu:stable_asm_sym, r=davidtwco

Stabilize asm_sym

Tracking issue #93333

Reference PR: https://github.com/rust-lang/reference/pull/1270

20 months agoRollup merge of #103163 - SUPERCILEX:uninit-array-assume2, r=scottmcm
Yuki Okushi [Tue, 18 Oct 2022 12:21:32 +0000 (21:21 +0900)]
Rollup merge of #103163 - SUPERCILEX:uninit-array-assume2, r=scottmcm

Remove all uses of array_assume_init

See https://github.com/rust-lang/rust/pull/103134#discussion_r997462733

r? `@scottmcm`

20 months agoRollup merge of #103159 - cuviper:check_pow-final-try_opt, r=Mark-Simulacrum
Yuki Okushi [Tue, 18 Oct 2022 12:21:31 +0000 (21:21 +0900)]
Rollup merge of #103159 - cuviper:check_pow-final-try_opt, r=Mark-Simulacrum

Remove the redundant `Some(try_opt!(..))` in `checked_pow`

The final return value doesn't need to be tried at all -- we can just
return the checked option directly. The optimizer can probably figure
this out anyway, but there's no need to make it work here.

20 months agoRollup merge of #103154 - H4x5:reverse-searcher-typo, r=Mark-Simulacrum
Yuki Okushi [Tue, 18 Oct 2022 12:21:31 +0000 (21:21 +0900)]
Rollup merge of #103154 - H4x5:reverse-searcher-typo, r=Mark-Simulacrum

Fix typo in `ReverseSearcher` docs

20 months agoRollup merge of #103142 - fmease:fix-103052, r=oli-obk
Yuki Okushi [Tue, 18 Oct 2022 12:21:30 +0000 (21:21 +0900)]
Rollup merge of #103142 - fmease:fix-103052, r=oli-obk

Make diagnostic for unsatisfied `Termination` bounds more precise

Don't blindly emit a diagnostic claiming that “*`main` has an invalid return type*” if we encounter a type that should but doesn't implement `std::process::Termination` and isn't actually the return type of the program entry `main`.

Fixes #103052.

``@rustbot`` label A-diagnostics T-compiler T-libs
r? diagnostics

20 months agoRollup merge of #103023 - andrewpollack:i-fuchsia-finals, r=tmandry
Yuki Okushi [Tue, 18 Oct 2022 12:21:29 +0000 (21:21 +0900)]
Rollup merge of #103023 - andrewpollack:i-fuchsia-finals, r=tmandry

Adding `fuchsia-ignore` and `needs-unwind` to compiler test cases

Final tests covering missing privileges

r? ``@tmandry``

cc. ``@djkoloski``

20 months agoAuto merge of #103075 - SUPERCILEX:miri-metadata, r=thomcc
bors [Tue, 18 Oct 2022 10:54:53 +0000 (10:54 +0000)]
Auto merge of #103075 - SUPERCILEX:miri-metadata, r=thomcc

Support DirEntry metadata calls in miri

This should work as it uses lstat64 which is supported here: ~https://github.com/rust-lang/miri/blob/d9ad25ee4bbd9364c498959cdc82b5fa6c41e63c/src/shims/unix/macos/foreign_items.rs#L42~ just noticed that's macos, linux would be using statx: https://github.com/rust-lang/miri/blob/86f0e63b21721fe2c14608644f467b9cb21945eb/src/shims/unix/linux/foreign_items.rs#L112

The failing syscall is `dirfd`, so maybe that should actually be added to the shims?

20 months agoAuto merge of #103177 - lnicola:rust-analyzer-2022-10-18, r=lnicola
bors [Tue, 18 Oct 2022 07:46:49 +0000 (07:46 +0000)]
Auto merge of #103177 - lnicola:rust-analyzer-2022-10-18, r=lnicola

:arrow_up: rust-analyzer

r? `@ghost`

20 months ago:arrow_up: rust-analyzer
Laurențiu Nicola [Tue, 18 Oct 2022 06:12:49 +0000 (09:12 +0300)]
:arrow_up: rust-analyzer

20 months agoAuto merge of #102992 - nnethercote:rm-RunCompiler-emitter, r=bjorn3
bors [Tue, 18 Oct 2022 05:06:04 +0000 (05:06 +0000)]
Auto merge of #102992 - nnethercote:rm-RunCompiler-emitter, r=bjorn3

Remove `RunCompiler::emitter`.

It's no longer used.

r? `@bjorn3`

20 months agoAuto merge of #102543 - daym:patch-1, r=joshtriplett
bors [Tue, 18 Oct 2022 02:04:24 +0000 (02:04 +0000)]
Auto merge of #102543 - daym:patch-1, r=joshtriplett

Remove "execute" bit from lock file permissions

Previously, flock would set the "execute" bit on Rust lock files. That makes no sense.

This patch clears the "execute" bit on Rust lock files.

See issue #102531.

20 months agoAuto merge of #103165 - matthiaskrgr:rollup-guw8oh6, r=matthiaskrgr
bors [Mon, 17 Oct 2022 23:16:57 +0000 (23:16 +0000)]
Auto merge of #103165 - matthiaskrgr:rollup-guw8oh6, r=matthiaskrgr

Rollup of 4 pull requests

Successful merges:

 - #103152 (Use named arguments to make GUI test more clear)
 - #103160 (rustdoc: factor JS mobile scroll lock into its own function)
 - #103161 (rustdoc: remove redundant CSS on `#copy-path`)
 - #103162 (rustdoc: remove redundant CSS `#crate-search { border-radius }`)

Failed merges:

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

20 months agoRemove `RunCompiler::emitter`.
Nicholas Nethercote [Wed, 12 Oct 2022 23:23:23 +0000 (10:23 +1100)]
Remove `RunCompiler::emitter`.

It's no longer used.

20 months agoStabilize asm_sym
Amanieu d'Antras [Mon, 17 Oct 2022 21:38:37 +0000 (22:38 +0100)]
Stabilize asm_sym

20 months agoRollup merge of #103162 - notriddle:notriddle/crate-search, r=GuillaumeGomez
Matthias Krüger [Mon, 17 Oct 2022 21:09:08 +0000 (23:09 +0200)]
Rollup merge of #103162 - notriddle:notriddle/crate-search, r=GuillaumeGomez

rustdoc: remove redundant CSS `#crate-search { border-radius }`

This is the same border-radius that's always set on that ID:

https://github.com/rust-lang/rust/blob/a9d1cafa878ecc04a4aa7aaa7df0414a29a2bd0b/src/librustdoc/html/static/css/rustdoc.css#L825-L836

20 months agoRollup merge of #103161 - notriddle:notriddle/copy-path-settings-help-button, r=Guill...
Matthias Krüger [Mon, 17 Oct 2022 21:09:07 +0000 (23:09 +0200)]
Rollup merge of #103161 - notriddle:notriddle/copy-path-settings-help-button, r=GuillaumeGomez

rustdoc: remove redundant CSS on `#copy-path`

The border and background were removed in 5d004c1e2020eaa9bc336f09b6b0475c0eef4d78, but not all the CSS was.

20 months agoRollup merge of #103160 - notriddle:notriddle/js-mobile-scroll, r=GuillaumeGomez
Matthias Krüger [Mon, 17 Oct 2022 21:09:07 +0000 (23:09 +0200)]
Rollup merge of #103160 - notriddle:notriddle/js-mobile-scroll, r=GuillaumeGomez

rustdoc: factor JS mobile scroll lock into its own function

https://github.com/rust-lang/rust/pull/98775#issuecomment-1172728308

20 months agoRollup merge of #103152 - GuillaumeGomez:named-arguments, r=notriddle
Matthias Krüger [Mon, 17 Oct 2022 21:09:06 +0000 (23:09 +0200)]
Rollup merge of #103152 - GuillaumeGomez:named-arguments, r=notriddle

Use named arguments to make GUI test more clear

As you suggested `@notriddle.` The result looks like this.

r? `@notriddle`

20 months agoRemove all uses of array_assume_init
Alex Saveau [Mon, 17 Oct 2022 04:01:28 +0000 (21:01 -0700)]
Remove all uses of array_assume_init

Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
20 months agoAuto merge of #101837 - scottmcm:box-array-from-vec, r=m-ou-se
bors [Mon, 17 Oct 2022 19:46:04 +0000 (19:46 +0000)]
Auto merge of #101837 - scottmcm:box-array-from-vec, r=m-ou-se

Add `Box<[T; N]>: TryFrom<Vec<T>>`

We have `[T; N]: TryFrom<Vec<T>>` (#76310) and `Box<[T; N]>: TryFrom<Box<[T]>>`, but not this combination.

`vec.into_boxed_slice().try_into()` isn't quite a replacement for this, as that'll reallocate unnecessarily in the error case.

**Insta-stable, so needs an FCP**

(I tried to make this work with `, A`, but that's disallowed because of `#[fundamental]` https://github.com/rust-lang/rust/issues/29635#issuecomment-1247598385)

20 months agorustdoc: remove redundant CSS `#crate-search { border-radius }`
Michael Howell [Mon, 17 Oct 2022 19:16:40 +0000 (12:16 -0700)]
rustdoc: remove redundant CSS `#crate-search { border-radius }`

This is the same border-radius that's always set on that ID:

https://github.com/rust-lang/rust/blob/a9d1cafa878ecc04a4aa7aaa7df0414a29a2bd0b/src/librustdoc/html/static/css/rustdoc.css#L825-L836

20 months agoRemove execute bit from lock file permissions
Danny Milosavljevic [Sat, 1 Oct 2022 01:50:05 +0000 (03:50 +0200)]
Remove execute bit from lock file permissions

20 months agorustdoc: remove redundant CSS on `#copy-path`
Michael Howell [Mon, 17 Oct 2022 18:53:42 +0000 (11:53 -0700)]
rustdoc: remove redundant CSS on `#copy-path`

The border and background were removed in
5d004c1e2020eaa9bc336f09b6b0475c0eef4d78, but not all the CSS was.

20 months agorustdoc: factor JS mobile scroll lock into its own function
Michael Howell [Mon, 17 Oct 2022 18:41:39 +0000 (11:41 -0700)]
rustdoc: factor JS mobile scroll lock into its own function

https://github.com/rust-lang/rust/pull/98775#issuecomment-1172728308

20 months agoRemove the redundant `Some(try_opt!(..))` in `checked_pow`
Josh Stone [Mon, 17 Oct 2022 18:21:50 +0000 (11:21 -0700)]
Remove the redundant `Some(try_opt!(..))` in `checked_pow`

The final return value doesn't need to be tried at all -- we can just
return the checked option directly. The optimizer can probably figure
this out anyway, but there's no need to make it work here.

20 months agoFix typo in `ReverseSearcher` docs
Sky [Mon, 17 Oct 2022 17:14:15 +0000 (13:14 -0400)]
Fix typo in `ReverseSearcher` docs

20 months agoAuto merge of #103151 - matthiaskrgr:rollup-t3mmnsg, r=matthiaskrgr
bors [Mon, 17 Oct 2022 17:05:17 +0000 (17:05 +0000)]
Auto merge of #103151 - matthiaskrgr:rollup-t3mmnsg, r=matthiaskrgr

Rollup of 4 pull requests

Successful merges:

 - #102454 (Suggest parentheses for possible range method calling)
 - #102466 (only allow `ConstEquate` with `feature(gce)`)
 - #102945 (Do not register placeholder `RegionOutlives` obligations when `considering_regions` is false)
 - #103091 (rustdoc: remove unused HTML class `sidebar-title`)

Failed merges:

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

20 months agoUse named arguments to make test clearer
Guillaume Gomez [Mon, 17 Oct 2022 16:08:53 +0000 (18:08 +0200)]
Use named arguments to make test clearer

20 months agoUpdate browser-ui-test version to 0.12.6
Guillaume Gomez [Mon, 17 Oct 2022 16:08:40 +0000 (18:08 +0200)]
Update browser-ui-test version to 0.12.6

20 months agoRollup merge of #103091 - notriddle:notriddle/sidebar-title, r=GuillaumeGomez
Matthias Krüger [Mon, 17 Oct 2022 15:15:51 +0000 (17:15 +0200)]
Rollup merge of #103091 - notriddle:notriddle/sidebar-title, r=GuillaumeGomez

rustdoc: remove unused HTML class `sidebar-title`

Since 6a5f8b1aef1417d7dc85b5d0a229d2db1930eb7c, this class is no longer styled.

20 months agoRollup merge of #102945 - compiler-errors:placeholder-region-outlives, r=lcnr
Matthias Krüger [Mon, 17 Oct 2022 15:15:50 +0000 (17:15 +0200)]
Rollup merge of #102945 - compiler-errors:placeholder-region-outlives, r=lcnr

Do not register placeholder `RegionOutlives` obligations when `considering_regions` is false

**NOTE:** I'm kinda just putting this up for discussion. I'm not certain this is correct...?

This was introduced in [`608625d`](https://github.com/rust-lang/rust/commit/608625dae95cde00e4570eb6c2d63b2244bbf34c#diff-6e54b18681342ec725d75591dbf384ad08cd73df29db00485fe51b4e90f76ff7R361).

Interestingly, we only check `data.has_placeholders()` for `RegionOutlives`, and not for `TypeOutlives`... why? For the record, that different treatment between `RegionOutlives` and `TypeOutlives` is why the fix "The compiling succeeds when all `'a : 'b` are replaced with `&'a () : 'b`" in #100689 _"works"_, but it seems like an implementation detail considering this.

Also, why do we care about placeholder regions being registered if `considering_regions` is false? It doesn't seem to affect any UI tests, for example.

r? `@lcnr`

Fixes #102899
Fixes #100689

20 months agoRollup merge of #102466 - lcnr:const-equate-uwu, r=BoxyUwU
Matthias Krüger [Mon, 17 Oct 2022 15:15:50 +0000 (17:15 +0200)]
Rollup merge of #102466 - lcnr:const-equate-uwu, r=BoxyUwU

only allow `ConstEquate` with `feature(gce)`

20 months agoRollup merge of #102454 - chenyukang:fix-102396-missing-parentheses, r=lcnr
Matthias Krüger [Mon, 17 Oct 2022 15:15:49 +0000 (17:15 +0200)]
Rollup merge of #102454 - chenyukang:fix-102396-missing-parentheses, r=lcnr

Suggest parentheses for possible range method calling

Fixes #102396

20 months agoAuto merge of #102355 - lcnr:bye-bye-type-traversal, r=oli-obk
bors [Mon, 17 Oct 2022 14:19:28 +0000 (14:19 +0000)]
Auto merge of #102355 - lcnr:bye-bye-type-traversal, r=oli-obk

remove type traversal for mir constants

r? `@oli-obk` cc `@b-naber`

20 months agoAuto merge of #103145 - matthiaskrgr:rollup-mxwsysv, r=matthiaskrgr
bors [Mon, 17 Oct 2022 11:33:40 +0000 (11:33 +0000)]
Auto merge of #103145 - matthiaskrgr:rollup-mxwsysv, r=matthiaskrgr

Rollup of 4 pull requests

Successful merges:

 - #102962 (remote-test-server: Show command line arguments)
 - #103129 (rustdoc: remove unused `.sub-logo-container` DOM on non-source pages)
 - #103136 (Fix types in documentation for `Alignment::as_usize` and `Alignmnet::as_nonzero`)
 - #103139 (Duplicate comment in mod.rs)

Failed merges:

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

20 months agoRollup merge of #103139 - smoelius:patch-2, r=Dylan-DPC
Matthias Krüger [Mon, 17 Oct 2022 11:11:08 +0000 (13:11 +0200)]
Rollup merge of #103139 - smoelius:patch-2, r=Dylan-DPC

Duplicate comment in mod.rs

20 months agoRollup merge of #103136 - tmccombs:alignment-doc-fixes, r=Dylan-DPC
Matthias Krüger [Mon, 17 Oct 2022 11:11:07 +0000 (13:11 +0200)]
Rollup merge of #103136 - tmccombs:alignment-doc-fixes, r=Dylan-DPC

Fix types in documentation for `Alignment::as_usize` and `Alignmnet::as_nonzero`

20 months agoRollup merge of #103129 - notriddle:notriddle/sub-logo-container, r=GuillaumeGomez
Matthias Krüger [Mon, 17 Oct 2022 11:11:07 +0000 (13:11 +0200)]
Rollup merge of #103129 - notriddle:notriddle/sub-logo-container, r=GuillaumeGomez

rustdoc: remove unused `.sub-logo-container` DOM on non-source pages

20 months agoRollup merge of #102962 - flba-eb:remote_test_server_help, r=pietroalbini
Matthias Krüger [Mon, 17 Oct 2022 11:11:07 +0000 (13:11 +0200)]
Rollup merge of #102962 - flba-eb:remote_test_server_help, r=pietroalbini

remote-test-server: Show command line arguments

The user of remote-test-server should get at least some minimal command line help as this is often started manually.

r? `@pietroalbini`

20 months agoMake diagnostic for unsatisfied Termination bounds more precise
León Orell Valerian Liehr [Mon, 17 Oct 2022 10:04:16 +0000 (12:04 +0200)]
Make diagnostic for unsatisfied Termination bounds more precise

20 months agoadd inline to `TrivialTypeTraversalImpls`
lcnr [Wed, 5 Oct 2022 16:26:48 +0000 (18:26 +0200)]
add inline to `TrivialTypeTraversalImpls`

20 months agorm `try_normalize_mir_const_after_erasing_regions`
lcnr [Thu, 29 Sep 2022 10:39:35 +0000 (12:39 +0200)]
rm `try_normalize_mir_const_after_erasing_regions`

20 months agomir constants: type traversing bye bye
lcnr [Tue, 27 Sep 2022 09:59:25 +0000 (11:59 +0200)]
mir constants: type traversing bye bye

20 months agoAuto merge of #103116 - TaKO8Ki:fix-103053, r=lcnr
bors [Mon, 17 Oct 2022 08:04:52 +0000 (08:04 +0000)]
Auto merge of #103116 - TaKO8Ki:fix-103053, r=lcnr

Fix `own_substs` ICE

Fixes #103053

20 months agoDuplicate comment in mod.rs
Samuel Moelius [Mon, 17 Oct 2022 07:54:56 +0000 (03:54 -0400)]
Duplicate comment in mod.rs

20 months agoFix types in documentation for Alignment::as_usize and Alignmnet::as_nonzero
Thayne McCombs [Mon, 17 Oct 2022 05:44:06 +0000 (23:44 -0600)]
Fix types in documentation for Alignment::as_usize and Alignmnet::as_nonzero

20 months agoAuto merge of #103096 - petrochenkov:indresdoc, r=cjgillot
bors [Mon, 17 Oct 2022 02:06:25 +0000 (02:06 +0000)]
Auto merge of #103096 - petrochenkov:indresdoc, r=cjgillot

resolve: Shadow erroneous glob imports with erroneous single imports

If such shadowing doesn't happen we end up in a weird state that may cause ICEs.
(In non-erroneous cases single imports always shadow glob imports too.)

Fixes https://github.com/rust-lang/rust/issues/100047
Fixes https://github.com/rust-lang/rust/issues/100241

20 months agorustdoc: clean up `.sub-logo-container` CSS
Michael Howell [Sun, 16 Oct 2022 23:59:21 +0000 (16:59 -0700)]
rustdoc: clean up `.sub-logo-container` CSS

* Since it's used exclusively on source pages, no need to explicitly
  select.

* No need to hide it when the sidebar is open, since it fills the whole
  page.

20 months agorustdoc: remove unused `.sub-logo-container` DOM on non-source pages
Michael Howell [Sun, 16 Oct 2022 23:58:55 +0000 (16:58 -0700)]
rustdoc: remove unused `.sub-logo-container` DOM on non-source pages

20 months agotrivial fix for comments feedback
yukang [Mon, 17 Oct 2022 00:32:08 +0000 (08:32 +0800)]
trivial fix for comments feedback

20 months agoAuto merge of #103125 - matthiaskrgr:rollup-82xttcl, r=matthiaskrgr
bors [Sun, 16 Oct 2022 23:15:20 +0000 (23:15 +0000)]
Auto merge of #103125 - matthiaskrgr:rollup-82xttcl, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #103087 (Documentation BTreeMap::append's behavior for already existing keys)
 - #103089 (Mark derived StructuralEq as automatically derived.)
 - #103102 (Clarify the possible return values of `len_utf16`)
 - #103109 (PhantomData: inline a macro that is used only once)
 - #103120 (rustdoc: Do not expect `doc(primitive)` modules to always exist)

Failed merges:

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

20 months agoRollup merge of #103120 - petrochenkov:docice, r=GuillaumeGomez
Matthias Krüger [Sun, 16 Oct 2022 20:36:07 +0000 (22:36 +0200)]
Rollup merge of #103120 - petrochenkov:docice, r=GuillaumeGomez

rustdoc: Do not expect `doc(primitive)` modules to always exist

The second commit fixes one more ICE by processing impls in crates loaded through the "load all `--extern`s" hack.

Fixes https://github.com/rust-lang/rust/issues/96288
Fixes https://github.com/rust-lang/rust/issues/103028

20 months agoRollup merge of #103109 - RalfJung:phantom-data-impl, r=thomcc
Matthias Krüger [Sun, 16 Oct 2022 20:36:06 +0000 (22:36 +0200)]
Rollup merge of #103109 - RalfJung:phantom-data-impl, r=thomcc

PhantomData: inline a macro that is used only once

I suspect this macro used to have more uses, but right now it just obfuscates the code.

20 months agoRollup merge of #103102 - H4x5:len_utf16_docs, r=scottmcm
Matthias Krüger [Sun, 16 Oct 2022 20:36:06 +0000 (22:36 +0200)]
Rollup merge of #103102 - H4x5:len_utf16_docs, r=scottmcm

Clarify the possible return values of `len_utf16`

`char::len_utf16` always return 1 or 2. Clarify this in the docs, in the same way as `char::len_utf8`.

20 months agoRollup merge of #103089 - cjgillot:automatic-structural-eq, r=oli-obk
Matthias Krüger [Sun, 16 Oct 2022 20:36:05 +0000 (22:36 +0200)]
Rollup merge of #103089 - cjgillot:automatic-structural-eq, r=oli-obk

Mark derived StructuralEq as automatically derived.

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

Drive-by: use correct spans for generic params.
20 months agoRollup merge of #103087 - phimuemue:btreemap_append_doc, r=Mark-Simulacrum
Matthias Krüger [Sun, 16 Oct 2022 20:36:05 +0000 (22:36 +0200)]
Rollup merge of #103087 - phimuemue:btreemap_append_doc, r=Mark-Simulacrum

Documentation BTreeMap::append's behavior for already existing keys

`BTreeMap::append` overwrites existing values with new ones. This commit adds explicit documentation for that.

20 months agoAuto merge of #102026 - Bryanskiy:resolve_update, r=petrochenkov
bors [Sun, 16 Oct 2022 20:34:38 +0000 (20:34 +0000)]
Auto merge of #102026 - Bryanskiy:resolve_update, r=petrochenkov

Populate effective visibilities in 'rustc_resolve'

Next part of RFC https://github.com/rust-lang/rust/issues/48054.
previous: https://github.com/rust-lang/rust/pull/101713

`@rustbot` author
r? `@petrochenkov`

20 months agoSupport DirEntry metadata calls in miri
Alex Saveau [Sat, 15 Oct 2022 03:51:54 +0000 (20:51 -0700)]
Support DirEntry metadata calls in miri

Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
20 months agoPopulate effective visibilities in 'rustc_resolve'
Bryanskiy [Sun, 25 Sep 2022 11:25:02 +0000 (14:25 +0300)]
Populate effective visibilities in 'rustc_resolve'

20 months agorustdoc: Process extern impls in all loaded crates
Vadim Petrochenkov [Sun, 16 Oct 2022 17:51:13 +0000 (21:51 +0400)]
rustdoc: Process extern impls in all loaded crates

including those loaded through hacks.

20 months agoAuto merge of #103119 - matthiaskrgr:rollup-2vb8hif, r=matthiaskrgr
bors [Sun, 16 Oct 2022 17:54:02 +0000 (17:54 +0000)]
Auto merge of #103119 - matthiaskrgr:rollup-2vb8hif, r=matthiaskrgr

Rollup of 4 pull requests

Successful merges:

 - #102857 (Add a regression test for #39137)
 - #102953 (Improve docs for `struct_lint_level` function.)
 - #103060 (rustdoc: make the help button a link to a page)
 - #103115 (Clean up anchors.goml rustdoc GUI test)

Failed merges:

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

20 months agoAuto merge of #13397 - zyctree:zyctree-patch-2, r=lnicola
bors [Sun, 16 Oct 2022 17:40:21 +0000 (17:40 +0000)]
Auto merge of #13397 - zyctree:zyctree-patch-2, r=lnicola

fix link in syntax.md

20 months agoupdate link in syntax.md
zyctree [Sun, 16 Oct 2022 17:39:19 +0000 (01:39 +0800)]
update link in syntax.md

20 months agorustdoc: Do not expect `doc(primitive)` modules to always exist
Vadim Petrochenkov [Sun, 16 Oct 2022 16:39:53 +0000 (20:39 +0400)]
rustdoc: Do not expect `doc(primitive)` modules to always exist

20 months agoRollup merge of #103115 - GuillaumeGomez:clean-up-anchors-gui-test, r=notriddle
Matthias Krüger [Sun, 16 Oct 2022 15:51:32 +0000 (17:51 +0200)]
Rollup merge of #103115 - GuillaumeGomez:clean-up-anchors-gui-test, r=notriddle

Clean up anchors.goml rustdoc GUI test

r? ``@notriddle``

20 months agoRollup merge of #103060 - notriddle:notridddle/help-page, r=GuillaumeGomez
Matthias Krüger [Sun, 16 Oct 2022 15:51:31 +0000 (17:51 +0200)]
Rollup merge of #103060 - notriddle:notridddle/help-page, r=GuillaumeGomez

rustdoc: make the help button a link to a page

This allows you to open the help section in a new browser tab, which is a pretty reasonable thing to want for a documentation page.

Preview: http://notriddle.com/notriddle-rustdoc-demos/help-page/std/index.html

20 months agoRollup merge of #102953 - WaffleLapkin:better_docs_for_decorate_param, r=RalfJung
Matthias Krüger [Sun, 16 Oct 2022 15:51:31 +0000 (17:51 +0200)]
Rollup merge of #102953 - WaffleLapkin:better_docs_for_decorate_param, r=RalfJung

Improve docs for `struct_lint_level` function.

r? ``@RalfJung``

Does this answer your questions?

20 months agoRollup merge of #102857 - saethlin:derived-enum-hash-test, r=Mark-Simulacrum
Matthias Krüger [Sun, 16 Oct 2022 15:51:30 +0000 (17:51 +0200)]
Rollup merge of #102857 - saethlin:derived-enum-hash-test, r=Mark-Simulacrum

Add a regression test for #39137

The problem in the issue has been fixed in the meantime, so since this adds a regression test I think this closes https://github.com/rust-lang/rust/issues/39137

20 months agoupdate link in syntax.md
zyctree [Sun, 16 Oct 2022 15:41:32 +0000 (23:41 +0800)]
update link in syntax.md

20 months agoClarify the possible return values of len_utf16
Sky [Sun, 16 Oct 2022 01:41:45 +0000 (21:41 -0400)]
Clarify the possible return values of len_utf16

20 months agofix typo
Ralf Jung [Sun, 16 Oct 2022 14:47:55 +0000 (16:47 +0200)]
fix typo

20 months agofix `own_substs` ICE
Takayuki Maeda [Sun, 16 Oct 2022 13:24:27 +0000 (22:24 +0900)]
fix `own_substs` ICE

20 months agoClean up anchors.goml rustdoc GUI test
Guillaume Gomez [Sun, 16 Oct 2022 13:15:03 +0000 (15:15 +0200)]
Clean up anchors.goml rustdoc GUI test

20 months agoUpdate browser-ui-test version to 0.12.5
Guillaume Gomez [Sun, 16 Oct 2022 12:12:24 +0000 (14:12 +0200)]
Update browser-ui-test version to 0.12.5

20 months agoAuto merge of #13354 - Veykril:try-stuff, r=Veykril
bors [Sun, 16 Oct 2022 11:11:08 +0000 (11:11 +0000)]
Auto merge of #13354 - Veykril:try-stuff, r=Veykril

feat: Diagnose some incorrect usages of the question mark operator

Trying to figure out how the type stuff in r-a works some more, I think I am doing this correct here but I am not quite sure :)

20 months agoDiagnose incorrect usages of the question mark operator
Lukas Wirth [Wed, 5 Oct 2022 17:15:07 +0000 (19:15 +0200)]
Diagnose incorrect usages of the question mark operator

20 months agoAuto merge of #13408 - lowr:patch/bump-chalk-0.86, r=Veykril
bors [Sun, 16 Oct 2022 10:57:23 +0000 (10:57 +0000)]
Auto merge of #13408 - lowr:patch/bump-chalk-0.86, r=Veykril

Bump chalk

There's a bug in current chalk that prevents us from properly supporting GATs, which is supposed to be fixed in v0.86. Note the following:
- v0.86 is only going to be released next Sunday so I'll keep this PR as draft until then.
- This doesn't compile without https://github.com/rust-lang/chalk/pull/779, which I hope will be included in v0.86. I confirmed this compiles with it locally.

Two breaking changes from v0.84:
- `TypeFolder` has been split into `TypeFolder` and `FallibleTypeFolder` (https://github.com/rust-lang/chalk/pull/772)
- `ProjectionTy::self_type_parameter()` has been removed (https://github.com/rust-lang/chalk/pull/778)

20 months agoBump chalk to 0.86
Ryo Yoshida [Thu, 13 Oct 2022 15:39:14 +0000 (00:39 +0900)]
Bump chalk to 0.86

Two breaking changes:
- `TypeFolder` has been split into `TypeFolder` and `FallibleTypeFolder`
- `ProjectionTy::self_type_parameter()` has been removed

20 months agoAuto merge of #102334 - compiler-errors:rpitit-substs-issue, r=cjgillot
bors [Sun, 16 Oct 2022 10:10:44 +0000 (10:10 +0000)]
Auto merge of #102334 - compiler-errors:rpitit-substs-issue, r=cjgillot

Fix subst issues with return-position `impl Trait` in trait

1. Fix an issue where we were rebase impl substs onto trait method substs, instead of trait substs
2. Fix an issue where early-bound regions aren't being mapped correctly for RPITIT hidden types

Fixes #102301
Fixes #102310
Fixes #102334
Fixes #102918

20 months agoAuto merge of #13421 - rust-lang:Veykril-patch-1, r=Veykril
bors [Sun, 16 Oct 2022 09:52:16 +0000 (09:52 +0000)]
Auto merge of #13421 - rust-lang:Veykril-patch-1, r=Veykril

Update guide.md to reflect support for proc-macros

20 months agoUpdate guide.md to reflect support for proc-macros
Lukas Wirth [Sun, 16 Oct 2022 09:52:01 +0000 (11:52 +0200)]
Update guide.md to reflect support for proc-macros

20 months agoAuto merge of #13402 - HKalbasi:patch-1, r=Veykril
bors [Sun, 16 Oct 2022 09:20:38 +0000 (09:20 +0000)]
Auto merge of #13402 - HKalbasi:patch-1, r=Veykril

Cast runnableEnv items to string

fix #13390

An alternative approach could be raising an error if there is non string values.

20 months agoAuto merge of #13420 - volsa:master, r=Veykril
bors [Sun, 16 Oct 2022 08:42:24 +0000 (08:42 +0000)]
Auto merge of #13420 - volsa:master, r=Veykril

fix: Ignore auto-import assist on parameter names

Fixes #13105; before & after

https://user-images.githubusercontent.com/29666622/195999489-0474c93a-b2bf-41c4-b7da-a4242a8082d8.mov

https://user-images.githubusercontent.com/29666622/195999571-605ee09c-bc6f-4ee5-bfe4-73e37254c647.mov

20 months agoPhantomData: inline a macro that is used only once
Ralf Jung [Sun, 16 Oct 2022 08:36:13 +0000 (10:36 +0200)]
PhantomData: inline a macro that is used only once

20 months agoAuto merge of #102080 - yanchen4791:issue-99824-fix, r=cjgillot
bors [Sun, 16 Oct 2022 07:40:56 +0000 (07:40 +0000)]
Auto merge of #102080 - yanchen4791:issue-99824-fix, r=cjgillot

Fix missing explanation of where the borrowed reference is used when the same borrow occurs multiple times due to loop iterations

Fix #99824.

Problem of the issue:
If a borrow occurs in a loop, the borrowed reference could be invalidated at the same place at next iteration of the loop. When this happens, the point where the borrow occurs is the same as the intervening point that might invalidate the reference in the loop. This causes a problem for the current code finding the point where the resulting reference is used, so that the explanation of the cause will be missing. As the second point of "explain all errors in terms of three points" (see [leveraging intuition framing errors in terms of points"](https://rust-lang.github.io/rfcs/2094-nll.html#leveraging-intuition-framing-errors-in-terms-of-points), this explanation is very helpful for user to understand the error.

In the current implementation, the searching region for finding the location where the borrowed reference is used is limited to between the place where the borrow occurs and the place where the reference is invalidated. If those two places happen to be the same, which indicates that the borrow and invalidation occur at the same place in a loop, the search will fail.

One solution to the problem is when these two places are the same,  find the terminator of the loop, and then use the location of the loop terminator instead of the location of the borrow for the region to find the place where the borrowed reference is used.

20 months agoAuto merge of #103105 - JohnTitor:rollup-x4ivrix, r=JohnTitor
bors [Sun, 16 Oct 2022 04:54:29 +0000 (04:54 +0000)]
Auto merge of #103105 - JohnTitor:rollup-x4ivrix, r=JohnTitor

Rollup of 6 pull requests

Successful merges:

 - #101717 (Add documentation about the memory layout of `UnsafeCell<T>`)
 - #102023 (Add MaybeUninit array transpose From impls)
 - #103033 (Update pkg-config)
 - #103080 (pretty: fix to print some lifetimes on HIR pretty-print)
 - #103082 (Surround type with backticks)
 - #103088 (Fix settings page)

Failed merges:

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

20 months agorustdoc: make help button a no-op when on help page
Michael Howell [Sun, 16 Oct 2022 04:02:57 +0000 (21:02 -0700)]
rustdoc: make help button a no-op when on help page

20 months agoRollup merge of #103088 - GuillaumeGomez:fix-settings-page, r=notriddle
Yuki Okushi [Sun, 16 Oct 2022 02:41:14 +0000 (11:41 +0900)]
Rollup merge of #103088 - GuillaumeGomez:fix-settings-page, r=notriddle

Fix settings page

Thanks to https://github.com/rust-lang/rust/pull/103060, I discovered that the settings page was badly rendered. This PR fixes it.

Before:
![Screenshot from 2022-10-15 16-02-41](https://user-images.githubusercontent.com/3050060/195990668-42e0b16b-3146-4864-b822-6f6a80fb77a5.png)

After:
![Screenshot from 2022-10-15 16-02-31](https://user-images.githubusercontent.com/3050060/195990664-20f967df-8989-4336-bca9-be52baab8e81.png)

r? ```@notriddle```

20 months agoRollup merge of #103082 - gimbles:patch-1, r=cjgillo
Yuki Okushi [Sun, 16 Oct 2022 02:41:14 +0000 (11:41 +0900)]
Rollup merge of #103082 - gimbles:patch-1, r=cjgillo

Surround type with backticks

Very smol PR. :)

20 months agoRollup merge of #103080 - ohno418:fix-hir-pretty-print-lifetimes, r=cjgillot
Yuki Okushi [Sun, 16 Oct 2022 02:41:13 +0000 (11:41 +0900)]
Rollup merge of #103080 - ohno418:fix-hir-pretty-print-lifetimes, r=cjgillot

pretty: fix to print some lifetimes on HIR pretty-print

HIR pretty-printer doesn't seem to print some lifetimes in types. This PR fixes that.

Closes https://github.com/rust-lang/rust/issues/85089

20 months agoRollup merge of #103033 - alyssais:pkg-config, r=joshtriplett
Yuki Okushi [Sun, 16 Oct 2022 02:41:13 +0000 (11:41 +0900)]
Rollup merge of #103033 - alyssais:pkg-config, r=joshtriplett

Update pkg-config

I'd like to be able to cross-compile rustc in a scenario where it'd be really helpful to have https://github.com/rust-lang/pkg-config-rs/commit/cd3ccca7c3b89644e74b0217ef93c632efd8ed2a.  I've done some test builds of the compiler on x86_64 linux, targeting x86_64 linux and aarch64 linux.

20 months agoRollup merge of #102023 - SUPERCILEX:maybeuninit-transpose, r=scottmcm
Yuki Okushi [Sun, 16 Oct 2022 02:41:12 +0000 (11:41 +0900)]
Rollup merge of #102023 - SUPERCILEX:maybeuninit-transpose, r=scottmcm

Add MaybeUninit array transpose From impls

See discussion in https://github.com/rust-lang/rust/pull/101179 and https://github.com/rust-lang/rust/issues/96097. I believe this solution offers the simplest implementation with minimal future API regret.

`@RalfJung` mind doing a correctness review?

20 months agoRollup merge of #101717 - Pointerbender:unsafecell-memory-layout, r=Amanieu
Yuki Okushi [Sun, 16 Oct 2022 02:41:12 +0000 (11:41 +0900)]
Rollup merge of #101717 - Pointerbender:unsafecell-memory-layout, r=Amanieu

Add documentation about the memory layout of `UnsafeCell<T>`

The documentation for `UnsafeCell<T>` currently does not make any promises about its memory layout. This PR adds this documentation, namely that the memory layout of `UnsafeCell<T>` is the same as the memory layout of its inner `T`.

# Use case
Without this layout promise, the following cast would not be legally possible:

```rust
fn example<T>(ptr: *mut T) -> *const UnsafeCell<T> {
  ptr as *const UnsafeCell<T>
}
```

A use case where this can come up involves FFI. If Rust receives a pointer over a FFI boundary which provides shared read-write access (with some form of custom synchronization), and this pointer is managed by some Rust struct with lifetime `'a`, then it would greatly simplify its (internal) API and safety contract if a `&'a UnsafeCell<T>` can be created from a raw FFI pointer `*mut T`. A lot of safety checks can be done when receiving the pointer for the first time through FFI (non-nullness, alignment, initialize uninit bytes, etc.) and these properties can then be encoded into the `&UnsafeCell<T>` type. Without this documentation guarantee, this is not legal today outside of the standard library.

# Caveats
Casting in the opposite direction is still not valid, even with this documentation change:

```rust
fn example2<T>(ptr: &UnsafeCell<T>) -> &mut T {
  let t = ptr as *const UnsafeCell<T> as *mut T;
  unsafe { &mut *t }
}
```

This is because the only legal way to obtain a mutable pointer to the contents of the shared reference is through [`UnsafeCell::get`](https://doc.rust-lang.org/std/cell/struct.UnsafeCell.html#method.get) and [`UnsafeCell::raw_get`](https://doc.rust-lang.org/std/cell/struct.UnsafeCell.html#method.raw_get). Although there might be a desire to also make this legal at some point in the future, that part is outside the scope of this PR. Also see this relevant [Zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/136281-t-lang.2Fwg-unsafe-code-guidelines/topic/transmuting.20.26.20-.3E.20.26mut).

# Alternatives
Instead of adding a new documentation promise, it's also possible to add a new method to `UnsafeCell<T>` with signature `pub fn from_ptr_bikeshed(ptr: *mut T) -> *const UnsafeCell<T>` which indirectly only allows one-way casting to `*const UnsafeCell<T>`.

20 months agoAuto merge of #102931 - camsteffen:inline-overlapping-impls, r=cjgillot
bors [Sun, 16 Oct 2022 02:05:30 +0000 (02:05 +0000)]
Auto merge of #102931 - camsteffen:inline-overlapping-impls, r=cjgillot

Make `overlapping_impls` not generic

Trying to win back perf from #101632.

20 months agoAdd MaybeUninit array transpose impls
Alex Saveau [Sat, 15 Oct 2022 22:57:19 +0000 (15:57 -0700)]
Add MaybeUninit array transpose impls

Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
20 months agoAuto merge of #100579 - joboet:sync_mutex_everywhere, r=thomcc
bors [Sat, 15 Oct 2022 22:49:30 +0000 (22:49 +0000)]
Auto merge of #100579 - joboet:sync_mutex_everywhere, r=thomcc

std: use `sync::Mutex` for internal statics

Since `sync::Mutex` is now `const`-constructible, it can be used for internal statics, removing the need for `sys_common::StaticMutex`. This adds some extra allocations on platforms which need to box their mutexes (currently SGX and some UNIX), but these will become unnecessary with the lock improvements tracked in #93740.

I changed the program argument implementation on Hermit, it does not need `Mutex` but can use atomics like some UNIX systems (ping `@mkroening` `@stlankes).`

20 months agoresolve: Shadow erroneous glob imports with erroneous single imports
Vadim Petrochenkov [Sat, 15 Oct 2022 18:37:31 +0000 (22:37 +0400)]
resolve: Shadow erroneous glob imports with erroneous single imports