Commit Graph

971 Commits

Author SHA1 Message Date
Jack Huey
e09242d5b8 Final bits 2022-09-16 17:47:53 -04:00
Jack Huey
9929c0ac76 Add AscribeUserTypeProvePredicate 2022-09-16 17:20:11 -04:00
Jack Huey
67653292be Add to_constraint_category to ObligationCause and SubregionOrigin 2022-09-16 17:00:11 -04:00
Jack Huey
6075877c89 Pass ConstraintCategory thorough a few more places 2022-09-16 16:44:18 -04:00
Jack Huey
a46376e247 Make QueryOutlivesConstraint contain a ConstraintCategory 2022-09-16 16:15:41 -04:00
bors
4d4e51e428 Auto merge of #101902 - jackh726:revert-static-hrtb-error, r=nikomatsakis
Partially revert #101433

reverts #101433 to fix #101844

We should get this into the beta cut, since the ICE is getting hit quite a bit.
2022-09-16 16:46:14 +00:00
Jack Huey
92b759f517 Revert "Better errors for implied static bound"
This reverts commit c75817b0a7.
2022-09-16 09:47:07 -04:00
Oli Scherer
8aed75bee0 Don't throw away information just to recompute it again 2022-09-15 16:23:10 +00:00
bors
6153d3cbe6 Auto merge of #101212 - eholk:dyn-star, r=compiler-errors
Initial implementation of dyn*

This PR adds extremely basic and incomplete support for [dyn*](https://smallcultfollowing.com/babysteps//blog/2022/03/29/dyn-can-we-make-dyn-sized/). The goal is to get something in tree behind a flag to make collaboration easier, and also to make sure the implementation so far is not unreasonable. This PR does quite a few things:

* Introduce `dyn_star` feature flag
* Adds parsing for `dyn* Trait` types
* Defines `dyn* Trait` as a sized type
* Adds support for explicit casts, like `42usize as dyn* Debug`
  * Including const evaluation of such casts
* Adds codegen for drop glue so things are cleaned up properly when a `dyn* Trait` object goes out of scope
* Adds codegen for method calls, at least for methods that take `&self`

Quite a bit is still missing, but this gives us a starting point. Note that this is never intended to become stable surface syntax for Rust, but rather `dyn*` is planned to be used as an implementation detail for async functions in dyn traits.

Joint work with `@nikomatsakis` and `@compiler-errors.`

r? `@bjorn3`
2022-09-14 18:10:51 +00:00
Dylan DPC
430123164f
Rollup merge of #101433 - jackh726:better-static-placeholder-error, r=compiler-errors
Emit a note that static bounds from HRTBs are a bug

This note isn't perfect, but opening this to either 1) land as is or 2) get some feedback on how to improve it

Let r? `@compiler-errors` and cc. `@nikomatsakis`
2022-09-14 19:26:18 +05:30
bors
a0d1df4a5d Auto merge of #101709 - nnethercote:simplify-visitors-more, r=cjgillot
Simplify visitors more

A successor to #100392.

r? `@cjgillot`
2022-09-14 05:21:14 +00:00
Jack Huey
c75817b0a7 Better errors for implied static bound 2022-09-13 20:18:04 -04:00
bors
1ce51982b8 Auto merge of #101615 - compiler-errors:rpitit-perf, r=oli-obk
Make `compare_predicate_entailment` no longer a query

Make `compare_predicate_entailment` so it's no longer a query (again), and splits out the new logic (that equates the return types to infer RPITITs) into its own query. This means that this new query (now called `collect_trait_impl_trait_tys`) is no longer executed for non-RPITIT cases.

This should improve perf (https://github.com/rust-lang/rust/pull/101224#issuecomment-1241682203), though in practice we see that these some crates remain from the primary regressions list on the original report... They are all <= 0.43% regression and seemingly only on the incr-full scenario for all of them.

I am at a loss for what might be causing this regression other than what I fixed here, since we don't introduce much new non-RPITIT logic except for some `def_kind` query calls in some places, for example, like projection. Maybe that's it?

----

Originally this PR was opened to test enabling `cache_on_disk` (62164aaaa11) but that didn't turn out to be very useful (https://github.com/rust-lang/rust/pull/101615#issuecomment-1242403205), so that led me to just split the query (and rename the PR).
2022-09-13 15:33:06 +00:00
Eric Holk
6c01273a15 Plumb dyn trait representation through ty::Dynamic 2022-09-12 16:55:55 -07:00
Nicholas Nethercote
7e3fd33a66 Remove unused argument from visit_poly_trait_ref. 2022-09-12 13:51:10 +10:00
Michael Goulet
5599a45e58 Fix ICE in opt_suggest_box_span 2022-09-12 02:00:20 +00:00
bors
2287107588 Auto merge of #98559 - jackh726:remove-reempty, r=oli-obk
Remove ReEmpty

r? rust-lang/types
2022-09-10 20:54:01 +00:00
Michael Goulet
bec079d1a9 split compare_predicate_entailment and collect_trait_impl_trait_tys out 2022-09-10 02:49:14 +00:00
Michael Goulet
6876c94d80 Fix documentation lint failures 2022-09-09 01:31:46 +00:00
Michael Goulet
270b776ef9 Adjust pretty printing of RPITITs 2022-09-09 01:31:46 +00:00
Camille GILLOT
05812df603 Handle generic parameters. 2022-09-09 01:31:46 +00:00
Jack Huey
1e54fcc1ad Combine logic from lubs into lub_empty function 2022-09-08 20:55:56 -04:00
Jack Huey
f6d2995fb8 Make some functions pub(super) 2022-09-08 20:55:56 -04:00
Jack Huey
1ca9eb8ec3 Remove ReEmpty 2022-09-08 20:55:55 -04:00
Jack Huey
dd0335a27f Don't construct ReEmpty regions in resolve_var 2022-09-08 18:04:10 -04:00
Jack Huey
f29c91bf12 Create VarValue::Empty 2022-09-08 17:57:32 -04:00
Jack Huey
cc87d53da9 Don't use reempty as an implicit_outlives_region 2022-09-08 17:55:56 -04:00
bors
ccb5595df2 Auto merge of #98900 - lcnr:region-stuff, r=jackh726
const_generics: correctly deal with bound variables

removes the hack in `resolve` which was needed because we evaluated constants without caring about their bound variables.

Each commit should be fairly self-contained, even if they build on each other

r? `@jackh726`
2022-09-08 10:30:00 +00:00
lcnr
d15b00af48 don't evaluate with escaping bound vars 2022-09-08 11:41:00 +02:00
lcnr
060f3e0c65 generalize: no need to cache errors 2022-09-08 11:14:33 +02:00
Dylan DPC
e3ea8008cc
Rollup merge of #101153 - IntQuant:issue-100717-infer-2, r=davidtwco
Migrate another part of rustc_infer to session diagnostic

Probably will migrate another file before marking this one as ready-to-merge.

`@rustbot` label +A-translation
r? rust-lang/diagnostics
cc https://github.com/rust-lang/rust/issues/100717
2022-09-08 11:55:06 +05:30
Matthias Krüger
0a1c816dcd
Rollup merge of #101503 - spastorino:add-debug-calls, r=compiler-errors
Add debug calls

`@oli-obk` requested this and other changes as a way of simplifying https://github.com/rust-lang/rust/pull/101345. This is just going to make the diff of https://github.com/rust-lang/rust/pull/101345 smaller.

r? `@oli-obk` `@cjgillot`
2022-09-07 21:48:16 +02:00
bors
a4d034126d Auto merge of #101432 - nnethercote:shrink-PredicateS, r=lcnr
Shrink `PredicateS`

r? `@ghost`
2022-09-07 13:49:58 +00:00
Santiago Pastorino
e3a738a942
Add instrument and debug calls 2022-09-07 10:46:14 -03:00
Nikita Tomashevich
3d70be7240
Whoops forgot a space 2022-09-06 22:55:49 +03:00
Nikita Tomashevich
ee74f925f5
Replace manual impl with a derive macro as multipart suggestions are now supported by them 2022-09-06 22:18:56 +03:00
IQuant
cb7ad9e548
Slightly more concise comment
Co-authored-by: David Wood <agile.lion3441@fuligin.ink>
2022-09-06 18:41:09 +03:00
Nikita Tomashevich
59c567296a
Use untranslated messages for now 2022-09-06 18:41:09 +03:00
Nikita Tomashevich
e750d7faa7
Remove a comment and use IntoDiagnosticArg instead of add_to() where feasible 2022-09-06 18:41:08 +03:00
Nikita Tomashevich
3190522294
Address some comments 2022-09-06 18:41:08 +03:00
Nikita Tomashevich
e0e9b21c78
Mugrate mismatched_static_lifetime.rs 2022-09-06 18:41:08 +03:00
Nikita Tomashevich
af3343ae29
Migrate E0623 2022-09-06 18:41:08 +03:00
Guillaume Gomez
7c7548cd37
Rollup merge of #101445 - TaKO8Ki:suggest-introducing-explicit-lifetime, r=oli-obk
Suggest introducing an explicit lifetime if it does not exist

Fixes #101027
2022-09-06 17:00:27 +02:00
Guillaume Gomez
4d830b7775
Rollup merge of #101434 - JhonnyBillM:replace-session-for-handler-in-into-diagnostic, r=davidtwco
Update `SessionDiagnostic::into_diagnostic` to take `Handler` instead of `ParseSess`

Suggested by the team in [this Zulip Topic](https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.23100717.20SessionDiagnostic.20on.20Handler).

`Handler` already has almost all the capabilities of `ParseSess` when it comes to diagnostic emission, in this migration we only needed to add the ability to access `source_map` from the emitter in order to get a `Snippet` and the `start_point`. Not sure if adding these two methods [`span_to_snippet_from_emitter` and  `span_start_point_from_emitter`] is the best way to address this gap.

P.S. If this goes in the right direction, then we probably may want to move `SessionDiagnostic` to `rustc_errors` and rename it to `DiagnosticHandler` or something similar.

r? `@davidtwco`
r? `@compiler-errors`
2022-09-06 17:00:26 +02:00
bors
b44197abb0 Auto merge of #101261 - TaKO8Ki:separate-receiver-from-arguments-in-hir, r=cjgillot
Separate the receiver from arguments in HIR

Related to #100232

cc `@cjgillot`
2022-09-05 16:21:40 +00:00
Takayuki Maeda
87c6da363f separate the receiver from arguments in HIR 2022-09-05 22:25:49 +09:00
Takayuki Maeda
016626ab12 suggest introducing an explicit lifetime if it does not exist 2022-09-05 19:45:53 +09:00
Jhonny Bill Mena
321e60bf34 UPDATE - into_diagnostic to take a Handler instead of a ParseSess
Suggested by the team in this Zulip Topic https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.23100717.20SessionDiagnostic.20on.20Handler

Handler already has almost all the capabilities of ParseSess when it comes to diagnostic emission, in this migration we only needed to add the ability to access source_map from the emitter in order to get a Snippet and the start_point. Not sure if this is the best way to address this gap
2022-09-05 02:18:45 -04:00
Nicholas Nethercote
79db32b64e Pack Term in the same way as GenericArg.
This shrinks the `PredicateS` type, which is instanted frequently.
2022-09-05 15:08:52 +10:00
Nicholas Nethercote
bb0ae3c446 Make hir::PathSegment::hir_id non-optional. 2022-09-05 14:20:25 +10:00