about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection
AgeCommit message (Collapse)AuthorLines
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
2022-12-29Rollup merge of #106202 - estebank:trim-paths, r=NilstriebMatthias Krüger-4/+10
Trim more paths in obligation types
2022-12-29Rollup merge of #106223 - estebank:suggest-let-ty-borrow, r=compiler-errorsMatthias Krüger-0/+9
On unsized locals with explicit types suggest `&` Fix #72742.
2022-12-29Rollup merge of #106221 - Nilstrieb:rptr-more-like-ref-actually, ↵Matthias Krüger-1/+1
r=compiler-errors Rename `Rptr` to `Ref` in AST and HIR The name makes a lot more sense, and `ty::TyKind` calls it `Ref` already as well.
2022-12-28On unsized locals with explicit types suggest `&`Esteban Küber-0/+9
Fix #72742.
2022-12-28Rename `Rptr` to `Ref` in AST and HIRNilstrieb-1/+1
The name makes a lot more sense, and `ty::TyKind` calls it `Ref` already as well.
2022-12-28Auto merge of #106129 - compiler-errors:compare_method-tweaks, r=BoxyUwUbors-1/+1
Some `compare_method` tweaks 1. Make some of the comparison functions' names more regular 2. Reduce pub scope of some of the things in `compare_method` ~3. Remove some unnecessary opaque type handling code -- `InferCtxt` already is in a mode that doesn't define opaque types~ * moved to a different PR 4. Bubble up `ErrorGuaranteed` for region constraint errors in `compare_method` - Improves a redundant error message in one unit test. 5. Move the `compare_method` module to have a more general name, since it's more like `compare_impl_item` :) 6. Rename `collect_trait_impl_trait_tys`
2022-12-28Allow trait method paths to satisfy const Fn boundsDeadbeef-7/+27
2022-12-28better names and a commentMichael Goulet-1/+1
2022-12-27Trim more paths in obligation typesEsteban Küber-4/+10
2022-12-27Restore cyclic closure messageMichael Goulet-1/+20
2022-12-27Rollup merge of #106151 - TaKO8Ki:remove-unused-imports, r=jackh726fee1-dead-1/+0
Remove unused imports
2022-12-26remove unused importsTakayuki Maeda-1/+0
2022-12-25fix more clippy::style findingsMatthias Krüger-24/+19
match_result_ok obfuscated_if_else single_char_add writeln_empty_string collapsible_match iter_cloned_collect unnecessary_mut_passed
2022-12-24Rollup merge of #105975 - jeremystucki:rustc-remove-needless-lifetimes, r=eholkMatthias Krüger-11/+8
rustc: Remove needless lifetimes
2022-12-23Rollup merge of #105661 - lcnr:evaluate-new, r=compiler-errorsnils-69/+1422
implement the skeleton of the updated trait solver cc ```@rust-lang/initiative-trait-system-refactor``` This is mostly following the architecture discussed in the types team meetup. After discussing the desired changes for the trait solver, we encountered cyclic dependencies between them. Most notably between changing evaluate to be canonical and returning inference constraints. We cannot canonicalize evaluate without returning inference constraints due to coinductive cycles. However, caching inference constraints also relies on canonicalization. Implementing both of these changes at once in-place is not feasible. This somewhat closely mirrors the current `evaluate` implementation with the following notable differences: - it moves `project` into the core solver, allowing us to correctly deal with coinductive projections (will be required for implied bounds, perfect derive) - it changes trait solver overflow to be non-fatal (required to backcompat breakage from changes to the iteration order of nested goals, deferred projection equality, generally very useful) - it returns inference constraints and canonicalizes inputs and outputs (required for a lot things, most notably merging fulfill and evaluate, and deferred projection equality) - it is implemented to work with lazy normalization A lot of things aren't yet implemented, but the remaining FIXMEs should all be fairly self-contained and parallelizable. If the architecture looks correct and is what we want here, I would like to quickly merge this and then split the work. r? ```@compiler-errors``` / ```@rust-lang/types``` :3
2022-12-21Don't call typeck if we have no typeck resultsMichael Goulet-11/+8
This has a 10000000% chance of us causing a cycle if we're not careful
2022-12-21CollectAllMismatches relation should respect int/float infer varsMichael Goulet-7/+20
2022-12-21Rename things to be a bit clearerMichael Goulet-14/+11
2022-12-21Substitute things correctlyMichael Goulet-1/+2
2022-12-21Remove some unnecessary try_map_boundMichael Goulet-8/+2
2022-12-20rustc: Remove needless lifetimesJeremy Stucki-11/+8
2022-12-20dedup assemblylcnr-298/+267
2022-12-19implement the skeleton of the updated trait solverlcnr-69/+1453
2022-12-19Rollup merge of #105882 - compiler-errors:issue-105832, r=jackh726Dylan DPC-5/+3
Don't ICE in closure arg borrow suggestion Fixes #105832
2022-12-19Rollup merge of #105839 - LegionMammal978:mut-upvar-not-send, r=lcnrDylan DPC-17/+22
Suggest a `T: Send` bound for `&mut T` upvars in `Send` generators Right now, we suggest a `T: Sync` bound for both `&T` and `&mut T` upvars. A user on URLO [found this confusing](https://users.rust-lang.org/t/error-complains-about-missing-sync-but-send-is-whats-missing/86021), so I wrote this quick fix to look at the mutability before making the suggestion.
2022-12-18Rollup merge of #105873 - matthiaskrgr:clippy_fmt, r=NilstriebMatthias Krüger-8/+8
use &str / String literals instead of format!()
2022-12-18Rollup merge of #105869 - matthiaskrgr:clone_on_copy, r=compiler-errorsMatthias Krüger-2/+2
don't clone Copy types
2022-12-18Rollup merge of #105867 - matthiaskrgr:rec_param, r=compiler-errorsMatthias Krüger-6/+1
remove redundant fn params that were only "used" in recursion