about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src
AgeCommit message (Collapse)AuthorLines
2023-04-16Rollup merge of #110272 - Ezrashaw:fix-unconned-lt-in-implbounds, r=aliemjayYuki Okushi-1/+12
fix: skip implied bounds if unconstrained lifetime exists Fixes #110161 r? ````@aliemjay````
2023-04-15remove redundant clonesMatthias Krüger-6/+9
2023-04-15Update compiler/rustc_trait_selection/src/traits/outlives_bounds.rsAli MJ Al-Nasrawy-2/+3
2023-04-14implement review suggestionsEzra Shaw-2/+3
2023-04-14Rollup merge of #110299 - kylematsuda:earlybinder-impl-subject, ↵Matthias Krüger-2/+2
r=compiler-errors Switch to `EarlyBinder` for `impl_subject` query Part of the work to finish https://github.com/rust-lang/rust/issues/105779. Several queries `X` have a `bound_X` variant that wraps the output in `EarlyBinder`. This adds `EarlyBinder` to the return type of the `impl_subject` query and removes `bound_impl_subject`. r? ```@lcnr```
2023-04-14Rollup merge of #110207 - compiler-errors:new-solver-unpin, r=lcnrMatthias Krüger-61/+102
Assemble `Unpin` candidates specially for generators in new solver Fixes compiler-errors/next-solver-hir-issues#16 r? ``@lcnr``
2023-04-14Rollup merge of #110180 - lcnr:canonicalize, r=compiler-errorsMatthias Krüger-14/+11
don't uniquify regions when canonicalizing uniquifying causes a bunch of issues, most notably it causes `AliasEq(<?x as Trait<'a>>::Assoc, <?x as Trait<'a>>::Assoc)` to result in ambiguity because both `normalizes-to` paths result in ambiguity and substs equate should trivially succeed but doesn't because we uniquified `'a` to two different regions. I originally added uniquification to make it easier to deal with requirement 6 from the dev-guide: https://rustc-dev-guide.rust-lang.org/solve/trait-solving.html#requirements > ### 6. Trait solving must be (free) lifetime agnostic > > Trait solving during codegen should have the same result as during typeck. As we erase > all free regions during codegen we must not rely on them during typeck. A noteworthy example > is special behavior for `'static`. cc https://github.com/rust-lang/rustc-dev-guide/pull/1671 Relying on regions being identical may cause ICE during MIR typeck, but even without this PR we can end up relying on that as type inference vars can resolve to types which contain an identical region. Let's land this and deal with any ICE that crop up as we go. Will look at this issue again before stabilization. r? ```@compiler-errors```
2023-04-14Rollup merge of #109800 - bryangarza:safe-transmute-improved-errors, ↵Matthias Krüger-24/+104
r=compiler-errors Improve safe transmute error reporting This patch updates the error reporting when Safe Transmute is not possible between 2 types by including the reason. Also, fix some small bugs that occur when computing the `Answer` for transmutability.
2023-04-14Move auto trait built-in candidate disqualification to a separate methodMichael Goulet-77/+101
2023-04-14Assemble Unpin candidates specially for generators in new solverMichael Goulet-1/+18
2023-04-13Improve safe transmute error reportingBryan Garza-24/+104
This patch updates the error reporting when Safe Transmute is not possible between 2 types by including the reason. Also, fix some small bugs that occur when computing the `Answer` for transmutability.
2023-04-13make tcx.impl_subject return EarlyBinder, remove bound_impl_subject, rename ↵Kyle Matsuda-2/+2
usages of bound_impl_subject to impl_subject
2023-04-13change usage of bound_impl_subject to impl_subjectKyle Matsuda-1/+1
2023-04-13Rollup merge of #110193 - compiler-errors:body-owner-issue, r=WaffleLapkinMatthias Krüger-1/+1
Check for body owner fallibly in error reporting Sometimes the "body id" we use for an obligation cause is not actually a body owner, like when we're doing WF checking on items. Fixes #110157
2023-04-13Rollup merge of #110220 - lcnr:regionzz, r=compiler-errorsMatthias Krüger-9/+27
cleanup our region error API - require `TypeErrCtxt` to always result in an error, closing #108810 - move `resolve_regions_and_report_errors` to the `ObligationCtxt` - call `process_registered_region_obligations` in `resolve_regions` - move `resolve_regions` into the `outlives` submodule - add `#[must_use]` to functions returning lists of errors r? types
2023-04-13fix: skip implied bounds if unconstrained lifetime existsEzra Shaw-1/+10
2023-04-13Remove some unused type folders.Nicholas Nethercote-21/+0
I'm surprised the compiler doesn't warn about these. It appears having an `impl` on a struct is enough to avoid a warning about it never being constructed.
2023-04-12Auto merge of #110252 - matthiaskrgr:rollup-ovaixra, r=matthiaskrgrbors-10/+52
Rollup of 8 pull requests Successful merges: - #109810 (Replace rustdoc-ui/{c,z}-help tests with a stable run-make test ) - #110035 (fix: ensure bad `#[test]` invocs retain correct AST) - #110089 (sync::mpsc: synchronize receiver disconnect with initialization) - #110103 (Report overflows gracefully with new solver) - #110122 (Fix x check --stage 1 when download-ci-llvm=false) - #110133 (Do not use ImplDerivedObligationCause for inherent impl method error reporting) - #110135 (Revert "Don't recover lifetimes/labels containing emojis as character literals") - #110235 (Fix `--extend-css` option) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-04-12fix commentlcnr-1/+2
2023-04-12Rollup merge of #110103 - compiler-errors:new-solver-overflows, r=lcnrMatthias Krüger-10/+52
Report overflows gracefully with new solver avoid reporting overflows as ambiguity errors, so that the error message is clearer. r? ```@lcnr```
2023-04-12Rollup merge of #110153 - DaniPopes:compiler-typos, r=NilstriebMatthias Krüger-8/+8
Fix typos in compiler I ran [`typos -w compiler`](https://github.com/crate-ci/typos) to fix typos in the `compiler` directory. Refs #110150
2023-04-12`#[must_use]` for fns returning a list of errorslcnr-1/+5
2023-04-12Auto merge of #107614 - ↵bors-2/+5
compiler-errors:allow-elaborator-to-filter-only-super-traits, r=oli-obk Split implied and super predicate queries, then allow elaborator to filter only supertraits Split the `super_predicates_of` query into a new `implied_predicates_of` query. The former now only returns the *real* supertraits of a trait alias, and the latter now returns the implied predicates (which include all of the `where` clauses of the trait alias). The behavior of these queries is identical for regular traits. Now that the two queries are split, we can add a new filter method to the elaborator, `filter_only_self()`, which can be used in instances that we need only the *supertrait* predicates, such as during the elaboration used in closure signature deduction. This toggles the usage of `super_predicates_of` instead of `implied_predicates_of` during elaboration of a trait predicate. This supersedes #104745, and fixes the four independent bugs identified in that PR. Fixes #104719 Fixes #106238 Fixes #110023 Fixes #109514 r? types
2023-04-12region error cleanuplcnr-8/+21
- require `TypeErrCtxt` to always result in an error - move `resolve_regions_and_report_errors` to the `ObligationCtxt` - merge `process_registered_region_obligations` into `resolve_regions`
2023-04-11Rollup merge of #110126 - compiler-errors:new-solver-safe-transmute, r=oli-obkMichael Goulet-0/+64
Support safe transmute in new solver Basically copies the same implementation as the old solver, but instead of looking for param types, we look for type or const placeholders.
2023-04-11Allow the elaborator to only filter to real supertraitsMichael Goulet-1/+4
2023-04-11Split implied and super predicate queriesMichael Goulet-1/+1
2023-04-11Check for body owner falliblyMichael Goulet-1/+1
2023-04-11don't uniquify regions when canonicalizinglcnr-14/+11
2023-04-10Fix typos in compilerDaniPopes-8/+8
2023-04-10Report overflows gracefully with new solverMichael Goulet-10/+52
2023-04-10Support safe transmute in new solverMichael Goulet-0/+64
2023-04-10Stall auto-trait assembly for int/float vars in new solverMichael Goulet-24/+64
2023-04-10review + some small stufflcnr-10/+16
2023-04-10move `structural_traits` into `assembly`lcnr-11/+9
2023-04-10prioritize param-env candidateslcnr-78/+83
2023-04-09Auto merge of #109413 - compiler-errors:pointer-like-abi, r=cjgillotbors-10/+8
Enforce that `PointerLike` requires a pointer-like ABI At least temporarily, let's ban coercing things that are pointer-sized and pointer-aligned but *not* `Abi::Scalar(..)` into `dyn*`. See: https://github.com/rust-lang/rust/pull/104694#discussion_r1142522073 This can be lifted in the future if we decie that we *want* to be able to coerce something `repr(C)` into a `dyn*`, but we'll have to figure out what to do with Miri and codegen... r? compiler
2023-04-09Auto merge of #110031 - compiler-errors:generic-elaboration, r=b-naberbors-21/+17
Make elaboration generic over input Combines all the `elaborate_*` family of functions into just one, which is an iterator over the same type that you pass in (e.g. elaborating `Predicate` gives `Predicate`s, elaborating `Obligation`s gives `Obligation`s, etc.)
2023-04-08Enforce that PointerLike requires a pointer-like ABIMichael Goulet-10/+8
2023-04-08Remove `remap_env_constness` in queriesDeadbeef-7/+1
2023-04-07Switched provisional evaluation cache map to FxIndexMap, and replaced ↵Andrew Xie-15/+9
map.drain_filter with map.retain
2023-04-06Remove u32 on BoundTyKind::AnonJack Huey-8/+6
2023-04-06Remove index from BrAnonJack Huey-3/+3
2023-04-06Remove expect_anon and expect_anon_placeholder in favor of varJack Huey-1/+1
2023-04-06Use BoundTy and BoundRegion instead of kind of PlaceholderTy and ↵Jack Huey-7/+13
PlaceholderRegion
2023-04-06Get rid of elaborate_trait_ref{s} tooMichael Goulet-3/+4
2023-04-06Make elaborator genericMichael Goulet-20/+15
2023-04-06Rollup merge of #109755 - compiler-errors:new-solver-generator-witness-mir, ↵Matthias Krüger-3/+46
r=cjgillot Implement support for `GeneratorWitnessMIR` in new solver r? ```@cjgillot``` I mostly want this to cut down the number of failing UI tests when running the UI test suite with `--compare-mode=next-solver`, but there doesn't seem like much reason to block implementing this since it adds minimal complexity to the existing structural traits impl in the new solver. If others are against adding this for some reason, then maybe we should just make `GeneratorWitnessMIR` return `NoSolution` for these traits. Anything but an ICE please :smile_cat: :ice_cube:
2023-04-05Rollup merge of #109956 - compiler-errors:tweak-debug-outputs, r=oli-obkYuki Okushi-7/+31
Tweak debug outputs to make debugging new solver easier 1. Move the fields that are "most important" (I know this is subjective) to the beginning of the structs. For goals, I typically care more about the predicate than the param-env (which is significantly longer in debug output). For canonicalized things, I typically care more about what is *being* canonicalized. For a canonical response, I typically care about the response -- or at least, it's typically useful to put it first since it's short and affects the whether the solver recurses or not... 2. Add some more debug and instrument calls to functions to add more structure to tracing lines. r? `@oli-obk` or `@BoxyUwU` (since I think `@lcnr` is on holiday)
2023-04-05Tweak debug outputs to make debugging new solver easierMichael Goulet-7/+31