Commit Graph

807 Commits

Author SHA1 Message Date
Maybe Waffle
b80356a5ab Use tcx.require_lang_item instead of unwrapping 2022-11-22 17:19:19 +00:00
Oli Scherer
7658e0fccf Stop passing the self-type as a separate argument. 2022-11-21 20:39:46 +00:00
Oli Scherer
ad57f88d3f Add helper to create the trait ref for a lang item 2022-11-21 20:35:17 +00:00
Oli Scherer
ec8d01fdcc Allow iterators instead of requiring slices that will get turned into iterators 2022-11-21 20:33:55 +00:00
Oli Scherer
6f77c97b38 Assert that various types have the right amount of generic args and fix the sites that used the wrong amount 2022-11-21 20:31:59 +00:00
Matthias Krüger
844e3fb928
Rollup merge of #104595 - compiler-errors:poly-existential-predicate, r=lcnr
Add `PolyExistentialPredicate` type alias

Wrapping `ExistentialPredicate`s in a binder is very common, and this alias already exists for the `PolyExistential{TraitRef,Projection}` types.
2022-11-21 14:11:11 +01:00
Matthias Krüger
820a41580e
Rollup merge of #104564 - RalfJung:either, r=oli-obk
interpret: use Either over Result when it is not representing an error condition

r? `@oli-obk`
2022-11-20 18:21:48 +01:00
bors
c5d82ed7a4 Auto merge of #102795 - lukas-code:constify-is-aligned-via-align-offset, r=oli-obk
Constify `is_aligned` via `align_offset`

Alternative to https://github.com/rust-lang/rust/pull/102753

Make `align_offset` work in const eval (and not always return `usize::MAX`) and then use that to constify `is_aligned{_to}`.

Tracking Issue: https://github.com/rust-lang/rust/issues/104203
2022-11-19 18:57:39 +00:00
Lukas Markeffsky
3d7e9c4b7f Revert "don't call align_offset during const eval, ever"
This reverts commit f3a577bfae376c0222e934911865ed14cddd1539.
2022-11-19 16:58:02 +01:00
Lukas Markeffsky
9e5d497b67 fix const align_offset implementation 2022-11-19 16:57:58 +01:00
Lukas Markeffsky
60f352fd7d replace potential ICE with graceful error (no_core only) 2022-11-19 16:47:42 +01:00
Lukas Markeffsky
a906f6cb69 don't call align_offset during const eval, ever 2022-11-19 16:47:42 +01:00
Lukas Markeffsky
211743b2c8 make const align_offset useful 2022-11-19 16:36:08 +01:00
Lukas Markeffsky
f770fecfe1 unify inherent impls of CompileTimeEvalContext 2022-11-19 16:36:08 +01:00
Lukas Markeffsky
f13c4f4d6a constify exact_div intrinsic 2022-11-19 16:36:08 +01:00
Matthias Krüger
c571b2a964
Rollup merge of #104593 - compiler-errors:rpitit-object-safety-spans, r=fee1-dead
Improve spans for RPITIT object-safety errors

No reason why we can't point at the `impl Trait` that causes the object-safety violation.

Also [drive-by: Add is_async fn to hir::IsAsync](c4165f3a96), which touches clippy too.
2022-11-19 15:35:23 +01:00
Dylan DPC
00876c68c4
Rollup merge of #104411 - lcnr:bivariance-nll, r=compiler-errors
nll: correctly deal with bivariance

fixes #104409

when in a bivariant context, relating stuff should always trivially succeed. Also changes the mir validator to correctly deal with higher ranked regions.

r? types cc ``@RalfJung``
2022-11-19 11:54:44 +05:30
Michael Goulet
c36ff28d42 drive-by: PolyExistentialPredicate 2022-11-19 04:04:27 +00:00
Michael Goulet
c4165f3a96 drive-by: Add is_async fn to hir::IsAsync 2022-11-19 02:22:24 +00:00
Ralf Jung
09a887cebf review feedback 2022-11-18 14:24:48 +01:00
Ralf Jung
4101889786 interpret: use Either over Result when it is not representing an error condition 2022-11-18 10:18:32 +01:00
Matthias Krüger
ed97f245f1
Rollup merge of #104483 - oli-obk:santa-clauses-make-goals, r=compiler-errors
Convert predicates into Predicate in the Obligation constructor

instead of having almost all callers do that.

This reduces a bit of boilerplate, and also paves the way for my work towards https://github.com/rust-lang/compiler-team/issues/531 (as it makes it easier to accept both goals and clauses where right now it only accepts predicates).
2022-11-17 22:33:19 +01:00
yukang
20ea083d87 fix #104390, fix ICE in in_operand for ty error 2022-11-16 17:48:13 +08:00
Oli Scherer
4f11f3b257 Convert predicates into Predicate in the Obligation constructor 2022-11-16 09:25:19 +00:00
Ralf Jung
1115ec601a cleanup and dedupe CTFE and Miri error reporting 2022-11-16 10:13:29 +01:00
bors
a00f8ba7fc Auto merge of #104054 - RalfJung:byte-provenance, r=oli-obk
interpret: support for per-byte provenance

Also factors the provenance map into its own module.

The third commit does the same for the init mask. I can move it in a separate PR if you prefer.

Fixes https://github.com/rust-lang/miri/issues/2181

r? `@oli-obk`
2022-11-15 17:37:15 +00:00
lcnr
b2e6d08e3f use ocx type relation routines 2022-11-15 14:13:47 +01:00
lcnr
f5f67618e2 add comment about opaque types 2022-11-15 13:50:13 +01:00
lcnr
6aa611a84c mv utility methods into separate module 2022-11-15 13:50:13 +01:00
lcnr
45f441a7b4 nll: correctly deal with bivariance 2022-11-15 13:34:08 +01:00
Matthias Krüger
050ece6765
Rollup merge of #104356 - RalfJung:interpret-check-mplace, r=oli-obk
interpret: make check_mplace public

This helps avoid code duplication in https://github.com/rust-lang/miri/pull/2661.
2022-11-14 19:26:18 +01:00
Matthias Krüger
5763fa74f0
Rollup merge of #104349 - rustaceanclub:master, r=oli-obk
fix some typos in comments
2022-11-14 19:26:18 +01:00
Ralf Jung
68af46c112 assert that we are (de)seiralizing ProvenanceMap correctly 2022-11-14 18:26:40 +01:00
Ralf Jung
7982d6ac64 interpret: make check_mplace public 2022-11-13 12:56:48 +01:00
Ralf Jung
c78021709a add is_sized method on Abi and Layout, and use it 2022-11-13 12:23:53 +01:00
cui fliter
442f848d74 fix some typos in comments
Signed-off-by: cui fliter <imcusg@gmail.com>
2022-11-13 15:26:17 +08:00
Dylan DPC
77a44ab568
Rollup merge of #103865 - compiler-errors:fallback-has-occurred-tracking, r=eholk
Move `fallback_has_occurred` state tracking to `FnCtxt`

Removes a ton of callsites that defaulted to `false`
2022-11-08 11:23:51 +05:30
Ralf Jung
c3a7ca1125 move InitMask to its own module 2022-11-06 14:17:10 +01:00
Ralf Jung
2cef9e3d19 interpret: support for per-byte provenance 2022-11-06 14:17:10 +01:00
Michael Goulet
bc345d7bd0 Move fallback_has_occurred to FnCtxt 2022-11-06 02:40:25 +00:00
bors
a4ab2e0643 Auto merge of #103975 - oli-obk:tracing, r=jackh726
Some tracing and comment cleanups

Pulled out of https://github.com/rust-lang/rust/pull/101900 to see if that is the perf impact
2022-11-06 02:21:34 +00:00
Matthias Krüger
ad01a37ca9
Rollup merge of #103868 - compiler-errors:trait-engine-less, r=jackh726
Use `TraitEngine` (by itself) less

Replace `TraitEngine` in favor of `ObligationCtxt` or `fully_solve_*`, improving code readability.
2022-11-05 00:02:04 +01:00
Oli Scherer
44d1936d00 Some tracing and comment cleanups 2022-11-04 17:10:07 +00:00
Matthias Krüger
61c6cdb5f4
Rollup merge of #103915 - chenyukang:yukang/fix-103874, r=lcnr
Improve use of ErrorGuaranteed and code cleanup

Part of #103874
2022-11-04 06:40:32 +01:00
yukang
a21a055ca6 remove 'delay_span_bug' following 'references_error' 2022-11-03 09:22:08 +08:00
yukang
7df9d818ab deprecate DelaySpanBugEmitted and use ErrorGuaranteed directly 2022-11-02 23:15:49 +08:00
Michael Goulet
41e4218d2a Use TraitEngine less 2022-11-02 04:11:05 +00:00
Michael Goulet
e24df2778f Format dyn Trait better in type_name intrinsic 2022-11-01 20:41:47 +00:00
Dylan DPC
20528baac4
Rollup merge of #103729 - RalfJung:align-of-val-packed, r=oli-obk
interpret: fix align_of_val on packed types

Fixes https://github.com/rust-lang/miri/issues/2632

r? `@oli-obk`
2022-11-01 14:12:26 +05:30
Yuki Okushi
0f40e95b2e
Rollup merge of #103798 - RalfJung:type_name, r=oli-obk
interpret: move type_name implementation to an interpreter-independent helper file

This should avoid pinging rust-lang/miri each time that file changes, which is really not necessary.

r? `@oli-obk`
2022-11-01 12:03:43 +09:00