Commit Graph

6314 Commits

Author SHA1 Message Date
Matthias Krüger
15fb2f214c
Rollup merge of #123130 - oli-obk:missing_type_taint, r=compiler-errors
Load missing type of impl associated constant from trait definition

fixes #123092

Also does some cleanups I discovered while analyzing this issue
2024-03-27 23:27:23 +01:00
Matthias Krüger
ae33b9045b
Rollup merge of #123101 - Bryanskiy:delegation-fixes-2, r=petrochenkov
Delegation: fix ICE on wrong `Self` instantiation

fixes https://github.com/rust-lang/rust/issues/119921
fixes https://github.com/rust-lang/rust/issues/119919

There is no way to instantiate `Self` param for caller in delegation item if

1. callee is a trait method && callee contains `Self` param
2. delegation item isn't an associative item

In general, we can consider `Self` param as independent type param in these cases:

```rust

trait Trait {
    fn foo(_: Option<&Self>) {...}
}

reuse Trait::foo;
// will be desugared to:
fn foo<T: Trait>(x: Option<&T>) { Trait::foo(x) }
```

But this requires early bound parameters support. For now, I suggest banning such cases to avoid ICE's.

r? ``@petrochenkov``
2024-03-27 23:27:23 +01:00
Matthias Krüger
6464e5b78c
Rollup merge of #123075 - rcvalle:rust-cfi-fix-drop-drop-in-place, r=compiler-errors
CFI: Fix drop and drop_in_place

Fix drop and drop_in_place by transforming self of drop and drop_in_place methods into a Drop trait objects.

This was split off from https://github.com/rust-lang/rust/pull/116404.

cc `@compiler-errors` `@workingjubilee`
2024-03-27 23:27:22 +01:00
Ramon de C Valle
0b860818e6 CFI: Fix drop and drop_in_place
Fix drop and drop_in_place by transforming self of drop and
drop_in_place methods into Drop trait objects.
2024-03-27 12:52:14 -07:00
Jules Bertholet
528d45af18
Feature gate 2024-03-27 11:20:28 -04:00
Kornel
826ddb3018 Suggest correct path in include_bytes! 2024-03-27 15:16:25 +00:00
Oli Scherer
e522d2906d Stop sorting DefIds in the compiler 2024-03-27 14:02:17 +00:00
Oli Scherer
6be79cb103 Sort a diagnostic by DefPathStr instead of DefId 2024-03-27 14:02:16 +00:00
Oli Scherer
57f68c3555 Sort method suggestions by DefPath instead of DefId 2024-03-27 14:02:16 +00:00
Oli Scherer
459ea32a27 Remove Partial/Ord from BoundRegion 2024-03-27 14:02:16 +00:00
Oli Scherer
ae24fef028 Use TraitRef::to_string sorting in favor of TraitRef::ord, as the latter compares DefIds which we need to avoid 2024-03-27 14:02:15 +00:00
Jules Bertholet
e0da13f25f
Implement mut ref/mut ref mut 2024-03-27 09:53:23 -04:00
Bryanskiy
0cd9708de6 Delegation: fix ICE on wrong instantiation 2024-03-27 15:51:48 +03:00
Oli Scherer
804c047657 Load missing type of impl associated constant from trait definition 2024-03-27 11:02:53 +00:00
bors
10a7aa14fe Auto merge of #123128 - GuillaumeGomez:rollup-3l3zu6s, r=GuillaumeGomez
Rollup of 6 pull requests

Successful merges:

 - #121843 (Implement `-L KIND=`@RUSTC_BUILTIN/...`)`
 - #122860 (coverage: Re-enable `UnreachablePropagation` for coverage builds)
 - #123021 (Make `TyCtxt::coroutine_layout` take coroutine's kind parameter)
 - #123024 (CFI: Enable KCFI testing of run-pass tests)
 - #123083 (lib: fix some unnecessary_cast clippy lint)
 - #123116 (rustdoc: Swap fields and variant documentations)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-27 09:32:38 +00:00
Guillaume Gomez
dc4236d43b
Rollup merge of #123024 - maurer:kcfi-testing, r=workingjubilee
CFI: Enable KCFI testing of run-pass tests

This enables KCFI-based testing for all the CFI run-pass tests in the suite today. We can add the test header on top of in-flight CFI tests once they land. This is becoming more important as we get closer to leveraging CFI's multiple type attachment feature, as that is where the implementations will have a divergence.

It also enables KCFI as a sanitizer for x86_64 and aarch64 Linux to make this possible. The sanitizer should likely be available for all aarch64, x86_64, and riscv targets, but that isn't critical for initial testing.
2024-03-27 10:13:43 +01:00
bors
0dcc1309d0 Auto merge of #116016 - jhpratt:kill-rustc-serialize, r=ehuss
Soft-destabilize `RustcEncodable` & `RustcDecodable`, remove from prelude in next edition

cc rust-lang/libs-team#272

Any use of `RustcEncodable` and `RustcDecodable` now triggers a deny-by-default lint. The derives have been removed from the 2024 prelude. I specifically chose **not** to document this in the module-level documentation, as the presence in existing preludes is not documented (which I presume is intentional).

This does not implement the proposed change for `rustfix`, which I will be looking into shortly.

With regard to the items in the preludes being stable, this should not be an issue because #15702 has been resolved.

r? libs-api
2024-03-27 07:30:36 +00:00
bors
435b525514 Auto merge of #122958 - jieyouxu:port-backtrace-dylib-dep, r=workingjubilee
Port backtrace dylib-dep test to a ui test

Original test: [dylib-dep](6fa4b85b99/crates/dylib-dep)
Part of #122899.
2024-03-27 01:08:47 +00:00
bors
a1b499134a Auto merge of #123108 - matthiaskrgr:rollup-zossklv, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #108675 (Document `adt_const_params` feature in Unstable Book)
 - #122120 (Suggest associated type bounds on problematic associated equality bounds)
 - #122589 (Fix diagnostics for async block cloning)
 - #122835 (Require `DerefMut` and `DerefPure` on `deref!()` patterns when appropriate)
 - #123049 (In `ConstructCoroutineInClosureShim`, pass receiver by mut ref, not mut pointer)
 - #123055 (enable cargo miri test doctests)
 - #123057 (unix fs: Make hurd using explicit new rather than From)
 - #123087 (Change `f16` and `f128` clippy stubs to be nonpanicking)
 - #123103 (Rename `Inherited` -> `TypeckRootCtxt`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-26 22:25:03 +00:00
Matthias Krüger
0029a11d7d
Rollup merge of #122835 - compiler-errors:deref-pure, r=Nadrieril
Require `DerefMut` and `DerefPure` on `deref!()` patterns when appropriate

Waiting on the deref pattern syntax pr to merge

r? nadrieril
2024-03-26 21:23:48 +01:00
Matthias Krüger
20770ac3fc
Rollup merge of #122589 - wutchzone:121547, r=compiler-errors
Fix diagnostics for async block cloning

Closes #121547

r? diagnostics
2024-03-26 21:23:48 +01:00
Matthias Krüger
ff8cdc9e14
Rollup merge of #122120 - fmease:sugg-assoc-ty-bound-on-eq-bound, r=compiler-errors
Suggest associated type bounds on problematic associated equality bounds

Fixes #105056. TL;DR: Suggest `Trait<Ty: Bound>` on `Trait<Ty = Bound>` in Rust >=2021.

~~Blocked on #122055 (stabilization of `associated_type_bounds`), I'd say.~~ (merged)
2024-03-26 21:23:47 +01:00
bors
47ecded352 Auto merge of #118644 - madsmtm:macos-weak-linking-test, r=compiler-errors
Add test for Apple's `-weak_framework` linker argument

The [`-weak_framework`](https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/WeakLinking.html) linker argument can sometimes be useful to reduce startup times, and to link newer frameworks while still having older deployment targets.

So I made a test to ensure that it continues to work.

Discussed in https://github.com/rust-lang/rust/issues/99427.
2024-03-26 20:22:54 +00:00
许杰友 Jieyou Xu (Joe)
7764e8ace3
Port backtrace dylib-dep test to a ui test 2024-03-26 19:07:12 +00:00
Matthias Krüger
4d1fb9e98a
Rollup merge of #123091 - Bryanskiy:delegation-fixes, r=petrochenkov
Delegation: fix ICE on wrong `self` resolution

fixes https://github.com/rust-lang/rust/issues/122874

Delegation item should be wrapped in a `rib` to behave like a regular function during name resolution.

r? `@petrochenkov`
2024-03-26 17:06:43 +01:00
Matthias Krüger
1fd3ee0660
Rollup merge of #123066 - maurer:cfi-erased-lifetime-ice, r=compiler-errors
CFI: (actually) check that methods are object-safe before projecting their receivers to `dyn Trait` in CFI

`trait_object_ty` assumed that associated types would be fully determined by the trait. This is *almost* true - const parameters and type parameters are no longer allowed, but lifetime parameters are. Since we erase all lifetime parameters anyways, instantiate it with as many erased regions as it needs.

Fixes: #123053

r? `@compiler-errors`
2024-03-26 17:06:40 +01:00
Matthias Krüger
03f5c4f05f
Rollup merge of #122766 - bvanjoi:fix-115185, r=petrochenkov
store segment and module in `UnresolvedImportError`

Fixes #115185

An easy fix. r? `@Nilstrieb`
2024-03-26 17:06:38 +01:00
Michael Goulet
950b40f111 Don't check match scrutinee of postfix match for unused parens 2024-03-26 11:16:49 -04:00
Bryanskiy
17c6101864 Delegation: fix ICE on wrong self resolution 2024-03-26 14:00:51 +03:00
bors
519d892f95 Auto merge of #121387 - oli-obk:eager_const_failures_regression, r=lcnr
Avoid some unnecessary query invocations.

Specifically this inlines `const_eval_poly` and avoids computing the generic params, the param env, normalizing the param env and erasing lifetimes on everything.

should fix the perf regression from https://github.com/rust-lang/rust/pull/121087
2024-03-26 10:52:11 +00:00
Ali MJ Al-Nasrawy
4e1999d387 ignore uncaptured lifetimes when checking opaques 2024-03-26 09:26:23 +00:00
Ali MJ Al-Nasrawy
92f40b8059 fix ICE in check_unique 2024-03-26 09:26:23 +00:00
Matthew Maurer
2c0a8de0b9 CFI: Enable KCFI testing of run-pass tests
This enables KCFI-based testing for all the CFI run-pass tests in the
suite today. We can add the test header on top of in-flight CFI tests
once they land.

It also enables KCFI as a sanitizer for x86_64 and aarch64 Linux to make
this possible. The sanitizer should likely be available for all aarch64,
x86_64, and riscv targets, but that isn't critical for initial testing.
2024-03-26 03:16:41 +00:00
Michael Goulet
5fdc7555c1 Require DerefMut if deref pattern has nested ref mut binding 2024-03-25 19:39:45 -04:00
Matthew Maurer
70e1d23895 CFI: Pad out associated type resolution with erased lifetimes
`trait_object_ty` assumed that associated types would be fully
determined by the trait. This is *almost* true - const parameters and
type parameters are no longer allowed, but lifetime parameters are.
Since we erase all lifetime parameters anyways, instantiate it with as
many erased regions as it needs.

Fixes: #123053
2024-03-25 22:46:21 +00:00
Jubilee
56e8f67c87
Rollup merge of #123051 - matthiaskrgr:casetest, r=workingjubilee
did I mention that tests are super cool?

Fixes https://github.com/rust-lang/rust/issues/81974
Fixes https://github.com/rust-lang/rust/issues/84727
Fixes https://github.com/rust-lang/rust/issues/92979
2024-03-25 14:35:38 -07:00
Jubilee
4856f9a42f
Rollup merge of #122950 - ShoyuVanilla:issue-101903, r=compiler-errors
Add regression tests for #101903

Closes #101903

See https://doc.rust-lang.org/1.77.0/nightly-rustc/rustc_lint/opaque_hidden_inferred_bound/static.OPAQUE_HIDDEN_INFERRED_BOUND.html#example
2024-03-25 14:35:36 -07:00
Jubilee
9775296796
Rollup merge of #122923 - kpreid:print-async-def, r=compiler-errors
In `pretty_print_type()`, print `async fn` futures' paths instead of spans.

This makes `-Zprint-type-sizes`'s output easier to read, because the name of an `async fn` is more immediately recognizable than its span. This change will also synergize with my other `-Zprint-type-sizes` PR #122922 which prints the type of child futures being awaited.

I also deleted the comment "FIXME(eddyb) should use `def_span`." because it appears to have already been fixed by commit 67727aa7c3.
2024-03-25 14:35:35 -07:00
Jubilee
2f8c9bd651
Rollup merge of #122769 - RalfJung:reachable, r=tmiasko
extend comments for reachability set computation

I hope this is right. :) Please review carefully.

r? ``@tmiasko``
Cc ``@oli-obk`` ``@saethlin``
2024-03-25 14:35:34 -07:00
Matthias Krüger
a3c2d752bd add test for ICE: failed to get layout for [type error] #92979
Fixes https://github.com/rust-lang/rust/issues/92979
2024-03-25 20:35:51 +01:00
Matthias Krüger
6fe555549b add test for ICE Where clause Binder(..) was applicable to Obligation(..) but now is not
Fixes https://github.com/rust-lang/rust/issues/84727
2024-03-25 20:20:01 +01:00
Matthias Krüger
5f95fc1dff add test for Compiler panic using fn_traits #81974
Fixes https://github.com/rust-lang/rust/issues/81974
2024-03-25 20:15:28 +01:00
Ralf Jung
d94f6576dd extend doc comment for reachability set computation
also extend the const fn reachability test
2024-03-25 19:57:57 +01:00
Matthias Krüger
4369718980
Rollup merge of #123034 - bjorn3:test_ignores, r=compiler-errors
Add a bunch of needs-unwind annotations to tests

To filter out tests that fail with cg_clif due to missing panic=unwind support.
2024-03-25 17:05:36 +01:00
Matthias Krüger
657dd0b797
Rollup merge of #122999 - Alexendoo:unpretty-avoid-crash-test, r=petrochenkov
Fix unpretty UI test when /tmp does not exist

On Windows this test fails if e.g. `C:\tmp` is created successfully
2024-03-25 17:05:35 +01:00
Matthias Krüger
877f29363d
Rollup merge of #122988 - matthiaskrgr:icetests, r=petrochenkov
add even more tests!

Fixes https://github.com/rust-lang/rust/issues/109869
Fixes https://github.com/rust-lang/rust/issues/110453
Fixes https://github.com/rust-lang/rust/issues/109020
Fixes https://github.com/rust-lang/rust/issues/108580
Fixes https://github.com/rust-lang/rust/issues/108220
Fixes https://github.com/rust-lang/rust/issues/113045
Fixes https://github.com/rust-lang/rust/issues/113133
Fixes https://github.com/rust-lang/rust/issues/114464
Fixes https://github.com/rust-lang/rust/issues/116599
Fixes https://github.com/rust-lang/rust/issues/119731
2024-03-25 17:05:34 +01:00
Matthias Krüger
e9ec44251c
Rollup merge of #122910 - compiler-errors:unit-struct-in-path-pat-only, r=petrochenkov
Validate that we're only matching on unit struct for path pattern

Resolution doesn't validate that we only really take `CtorKind::Unit` in path patterns, since all it sees is `Res::SelfCtor(def_id)`. Check this instead during pattern typeck.

r? petrochenkov

Fixes #122809
2024-03-25 17:05:33 +01:00
Matthias Krüger
ccc5310922
Rollup merge of #122881 - Bryanskiy:delegation-fixes-2, r=petrochenkov
Delegation: fix ICE on `bound_vars` divergence

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

Bug was caused by divergence  between lowered type and corresponding `bound_vars` in `late_bound_vars_map`. In this patch `bound_vars` calculation for delegation item is moved from `lower_fn_ty` to `resolve_bound_vars` query.

r? `@petrochenkov`
2024-03-25 17:05:32 +01:00
Matthias Krüger
ded16b3a97
Rollup merge of #122842 - pacak:explicit_name, r=michaelwoerister
Don't emit an error about failing to produce a file with a specific name if user never gave an explicit name

Fixes #122509

You can ask `rustc` to produce some intermediate results with `--emit foo`, this operation comes in two flavors: `--emit asm` and `--emit asm=foo.s`. First one produces one or more `.s` files without any name guarantees, second one renames it into `foo.s`. Second version only works when compiler produces a single file - for asm files this means using a single compilation unit for example.

In case compilation produced more than a single file `rustc` runs following check to emit some warnings:

```rust
            if crate_output.outputs.contains_key(&output_type) {
                // 2) Multiple codegen units, with `--emit foo=some_name`. We have
                //    no good solution for this case, so warn the user.
                sess.dcx().emit_warn(errors::IgnoringEmitPath { extension });
            } else if crate_output.single_output_file.is_some() {
                // 3) Multiple codegen units, with `-o some_name`. We have
                //    no good solution for this case, so warn the user.
                sess.dcx().emit_warn(errors::IgnoringOutput { extension });
            } else {
                // 4) Multiple codegen units, but no explicit name. We
                //    just leave the `foo.0.x` files in place.
                // (We don't have to do any work in this case.)
            }
```

Comment in the final `else` branch implies that if user didn't ask for a specific name - there's no need to emit warnings. However because of the internal representation of `crate_output.outputs` - this doesn't work as expected: if user asked to produce an asm file without giving it an implicit name it will contain `Some(None)`.

To fix the problem new code actually checks if user gave an explicit name. I think this was an original intentional behavior, at least comments imply that.
2024-03-25 17:05:32 +01:00
bjorn3
5f5dcaefe6 Add needs-unwind for proc macro tests
Rustc gives a warning when compiling proc macros with panic=abort.
2024-03-25 15:02:55 +00:00
Kevin Reid
3010fa9afb In pretty_print_type(), print async fn futures' paths instead of spans.
This makes `-Zprint-type-sizes`'s output easier to read, because the
name of an `async fn` is more immediately recognizable than its span.

I also deleted the comment "FIXME(eddyb) should use `def_span`." because
it appears to have already been fixed by commit 67727aa7c3.
2024-03-25 08:01:15 -07:00
bjorn3
3733dcc72d Add needs-unwind annotations to a couple of tests 2024-03-25 14:19:07 +00:00
bors
af98101ed8 Auto merge of #123029 - matthiaskrgr:rollup-6qsevhx, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #122858 (Tweak `parse_dot_suffix_expr`)
 - #122982 (Add more comments to the bootstrap code that handles `tests/coverage`)
 - #122990 (Clarify transmute example)
 - #122995 (Clean up unnecessary headers/flags in coverage mir-opt tests)
 - #123003 (CFI: Handle dyn with no principal)
 - #123005 (CFI: Support complex receivers)
 - #123020 (Temporarily remove nnethercote from the review rotation.)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-25 12:00:21 +00:00
Matthias Krüger
fe0222be07
Rollup merge of #123005 - maurer:cfi-arbitrary-receivers, r=compiler-errors
CFI: Support complex receivers

Right now, we only support rewriting `&self` and `&mut self` into `&dyn MyTrait` and `&mut dyn MyTrait`. This expands it to handle the full gamut of receivers by calculating the receiver based on *substitution* rather than based on a rewrite. This means that, for example, `Arc<Self>` will become `Arc<dyn MyTrait>` appropriately with this change.

This approach also allows us to support associated type constraints as well, so we will correctly rewrite `&self` into `&dyn MyTrait<T=i32>`, for example.

r? ```@workingjubilee```
2024-03-25 11:00:14 +01:00
Matthias Krüger
84ec66e15b
Rollup merge of #123003 - maurer:dyn-empty, r=compiler-errors
CFI: Handle dyn with no principal

In user-facing Rust, `dyn` always has at least one predicate following it. Unfortunately, because we filter out marker traits from receivers at callsites and `dyn Sync` is, for example, legal, this results in us having `dyn` types with no predicates on occasion in our alias set encoding. This patch handles cases where there are no predicates in a `dyn` type which are relevant to its alias set.

Fixes #122998

r? workingjubilee
2024-03-25 11:00:14 +01:00
bors
dda2372cf3 Auto merge of #122802 - estebank:unconstrained-generic-const, r=Nadrieril
Provide structured suggestion for unconstrained generic constant

```
error: unconstrained generic constant
  --> $DIR/const-argument-if-length.rs:18:10
   |
LL |     pad: [u8; is_zst::<T>()],
   |          ^^^^^^^^^^^^^^^^^^^
   |
help: try adding a `where` bound
   |
LL | pub struct AtLeastByte<T: ?Sized> where [(); is_zst::<T>()]: {
   |                                   ++++++++++++++++++++++++++
```

Detect when the constant expression isn't `usize` and suggest casting:

```
error: unconstrained generic constant
 --> f300.rs:6:10
  |
6 |     bb::<{!N}>();
  |          ^^^^
-Ztrack-diagnostics: created at compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs:3539:36
  |
help: try adding a `where` bound
  |
5 | fn b<const N: bool>() where [(); {!N} as usize]: {
  |                       ++++++++++++++++++++++++++
```

Fix #122395.
2024-03-25 09:59:37 +00:00
Martin Nordholts
71eb763d23 unix_sigpipe: Add test for SIGPIPE disposition in child processes
For robustness, also test the disposition in our own process even if
other tests in `tests/ui/attributes/unix_sigpipe` already covers it.
2024-03-25 06:23:47 +01:00
Martin Nordholts
a2a2f30415 test-aux-bin.rs: Clarify that it is aux-bin that blocks cross-compile run-pass 2024-03-25 06:23:35 +01:00
bors
13dac8fb73 Auto merge of #122721 - oli-obk:merge_queries, r=davidtwco
Replace `mir_built` query with a hook and use mir_const everywhere instead

A small perf improvement due to less dep graph handling.

Mostly just a cleanup to get rid of one of our many mir queries
2024-03-25 01:33:46 +00:00
Matthew Maurer
40f41e7e89 CFI: Support arbitrary receivers
Previously, we only rewrote `&self` and `&mut self` receivers. By
instantiating the method from the trait definition, we can make this
work work with arbitrary legal receivers instead.
2024-03-24 22:46:48 +00:00
Matthew Maurer
ea4518522f CFI: Handle dyn with no principal
In user-facing Rust, `dyn` always has at least one predicate following
it. Unfortunately, because we filter out marker traits from receivers at
callsites and `dyn Sync` is, for example, legal, this results in us
having `dyn` types with no predicates on occasion in our alias set
encoding. This patch handles cases where there are no predicates in a
`dyn` type which are relevant to its alias set.

Fixes #122998
2024-03-24 16:58:33 +00:00
Matthias Krüger
f67fb08605
Rollup merge of #122984 - RalfJung:panic-in-hook, r=Amanieu
panic-in-panic-hook: formatting a message that's just a string is risk-free

This slightly improves the output in the 'panic while processing panic' case if the panic message does not involve any formatting. Follow-up to https://github.com/rust-lang/rust/pull/122930.

r? ``@Amanieu``
2024-03-24 17:08:19 +01:00
Matthias Krüger
96a5348c05
Rollup merge of #122949 - ShoyuVanilla:issue-117310, r=lcnr
Add a regression test for #117310

Closes #117310

It seems to have been fixed in `rustc 1.79.0-nightly (1388d7a06 2024-03-20)` or before, so just adding a regression test for it.
2024-03-24 17:08:17 +01:00
Matthias Krüger
702261dce6
Rollup merge of #122886 - matthiaskrgr:issue90192, r=fee1-dead
add test for #90192

Fixes #90192
2024-03-24 17:08:16 +01:00
Matthias Krüger
04eedb24c9
Rollup merge of #122757 - h1467792822:priv-dep, r=davidtwco
Fixed the `private-dependency` bug

Fixed the private-dependency bug: If the directly dependent crate is loaded last and is not configured with `--extern`, it may be incorrectly set to `private-dependency`

Fixes #122756
2024-03-24 17:08:15 +01:00
Alex Macleod
47192937d4 Fix unpretty UI test when /tmp does not exist 2024-03-24 14:00:45 +00:00
bors
6e6c721742 Auto merge of #122895 - matthiaskrgr:ice-tests-5xxxx-to-9xxxx, r=fmease
add some ice tests 5xxxx to 9xxxx

  Fixes rust-lang/rust#98842
  Fixes rust-lang/rust#90691
  Fixes rust-lang/rust#88421
  Fixes rust-lang/rust#88212
  Fixes rust-lang/rust#83056
  Fixes rust-lang/rust#80125
  Fixes rust-lang/rust#64784
  Fixes rust-lang/rust#52334
2024-03-24 13:38:12 +00:00
bors
6a92312a1e Auto merge of #122891 - compiler-errors:encode-implied-predicates-always, r=oli-obk
Encode implied predicates for traits

In #112629, we decided to make associated type bounds in the "supertrait" AST position *implied* even though they're not supertraits themselves.

This means that the `super_predicates` and `implied_predicates` queries now differ for regular traits. The assumption that they didn't differ was hard-coded in #107614, so in cross-crate positions this means that we forget the implied predicates from associated type bounds.

This isn't unsound, just kind of annoying. This should be backported since associated type bounds are slated to stabilize for 1.78 -- either that, or associated type bounds can be reverted on beta and re-shipped in 1.79 with this patch.

Fixes #122859
2024-03-24 11:17:21 +00:00
Matthias Krüger
e4d816e66c add tests for ICE: 'broken MIR: bad assignment: NoSolution' on trait with default method and no impls
Fixes #109869
2024-03-24 10:57:20 +01:00
Matthias Krüger
e800b99347 add tests for ICE in mir building with captured value of unresolved type, None in compiler/rustc_mir_build/src/build/expr/as_place.rs #110453
Fixes #110453
2024-03-24 10:51:23 +01:00
Matthias Krüger
56ea366763 add test for Failed to normalize closure with TAIT #109020
Fixes #109020
2024-03-24 10:41:34 +01:00
Matthias Krüger
5e0d8c3b62 add test for ICE: no errors encountered even though delay_span_bug issued, expected ReFree to map to ReEarlyBound #108580
Fixes https://github.com/rust-lang/rust/issues/108580
2024-03-24 10:35:24 +01:00
Ralf Jung
0727b6ad0d panic-in-panic-hook: formatting a message that's just a string is risk-free 2024-03-24 10:29:44 +01:00
Matthias Krüger
6203ebe274 add test for ICE with associated_const_equality #108220
Fixes #108220
2024-03-24 10:28:25 +01:00
Matthias Krüger
b151e06659 add test for ICE: min_specialization: Ok(['?0, Const { ty: usize, kind: Leaf(0x0000000000000000) }]) is not fully resolved #113045
Fixes https://github.com/rust-lang/rust/issues/113045
2024-03-24 10:19:25 +01:00
Matthias Krüger
cdea6d8382 add test for ICE: no entry found for key for const function in generic_const_exprs #113133
Fixes #113133
2024-03-24 10:16:29 +01:00
Matthias Krüger
8ed5e6744f add test for #114464
Fixes #114464
2024-03-24 10:09:56 +01:00
Matthias Krüger
db68dc27f4 add test for #116599
Fixes #116599
2024-03-24 10:05:27 +01:00
Matthias Krüger
127c36c794 add test for https://github.com/rust-lang/rust/issues/119731
Fixes #119731
2024-03-24 10:01:50 +01:00
Matthias Krüger
114d012a0e add issue numbers via // issue: rust-lang/rust#ISSUE_NUM directive 2024-03-24 09:34:11 +01:00
Matthias Krüger
57f500512b add test for stack overflow with recursive type #98842
Fixes #98842
2024-03-24 09:23:13 +01:00
Matthias Krüger
5ae90256da add test for ice #90691 ICE: resolution failed during building vtable representation
Fixes #90691
2024-03-24 09:23:13 +01:00
Matthias Krüger
f44ee8f87d add test for 88421 ICE: could not fully normalize `&<MyType as std::ops::Index<MyType>>::Output
Fixes #88421
2024-03-24 09:23:13 +01:00
Matthias Krüger
74ca9813ed add test for #88212 ICE when lambda captures unsized local
Fixes #88212
2024-03-24 09:23:13 +01:00
Matthias Krüger
445507a19d add test for ice 83056 "bad input type for cast"
Fixes #83056
2024-03-24 09:23:12 +01:00
Matthias Krüger
19310ce2cc add test for str as extern "C" arg causes compiler panic #80125
Fixes #80125
2024-03-24 09:23:12 +01:00
Matthias Krüger
a5ad0be52f add test for #64784 Declarative macros can create infinite glob import cycles
Fixes #64784
2024-03-24 09:23:12 +01:00
Matthias Krüger
14d05c4c4b add test for #52334
Fixes #52334
2024-03-24 09:23:12 +01:00
Matthias Krüger
fc5085d570 add test for #90192
Fixes #90192
2024-03-24 09:19:29 +01:00
Jubilee
992aa1edb6
Rollup merge of #122879 - maurer:callsite-instances, r=workingjubilee
CFI: Strip auto traits off Virtual calls

We already use `Instance` at declaration sites when available to glean additional information about possible abstractions of the type in use. This does the same when possible at callsites as well.

The primary purpose of this change is to allow CFI to alter how it generates type information for indirect calls through `Virtual` instances.

This is needed for the "separate machinery" version of my approach to the vtable issues (#122573), because we need to respond differently to a `Virtual` call to the same type as a non-virtual call, specifically [stripping auto traits off the receiver's `Self`](54b15b0c36) because there isn't a separate vtable for `Foo` vs `Foo + Send`.

This would also make a more general underlying mechanism that could be used by rcvalle's [proposed drop detection / encoding](edcd1e20a1) if we end up using his approach, as we could condition out on the `def_id` in the CFI code rather than requiring the generating code to explicitly note whether it was calling drop.
2024-03-23 22:59:42 -07:00
Jubilee
b9b65f816d
Rollup merge of #122875 - maurer:cfi-transparent-termination, r=workingjubilee
CFI: Support self_cell-like recursion

Current `transform_ty` attempts to avoid cycles when normalizing `#[repr(transparent)]` types to their interior, but runs afoul of this pattern used in `self_cell`:

```
struct X<T> {
  x: u8,
  p: PhantomData<T>,
}

 #[repr(transparent)]
struct Y(X<Y>);
```

When attempting to normalize Y, it will still cycle indefinitely. By using a types-visited list, this will instead get expanded exactly one layer deep to X<Y>, and then stop, not attempting to normalize `Y` any further.

This PR was split off from #121962 as part of fixing the larger vtable compatibility issues.

r? ``````@workingjubilee``````
2024-03-23 22:59:42 -07:00
Jubilee
97fcfaa103
Rollup merge of #121940 - veera-sivarajan:bugfix-121593, r=fmease
Mention Register Size in `#[warn(asm_sub_register)]`

Fixes #121593

Displays the register size information obtained from `suggest_modifier()` and `default_modifier()`.
2024-03-23 22:59:40 -07:00
Matthias Krüger
2463ad0f5f
Rollup merge of #122943 - matthiaskrgr:ice-tests-9xxxx-to-12xxxx, r=fmease
add a couple more ice tests

Fixes rust-lang/rust#104779
Fixes rust-lang/rust#106423
Fixes rust-lang/rust#106444
Fixes rust-lang/rust#101852
Fixes rust-lang/rust#106874
Fixes rust-lang/rust#105047
Fixes rust-lang/rust#107228
Fixes rust-lang/rust#99945
2024-03-24 01:05:54 +01:00
Matthias Krüger
d8c224267d
Rollup merge of #122942 - Luv-Ray:master, r=lcnr
Add test in higher ranked subtype

I'm a beginner in this repository, and there are some things I'm not sure about:

- Is it okay that there is a warning:
```
rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [?1t, '^0.Named(DefId(0:15 ~ structually_relate_aliases[de75]::{impl#1}::'a), "'a")], def_id: DefId(0:5 ~ structually_relate_aliases[de75]::ToUnit::Unit) }
```
- Is it okay that there are two duplicate errors in the same line?
- Did I put the test in the right place?

Any suggestions would be appreciated.

Fixes #121649
2024-03-24 01:05:54 +01:00
Matthias Krüger
cb03714e6f
Rollup merge of #122907 - compiler-errors:uniquify-reerror, r=lcnr
Uniquify `ReError` on input mode in canonicalizer

See test descr

Fixes #122861

r? lcnr
2024-03-24 01:05:53 +01:00
Matthias Krüger
1164c2725e
Rollup merge of #122217 - estebank:issue-119685, r=fmease
Handle str literals written with `'` lexed as lifetime

Given `'hello world'` and `'1 str', provide a structured suggestion for a valid string literal:

```
error[E0762]: unterminated character literal
  --> $DIR/lex-bad-str-literal-as-char-3.rs:2:26
   |
LL |     println!('hello world');
   |                          ^^^^
   |
help: if you meant to write a `str` literal, use double quotes
   |
LL |     println!("hello world");
   |              ~           ~
```
```
error[E0762]: unterminated character literal
  --> $DIR/lex-bad-str-literal-as-char-1.rs:2:20
   |
LL |     println!('1 + 1');
   |                    ^^^^
   |
help: if you meant to write a `str` literal, use double quotes
   |
LL |     println!("1 + 1");
   |              ~     ~
```

Fix #119685.
2024-03-24 01:05:51 +01:00
Matthias Krüger
516758136e
Rollup merge of #121281 - kadiwa4:test_103626, r=estebank,lcnr
regression test for #103626

I don't know what a descriptive filename for this would be.

Fixes #103626
2024-03-24 01:05:50 +01:00
Ralf Jung
f2cff5ebb9 also rename the SIMD intrinsic 2024-03-23 23:03:37 +01:00
Daniel Sedlak
0c7f8b0f89 Fix diagnostics for async block cloning 2024-03-23 20:22:51 +01:00
Matthew Maurer
f434c27067 CFI: Strip auto traits off Self for virtual calls
Additional trait bounds beyond the principal trait and its implications
are not possible in the vtable. This means that if a receiver is
`&dyn Foo + Send`, the function will only be expecting `&dyn Foo`.

This strips those auto traits off before CFI encoding.
2024-03-23 18:30:45 +00:00
Kalle Wachsmuth
188c46a65e
regression test for #103626 2024-03-23 17:48:57 +01:00
bors
020bbe46bd Auto merge of #122947 - matthiaskrgr:rollup-10j7orh, r=matthiaskrgr
Rollup of 11 pull requests

Successful merges:

 - #120577 (Stabilize slice_split_at_unchecked)
 - #122698 (Cancel `cargo update` job if there's no updates)
 - #122780 (Rename `hir::Local` into `hir::LetStmt`)
 - #122915 (Delay a bug if no RPITITs were found)
 - #122916 (docs(sync): normalize dot in fn summaries)
 - #122921 (Enable more mir-opt tests in debug builds)
 - #122922 (-Zprint-type-sizes: print the types of awaitees and unnamed coroutine locals.)
 - #122927 (Change an ICE regression test to use the original reproducer)
 - #122930 (add panic location to 'panicked while processing panic')
 - #122931 (Fix some typos in the pin.rs)
 - #122933 (tag_for_variant follow-ups)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-23 15:58:17 +00:00
Luv-Ray
246f7465b3 Add test in higher-ranked 2024-03-23 23:33:43 +08:00
Shoyu Vanilla
c31b2178e0 Add regression tests for #101903 2024-03-24 00:32:04 +09:00
Matthias Krüger
9aea37d3c1 address review feedback 2024-03-23 16:14:42 +01:00
Shoyu Vanilla
37dbe40a7e Add a regression test for #117310 2024-03-23 23:54:44 +09:00
Matthias Krüger
691d5f533d
Rollup merge of #122930 - RalfJung:panic-in-panic-fmt, r=Amanieu
add panic location to 'panicked while processing panic'

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

r? `@Amanieu`
2024-03-23 15:00:20 +01:00
Matthias Krüger
aaf5f3b53e
Rollup merge of #122927 - gurry:122199-ice-unexpected-node-2, r=workingjubilee
Change an ICE regression test to use the original reproducer

The ICE was fixed in PR https://github.com/rust-lang/rust/pull/122370, but the test used a different reproducer than the one originally reported. This PR changes it to the original one, giving us more confidence that the fix works.

Fixes #122199
2024-03-23 15:00:20 +01:00
Matthias Krüger
9418f69446
Rollup merge of #122922 - kpreid:print-async, r=compiler-errors
-Zprint-type-sizes: print the types of awaitees and unnamed coroutine locals.

This should assist comprehending the size of coroutines. In particular, whenever a future is suspended while awaiting another future, the latter is given the special name `__awaitee`, and now the type of the awaited future will be printed, allowing identifying caller/callee — er, I mean, poller/pollee — relationships.

It would be possible to include the type name in more cases, but I thought that that might be overly verbose (`print-type-sizes` is already a lot of text) and ordinary named fields or variables are easier for readers to discover the types of.

This change will also synergize with my other PR #122923 which changes type printing to print the path of the `async fn` instead of the span.

Implementation note: I'm not sure if `Symbol::intern` is appropriate for this application, but it was the obvious way to not have to remove the `Copy` implementation from `FieldInfo`, or add a `'tcx` lifetime, while avoiding keeping a lot of possibly redundant strings in memory. I don't know what the proper tradeoff to make here is (though presumably it is not too important for a `-Z` debugging option).
2024-03-23 15:00:20 +01:00
Matthias Krüger
f03326c579
Rollup merge of #122915 - fmease:lt-opaq-mismatch-delay-bug, r=compiler-errors
Delay a bug if no RPITITs were found

Fixes #122655. See the issue for context.

r? compiler-errors or compiler
2024-03-23 15:00:18 +01:00
bors
d6eb0f5a09 Auto merge of #122582 - scottmcm:swap-intrinsic-v2, r=oli-obk
Let codegen decide when to `mem::swap` with immediates

Making `libcore` decide this is silly; the backend has so much better information about when it's a good idea.

Thus this PR introduces a new `typed_swap` intrinsic with a fallback body, and replaces that fallback implementation when swapping immediates or scalar pairs.

r? oli-obk

Replaces #111744, and means we'll never need more libs PRs like #111803 or #107140
2024-03-23 13:57:55 +00:00
Ralf Jung
67b9d7d184 rename ptr::from_exposed_addr -> ptr::with_exposed_provenance 2024-03-23 13:18:33 +01:00
Matthias Krüger
368bfb2c10 add test for #107228
Fixes #107228
2024-03-23 13:05:22 +01:00
Matthias Krüger
f2bc9c5997 add test for #106874 ICE BoundUniversalRegionError
Fixes #106874
2024-03-23 12:50:21 +01:00
Matthias Krüger
cc422cee97 add test for ICE #106444
Fixes #106444
2024-03-23 12:38:50 +01:00
Matthias Krüger
f8aeac8a36 add test for #106423
Fixes #106423
2024-03-23 12:32:32 +01:00
Matthias Krüger
f1f287fadb add test for ICE "raw ptr comparison should already be caught in the trait system" #105047
Fixes #105047
2024-03-23 12:24:40 +01:00
Matthias Krüger
e54bff7109 add test for #104779 opaque types, patterns and subtyping ICE: IndexMap: key not found
Fixes #104779
2024-03-23 12:19:05 +01:00
Matthias Krüger
2f9a240b91 add test for opaque type with non-universal region substs #101852
Fixes #101852
2024-03-23 12:01:39 +01:00
Matthias Krüger
12e362989b add test for #99945
Fixes #99945
2024-03-23 11:57:26 +01:00
Ralf Jung
fc257fae3c add panic location to 'panicked while processing panic' 2024-03-23 09:44:04 +01:00
Gurinder Singh
4afce46231 Change an ICE regression test to use the original reproducer
This gives us more confidence that the ICE was indeed fixed.
2024-03-23 11:22:17 +05:30
Kevin Reid
44d185b0d0 -Zprint-type-sizes: print the types of awaitees and unnamed coroutine locals.
This should assist comprehending the size of coroutines.
In particular, whenever a future is suspended while awaiting another
future, the latter is given the special name `__awaitee`, and now the
type of the awaited future will be printed, allowing identifying
caller/callee — er, I mean, poller/pollee — relationships.

It would be possible to include the type name in more cases, but I
thought that that might be overly verbose (`print-type-sizes` is already
a lot of text) and ordinary named fields or variables are easier for
readers to discover the types of.
2024-03-22 18:07:15 -07:00
Michael Goulet
08235b1603 Validate that we're only matching on unit struct for path pattern 2024-03-22 20:53:42 -04:00
bors
c308726599 Auto merge of #119552 - krtab:dead_code_priv_mod_pub_field, r=cjgillot,saethlin
Replace visibility test with reachability test in dead code detection

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

Also included is a fix for an error now flagged by the lint
2024-03-23 00:37:05 +00:00
León Orell Valerian Liehr
3879acbec0
Suggest assoc ty bound on lifetime in eq constraint 2024-03-23 00:17:30 +01:00
León Orell Valerian Liehr
22b9e960d9
Suggest assoc ty bound on bare dyn trait in eq constraint 2024-03-23 00:17:30 +01:00
Matthew Maurer
dec36c3d6e CFI: Support self_cell-like recursion
Current `transform_ty` attempts to avoid cycles when normalizing
`#[repr(transparent)]` types to their interior, but runs afoul of this
pattern used in `self_cell`:

```
struct X<T> {
  x: u8,
  p: PhantomData<T>,
}

 #[repr(transparent)]
struct Y(X<Y>);
```

When attempting to normalize Y, it will still cycle indefinitely. By
using a types-visited list, this will instead get expanded exactly
one layer deep to X<Y>, and then stop, not attempting to normalize `Y`
any further.
2024-03-22 23:02:05 +00:00
León Orell Valerian Liehr
807bd98971
Delay a bug if no RPITITs were found 2024-03-22 22:56:28 +01:00
Michael Goulet
5333f2a9d1 Move check for error in impl header outside of reporting 2024-03-22 17:46:40 -04:00
Michael Goulet
1fcf2eaa9f Uniquify ReError on input mode in canonicalizer 2024-03-22 16:35:50 -04:00
Jacob Pratt
fbf21c5763
Remove RustcEncodable/Decodable from 2024 prelude 2024-03-22 13:30:48 -07:00
Matthias Krüger
487933889b
Rollup merge of #122888 - matthiaskrgr:evenmoretests, r=compiler-errors
add a couple more tests
2024-03-22 20:31:31 +01:00
Matthias Krüger
4e594572b4
Rollup merge of #122651 - kornelski:flat-turbofish, r=spastorino,compiler-errors
Suggest `_` for missing generic arguments in turbofish

The compiler may suggest unusable generic type names for missing generic arguments in an expression context:

```rust
fn main() {
    (0..1).collect::<Vec>()
}
```

> help: add missing generic argument
>
>      (0..1).collect::<Vec<T>>()

but `T` is not a valid name in this context, and this suggestion won't compile.

I've changed it to use `_` inside method calls (turbofish), so it will suggest `(0..1).collect::<Vec<_>>()` which _may_ compile.

It's possible that the suggested `_` will be ambiguous, but there is very extensive E0283 that will help resolve that, which is more helpful than a basic "cannot find type `T` in this scope" users would get otherwise.

Out of caution to limit scope of the change I've limited it to just turbofish, but I suspect `_` could be the better choice in more cases. Perhaps in all expressions?
2024-03-22 20:31:29 +01:00
Matthias Krüger
aa184c558f
Rollup merge of #122195 - jieyouxu:impl-return-note, r=fmease
Note that the caller chooses a type for type param

```
error[E0308]: mismatched types
  --> $DIR/return-impl-trait.rs:23:5
   |
LL | fn other_bounds<T>() -> T
   |                 -       -
   |                 |       |
   |                 |       expected `T` because of return type
   |                 |       help: consider using an impl return type: `impl Trait`
   |                 expected this type parameter
...
LL |     ()
   |     ^^ expected type parameter `T`, found `()`
   |
   = note: expected type parameter `T`
                   found unit type `()`
   = note: the caller chooses the type of T which can be different from ()
```

Tried to see if "expected this type parameter" can be replaced, but that goes all the way to `rustc_infer` so seems not worth the effort and can affect other diagnostics.

Revives #112088 and #104755.
2024-03-22 20:31:28 +01:00
Matthias Krüger
104c4bc808
Rollup merge of #114009 - dvdhrm:pr/transmzst, r=pnkfelix
compiler: allow transmute of ZST arrays with generics

Extend the `SizeSkeleton` evaluator to shortcut zero-sized arrays, thus considering `[T; 0]` to have a compile-time fixed-size of 0.

The existing evaluator already deals with generic arrays under the feature-guard `transmute_const_generics`. However, it merely allows comparing fixed-size types with fixed-size types, and generic types with generic types. For generic types, it merely compares whether their arguments match (ordering them first). Even if their exact sizes are not known at compile time, it can ensure that they will eventually be the same.

This patch extends this by shortcutting the size-evaluation of zero sized arrays and thus allowing size comparisons of `()` with `[T; 0]`, where one contains generics and the other does not.

This code is guarded by `transmute_const_generics` (#109929), even though it is unclear whether it should be. However, this assumes that a separate stabilization PR is required to move this out of the feature guard.

Initially reported in #98104.
2024-03-22 20:31:28 +01:00
Scott McMurray
d0ce391b14 swap_simple no longer needs to be a separate function 2024-03-22 11:55:17 -07:00
Michael Goulet
3361488681 Always encode implied_predicates query for traits
With associated type bounds enabled, the implied_predicates and super_predicates
queries may differ for traits, since associated type bounds are also
implied but are not counted as super predicates.
2024-03-22 13:20:54 -04:00
Michael Goulet
c855bf62d7 Add a test 2024-03-22 13:20:54 -04:00
Matthias Krüger
2171243b2b add test for #105210 assertion failure self.lines.iter().all(|r| !r.iter().any(|sc| sc.chr == \'\\t\')) with edition 2021
Fixes #105210
2024-03-22 17:25:57 +01:00
Matthias Krüger
5b5dec338d add test for #97725
Fixes #97725
2024-03-22 17:12:43 +01:00
Michael Baikov
b84326ec9c tests/ui: Add a directory for warnings, add a test 2024-03-22 11:27:34 -04:00
Michael Baikov
bf12aa49e7 Don't emit an error about failing to produce a file with a specific name
If user never gave an explicit name
2024-03-22 10:59:13 -04:00
Bryanskiy
d1ba632f4f Delegation: fix ICE on bound_vars divergence 2024-03-22 17:24:41 +03:00
bors
1447f9d38c Auto merge of #122869 - matthiaskrgr:rollup-0navj4l, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #121619 (Experimental feature postfix match)
 - #122370 (Gracefully handle `AnonConst` in `diagnostic_hir_wf_check()`)
 - #122537 (interpret/allocation: fix aliasing issue in interpreter and refactor getters a bit)
 - #122542 (coverage: Clean up marker statements that aren't needed later)
 - #122800 (Add `NonNull::<[T]>::is_empty`.)
 - #122820 (Stop using `<DefId as Ord>` in various diagnostic situations)
 - #122847 (Suggest `RUST_MIN_STACK` workaround on overflow)
 - #122855 (Fix Itanium mangling usizes)
 - #122863 (add more ice tests )

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-22 12:29:42 +00:00
Matthias Krüger
a5de4fb2a5
Rollup merge of #122863 - matthiaskrgr:teest, r=lcnr
add more ice tests

fixes #119275
fixes #113017
fixes #112824
fixes #112823
fixes #121472
fixes #110696
2024-03-22 11:37:03 +01:00
Matthias Krüger
7481c0eab5
Rollup merge of #122820 - oli-obk:no_ord_def_id, r=estebank
Stop using `<DefId as Ord>` in various diagnostic situations

work towards https://github.com/rust-lang/rust/issues/90317

Reverts part of https://github.com/rust-lang/rust/pull/106281, as it sorts constants and that's problematic since it can contain `ParamConst`, which contains `DefId`s
2024-03-22 11:37:01 +01:00
Matthias Krüger
f5ac009a27
Rollup merge of #122370 - gurry:122199-ice-unexpected-node, r=davidtwco
Gracefully handle `AnonConst` in `diagnostic_hir_wf_check()`

Instead of running the WF check on the `AnonConst` itself we run it on the `ty` of the generic param of which the `AnonConst` is the default value.

Fixes #122199
2024-03-22 11:36:59 +01:00
Matthias Krüger
783778c631
Rollup merge of #121619 - RossSmyth:pfix_match, r=petrochenkov
Experimental feature postfix match

This has a basic experimental implementation for the RFC postfix match (rust-lang/rfcs#3295, #121618). [Liaison is](https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Postfix.20Match.20Liaison/near/423301844) ```@scottmcm``` with the lang team's [experimental feature gate process](https://github.com/rust-lang/lang-team/blob/master/src/how_to/experiment.md).

This feature has had an RFC for a while, and there has been discussion on it for a while. It would probably be valuable to see it out in the field rather than continue discussing it. This feature also allows to see how popular postfix expressions like this are for the postfix macros RFC, as those will take more time to implement.

It is entirely implemented in the parser, so it should be relatively easy to remove if needed.

This PR is split in to 5 commits to ease review.

1. The implementation of the feature & gating.
2. Add a MatchKind field, fix uses, fix pretty.
3. Basic rustfmt impl, as rustfmt crashes upon seeing this syntax without a fix.
4. Add new MatchSource to HIR for Clippy & other HIR consumers
2024-03-22 11:36:58 +01:00
Matthias Krüger
e68cb00fb2 address review comments 2024-03-22 11:35:31 +01:00
bors
eff958c59e Auto merge of #120926 - fmease:astconv-no-mo, r=oli-obk
[MCP 723] Rename `astconv::AstConv` and related items

See rust-lang/compiler-team#723.
Corresponding rustc-dev-guide PR: rust-lang/rustc-dev-guide#1916.

Please consult the following *normative* list of changes here:
https://fmease.dev/rustc-dev/astconv-no-mo.html ([2024-03-22 archive link](https://web.archive.org/web/20240322054711/https://fmease.dev/rustc-dev/astconv-no-mo.html)).
2024-03-22 10:28:39 +00:00
bors
eb80be223f Auto merge of #122824 - oli-obk:no_ord_def_id2, r=estebank,michaelwoerister
Stop sorting via `DefId`s in region resolution

hopefully maintains the perf improvement from https://github.com/rust-lang/rust/pull/118824

works towards https://github.com/rust-lang/rust/issues/90317
2024-03-22 08:10:40 +00:00
Matthias Krüger
bd2d70dd0a add test for ice #119275 "no entry found for key" in predicates_of.rs
fixes #119275
2024-03-22 08:45:03 +01:00
Matthias Krüger
b0e10083f3 add test for ice #113017 no entry found for key in generics_of.rs
Fixes #113017
2024-03-22 08:38:26 +01:00
Matthias Krüger
d7e166d408 add test for ice "type mismatching when copying!"
Fixes #112824
2024-03-22 08:31:01 +01:00
Matthias Krüger
2b5740371c add test for https://github.com/rust-lang/rust/issues/112823
Fixes #112823
2024-03-22 08:27:14 +01:00
Matthias Krüger
4d9ce7a1a2 add test for ice #121472
Fixes #121472
2024-03-22 08:19:44 +01:00
Matthias Krüger
1bcbed19d1 add test for #110696
Fixes #110696
2024-03-22 08:13:54 +01:00
bors
7762adccb2 Auto merge of #122456 - maurer:cfi-nonpassed, r=workingjubilee
CFI: Skip non-passed arguments

Rust will occasionally rely on fn((), X) -> Y being compatible with fn(X) -> Y, since () is a non-passed argument. Relax CFI by choosing not to encode non-passed arguments.

This PR was split off from #121962 as part of fixing the larger vtable compatibility issues.

r? `@workingjubilee`
2024-03-22 06:09:40 +00:00
León Orell Valerian Liehr
82c2c8deb1
Update (doc) comments
Several (doc) comments were super outdated or didn't provide enough context.

Some doc comments shoved everything in a single paragraph without respecting
the fact that the first paragraph should be a single sentence because rustdoc
treats these as item descriptions / synopses on module pages.
2024-03-22 06:31:51 +01:00
Matthias Krüger
e647543cda
Rollup merge of #122844 - matthiaskrgr:just_one_more_test_mom, r=compiler-errors
add test for ice "cannot relate region: LUB(ReErased, ReError)"

Fixes #109178
2024-03-22 01:07:34 +01:00
Matthias Krüger
ce63d7ae43
Rollup merge of #122841 - matthiaskrgr:moretests, r=wesleywiser
add 2 more tests for issues fixed by #122749

 Fixes #121807
 Fixes #122098
2024-03-22 01:07:33 +01:00
Matthias Krüger
c48c35f23c
Rollup merge of #122837 - matthiaskrgr:fix_122549, r=petrochenkov
add test for #122549

Fixes #122549
2024-03-22 01:07:32 +01:00
Matthias Krüger
1757cb5871
Rollup merge of #122829 - ShoyuVanilla:gen-block-impl-fused-iter, r=compiler-errors
Implement `FusedIterator` for `gen` block

cc #117078
2024-03-22 01:07:31 +01:00
Matthias Krüger
08ac38b661
Rollup merge of #122826 - compiler-errors:associated-type-bound-tests, r=lcnr
Add tests for shortcomings of associated type bounds

Adds the test in https://github.com/rust-lang/rust/pull/122791#issuecomment-2011433015

Turns out that #121123 is what breaks `tests/ui/associated-type-bounds/cant-see-copy-bound-from-child-rigid.rs` (passes on nightly), but given that associated type bounds haven't landed anywhere yet, I'm happy with breaking it.

This is unrelated to #122791, which just needed that original commit e6b64c6194 stacked on top of it so that it wouldn't have tests failing.

r? lcnr
2024-03-22 01:07:31 +01:00
Matthew Maurer
f2f0d255df CFI: Skip non-passed arguments
Rust will occasionally rely on fn((), X) -> Y being compatible with
fn(X) -> Y, since () is a non-passed argument. Relax CFI by choosing not
to encode non-passed arguments.
2024-03-21 22:26:26 +00:00
Matthias Krüger
847311e36f add test for ice "cannot relate region: LUB(ReErased, ReError)"
Fixes #109178
2024-03-21 22:02:32 +01:00
Matthias Krüger
bdafec33d5 add test for #121807
Fixes #121807
2024-03-21 21:27:37 +01:00
Matthias Krüger
35a78459aa add test for https://github.com/rust-lang/rust/issues/122098 ICE: index out of bounds, snapshot_vec.rs
Fixes #122098
2024-03-21 20:57:54 +01:00
Matthias Krüger
daa65539ce add test for #122549
Fixes #122549
2024-03-21 20:36:13 +01:00
Shoyu Vanilla
ae4c5c891e Implement FusedIterator for gen block 2024-03-22 02:02:34 +09:00
Matthias Krüger
9cd11c4335
Rollup merge of #122793 - compiler-errors:deref-pat-syntax, r=Nadrieril
Implement macro-based deref!() syntax for deref patterns

Stop using `box PAT` syntax for deref patterns, and instead use a perma-unstable macro.

Blocked on #122222

r? `@Nadrieril`
2024-03-21 17:46:50 +01:00
Matthias Krüger
8b132109c4
Rollup merge of #122752 - nnethercote:Interpolated-cleanups, r=petrochenkov
Interpolated cleanups

Various cleanups I made while working on attempts to remove `Interpolated`, that are worth merging now. Best reviewed one commit at a time.

r? `@petrochenkov`
2024-03-21 17:46:49 +01:00
Matthias Krüger
40c972e335
Rollup merge of #122733 - oli-obk:error_prop, r=compiler-errors
Strip placeholders from hidden types before remapping generic parameter

When remapping generic parameters in the hidden type to the generic parameters of the definition of the opaque, we assume that placeholders cannot exist. Instead of just patching that site, I decided to handle it earlier, directly in `infer_opaque_types`, where we are already doing all the careful lifetime handling.

fixes #122694

the reason that ICE now occurred was that we stopped treating `operation` as being in the defining scope, so the TAIT became part of the hidden type of the `async fn`'s opaque type instead of just bailing out as ambiguos

I think

```rust
use std::future::Future;

mod foo {
    type FutNothing<'a> = impl 'a + Future<Output = ()>;
    //~^ ERROR: unconstrained opaque type
}

async fn operation(_: &mut ()) -> () {
    //~^ ERROR: concrete type differs from previous
    call(operation).await
    //~^ ERROR: concrete type differs from previous
}

async fn call<F>(_f: F)
where
    for<'any> F: FnMut(&'any mut ()) -> foo::FutNothing<'any>,
{
    //~^ ERROR: expected generic lifetime parameter, found `'any`
}
```

would have already had the same ICE before https://github.com/rust-lang/rust/pull/121796
2024-03-21 17:46:49 +01:00
Matthias Krüger
2e41425de6
Rollup merge of #122402 - weiznich:fix/122391, r=compiler-errors
Make `#[diagnostic::on_unimplemented]` format string parsing more robust

This commit fixes several issues with the format string parsing of the `#[diagnostic::on_unimplemented]` attribute that were pointed out by `@ehuss.`
In detail it fixes:

* Appearing format specifiers (display, etc). For these we generate a warning that the specifier is unsupported. Otherwise we ignore them
* Positional arguments. For these we generate a warning that positional arguments are unsupported in that location and replace them with the format string equivalent (so `{}` or `{n}` where n is the index of the positional argument)
* Broken format strings with enclosed }. For these we generate a warning about the broken format string and set the emitted message literally to the provided unformatted string
* Unknown format specifiers. For these we generate an additional warning about the unknown specifier. Otherwise we emit the literal string as message.

This essentially makes those strings behave like `format!` with the minor difference that we do not generate hard errors but only warnings. After that we continue trying to do something unsuprising (mostly either ignoring the broken parts or falling back to just giving back the literal string as provided).

Fix #122391

r? `@compiler-errors`
2024-03-21 17:46:48 +01:00
Oli Scherer
208582f3fe Stop sorting via DefIds in region resolution 2024-03-21 16:36:17 +00:00
Michael Goulet
a4db3ffdcb Don't suggest deref macro since it's unstable 2024-03-21 11:42:49 -04:00
Michael Goulet
2d633317f3 Implement macro-based deref!() syntax for deref patterns
Stop using `box PAT` syntax for deref patterns, as it's misleading and
also causes their semantics being tangled up.
2024-03-21 11:42:49 -04:00
Michael Goulet
8ca7aac3eb Add tests for shortcomings of associated type bounds 2024-03-21 10:34:53 -04:00
lilasta
d324d6de0e Stabilize const_caller_location and const_location_fields 2024-03-21 22:19:57 +09:00
Matthias Krüger
62e414d3af
Rollup merge of #122806 - compiler-errors:type-ascribe, r=fmease
Make `type_ascribe!` not a built-in

The only weird thing is the macro expansion note. I wonder if we should suppress these 🤔

r? ````@fmease```` since you told me about builtin# lol
2024-03-21 12:05:09 +01:00
Matthias Krüger
3331d0d1e7
Rollup merge of #122801 - celinval:smir-pretty, r=compiler-errors
Fix misc printing issues in emit=stable_mir

Trying to continue the work that ````@ouz-a```` started here: https://github.com/rust-lang/rust/pull/118364

Few modifications beyond fixes:
1. I made the `pretty_*` functions private.
2. I added a function to print the instance body
3. Changed a bunch of signatures to write to the writer directly.
4. Added a function to translate the place to its internal representation, so we could use the internal debug implementation.
5. Also removed `pretty_ty`, replaced by Display implementation of Ty which uses the internal display.
2024-03-21 12:05:08 +01:00
Matthias Krüger
300d3fb2fd
Rollup merge of #122799 - estebank:issue-122569, r=fee1-dead
Replace closures with `_` when suggesting fully qualified path for method call

```
error[E0283]: type annotations needed
  --> $DIR/into-inference-needs-type.rs:12:10
   |
LL |         .into()?;
   |          ^^^^
   |
   = note: cannot satisfy `_: From<...>`
   = note: required for `FilterMap<...>` to implement `Into<_>`
help: try using a fully qualified path to specify the expected types
   |
LL ~     let list = <FilterMap<Map<std::slice::Iter<'_, &str>, _>, _> as Into<T>>::into(vec
LL |         .iter()
LL |         .map(|s| s.strip_prefix("t"))
LL ~         .filter_map(Option::Some))?;
   |
```

Fix #122569.
2024-03-21 12:05:08 +01:00
Matthias Krüger
e78522fd00
Rollup merge of #122358 - compiler-errors:bound-regions-in-generator, r=lcnr
Don't ICE when encountering bound regions in generator interior type

I'm pretty sure this meant to say "`has_free_regions`", probably just a typo in 4a4fc3bb5b. We can have bound regions (because we only convert non-bound regions into existential regions in generator interiors), but we can't have (non-ReErased) free regions.

r? lcnr
2024-03-21 12:05:05 +01:00
Matthias Krüger
0867025cc8
Rollup merge of #122222 - Nadrieril:deref-pat-feature-gate, r=compiler-errors
deref patterns: bare-bones feature gate and typechecking

I am restarting the deref patterns experimentation. This introduces a feature gate under the lang-team [experimental feature](https://github.com/rust-lang/lang-team/blob/master/src/how_to/experiment.md) process, with [````@cramertj```` as lang-team liaison](https://github.com/rust-lang/lang-team/issues/88) (it's been a while though, you still ok with this ````@cramertj?).```` Tracking issue: https://github.com/rust-lang/rust/issues/87121.

This is the barest-bones implementation I could think of:
- explicit syntax, reusing `box <pat>` because that saves me a ton of work;
- use `Deref` as a marker trait (instead of a yet-to-design `DerefPure`);
- no support for mutable patterns with `DerefMut` for now;
- MIR lowering will come in the next PR. It's the trickiest part.

My goal is to let us figure out the MIR lowering part, which might take some work. And hopefully get something working for std types soon.

This is in large part salvaged from ````@fee1-dead's```` https://github.com/rust-lang/rust/pull/119467.

r? ````@compiler-errors````
2024-03-21 12:05:05 +01:00
Oli Scherer
d8470bb00b Sorting arbitrary constants should not be done, as it relies on DefId ordering, which breaks incremental compilation. 2024-03-21 10:45:30 +00:00
Oli Scherer
cda209bf43 Stop ConstraintCategory Ord impl from relying on Ty's Ord impl. 2024-03-21 10:45:30 +00:00
bors
df8ac8f1d7 Auto merge of #122568 - RalfJung:mentioned-items, r=oli-obk
recursively evaluate the constants in everything that is 'mentioned'

This is another attempt at fixing https://github.com/rust-lang/rust/issues/107503. The previous attempt at https://github.com/rust-lang/rust/pull/112879 seems stuck in figuring out where the [perf regression](https://perf.rust-lang.org/compare.html?start=c55d1ee8d4e3162187214692229a63c2cc5e0f31&end=ec8de1ebe0d698b109beeaaac83e60f4ef8bb7d1&stat=instructions:u) comes from. In  https://github.com/rust-lang/rust/pull/122258 I learned some things, which informed the approach this PR is taking.

Quoting from the new collector docs, which explain the high-level idea:
```rust
//! One important role of collection is to evaluate all constants that are used by all the items
//! which are being collected. Codegen can then rely on only encountering constants that evaluate
//! successfully, and if a constant fails to evaluate, the collector has much better context to be
//! able to show where this constant comes up.
//!
//! However, the exact set of "used" items (collected as described above), and therefore the exact
//! set of used constants, can depend on optimizations. Optimizing away dead code may optimize away
//! a function call that uses a failing constant, so an unoptimized build may fail where an
//! optimized build succeeds. This is undesirable.
//!
//! To fix this, the collector has the concept of "mentioned" items. Some time during the MIR
//! pipeline, before any optimization-level-dependent optimizations, we compute a list of all items
//! that syntactically appear in the code. These are considered "mentioned", and even if they are in
//! dead code and get optimized away (which makes them no longer "used"), they are still
//! "mentioned". For every used item, the collector ensures that all mentioned items, recursively,
//! do not use a failing constant. This is reflected via the [`CollectionMode`], which determines
//! whether we are visiting a used item or merely a mentioned item.
//!
//! The collector and "mentioned items" gathering (which lives in `rustc_mir_transform::mentioned_items`)
//! need to stay in sync in the following sense:
//!
//! - For every item that the collector gather that could eventually lead to build failure (most
//!   likely due to containing a constant that fails to evaluate), a corresponding mentioned item
//!   must be added. This should use the exact same strategy as the ecollector to make sure they are
//!   in sync. However, while the collector works on monomorphized types, mentioned items are
//!   collected on generic MIR -- so any time the collector checks for a particular type (such as
//!   `ty::FnDef`), we have to just onconditionally add this as a mentioned item.
//! - In `visit_mentioned_item`, we then do with that mentioned item exactly what the collector
//!   would have done during regular MIR visiting. Basically you can think of the collector having
//!   two stages, a pre-monomorphization stage and a post-monomorphization stage (usually quite
//!   literally separated by a call to `self.monomorphize`); the pre-monomorphizationn stage is
//!   duplicated in mentioned items gathering and the post-monomorphization stage is duplicated in
//!   `visit_mentioned_item`.
//! - Finally, as a performance optimization, the collector should fill `used_mentioned_item` during
//!   its MIR traversal with exactly what mentioned item gathering would have added in the same
//!   situation. This detects mentioned items that have *not* been optimized away and hence don't
//!   need a dedicated traversal.

enum CollectionMode {
    /// Collect items that are used, i.e., actually needed for codegen.
    ///
    /// Which items are used can depend on optimization levels, as MIR optimizations can remove
    /// uses.
    UsedItems,
    /// Collect items that are mentioned. The goal of this mode is that it is independent of
    /// optimizations: the set of "mentioned" items is computed before optimizations are run.
    ///
    /// The exact contents of this set are *not* a stable guarantee. (For instance, it is currently
    /// computed after drop-elaboration. If we ever do some optimizations even in debug builds, we
    /// might decide to run them before computing mentioned items.) The key property of this set is
    /// that it is optimization-independent.
    MentionedItems,
}
```
And the `mentioned_items` MIR body field docs:
```rust
    /// Further items that were mentioned in this function and hence *may* become monomorphized,
    /// depending on optimizations. We use this to avoid optimization-dependent compile errors: the
    /// collector recursively traverses all "mentioned" items and evaluates all their
    /// `required_consts`.
    ///
    /// This is *not* soundness-critical and the contents of this list are *not* a stable guarantee.
    /// All that's relevant is that this set is optimization-level-independent, and that it includes
    /// everything that the collector would consider "used". (For example, we currently compute this
    /// set after drop elaboration, so some drop calls that can never be reached are not considered
    /// "mentioned".) See the documentation of `CollectionMode` in
    /// `compiler/rustc_monomorphize/src/collector.rs` for more context.
    pub mentioned_items: Vec<Spanned<MentionedItem<'tcx>>>,
```

Fixes #107503
2024-03-21 09:01:18 +00:00
Oli Scherer
6623bdf68b Strip placeholders from hidden types before remapping generic parameter in the hidden type to the generic parameters of the definition of the opaque 2024-03-21 08:17:12 +00:00
Ralf Jung
8c01b85dba make sure we don't inline these generic fn as that could monomorphize them 2024-03-21 09:05:47 +01:00
Georg Semmler
5568c569c0
Make #[diagnostic::on_unimplemented] format string parsing more robust
This commit fixes several issues with the format string parsing of the
`#[diagnostic::on_unimplemented]` attribute that were pointed out by
@ehuss.
In detail it fixes:

* Appearing format specifiers (display, etc). For these we generate a
warning that the specifier is unsupported. Otherwise we ignore them
* Positional arguments. For these we generate a warning that positional
arguments are unsupported in that location and replace them with the
format string equivalent (so `{}` or `{n}` where n is the index of the
positional argument)
* Broken format strings with enclosed }. For these we generate a warning
about the broken format string and set the emitted message literally to
the provided unformatted string
* Unknown format specifiers. For these we generate an additional warning
about the unknown specifier. Otherwise we emit the literal string as
message.

This essentially makes those strings behave like `format!` with the
minor difference that we do not generate hard errors but only warnings.
After that we continue trying to do something unsuprising (mostly either
ignoring the broken parts or falling back to just giving back the
literal string as provided).

Fix #122391
2024-03-21 08:27:26 +01:00
bors
47dd709bed Auto merge of #121123 - compiler-errors:item-assumptions, r=oli-obk
Split an item bounds and an item's super predicates

This is the moral equivalent of #107614, but instead for predicates this applies to **item bounds**. This PR splits out the item bounds (i.e. *all* predicates that are assumed to hold for the alias) from the item *super predicates*, which are the subset of item bounds which share the same self type as the alias.

## Why?

Much like #107614, there are places in the compiler where we *only* care about super-predicates, and considering predicates that possibly don't have anything to do with the alias is problematic. This includes things like closure signature inference (which is at its core searching for `Self: Fn(..)` style bounds), but also lints like `#[must_use]`, error reporting for aliases, computing type outlives predicates.

Even in cases where considering all of the `item_bounds` doesn't lead to bugs, unnecessarily considering irrelevant bounds does lead to a regression (#121121) due to doing extra work in the solver.

## Example 1 - Trait Aliases

This is best explored via an example:

```
type TAIT<T> = impl TraitAlias<T>;

trait TraitAlias<T> = A + B where T: C;
```

The item bounds list for `Tait<T>` will include:
* `Tait<T>: A`
* `Tait<T>: B`
* `T: C`

While `item_super_predicates` query will include just the first two predicates.

Side-note: You may wonder why `T: C` is included in the item bounds for `TAIT`? This is because when we elaborate `TraitAlias<T>`, we will also elaborate all the predicates on the trait.

## Example 2 - Associated Type Bounds

```
type TAIT<T> = impl Iterator<Item: A>;
```

The `item_bounds` list for `TAIT<T>` will include:
* `Tait<T>: Iterator`
* `<Tait<T> as Iterator>::Item: A`

But the `item_super_predicates` will just include the first bound, since that's the only bound that is relevant to the *alias* itself.

## So what

This leads to some diagnostics duplication just like #107614, but none of it will be user-facing. We only see it in the UI test suite because we explicitly disable diagnostic deduplication.

Regarding naming, I went with `super_predicates` kind of arbitrarily; this can easily be changed, but I'd consider better names as long as we don't block this PR in perpetuity.
2024-03-21 06:12:24 +00:00
bors
6e1f7b538a Auto merge of #121587 - ShoyuVanilla:fix-issue-121267, r=TaKO8Ki
Fix bad span for explicit lifetime suggestions

Fixes #121267

Current explicit lifetime suggestions are not showing correct spans for some lifetimes - e.g. elided lifetime generic parameters;

This should be done correctly regarding elided lifetime kind like the following code

43fdd4916d/compiler/rustc_resolve/src/late/diagnostics.rs (L3015-L3044)
2024-03-21 04:11:09 +00:00
Michael Goulet
a015b90953 Make type_ascribe! not a built-in 2024-03-20 22:28:56 -04:00
Shoyu Vanilla
c270a42fea Fix bad span for explicit lifetime suggestion
Move verbose logic to a function

Minor renaming
2024-03-21 10:31:04 +09:00
Jacob Pratt
4e792df4ed
Rollup merge of #122749 - aliemjay:region-err, r=compiler-errors
make `type_flags(ReError) & HAS_ERROR`

Self-explanatory. `TypeVisitableExt::references_error(ReError)` incorrectly returned `false`.
2024-03-20 20:29:45 -04:00
Esteban Küber
5fae665924 Replace closures with _ when suggesting fully qualified path for method call
```
error[E0283]: type annotations needed
  --> $DIR/into-inference-needs-type.rs:12:10
   |
LL |         .into()?;
   |          ^^^^
   |
   = note: cannot satisfy `_: From<...>`
   = note: required for `FilterMap<...>` to implement `Into<_>`
help: try using a fully qualified path to specify the expected types
   |
LL ~     let list = <FilterMap<Map<std::slice::Iter<'_, &str>, _>, _> as Into<T>>::into(vec
LL |         .iter()
LL |         .map(|s| s.strip_prefix("t"))
LL ~         .filter_map(Option::Some))?;
   |
```

Fix #122569.
2024-03-21 00:07:44 +00:00
Esteban Küber
6b24fdf811 Provide structured suggestion for unconstrained generic constant
```
error: unconstrained generic constant
  --> $DIR/const-argument-if-length.rs:18:10
   |
LL |     pad: [u8; is_zst::<T>()],
   |          ^^^^^^^^^^^^^^^^^^^
   |
help: try adding a `where` bound
   |
LL | pub struct AtLeastByte<T: ?Sized> where [(); is_zst::<T>()]: {
   |                                   ++++++++++++++++++++++++++
```

Detect when the constant expression isn't `usize` and suggest casting:

```
error: unconstrained generic constant
 --> f300.rs:6:10
  |
6 |     bb::<{!N}>();
  |          ^^^^
-Ztrack-diagnostics: created at compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs:3539:36
  |
help: try adding a `where` bound
  |
5 | fn b<const N: bool>() where [(); {!N} as usize]: {
  |                       ++++++++++++++++++++++++++
```

Fix #122395.
2024-03-21 00:03:59 +00:00
Veera
afc99cc976 Update test for aarch64 2024-03-20 19:38:36 -04:00
Nicholas Nethercote
8ac16c6193 Rewrite parse_meta_item.
It can't use `maybe_whole`, but it can match `maybe_whole` more closely.

Also add a test for a case that wasn't previously covered.
2024-03-21 10:16:09 +11:00