Commit Graph

789 Commits

Author SHA1 Message Date
Alan Egerton
e9e5d0685b
Relax constrained generics to TypeVisitable 2022-07-05 22:25:43 +01:00
Alan Egerton
f66c06f7f2
Explicit TypeVisitable implementations 2022-07-05 22:25:35 +01:00
Alan Egerton
e4b9625b87
Add #[derive(TypeVisitable)] 2022-07-05 22:25:15 +01:00
bors
efb171e235 Auto merge of #98584 - lcnr:region-stuff-more-beans, r=oli-obk
continue nll transition by removing stuff

r? `@jackh726` for now

building on #98641
2022-07-05 14:58:31 +00:00
lcnr
9f95c605f8 region obligations, remove body_id 2022-07-04 14:35:20 +02:00
lcnr
a0d2d9f315 implied bounds byebye nested hir ids 2022-07-04 14:35:20 +02:00
lcnr
68d70fc5bd only use FnCtxt for regionck inside of bodies 2022-07-04 14:35:20 +02:00
lcnr
24799e3720 remove an unused DefId 2022-07-04 14:35:19 +02:00
lcnr
f475e880a4 InferSource::GenericArg, check for contains 2022-07-04 14:04:07 +02:00
lcnr
7952d2ed83 resolve vars in node substs 2022-07-04 13:58:29 +02:00
lcnr
eef34a648b stop suggesting things inside of macros 2022-07-04 13:58:29 +02:00
lcnr
f1836c453a update infer cost computation for types 2022-07-04 13:58:29 +02:00
lcnr
c2ed08715b remove unused function argument 2022-07-04 13:58:28 +02:00
Michael Goulet
f44ae98cee Only label place where type is needed if span is meaningful 2022-07-01 17:38:34 +00:00
Matthias Krüger
0d5636ce88
Rollup merge of #98610 - lcnr:emit_inference_failure_err-ice, r=estebank
fix `emit_inference_failure_err` ICE

fixes #98598

this fix doesn't make me too happy, but 🤷
2022-07-01 06:05:52 +02:00
lcnr
e043821e93 add issue number to fixme 2022-06-30 15:53:17 +02:00
Matthias Krüger
48170d5a1c
Rollup merge of #96727 - oli-obk:no_expect, r=lcnr
Make TAIT behave exactly like RPIT

fixes https://github.com/rust-lang/rust/issues/96552

This makes type-alias-impl-trait behave like return-position-impl-trait. Unfortunately it also causes some cases to stop compiling due to "needing type annotations" and makes panicking cause fallback for the hidden type to `()`.

All of these are addressable, but we should probably address them for RPIT and TAIT together

r? ``@lcnr``
2022-06-30 00:23:50 +02:00
Matthias Krüger
d34c4ca9be
Rollup merge of #98668 - TaKO8Ki:avoid-many-&str-to-string-conversions, 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-29 20:35:07 +02:00
Dylan DPC
fcbb2e8009
Rollup merge of #98607 - compiler-errors:tuple-wrap-suggestion, r=oli-obk
Clean up arg mismatch diagnostic, generalize tuple wrap suggestion

This is based on top of #97542, so just look at the last commit which contains the relevant changes.

1. Remove `final_arg_types` which was one of the last places we were using raw (`usize`) indices instead of typed indices in the arg mismatch suggestion code.
2. Improve the tuple wrap suggestion, now we suggest things like `call(a, b, c, d)` -> `call(a, (b, c), d)` 😺
3. Folded in fix #98645
2022-06-29 17:59:36 +05:30
Takayuki Maeda
6212e6b339 avoid many &str to String conversions with MultiSpan::push_span_label 2022-06-29 21:16:43 +09:00
bors
66c83ffca1 Auto merge of #98558 - nnethercote:smallvec-1.8.1, r=lqd
Update `smallvec` to 1.8.1.

This pulls in https://github.com/servo/rust-smallvec/pull/282, which
gives some small wins for rustc.

r? `@lqd`
2022-06-29 09:11:29 +00:00
Oli Scherer
c33b127d7c The only reason we had to replace opaque types in closures was due to async fn desugaring, make that explicit 2022-06-29 08:58:36 +00:00
Oli Scherer
524d2b3178 Make RPIT and TAIT work exactly the same 2022-06-29 08:58:36 +00:00
Dylan DPC
c703d11dcc
Rollup merge of #97346 - JohnTitor:remove-back-compat-hacks, r=oli-obk
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-28 15:30:00 +05:30
lcnr
1d845bd412 fix emit_inference_failure_err ICE 2022-06-28 11:44:25 +02:00
Michael Goulet
75337775f7 Remove final_arg_types, improve tuple wrapping suggestion 2022-06-28 00:19:49 -07:00
lcnr
28fafc45e6 lower-generic vs. outlive 2022-06-27 16:06:46 +02:00
lcnr
70497d9d10 fold_region: remove unused parameter 2022-06-27 15:55:03 +02:00
lcnr
4dbf9ba0ab outside of borrowck, do not provide an implicit_region_bound
see comment added to the field in `VerifyBoundCx`.
2022-06-27 15:48:54 +02:00
Yuki Okushi
c24f06354a
Remove a back-compat hack on lazy TAIT 2022-06-27 20:43:44 +09:00
Nicholas Nethercote
7c40661ddb Update smallvec to 1.8.1.
This pulls in https://github.com/servo/rust-smallvec/pull/282, which
gives some small wins for rustc.
2022-06-27 08:48:55 +10:00
Matthias Krüger
65187f51dc
Rollup merge of #98311 - eggyal:reverse-folder-hierarchy, r=jackh726
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-25 15:14:11 +02:00
bors
d017d59ed0 Auto merge of #98109 - nikomatsakis:issue-98095, r=jackh726
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-24 07:39:28 +00:00
Niko Matsakis
e93e10516e run x.py fmt 2022-06-23 17:00:46 -04:00
Niko Matsakis
9118fafd40 remove misleading comment
per aliemjay's suggestion
2022-06-23 17:00:28 -04:00
Niko Matsakis
d8337ee2f4 try to clarify confusing comment 2022-06-23 17:00:28 -04:00
Niko Matsakis
c3137d9e8c normalize if-eq bounds before testing
Hat-tip: aliemjay
2022-06-23 17:00:28 -04:00
Niko Matsakis
e6b630c5b1
apply suggestions from oli-obk
Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
2022-06-23 16:40:06 -04:00
Niko Matsakis
c9bf88ccf9 coallesce docs 2022-06-23 16:38:24 -04:00
Niko Matsakis
27e0f7a886 rename IfEqBound to IfEq 2022-06-23 16:35:47 -04:00
Niko Matsakis
893b919e64 remove VerifyBound::IfEq variant 2022-06-23 16:28:46 -04:00
Yuki Okushi
dfc6d7ac76
Rollup merge of #97818 - compiler-errors:rpit-error-spanned, r=oli-obk
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-22 15:16:12 +09:00
Michael Goulet
52409c4c90 Point at return expression for RPIT-related error 2022-06-21 18:23:37 -07:00
Yuki Okushi
fdeecb2314
Rollup merge of #97867 - lcnr:lub-binder, r=oli-obk
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-22 07:03:59 +09:00
Alan Egerton
6ac6866bec
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-21 17:38:22 +01:00
Oli Scherer
d2ea7e2059 Avoid an ICE and instead let the compiler report a useful error 2022-06-21 08:47:02 +00:00
Niko Matsakis
b7b3d2cee0 generalize the outlives obligation code
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-15 11:47:05 -04:00
Niko Matsakis
10f0f66d45 improved debug output 2022-06-15 11:47:05 -04:00
Niko Matsakis
87c2907bca remove compare-fn and use erased-ty 2022-06-15 11:47:04 -04:00
Niko Matsakis
e260afc3ba simplify argument type for to take param-ty
we don't really take other things
2022-06-15 11:47:04 -04:00