Commit Graph

213871 Commits

Author SHA1 Message Date
Kai Luo
04a697502f Also check ttype_index when using SJLJ 2023-01-09 23:02:53 +08:00
Kai Luo
34534152f5 [LSDA] Take ttype_index into account when taking action
If cs_action != 0, we should check the ttype_index field in
action record. If ttype_index == 0, a clean up action is taken.
2023-01-04 18:00:09 +08:00
bors
fbe8292872 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
2023-01-03 23:38:28 +00:00
bors
c7572670a1 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`:

397b66e77b/compiler/rustc_hir_typeck/src/method/suggest.rs (L117)
to `note_candidates_on_method_error`

And this long block:
397b66e77b/compiler/rustc_hir_typeck/src/method/suggest.rs (L263)

to `report_no_match_method_error`.

r? `@compiler-errors`
2023-01-03 20:44:40 +00:00
bors
ab10908e8c 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
2023-01-03 17:08:17 +00:00
Matthias Krüger
e2f7108459
Rollup merge of #106402 - Rageking8:fix_dupe_word_typos, r=Nilstrieb
Fix dupe word typos

r? `@Nilstrieb`
Thanks!
2023-01-03 17:12:13 +01:00
Matthias Krüger
9d1193310f
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.
2023-01-03 17:12:13 +01:00
Matthias Krüger
83b11f70ad
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
2023-01-03 17:12:12 +01:00
Matthias Krüger
01d99f6569
Rollup merge of #106365 - gimbles:patch-1, r=jyn514
Grammar : Missing "is" in format specifier diagnostic
2023-01-03 17:12:12 +01:00
Matthias Krüger
a0458d41ba
Rollup merge of #106356 - aDotInTheVoid:del-ctor-kind, r=jyn514
clean: Remove `ctor_kind` from `VariantStruct`.

It's always `None`.

r? `@ghost`
2023-01-03 17:12:11 +01:00
Matthias Krüger
6e94012c67
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
2023-01-03 17:12:11 +01:00
Matthias Krüger
da07053ee1
Rollup merge of #105681 - tshepang:doc-mir-visit, r=Nilstrieb
some fixes/improvements to mir::visit module
2023-01-03 17:12:10 +01:00
Matthias Krüger
258a0fb89e
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.
2023-01-03 17:12:10 +01:00
Nixon Enraght-Moony
f1f99c611a clean: Remove ctor_kind from VariantStruct.
It's always `None`.
2023-01-03 15:10:53 +00:00
bors
312c9a37f2 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`
2023-01-03 14:05:44 +00:00
bors
b435960c4c 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`
2023-01-03 11:06:08 +00:00
bors
3b1c8a94a4 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
2023-01-03 08:05:54 +00:00
Rageking8
e808a69911 fix dupe word typos 2023-01-03 15:48:16 +08:00
bors
442f997f98 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).
2023-01-03 04:54:03 +00:00
J Haigh
85f649fd27
no_deps
Co-authored-by: Joshua Nelson <github@jyn.dev>
2023-01-02 20:49:18 -07:00
DebugSteven
376dd8a9b3 use cargo_metadata to get x version 2023-01-02 19:31:18 -07:00
bors
481c9bad80 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
2023-01-03 01:45:33 +00:00
Michael Goulet
b2317a642d has_overflow only if value is *not* within limit 2023-01-03 01:09:08 +00:00
Michael Goulet
d4cf00f03d
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
2023-01-02 15:39:19 -08:00
Michael Goulet
d112cd9a00
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)
2023-01-02 15:39:19 -08:00
Michael Goulet
ea3c4d8ddd
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`
2023-01-02 15:39:19 -08:00
Michael Goulet
0d5c5fae61
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`
2023-01-02 15:39:18 -08:00
Michael Goulet
0670a6151c
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`
2023-01-02 15:39:17 -08:00
Michael Goulet
fbffaa91ad
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
```
2023-01-02 15:39:17 -08:00
Michael Goulet
da1ca5df6e
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.
2023-01-02 15:39:16 -08:00
Michael Goulet
722bc0c8ee
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)
2023-01-02 15:39:16 -08:00
DebugSteven
e9ca6636e1 get latest x version from parsing cargo command 2023-01-02 16:36:29 -07:00
Rémy Rakic
7770b06b06 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.
2023-01-02 23:30:07 +00:00
bors
67d16171d7 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`
2023-01-02 22:52:58 +00:00
Manish Goregaokar
157211ff2f Document rustc_ast::FnHeader fields 2023-01-02 14:42:27 -08:00
Manish Goregaokar
3c7c694e73 Document rustc_ast::Extern variants 2023-01-02 14:42:27 -08:00
Michael Howell
817cc33446 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
2023-01-02 13:12:45 -07:00
bors
d6f99e535a 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.
2023-01-02 20:12:16 +00:00
Nilstrieb
9fe4efe115 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.
2023-01-02 20:22:19 +01:00
Nilstrieb
e1787f5572 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
```
2023-01-02 20:15:48 +01:00
David Tolnay
257e766c0c
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`
2023-01-02 10:33:23 -08:00
James Higgins
fd59b628ea
Add PhantomData marker to Context to make Context !Send and !Sync 2023-01-02 10:20:59 -08:00
bors
23b1cc197a Auto merge of #106272 - clubby789:codegen-test-103840, r=nikic
Add codegen test for issue 103840

Closes #103840
2023-01-02 17:18:58 +00:00
rustbot
693399f7c2 Update books 2023-01-02 12:00:31 -05:00
Ralf Jung
e7cad62257 do not add noalias in return position 2023-01-02 15:11:19 +01:00
Guillaume Gomez
c1567730c0 Add regression test for #96287 2023-01-02 14:49:08 +01:00
Guillaume Gomez
a167435b76 Add regression test for #105742 2023-01-02 14:49:08 +01:00
Guillaume Gomez
1a9432255e Add regression test for #105737 2023-01-02 14:29:22 +01:00
Guillaume Gomez
ed3c3d3ddd Add regression test for #105334 2023-01-02 14:29:02 +01:00
Guillaume Gomez
e8853563df Add regression test for #106226 2023-01-02 14:28:39 +01:00