Commit Graph

213975 Commits

Author SHA1 Message Date
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
Joshua Nelson
6f1d9ba581 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.
2023-01-03 03:40:58 +00: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
Ardis Lu
6c254ed6dc
rustdoc: allow popover child links to work
No need to prevent default click behavior on a <div>, it will also disable all child click behavior.
2023-01-02 17:26:16 -08:00
Michael Goulet
b2317a642d has_overflow only if value is *not* within limit 2023-01-03 01:09:08 +00:00
Tomasz Miąsko
3eabea9e2c Remove duplicated elaborate box derefs pass
The pass runs earlier as a part of `run_runtime_lowering_passes`.
2023-01-03 00:00:00 +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
Léo Lanteri Thauvin
2a7d559970 Don't trim path for unsafe_op_in_unsafe_fn lints 2023-01-03 00:28:54 +01:00
Joshua Nelson
5c79624bfa Fix unknown_crate when --crate-name isn't passed on the CLI 2023-01-02 23:02:58 +00:00
Joshua Nelson
eb53eea609 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`.
2023-01-02 23:02:58 +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
Tomasz Miąsko
357c3cf72c Fix handling of dead unwinds in backward analyses
Dead unwinds set contains a head of an unreachable unwind edge.
2023-01-02 22:24:01 +01: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
5974f6f0a5 default OOM handler: use non-unwinding panic (unless -Zoom=panic is set), to match std handler 2023-01-02 16:35:14 +01: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
bors
fb9dfa8cef 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.
2023-01-02 13:10:16 +00:00
clubby789
537c7f4fa9 Print correct base for too-large literals
Also update tests
2023-01-02 11:43:07 +00:00
gimbles
f8755ab864 maybe 2023-01-02 16:53:43 +05:30
Guillaume Gomez
3919b71b48 Fix rustdoc ICE on bad typedef with mismatching types 2023-01-02 11:47:36 +01:00
Gimbles
32ab2d95f1
Update format.rs 2023-01-02 15:51:54 +05:30
bors
f89003eda8 Auto merge of #106301 - notriddle:notriddle/dir-entry, r=GuillaumeGomez
rustdoc: use the regular arrow indicator for dir-entry CSS

This mostly reverts 468acca108, 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)
2023-01-02 10:21:53 +00:00
bors
d5a7ddd99f Auto merge of #106284 - estebank:merge-mut-errors, r=jyn514
Merge multiple mutable borrows of immutable binding errors

Fix #53466.
2023-01-02 07:30:23 +00:00
Jakob Degen
ee6503a706 Reenable limited top-down MIR inlining 2023-01-01 22:01:29 -08:00