summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty/sty.rs
AgeCommit message (Collapse)AuthorLines
2023-03-18Don't eagerly convert principal to stringclubby789-0/+6
2023-01-19even more unify Projection/Opaque in outlives codeAli MJ Al-Nasrawy-2/+17
2023-01-18Rollup merge of #107023 - scottmcm:stop-shouting, r=NilstriebMichael Goulet-1/+1
Stop using `BREAK` & `CONTINUE` in compiler Switching them to `Break(())` and `Continue(())` instead. Entirely search-and-replace, though there's one spot where rustfmt insisted on a reformatting too. libs-api would like to remove these constants (https://github.com/rust-lang/rust/pull/102697#issuecomment-1385705202), so stop using them in compiler to make the removal PR later smaller.
2023-01-18Rollup merge of #106718 - lcnr:solver-cycles, r=compiler-errorsDylan DPC-11/+0
finish trait solver skeleton work ### 648d661b4e0fcf55f7082894f577377eb451db4b The previous implementation didn't remove provisional entries which depended on the current goal if we're forced to rerun in case the provisional result of that entry is different from the new result. For reference, see https://rust-lang.github.io/chalk/book/recursive/search_graph.html. We should also treat inductive cycles as overflow, not ordinary ambiguity. ### 219a5de2517cebfe20a2c3417bd302f7c12db70c 6a1912be539dd5a3b3c10be669787c4bf0c1868a These two commits move canonicalization to the start of the queries which simplifies a bunch of stuff. I originally intended to keep stuff canonicalized for a while because I expected us to add a additional caches the trait solver, either for candidate assembly or for projections. We ended up not adding (and expect to not need) any of them so this just ends up being easier to understand. ### d78d5ad0979e965afde6500bccfa119b47063506 adds a special `eq` for the solver which doesn't care about obligations or spans ### 18704e6a78b7703e1bbb3856f015cb76c0a07a06 implements https://rust-lang.zulipchat.com/#narrow/stream/364551-t-types.2Ftrait-system-refactor/topic/projection.20cache r? `@compiler-errors`
2023-01-17Stop using `BREAK` & `CONTINUE` in compilerScott McMurray-1/+1
Switching them to `Break(())` and `Continue(())` instead. libs-api would like to remove these constants, so stop using them in compiler to make the removal PR later smaller.
2023-01-18instantiate canonical vars eagerlylcnr-11/+0
2023-01-18Rollup merge of #106747 - yanchen4791:issue-105507-fix, r=estebankMatthias Krüger-0/+7
Add 'static lifetime suggestion when GAT implied 'static requirement from HRTB Fix for issue #105507 The problem: When generic associated types (GATs) are from higher-ranked trait bounds (HRTB), they are implied 'static requirement (see [Implied 'static requirement from higher-ranked trait bounds](https://blog.rust-lang.org/2022/10/28/gats-stabilization.html#implied-static-requirement-from-higher-ranked-trait-bounds) for more details). If the user did not explicitly specify the `'static` lifetime when using the GAT, the current error message will only point out the type `does not live long enough` where the type is used, but not where the GAT is specified and how to fix the problem. The solution: Add notes at the span where the problematic GATs are specified and suggestions of how to fix the problem by adding `'static` lifetime at the right spans.
2023-01-17Add 'static lifetime suggestion when GAT implied 'static requirement from HRTByanchen4791-0/+7
2023-01-17Rollup merge of #106980 - Nilstrieb:_use_mk_manual_debug_impl_instead, r=lcnrMatthias Krüger-1/+1
Hide `_use_mk_alias_ty_instead` in `<AliasTy as Debug>::fmt`
2023-01-17Rollup merge of #104505 - WaffleLapkin:no-double-spaces-in-comments, r=jackh726Matthias Krüger-1/+1
Remove double spaces after dots in comments Most of the comments do not have double spaces, so I assume these are typos.
2023-01-17Hide `_use_mk_alias_ty_instead` in `<AliasTy as Debug>::fmt`nils-1/+1
2023-01-17Remove double spaces after dots in commentsMaybe Waffle-1/+1
2023-01-15Auto merge of #106742 - compiler-errors:new-solver-make-it-not-ice, r=lcnrbors-2/+88
Implement some FIXME methods in the new trait solver Implement just enough of the solver's response logic to make it not ICE. Also, fix a bug with `no_bound_vars` call failing due to canonical bound vars. r? `@lcnr`
2023-01-12is_ty_infer -> is_ty_or_numeric_inferMichael Goulet-1/+1
2023-01-12HACK: Handle escaping bound vars from the canonical queryMichael Goulet-2/+88
2022-12-23Rollup merge of #105661 - lcnr:evaluate-new, r=compiler-errorsnils-4/+8
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-19implement the skeleton of the updated trait solverlcnr-4/+8
2022-12-18A few small cleanups for `newtype_index`Nilstrieb-3/+2
Remove the `..` from the body, only a few invocations used it and it's inconsistent with rust syntax. Use `;` instead of `,` between consts. As the Rust syntax gods inteded.
2022-12-18Make `#[debug_format]` an attribute in `newtype_index`Nilstrieb-1/+1
This removes the `custom` format functionality as its only user was trivially migrated to using a normal format. If a new use case for a custom formatting impl pops up, you can add it back.
2022-12-14Fix rustdocOli Scherer-1/+1
2022-12-14Remove TraitRef::newOli Scherer-15/+3
2022-12-14Prevent the creation of `TraitRef` without dedicated methodsOli Scherer-7/+12
2022-12-14Ensure no one constructs `AliasTy`s themselvesOli Scherer-0/+4
2022-12-14Rename to match similar methodsOli Scherer-1/+1
2022-12-14Guard `AliasTy` creation against passing the wrong number of substsOli Scherer-4/+2
2022-12-13nit: docsMichael Goulet-3/+12
2022-12-13Combine identical alias armsMichael Goulet-8/+8
2022-12-13Combine projection and opaque into aliasMichael Goulet-6/+9
2022-12-13squash OpaqueTy and ProjectionTy into AliasTyMichael Goulet-21/+18
2022-12-13ProjectionTy.item_def_id -> ProjectionTy.def_idMichael Goulet-11/+11
2022-12-13make Opaque have one field: OpaqueTyMichael Goulet-0/+10
2022-12-13Auto merge of #105612 - oli-obk:bind_rustdoc, r=GuillaumeGomezbors-1/+12
use ty::Binder in rustdoc instead of `skip_binder` r? `@GuillaumeGomez` this is a preliminary cleanup required to be able to normalize correctly/conveniently in rustdoc
2022-12-13Fast path some binder relationsMichael Goulet-2/+2
2022-12-12Avoid trying to normalize unnormalizable typesOli Scherer-1/+4
2022-12-12Round 3: require binders for substsOli Scherer-0/+1
2022-12-12Round 1: add some binders (fails due to losing bound vars and then rebinding ↵Oli Scherer-0/+7
them with `Binder::dummy`)
2022-12-06Rollup merge of #104898 - oli-obk:group_all_the_things, r=wesleywiserMatthias Krüger-1/+1
Put all cached values into a central struct instead of just the stable hash cc `@nnethercote` this allows re-use of the type for Predicate without duplicating all the logic for the non-hash cached fields
2022-12-06Add GenericParamDef::to_error and InternalSubsts::extend_with_errorMichael Goulet-13/+2
2022-12-05Synthesize generics for bad auto traits in dyn typesMichael Goulet-2/+22
2022-11-30Remove TySOli Scherer-1/+1
2022-11-28Rollup merge of #104732 - WaffleLapkin:from_def_idn't, r=compiler-errorsDylan DPC-2/+1
Refactor `ty::ClosureKind` related stuff I've tried to fix all duplication and weirdness, but if I missed something do tell :p r? `@compiler-errors`
2022-11-27Rollup merge of #104976 - WaffleLapkin:move_comments, r=cjgillotMatthias Krüger-1/+1
Prefer doc comments over `//`-comments in compiler Doc comments are generally nicer: they show up in the documentation, they are shown in IDEs when you hover other mentions of items, etc. Thus it makes sense to use them instead of `//`-comments.
2022-11-27Auto merge of #104048 - cjgillot:split-lifetime, r=compiler-errorsbors-1/+3
Separate lifetime ident from lifetime resolution in HIR Drive-by: change how suggested generic args are computed. Fixes https://github.com/rust-lang/rust/issues/103815 I recommend reviewing commit-by-commit.
2022-11-27Prefer doc comments over `//`-comments in compilerMaybe Waffle-1/+1
2022-11-27micro doc fixesMaybe Waffle-2/+1
2022-11-25get rid of to_poly_trait_predicateOli Scherer-17/+0
2022-11-24Use kw::Empty for elided lifetimes in path.Camille GILLOT-1/+3
2022-11-22Use `tcx.require_lang_item` instead of unwrappingMaybe Waffle-1/+2
2022-11-21Stop passing the self-type as a separate argument.Oli Scherer-3/+6
2022-11-21Allow iterators instead of requiring slices that will get turned into iteratorsOli Scherer-3/+3