about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src
AgeCommit message (Collapse)AuthorLines
2024-04-19Let inherent associated types constrain opaque types during projectionOli Scherer-1/+1
2024-04-18Auto merge of #124008 - nnethercote:simpler-static_assert_size, r=Nilstriebbors-2/+2
Simplify `static_assert_size`s. We want to run them on all 64-bit platforms. r? `@ghost`
2024-04-18Simplify `static_assert_size`s.Nicholas Nethercote-2/+2
We want to run them on all 64-bit platforms.
2024-04-17Use non-exhaustive matches for TyKindDaria Sukhonina-8/+8
Also no longer export noop async_drop_in_place_raw
2024-04-17Rename `BindingAnnotation` to `BindingMode`Jules Bertholet-3/+1
2024-04-17Rollup merge of #122813 - nnethercote:nicer-quals, r=compiler-errorsMatthias Krüger-7/+6
Qualifier tweaking Adding and removing qualifiers in some cases that make things nicer. Details in individual commits. r? `@compiler-errors`
2024-04-17Auto merge of #124040 - GuillaumeGomez:rollup-hrrvsgh, r=GuillaumeGomezbors-4/+14
Rollup of 7 pull requests Successful merges: - #123673 (Don't ICE for kind mismatches during error rendering) - #123675 (Taint const qualifs if a static is referenced that didn't pass wfcheck) - #123975 (Port the 2 `rust-lld` run-make tests to `rmake`) - #124000 (Use `/* value */` as a placeholder) - #124013 (Box::into_raw: make Miri understand that this is a box-to-raw cast) - #124027 (Prefer identity equality over equating types during coercion.) - #124036 (Remove `default_hidden_visibility: false` from wasm targets) r? `@ghost` `@rustbot` modify labels: rollup
2024-04-17Rollup merge of #124000 - compiler-errors:sugg-tweaks, r=wesleywiserGuillaume Gomez-4/+11
Use `/* value */` as a placeholder The expression `value` isn't a valid suggestion; let's use `/* value */` as a placeholder (which is also invalid) since it more clearly signals to the user that they need to fill it in with something meaningful. This parallels the suggestions we have in a couple other places, like arguments. We could also print the type name instead of `/* value */`, especially if it's suggestable, but I don't care strongly about that.
2024-04-17Rollup merge of #123673 - oli-obk:sig_wfcheck_ice, r=jieyouxu,estebankGuillaume Gomez-0/+3
Don't ICE for kind mismatches during error rendering fixes #123457 also some test suite cleanups to make backtraces easier to read
2024-04-16Auto merge of #123537 - compiler-errors:shallow, r=lcnrbors-17/+16
Simplify shallow resolver to just fold ty/consts Probably faster than using a whole folder?
2024-04-16Add simple async drop glue generationzetanumbers-1/+117
Explainer: https://zetanumbers.github.io/book/async-drop-design.html https://github.com/rust-lang/rust/pull/121801
2024-04-16Don't ICE for kind mismatches during error renderingOli Scherer-0/+3
2024-04-16Fail candidate assembly for erroneous typesGurinder Singh-1/+12
Trait predicates for types which have errors may still evaluate to OK leading to downstream ICEs. Now we return a selection error for such types in candidate assembly and thereby prevent such issues
2024-04-16Avoid lots of `hir::HirId{,Map,Set}` qualifiers.Nicholas Nethercote-2/+2
Because they're a bit redundant.
2024-04-16Avoid unnecessary `rustc_span::DUMMY_SP` usage.Nicholas Nethercote-5/+4
In some cases `DUMMY_SP` is already imported. In other cases this commit adds the necessary import, in files where `DUMMY_SP` is used more than once.
2024-04-15Make array suggestions slightly more accurateMichael Goulet-3/+10
2024-04-15Use /* value */ as a placeholderMichael Goulet-1/+1
2024-04-16Rollup merge of #123016 - compiler-errors:no-type-var-origin, r=lcnrLeón Orell Valerian Liehr-47/+25
Remove `TypeVariableOriginKind` and `ConstVariableOriginKind` It's annoying to have to import `TypeVariableOriginKind` just to fill it with `MiscVariable` for almost every use. Every other usage other than `TypeParameterDefinition` wasn't even used -- I can see how it may have been useful once for debugging, but I do quite a lot of typeck debugging and I've never really needed it. So let's just remove it, and keep around the only useful thing which is the `DefId` of the param for `var_for_def`. This is based on #123006, which removed the special use of `TypeVariableOriginKind::OpaqueInference`, which I'm pretty sure I was the one that added. r? lcnr or re-roll to types
2024-04-15Simplify shallow resolver to just fold ty/constsMichael Goulet-17/+16
2024-04-15Remove ConstVariableOriginKindMichael Goulet-10/+4
2024-04-15Remove TypeVariableOriginKindMichael Goulet-37/+21
2024-04-15Rollup merge of #123924 - compiler-errors:tuple-sugg, r=estebankMichael Goulet-0/+56
Fix various bugs in `ty_kind_suggestion` Consolidates two implementations of `ty_kind_suggestion` Fixes some misuse of the empty param-env Fixes a problem where we suggested `(42)` instead of `(42,)` for tuple suggestions Suggest a value when `return;`, making it consistent with `break;` Fixes #123906
2024-04-15Rollup merge of #123900 - compiler-errors:nobound, r=lcnrMichael Goulet-23/+20
Stop using `PolyTraitRef` for closure/coroutine predicates already instantiated w placeholders r? lcnr
2024-04-15PolyTraitRefs -> TraitRefsMichael Goulet-9/+4
2024-04-15Stop using PolyTraitRef for closure/coroutine predicates already ↵Michael Goulet-24/+26
instantiated w placeholders
2024-04-14Rollup merge of #123618 - compiler-errors:overflow-ambig, r=spastorinoGuillaume Gomez-6/+18
Discard overflow obligations in `impl_may_apply` Hacky fix for #123493. Throws away obligations that are overflowing in `impl_may_apply` when we recompute if an impl applies, since those will lead to fatal overflow if processed during fulfillment. Something about #114811 (I think it's the predicate reordering) caused us to evaluate predicates differently in error reporting leading to fatal overflow, though I believe the underlying overflow is possible to hit since this code was rewritten to use fulfillment. Fixes #123493
2024-04-14Fix 1-tuple value suggestionMichael Goulet-5/+4
2024-04-14Fix value suggestion for array in generic contextMichael Goulet-5/+4
2024-04-14Consolidate two copies of ty_kind_suggestionMichael Goulet-0/+58
2024-04-09Add a helper for extending a span to include any trailing whitespaceMichael Goulet-6/+2
2024-04-09Rollup merge of #123662 - compiler-errors:no-upvars-yet, r=oli-obkGuillaume Gomez-35/+47
Don't rely on upvars being assigned just because coroutine-closure kind is assigned Previously, code relied on the implicit assumption that if a coroutine-closure's kind variable was constrained, then its upvars were also constrained. This is because we assign all of them at once at the end up upvar analysis. However, there's another way that a coroutine-closure's kind can be constrained: from a signature hint in closure signature deduction. After #123350, we use these hints, which means the implicit assumption above no longer holds. This PR adds the necessary checks so that we don't ICE. r? oli-obk
2024-04-08Don't rely on upvars being assigned just because coroutine-closure kind is ↵Michael Goulet-35/+47
assigned
2024-04-08Auto merge of #122077 - oli-obk:eager_opaque_checks4, r=lcnrbors-56/+68
Pass list of defineable opaque types into canonical queries This eliminates `DefiningAnchor::Bubble` for good and brings the old solver closer to the new one wrt cycles and nested obligations. At that point the difference between `DefiningAnchor::Bind([])` and `DefiningAnchor::Error` was academic. We only used the difference for some sanity checks, which actually had to be worked around in places, so I just removed `DefiningAnchor` entirely and just stored the list of opaques that may be defined. fixes #108498 fixes https://github.com/rust-lang/rust/issues/116877 * [x] run crater - https://github.com/rust-lang/rust/pull/122077#issuecomment-2013293931
2024-04-08Rollup merge of #123578 - lqd:regression-123275, r=compiler-errorsMatthias Krüger-3/+47
Restore `pred_known_to_hold_modulo_regions` As requested by `@lcnr` in https://github.com/rust-lang/rust/issues/123275#issuecomment-2031885563 this PR restores `pred_known_to_hold_modulo_regions` to fix that "unexpected unsized tail" beta regression. This also adds the reduced repro from https://github.com/rust-lang/rust/issues/123275#issuecomment-2041222851 as a sub-optimal test is better than no test at all, and it'll also cover #108721. It still ICEs on master, even though https://github.com/phlip9/rustc-warp-ice doesn't on nightly anymore, since https://github.com/rust-lang/rust/pull/122493. Fixes #123275. r? `@compiler-errors` but feel free to close if you'd rather have a better test instead cc `@wesleywiser` who had signed up to do the revert Will need a backport if we go with this PR: `@rustbot` label +beta-nominated
2024-04-08Rollup merge of #123367 - jswrenn:layoutify, r=compiler-errorsMatthias Krüger-16/+58
Safe Transmute: Compute transmutability from `rustc_target::abi::Layout` In its first step of computing transmutability, `rustc_transmutability` constructs a byte-level representation of type layout (`Tree`). Previously, this representation was computed for ADTs by inspecting the ADT definition and performing our own layout computations. This process was error-prone, verbose, and limited our ability to analyze many types (particularly default-repr types). In this PR, we instead construct `Tree`s from `rustc_target::abi::Layout`s. This helps ensure that layout optimizations are reflected our analyses, and increases the kinds of types we can now analyze, including: - default repr ADTs - transparent unions - `UnsafeCell`-containing types Overall, this PR expands the expressvity of `rustc_transmutability` to be much closer to the transmutability analysis performed by miri. Future PRs will work to close the remaining gaps (e.g., support for `Box`, raw pointers, `NonZero*`, coroutines, etc.). r? `@compiler-errors`
2024-04-08Compute transmutability from `rustc_target::abi::Layout`Jack Wrenn-16/+58
In its first step of computing transmutability, `rustc_transmutability` constructs a byte-level representation of type layout (`Tree`). Previously, this representation was computed for ADTs by inspecting the ADT definition and performing our own layout computations. This process was error-prone, verbose, and limited our ability to analyze many types (particularly default-repr types). In this PR, we instead construct `Tree`s from `rustc_target::abi::Layout`s. This helps ensure that layout optimizations are reflected our analyses, and increases the kinds of types we can now analyze, including: - default repr ADTs - transparent unions - `UnsafeCell`-containing types Overall, this PR expands the expressvity of `rustc_transmutability` to be much closer to the transmutability analysis performed by miri. Future PRs will work to close the remaining gaps (e.g., support for `Box`, raw pointers, `NonZero*`, coroutines, etc.).
2024-04-08Avoid fetching the opaque type origin when only "is this in the defining ↵Oli Scherer-7/+4
scope" is actually needed
2024-04-08Eliminate `DefiningAnchor` now that is just a single-variant enumOli Scherer-1/+1
2024-04-08Scrape extraneous regions from ↵Oli Scherer-43/+60
instantiate_nll_query_response_and_region_obligations
2024-04-08Pass list of defineable opaque types into canonical queriesOli Scherer-6/+4
2024-04-08Actually create ranged int types in the type system.Oli Scherer-8/+51
2024-04-07Discard overflow obligations in impl_may_applyMichael Goulet-6/+18
2024-04-06Revert "remove `pred_known_to_hold_modulo_regions`"Rémy Rakic-3/+47
This reverts commit 399a258f46074740862568b124c02f7b7d04638c.
2024-04-06Add a debug asserts call to match_projection_projections to ensure invariantSantiago Pastorino-0/+2
2024-04-06Auto merge of #123471 - compiler-errors:match_projection_projections, r=oli-obkbors-0/+3
Check def id before calling `match_projection_projections` When I "inlined" `assemble_candidates_from_predicates` into `for_each_item_bound` in #120584, I forgot to copy over the check that actually made sure the def id of the candidate was equal to the def id of the obligation. This means that we normalize goal a bit too often even if it's not productive to do so. This PR adds that def id check back. Fixes #123448
2024-04-05Auto merge of #122747 - Urgau:non-local-defs_perfect_impl, r=lcnrbors-12/+24
Implement T-types suggested logic for perfect non-local impl detection This implement [T-types suggested logic](https://github.com/rust-lang/rust/issues/121621#issuecomment-1976826895) for perfect non-local impl detection: > for each impl, instantiate all local types with inference vars and then assemble candidates for that goal, if there are more than 1 (non-private impls), it does not leak This extension to the current logic is meant to address issues reported in https://github.com/rust-lang/rust/issues/121621. This PR also re-enables the lint `non_local_definitions` to warn-by-default. Implementation was discussed in this [zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/144729-t-types/topic/Implementing.20new.20non-local.20impl.20defs.20logic). Fixes https://github.com/rust-lang/rust/issues/121621 Fixes https://github.com/rust-lang/rust/issues/121746 r? `@lcnr` *(feel free to re-roll)*
2024-04-05Expose rustc_trait_selection::error_reporting::ambiguity moduleUrgau-12/+13
2024-04-05Take the polarity into account in compute_applicable_implsUrgau-0/+11
2024-04-05Rollup merge of #123496 - lcnr:wf-ping, r=compiler-errorsGuillaume Gomez-2/+0
ping on wf changes, remove fixme extend core type system pings to `wf.rs` r? `@compiler-errors`
2024-04-05Rollup merge of #122894 - compiler-errors:downgrade, r=lcnrGuillaume Gomez-4/+5
Move check for error in impl header outside of reporting Fixes #121006 r? lcnr test location kinda sucks, can move it if needed