]> git.lizzy.rs Git - rust.git/log
rust.git
17 months agoAuto merge of #106442 - matthiaskrgr:rollup-wivf7gh, r=matthiaskrgr
bors [Wed, 4 Jan 2023 09:41:43 +0000 (09:41 +0000)]
Auto merge of #106442 - matthiaskrgr:rollup-wivf7gh, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #106200 (Suggest `impl Fn*` and `impl Future` in `-> _` return suggestions)
 - #106274 (Add JSON output to -Zdump-mono-stats)
 - #106292 (Add codegen test for `Box::new(uninit)` of big arrays)
 - #106327 (Add tidy check for dbg)
 - #106361 (Note maximum integer literal for `IntLiteralTooLarge`)
 - #106396 (Allow passing a specific date to `bump-stage0`)
 - #106436 (Enable doctests for rustc_query_impl)

Failed merges:

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

17 months agoRollup merge of #106436 - CarsonV:doctest_query_impl, r=jyn514
Matthias Krüger [Wed, 4 Jan 2023 06:28:57 +0000 (07:28 +0100)]
Rollup merge of #106436 - CarsonV:doctest_query_impl, r=jyn514

Enable doctests for rustc_query_impl

doctests worked out of the box for query_impl on my local machine. Working towards #99144

17 months agoRollup merge of #106396 - jyn514:bump-stage-date, r=pietroalbini
Matthias Krüger [Wed, 4 Jan 2023 06:28:56 +0000 (07:28 +0100)]
Rollup merge of #106396 - jyn514:bump-stage-date, r=pietroalbini

Allow passing a specific date to `bump-stage0`

This allows regenerating `src/stage0.json` on changes to the tool, without needing to hard-code the date in the source. It was useful for https://github.com/rust-lang/rust/pull/106394, which added clippy to the list of required components.

r? `@pietroalbini`

17 months agoRollup merge of #106361 - clubby789:int-literal-too-large, r=estebank
Matthias Krüger [Wed, 4 Jan 2023 06:28:56 +0000 (07:28 +0100)]
Rollup merge of #106361 - clubby789:int-literal-too-large, r=estebank

Note maximum integer literal for `IntLiteralTooLarge`

Closes #105908

`@rustbot` label +A-diagnostics

17 months agoRollup merge of #106327 - gimbles:dbg, r=jyn514
Matthias Krüger [Wed, 4 Jan 2023 06:28:55 +0000 (07:28 +0100)]
Rollup merge of #106327 - gimbles:dbg, r=jyn514

Add tidy check for dbg

Fixes #106169

17 months agoRollup merge of #106292 - Nilstrieb:box-uninit-test, r=RalfJung
Matthias Krüger [Wed, 4 Jan 2023 06:28:55 +0000 (07:28 +0100)]
Rollup merge of #106292 - Nilstrieb:box-uninit-test, r=RalfJung

Add codegen test for `Box::new(uninit)` of big arrays

Closes #58201

r? `@RalfJung`

17 months agoRollup merge of #106274 - jyn514:dump-mono-stats, r=lqd
Matthias Krüger [Wed, 4 Jan 2023 06:28:54 +0000 (07:28 +0100)]
Rollup merge of #106274 - jyn514:dump-mono-stats, r=lqd

Add JSON output to -Zdump-mono-stats

Follow-up to https://github.com/rust-lang/rust/pull/105481

r? `@lqd` cc `@wesleywiser`

17 months agoRollup merge of #106200 - compiler-errors:suggest-impl-trait, r=estebank
Matthias Krüger [Wed, 4 Jan 2023 06:28:54 +0000 (07:28 +0100)]
Rollup merge of #106200 - compiler-errors:suggest-impl-trait, r=estebank

Suggest `impl Fn*` and `impl Future` in `-> _` return suggestions

Follow-up to #106172, only the last commit is relevant. Can rebase once that PR is landed for easier review.

Suggests `impl Future` and `impl Fn{,Mut,Once}` in `-> _` return suggestions.

r? `@estebank`

17 months agoAuto merge of #104376 - compiler-errors:thin-metadata-implies-thin-ptr, r=wesleywiser
bors [Wed, 4 Jan 2023 06:28:05 +0000 (06:28 +0000)]
Auto merge of #104376 - compiler-errors:thin-metadata-implies-thin-ptr, r=wesleywiser

layout_of: `T: Thin` implies `sizeof(&T) == sizeof(usize)`

Use the `<T as Pointee>::Metadata` associated type to calculate the layout of a pointee's metadata, instead of hard-coding rules about certain types.

Maybe this approach is overkill -- we could instead hard-code this approach as a fallback, with the matching on `Slice`/`Dynamic`/etc. happening first

Fixes this issue here https://github.com/rust-lang/rust/pull/104338#issuecomment-1312595844 .. But is also useful with transmutes, for example, given the UI test I added below.

17 months agoAuto merge of #106432 - compiler-errors:rollup-lzj0lnp, r=compiler-errors
bors [Wed, 4 Jan 2023 03:37:21 +0000 (03:37 +0000)]
Auto merge of #106432 - compiler-errors:rollup-lzj0lnp, r=compiler-errors

Rollup of 8 pull requests

Successful merges:

 - #104748 (Ensure `lld` is supported with `download-ci-llvm`)
 - #105541 (Simplify some iterator combinators)
 - #106045 (default OOM handler: use non-unwinding panic, to match std handler)
 - #106157 (Don't trim path for `unsafe_op_in_unsafe_fn` lints)
 - #106353 (Reduce spans for `unsafe impl` errors)
 - #106381 (Jsondoclint: Add `--verbose` and `--json-output` options)
 - #106411 (rustdoc: remove legacy font-feature-settings CSS)
 - #106414 (Add cuviper to the review rotation for libs)

Failed merges:

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

17 months agoEnable query_impl doctests
CarsonV [Wed, 4 Jan 2023 02:12:09 +0000 (20:12 -0600)]
Enable query_impl doctests

17 months agoRollup merge of #106414 - cuviper:libs-review, r=Mark-Simulacrum
Michael Goulet [Wed, 4 Jan 2023 01:19:28 +0000 (17:19 -0800)]
Rollup merge of #106414 - cuviper:libs-review, r=Mark-Simulacrum

Add cuviper to the review rotation for libs

17 months agoRollup merge of #106411 - notriddle:notriddle/font-feature-settings, r=GuillaumeGomez
Michael Goulet [Wed, 4 Jan 2023 01:19:28 +0000 (17:19 -0800)]
Rollup merge of #106411 - notriddle:notriddle/font-feature-settings, r=GuillaumeGomez

rustdoc: remove legacy font-feature-settings CSS

According to [caniuse], these vendor prefixes aren't needed in any supported web browsers as defined in [RFC 1985].

* The last version of Chrome that required a vendor prefix was version 47. The current version is 108.
* Firefox 33 is the last version that required a vendor prefix. The [current Firefox ESR] is version 102.
* The last version of Safari that required a vendor prefix was version 9.1. The current version is 16.
* The last version of Safari/iOS that required a vendor prefix was version 9.3. The current version is 16.
* Edge never required vendor prefixes.
* UCAndroid never required vendor prefixes.

[caniuse]: https://caniuse.com/?search=font-feature-settings
[RFC 1985]: https://rust-lang.github.io/rfcs/1985-tiered-browser-support.html
[current Firefox ESR]: https://wiki.mozilla.org/Releases

17 months agoRollup merge of #106381 - aDotInTheVoid:jsondoclint-more-options, r=notriddle
Michael Goulet [Wed, 4 Jan 2023 01:19:27 +0000 (17:19 -0800)]
Rollup merge of #106381 - aDotInTheVoid:jsondoclint-more-options, r=notriddle

Jsondoclint: Add `--verbose` and `--json-output` options

There quite helpful for manually using jsondoclint as a debugging tool, especially on large files (these were written to look into core.json).

r? rustdoc

17 months agoRollup merge of #106353 - lukas-code:reduce-red-lines-in-my-ide, r=wesleywiser
Michael Goulet [Wed, 4 Jan 2023 01:19:27 +0000 (17:19 -0800)]
Rollup merge of #106353 - lukas-code:reduce-red-lines-in-my-ide, r=wesleywiser

Reduce spans for `unsafe impl` errors

Because huge spans aren't great for IDEs.

Prior art: https://github.com/rust-lang/rust/pull/103749

17 months agoRollup merge of #106157 - LeSeulArtichaut:106126-thir-unsafeck-good-path-bug-2, r...
Michael Goulet [Wed, 4 Jan 2023 01:19:26 +0000 (17:19 -0800)]
Rollup merge of #106157 - LeSeulArtichaut:106126-thir-unsafeck-good-path-bug-2, r=compiler-errors

Don't trim path for `unsafe_op_in_unsafe_fn` lints

Fixes #106126, alternative to #106127.
r? `@ghost` for now.

17 months agoRollup merge of #106045 - RalfJung:oom-nounwind-panic, r=Amanieu
Michael Goulet [Wed, 4 Jan 2023 01:19:26 +0000 (17:19 -0800)]
Rollup merge of #106045 - RalfJung:oom-nounwind-panic, r=Amanieu

default OOM handler: use non-unwinding panic, to match std handler

The OOM handler in std will by default abort. This adjusts the default in liballoc to do the same, using the `can_unwind` flag on the panic info to indicate a non-unwinding panic.

In practice this probably makes little difference since the liballoc default will only come into play in no-std situations where people write a custom panic handler, which most likely will not implement unwinding. But still, this seems more consistent.

Cc `@rust-lang/wg-allocators,` https://github.com/rust-lang/rust/issues/66741

17 months agoRollup merge of #105541 - compiler-errors:iter-comb, r=cjgillot
Michael Goulet [Wed, 4 Jan 2023 01:19:25 +0000 (17:19 -0800)]
Rollup merge of #105541 - compiler-errors:iter-comb, r=cjgillot

Simplify some iterator combinators

Saw a `flat_map().next()` instead of a `find_map()` in some method probe code, so did a quick search for some similar usages.

17 months agoRollup merge of #104748 - lqd:download_lld, r=jyn514
Michael Goulet [Wed, 4 Jan 2023 01:19:25 +0000 (17:19 -0800)]
Rollup merge of #104748 - lqd:download_lld, r=jyn514

Ensure `lld` is supported with `download-ci-llvm`

This PR:
- ensures LLD's step in bootstrap's dist, but it's not strictly necessary since dist will already package it when it's present.
- makes bootstrap's `native::LLD` step support using the packaged `ci-llvm/bin/lld`, instead of building it from source (which would most likely not be available today, nor in the future where `download-ci-llvm = if-available` is the default).

If I understand correctly, `--enable-full-tools` will also enable `rust.lld`, and this is why LLD is already packaged today in the `rust-dev` component on the main targets (and why `-Zgcc-ld=lld` does work there).

That means it's likely that this PR will not be able to land before I've reworked and landed #101792: if LLD is available in `download-ci-llvm`, the `needs-rust-lld` tests should start being executed on the x64 macOS test builders, and CI would fail today.

I've tested locally that building with `download-ci-llvm = true` and `lld = true` with the LLVM submodule unregistered was successful, and that `rust-lld` and the various `lld-wrapper`s are present and `-Zgcc-ld=lld` works as well, on a few different platforms:
- `x86_64-unknown-linux-gnu`
- `aarch64-apple-darwin`
- `x86_64-pc-windows-msvc` (with `-Clinker=rust-lld` rather than `-Zgcc-ld=lld`)
- `x86_64-apple-darwin`, with the `MACOSX_DEPLOYMENT_TARGET` workaround for #101653

I don't think we really need to bump the `download-ci-llvm-stamp` in this case, since `./build/$triple/ci-llvm/bin/lld` is present on all the above targets already, but have added it mechanically, and it should probably be removed to avoid unnecessary downloads/churn.

Fixes #98340
Supersedes #100010

17 months agoreview comment: Deduplicate dyn ty_and_layout_field code
Michael Goulet [Wed, 4 Jan 2023 01:02:52 +0000 (01:02 +0000)]
review comment: Deduplicate dyn ty_and_layout_field code

17 months agoMirror metadata changes in layout sanity check
Michael Goulet [Sun, 13 Nov 2022 21:49:54 +0000 (21:49 +0000)]
Mirror metadata changes in layout sanity check

17 months agolayout_of: `T: Thin` implies `sizeof(&T) == sizeof(usize)`
Michael Goulet [Sat, 12 Nov 2022 23:54:39 +0000 (23:54 +0000)]
layout_of: `T: Thin` implies `sizeof(&T) == sizeof(usize)`

17 months agoAddress comments
Michael Goulet [Tue, 27 Dec 2022 17:53:29 +0000 (17:53 +0000)]
Address comments

17 months agoSimplify some iterator combinators
Michael Goulet [Sat, 10 Dec 2022 20:31:01 +0000 (20:31 +0000)]
Simplify some iterator combinators

17 months agoRestore Fn trait note
Michael Goulet [Wed, 4 Jan 2023 00:26:53 +0000 (00:26 +0000)]
Restore Fn trait note

17 months agoSuggest more impl Trait on `-> _`
Michael Goulet [Tue, 27 Dec 2022 23:56:46 +0000 (23:56 +0000)]
Suggest more impl Trait on `-> _`

17 months agoAuto merge of #105712 - amg98:feat/vita-support, r=wesleywiser
bors [Tue, 3 Jan 2023 23:38:28 +0000 (23:38 +0000)]
Auto merge of #105712 - amg98:feat/vita-support, r=wesleywiser

PlayStation Vita support

Just the compiler definitions for no-std projects and std support using newlib

Earlier PR: https://github.com/rust-lang/rust/pull/105606

17 months agoAuto merge of #105752 - chenyukang:yukang/refactor-method-error, r=compiler-errors
bors [Tue, 3 Jan 2023 20:44:40 +0000 (20:44 +0000)]
Auto merge of #105752 - chenyukang:yukang/refactor-method-error, r=compiler-errors

Refactoring report_method_error

While working on #105732, I found it's hard to follow this long function,
so I tried to make it shorter.

It's not easy for code reviewing, since so many lines of code changes,
but only the positions are changed.

Generally, I extract two sub-methods from `report_method_error`:

https://github.com/rust-lang/rust/blob/397b66e77b279de5006facf87979f9ecff5c7f87/compiler/rustc_hir_typeck/src/method/suggest.rs#L117
to `note_candidates_on_method_error`

And this long block:
https://github.com/rust-lang/rust/blob/397b66e77b279de5006facf87979f9ecff5c7f87/compiler/rustc_hir_typeck/src/method/suggest.rs#L263

to `report_no_match_method_error`.

r? `@compiler-errors`

17 months agoensure lld's step unconditionally for RustDev component
Rémy Rakic [Tue, 3 Jan 2023 20:21:49 +0000 (20:21 +0000)]
ensure lld's step unconditionally for RustDev component

17 months agobump download-ci-llvm-stamp
Rémy Rakic [Tue, 22 Nov 2022 22:38:53 +0000 (22:38 +0000)]
bump download-ci-llvm-stamp

17 months agoturn a comment into an actual doc comment
Rémy Rakic [Wed, 23 Nov 2022 18:16:37 +0000 (18:16 +0000)]
turn a comment into an actual doc comment

17 months agoslight cleanup
Rémy Rakic [Wed, 23 Nov 2022 18:12:58 +0000 (18:12 +0000)]
slight cleanup

17 months agomake the `native::LLD` step able to use an already built lld
Rémy Rakic [Wed, 23 Nov 2022 18:08:15 +0000 (18:08 +0000)]
make the `native::LLD` step able to use an already built lld

Makes the lld step avoid building it from source when possible: when
dist has packaged it along the other LLVM binaries for the rust-dev
component.

17 months agobootstrap dist: ensure LLD's step
Rémy Rakic [Wed, 23 Nov 2022 18:20:57 +0000 (18:20 +0000)]
bootstrap dist: ensure LLD's step

17 months agoAdd cuviper to the review rotation for libs
Josh Stone [Tue, 3 Jan 2023 17:47:03 +0000 (09:47 -0800)]
Add cuviper to the review rotation for libs

17 months agorustdoc: remove legacy font-feature-settings CSS
Michael Howell [Tue, 3 Jan 2023 17:23:55 +0000 (10:23 -0700)]
rustdoc: remove legacy font-feature-settings CSS

According to [caniuse], these vendor prefixes aren't needed in any supported
web browsers as defined in [RFC 1985].

* The last version of Chrome that required a vendor prefix was version 47.
  The current version is 108.
* Firefox 33 is the last version that required a vendor prefix. The
  [current Firefox ESR] is version 102.
* The last version of Safari that required a vendor prefix was version 9.1.
  The current version is 16.
* The last version of Safari/iOS that required a vendor prefix was version
  9.3. The current version is 16.
* Edge never required vendor prefixes.
* UCAndroid never required vendor prefixes.

[caniuse]: https://caniuse.com/?search=font-feature-settings
[RFC 1985]: https://rust-lang.github.io/rfcs/1985-tiered-browser-support.html
[current Firefox ESR]: https://wiki.mozilla.org/Releases

17 months agoAuto merge of #106409 - matthiaskrgr:rollup-b58z1hz, r=matthiaskrgr
bors [Tue, 3 Jan 2023 17:08:17 +0000 (17:08 +0000)]
Auto merge of #106409 - matthiaskrgr:rollup-b58z1hz, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #104552 (warn newer available version of the x tool)
 - #105681 (some fixes/improvements to mir::visit module)
 - #106005 (Test the borrowck behavior of if-let guards)
 - #106356 (clean: Remove `ctor_kind` from `VariantStruct`.)
 - #106365 (Grammar : Missing "is" in format specifier diagnostic)
 - #106388 (rustdoc: remove legacy box-sizing CSS)
 - #106392 (`has_overflow` only if value is *not* within limit)
 - #106402 (Fix dupe word typos)

Failed merges:

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

17 months agoRollup merge of #106402 - Rageking8:fix_dupe_word_typos, r=Nilstrieb
Matthias Krüger [Tue, 3 Jan 2023 16:12:13 +0000 (17:12 +0100)]
Rollup merge of #106402 - Rageking8:fix_dupe_word_typos, r=Nilstrieb

Fix dupe word typos

r? `@Nilstrieb`
Thanks!

17 months agoRollup merge of #106392 - compiler-errors:new-trait-solver-overflow, r=lcnr
Matthias Krüger [Tue, 3 Jan 2023 16:12:13 +0000 (17:12 +0100)]
Rollup merge of #106392 - compiler-errors:new-trait-solver-overflow, r=lcnr

`has_overflow` only if value is *not* within limit

New solver forgot a not operator, I think.

17 months agoRollup merge of #106388 - notriddle:notriddle/box-sizing, r=camelid
Matthias Krüger [Tue, 3 Jan 2023 16:12:12 +0000 (17:12 +0100)]
Rollup merge of #106388 - notriddle:notriddle/box-sizing, r=camelid

rustdoc: remove legacy box-sizing CSS

According to [caniuse], these vendor prefixes aren't needed in any supported web browsers as defined in [RFC 1985]

* The last version of Chrome that required a vendor prefix was version 9. The current version is 108.
* Firefox 28 is the last version that required a vendor prefix. The [current Firefox ESR] is version 102.
* The last version of Safari that required a vendor prefix was version 5. The current version is 16.
* The last version of Safari/iOS that required a vendor prefix was version 4. The current version is 16.
* Edge never required vendor prefixes.
* UCAndroid never required vendor prefixes.

[caniuse]: https://caniuse.com/?search=box-sizing
[RFC 1985]: https://rust-lang.github.io/rfcs/1985-tiered-browser-support.html
[current Firefox ESR]: https://wiki.mozilla.org/Releases

17 months agoRollup merge of #106365 - gimbles:patch-1, r=jyn514
Matthias Krüger [Tue, 3 Jan 2023 16:12:12 +0000 (17:12 +0100)]
Rollup merge of #106365 - gimbles:patch-1, r=jyn514

Grammar : Missing "is" in format specifier diagnostic

17 months agoRollup merge of #106356 - aDotInTheVoid:del-ctor-kind, r=jyn514
Matthias Krüger [Tue, 3 Jan 2023 16:12:11 +0000 (17:12 +0100)]
Rollup merge of #106356 - aDotInTheVoid:del-ctor-kind, r=jyn514

clean: Remove `ctor_kind` from `VariantStruct`.

It's always `None`.

r? `@ghost`

17 months agoRollup merge of #106005 - LeSeulArtichaut:if-let-guard-borrowck-test, r=Nilstrieb
Matthias Krüger [Tue, 3 Jan 2023 16:12:11 +0000 (17:12 +0100)]
Rollup merge of #106005 - LeSeulArtichaut:if-let-guard-borrowck-test, r=Nilstrieb

Test the borrowck behavior of if-let guards

Add some tests to make sure that if-let guards behave the same as if guards with respect to borrow-checking. Most of them are a naive adaptation, replacing an `if` guard with `if let Some(())`.
This includes regression tests for notable issues that arose for if guards (#24535, #27282, #29723, #31287) as suggested in https://github.com/rust-lang/rust/issues/51114#issuecomment-900470419.

cc `@pnkfelix` are there any other tests that you would want to see?
cc tracking issue #51114

17 months agoRollup merge of #105681 - tshepang:doc-mir-visit, r=Nilstrieb
Matthias Krüger [Tue, 3 Jan 2023 16:12:10 +0000 (17:12 +0100)]
Rollup merge of #105681 - tshepang:doc-mir-visit, r=Nilstrieb

some fixes/improvements to mir::visit module

17 months agoRollup merge of #104552 - DebugSteven:warn-newer-x, r=jyn514
Matthias Krüger [Tue, 3 Jan 2023 16:12:10 +0000 (17:12 +0100)]
Rollup merge of #104552 - DebugSteven:warn-newer-x, r=jyn514

warn newer available version of the x tool

This PR adds a check to `tidy` to assert that the installed version of `x` is equal to the version in `src/tools/x/Cargo.toml`. It adds a `--wrapper-version` argument to `x` to determine the version at runtime, .

It does not warn if `x` has not yet been installed, on the assumption that the user isn't interested in using it.

18 months agoclean: Remove `ctor_kind` from `VariantStruct`.
Nixon Enraght-Moony [Sun, 1 Jan 2023 20:07:45 +0000 (20:07 +0000)]
clean: Remove `ctor_kind` from `VariantStruct`.

It's always `None`.

18 months agojsondoclint: Add option to dump errors as json.
Nixon Enraght-Moony [Mon, 2 Jan 2023 20:15:45 +0000 (20:15 +0000)]
jsondoclint: Add option to dump errors as json.

The output looks like:
{
  "errors": [
    {
      "id": "2:2017:1833",
      "kind": {
        "NotFound": [
          [
            {"Field": "index"},
            {"Field": "0:0:1571"},
            {"Field": "links"},
            {"Field": "pointer::read"}
          ]
        ]
      }
    }
  ],
  "path": "/home/nixon/dev/rust/rust/build/x86_64-unknown-linux-gnu/test/rustdoc-json/intra-doc-links/pointer_method/pointer_method.json"
}

18 months agojsondoclint: Find selector for missing ID when error is created, not reported.
Nixon Enraght-Moony [Mon, 2 Jan 2023 19:54:08 +0000 (19:54 +0000)]
jsondoclint: Find selector for missing ID when error is created, not reported.

This is needed for json output, but even without that, it increases
performance massivly. On my machine, in reduces the time to check
core.json from 40.190s to 11.333s.

18 months agojsondoclint: Add `--verbose` flag.
Nixon Enraght-Moony [Mon, 2 Jan 2023 19:40:00 +0000 (19:40 +0000)]
jsondoclint: Add `--verbose` flag.

Without verbose:
    0:61941:36627 not in index or paths, but refered to at '$.index["0:62007"].inner.for.inner.id' and 12 more

With verbose:
    0:10808:27206 not in index or paths, but refered to at '$.index["0:10813"].inner.for.inner.id', '$.index["0:52495"].inner.for.inner.id', '$.index["a:0:2666:215-0:10808:27206"].inner.for.inner.id', '$.index["a:0:2680:223-0:10808:27206"].inner.for.inner.id', '$.index["a:0:2730:7845-0:10808:27206"].inner.for.inner.id', '$.index["a:0:7731:21706-0:10808:27206"].inner.for.inner.id', '$.index["a:0:7732:21705-0:10808:27206"].inner.for.inner.id'

18 months agojsondoclint: Parse args with clap.
Nixon Enraght-Moony [Mon, 2 Jan 2023 19:30:39 +0000 (19:30 +0000)]
jsondoclint: Parse args with clap.

18 months agoAuto merge of #101792 - lqd:rust-lld, r=petrochenkov
bors [Tue, 3 Jan 2023 14:05:44 +0000 (14:05 +0000)]
Auto merge of #101792 - lqd:rust-lld, r=petrochenkov

Only specify `--target` by default for `-Zgcc-ld=lld` on wasm

On macOS, it's not yet clear which cases of clang/OS/target/SDK version impact how to find ld/lld/rust-lld. The `--target` argument is not needed on our current targets with a vanilla config to do so, but may be in some cases ?

That is, things look to be different and more subtle than suggested in https://github.com/rust-lang/rust/issues/97402#issuecomment-1147404520.

Specifying this argument unconditionally currently breaks `-Zgcc-ld=lld` on the 10.7+ targets on x64 macOS. Vanilla configs on x64 and aarch64 don't seem to need it to be able to find `rust-lld`.

This fixes #101653 on macOS (I've tried on x64 and aarch64: vanilla installs with the most recent command line tools available for each of the OS versions I have access to, `run-make/issue-71519` passes).

I didn't expect the previous PRs to fail because of the existing tests, but CI does not actually run those tests yet, which explains the regressions. I was hoping to fix those in this PR but it's more involved (building lld is required for the tests to run, llvm/lld is not built on the test builders but on the dist builders, the dist builders don't run tests). This PR is just to unblock current users on macOS who have reported issues, but a regression could happen in the future by mistake until then.

r? `@petrochenkov`

18 months agoAuto merge of #95644 - WaffleLapkin:str_split_as_str_refactor_take2, r=Amanieu
bors [Tue, 3 Jan 2023 11:06:08 +0000 (11:06 +0000)]
Auto merge of #95644 - WaffleLapkin:str_split_as_str_refactor_take2, r=Amanieu

`Split*::as_str` refactor

I've made this patch almost a year ago, so the rename and the behavior change are in one commit, sorry 😅

This fixes #84974, as it's required to make other changes work.

This PR
- Renames `as_str` method of string `Split*` iterators to `remainder` (it seems like the `as_str` name was confusing to users)
- Makes `remainder` return `Option<&str>`, to distinguish between "the iterator is exhausted" and "the tail is empty", this was [required on the tracking issue](https://github.com/rust-lang/rust/issues/77998#issuecomment-832696619)

r? `@m-ou-se`

18 months agoAuto merge of #105609 - bjorn3:shrink_rustc_dev, r=jyn514
bors [Tue, 3 Jan 2023 08:05:54 +0000 (08:05 +0000)]
Auto merge of #105609 - bjorn3:shrink_rustc_dev, r=jyn514

Only include metadata for non-dynamic libraries in rustc-dev

The actual object code should be linked from librustc_driver.so, which is still included in rustc-dev. This saves on download time and disk usage.

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

18 months agofix dupe word typos
Rageking8 [Tue, 3 Jan 2023 07:48:16 +0000 (15:48 +0800)]
fix dupe word typos

18 months agoAuto merge of #106371 - RalfJung:no-ret-position-noalias, r=nikic
bors [Tue, 3 Jan 2023 04:54:03 +0000 (04:54 +0000)]
Auto merge of #106371 - RalfJung:no-ret-position-noalias, r=nikic

do not add noalias in return position

`noalias` as a return attribute in LLVM indicates that the returned pointer does not alias anything else that is reachable from the caller, *including things reachable before this function call*. This is clearly not the case with a function like `fn id(Box<T>) -> Box<T>`, so we cannot use this attribute.

Fixes https://github.com/rust-lang/unsafe-code-guidelines/issues/385 (including an actual miscompilation that `@comex` managed to produce).

18 months agono_deps
J Haigh [Tue, 3 Jan 2023 03:49:18 +0000 (20:49 -0700)]
no_deps

Co-authored-by: Joshua Nelson <github@jyn.dev>
18 months agoAllow passing a specific date to `bump-stage0`
Joshua Nelson [Tue, 3 Jan 2023 03:39:41 +0000 (03:39 +0000)]
Allow passing a specific date to `bump-stage0`

This allows regenerating `src/stage0.json` on changes to the tool,
without needing to hard-code the date in the source.

18 months agouse cargo_metadata to get x version
DebugSteven [Tue, 3 Jan 2023 02:31:18 +0000 (19:31 -0700)]
use cargo_metadata to get x version

18 months agoAuto merge of #106386 - compiler-errors:rollup-dxjv18b, r=compiler-errors
bors [Tue, 3 Jan 2023 01:45:33 +0000 (01:45 +0000)]
Auto merge of #106386 - compiler-errors:rollup-dxjv18b, r=compiler-errors

Rollup of 8 pull requests

Successful merges:

 - #95985 (Add PhantomData marker to Context to make Context !Send and !Sync)
 - #104298 (Add notes and examples about non-intuitive `PathBuf::set_extension` behavior)
 - #105558 (Reduce HIR debug output)
 - #106315 (Cleanup `mingw-tidy` docker job)
 - #106354 (Rustdoc-Json: Report discriminant on all kinds of enum variant.)
 - #106366 (Fix rustdoc ICE on bad typedef with mismatching types)
 - #106376 (Update books)
 - #106383 (Document some of the AST nodes)

Failed merges:

 - #106356 (clean: Remove `ctor_kind` from `VariantStruct`.)

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

18 months agohas_overflow only if value is *not* within limit
Michael Goulet [Tue, 3 Jan 2023 01:09:08 +0000 (01:09 +0000)]
has_overflow only if value is *not* within limit

18 months agoRollup merge of #106383 - Manishearth:ast-docs, r=compiler-errors
Michael Goulet [Mon, 2 Jan 2023 23:39:19 +0000 (15:39 -0800)]
Rollup merge of #106383 - Manishearth:ast-docs, r=compiler-errors

Document some of the AST nodes

Someone was confused about some of this on Zulip, added some docs

We probably should make sure every last field/variant in the AST/HIR is documented at some point

`@bors` rollup

18 months agoRollup merge of #106376 - rustbot:docs-update, r=ehuss
Michael Goulet [Mon, 2 Jan 2023 23:39:19 +0000 (15:39 -0800)]
Rollup merge of #106376 - rustbot:docs-update, r=ehuss

Update books

## rust-lang/book

3 commits in a60f4316ec923a5ac2ed6a2eba6960edb832d855..2bd5d42c9956369132228da6409f0e68da56c51a
2022-12-22 21:37:10 UTC to 2022-12-22 21:36:14 UTC

- fix macos installation problem (rust-lang/book#3469)
- Update -guessing-game-tutorial incorrect output (rust-lang/book#3462)
- FIX: IT repo updated (rust-lang/book#3454)

## rust-lang/nomicon

1 commits in dd37e21ccee43918ed18a71581bb2af537ffe4fc..8ca261268068d80c0969260fff15199bad87b587
2022-12-30 16:32:09 UTC to 2022-12-30 16:32:09 UTC

- Discourage the use of transmute to construct invalid values (rust-lang/nomicon#388)

## rust-lang/rust-by-example

6 commits in 995df09b65c582eb6290ab7ea5d9485983eb4c37..8888f9428fe9a48f31de6bd2cef9b9bf80791edc
2023-01-01 12:53:50 UTC to 2022-12-21 10:18:31 UTC

- types/alias: use io::{Result,Error} instead of Io{Result,Error} (rust-lang/rust-by-example#1660)
- Fix sample code mismatching its comments (rust-lang/rust-by-example#1659)
- fix: add missing space (rust-lang/rust-by-example#1658)
- diverging: fix issues with example code (rust-lang/rust-by-example#1631)
- Update enum.md (rust-lang/rust-by-example#1645)
- Clean up Chapter 2 (Primitives) (rust-lang/rust-by-example#1651)

## rust-lang/rustc-dev-guide

5 commits in 8b42eb5f57d3d8ed2257a22d0e850d9db52afed3..b3e2a6e6c8a3aae5b5d950c63046f23bae07096d
2023-01-01 05:20:47 UTC to 2022-12-25 12:11:21 UTC

- Add help for when you update a submodule by accident (rust-lang/rustc-dev-guide#1537)
- Simplify "how to build and run" section (rust-lang/rustc-dev-guide#1528)
- Replace `$TARGET` with `host` (rust-lang/rustc-dev-guide#1514)
- Add more rebasing help (rust-lang/rustc-dev-guide#1536)
- Fix rustc_borrowck crate name typo (rust-lang/rustc-dev-guide#1535)

18 months agoRollup merge of #106366 - GuillaumeGomez:fix-rustdoc-ice-typedef-type-mismatch, r...
Michael Goulet [Mon, 2 Jan 2023 23:39:19 +0000 (15:39 -0800)]
Rollup merge of #106366 - GuillaumeGomez:fix-rustdoc-ice-typedef-type-mismatch, r=notriddle

Fix rustdoc ICE on bad typedef with mismatching types

Fixes https://github.com/rust-lang/rust/issues/106226.
Fixes #105742.
Fixes #105737.
Fixes #105334.
Fixes #96287.

In this case, it's ok to replace the panic with `rustc_error::raise` because the compiler provided us with a `Error`.

r? `@notriddle`

18 months agoRollup merge of #106354 - aDotInTheVoid:rdj-always-discr, r=GuillaumeGomez
Michael Goulet [Mon, 2 Jan 2023 23:39:18 +0000 (15:39 -0800)]
Rollup merge of #106354 - aDotInTheVoid:rdj-always-discr, r=GuillaumeGomez

Rustdoc-Json: Report discriminant on all kinds of enum variant.

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

Probably easier to review one commit at a time.

r? `@GuillaumeGomez`

18 months agoRollup merge of #106315 - jyn514:cleanup-mingw-tidy, r=fee1-dead
Michael Goulet [Mon, 2 Jan 2023 23:39:17 +0000 (15:39 -0800)]
Rollup merge of #106315 - jyn514:cleanup-mingw-tidy, r=fee1-dead

Cleanup `mingw-tidy` docker job

Fixes a couple small regressions from https://github.com/rust-lang/rust/pull/106048 and https://github.com/rust-lang/rust/pull/105714.

- Avoid `/checkout/src/ci/run.sh: line 187: [: =: unary operator expected`: https://github.com/rust-lang/rust/actions/runs/3809902408/jobs/6481611301#step:26:1701
- Avoid running `x check` in the tidy test, to get faster feedback. It's already run on the normal `mingw-check` job.

r? `@fee1-dead`

18 months agoRollup merge of #105558 - Nilstrieb:less-spam-hir-tree, r=cjgillot
Michael Goulet [Mon, 2 Jan 2023 23:39:17 +0000 (15:39 -0800)]
Rollup merge of #105558 - Nilstrieb:less-spam-hir-tree, r=cjgillot

Reduce HIR debug output

HIR debug output is currently very verbose, especially when used with the alternate (`#`) flag. This commit reduces the amount of noisy newlines by forcing a few small key types to stay on one line, which makes the output easier to read and scroll by.

```
$ rustc +after hello_world.rs -Zunpretty=hir-tree | wc -l
582
$ rustc +before hello_world.rs -Zunpretty=hir-tree | wc -l
932
```

18 months agoRollup merge of #104298 - tbu-:pr_set_extension_caveats, r=m-ou-se
Michael Goulet [Mon, 2 Jan 2023 23:39:16 +0000 (15:39 -0800)]
Rollup merge of #104298 - tbu-:pr_set_extension_caveats, r=m-ou-se

Add notes and examples about non-intuitive `PathBuf::set_extension` behavior

Basically, passing the empty string will actually remove the extension instead of setting it to the empty string. This might change what is considered to be an extension. Additionally, passing an extension that contains dots will make the path only consider the last part of it to be the new extension.

18 months agoRollup merge of #95985 - jihiggins:issue-66481, r=dtolnay
Michael Goulet [Mon, 2 Jan 2023 23:39:16 +0000 (15:39 -0800)]
Rollup merge of #95985 - jihiggins:issue-66481, r=dtolnay

Add PhantomData marker to Context to make Context !Send and !Sync

Adds `PhantomData<*mut ()>` to `Context` in order to allow for future `!Send` or `!Sync` additions to `Context`'s fields. This would allow for things like future single threaded async executor optimizations, or (re)adding `LocalWaker`, etc.

Closes #66481.

Per https://github.com/rust-lang/rust/issues/66481#issuecomment-561289725, this is a breaking change that needs a Crater run as the next step.

(So far have tested the change locally with `cargotest` on WSL)

18 months agoget latest x version from parsing cargo command
DebugSteven [Mon, 2 Jan 2023 23:36:29 +0000 (16:36 -0700)]
get latest x version from parsing cargo command

18 months agoonly specify --target by default for -Zgcc-ld=lld on wasm
Rémy Rakic [Tue, 13 Sep 2022 09:17:13 +0000 (11:17 +0200)]
only specify --target by default for -Zgcc-ld=lld on wasm

On macOS, it's not yet clear which cases of clang/OS/target/SDK version impact
how to find ld/lld/rust-lld. The --target is not needed on our current targets with
a vanilla config, but may be in some cases. Specifying it all the time breaks the 10.7+
targets on x64 macOS.

We try to only specify it on macOS if the linker flavors are different,
for possible cases of cross-compilation with `-Zgcc-ld=lld` but the
expectation is that it should be passed manually when needed in these
situations.

18 months agoDon't trim path for `unsafe_op_in_unsafe_fn` lints
Léo Lanteri Thauvin [Mon, 26 Dec 2022 17:49:19 +0000 (18:49 +0100)]
Don't trim path for `unsafe_op_in_unsafe_fn` lints

18 months agoFix `unknown_crate` when `--crate-name` isn't passed on the CLI
Joshua Nelson [Thu, 29 Dec 2022 21:53:13 +0000 (21:53 +0000)]
Fix `unknown_crate` when `--crate-name` isn't passed on the CLI

18 months agoAdd json output to `-Zdump-mono-stats`
Joshua Nelson [Thu, 29 Dec 2022 21:08:09 +0000 (21:08 +0000)]
Add json output to `-Zdump-mono-stats`

This allows analyzing the output programatically; for example, finding
the item with the highest `total_estimate`.

I also took the liberty of adding `untracked` tests to `rustc_session` and documentation to the unstable book for `dump-mono-items`.

18 months agoAuto merge of #106364 - JakobDegen:top-down-inlining, r=cjgillot
bors [Mon, 2 Jan 2023 22:52:58 +0000 (22:52 +0000)]
Auto merge of #106364 - JakobDegen:top-down-inlining, r=cjgillot

Reenable limited top-down MIR inlining

Reverts most of #105119 and uses an alternative strategy to prevent exponential blowup. Specifically, we allow doing top-down inlining up to depth at most five, and for at most one call site per nested body.

r? `@cjgillot`

18 months agoDocument rustc_ast::FnHeader fields
Manish Goregaokar [Mon, 2 Jan 2023 22:26:43 +0000 (14:26 -0800)]
Document rustc_ast::FnHeader fields

18 months agoDocument rustc_ast::Extern variants
Manish Goregaokar [Mon, 2 Jan 2023 22:25:24 +0000 (14:25 -0800)]
Document rustc_ast::Extern variants

18 months agorustdoc: remove legacy box-sizing CSS
Michael Howell [Mon, 2 Jan 2023 20:12:45 +0000 (13:12 -0700)]
rustdoc: remove legacy box-sizing CSS

According to [caniuse], these vendor prefixes aren't needed in any
supported web browsers as defined in [RFC 1985]

* The last version of Chrome that required a vendor prefix was version 9.
  The current version is 108.
* Firefox 28 is the last version that required a vendor prefix. The
  [current Firefox ESR] is version 102.
* The last version of Safari that required a vendor prefix was version 5.
  The current version is 16.
* The last version of Safari/iOS that required a vendor prefix was version 4.
  The current version is 16.
* Edge never required vendor prefixes.
* UCAndroid never required vendor prefixes.

[caniuse]: https://caniuse.com/?search=box-sizing
[RFC 1985]: https://rust-lang.github.io/rfcs/1985-tiered-browser-support.html
[current Firefox ESR]: https://wiki.mozilla.org/Releases

18 months agoAuto merge of #106307 - Nilstrieb:dynamic->static, r=cjgillot
bors [Mon, 2 Jan 2023 20:12:16 +0000 (20:12 +0000)]
Auto merge of #106307 - Nilstrieb:dynamic->static, r=cjgillot

Abolish `QueryVTable` in favour of more assoc items on `QueryConfig`

This may introduce additional mono _but_ may help const fold things better and especially may help not constructing a `QueryVTable` anymore which is cheap but not free.

18 months agoAbolish `QueryVTable` in favour of more assoc items on `QueryConfig`
Nilstrieb [Fri, 30 Dec 2022 22:25:19 +0000 (23:25 +0100)]
Abolish `QueryVTable` in favour of more assoc items on `QueryConfig`

This may introduce additional mono _but_ may help const fold things
better and especially may help not constructing a `QueryVTable` anymore
which is cheap but not free.

18 months agoReduce HIR debug output
Nilstrieb [Sun, 11 Dec 2022 11:10:55 +0000 (12:10 +0100)]
Reduce HIR debug output

HIR debug output is currently very verbose, especially when used with
the alternate (`#`) flag. This commit reduces the amount of noisy
newlines by forcing a few small key types to stay on one line, which
makes the output easier to read and scroll by.

```
$ rustc +after hello_world.rs -Zunpretty=hir-tree | wc -l
582
$ rustc +before hello_world.rs -Zunpretty=hir-tree | wc -l
932
```

18 months agoRemove test of static Context
David Tolnay [Mon, 2 Jan 2023 18:31:50 +0000 (10:31 -0800)]
Remove test of static Context

Context is no longer Sync so this doesn't work.

    error[E0277]: `*mut ()` cannot be shared between threads safely
      --> library/core/tests/task.rs:24:21
       |
    24 |     static CONTEXT: Context<'static> = Context::from_waker(&WAKER);
       |                     ^^^^^^^^^^^^^^^^ `*mut ()` cannot be shared between threads safely
       |
       = help: within `Context<'static>`, the trait `Sync` is not implemented for `*mut ()`
       = note: required because it appears within the type `PhantomData<*mut ()>`
       = note: required because it appears within the type `Context<'static>`
       = note: shared static variables must have a type that implements `Sync`

18 months agoAdd PhantomData marker to Context to make Context !Send and !Sync
James Higgins [Tue, 12 Apr 2022 16:54:36 +0000 (13:54 -0300)]
Add PhantomData marker to Context to make Context !Send and !Sync

18 months agoAuto merge of #106272 - clubby789:codegen-test-103840, r=nikic
bors [Mon, 2 Jan 2023 17:18:58 +0000 (17:18 +0000)]
Auto merge of #106272 - clubby789:codegen-test-103840, r=nikic

Add codegen test for issue 103840

Closes #103840

18 months agoUpdate books
rustbot [Mon, 2 Jan 2023 17:00:31 +0000 (12:00 -0500)]
Update books

18 months agodefault OOM handler: use non-unwinding panic (unless -Zoom=panic is set), to match...
Ralf Jung [Thu, 22 Dec 2022 15:32:08 +0000 (16:32 +0100)]
default OOM handler: use non-unwinding panic (unless -Zoom=panic is set), to match std handler

18 months agodo not add noalias in return position
Ralf Jung [Mon, 2 Jan 2023 14:11:19 +0000 (15:11 +0100)]
do not add noalias in return position

18 months agoAdd regression test for #96287
Guillaume Gomez [Mon, 2 Jan 2023 13:29:56 +0000 (14:29 +0100)]
Add regression test for #96287

18 months agoAdd regression test for #105742
Guillaume Gomez [Mon, 2 Jan 2023 13:29:38 +0000 (14:29 +0100)]
Add regression test for #105742

18 months agoAdd regression test for #105737
Guillaume Gomez [Mon, 2 Jan 2023 13:29:22 +0000 (14:29 +0100)]
Add regression test for #105737

18 months agoAdd regression test for #105334
Guillaume Gomez [Mon, 2 Jan 2023 13:29:02 +0000 (14:29 +0100)]
Add regression test for #105334

18 months agoAdd regression test for #106226
Guillaume Gomez [Mon, 2 Jan 2023 10:47:56 +0000 (11:47 +0100)]
Add regression test for #106226

18 months agoAuto merge of #84762 - cjgillot:resolve-span-opt, r=petrochenkov
bors [Mon, 2 Jan 2023 13:10:16 +0000 (13:10 +0000)]
Auto merge of #84762 - cjgillot:resolve-span-opt, r=petrochenkov

Encode spans relative to the enclosing item -- enable on nightly

Follow-up to #84373 with the flag `-Zincremental-relative-spans` set by default.

This PR seeks to remove one of the main shortcomings of incremental: the handling of spans.
Changing the contents of a function may require redoing part of the compilation process for another function in another file because of span information is changed.
Within one file: all the spans in HIR change, so typechecking had to be re-done.
Between files: spans of associated types/consts/functions change, so type-based resolution needs to be re-done (hygiene information is stored in the span).

The flag `-Zincremental-relative-spans` encodes local spans relative to the span of an item, stored inside the `source_span` query.

Trap: stashed diagnostics are referenced by the "raw" span, so stealing them requires to remove the span's parent.

In order to avoid too much traffic in the span interner, span encoding uses the `ctxt_or_tag` field to encode:
- the parent when the `SyntaxContext` is 0;
- the `SyntaxContext` when the parent is `None`.
Even with this, the PR creates a lot of traffic to the Span interner, when a Span has both a LocalDefId parent and a non-root SyntaxContext. They appear in lowering, when we add a parent to all spans, including those which come from macros, and during inlining when we mark inlined spans.

The last commit changes how queries of `LocalDefId` manage their cache. I can put this in a separate PR if required.

Possible future directions:
- validate that all spans are marked in HIR validation;
- mark macro-expanded spans relative to the def-site and not the use-site.

18 months agoPrint correct base for too-large literals
clubby789 [Mon, 2 Jan 2023 05:07:02 +0000 (05:07 +0000)]
Print correct base for too-large literals

Also update tests

18 months agomaybe
gimbles [Mon, 2 Jan 2023 11:23:43 +0000 (16:53 +0530)]
maybe

18 months agoFix rustdoc ICE on bad typedef with mismatching types
Guillaume Gomez [Mon, 2 Jan 2023 10:47:36 +0000 (11:47 +0100)]
Fix rustdoc ICE on bad typedef with mismatching types

18 months agoUpdate format.rs
Gimbles [Mon, 2 Jan 2023 10:21:54 +0000 (15:51 +0530)]
Update format.rs

18 months agoAuto merge of #106301 - notriddle:notriddle/dir-entry, r=GuillaumeGomez
bors [Mon, 2 Jan 2023 10:21:53 +0000 (10:21 +0000)]
Auto merge of #106301 - notriddle:notriddle/dir-entry, r=GuillaumeGomez

rustdoc: use the regular arrow indicator for dir-entry CSS

This mostly reverts 468acca108e65101b802821bded17149dc1d86c9, while still fixing the problem it fixed by using an internal list-style-position. It results in a slight change in the hover indicator, but nothing misleading.

Preview: http://notriddle.com/notriddle-rustdoc-demos/dir-entry/src/std/lib.rs.html

## Before

![image](https://user-images.githubusercontent.com/1593513/210104247-642e6df0-07d3-452a-a2ab-4c700bc22e0e.png)

## After

![image](https://user-images.githubusercontent.com/1593513/210104271-a3832784-1e4d-4516-983e-6ecb9051857b.png)

18 months agoAuto merge of #106284 - estebank:merge-mut-errors, r=jyn514
bors [Mon, 2 Jan 2023 07:30:23 +0000 (07:30 +0000)]
Auto merge of #106284 - estebank:merge-mut-errors, r=jyn514

Merge multiple mutable borrows of immutable binding errors

Fix #53466.

18 months agoReenable limited top-down MIR inlining
Jakob Degen [Mon, 2 Jan 2023 06:01:29 +0000 (22:01 -0800)]
Reenable limited top-down MIR inlining

18 months agoVerbose suggestions
Esteban Küber [Sun, 1 Jan 2023 08:06:31 +0000 (00:06 -0800)]
Verbose suggestions