about summary refs log tree commit diff
path: root/compiler/rustc_infer/src
AgeCommit message (Collapse)AuthorLines
2022-06-27outside of borrowck, do not provide an implicit_region_boundlcnr-11/+7
see comment added to the field in `VerifyBoundCx`.
2022-06-27Remove a back-compat hack on lazy TAITYuki Okushi-8/+6
2022-06-25Rollup merge of #98311 - eggyal:reverse-folder-hierarchy, r=jackh726Matthias Krüger-4/+2
Reverse folder hierarchy #91318 introduced a trait for infallible folders distinct from the fallible version. For some reason (completely unfathomable to me now that I look at it with fresh eyes), the infallible trait was a supertrait of the fallible one: that is, all fallible folders were required to also be infallible. Moreover the `Error` associated type was defined on the infallible trait! It's so absurd that it has me questioning whether I was entirely sane. This trait reverses the hierarchy, so that the fallible trait is a supertrait of the infallible one: all infallible folders are required to also be fallible (which is a trivial blanket implementation). This of course makes much more sense! It also enables the `Error` associated type to sit on the fallible trait, where it sensibly belongs. There is one downside however: folders expose a `tcx` accessor method. Since the blanket fallible implementation for infallible folders only has access to a generic `F: TypeFolder`, we need that trait to expose such an accessor to which we can delegate. Alternatively it's possible to extract that accessor into a separate `HasTcx` trait (or similar) that would then be a supertrait of both the fallible and infallible folder traits: this would ensure that there's only one unambiguous `tcx` method, at the cost of a little additional boilerplate. If desired, I can submit that as a separate PR. r? ````@jackh726````
2022-06-24Auto merge of #98109 - nikomatsakis:issue-98095, r=jackh726bors-100/+373
fix universes in the NLL type tests In the NLL code, we were not accommodating universes in the `type_test` logic. Fixes #98095. r? `@compiler-errors` This breaks some tests, however, so the purpose of this branch is more explanatory and perhaps to do a crater run.
2022-06-23run `x.py fmt`Niko Matsakis-5/+1
2022-06-23remove misleading commentNiko Matsakis-4/+1
per aliemjay's suggestion
2022-06-23try to clarify confusing commentNiko Matsakis-1/+9
2022-06-23normalize if-eq bounds before testingNiko Matsakis-1/+2
Hat-tip: aliemjay
2022-06-23apply suggestions from oli-obkNiko Matsakis-7/+7
Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
2022-06-23coallesce docsNiko Matsakis-65/+32
2022-06-23rename IfEqBound to IfEqNiko Matsakis-7/+7
2022-06-23remove VerifyBound::IfEq variantNiko Matsakis-36/+31
2022-06-22Rollup merge of #97818 - compiler-errors:rpit-error-spanned, r=oli-obkYuki Okushi-3/+7
Point at return expression for RPIT-related error Certainly this needs some diagnostic refining, but I wanted to show that it was possible first and foremost. Not sure if this is the right approach. Open to feedback. Fixes #80583
2022-06-21Point at return expression for RPIT-related errorMichael Goulet-3/+7
2022-06-22Rollup merge of #97867 - lcnr:lub-binder, r=oli-obkYuki Okushi-12/+28
lub: don't bail out due to empty binders allows for the following to compile. The equivalent code using `struct Wrapper<'upper>(fn(&'upper ());` already compiles on stable. ```rust let _: fn(&'upper ()) = match v { true => lt_in_fn::<'a>(), false => lt_in_fn::<'b>(), }; ``` see https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=7034a677190110941223cafac6632f70 for a complete example r? ```@rust-lang/types```
2022-06-21Reverse folder hierarchyAlan Egerton-4/+2
#91318 introduced a trait for infallible folders distinct from the fallible version. For some reason (completely unfathomable to me now that I look at it with fresh eyes), the infallible trait was a supertrait of the fallible one: that is, all fallible folders were required to also be infallible. Moreover the `Error` associated type was defined on the infallible trait! It's so absurd that it has me questioning whether I was entirely sane. This trait reverses the hierarchy, so that the fallible trait is a supertrait of the infallible one: all infallible folders are required to also be fallible (which is a trivial blanket implementation). This of course makes much more sense! It also enables the `Error` associated type to sit on the fallible trait, where it sensibly belongs. There is one downside however: folders expose a `tcx` accessor method. Since the blanket fallible implementation for infallible folders only has access to a generic `F: TypeFolder`, we need that trait to expose such an accessor to which we can delegate. Alternatively it's possible to extract that accessor into a separate `HasTcx` trait (or similar) that would then be a supertrait of both the fallible and infallible folder traits: this would ensure that there's only one unambiguous `tcx` method, at the cost of a little additional boilerplate. If desired, I can submit that as a separate PR. r? @jackh726
2022-06-21Avoid an ICE and instead let the compiler report a useful errorOli Scherer-1/+5
2022-06-15generalize the outlives obligation codeNiko Matsakis-31/+94
The code now accepts `Binder<OutlivesPredicate>` instead of just `OutlivesPredicate` and thus exercises the new, generalized `IfEqBound` codepaths. Note though that we never *produce* Binder<OutlivesPredicate>, so we are only testing a subset of those codepaths that excludes actual higher-ranked outlives bounds.
2022-06-15improved debug outputNiko Matsakis-5/+2
2022-06-15remove compare-fn and use erased-tyNiko Matsakis-17/+23
2022-06-15simplify argument type for to take param-tyNiko Matsakis-6/+4
we don't really take other things
2022-06-15implement (unused) matching solverNiko Matsakis-2/+248
2022-06-15simply the IfEq bound -- we only ever use a regionNiko Matsakis-7/+6
the excessive generality becomes annoying later because it wouldn't implement type folding etc
2022-06-15Rollup merge of #98110 - cjgillot:closure-brace, r=Aaron1011Yuki Okushi-6/+8
Make `ExprKind::Closure` a struct variant. Simple refactor since we both need it to introduce additional fields in `ExprKind::Closure`. r? ``@Aaron1011``
2022-06-14implement valtrees as the type-system representation for constant valuesb-naber-3/+25
2022-06-14Rollup merge of #97935 - nnethercote:rename-ConstS-val-as-kind, r=lcnrDylan DPC-20/+20
Rename the `ConstS::val` field as `kind`. And likewise for the `Const::val` method. Because its type is called `ConstKind`. Also `val` is a confusing name because `ConstKind` is an enum with seven variants, one of which is called `Value`. Also, this gives consistency with `TyS` and `PredicateS` which have `kind` fields. The commit also renames a few `Const` variables from `val` to `c`, to avoid confusion with the `ConstKind::Value` variant. r? `@BoxyUwU`
2022-06-14Auto merge of #98041 - jackh726:remove-regionckmode, r=oli-obkbors-46/+34
Remove RegionckMode in favor of calling new skip_region_resolution Simple cleanup. We can skip a bunch of stuff for places where NLL does the region checking, so skip earlier. r? rust-lang/types
2022-06-14Rename the `ConstS::val` field as `kind`.Nicholas Nethercote-20/+20
And likewise for the `Const::val` method. Because its type is called `ConstKind`. Also `val` is a confusing name because `ConstKind` is an enum with seven variants, one of which is called `Value`. Also, this gives consistency with `TyS` and `PredicateS` which have `kind` fields. The commit also renames a few `Const` variables from `val` to `c`, to avoid confusion with the `ConstKind::Value` variant.
2022-06-13remove unnecessary `to_string` and `String::new`Takayuki Maeda-13/+13
2022-06-13Remove RegionckMode in favor of calling new skip_region_resolutionJack Huey-46/+34
2022-06-12Rollup merge of #98012 - compiler-errors:poly-trait-refs-are-traits, r=cjgillotDylan DPC-1/+3
`ValuePairs::PolyTraitRefs` should be called "trait"s in type error diagnostics Pretty simple, we already do this for `ValuePairs::TraitRefs`...
2022-06-11Make is_suggestable work on all TypeFoldableMichael Goulet-5/+1
2022-06-11Handle empty where-clause betterMichael Goulet-9/+4
2022-06-11ValuePairs::PolyTraitRefs should be called 'trait'Michael Goulet-1/+3
2022-06-12Make `ExprKind::Closure` a struct variant.Camille GILLOT-6/+8
2022-06-11remove an unnecessary format macroTakayuki Maeda-5/+2
2022-06-11Rollup merge of #97967 - BoxyUwU:at_docs_mention_trace, r=compiler-errorsDylan DPC-0/+21
Mention `infer::Trace` methods on `infer::At` methods' docs I missed that you could do `infcx.at(...).trace(...).eq(a, b)` when `a` and `b` dont implement `ToTrace` but does implement `Relate` these docs would have helped see that :sweat_smile:
2022-06-11Rollup merge of #97703 - lcnr:post-89862, r=estebankDylan DPC-73/+31
some additional `need_type_info.rs` cleanup also fixes #97698, fixes #97806 cc `@estebank`
2022-06-10the day that i make a PR without a tidy error..Ellen-7/+7
2022-06-10aEllen-0/+21
2022-06-10use FxHashMap instead of BTreeMaplcnr-4/+3
2022-06-10eagerly check whether we replace any bound varslcnr-24/+15
2022-06-10update higher_ranked_sub docslcnr-27/+35
2022-06-10bound_vars -> infer: don't return lt maplcnr-5/+3
2022-06-10replace bound vars: make caching explicitlcnr-23/+34
2022-06-09rewrite combine doc commentlcnr-23/+23
2022-06-08add test + don't warn on `Res::SelfTy`lcnr-0/+3
2022-06-08lub: don't bail out due to empty binderslcnr-12/+28
2022-06-08need_type_info: don't ICE when detected ty aliaslcnr-6/+15
fixes #97698
2022-06-08dedup diagnostics default params handlinglcnr-67/+13