]> git.lizzy.rs Git - rust.git/log
rust.git
18 months agoInline and remove `MetaItemLit::from_lit_kind`.
Nicholas Nethercote [Tue, 29 Nov 2022 07:42:40 +0000 (18:42 +1100)]
Inline and remove `MetaItemLit::from_lit_kind`.

It has a single call site.

18 months agoRemove an out-of-date comment.
Nicholas Nethercote [Tue, 29 Nov 2022 06:13:38 +0000 (17:13 +1100)]
Remove an out-of-date comment.

This comment dates back to at least 2013, and is no longer relevant.
(There used to be an `allow` attribute, but that's no longer present.)

18 months agoAvoid more unnecessary `MetaItem`/`Attribute` conversions.
Nicholas Nethercote [Mon, 28 Nov 2022 00:17:45 +0000 (11:17 +1100)]
Avoid more unnecessary `MetaItem`/`Attribute` conversions.

In `Expander::expand` the code currently uses `mk_attr_outer` to convert
a `MetaItem` to an `Attribute`, and then follows that with
`meta_item_list` which converts back. This commit avoids the unnecessary
conversions.

There was one wrinkle: the existing conversions caused the bogus `<>` on
`Default<>` to be removed. With the conversion gone, we get a second
error message about the `<>`. This is a rare case, so I think it
probably doesn't matter much.

18 months agoReorder some types.
Nicholas Nethercote [Thu, 24 Nov 2022 22:59:36 +0000 (09:59 +1100)]
Reorder some types.

So that `Attribute` and `MetaItem` are listed first, and then the
component types are below them in a logical order.

18 months agoImprove comments about attributes and meta items.
Nicholas Nethercote [Thu, 24 Nov 2022 22:53:37 +0000 (09:53 +1100)]
Improve comments about attributes and meta items.

I have found the distinction confusing.

18 months agoAvoid unnecessary `MetaItem`/`Attribute` conversions.
Nicholas Nethercote [Thu, 24 Nov 2022 05:00:57 +0000 (16:00 +1100)]
Avoid unnecessary `MetaItem`/`Attribute` conversions.

`check_builtin_attribute` calls `parse_meta` to convert an `Attribute`
to a `MetaItem`, which it then checks. However, many callers of
`check_builtin_attribute` start with a `MetaItem`, and then convert it
to an `Attribute` by calling `cx.attribute(meta_item)`. This `MetaItem`
to `Attribute` to `MetaItem` conversion is silly.

This commit adds a new function `check_builtin_meta_item`, which can be
called instead from these call sites. `check_builtin_attribute` also now
calls it. The commit also renames `check_meta` as `check_attr` to better
match its arguments.

18 months agoAuto merge of #105017 - matthiaskrgr:rollup-j0x550l, r=matthiaskrgr
bors [Mon, 28 Nov 2022 20:53:42 +0000 (20:53 +0000)]
Auto merge of #105017 - matthiaskrgr:rollup-j0x550l, r=matthiaskrgr

Rollup of 9 pull requests

Successful merges:

 - #104804 (Rename `ast::Lit` as `ast::MetaItemLit`.)
 - #104891 (Add documentation for `has_escaping_bound_vars`)
 - #104933 (interpret: remove PartialOrd from a bunch of types that do not have or need a sensible order)
 - #104936 (Ignore bivariant parameters in test_type_match.)
 - #104954 (make simple check of prinf function)
 - #104956 (Avoid ICE if the Clone trait is not found while building error suggestions)
 - #104982 (interpret: get rid of run() function)
 - #104998 (Update my mailmap)
 - #105006 (stricter alignment enforcement for ScalarPair)

Failed merges:

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

18 months agoRollup merge of #105006 - RalfJung:scalar-pair-alignment, r=eddyb
Matthias Krüger [Mon, 28 Nov 2022 16:25:50 +0000 (17:25 +0100)]
Rollup merge of #105006 - RalfJung:scalar-pair-alignment, r=eddyb

stricter alignment enforcement for ScalarPair

`@eddyb` [indicated](https://github.com/rust-lang/rust/pull/103926#discussion_r1033315005) that alignment violating this check might be a bug. So let's see what the test suite says.

(Only the 2nd commit actually changes behavior... but I couldn't not do that other cleanup.^^)

Does the PR CI runner even enable debug assertions though...?

18 months agoRollup merge of #104998 - JakobDegen:mailmap, r=jyn514
Matthias Krüger [Mon, 28 Nov 2022 16:25:50 +0000 (17:25 +0100)]
Rollup merge of #104998 - JakobDegen:mailmap, r=jyn514

Update my mailmap

18 months agoRollup merge of #104982 - RalfJung:norun, r=oli-obk
Matthias Krüger [Mon, 28 Nov 2022 16:25:49 +0000 (17:25 +0100)]
Rollup merge of #104982 - RalfJung:norun, r=oli-obk

interpret: get rid of run() function

Miri needs its own loop anyway, so there's not much of a point in trying to share this code.

18 months agoRollup merge of #104956 - mucinoab:issue-104870, r=compiler-errors
Matthias Krüger [Mon, 28 Nov 2022 16:25:49 +0000 (17:25 +0100)]
Rollup merge of #104956 - mucinoab:issue-104870, r=compiler-errors

Avoid ICE if the Clone trait is not found while building error suggestions

Fixes #104870

r? `@compiler-errors`

18 months agoRollup merge of #104954 - vincenzopalazzo:macros/prinf, r=estebank
Matthias Krüger [Mon, 28 Nov 2022 16:25:48 +0000 (17:25 +0100)]
Rollup merge of #104954 - vincenzopalazzo:macros/prinf, r=estebank

make simple check of prinf function

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

With this commit we start to make some simple
check when the name resolution fails, and
we generate some helper messages in case the
name is a C name like in the case of the `printf`
and suggest the correct rust method.

`@rustbot` r? `@pnkfelix`

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
18 months agoRollup merge of #104936 - cjgillot:self-rpit-orig-too, r=oli-obk
Matthias Krüger [Mon, 28 Nov 2022 16:25:47 +0000 (17:25 +0100)]
Rollup merge of #104936 - cjgillot:self-rpit-orig-too, r=oli-obk

Ignore bivariant parameters in test_type_match.

https://github.com/rust-lang/rust/pull/103491 made opaque types bivariant with respect of some of their lifetime parameters.  Because of this bivariance, some lifetime variables were not unified to anything during borrowck, and were considered as unequal by borrowck type test.

This PR makes type test ignore the bivariant parameters in test_type_match.

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

r? `@oli-obk`

18 months agoRollup merge of #104933 - RalfJung:interpret-partial-ord, r=oli-obk
Matthias Krüger [Mon, 28 Nov 2022 16:25:47 +0000 (17:25 +0100)]
Rollup merge of #104933 - RalfJung:interpret-partial-ord, r=oli-obk

interpret: remove PartialOrd from a bunch of types that do not have or need a sensible order

r? `@oli-obk`

18 months agoRollup merge of #104891 - fee1-dead-contrib:escaping_bound_vars_docs, r=wesleywiser
Matthias Krüger [Mon, 28 Nov 2022 16:25:46 +0000 (17:25 +0100)]
Rollup merge of #104891 - fee1-dead-contrib:escaping_bound_vars_docs, r=wesleywiser

Add documentation for `has_escaping_bound_vars`

Thanks to `@BoxyUwU` for explaining this to me. Adding docs with a helpful link if people get confused.

18 months agoRollup merge of #104804 - nnethercote:MetaItemLit, r=petrochenkov
Matthias Krüger [Mon, 28 Nov 2022 16:25:46 +0000 (17:25 +0100)]
Rollup merge of #104804 - nnethercote:MetaItemLit, r=petrochenkov

Rename `ast::Lit` as `ast::MetaItemLit`.

And some other literal cleanups.

r? `@petrochenkov`

18 months agostricter alignment enforcement for ScalarPair and Vector
Ralf Jung [Mon, 28 Nov 2022 09:45:22 +0000 (10:45 +0100)]
stricter alignment enforcement for ScalarPair and Vector

18 months agoAuto merge of #105008 - Dylan-DPC:rollup-wcd19yu, r=Dylan-DPC
bors [Mon, 28 Nov 2022 13:20:33 +0000 (13:20 +0000)]
Auto merge of #105008 - Dylan-DPC:rollup-wcd19yu, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #104360 (Stabilize native library modifier `verbatim`)
 - #104732 (Refactor `ty::ClosureKind` related stuff)
 - #104795 (Change multiline span ASCII art visual order)
 - #104890 (small method code cleanup)
 - #104907 (Remove `SelectionContext::infcx()` in favor of field access)
 - #104927 (Simplify some binder shifting logic)

Failed merges:

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

18 months agoAuto merge of #102991 - Sp00ph:master, r=scottmcm
bors [Mon, 28 Nov 2022 10:39:47 +0000 (10:39 +0000)]
Auto merge of #102991 - Sp00ph:master, r=scottmcm

Update VecDeque implementation to use head+len instead of head+tail

(See #99805)

This changes `alloc::collections::VecDeque`'s internal representation from using head and tail indices to using a head index and a length field. It has a few advantages over the current design:
* It allows the buffer to be of length 0, which means the `VecDeque::new` new longer has to allocate and could be changed to a `const fn`
* It allows the `VecDeque` to fill the buffer completely, unlike the old implementation, which always had to leave a free space
* It removes the restriction for the size to be a power of two, allowing it to properly `shrink_to_fit`, unlike the old `VecDeque`
* The above points also combine to allow the `Vec<T> -> VecDeque<T>` conversion to be very cheap and guaranteed O(1). I mention this in the `From<Vec<T>>` impl, but it's not a strong guarantee just yet, as that would likely need some form of API change proposal.

All the tests seem to pass for the new `VecDeque`, with some slight adjustments.

r? `@scottmcm`

18 months agoRollup merge of #104927 - compiler-errors:binder-shifting-logic, r=oli-obk
Dylan DPC [Mon, 28 Nov 2022 10:12:12 +0000 (15:42 +0530)]
Rollup merge of #104927 - compiler-errors:binder-shifting-logic, r=oli-obk

Simplify some binder shifting logic

Not sure if worth, but we'll see

18 months agoRollup merge of #104907 - compiler-errors:selcx-infcx, r=oli-obk
Dylan DPC [Mon, 28 Nov 2022 10:12:11 +0000 (15:42 +0530)]
Rollup merge of #104907 - compiler-errors:selcx-infcx, r=oli-obk

Remove `SelectionContext::infcx()` in favor of field access

Encapsulation doesn't seem particularly important here, and having two choices is always more confusing than having one.

r? types

18 months agoRollup merge of #104890 - lcnr:small-cleanup, r=fee1-dead
Dylan DPC [Mon, 28 Nov 2022 10:12:11 +0000 (15:42 +0530)]
Rollup merge of #104890 - lcnr:small-cleanup, r=fee1-dead

small method code cleanup

18 months agoRollup merge of #104795 - estebank:multiline-spans, r=TaKO8Ki
Dylan DPC [Mon, 28 Nov 2022 10:12:10 +0000 (15:42 +0530)]
Rollup merge of #104795 - estebank:multiline-spans, r=TaKO8Ki

Change multiline span ASCII art visual order

Tweak the ASCII art for nested multiline spans so that we minimize line overlaps.

Partially addresses https://github.com/rust-lang/rust/issues/61017.

18 months agoRollup merge of #104732 - WaffleLapkin:from_def_idn't, r=compiler-errors
Dylan DPC [Mon, 28 Nov 2022 10:12:10 +0000 (15:42 +0530)]
Rollup merge of #104732 - WaffleLapkin:from_def_idn't, r=compiler-errors

Refactor `ty::ClosureKind` related stuff

I've tried to fix all duplication and weirdness, but if I missed something do tell :p

r? `@compiler-errors`

18 months agoRollup merge of #104360 - petrochenkov:stabverb, r=TaKO8Ki
Dylan DPC [Mon, 28 Nov 2022 10:12:09 +0000 (15:42 +0530)]
Rollup merge of #104360 - petrochenkov:stabverb, r=TaKO8Ki

Stabilize native library modifier `verbatim`

Stabilization report - https://github.com/rust-lang/rust/pull/104360#issuecomment-1312724787.

cc https://github.com/rust-lang/rust/issues/81490
Closes https://github.com/rust-lang/rust/issues/99425

18 months agosanity_check_layout: less rightwards drift
Ralf Jung [Mon, 28 Nov 2022 09:45:12 +0000 (10:45 +0100)]
sanity_check_layout: less rightwards drift

18 months agofix clippy tests
Esteban Küber [Mon, 28 Nov 2022 08:41:31 +0000 (00:41 -0800)]
fix clippy tests

18 months agoTweak output
Esteban Küber [Wed, 23 Nov 2022 22:51:24 +0000 (14:51 -0800)]
Tweak output

18 months agoChange multiline span ASCII art visual order
Esteban Küber [Wed, 23 Nov 2022 22:28:45 +0000 (14:28 -0800)]
Change multiline span ASCII art visual order

18 months agoRename `NestedMetaItem::[Ll]iteral` as `NestedMetaItem::[Ll]it`.
Nicholas Nethercote [Thu, 24 Nov 2022 04:00:09 +0000 (15:00 +1100)]
Rename `NestedMetaItem::[Ll]iteral` as `NestedMetaItem::[Ll]it`.

We already use a mix of `Literal` and `Lit`. The latter is better
because it is shorter without causing any ambiguity.

18 months agoAdjust comments on `StrLit`.
Nicholas Nethercote [Thu, 24 Nov 2022 21:18:57 +0000 (08:18 +1100)]
Adjust comments on `StrLit`.

18 months agoRename `ast::Lit` as `ast::MetaItemLit`.
Nicholas Nethercote [Wed, 23 Nov 2022 04:39:42 +0000 (15:39 +1100)]
Rename `ast::Lit` as `ast::MetaItemLit`.

18 months agoFactor out a repeated expression in `lower_attr_args`.
Nicholas Nethercote [Thu, 24 Nov 2022 02:47:57 +0000 (13:47 +1100)]
Factor out a repeated expression in `lower_attr_args`.

18 months agoRemove `Lit::from_included_bytes`.
Nicholas Nethercote [Wed, 23 Nov 2022 06:00:37 +0000 (17:00 +1100)]
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.

18 months agoAuto merge of #104915 - weihanglo:update-cargo, r=ehuss
bors [Mon, 28 Nov 2022 03:16:58 +0000 (03:16 +0000)]
Auto merge of #104915 - weihanglo:update-cargo, r=ehuss

Update cargo

5 commits in ba607b23db8398723d659249d9abf5536bc322e5..e027c4b5d25af2119b1956fac42863b9b3242744 2022-11-22 20:52:39 +0000 to 2022-11-25 19:44:46 +0000

- fix: Move off atty to resolve soundness issue (rust-lang/cargo#11420)
- add newline char to `cargo install .` error message for easier reading. (rust-lang/cargo#11401)
- chore: Upgrade to env_logger (rust-lang/cargo#11417)
- Change rustdoc-scrape-examples to be a target-level configuration (rust-lang/cargo#10343)
- temporarily disable test `lto::test_profile` (rust-lang/cargo#11419)

r+ `@ghost`

18 months agoAvoid ICE if the Clone trait is not found while building error suggestions
Bruno A. Muciño [Mon, 28 Nov 2022 02:50:13 +0000 (20:50 -0600)]
Avoid ICE if the Clone trait is not found while building error suggestions

18 months agoUpdate my mailmap
Jakob Degen [Mon, 28 Nov 2022 01:18:38 +0000 (17:18 -0800)]
Update my mailmap

18 months agoAuto merge of #104990 - matthiaskrgr:rollup-oskk8v3, r=matthiaskrgr
bors [Mon, 28 Nov 2022 00:18:22 +0000 (00:18 +0000)]
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

18 months agoFix `pretty-std` test
Markus Everling [Sun, 27 Nov 2022 22:08:14 +0000 (23:08 +0100)]
Fix `pretty-std` test

18 months agoRollup merge of #104989 - RalfJung:miri, r=RalfJung
Matthias Krüger [Sun, 27 Nov 2022 21:14:09 +0000 (22:14 +0100)]
Rollup merge of #104989 - RalfJung:miri, r=RalfJung

update Miri

r? `@ghost`

18 months agoRollup merge of #104984 - GuillaumeGomez:remote-crate-primitives, r=notriddle
Matthias Krüger [Sun, 27 Nov 2022 21:14:09 +0000 (22:14 +0100)]
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`

18 months agoRollup merge of #104976 - WaffleLapkin:move_comments, r=cjgillot
Matthias Krüger [Sun, 27 Nov 2022 21:14:08 +0000 (22:14 +0100)]
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.

18 months agoRollup merge of #104955 - GuillaumeGomez:migrate-to-func, r=notriddle
Matthias Krüger [Sun, 27 Nov 2022 21:14:08 +0000 (22:14 +0100)]
Rollup merge of #104955 - GuillaumeGomez:migrate-to-func, r=notriddle

Switch rustdoc-gui test to function call

r? `@notriddle`

18 months agoAuto merge of #104506 - joshtriplett:style-principles-readability-in-plain-text,...
bors [Sun, 27 Nov 2022 21:07:04 +0000 (21:07 +0000)]
Auto merge of #104506 - joshtriplett:style-principles-readability-in-plain-text, r=compiler-errors

Expand a style-guide principle: readability in plain text

18 months agoAuto merge of #2702 - RalfJung:rustup, r=RalfJung
bors [Sun, 27 Nov 2022 19:54:04 +0000 (19:54 +0000)]
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.

18 months agoclippy
Ralf Jung [Sun, 27 Nov 2022 19:50:53 +0000 (20:50 +0100)]
clippy

18 months agoadvice on josh pushing
Ralf Jung [Sun, 27 Nov 2022 19:47:49 +0000 (20:47 +0100)]
advice on josh pushing

18 months agoMerge from rustc
Ralf Jung [Sun, 27 Nov 2022 19:51:52 +0000 (20:51 +0100)]
Merge from rustc

18 months agoPreparing for merge from rustc
Ralf Jung [Sun, 27 Nov 2022 19:51:50 +0000 (20:51 +0100)]
Preparing for merge from rustc

18 months agofix type
lcnr [Sun, 27 Nov 2022 19:48:31 +0000 (20:48 +0100)]
fix type

Co-authored-by: fee1-dead <ent3rm4n@gmail.com>
18 months agoStabilize native library modifier `verbatim`
Vadim Petrochenkov [Sun, 13 Nov 2022 10:03:01 +0000 (13:03 +0300)]
Stabilize native library modifier `verbatim`

18 months agoAuto merge of #2694 - RalfJung:retag-deref-check, r=saethlin
bors [Sun, 27 Nov 2022 19:03:21 +0000 (19:03 +0000)]
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`

18 months agoAuto merge of #104983 - matthiaskrgr:rollup-018sk73, r=matthiaskrgr
bors [Sun, 27 Nov 2022 17:10:58 +0000 (17:10 +0000)]
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

18 months agoFix natvis `VecDeque` formatter
Markus Everling [Sun, 27 Nov 2022 14:55:13 +0000 (15:55 +0100)]
Fix natvis `VecDeque` formatter

18 months agoAdd rustdoc test for Deref to primitive types
Guillaume Gomez [Sun, 27 Nov 2022 15:31:52 +0000 (16:31 +0100)]
Add rustdoc test for Deref to primitive types

18 months agoRemove Crate::primitives field
Guillaume Gomez [Sun, 27 Nov 2022 15:31:34 +0000 (16:31 +0100)]
Remove Crate::primitives field

18 months agoRollup merge of #104946 - notriddle:notriddle/popover-menu-focus, r=GuillaumeGomez
Matthias Krüger [Sun, 27 Nov 2022 15:03:09 +0000 (16:03 +0100)]
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.

18 months agoRollup merge of #104944 - aDotInTheVoid:jsondoclint-unit-tests, r=jyn514
Matthias Krüger [Sun, 27 Nov 2022 15:03:09 +0000 (16:03 +0100)]
Rollup merge of #104944 - aDotInTheVoid:jsondoclint-unit-tests, r=jyn514

Support unit tests for jsondoclint

r? ````@ghost````

18 months agoRollup merge of #104934 - ChrisDenton:all-anybody-wants, r=thomcc
Matthias Krüger [Sun, 27 Nov 2022 15:03:08 +0000 (16:03 +0100)]
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 https://github.com/rust-lang/rust/commit/45bf1ed1a1123122ded05ae2eedaf0f190e52726

(hat tip to kangalioo for the git archaeology)

18 months agoRollup merge of #104931 - Swatinem:async-pretty, r=eholk
Matthias Krüger [Sun, 27 Nov 2022 15:03:08 +0000 (16:03 +0100)]
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.

18 months agoRollup merge of #104917 - compiler-errors:requires-debug-assertions, r=Mark-Simulacrum
Matthias Krüger [Sun, 27 Nov 2022 15:03:07 +0000 (16:03 +0100)]
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.

18 months agoRollup merge of #104892 - lukas-code:discriminant, r=scottmcm
Matthias Krüger [Sun, 27 Nov 2022 15:03:07 +0000 (16:03 +0100)]
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

18 months agoRollup merge of #104882 - lcnr:notify-ocx, r=Mark-Simulacrum
Matthias Krüger [Sun, 27 Nov 2022 15:03:06 +0000 (16:03 +0100)]
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 ^^

18 months agoRollup merge of #95836 - workingjubilee:doctest-exe, r=notriddle
Matthias Krüger [Sun, 27 Nov 2022 15:03:06 +0000 (16:03 +0100)]
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.

18 months agoAuto merge of #104048 - cjgillot:split-lifetime, r=compiler-errors
bors [Sun, 27 Nov 2022 14:30:19 +0000 (14:30 +0000)]
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.

18 months agointerpret: get rid of run() function
Ralf Jung [Sun, 27 Nov 2022 14:20:26 +0000 (15:20 +0100)]
interpret: get rid of run() function

18 months agoAuto merge of #2685 - Nilstrieb:cargo-miri-wasm, r=RalfJung
bors [Sun, 27 Nov 2022 13:31:05 +0000 (13:31 +0000)]
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.

18 months agoAuto merge of #2701 - RalfJung:smoke, r=RalfJung
bors [Sun, 27 Nov 2022 12:45:34 +0000 (12:45 +0000)]
Auto merge of #2701 - RalfJung:smoke, r=RalfJung

run_tests_minimal: actually run the smoke test on the desired target

18 months agorun_tests_minimal: actually run the smoke test on the desired target
Ralf Jung [Sun, 27 Nov 2022 12:26:31 +0000 (13:26 +0100)]
run_tests_minimal: actually run the smoke test on the desired target

18 months agoAuto merge of #2700 - RalfJung:begingroup, r=RalfJung
bors [Sun, 27 Nov 2022 12:21:26 +0000 (12:21 +0000)]
Auto merge of #2700 - RalfJung:begingroup, r=RalfJung

CI: fix begingroup printing

18 months agoCI: fix begingroup printing
Ralf Jung [Sun, 27 Nov 2022 12:20:44 +0000 (13:20 +0100)]
CI: fix begingroup printing

18 months agoPrefer doc comments over `//`-comments in compiler
Maybe Waffle [Sun, 27 Nov 2022 11:15:06 +0000 (11:15 +0000)]
Prefer doc comments over `//`-comments in compiler

18 months agomake simple check of prinf function.
Vincenzo Palazzo [Sat, 26 Nov 2022 21:23:27 +0000 (22:23 +0100)]
make simple check of prinf function.

With this commit we start to make some simple
check when the name resolution fails, and
we generate some helper message in case the
name is a C name like in the case of the `printf`
and suggest the correct rust method.

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
18 months agoAuto merge of #103917 - oli-obk:layout_math, r=RalfJung,lcnr
bors [Sun, 27 Nov 2022 10:35:00 +0000 (10:35 +0000)]
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

18 months agoUse `.wasm` extension when building for wasm in cargo-miri
nils [Mon, 21 Nov 2022 08:01:26 +0000 (09:01 +0100)]
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.

18 months agoUse `TyCtxt::is_fn_trait` is a couple more places
Maybe Waffle [Tue, 22 Nov 2022 19:03:26 +0000 (19:03 +0000)]
Use `TyCtxt::is_fn_trait` is a couple more places

18 months agomicro doc fixes
Maybe Waffle [Tue, 22 Nov 2022 18:52:07 +0000 (18:52 +0000)]
micro doc fixes

18 months agoSimplify `ty::ClosureKind::extends`
Maybe Waffle [Tue, 22 Nov 2022 18:35:58 +0000 (18:35 +0000)]
Simplify `ty::ClosureKind::extends`

This is valid per the comment of the `ClosureKind` defition

18 months agoAdd `TyCtxt::is_fn_trait`
Maybe Waffle [Tue, 22 Nov 2022 18:31:23 +0000 (18:31 +0000)]
Add `TyCtxt::is_fn_trait`

18 months agoRemove `ty::ClosureKind::from_def_id`
Maybe Waffle [Tue, 22 Nov 2022 18:24:50 +0000 (18:24 +0000)]
Remove `ty::ClosureKind::from_def_id`

…in favour of `TyCtxt::fn_trait_kind_from_def_id`

18 months agoRename `fn_trait_kind_from_{from_lang=>def_id}` to better convey meaning
Maybe Waffle [Tue, 22 Nov 2022 18:12:12 +0000 (18:12 +0000)]
Rename `fn_trait_kind_from_{from_lang=>def_id}` to better convey meaning

18 months agoAuto merge of #103786 - tshepang:obsolete, r=jyn514
bors [Sun, 27 Nov 2022 07:12:30 +0000 (07:12 +0000)]
Auto merge of #103786 - tshepang:obsolete, r=jyn514

Don't build `compiler_builtins` with `-C panic=abort`

18 months agoAuto merge of #96451 - JakobDegen:dest-prop, r=tmiasko
bors [Sun, 27 Nov 2022 04:09:53 +0000 (04:09 +0000)]
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

18 months agoAttempt to solve problem with globs
Jubilee Young [Sun, 27 Nov 2022 02:47:52 +0000 (18:47 -0800)]
Attempt to solve problem with globs

18 months agoUse target exe_suffix for doctests
Jubilee Young [Sat, 9 Apr 2022 05:28:33 +0000 (22:28 -0700)]
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.

18 months agoUpdate cargo
Weihang Lo [Fri, 25 Nov 2022 22:37:04 +0000 (22:37 +0000)]
Update cargo

5 commits in ba607b23db8398723d659249d9abf5536bc322e5..e027c4b5d25af2119b1956fac42863b9b3242744
2022-11-22 20:52:39 +0000 to 2022-11-25 19:44:46 +0000
- fix: Move off atty to resolve soundness issue (rust-lang/cargo#11420)
- add newline char to `cargo install .` error message for easier reading. (rust-lang/cargo#11401)
- chore: Upgrade to env_logger (rust-lang/cargo#11417)
- Change rustdoc-scrape-examples to be a target-level configuration (rust-lang/cargo#10343)
- temporarily disable test `lto::test_profile` (rust-lang/cargo#11419)

18 months agoRewrite dest prop.
Jakob Degen [Sun, 24 Apr 2022 21:34:24 +0000 (17:34 -0400)]
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.

18 months agoAuto merge of #104818 - scottmcm:refactor-extend-func, r=the8472
bors [Sun, 27 Nov 2022 00:58:50 +0000 (00:58 +0000)]
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:
https://github.com/rust-lang/rust/blob/341d8b8a2c290b4535e965867e876b095461ff6e/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:
https://github.com/rust-lang/rust/blob/341d8b8a2c290b4535e965867e876b095461ff6e/library/alloc/src/vec/mod.rs#L2494-L2502

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

r? `@ghost`

18 months agonits
Ralf Jung [Sat, 26 Nov 2022 23:06:00 +0000 (00:06 +0100)]
nits

18 months agomake Stacked Borrows retags act like data races
Ralf Jung [Sat, 26 Nov 2022 13:46:06 +0000 (14:46 +0100)]
make Stacked Borrows retags act like data races

18 months agoslightly adjust and synchronize Machine passing for SB and DataRace
Ralf Jung [Sat, 26 Nov 2022 13:42:27 +0000 (14:42 +0100)]
slightly adjust and synchronize Machine passing for SB and DataRace

18 months ago!Unpin retags must still be reads, to check dereferenceable
Ralf Jung [Sat, 26 Nov 2022 12:22:19 +0000 (13:22 +0100)]
!Unpin retags must still be reads, to check dereferenceable

also fix ICE on deallocation error and avoid redundant find_granting on retag

18 months agoAdd second test case in `make_contiguous_head_to_end`
Markus Everling [Sat, 26 Nov 2022 22:08:57 +0000 (23:08 +0100)]
Add second test case in `make_contiguous_head_to_end`

18 months agoImprove slow path in `make_contiguous`
Markus Everling [Sat, 26 Nov 2022 21:48:20 +0000 (22:48 +0100)]
Improve slow path in `make_contiguous`

18 months agoAuto merge of #104950 - jyn514:revert-preview, r=Mark-Simulacrum
bors [Sat, 26 Nov 2022 21:47:17 +0000 (21:47 +0000)]
Auto merge of #104950 - jyn514:revert-preview, r=Mark-Simulacrum

Revert "Don't set `is_preview` for clippy and rustfmt"

This reverts commit fb3e724d7602675f147a9b80e70fb6bd6512738c, 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

18 months agoSwitch rustdoc-gui test to function call
Guillaume Gomez [Sat, 26 Nov 2022 21:35:05 +0000 (22:35 +0100)]
Switch rustdoc-gui test to function call

18 months agorustdoc: pass "true" to reset focus for notable traits
Michael Howell [Sat, 26 Nov 2022 21:32:57 +0000 (14:32 -0700)]
rustdoc: pass "true" to reset focus for notable traits

18 months agoRevert "Don't set `is_preview` for clippy and rustfmt"
Joshua Nelson [Sat, 26 Nov 2022 20:23:53 +0000 (15:23 -0500)]
Revert "Don't set `is_preview` for clippy and rustfmt"

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

18 months agoPretty-print generators with their `generator_kind`
Arpad Borsos [Fri, 25 Nov 2022 08:53:58 +0000 (09:53 +0100)]
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.

18 months agoAuto merge of #104945 - GuillaumeGomez:rollup-ygzbpbe, r=GuillaumeGomez
bors [Sat, 26 Nov 2022 17:58:12 +0000 (17:58 +0000)]
Auto merge of #104945 - GuillaumeGomez:rollup-ygzbpbe, r=GuillaumeGomez

Rollup of 7 pull requests

Successful merges:

 - #104786 (Use the power of adding helper function to simplify code w/ `Mutability`)
 - #104788 (Do not record unresolved const vars in generator interior)
 - #104909 (Rename `normalize_opaque_types` to `reveal_opaque_types_in_bounds`)
 - #104921 (Remove unnecessary binder from `get_impl_future_output_ty`)
 - #104924 (jsondoclint: Accept trait alias is places where trait expected.)
 - #104928 (rustdoc: use flexbox CSS to align sidebar button instead of position)
 - #104943 (jsondoclint: Handle using enum variants and glob using enums.)

Failed merges:

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