summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src/traits
AgeCommit message (Collapse)AuthorLines
2023-05-25update recursion depth in `confirm_candidate`lcnr-0/+6
(cherry picked from commit 1708ad65a45fa39aa177c5f015415a9440c18912)
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 #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-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-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-5/+28
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-5/+28
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-2/+2
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-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-11Split implied and super predicate queriesMichael Goulet-1/+1
2023-04-11Check for body owner falliblyMichael Goulet-1/+1
2023-04-10Fix typos in compilerDaniPopes-2/+2
2023-04-10Report overflows gracefully with new solverMichael Goulet-5/+28
2023-04-09Auto merge of #109413 - compiler-errors:pointer-like-abi, r=cjgillotbors-8/+7
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-19/+15
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-8/+7
2023-04-07Switched provisional evaluation cache map to FxIndexMap, and replaced ↵Andrew Xie-15/+9
map.drain_filter with map.retain
2023-04-06Remove index from BrAnonJack Huey-2/+2
2023-04-06Use BoundTy and BoundRegion instead of kind of PlaceholderTy and ↵Jack Huey-3/+3
PlaceholderRegion
2023-04-06Get rid of elaborate_trait_ref{s} tooMichael Goulet-3/+4
2023-04-06Make elaborator genericMichael Goulet-18/+13
2023-04-04Auto merge of #109917 - compiler-errors:remove-relation-methods, r=oli-obkbors-8/+0
Remove `intercrate` and `mark_ambiguous` from `TypeRelation` Fixes #109863 Pulls this logic into `super_combine_tys`, which has access to `InferCtxt` and takes a `ObligationEmittingRelation` -- both of which simplify the logic here. r? `@oli-obk` `@aliemjay`
2023-04-04Remove intercrate and mark_ambiguous from RelationMichael Goulet-8/+0
2023-04-03Never consider int and float vars for `FnPtr` candidatesNilstrieb-8/+14
This solves a regression where `0.0.cmp()` was ambiguous when a custom trait with a `cmp` method was in scope. FOr integers it shouldn't be a problem in practice so I wasn't able to add a test.
2023-04-02Rollup merge of #109846 - matthiaskrgr:clippy2023_04_III, r=NilstriebNilstrieb-3/+1
more clippy::complexity fixes (iter_kv_map, map_flatten, nonminimal_bool)
2023-04-01use and_then/flat_map for map().flatten()Matthias Krüger-3/+1
2023-04-01a couple clippy::complexity fixesMatthias Krüger-3/+2
map_identity filter_next option_as_ref_deref unnecessary_find_map redundant_slicing unnecessary_unwrap bool_comparison derivable_impls manual_flatten needless_borrowed_reference
2023-03-30Update `ty::VariantDef` to use `IndexVec<FieldIdx, FieldDef>`Scott McMurray-0/+1
And while doing the updates for that, also uses `FieldIdx` in `ProjectionKind::Field` and `TypeckResults::field_indices`. There's more places that could use it (like `rustc_const_eval` and `LayoutS`), but I tried to keep this PR from exploding to *even more* places. Part 2/? of https://github.com/rust-lang/compiler-team/issues/606
2023-03-29Inline and remove `SelectionContext::fast_reject_trait_refs`.Nicholas Nethercote-18/+4
Because it has a single call site, and it lets us move a small amount of the work outside the loop.
2023-03-29Introduce `DeepRejectCtxt::substs_refs_may_unify`.Nicholas Nethercote-4/+7
It factors out a repeated code pattern.
2023-03-28Auto merge of #109692 - Nilstrieb:rollup-hq65rps, r=Nilstriebbors-85/+93
Rollup of 8 pull requests Successful merges: - #91793 (socket ancillary data implementation for FreeBSD (from 13 and above).) - #92284 (Change advance(_back)_by to return the remainder instead of the number of processed elements) - #102472 (stop special-casing `'static` in evaluation) - #108480 (Use Rayon's TLV directly) - #109321 (Erase impl regions when checking for impossible to eagerly monomorphize items) - #109470 (Correctly substitute GAT's type used in `normalize_param_env` in `check_type_bounds`) - #109562 (Update ar_archive_writer to 0.1.3) - #109629 (remove obsolete `givens` from regionck) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-03-28Auto merge of #108080 - oli-obk:FnPtr-trait, r=lcnrbors-12/+162
Add a builtin `FnPtr` trait that is implemented for all function pointers r? `@ghost` Rebased version of https://github.com/rust-lang/rust/pull/99531 (plus adjustments mentioned in the PR). If perf is happy with this version, I would like to land it, even if the diagnostics fix in 9df8e1befb5031a5bf9d8dfe25170620642d3c59 only works for `FnPtr` specifically, and does not generally improve blanket impls.
2023-03-28Rollup merge of #109629 - aliemjay:remove-givens, r=lcnrnils-7/+7
remove obsolete `givens` from regionck Revives #107376. The only change is the last commit (https://github.com/rust-lang/rust/pull/109629/commits/2a3177a8bcc4c5a5285dc2908a0f1ce98e9a6377) which should fix the regression. Fixes https://github.com/rust-lang/rust/issues/106567 r? `@lcnr`
2023-03-28Rollup merge of #102472 - lcnr:static-in-eval, r=jackh726nils-78/+86
stop special-casing `'static` in evaluation fixes #102360 I have no idea whether this actually removed all places where `'static` matters. Without canonicalization it's very easy to accidentally rely on `'static` again. Blocked on changing the `order_dependent_trait_objects` future-compat lint to a hard error r? `@nikomatsakis`
2023-03-27Some tracing/instrument cleanupsOli Scherer-6/+3
2023-03-27Add a builtin `FnPtr` traitlcnr-6/+159
2023-03-26Don't elaborate non-obligations into obligationsMichael Goulet-38/+33
2023-03-26resolve regions before implied boundsAli MJ Al-Nasrawy-5/+7
2023-03-26remove obsolete `givens` from regionckAli MJ Al-Nasrawy-2/+0
2023-03-24Auto merge of #109547 - matthiaskrgr:rollup-zczqgdk, r=matthiaskrgrbors-24/+27
Rollup of 9 pull requests Successful merges: - #108629 (rustdoc: add support for type filters in arguments and generics) - #108924 (panic_immediate_abort requires abort as a panic strategy) - #108961 (Refine error spans for const args in hir typeck) - #108986 (sync LVI tests) - #109142 (Add block-based mutex unlocking example) - #109368 (fix typo in the creation of OpenOption for RustyHermit) - #109493 (Return nested obligations from canonical response var unification) - #109515 (Add AixLinker to support linking on AIX) - #109536 (resolve: Rename some cstore methods to match queries and add comments) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-03-24Rollup merge of #109493 - compiler-errors:new-solver-vars-obligations, r=lcnrMatthias Krüger-22/+15
Return nested obligations from canonical response var unification Handle alias-eq obligations being emitted from `instantiate_and_apply_query_response` in: * `EvalCtxt` - by processing the nested obligations in the next loop by `new_goals` * `FulfillCtxt` - by adding the nested obligations to the fulfillment's pending obligations * `InferCtxt::evaluate_obligation` - ~~by returning `EvaluationResult::EvaluatedToAmbig` (boo :-1:, see the FIXME)~~ same behavior as above, since we use fulfillment and `select_where_possible` The only one that's truly sketchy is `evaluate_obligation`, but it's not hard to modify this behavior moving forward. From #109037, I think a smaller repro could be crafted if I were smarter, but I am not, so I just took this from #105878. r? `@lcnr` cc `@BoxyUwU`
2023-03-24Rollup merge of #108961 - compiler-errors:refine-ct-errors, r=BoxyUwUMatthias Krüger-2/+12
Refine error spans for const args in hir typeck Improve just a couple of error messages having to do with mismatched consts. r? `@ghost` i'll put this up when the dependent commits are merged
2023-03-23Auto merge of #109202 - compiler-errors:new-solver-fast-reject-faster-2, r=lcnrbors-19/+9
Don't pass `TreatProjections` separately to `fast_reject` Don't pass `TreatProjections` separately to `fast_reject`, and instead use the original approach of switching on two variants of `TreatParams` (undoes this: https://github.com/rust-lang/rust/pull/108830#pullrequestreview-1330371417). Fixes the regression introduced in https://github.com/rust-lang/rust/pull/108830#issuecomment-1468116419
2023-03-23Use fulfillment in InferCtxt::evaluate_obligationMichael Goulet-30/+15