summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src
AgeCommit message (Collapse)AuthorLines
2022-07-09Make `evaluate_obligation` not succeed unconditionally if it registered new ↵Oli Scherer-0/+5
hidden types for opaque types
2022-06-23Rollup merge of #98365 - jyn514:improve-obligation-errors-review-comments, ↵Michael Goulet-22/+4
r=eholk Address review comments from #98259 It got approved so fast I didn't have time to make changes xD r? ``@eholk``
2022-06-23Rollup merge of #98259 - jyn514:improve-obligation-errors, r=estebankMichael Goulet-12/+93
Greatly improve error reporting for futures and generators in `note_obligation_cause_code` Most futures don't go through this code path, because they're caught by `maybe_note_obligation_cause_for_async_await`. But all generators do, and `maybe_note` is imperfect and doesn't catch all futures. Improve the error message for those it misses. At some point, we may want to consider unifying this with the code for `maybe_note_async_await`, so that `async_await` notes all parent constraints, and `note_obligation` can point to yield points. But both functions are quite complicated, and it's not clear to me how to combine them; this seems like a good incremental improvement. Helps with https://github.com/rust-lang/rust/issues/97332. r? ``@estebank`` cc ``@eholk`` ``@compiler-errors``
2022-06-21Point at return expression for RPIT-related errorMichael Goulet-0/+11
2022-06-21Address review comments from #98259Joshua Nelson-22/+4
It got merged so fast I didn't have time to make changes xD
2022-06-21Rollup merge of #97805 - coolreader18:trace-suggestions, r=oli-obkYuki Okushi-58/+36
Add proper tracing spans to rustc_trait_selection::traits::error_reporting While I was trying to figure out #97704 I did some of this to make the logs more legible, so I figured I'd do the whole module and open a PR with it. afaict this is an ongoing process in the compiler from the log->tracing transition? but lmk if there was a reason for the more verbose forms of logging as they are. Also, for some of the functions with only one log in them, I put the function name as a message for that log instead of `#[instrument]`-ing the whole function with a span? but maybe the latter would actually be preferable, I'm not actually sure.
2022-06-20Auto merge of #97674 - nnethercote:oblig-forest-tweaks, r=nikomatsakisbors-60/+38
Obligation forest tweaks A few minor improvements to the code. r? `@nikomatsakis`
2022-06-20Fix minor documentation typoPeter Hebden-1/+1
Incorrect pluralisation of `crate`
2022-06-19Greatly improve error reporting for futures and generators in ↵Joshua Nelson-12/+93
`note_obligation_cause_code` Most futures don't go through this code path, because they're caught by `maybe_note_obligation_cause_for_async_await`. But all generators do, and `maybe_note` is imperfect and doesn't catch all futures. Improve the error message for those it misses. At some point, we may want to consider unifying this with the code for `maybe_note_async_await`, so that `async_await` notes all parent constraints, and `note_obligation` can point to yield points. But both functions are quite complicated, and it's not clear to me how to combine them; this seems like a good incremental improvement.
2022-06-19Rollup merge of #98136 - fee1-dead-contrib:rename_impl_constness, r=oli-obkDylan DPC-3/+2
Rename `impl_constness` to `constness` The current code is a basis for `is_const_fn_raw`, and `impl_constness` is no longer a valid name, which is previously used for determining the constness of impls, and not items in general. r? `@oli-obk`
2022-06-15Rename `impl_constness` to `constness`Deadbeef-3/+2
The current code is a basis for `is_const_fn_raw`, and `impl_constness` is no longer a valid name, which is previously used for determining the constness of impls, and not items in general.
2022-06-15Rollup merge of #98110 - cjgillot:closure-brace, r=Aaron1011Yuki Okushi-9/+9
Make `ExprKind::Closure` a struct variant. Simple refactor since we both need it to introduce additional fields in `ExprKind::Closure`. r? ``@Aaron1011``
2022-06-14rebaseb-naber-6/+2
2022-06-14implement valtrees as the type-system representation for constant valuesb-naber-34/+55
2022-06-14Rollup merge of #97935 - nnethercote:rename-ConstS-val-as-kind, r=lcnrDylan DPC-27/+27
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-8/+4
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-27/+27
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-23/+18
2022-06-13Remove RegionckMode in favor of calling new skip_region_resolutionJack Huey-8/+4
2022-06-11Address commentsMichael Goulet-48/+95
2022-06-11Properly replace `impl Trait` in fn args, turn {integer} to i32Michael Goulet-12/+27
2022-06-11Make is_suggestable work on all TypeFoldableMichael Goulet-22/+18
2022-06-11Handle empty where-clause betterMichael Goulet-5/+6
2022-06-12Make `ExprKind::Closure` a struct variant.Camille GILLOT-9/+9
2022-06-10bound_vars -> infer: don't return lt maplcnr-11/+8
2022-06-08Auto merge of #97860 - Dylan-DPC:rollup-t3vxos8, r=Dylan-DPCbors-6/+8
Rollup of 5 pull requests Successful merges: - #97595 (Remove unwrap from get_vtable) - #97597 (Preserve unused pointer to address casts) - #97819 (Recover `import` instead of `use` in item) - #97823 (Recover missing comma after match arm) - #97851 (Use repr(C) when depending on struct layout in ptr tests) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-06-08Rollup merge of #97595 - ouz-a:issue-97381, r=compiler-errorsDylan DPC-6/+8
Remove unwrap from get_vtable This avoids ICE on issue #97381 I think the bug is a bit deeper though, it compiles fine when `v` is `&v` which makes me think `Deref` is causing some issue with borrowck but it's fine I guess since this thing crashes since `nightly-2020-09-17` 😅
2022-06-08Auto merge of #97447 - nnethercote:improve-folding, r=jackh726bors-24/+20
Folding revamp r? `@ghost`
2022-06-08Folding revamp.Nicholas Nethercote-20/+19
This commit makes type folding more like the way chalk does it. Currently, `TypeFoldable` has `fold_with` and `super_fold_with` methods. - `fold_with` is the standard entry point, and defaults to calling `super_fold_with`. - `super_fold_with` does the actual work of traversing a type. - For a few types of interest (`Ty`, `Region`, etc.) `fold_with` instead calls into a `TypeFolder`, which can then call back into `super_fold_with`. With the new approach, `TypeFoldable` has `fold_with` and `TypeSuperFoldable` has `super_fold_with`. - `fold_with` is still the standard entry point, *and* it does the actual work of traversing a type, for all types except types of interest. - `super_fold_with` is only implemented for the types of interest. Benefits of the new model. - I find it easier to understand. The distinction between types of interest and other types is clearer, and `super_fold_with` doesn't exist for most types. - With the current model is easy to get confused and implement a `super_fold_with` method that should be left defaulted. (Some of the precursor commits fixed such cases.) - With the current model it's easy to call `super_fold_with` within `TypeFolder` impls where `fold_with` should be called. The new approach makes this mistake impossible, and this commit fixes a number of such cases. - It's potentially faster, because it avoids the `fold_with` -> `super_fold_with` call in all cases except types of interest. A lot of the time the compile would inline those away, but not necessarily always.
2022-06-08Rename `TypeVisitor::visit_unevaluated_const`.Nicholas Nethercote-4/+1
To match the corresponding type name.
2022-06-07Auto merge of #97081 - oli-obk:outlives_query_fast_path, r=jackh726bors-3/+10
Re-use the type op instead of calling the implied_outlives_bounds query directly r? `@ghost`
2022-06-06Add proper tracing spans to rustc_trait_selection::traits::error_reportingNoa-58/+36
2022-06-06Rollup merge of #97721 - compiler-errors:issue-97704, r=jackh726Matthias Krüger-30/+18
Do `suggest_await_before_try` with infer variables in self, and clean up binders Fixes #97704 Also cleans up binders in this fn, since everything is a `Poly*` and we really shouldn't have stray escaping late-bound regions everywhere. That's why the function changed so much. This isn't necessary, so I can revert if necessary.
2022-06-05Do suggest_await_before_try with infer in self, clean up bindersMichael Goulet-30/+18
2022-06-06Split `process_obligation` in two.Nicholas Nethercote-41/+30
Because it really has two halves: - A read-only part that checks if further work is needed. - The further work part, which is much less hot. This makes things a bit clearer and nicer.
2022-06-06Handle stalling within `ObligationForest`.Nicholas Nethercote-19/+8
It is simpler if `ObligationForest` does this itself, rather than the caller having to manage it.
2022-06-05get_vtable returns opt instd of unwrppingouz-a-6/+8
2022-06-05Auto merge of #97697 - WaffleLapkin:no_ref_vec, r=WaffleLapkinbors-5/+7
Replace `&Vec<_>`s with `&[_]`s It's generally preferable to use `&[_]` since it's one less indirection and it can be created from types other that `Vec`. I've left `&Vec` in some locals where it doesn't really matter, in cases where `TypeFoldable` is expected (`TypeFoldable: Clone` so slice can't implement it) and in cases where it's `&TypeAliasThatIsActiallyVec`. Nothing important, really, I was just a little annoyed by `visit_generic_param_vec` :D r? `@compiler-errors`
2022-06-03Tighten spans for bad fields in Copy structMichael Goulet-2/+2
2022-06-03Replace `&Vec<_>`s with `&[_]`sMaybe Waffle-5/+7
2022-06-02fix wrong suggestion for adding where clausesTakayuki Maeda-2/+16
2022-06-01Rollup merge of #97616 - TaKO8Ki:remove-unnecessary-option, r=Dylan-DPCYuki Okushi-3/+10
Remove an unnecessary `Option`
2022-06-01remove an unnecessary `Option`Takayuki Maeda-3/+10
2022-05-31Fix comment in poly_project_and_unify_typeMichael Goulet-14/+14
2022-05-29Auto merge of #97214 - Mark-Simulacrum:stage0-bump, r=pietroalbinibors-1/+0
Finish bumping stage0 It looks like the last time had left some remaining cfg's -- which made me think that the stage0 bump was actually successful. This brings us to a released 1.62 beta though. This now brings us to cfg-clean, with the exception of check-cfg-features in bootstrap; I'd prefer to leave that for a separate PR at this time since it's likely to be more tricky. cc https://github.com/rust-lang/rust/pull/97147#issuecomment-1132845061 r? `@pietroalbini`
2022-05-28Fix TyKind lint, make consts no longer fn, etcMichael Goulet-7/+5
2022-05-28Initial fixes on top of type interner commitMichael Goulet-4/+4
2022-05-27Finish bumping stage0Mark Rousskov-1/+0
It looks like the last time had left some remaining cfg's -- which made me think that the stage0 bump was actually successful. This brings us to a released 1.62 beta though.
2022-05-27Auto merge of #96046 - oli-obk:const_typeck, r=cjgillotbors-0/+1
Move various checks to typeck so them failing causes the typeck result to get tainted Fixes #69487 fixes #79047 cc `@RalfJung` this gets rid of the `Transmute` invalid program error variant
2022-05-25Rollup merge of #97351 - ↵Dylan DPC-10/+24
b-naber:adt-const-params-structural-match-violation, r=michaelwoerister Output correct type responsible for structural match violation Previously we included the outermost type that caused a structural match violation in the error message and stated that that type must be annotated with `#[derive(Eq, PartialEq)]` even if it already had that annotation. This PR outputs the correct type in the error message. Fixes https://github.com/rust-lang/rust/issues/97278