Commit Graph

25758 Commits

Author SHA1 Message Date
bors
75726cae37 Auto merge of #112629 - compiler-errors:atb-imply, r=jackh726
Make associated type bounds in supertrait position implied

`trait A: B<Assoc: C> {}` should be able to imply both `Self: B` and `<Self as B>::Assoc: C`. Adjust the way that we collect implied predicates to do so.

Fixes #112573
Fixes #112568
2023-06-28 23:58:28 +00:00
bors
5bd28f5eac Auto merge of #98867 - cjgillot:metaloop, r=oli-obk
Refactor metadata emission to avoid visiting HIR

This PR refactors metadata emission to be based on tables and iteration over definitions.

In a first part, this PR moves information from the `EntryKind` enum to tables, until removing the `EntryKind` enum.
In a second part, the iteration scheme is refactored to avoid fetching HIR unless strictly necessary.

r? `@ghost`
2023-06-28 16:16:27 +00:00
Dylan DPC
e4e1a995dc
Rollup merge of #113019 - ericmarkmartin:warning-for-guard-non-exhaustion, r=fee1-dead
add note for non-exhaustive matches with guards

Associated issue: #92197

When a match statement includes guards on every match arm (and is therefore necessarily non-exhaustive), add a note to the error E0004 diagnostic noting this.
2023-06-28 18:28:47 +05:30
Dylan DPC
fc2c587cd0
Rollup merge of #112867 - compiler-errors:more-impl-source-nits, r=lcnr
More `ImplSource` nits

Even more clean-ups, I'll put this up in parallel with the `select_in_new_trait_solver` PR.

r? ``@lcnr``
2023-06-28 18:28:47 +05:30
Dylan DPC
dabcbae535
Rollup merge of #112236 - cjgillot:interval-kill, r=davidtwco
Simplify computation of killed borrows

Follow-up to https://github.com/rust-lang/rust/pull/111759

Processing the first block manually once makes the pre-order walk simpler.
2023-06-28 18:28:46 +05:30
Dylan DPC
fa56e01b35
Rollup merge of #111571 - jhpratt:proc-macro-span, r=m-ou-se
Implement proposed API for `proc_macro_span`

As proposed in [#54725 (comment)](https://github.com/rust-lang/rust/issues/54725#issuecomment-1546918161). I have omitted the byte-level API as it's already available as [`Span::byte_range`](https://doc.rust-lang.org/nightly/proc_macro/struct.Span.html#method.byte_range).

`@rustbot` label +A-proc-macros

r? `@m-ou-se`
2023-06-28 18:28:46 +05:30
bors
8882507bc7 Auto merge of #112708 - flip1995:clippy-freezing-pc-with-ice, r=oli-obk
Avoid calling queries during query stack printing

This has the side effect, that when Clippy should ICE (during an EarlyPass?) it will fill up the RAM with 2 GB/s and then freezes my Laptop. This is blocking the Clippy sync and might give some people really bad experiences, so this should be merged ASAP.

r? `@cjgillot`
cc `@Zoxc`

I only commented this on [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/.60try_print_query_stack.60.20has.20.60ImplicitCtx.60.20during.20.60EarlyPass.60/near/363926180). I should've left a comment on the PR as well. My bad.
2023-06-28 09:40:07 +00:00
Oli Scherer
7c15779ff1 Rustdoc nit: refer to macro from docs 2023-06-28 07:07:16 +00:00
Eric Mark Martin
96bd056695 remove cruft 2023-06-28 01:55:32 -04:00
Eric Mark Martin
2017a176eb use translatable subdiagnostic 2023-06-28 01:51:53 -04:00
Eric Mark Martin
fbd1e0252f add note for non-exhaustive matches with guards 2023-06-28 01:51:53 -04:00
bors
08fd6f719e Auto merge of #111269 - clubby789:validate-fluent-variables, r=davidtwco
Validate fluent variable references in tests

Closes #101109

Under `cfg(test)`, the `fluent_messages` macro will emit a list of variables referenced by each message and its attributes. The derive attribute will now emit a `#[test]` that checks that each referenced variable exists in the structure it's applied to.
2023-06-28 03:47:02 +00:00
bors
bb95b7dcd6 Auto merge of #112307 - lcnr:operand-ref, r=compiler-errors
mir opt + codegen: handle subtyping

fixes #107205

the same issue was caused in multiple places:
- mir opts: both copy and destination propagation
- codegen: assigning operands to locals (which also propagates values)

I changed codegen to always update the type in the operands used for locals which should guard against any new occurrences of this bug going forward. I don't know how to make mir optimizations more resilient here. Hopefully the added tests will be enough to detect any trivially wrong optimizations going forward.
2023-06-28 00:41:37 +00:00
bors
6b46c996e1 Auto merge of #113105 - matthiaskrgr:rollup-rci0uym, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #112207 (Add trustzone and virtualization target features for aarch32.)
 - #112454 (Make compiletest aware of targets without dynamic linking)
 - #112628 (Allow comparing `Box`es with different allocators)
 - #112692 (Provide more context for `rustc +nightly -Zunstable-options` on stable)
 - #112972 (Make `UnwindAction::Continue` explicit in MIR dump)
 - #113020 (Add tests impl via obj unless denied)
 - #113084 (Simplify some conditions)
 - #113103 (Normalize types when applying uninhabited predicate.)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-06-27 21:31:47 +00:00
Matthias Krüger
4b1d0682a6
Rollup merge of #113103 - cjgillot:normalize-inhabited, r=compiler-errors
Normalize types when applying uninhabited predicate.

Fixes https://github.com/rust-lang/rust/issues/112997
2023-06-27 22:10:16 +02:00
Matthias Krüger
d505582ce2
Rollup merge of #113084 - WaffleLapkin:less_map_or, r=Nilstrieb
Simplify some conditions

r? `@Nilstrieb`

Some things taken out of my `is_none_or` pr.
2023-06-27 22:10:15 +02:00
Matthias Krüger
9ec676dd7f
Rollup merge of #112972 - nbdd0121:mir, r=davidtwco
Make `UnwindAction::Continue` explicit in MIR dump

Makes it easier to spot unwinding related issues in MIR by making `UnwindAction::Continue` explicit, just like all other `UnwindAction`s.
2023-06-27 22:10:14 +02:00
Matthias Krüger
b6144cd843
Rollup merge of #112692 - jieyouxu:better-err-msg-for-unstable-options, r=davidtwco
Provide more context for `rustc +nightly -Zunstable-options` on stable

<img width="724" alt="Screenshot 2023-06-16 123456" src="https://github.com/rust-lang/rust/assets/39484203/1933e172-cb9f-4e51-9540-ade803a88360">

Closes #110090.
2023-06-27 22:10:14 +02:00
Matthias Krüger
1880e83ae3
Rollup merge of #112207 - qwandor:virt_feature, r=davidtwco
Add trustzone and virtualization target features for aarch32.

These are LLVM target features which allow the `smc` and `hvc` instructions respectively to be used in inline assembly.
2023-06-27 22:10:12 +02:00
Michael Goulet
de0e7d32fd pass PredicateFilter to compute_bounds 2023-06-27 18:28:27 +00:00
Michael Goulet
858a861fff Make associated type bounds in supertrait position implied 2023-06-27 18:28:07 +00:00
bors
5ea6668646 Auto merge of #113102 - matthiaskrgr:rollup-wpkbsw1, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #112518 (Detect actual span for getting unexpected token from parsing macros)
 - #112978 (Add suggestion for bad block fragment error)
 - #113068 (bootstrap: rename 'user' profile to 'dist')
 - #113079 (Use `CoverageKind::as_operand_id` instead of manually reimplementing it)
 - #113089 (Export AnalysisResults trait in rustc_mir_dataflow)
 - #113093 (`thir`: Add `Become` expression kind)
 - #113096 (Remove unused struct and tweak format macro uses)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-06-27 17:54:24 +00:00
Camille GILLOT
6f3f878351 Normalize types when applying uninhabited predicate. 2023-06-27 17:10:14 +00:00
Camille GILLOT
0faea7728f Encode impls in encode_impls. 2023-06-27 16:50:34 +00:00
Camille GILLOT
845fcc1939 Use instrument macro. 2023-06-27 16:50:34 +00:00
Camille GILLOT
fd81e964b8 Retire encode_info_for_items. 2023-06-27 16:50:34 +00:00
Camille GILLOT
22df32264a Encode Impl separately. 2023-06-27 16:50:34 +00:00
Camille GILLOT
45a9a5460f Encode Trait info in def-id loop. 2023-06-27 16:50:34 +00:00
Camille GILLOT
1a9d34fd81 Merge assoc_item functions. 2023-06-27 16:50:34 +00:00
Camille GILLOT
3c790b3730 Encode fn_sig separately.
Closures do not have a `fn_sig`, so no reason to encode one.
2023-06-27 16:50:34 +00:00
Matthias Krüger
adc3ae24d6
Rollup merge of #113096 - TaKO8Ki:remove-unused-struct, r=oli-obk
Remove unused struct and tweak format macro uses

This pul request removes an unused struct and tweaks `format!` uses.
2023-06-27 17:48:47 +02:00
Matthias Krüger
4571be358b
Rollup merge of #113093 - WaffleLapkin:become_unuwuable_in_thir, r=Nilstrieb
`thir`: Add `Become` expression kind

This PR is pretty small and just adds `thir::ExprKind::Become`. I didn't include the checks that will be done on thir, since they are much more complicated and can be done in parallel with with MIR (or, well, at least I believe they can).

r? `@Nilstrieb`
2023-06-27 17:48:47 +02:00
Matthias Krüger
1dc29bbfd6
Rollup merge of #113089 - floriangru:mut_analyses_followup, r=oli-obk
Export AnalysisResults trait in rustc_mir_dataflow

Followup to https://github.com/rust-lang/rust/pull/108293
Re-exports the new trait defined in mentioned PR to make ResultsCursor::seek_before_primary_effect, ResultsCursor::seek_after_primary_effect... usable again outside the compiler itself.
2023-06-27 17:48:46 +02:00
Matthias Krüger
526326e10d
Rollup merge of #113079 - Zalathar:as-operand-id, r=oli-obk
Use `CoverageKind::as_operand_id` instead of manually reimplementing it

These two pieces of code are functionally equivalent to the `CoverageKind::as_operand_id` method that already exists, and is already used elsewhere in this file.

This slightly reduces the amount of code that manually pattern-matches on `CoverageKind`.
2023-06-27 17:48:46 +02:00
Matthias Krüger
e992895c1d
Rollup merge of #112978 - compiler-errors:bad-block-sugg, r=davidtwco
Add suggestion for bad block fragment error

Makes it a bit clearer how to fix this parser restriction
2023-06-27 17:48:45 +02:00
Matthias Krüger
9f2c21c11f
Rollup merge of #112518 - chenyukang:yukang-fix-112458, r=davidtwco
Detect actual span for getting unexpected token from parsing macros

Fixes #112458
2023-06-27 17:48:44 +02:00
许杰友 Jieyou Xu (Joe)
cef812bd95
Provide more context for rustc +nightly -Zunstable-options on stable 2023-06-27 23:23:33 +08:00
bors
3c554f5cb4 Auto merge of #112516 - erikdesjardins:loop, r=davidtwco
cg_llvm: use index-based loop in write_operand_repeatedly

This should be easier for LLVM to analyze.

Fixes #111603

This needs a perf run.

[cc](https://github.com/rust-lang/rust/issues/111603#issuecomment-1567531178) `@caojoshua`
2023-06-27 15:01:56 +00:00
Oli Scherer
b0142f603d
Avoid calling queries during query stack printing 2023-06-27 16:12:07 +02:00
Takayuki Maeda
8352c02fc2 avoid using format!("{}", ..) 2023-06-27 22:12:29 +09:00
Takayuki Maeda
1b7efb5ade remove an unused struct ForbiddenNonLifetimeParam 2023-06-27 22:11:54 +09:00
bors
f42f19b6d3 Auto merge of #113078 - saethlin:mention-the-function, r=RalfJung
Mention the panic function in CheckAlignment

Per https://github.com/rust-lang/rust/pull/112599#discussion_r1242333935
r? `@RalfJung`
2023-06-27 09:43:37 +00:00
Florian Groult
3224ea4424 Export AnalysisResults trait in rustc_mir_dataflow 2023-06-27 11:35:32 +02:00
Maybe Waffle
c60fb12a35 thir: Add Become expression kind 2023-06-27 09:03:05 +00:00
Maybe Waffle
ef05533c39 Simplify some conditions 2023-06-27 07:40:47 +00:00
bors
95978b302c Auto merge of #113083 - matthiaskrgr:rollup-anbqpij, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #113039 (make custom mir ICE a bit nicer)
 - #113058 (Add/improve code comments)
 - #113063 (Update books)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-06-27 06:04:37 +00:00
Matthias Krüger
a144272eee
Rollup merge of #113039 - matthiaskrgr:custom_mir, r=compiler-errors
make custom mir ICE a bit nicer
2023-06-27 07:01:32 +02:00
bors
b5e51db16d Auto merge of #112938 - compiler-errors:clause-3, r=oli-obk
Migrate `TyCtxt::predicates_of` and `ParamEnv::caller_bounds` to `Clause`

The last big change in the series.

I will follow-up with additional filed issues once this PR lands:
- [ ] Investigate making `TypeFoldable<TyCtxt<'tcx>> for ty::Clause<'tcx>` implementation less weird: 2efe091705/compiler/rustc_middle/src/ty/structural_impls.rs (L672)
- [ ] Clean up the elaborator since it should only be emitting child clauses, not predicates
- [ ] Rename identifiers like `pred` and `predicates` to `clause` if they're actually clauses around the codebase
- [ ] Validate that all of the `ToPredicate` impls are acutally still needed, or prune them if they're not

r? `@ghost` until the other branch lands
2023-06-27 03:14:45 +00:00
Zalathar
fbb2079a24 Use CoverageKind::as_operand_id instead of manually reimplementing it 2023-06-27 12:51:42 +10:00
Ben Kimock
cdaac8799b Mention the panic function in CheckAlignment 2023-06-26 22:20:41 -04:00