Commit Graph

5328 Commits

Author SHA1 Message Date
Michael Goulet
0c73b41cd6 remove TypeWellFormedFromEnv 2023-07-03 21:40:04 +00:00
Michael Goulet
810fbf086d Remove chalk from the compiler 2023-07-03 21:40:04 +00:00
lcnr
5378f07d64 use deeply_normalize for assumed_wf_types 2023-07-03 09:12:14 +02:00
lcnr
bd0d533d23 fix structurally relate for weak aliases 2023-07-03 09:12:14 +02:00
bors
4c3f8c728b Auto merge of #113256 - matthiaskrgr:rollup-poex8w2, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #113147 (Fix document examples of Vec::from_raw_parts and Vec::from_raw_parts_in)
 - #113202 (std docs: factorize literal in Barrier example)
 - #113228 (Migrate GUI colors test to original CSS color format)
 - #113231 (Fix `dropping_copy_types` lint from linting in match-arm with side-effects)
 - #113233 (Update chalk)
 - #113234 (Don't pass --test-args to `python -m unitest`)
 - #113244 (Make Rust Analyzer tests faster by compiling less code)
 - #113249 (Document tracking issue for rustdoc `show-type-layout`)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-02 10:22:49 +00:00
Matthias Krüger
fda22efbf0
Rollup merge of #113233 - Nilstrieb:chaaalk, r=jackh726
Update chalk

For #109302

r? jackh726
2023-07-02 10:27:21 +02:00
bors
72b2101434 Auto merge of #112718 - oli-obk:SIMD-destructure_mir_const, r=cjgillot
Make simd_shuffle_indices use valtrees

This removes the second-to-last user of the `destructure_mir_constant` query. So in a follow-up we can remove the query and just move the query provider function directly into pretty printing (which is the last user).

cc `@rust-lang/clippy` there's a small functional change, but I think it is correct?
2023-07-02 07:43:36 +00:00
Nilstrieb
4be84771a7 Put FnAbiError behind reference to shrink result
The `FnAbi` is just a pointer, so the error type should not be bigger.
2023-07-01 21:16:27 +02:00
Nilstrieb
3019c1cb2a Put LayoutError behind reference to shrink result
`LayoutError` is 24 bytes, which is bigger than the `Ok` types, so let's
shrink that.
2023-07-01 21:16:25 +02:00
Nilstrieb
e43ec03968 Update chalk 2023-07-01 18:03:36 +02:00
Gary Guo
39c3ef799f Fix comment of fn_can_unwind 2023-06-30 18:38:56 +01:00
Matthias Krüger
42a495da7e
Rollup merge of #112670 - petrochenkov:typriv, r=eholk
privacy: Type privacy lints fixes and cleanups

See individual commits.
Follow up to https://github.com/rust-lang/rust/pull/111801.
2023-06-29 05:48:39 +02:00
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
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
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
Camille GILLOT
6f3f878351 Normalize types when applying uninhabited predicate. 2023-06-27 17:10:14 +00:00
Oli Scherer
b0142f603d
Avoid calling queries during query stack printing 2023-06-27 16:12:07 +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
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
bors
b9ad9b78a2 Auto merge of #112693 - ericmarkmartin:use-more-placeref, r=spastorino
Use PlaceRef abstractions more often

Associated issue: https://github.com/rust-lang/rust/issues/80647

r? `@spastorino`
2023-06-27 00:34:49 +00:00
Michael Goulet
374173cd99 TypeWellFormedInEnv 2023-06-26 23:12:04 +00:00
Michael Goulet
fbdef58414 Migrate predicates_of and caller_bounds to Clause 2023-06-26 23:12:03 +00:00
Oli Scherer
1c992c0b1c Assert that we don't convert unevaluated MIR promoteds to unevaluated type constants 2023-06-26 09:34:52 +00:00
Oli Scherer
168de14ac9 Make simd_shuffle_indices use valtrees 2023-06-26 09:34:52 +00:00
Eric Mark Martin
c07c10d1e4 use PlaceRef abstractions more consistently 2023-06-25 20:38:01 -04:00
bors
1d67eba687 Auto merge of #112891 - oli-obk:impl_trait_in_assoc_tys_cleanup, r=compiler-errors
Various impl trait in assoc tys cleanups

r? `@compiler-errors`

All commits except for the last are pure refactorings. 274dab5bd658c97886a8987340bf50ae57900c39 allows struct fields to participate in deciding whether a function has an opaque in its signature.

best reviewed commit by commit
2023-06-23 23:26:38 +00:00
Matthias Krüger
4e8983050e
Rollup merge of #112870 - compiler-errors:clause-2, r=oli-obk
Migrate `item_bounds` to `ty::Clause`

Should be simpler than the next PR that's coming up. Last three commits are the relevant ones.

r? ``@oli-obk`` or ``@lcnr``
2023-06-23 19:39:59 +02:00
Matthias Krüger
cea5ae00d2
Rollup merge of #112810 - compiler-errors:dont-ice-on-bad-layout, r=wesleywiser
Don't ICE on unnormalized struct tail in layout computation

1. We try to compute a `SizeSkeleton` even if a layout error occurs, but we really only need to do this if we get `LayoutError::Unknown`, since that means our type is too polymorphic to actually compute the full layout. If we have other errors, like `LayoutError::NormalizationError` or `LayoutError::Cycle`, then we can't really make any progress, since this represents an actual error.
2. Avoid using `normalize_erasing_regions` and `struct_tail_erasing_lifetimes` since those ICE on normalization errors, and since we may call `layout_of` in HIR typeck, we don't know for certain that we're on the happy path.

Fixes #112736
2023-06-23 19:39:58 +02:00
Gary Guo
c462291e0c Make UnwindAction::Continue explicit in MIR dump 2023-06-23 17:48:54 +01:00
Michael Goulet
471830b3a4 migrate inferred_outlives_of to Clause 2023-06-22 18:34:24 +00:00
Michael Goulet
2fa796a3c7 Expect clause more 2023-06-22 18:34:24 +00:00
Michael Goulet
46a650f4e0 Migrate item_bounds to ty::Clause 2023-06-22 18:34:23 +00:00
Oli Scherer
c8979e587b Move opaque_type_origin_unchecked onto TyCtxt and re-use it where it was open coded 2023-06-22 14:31:15 +00:00
bors
fa06a371b7 Auto merge of #112695 - nnethercote:inline-before-merging-cgus, r=wesleywiser
Inline before merging cgus

Because CGU merging relies on CGU sizes, but the CGU sizes before inlining aren't accurate.

This change doesn't have much effect on compile perf, but it makes follow-on changes that involve more sophisticated reasoning about CGU sizes much easier.

r? `@wesleywiser`
2023-06-22 08:34:32 +00:00
Nicholas Nethercote
abde9ba527 Tweak CGU size estimate code.
- Rename `create_size_estimate` as `compute_size_estimate`, because that
  makes more sense for the second and subsequent calls for each CGU.
- Change `CodegenUnit::size_estimate` from `Option<usize>` to `usize`.
  We can still assert that `compute_size_estimate` is called first.
- Move the size estimation for `place_mono_items` inside the function,
  for consistency with `merge_codegen_units`.
2023-06-22 09:33:06 +10:00
Santiago Pastorino
3ef510ca80
Print def_id on EarlyBoundRegion debug 2023-06-21 19:34:21 -03:00
Nicholas Nethercote
6f228e3420 Inline before merging CGUs.
Because CGU merging relies on CGU sizes, but the CGU sizes before
inlining aren't accurate.

This requires tweaking how the sizes are updated during merging: if CGU
A and B both have an inlined function F, then `size(A + B)` will be a
little less than `size(A) + size(B)`, because `A + B` will only have one
copy of F. Also, the minimum CGU size is increased because it now has to
account for inlined functions.

This change doesn't have much effect on compile perf, but it makes
follow-on changes that involve more sophisticated reasoning about CGU
sizes much easier.
2023-06-22 08:10:29 +10:00
Nilstrieb
a98c14f3a9
Rollup merge of #112772 - compiler-errors:clauses-1, r=lcnr
Add a fully fledged `Clause` type, rename old `Clause` to `ClauseKind`

Does two basic things before I put up a more delicate set of PRs (along the lines of #112714, but hopefully much cleaner) that migrate existing usages of `ty::Predicate` to `ty::Clause` (`predicates_of`/`item_bounds`/`ParamEnv::caller_bounds`).

1. Rename `Clause` to `ClauseKind`, so it's parallel with `PredicateKind`.
2. Add a new `Clause` type which is parallel to `Predicate`.
    * This type exposes `Clause::kind(self) -> Binder<'tcx, ClauseKind<'tcx>>` which is parallel to `Predicate::kind` 😸

The new `Clause` type essentially acts as a newtype wrapper around `Predicate` that asserts that it is specifically a `PredicateKind::Clause`. Turns out from experimentation[^1] that this is not negative performance-wise, which is wonderful, since this a much simpler design than something that requires encoding the discriminant into the alignment bits of a predicate kind, or something else like that...

r? ``@lcnr`` or ``@oli-obk``

[^1]: https://github.com/rust-lang/rust/pull/112714#issuecomment-1595653910
2023-06-21 07:37:01 +02:00
Nilstrieb
34c8e53d7a
Rollup merge of #112759 - cjgillot:closure-names, r=oli-obk
Make closure_saved_names_of_captured_variables a query.

As we will start removing debuginfo during MIR optimizations, we need to keep them somewhere.
2023-06-21 07:37:01 +02:00
bors
c55d1ee8d4 Auto merge of #112119 - zirconium-n:issue-113072-merge-borrow-kind, r=lcnr
Merge `BorrowKind::Unique` into `BorrowKind::Mut`

Fixes #112072

Might have conflict with #112070

r? `@lcnr`

I'm not sure what's the suitable change in a couple places.
2023-06-21 02:06:10 +00:00
Michael Goulet
7d0a5c31f5 yeet upcast_trait_def_id from ImplSourceObjectData 2023-06-20 23:33:02 +00:00
Michael Goulet
42571c4847 yeet ImplSource::TraitAlias too 2023-06-20 23:33:02 +00:00
bors
46514218f6 Auto merge of #112835 - lcnr:proof-tree-nits, r=BoxyUwU
proof tree nits

r? `@BoxyUwU`
2023-06-20 19:58:46 +00:00
Ziru Niu
b8a250fc4f update comment on MutBorrowKind::ClosureCapture 2023-06-20 20:55:31 +08:00
Ziru Niu
a52cc0a8c9 address most easy comments 2023-06-20 20:55:31 +08:00
Ziru Niu
8fb4c41f35 merge BorrowKind::Unique into BorrowKind::Mut 2023-06-20 20:55:31 +08:00
Guillaume Gomez
73496fc5d5
Rollup merge of #112786 - lcnr:early-binder, r=Nilstrieb
change binders from tuple structs to named fields
2023-06-20 14:23:40 +02:00
lcnr
f7472aa69e cleanup imports 2023-06-20 12:41:00 +02:00
bors
6fc0273b5a Auto merge of #112320 - compiler-errors:do-not-impl-via-obj, r=lcnr
Add `implement_via_object` to `rustc_deny_explicit_impl` to control object candidate assembly

Some built-in traits are special, since they are used to prove facts about the program that are important for later phases of compilation such as codegen and CTFE. For example, the `Unsize` trait is used to assert to the compiler that we are able to unsize a type into another type. It doesn't have any methods because it doesn't actually *instruct* the compiler how to do this unsizing, but this is later used (alongside an exhaustive match of combinations of unsizeable types) during codegen to generate unsize coercion code.

Due to this, these built-in traits are incompatible with the type erasure provided by object types. For example, the existence of `dyn Unsize<T>` does not mean that the compiler is able to unsize `Box<dyn Unsize<T>>` into `Box<T>`, since `Unsize` is a *witness* to the fact that a type can be unsized, and it doesn't actually encode that unsizing operation in its vtable as mentioned above.

The old trait solver gets around this fact by having complex control flow that never considers object bounds for certain built-in traits:
2f896da247/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs (L61-L132)

However, candidate assembly in the new solver is much more lovely, and I'd hate to add this list of opt-out cases into the new solver. Instead of maintaining this complex and hard-coded control flow, instead we can make this a property of the trait via a built-in attribute. We already have such a build attribute that's applied to every single trait that we care about: `rustc_deny_explicit_impl`. This PR adds `implement_via_object` as a meta-item to that attribute that allows us to opt a trait out of object-bound candidate assembly as well.

r? `@lcnr`
2023-06-20 08:42:37 +00:00
Michael Goulet
ca68cf0d46 Merge attrs, better validation 2023-06-20 04:38:55 +00:00
Michael Goulet
91e5c3f2e5 Make rustc_deny_explicit_impl only local as well 2023-06-20 04:38:46 +00:00
Michael Goulet
657d3f43a9 Add rustc_do_not_implement_via_object 2023-06-20 04:38:46 +00:00
Michael Goulet
31d1fbf8d2
Rollup merge of #112232 - fee1-dead-contrib:match-eq-const-msg, r=b-naber
Better error for non const `PartialEq` call generated by `match`

Resolves #90237
2023-06-19 17:53:33 -07:00
Michael Goulet
dd620aa73a Don't ICE on unnormalized struct tail in layout computation 2023-06-19 20:00:41 +00:00
bors
4051305389 Auto merge of #112238 - scottmcm:mir-add-unchecked, r=cjgillot
Promote unchecked integer math to MIR `BinOp`s

So slice indexing by a range gets down to one basic block, for example.

r? cjgillot
2023-06-19 17:14:21 +00:00
Camille GILLOT
3a1edd8212 Store generator field names in GeneratorLayout. 2023-06-19 16:50:52 +00:00
Camille GILLOT
7d5b2e4926 Make closure_saved_names_of_captured_variables a query. 2023-06-19 16:50:52 +00:00
Michael Goulet
dcee3ab4f8 doc 2023-06-19 15:46:39 +00:00
Michael Goulet
21226eefb2 Fully fledged Clause type 2023-06-19 15:46:08 +00:00
Michael Goulet
fca56a8d2c s/Clause/ClauseKind 2023-06-19 14:57:42 +00:00
lcnr
f2975810a5 change binders from tuple structs to named fields 2023-06-19 11:38:07 +02:00
Scott McMurray
39788e07ba Promote unchecked_add/sub/mul/shl/shr to mir::BinOp 2023-06-19 01:47:03 -07:00
Boxy
3a6ce74c07 move to nested module 2023-06-19 09:08:03 +01:00
Boxy
51090b962f show normalizes-to hack and response instantiation goals 2023-06-19 09:06:16 +01:00
Boxy
e367c04dc6 introduce a separate set of types for finalized proof trees 2023-06-19 09:06:16 +01:00
Boxy
3587d4ced8 say what kind of cache hit 2023-06-19 09:01:37 +01:00
Boxy
3009b2c647 initial info dump 2023-06-19 09:01:37 +01:00
Deadbeef
446db517af fix doc 2023-06-19 03:47:27 +00:00
bors
677710eaf0 Auto merge of #112638 - lqd:rpo, r=cjgillot
Switch the BB CFG cache from postorder to RPO

The `BasicBlocks` CFG cache is interesting:
- it stores a postorder, but `traversal::postorder` doesn't use it
- `traversal::reverse_postorder` does traverse the postorder cache backwards
- we do more RPO traversals than postorder traversals (around 20x on the perf.rlo benchmarks IIRC) but it's not cached
- a couple places here and there were manually reversing the non-cached postorder traversal

This PR switches the order of the cache, and makes a bit more use of it. This is a tiny win locally, but it's also for consistency and aesthetics.

r? `@ghost`
2023-06-18 12:45:41 +00:00
Rémy Rakic
08a9f25245 remove redundant combinators between PO and RPO 2023-06-18 09:16:40 +00:00
Matthias Krüger
3436069c34
Rollup merge of #112734 - dswij:bounds-predicates-clause, r=compiler-errors
Make `Bound::predicates`  use `Clause`

Part of #107250

`Bound::predicates` returns an iterator over `Binder<_, Clause>` instead of `Predicate`.

I tried updating `explicit_predicates_of` as well, but it seems that it needs a lot more change than I thought. Will do it in a separate PR instead.
2023-06-18 08:06:43 +02:00
Matthias Krüger
8d3d3cc0ba
Rollup merge of #112667 - compiler-errors:wf-goal-is-clause, r=lcnr
Move WF/ConstEvaluatable goal to clause

It can show up in a param-env, so I think it needs to be a clause kind.

r? ```@lcnr``` or ```@oli-obk```
2023-06-18 08:06:41 +02:00
Deadbeef
89c24af133 Better error for non const PartialEq call generated by match 2023-06-18 05:24:38 +00:00
Michael Goulet
6594c75449 Move ConstEvaluatable to Clause 2023-06-17 21:27:13 +00:00
Michael Goulet
52d3fc93f2 Move WF goal to clause 2023-06-17 21:20:20 +00:00
Matthias Krüger
5518eb863f
Rollup merge of #112738 - matthiaskrgr:ice_msg, r=oli-obk
make ice msg "Unknown runtime phase" a bit nicer
2023-06-17 18:27:31 +02:00
Matthias Krüger
32aee06448 make ice msg "Unknown runtime phase" a bit nicer 2023-06-17 13:55:11 +02:00
Matthias Krüger
981a2a2c00
Rollup merge of #112728 - Zalathar:spanview-charset, r=Nilstrieb
Add `<meta charset="utf-8">` to `-Zdump-mir-spanview` output

Without an explicit `<meta charset>` declaration, some browsers (e.g. Safari) won't detect the page encoding as UTF-8, causing unicode characters in the dump output to display incorrectly.
2023-06-17 12:43:32 +02:00
dswij
f874345784 Bound::predicates to return Clause 2023-06-17 17:16:30 +08:00
Zalathar
3eddb29555 Add <meta charset="utf-8"> to -Zdump-mir-spanview output 2023-06-17 18:31:35 +10:00
Michael Goulet
d97d4ebecc Remove even more redundant builtin candidates 2023-06-17 03:32:46 +00:00
Michael Goulet
2835d9d1d3 Simplify even more candidates 2023-06-17 03:32:46 +00:00
Michael Goulet
1311bb56f3 Simplify an ObjectData field 2023-06-17 03:32:45 +00:00
Michael Goulet
9e68b6f505 Simplify some impl source candidates 2023-06-17 03:32:45 +00:00
Michael Goulet
1704481bfa Remove some ImplSource candidates 2023-06-17 03:32:45 +00:00
bors
0cc541e4b2 Auto merge of #108860 - oli-obk:tait_alias, r=compiler-errors
Add `AliasKind::Weak` for type aliases.

`type Foo<T: Debug> = Bar<T>;` does not check `T: Debug` at use sites of `Foo<NotDebug>`, because in contrast to a

```rust
trait Identity {
    type Identity;
}
impl<T: Debug> Identity for T {
    type Identity = T;
}
<NotDebug as Identity>::Identity
```

type aliases do not exist in the type system, but are expanded to their aliased type immediately when going from HIR to the type layer.

Similarly:

* a private type alias for a public type is a completely fine thing, even though it makes it a bit hard to write out complex times sometimes
* rustdoc expands the type alias, even though often times users use them for documentation purposes
* diagnostics show the expanded type, which is confusing if the user wrote a type alias and the diagnostic talks about another type that they don't know about.

For type alias impl trait, these issues do not actually apply in most cases, but sometimes you have a type alias impl trait like `type Foo<T: Debug> = (impl Debug, Bar<T>);`, which only really checks it for `impl Debug`, but by accident prevents `Bar<T>` from only being instantiated after proving `T: Debug`. This PR makes sure that we always check these bounds explicitly and don't rely on an implementation accident.

To not break all the type aliases out there, we only use it when the type alias contains an opaque type. We can decide to do this for all type aliases over an edition.

Or we can later extend this to more types if we figure out the back-compat concerns with suddenly checking such bounds.

As a side effect, easily allows fixing https://github.com/rust-lang/rust/issues/108617, which I did.

fixes https://github.com/rust-lang/rust/issues/108617
2023-06-17 00:33:29 +00:00
Michael Goulet
56c96d7552
Rollup merge of #112706 - WaffleLapkin:syntax_context_is_root, r=petrochenkov
Add `SyntaxContext::is_root`

Makes the code a tad nicer.
2023-06-16 12:53:24 -07:00
Michael Goulet
cef94ecedf
Rollup merge of #112665 - compiler-errors:assumption-takes-clause, r=lcnr
Make assumption functions in new solver take `Binder<'tcx, Clause<'tcx>>`

We just use an if-let to match on an optional clause at all the places where we transition from `Predicate` -> `Clause`, but I assume that when things like item-bounds and param-env start to only store `Clause`s then those can just be trivially dropped.

r? ``@lcnr``
2023-06-16 12:53:23 -07:00
Oli Scherer
f3b7dd6388 Add AliasKind::Weak for type aliases.
Only use it when the type alias contains an opaque type.

Also does wf-checking on such type aliases.
2023-06-16 19:39:48 +00:00
Maybe Waffle
73c5c97de7 Add SyntaxContext::is_root 2023-06-16 13:47:42 +00:00
Dylan DPC
64f6c00772
Rollup merge of #112443 - compiler-errors:next-solver-opportunistically-resolve-regions, r=lcnr
Opportunistically resolve regions in new solver

Use `opportunistic_resolve_var` during canonicalization to collapse some regions.

We have to start using `CanonicalVarValues::is_identity_modulo_regions`. We also have to modify that function to consider responses like `['static, ^0, '^1, ^2]` to be an "identity" response, since because we opportunistically resolve regions, there's no longer a 1:1 mapping between canonical var values and bound var indices in the response...

There's one nasty side-effect -- one test (`tests/ui/dyn-star/param-env-infer.rs`) starts to ICE because the certainty goes from `Yes` to `Maybe(Overflow)`... Not exactly sure why, though? Putting this up for discussion/investigation.

r? ```@lcnr```
2023-06-16 14:46:15 +05:30
bors
c84d5e7078 Auto merge of #112346 - saethlin:no-comment, r=oli-obk
Remove comments from mir-opt MIR dumps

See https://rust-lang.zulipchat.com/#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/Line.20numbers.20in.20mir-opt.20tests/near/363849874

In https://github.com/rust-lang/rust/pull/99780 there is mention that "there has been a zulip conversation about disabling line numbers with mixed opinions" which to me means that some people opposed this. I can't find the referenced conversation so... here we go.

The current situation is quite chaotic. It's not hard to find MIR diffs which contain

* Absolute line numbers
* Relative line numbers
* Substituted line numbers (LL)
For example: 408bbd0406/tests/mir-opt/inline/inline_shims.drop.Inline.diff (L10-L17)

And sometimes adding a comment at the top of a mir-opt test generates a diff in the test because a line number changed: https://github.com/rust-lang/rust/pull/98112/files#diff-b8cf4bcce95078e6a3faf075e9abf6864872fb28a64d95c04f04513b9e3bbd81

And irrelevant changes to the standard library can generate diffs in mir-opt tests: https://github.com/rust-lang/rust/pull/110694/files#diff-bf96b0e7c67b8b272814536888fd9428c314991e155beae1f0a2a67f0ac47b2c
769886cc35

I think we should, specifically in mir-opt tests, completely remove the comments, or insert placeholders for all line and column numbers.
2023-06-16 01:55:34 +00:00
Guillaume Gomez
af955a647e
Rollup merge of #112614 - lukas-code:apit-unsized-suggestion, r=compiler-errors
tweak suggestion for argument-position `impl ?Sized`

fixes this invalid suggestion:
```text
help: consider removing the `?Sized` bound to make the type parameter `Sized`
  |
1 - fn foo(_: impl ?Sized) {}
1 + fn foo(_: impl ) {}
  |
```
2023-06-15 22:04:56 +02:00
Ben Kimock
0a1fa411ed Remove comments from mir-opt MIR dumps 2023-06-15 15:19:11 -04:00
Vadim Petrochenkov
98a86ffc9f privacy: Rename some variables for clarity 2023-06-15 21:25:47 +03:00