Commit Graph

211466 Commits

Author SHA1 Message Date
Nicholas Nethercote
e4a9150872 Rename ast::Lit as ast::MetaItemLit. 2022-11-28 15:18:49 +11:00
Nicholas Nethercote
aa10aad1ac Factor out a repeated expression in lower_attr_args. 2022-11-28 15:17:45 +11:00
Nicholas Nethercote
8cfc8153da Remove Lit::from_included_bytes.
`Lit::from_included_bytes` calls `Lit::from_lit_kind`, but the two call
sites only need the resulting `token::Lit`, not the full `ast::Lit`.

This commit changes those call sites to use `LitKind::to_token_lit`,
which means `from_included_bytes` can be removed.
2022-11-28 15:17:45 +11:00
bors
8c6bf2bee7 Auto merge of #104990 - matthiaskrgr:rollup-oskk8v3, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #104955 (Switch rustdoc-gui test to function call)
 - #104976 (Prefer doc comments over `//`-comments in compiler)
 - #104984 (Remove Crate::primitives field)
 - #104989 (update Miri)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-28 00:18:22 +00:00
Matthias Krüger
2ccb38b92d
Rollup merge of #104989 - RalfJung:miri, r=RalfJung
update Miri

r? `@ghost`
2022-11-27 22:14:09 +01:00
Matthias Krüger
5ea36cfc1c
Rollup merge of #104984 - GuillaumeGomez:remote-crate-primitives, r=notriddle
Remove Crate::primitives field

It is a new approach to #90447. Instead of removing primitives from everywhere (ie from `BadImplStripper`), I just removed them from the `Crate` type, allowing to reduce its size.

cc `@camelid`
r? `@notriddle`
2022-11-27 22:14:09 +01:00
Matthias Krüger
86304f5149
Rollup merge of #104976 - WaffleLapkin:move_comments, r=cjgillot
Prefer doc comments over `//`-comments in compiler

Doc comments are generally nicer: they show up in the documentation, they are shown in IDEs when you hover other mentions of items, etc. Thus it makes sense to use them instead of `//`-comments.
2022-11-27 22:14:08 +01:00
Matthias Krüger
53cfcfbfed
Rollup merge of #104955 - GuillaumeGomez:migrate-to-func, r=notriddle
Switch rustdoc-gui test to function call

r? `@notriddle`
2022-11-27 22:14:08 +01:00
bors
07e664c41a Auto merge of #104506 - joshtriplett:style-principles-readability-in-plain-text, r=compiler-errors
Expand a style-guide principle: readability in plain text
2022-11-27 21:07:04 +00:00
bors
f8fbc6da3c Auto merge of #2702 - RalfJung:rustup, r=RalfJung
Rustup

No changes happened on the rustc side, but I want to do a push next and would rather make josh's life easier by integrating some recent history first.
2022-11-27 19:54:04 +00:00
Ralf Jung
598c3da627 clippy 2022-11-27 20:53:17 +01:00
Ralf Jung
6d1e99e96e advice on josh pushing 2022-11-27 20:52:17 +01:00
Ralf Jung
7c12ed1d5d Merge from rustc 2022-11-27 20:51:52 +01:00
Ralf Jung
187ba67781 Preparing for merge from rustc 2022-11-27 20:51:50 +01:00
bors
66354f0043 Auto merge of #2694 - RalfJung:retag-deref-check, r=saethlin
fix handling of spurious accesses during retag

The `dereferenceable` attribute we emit for LLVM is checked during retag in Stacked Borrows.
However, we currently don't properly do that for retagging of `&mut !Unpin`, which this PR fixes.
Also this adjusts retagging to inform the data race model of the accesses as well.

Fixes https://github.com/rust-lang/miri/issues/2648.
Also fixes https://github.com/rust-lang/miri/issues/2693 since the same issue arose for retagging as well.

r? `@saethlin`
2022-11-27 19:03:21 +00:00
bors
1eb62b1235 Auto merge of #104983 - matthiaskrgr:rollup-018sk73, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #95836 (Use `rust_out{exe_suffix}` for doctests)
 - #104882 (notify lcnr on changes to `ObligationCtxt`)
 - #104892 (Explain how to get the discriminant out of a `#[repr(T)] enum` with payload)
 - #104917 (Allow non-org members to label `requires-debug-assertions`)
 - #104931 (Pretty-print generators with their `generator_kind`)
 - #104934 (Remove redundant `all` in cfg)
 - #104944 (Support unit tests for jsondoclint)
 - #104946 (rustdoc: improve popover focus handling JS)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-11-27 17:10:58 +00:00
Guillaume Gomez
23c3941942 Add rustdoc test for Deref to primitive types 2022-11-27 16:31:52 +01:00
Guillaume Gomez
5856e40885 Remove Crate::primitives field 2022-11-27 16:31:34 +01:00
Matthias Krüger
55cf566f04
Rollup merge of #104946 - notriddle:notriddle/popover-menu-focus, r=GuillaumeGomez
rustdoc: improve popover focus handling JS

This commit fixes a few inconsistencies and erratic behavior from the notable traits, settings, and sidebar popups:

* It makes it so that pressing Escape closes the mobile sidebar. This is a bit difficult to do on iPhone, but on other setups like desktop tiling window managers, it's easy and makes sense.
* It makes sure that pressing escape while a notable trait popover is open focuses the popover's toggle button, instead of leaving nothing focused, since that makes more sense with keyboard navigation. Clicking the settings, help, or sidebar buttons, however, will not focus the notable trait popover toggle button.
* It ensures that notable trait and settings popovers are exclusive with the mobile sidebar. Nothing should ever overlap a popover, and there should never be more than one popover open at once.
2022-11-27 16:03:09 +01:00
Matthias Krüger
e3165a3808
Rollup merge of #104944 - aDotInTheVoid:jsondoclint-unit-tests, r=jyn514
Support unit tests for jsondoclint

r? ````@ghost````
2022-11-27 16:03:09 +01:00
Matthias Krüger
8d90647641
Rollup merge of #104934 - ChrisDenton:all-anybody-wants, r=thomcc
Remove redundant `all` in cfg

This appears to have been accidentally left in after removing the other branches 45bf1ed1a1

(hat tip to kangalioo for the git archaeology)
2022-11-27 16:03:08 +01:00
Matthias Krüger
6e6c42c61c
Rollup merge of #104931 - Swatinem:async-pretty, r=eholk
Pretty-print generators with their `generator_kind`

After removing `GenFuture`, I special-cased async generators to pretty-print as `impl Future<Output = X>` mainly to avoid too much diagnostics changes originally.

This now reverses that change so that async fn/blocks are pretty-printed as `[$async-type@$source-position]` in various diagnostics, and updates the tests that this touches.
2022-11-27 16:03:08 +01:00
Matthias Krüger
9ebffb7c3c
Rollup merge of #104917 - compiler-errors:requires-debug-assertions, r=Mark-Simulacrum
Allow non-org members to label `requires-debug-assertions`

`jruderman` tried to add this in #104916, for example. I think I've seen this happen before as well.
2022-11-27 16:03:07 +01:00
Matthias Krüger
9ba78ac08b
Rollup merge of #104892 - lukas-code:discriminant, r=scottmcm
Explain how to get the discriminant out of a `#[repr(T)] enum` with payload

example stolen from https://github.com/rust-lang/reference/pull/1055

````@rustbot```` label A-docs
2022-11-27 16:03:07 +01:00
Matthias Krüger
5d05cf8473
Rollup merge of #104882 - lcnr:notify-ocx, r=Mark-Simulacrum
notify lcnr on changes to `ObligationCtxt`

Right now the `ObligationCtxt` has an API which should prevent leaking any important details of the trait solver. This allows us to freely use it without having to worry about causing issues for the [trait solver rewrite](https://github.com/orgs/rust-lang/projects/26/views/1).

I would like to keep it this way ^^
2022-11-27 16:03:06 +01:00
Matthias Krüger
7ce937fe4a
Rollup merge of #95836 - workingjubilee:doctest-exe, r=notriddle
Use `rust_out{exe_suffix}` for doctests

This was mentioned as an issue to me by ````@bruxisma.```` There are 3 separate instances where "rust_out" can become part of the name of a Rust executable, so I am mostly just hoping that this fixes the problem, given that the other sites which it can slip in seem to be well-behaved.
2022-11-27 16:03:06 +01:00
bors
454784afba Auto merge of #104048 - cjgillot:split-lifetime, r=compiler-errors
Separate lifetime ident from lifetime resolution in HIR

Drive-by: change how suggested generic args are computed.
Fixes https://github.com/rust-lang/rust/issues/103815

I recommend reviewing commit-by-commit.
2022-11-27 14:30:19 +00:00
bors
a83b105b4c Auto merge of #2685 - Nilstrieb:cargo-miri-wasm, r=RalfJung
Use `.wasm` extension when building for wasm in cargo-miri

WASM uses the `.wasm` file extension for its binaries (just like how windows uses `.exe`), so we need to set that as well.

I'm not sure whether gating this behind the wasm target is a good idea, maybe it makes more sense to always do it just like on windows.
2022-11-27 13:31:05 +00:00
bors
9f8df93b09 Auto merge of #2701 - RalfJung:smoke, r=RalfJung
run_tests_minimal: actually run the smoke test on the desired target
2022-11-27 12:45:34 +00:00
Ralf Jung
c6587b0160 run_tests_minimal: actually run the smoke test on the desired target 2022-11-27 13:26:31 +01:00
bors
5a14c5af09 Auto merge of #2700 - RalfJung:begingroup, r=RalfJung
CI: fix begingroup printing
2022-11-27 12:21:26 +00:00
Ralf Jung
b20efbd79f CI: fix begingroup printing 2022-11-27 13:20:44 +01:00
Maybe Waffle
1d42936b18 Prefer doc comments over //-comments in compiler 2022-11-27 11:19:04 +00:00
bors
df04d28163 Auto merge of #103917 - oli-obk:layout_math, r=RalfJung,lcnr
Various cleanups around scalar layout restrictions

Pulled out of https://github.com/rust-lang/rust/pull/103724
2022-11-27 10:35:00 +00:00
nils
958d5918b0 Use .wasm extension when building for wasm in cargo-miri
WASM uses the `.wasm` file extension for its binaries (just like how
windows uses `.exe`), so we need to set that as well.
2022-11-27 10:25:32 +01:00
bors
5ac7e08aaf Auto merge of #103786 - tshepang:obsolete, r=jyn514
Don't build `compiler_builtins` with `-C panic=abort`
2022-11-27 07:12:30 +00:00
bors
0e9eee6811 Auto merge of #96451 - JakobDegen:dest-prop, r=tmiasko
Fix Dest Prop

Closes #82678, #79191 .

This was not originally a total re-write of the pass but is has gradually turned into one. Notable changes:

 1. Significant improvements to documentation all around. The top of the file has been extended with a more precise argument for soundness. The code should be fairly readable, and I've done my best to add useful comments wherever possible. I would very much like for the bus factor to not be one on this code.
 3. Improved handling of conflicts that are not visible in normal dataflow.  This was the cause of #79191. Handling this correctly requires us to make decision about the semantics and specifically evaluation order of basically all MIR constructs (see specifically #68364 #71117.  The way this is implemented is based on my preferred resolution to these questions around the semantics of assignment statements.
 4. Some re-architecting to improve performance. More details below.
 5. Possible future improvements to this optimization are documented, and the code is written with the needs of those improvements in mind. The hope is that adding support for more precise analyses will not require a full re-write of this opt, but just localized changes.

### Regarding Performance

The previous approach had some performance issues; letting `l` be the number of locals and `s` be the number of statements/terminators, the runtime of the pass was `O(l^2 * s)`, both in theory and in practice. This version is smarter about not calculating unnecessary things and doing more caching. Our runtime is now dominated by one invocation of `MaybeLiveLocals` for each "round," and the number of rounds is less than 5 in over 90% of cases. This means it's linear-ish in practice.

r? `@oli-obk` who reviewed the last version of this, but review from anyone else would be more than welcome
2022-11-27 04:09:53 +00:00
Jubilee Young
47ddca6812 Attempt to solve problem with globs 2022-11-26 20:07:07 -08:00
Jubilee Young
353cef9654 Use target exe_suffix for doctests
This will use rust_out.exe for doctests on Windows,
rust_out.wasm for doctests in the wasm case, and
also handles cross-compiling or user-provided targets.
2022-11-26 20:06:13 -08:00
Jakob Degen
245c60749a Rewrite dest prop.
This fixes a number of correctness issues from the previous version. Additionally, we use a new
strategy which has much better performance charactersitics and also finds more opportunities to
apply the optimization.
2022-11-26 18:04:54 -08:00
bors
faf1891deb Auto merge of #104818 - scottmcm:refactor-extend-func, r=the8472
Stop peeling the last iteration of the loop in `Vec::resize_with`

`resize_with` uses the `ExtendWith` code that peels the last iteration:
341d8b8a2c/library/alloc/src/vec/mod.rs (L2525-L2529)

But that's kinda weird for `ExtendFunc` because it does the same thing on the last iteration anyway:
341d8b8a2c/library/alloc/src/vec/mod.rs (L2494-L2502)

So this just has it use the normal `extend`-from-`TrustedLen` code instead.

r? `@ghost`
2022-11-27 00:58:50 +00:00
Ralf Jung
edf8154695 nits 2022-11-27 00:06:00 +01:00
Ralf Jung
a3bd57823f make Stacked Borrows retags act like data races 2022-11-27 00:03:49 +01:00
Ralf Jung
a7f72218c8 slightly adjust and synchronize Machine passing for SB and DataRace 2022-11-27 00:03:49 +01:00
Ralf Jung
f479404b12 !Unpin retags must still be reads, to check dereferenceable
also fix ICE on deallocation error and avoid redundant find_granting on retag
2022-11-27 00:03:07 +01:00
bors
c0e9c86b3f Auto merge of #104950 - jyn514:revert-preview, r=Mark-Simulacrum
Revert "Don't set `is_preview` for clippy and rustfmt"

This reverts commit fb3e724d76, which broke `rustup update` for anyone with clippy or rustfmt installed.

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

r? `@Mark-Simulacrum`

`@bors` p=50 fixes nightly
2022-11-26 21:47:17 +00:00
Guillaume Gomez
b19e034745 Switch rustdoc-gui test to function call 2022-11-26 22:35:05 +01:00
Michael Howell
c26074afde rustdoc: pass "true" to reset focus for notable traits 2022-11-26 14:32:57 -07:00
Joshua Nelson
c80b484eff Revert "Don't set is_preview for clippy and rustfmt"
This reverts commit fb3e724d76, which broke `rustup update` for anyone with clippy or rustfmt installed.
2022-11-26 15:24:46 -05:00
Arpad Borsos
c96d888bdf
Pretty-print generators with their generator_kind
After removing `GenFuture`, I special-cased async generators to pretty-print as `impl Future<Output = X>` mainly to avoid too much diagnostics changes originally.

This now reverses that change so that async fn/blocks are pretty-printed as `[$movability `async` $something@$source-position]` in various diagnostics, and updates the tests that this touches.
2022-11-26 20:42:50 +01:00