Commit Graph

1897 Commits

Author SHA1 Message Date
Nicholas Nethercote
f86c76a782 Remove unnecessary qualifiers. 2024-11-04 17:36:25 +11:00
Nicholas Nethercote
a07011bde2 Remove unnecessary continue. 2024-11-04 17:36:25 +11:00
Nicholas Nethercote
e23bdd68f9 Remove ToUniverseInfo impl for CanonicalQueryInput<CustomTypeOp>.
It's unused.
2024-11-04 17:36:25 +11:00
Nicholas Nethercote
7901c03d2d Merge UniverseInfo and UniverseInfoInner.
It's strange to have a struct that contains a single anonymous field
that is an enum. This commit merges them. This does require increasing
the visibility of `TypeOfInfo` to `pub(crate)`, but that seems
worthwhile.
2024-11-04 17:36:25 +11:00
Nicholas Nethercote
bf1a5c2b7f Tidy up comments and some formatting.
Mostly by wrapping overly long comment lines, plus a few other things.
2024-11-04 17:36:25 +11:00
Nicholas Nethercote
ad875529bf Move some use declarations.
So they're all in the one place. Also prepend with `crate::`, à la the
`unqualified_local_imports` lint.
2024-11-04 17:36:23 +11:00
Nicholas Nethercote
6676cec925 Reduce visibilities. 2024-11-04 15:43:45 +11:00
Jubilee Young
586766e790 compiler: Replace rustc_target with _abi in _borrowck 2024-11-02 20:31:47 -07:00
bors
9ccfedf186 Auto merge of #132301 - compiler-errors:adjust, r=lcnr
Remove region from adjustments

It's not necessary to store this region, because it's only used in THIR and MemCat/ExprUse, both of which already basically only deal with erased regions anyways.
2024-10-31 10:17:49 +00:00
Michael Goulet
c1457798db Try to point out when edition 2024 lifetime capture rules cause borrowck issues 2024-10-31 01:35:14 +00:00
Michael Goulet
e093b82a41 Encode cross-crate opaque type origin 2024-10-31 01:35:13 +00:00
Camille GILLOT
b6e1214ac0 Remap impl-trait lifetimes on HIR instead of AST lowering. 2024-10-30 16:18:50 +00:00
Matthias Krüger
2055237e8f
Rollup merge of #132338 - nnethercote:rm-Engine, r=nnethercote
Remove `Engine`

It's just unnecessary plumbing. Removing it results in less code, and simpler code.

r? ``@cjgillot``
2024-10-30 06:40:37 +01:00
Nicholas Nethercote
e54c177118 Remove Analysis::into_engine.
This is a standard pattern:
```
MyAnalysis.into_engine(tcx, body).iterate_to_fixpoint()
```
`into_engine` and `iterate_to_fixpoint` are always called in pairs, but
sometimes with a builder-style `pass_name` call between them. But a
builder-style interface is overkill here. This has been bugging me a for
a while.

This commit:
- Merges `Engine::new` and `Engine::iterate_to_fixpoint`. This removes
  the need for `Engine` to have fields, leaving it as a trivial type
  that the next commit will remove.
- Renames `Analysis::into_engine` as `Analysis::iterate_to_fixpoint`,
  gives it an extra argument for the optional pass name, and makes it
  call `Engine::iterate_to_fixpoint` instead of `Engine::new`.

This turns the pattern from above into this:
```
MyAnalysis.iterate_to_fixpoint(tcx, body, None)
```
which is shorter at every call site, and there's less plumbing required
to support it.
2024-10-30 09:41:46 +11:00
lcnr
f51ec110a7 TypingMode 🤔 2024-10-29 17:01:24 +01:00
Michael Goulet
599ffab6cd Remove region from adjustments 2024-10-29 01:34:06 +00:00
klensy
746b675c5a fix clippy::clone_on_ref_ptr for compiler 2024-10-28 18:05:08 +03:00
Stuart Cook
ad43be310f
Rollup merge of #131756 - compiler-errors:deeply-normalize-type-err, r=lcnr
Deeply normalize `TypeTrace` when reporting type error in new solver

Normalize the values that come from the `TypeTrace` for various type mismatches.

Side-note: We can't normalize the `TypeError` itself bc it may come from instantiated binders, so it may reference values from within the probe...

r? lcnr
2024-10-24 14:19:55 +11:00
Michael Goulet
1920c66a8d Plumb through param_env to note_type_err 2024-10-24 02:48:08 +00:00
Matthias Krüger
464f4057c2 fix some manual_map 2024-10-23 22:22:56 +02:00
Ralf Jung
ad3991d303 nightly feature tracking: get rid of the per-feature bool fields 2024-10-23 09:14:41 +01:00
bors
f2ba41113d Auto merge of #130950 - compiler-errors:yeet-eval, r=BoxyUwU
Continue to get rid of `ty::Const::{try_}eval*`

This PR mostly does:

* Removes all of the `try_eval_*` and `eval_*` helpers from `ty::Const`, and replace their usages with `try_to_*`.
* Remove `ty::Const::eval`.
* Rename `ty::Const::normalize` to `ty::Const::normalize_internal`. This function is still used in the normalization code itself.
* Fix some weirdness around the `TransmuteFrom` goal.

I'm happy to split it out further; for example, I could probably land the first part which removes the helpers, or the changes to codegen which are more obvious than the changes to tools.

r? BoxyUwU

Part of https://github.com/rust-lang/rust/issues/130704
2024-10-21 03:46:28 +00:00
Matthias Krüger
268fa31596
Rollup merge of #127675 - chenyukang:yukang-fix-127562-addr, r=petrochenkov
Remove invalid help diagnostics for const pointer

Partially addresses #127562
2024-10-19 22:00:55 +02:00
Michael Goulet
e83e4e8112 Get rid of const eval_* and try_eval_* helpers 2024-10-19 18:07:35 +00:00
lcnr
3360c1773a move defining_opaque_types out of Canonical 2024-10-17 10:22:52 +02:00
lcnr
f3ce557fcd DropckOutlives to rustc_middle 2024-10-17 09:53:27 +02:00
lcnr
9334d85e69 remove type_op constructors 2024-10-17 09:53:27 +02:00
lcnr
401f9b4e0a ImpliedOutlivesBounds to rustc_middle 2024-10-17 09:53:27 +02:00
bors
d829780c4e Auto merge of #131481 - nnethercote:rm-GenKillSet, r=cjgillot
Remove `GenKillAnalysis`

There are two kinds of dataflow analysis in the compiler: `Analysis`, which is the basic kind, and `GenKillAnalysis`, which is a more specialized kind for gen/kill analyses that is intended as an optimization. However, it turns out that `GenKillAnalysis` is actually a  pessimization! It's faster (and much simpler) to do all the gen/kill analyses via `Analysis`. This lets us remove `GenKillAnalysis`, and `GenKillSet`, and a few other things, and also merge `AnalysisDomain` into `Analysis`. The PR removes 500 lines of code and improves performance.

r? `@tmiasko`
2024-10-16 09:45:05 +00:00
bors
9618da7c99 Auto merge of #131422 - GnomedDev:smallvec-predicate-obligations, r=compiler-errors
Use `ThinVec` for PredicateObligation storage

~~I noticed while profiling clippy on a project that a large amount of time is being spent allocating `Vec`s for `PredicateObligation`, and the `Vec`s are often quite small. This is an attempt to optimise this by using SmallVec to avoid heap allocations for these common small Vecs.~~

This PR turns all the `Vec<PredicateObligation>` into a single type alias while avoiding referring to `Vec` around it, then swaps the type over to `ThinVec<PredicateObligation>` and fixes the fallout. This also contains an implementation of `ThinVec::extract_if`, copied from `Vec::extract_if` and currently being upstreamed to https://github.com/Gankra/thin-vec/pull/66.

This leads to a small (0.2-0.7%) performance gain in the latest perf run.
2024-10-16 04:06:14 +00:00
Michael Goulet
7500e09b8b Move trait bound modifiers into hir::PolyTraitRef 2024-10-14 09:20:38 -04:00
Nicholas Nethercote
33abf6a0c8 Add defaults for Analysis::apply_{call_return_effect,terminator_effect}.
To avoid some low-value boilerplate code.
2024-10-14 16:35:47 +11:00
Nicholas Nethercote
ba13775319 Merge AnalysisDomain into Analysis.
With `GenKillAnalysis` gone, there is no need for them to be separate.
2024-10-14 16:35:47 +11:00
Nicholas Nethercote
4dc1b4d0b1 Remove GenKillAnalysis.
It's now functionally identical to `Analysis`.
2024-10-14 16:35:42 +11:00
Nicholas Nethercote
525f655866 Minimize use of GenKill.
Thanks to the previous couple of commits, many uses of the `GenKill`
trait can be replaced with a concrete type.
2024-10-14 16:35:28 +11:00
Nicholas Nethercote
13968b4a70 Tweak GenKillAnalysis method arguments.
`GenKillAnalysis` has very similar methods to `Analysis`, but the first
two have a notable difference: the second argument is `&mut impl
GenKill<Self::Idx>` instead of `&mut Self::Domain`. But thanks to the
previous commit, this difference is no longer necessary.
2024-10-14 16:35:28 +11:00
Trevor Gross
39071fdc58
Rollup merge of #131626 - matthiaskrgr:dont_string, r=lqd
remove a couple of redundant String to String conversion
2024-10-12 21:38:38 -05:00
Matthias Krüger
4bc21e318c remove a couple of redundant String to String conversion 2024-10-12 22:07:46 +02:00
GnomedDev
7ec06b0d1d Swap Vec<PredicateObligation> to type alias 2024-10-12 15:17:08 +01:00
Matthias Krüger
e5906e1591 yeet some clones 2024-10-12 10:59:12 +02:00
bors
249df9e791 Auto merge of #131444 - onur-ozkan:hotfix-ci, r=Kobzol
stabilize `ci_rustc_if_unchanged_logic` test

Makes `ci_rustc_if_unchanged_logic` test more stable and re-enables it. Previously, it was expecting CI-rustc to be used all the time when there were no changes, which wasn’t always the case. Purpose of this test is making sure we don't use CI-rustc while there are changes in compiler and/or library, but we don't really need to cover cases where CI-rustc is not enabled.

Second commit was pushed for making a change in the compiler tree, so `ci_rustc_if_unchanged_logic` can be tested properly in merge CI.
2024-10-10 23:51:17 +00:00
Michael Goulet
8715bfbf0e Make super combine into fns 2024-10-10 06:07:52 -04:00
Michael Goulet
ce7a61b9d0 Uplift super_combine 2024-10-10 06:07:51 -04:00
onur-ozkan
de744eafe1 update rustc_borrowck::places_conflict doc-comment
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-10-10 10:33:29 +03:00
Jubilee
9c4732a77d
Rollup merge of #131225 - nnethercote:rustc_borrowck-mm, r=lqd
`rustc_borrowck` memory management tweaks

Minor cleanups in `rustc_borrowck` relating to memory management.

r? `@lqd`
2024-10-07 11:10:54 -07:00
Folkert de Vries
5fc60d1e52 various fixes for naked_asm! implementation
- fix for divergence
- fix error message
- fix another cranelift test
- fix some cranelift things
- don't set the NORETURN option for naked asm
- fix use of naked_asm! in doc comment
- fix use of naked_asm! in run-make test
- use `span_bug` in unreachable branch
2024-10-06 19:00:09 +02:00
bors
5a4ee43c38 Auto merge of #129244 - cjgillot:opaque-hir, r=compiler-errors
Make opaque types regular HIR nodes

Having opaque types as HIR owner introduces all sorts of complications. This PR proposes to make them regular HIR nodes instead.

I haven't gone through all the test changes yet, so there may be a few surprises.

Many thanks to `@camelid` for the first draft.
Fixes https://github.com/rust-lang/rust/issues/129023

Fixes #129099
Fixes #125843
Fixes #119716
Fixes #121422
2024-10-05 06:19:35 +00:00
Noah Lev
d6f247f3d5 rm ItemKind::OpaqueTy
This introduce an additional collection of opaques on HIR, as they can no
longer be listed using the free item list.
2024-10-04 23:28:22 +00:00
Jubilee
4778893968
Rollup merge of #131264 - compiler-errors:fix-pub-crate, r=jieyouxu
Fix some `pub(crate)` that were undetected bc of `#[instrument]`

Self-explanatory, minor clean up.
2024-10-04 14:11:39 -07:00
Jubilee
5a8fcab713
Rollup merge of #130518 - scottmcm:stabilize-controlflow-extra, r=dtolnay
Stabilize the `map`/`value` methods on `ControlFlow`

And fix the stability attribute on the `pub use` in `core::ops`.

libs-api in https://github.com/rust-lang/rust/issues/75744#issuecomment-2231214910 seemed reasonably happy with naming for these, so let's try for an FCP.

Summary:
```rust
impl<B, C> ControlFlow<B, C> {
    pub fn break_value(self) -> Option<B>;
    pub fn map_break<T>(self, f: impl FnOnce(B) -> T) -> ControlFlow<T, C>;
    pub fn continue_value(self) -> Option<C>;
    pub fn map_continue<T>(self, f: impl FnOnce(C) -> T) -> ControlFlow<B, T>;
}
```

Resolves #75744

``@rustbot`` label +needs-fcp +t-libs-api -t-libs

---

Aside, in case it keeps someone else from going down the same dead end: I looked at the `{break,continue}_value` methods and tried to make them `const` as part of this, but that's disallowed because of not having `const Drop`, so put it back to not even unstably-const.
2024-10-04 14:11:34 -07:00