about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src
AgeCommit message (Collapse)AuthorLines
2022-06-30Make `evaluate_obligation` not succeed unconditionally if it registered new ↵Oli Scherer-0/+5
hidden types for opaque types
2022-06-29Rollup merge of #98668 - TaKO8Ki:avoid-many-&str-to-string-conversions, ↵Matthias Krüger-2/+1
r=Dylan-DPC Avoid some `&str` to `String` conversions with `MultiSpan::push_span_label` This patch removes some`&str` to `String` conversions with `MultiSpan::push_span_label`.
2022-06-29Rollup merge of #98499 - JulianKnodt:erase_lifetime, r=lcnrDylan DPC-1/+2
Erase regions in New Abstract Consts When an abstract const is constructed, we previously included lifetimes in the set of substitutes, so it was not able to unify two abstract consts if their lifetimes did not match but the values did, despite the values not depending on the lifetimes. This caused code that should have compiled to not compile. Fixes #98452 r? ```@lcnr```
2022-06-29avoid many `&str` to `String` conversions with `MultiSpan::push_span_label`Takayuki Maeda-2/+1
2022-06-29Auto merge of #98656 - Dylan-DPC:rollup-hhytn0c, r=Dylan-DPCbors-9/+9
Rollup of 7 pull requests Successful merges: - #97423 (Simplify memory ordering intrinsics) - #97542 (Use typed indices in argument mismatch algorithm) - #97786 (Account for `-Z simulate-remapped-rust-src-base` when resolving remapped paths) - #98277 (Fix trait object reborrow suggestion) - #98525 (Add regression test for #79224) - #98549 (interpret: do not prune requires_caller_location stack frames quite so early) - #98603 (Some borrowck diagnostic fixes) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-06-29Erase regions in new abstract constskadmin-1/+2
2022-06-29Auto merge of #98542 - jackh726:coinductive-wf, r=oli-obkbors-15/+100
Make empty bounds lower to `WellFormed` and make `WellFormed` coinductive r? rust-lang/types
2022-06-29Avoid constructing an unnecessary `InferCtxt`.Nicholas Nethercote-4/+1
Currently, `search_for_structural_match_violation` constructs an `infcx` from a `tcx` and then only uses the `tcx` within the `infcx`. This is wasteful because `infcx` is a big type. This commit changes it to use the `tcx` directly. When compiling `pest-2.1.3`, this changes the memcpy stats reported by DHAT for a `check full` build from this: ``` 433,008,916 bytes (100%, 99,787.93/Minstr) in 2,148,668 blocks (100%, 495.17/Minstr), avg size 201.52 bytes ``` to this: ``` 101,422,347 bytes (99.98%, 25,243.59/Minstr) in 1,318,407 blocks (99.96%, 328.15/Minstr), avg size 76.93 bytes ``` This translates to a 4.3% reduction in instruction counts.
2022-06-29Change `Search::infcx` to `tcx`.Nicholas Nethercote-14/+10
Because the `infcx` isn't needed. This removes one lifetime from `Search`.
2022-06-28Note concrete type being coerced into objectMichael Goulet-2/+3
2022-06-28Fix trait object reborrow suggestionMichael Goulet-8/+7
2022-06-28Rollup merge of #97346 - JohnTitor:remove-back-compat-hacks, r=oli-obkDylan DPC-17/+4
Remove a back-compat hack on lazy TAIT This PR's motivation is here: https://github.com/rust-lang/rust/issues/72614#issuecomment-1134595446 ~~But removing a hack doesn't seem to reject the code on the issue, there're some more hacks?~~ r? ``@oli-obk``
2022-06-28Take into account trait predicate coinductivenessJack Huey-6/+36
2022-06-28Make empty bounds lower to WellFormed and make WellFormed coinductiveJack Huey-15/+70
2022-06-27Rollup merge of #98576 - lcnr:region-stuff-cool-beans, r=jackh726Matthias Krüger-6/+2
small regions refactoring these commits should be fairly self-contained r? rust-lang/types
2022-06-27Rollup merge of #98506 - compiler-errors:object-safety-suggestions, r=oli-obkMatthias Krüger-33/+45
Fix span issues in object safety suggestions Fixes #98500
2022-06-27outside of borrowck, do not provide an implicit_region_boundlcnr-6/+2
see comment added to the field in `VerifyBoundCx`.
2022-06-27Remove a back-compat hack on lazy TAITYuki Okushi-17/+4
2022-06-27Auto merge of #98221 - cjgillot:single-coh, r=lcnrbors-1/+1
Perform coherence checking per impl. r? `@ghost`
2022-06-25Fix span issues in object safety suggestionsMichael Goulet-33/+45
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-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-22Perform coherence checking per impl.Camille GILLOT-1/+1
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-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-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`