about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection
AgeCommit message (Collapse)AuthorLines
2023-01-11Hide more of long types in E0271Esteban Küber-7/+46
Fix #40186.
2023-01-11Use the root trait predicate to determine whether to remove referencesEsteban Küber-0/+8
Fix #84837.
2023-01-11fix rebaseEsteban Küber-2/+1
2023-01-11Account for type paramsEsteban Küber-29/+59
2023-01-11Make `&`-removal suggestion verboseEsteban Küber-24/+47
2023-01-11Move autoderef to rustc_hir_analysisMichael Goulet-255/+24
2023-01-11Rollup merge of #106705 - compiler-errors:new-solver-err-properly, r=lcnrMatthias Krüger-11/+25
Report fulfillment errors in new trait solver Causes fewer ICEs when testing the new solver :smile:
2023-01-11Rollup merge of #106703 - compiler-errors:impl-derived-span, r=estebankMatthias Krüger-4/+24
Note predicate span on `ImplDerivedObligation` Seems obvious to point out the where-clause that introduces the `ImplDerivedObligation` :) r? `@estebank`
2023-01-11Filter impl and where-clause candidates that reference errorsMichael Goulet-1/+5
2023-01-11Handle inference variables in CollectAllMismatches correctlyMichael Goulet-5/+8
2023-01-11Note predicate span on ImplDerivedObligationMichael Goulet-4/+24
2023-01-11Report fulfillment errors in new trait solverMichael Goulet-11/+25
2023-01-11Rollup merge of #106397 - compiler-errors:new-solver-impl-wc, r=lcnrnils-6/+21
Check `impl`'s `where` clauses in `consider_impl_candidate` in experimental solver Check impl's nested predicates as part of the recursive evaluate in `consider_impl_candidate`. <sub>Unless, for some reason, these are intentionally **not** checked here -- in which case, I really don't understand where they're being checked...<sub> r? ```@lcnr```
2023-01-11Change `src/test` to `tests` in source files, fix tidy and testsAlbert Larsan-4/+4
2023-01-11Rollup merge of #106521 - oskgo:remove-E0280, r=jackh726Yuki Okushi-7/+11
remove E0280 After looking at #61137 I tried my hand at E0280. I'm unable to find a reasonable example that emits the error. There are a couple of old examples that compile with the current compiler ([#26217](https://github.com/rust-lang/rust/issues/26217), [#42114](https://github.com/rust-lang/rust/issues/42114), [#27113](https://github.com/rust-lang/rust/issues/27113)) and there is a [bug with chalk](https://github.com/rust-lang/rust/blob/b7cdb635c4b973572307ad288466fba64533369c/src/test/ui/chalkify/bugs/async.rs) that makes it emit the error, with a couple more chalk bugs on zulip. It seems like the error is supposed to be emitted from unfulfilled where bounds, of which two are related to borrow checking (error in where T: 'a or where 'a: 'b) and thus tend to emit errors like "lifetime may not live long enough" from borrow checking instead. The final case is with type equality constraints (where <T as Iterator>::Item == u32), which is unimplemented ([#20041](https://github.com/rust-lang/rust/issues/20041)). That such different problems are supposed to have the same error code also seems strange to me. Since the error seems to only be emitted when using chalk I propose to remove it and replace it with an ICE instead. A crater run might be warranted. Pinging `@jackh726` due to removal of chalk test that now ICEs.
2023-01-10remove E0280 and ICE insteadbowlerman-7/+11
2023-01-10Rollup merge of #106204 - compiler-errors:no-take-opaques-in-compare, r=oli-obkYuki Okushi-3/+0
No need to take opaques in `check_type_bounds` `InferCtxt` already has its defining use anchor set to err r? ``@oli-obk``
2023-01-09Assert defining anchor is set in take_opaque_typesMichael Goulet-3/+0
2023-01-09Check impl's where clauses in consider_impl_candidate in experimental solverMichael Goulet-6/+21
2023-01-09Rollup merge of #106389 - compiler-errors:no-canonicalized, r=lcnrfee1-dead-41/+41
Simplify some canonical type alias names * delete the `Canonicalized<'tcx>` type alias in favor for `Canonical<'tcx>` * `CanonicalizedQueryResponse` -> `CanonicalQueryResponse` I don't particularly care about the latter, but it should be consistent. We could alternatively delete the first alias and rename the struct to `Canonicalized`, and then keep the name of `CanonicalizedQueryResponse` untouched.
2023-01-09Rollup merge of #105655 - RedDocMD:bug-105645, r=oli-obkfee1-dead-0/+7
Remove invalid case for mutable borrow suggestion If we have a call such as `foo(&mut buf)` and after reference collapsing the type is inferred as `&T` where-as the required type is `&mut T`, don't suggest `foo(&mut mut buf)`. This is wrong syntactically and the issue lies elsewhere, not in the borrow. Fixes #105645
2023-01-09Clean upkadmin-23/+9
Simplify match statement Add multiple tests - 1 test for checking `N + 1 + 1` does not unify with `N+1` - 2 tests for checking that a function that uses two parameters only returns the parameter that is actually used. - Check exact repeat predicates
2023-01-09Check for duplicateskadmin-3/+15
2023-01-09Set !const_evaluatable if ambig. and not inferredkadmin-12/+10
This prevents an ICE due to a value not actually being evaluatable later.
2023-01-09Change based on commentskadmin-7/+26
Instead of just switching to a probe, check for different matches, and see how many there are. If one, unify it, otherwise return true and let it be unified later.
2023-01-09Change commit_if_ok to probekadmin-8/+3
2023-01-08Rollup merge of #106497 - chenyukang:yukang/fix-106443-sugg-clone, r=estebankMichael Goulet-1/+62
Suggest using clone when we have &T and T implemented Clone Fixes #106443
2023-01-08Add type flags support for Ty and Const late-bound regionsMichael Goulet-4/+3
2023-01-07Auto merge of #106519 - estebank:tail-unit, r=cjgillotbors-19/+107
Detect bindings assigned blocks without tail expressions Fix #44173.
2023-01-06Rollup merge of #106525 - compiler-errors:new-solver-wf, r=jackh726Michael Goulet-2/+2
Report WF error for chalk *and* new solver addressing this nit https://github.com/rust-lang/rust/pull/106385#discussion_r1062571070 No test yet because new solver is currently unusable, lol r? `@lcnr`
2023-01-07use type_implements_trait to check Param cloneyukang-20/+7
2023-01-07comments feedbackyukang-50/+51
2023-01-07Suggest possible clone when we have &Tyukang-2/+75
2023-01-06Rollup merge of #106499 - lyming2007:issue-105946-fix, r=estebankDylan DPC-4/+11
fix [type error] for error E0029 and E0277 check explicitly for the type references error if ty.references_error() is true change the error to be err.delay_as_bug() and prevent the error E0029 and E0277 from emitting out this fix #105946
2023-01-05fix [type error] for error E0029 and E0277Yiming Lei-4/+11
check explicitly for the type references error if ty.references_error() is true change the error to be err.delay_as_bug() and prevent the error E0029 and E0277 from emitting out this fix #105946
2023-01-06Tweak outputEsteban Küber-4/+4
2023-01-06Report WF error for new solver tooMichael Goulet-2/+2
2023-01-06Detect bindings assigned blocks without tail expressions in trait errorsEsteban Küber-19/+107
Address #44173 for trait errors.
2023-01-05Auto merge of #106482 - compiler-errors:rollup-g7n1p39, r=compiler-errorsbors-24/+25
Rollup of 6 pull requests Successful merges: - #105846 (Account for return-position `impl Trait` in trait in `opt_suggest_box_span`) - #106385 (Split `-Zchalk` flag into `-Ztrait-solver=(classic|chalk|next)` flag) - #106403 (Rename `hir::Map::{get_,find_}parent_node` to `hir::Map::{,opt_}parent_id`, and add `hir::Map::{get,find}_parent`) - #106462 (rustdoc: remove unnecessary wrapper around sidebar and mobile logos) - #106464 (Update Fuchsia walkthrough with new configs) - #106478 (Tweak wording of fn call with wrong number of args) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-01-04Rollup merge of #106403 - compiler-errors:rename-hir-methods, r=cjgillotMichael Goulet-13/+11
Rename `hir::Map::{get_,find_}parent_node` to `hir::Map::{,opt_}parent_id`, and add `hir::Map::{get,find}_parent` The `hir::Map::get_parent_node` function doesn't return a `Node`, and I think that's quite confusing. Let's rename it to something that sounds more like something that gets the parent hir id => `hir::Map::parent_id`. Same with `find_parent_node` => `opt_parent_id`. Also, combine `hir.get(hir.parent_id(hir_id))` and similar `hir.find(hir.parent_id(hir_id))` function into new functions that actually retrieve the parent node in one call. This last commit is the only one that might need to be looked at closely.
2023-01-05Auto merge of #105409 - compiler-errors:closure-infer-cycle, r=jackh726bors-1/+20
Don't deduce a signature that makes a closure cyclic Sometimes when elaborating supertrait bounds for closure signature inference, we end up deducing a closure signature that is cyclical because either a parameter or the return type references a projection mentioning `Self` that also has escaping bound vars, which means that it's not eagerly replaced with an inference variable. Interestingly, this is not *just* related to my PR that elaborates supertrait bounds for closure signature deduction. The committed test `supertrait-hint-cycle-3.rs` shows **stable** code that is fixed by this PR: ```rust trait Foo<'a> { type Input; } impl<F: Fn(u32)> Foo<'_> for F { type Input = u32; } fn needs_super<F: for<'a> Fn(<F as Foo<'a>>::Input) + for<'a> Foo<'a>>(_: F) {} fn main() { needs_super(|_: u32| {}); } ``` Fixes #105401 Fixes #105396 r? types
2023-01-04Rename stock solver to classicMichael Goulet-2/+2
2023-01-04Split `-Zchalk` flag into `-Ztrait-solver=(stock|chalk|next)` flagMichael Goulet-11/+14
2023-01-04get_parent and find_parentMichael Goulet-4/+2
2023-01-04rename get_parent_node to parent_idMichael Goulet-11/+11
2023-01-03Simplify some canonical type alias namesMichael Goulet-41/+41
2023-01-03has_overflow only if value is *not* within limitMichael Goulet-1/+1
2023-01-01Merge multiple mutable borrows of immutable binding errorsEsteban Küber-1/+1
Fix #53466.
2022-12-30Auto merge of #106210 - fee1-dead-contrib:const-closure-trait-method, ↵bors-7/+27
r=compiler-errors Allow trait method paths to satisfy const Fn bounds r? `@oli-obk`
2022-12-29Auto merge of #106266 - matthiaskrgr:rollup-cxrdbzy, r=matthiaskrgrbors-4/+10
Rollup of 9 pull requests Successful merges: - #104531 (Provide a better error and a suggestion for `Fn` traits with lifetime params) - #105899 (`./x doc library --open` opens `std`) - #106190 (Account for multiple multiline spans with empty padding) - #106202 (Trim more paths in obligation types) - #106234 (rustdoc: simplify settings, help, and copy button CSS by not reusing) - #106236 (docs/test: add docs and a UI test for `E0514` and `E0519`) - #106259 (Update Clippy) - #106260 (Fix index out of bounds issues in rustdoc) - #106263 (Formatter should not try to format non-Rust files) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup