Commit Graph

169 Commits

Author SHA1 Message Date
Ralf Jung 5a06b1e67c simplify alignment_check_failed a bit 2022-12-15 16:48:30 +00:00
Oli Scherer b05c790fd6 Reuse the ctfe error emitting logic for the future incompat lint 2022-12-15 16:48:24 +00:00
Oli Scherer dec05e9c73 Factor decorate closure out into a method 2022-12-15 16:25:50 +00:00
Oli Scherer d9d92ed7da Move alignment failure error reporting to machine 2022-12-15 16:07:35 +00:00
Oli Scherer d66824dbc4 Make alignment checks a future incompat lint 2022-12-15 16:07:28 +00:00
Ralf Jung fa83763491 always check alignment during CTFE 2022-12-15 15:36:11 +00:00
Michael Goulet 96cb18e864 Combine identical alias arms 2022-12-13 17:48:55 +00:00
Michael Goulet 61adaf8187 Combine projection and opaque into alias 2022-12-13 17:48:55 +00:00
KaDiWa 9bc69925cb compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
Oli Scherer 99348a5330 Change CTFE backtraces to use note instead of label to preserve their order
labels are reordered within the file in which they are reported, which can mess up the stack trace
2022-12-06 18:59:46 +00:00
Rageking8 58110572fb fix dupe word typos 2022-12-05 16:42:36 +08:00
Ralf Jung 60d5d65a4d interpret: get rid of run() function 2022-11-27 15:20:26 +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
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
Ralf Jung 4101889786 interpret: use Either over Result when it is not representing an error condition 2022-11-18 10:18:32 +01:00
Ralf Jung 1115ec601a cleanup and dedupe CTFE and Miri error reporting 2022-11-16 10:13:29 +01:00
Ralf Jung c78021709a add is_sized method on Abi and Layout, and use it 2022-11-13 12:23:53 +01:00
Guillaume Gomez 2414a4c31a Rollup merge of #103625 - WaffleLapkin:no_tyctxt_dogs_allowed, r=compiler-errors
Accept `TyCtxt` instead of `TyCtxtAt` in `Ty::is_*` functions

Functions in answer:

- `Ty::is_freeze`
- `Ty::is_sized`
- `Ty::is_unpin`
- `Ty::is_copy_modulo_regions`

This allows to remove a lot of useless `.at(DUMMY_SP)`, making the code a bit nicer :3

r? `@compiler-errors`
2022-10-29 14:18:03 +02:00
bors 5237c4d83d Auto merge of #102674 - CastilloDel:master, r=oli-obk
Remove allow(rustc::potential_query_instability) in rustc_const_eval

The use of FxHashMap has been replaced with FxIndexMap.

Related to #84447
2022-10-28 12:52:17 +00:00
Maybe Waffle a17ccfa621 Accept TyCtxt instead of TyCtxtAt in Ty::is_* functions
Functions in answer:

- `Ty::is_freeze`
- `Ty::is_sized`
- `Ty::is_unpin`
- `Ty::is_copy_modulo_regions`
2022-10-27 15:06:08 +04:00
Michael Goulet ab36a2fe16 Revert "Unify tcx.constness and param env constness checks"
This reverts commit bef8681a18.
This reverts commit c646c4d403.
2022-10-20 03:44:12 +00:00
CastilloDel c3a1ca6be7 Remove allow(rustc::potential_query_instability) in rustc_const_eval
The use of FxHashMap has been replaced with FxIndexMap. For
more information see https://github.com/rust-lang/rust/issues/84447
2022-10-18 17:44:01 +02:00
Rageking8 7122abaddf more dupe word typos 2022-10-14 12:57:56 +08:00
Michael Goulet c646c4d403 Unify tcx.constness and param env constness checks 2022-10-12 04:04:09 +00:00
Ralf Jung fd59d44f58 make const_err a hard error 2022-10-07 18:08:49 +02:00
Maybe Waffle a8f7e244b7 Refactor rustc lint API 2022-10-01 10:03:06 +00:00
Michael Howell b149c48186 Rollup merge of #102021 - lcnr:tyConst-fun, r=b-naber,BoxyUwU
some post-valtree cleanup

r? project-const-generics cc ```@b-naber```
2022-09-20 10:13:01 -07:00
lcnr c54c5a3c77 DestructuredConst split mir and ty 2022-09-19 17:00:38 +02:00
lcnr 526856768d ctfe, const_to_op only for mir constants 2022-09-19 16:17:33 +02:00
lcnr 647052fc04 remove the Subst trait, always use EarlyBinder 2022-09-19 11:37:27 +02:00
Oli Scherer f632dbe46f The <*const T>::guaranteed_* methods now return an option for the unknown case 2022-09-09 15:16:04 +00:00
Deadbeef 075084f772 Make const_eval_select a real intrinsic 2022-09-04 20:35:23 +08:00
Oli Scherer 1fc9ef1edd tracing::instrument cleanup 2022-09-01 14:54:27 +00:00
Dylan DPC 81f3841cfb Rollup merge of #101101 - RalfJung:read-pointer-as-bytes, r=oli-obk
interpret: make read-pointer-as-bytes a CTFE-only error with extra information

Next step in the reaction to https://github.com/rust-lang/rust/issues/99923. Also teaches Miri to implicitly strip provenance in more situations when transmuting pointers to integers, which fixes https://github.com/rust-lang/miri/issues/2456.

Pointer-to-int transmutation during CTFE now produces a message like this:
```
   = help: this code performed an operation that depends on the underlying bytes representing a pointer
   = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
```

r? ``@oli-obk``
2022-08-30 11:26:51 +05:30
Ralf Jung f29c3c421b entirely get rid of NeedsRfc CTFE errors 2022-08-28 13:40:24 -04:00
Ralf Jung a9f9145b09 CTFE: exposing pointers and calling extern fn doesn't need an RFC, it is just impossible 2022-08-28 13:32:48 -04:00
Matthias Krüger 5b8081490f Rollup merge of #101038 - RalfJung:interning-alignment, r=oli-obk
no alignment check during interning

This should fix https://github.com/rust-lang/rust/issues/101034
r? `@oli-obk`

Unfortunately we don't have a self-contained testcase for this problem. I am not sure how it can be triggered...
2022-08-28 09:35:19 +02:00
Ralf Jung 2e172473da interpret: make read-pointer-as-bytes *always* work in Miri
and show some extra information when it happens in CTFE
2022-08-27 18:37:44 -04:00
bors bb8a08f011 Auto merge of #101064 - compiler-errors:rollup-fwm5m5f, r=compiler-errors
Rollup of 9 pull requests

Successful merges:

 - #100724 (Migrate ast lowering to session diagnostic)
 - #100735 (Migrate `rustc_ty_utils` to `SessionDiagnostic`)
 - #100738 (Diagnostics migr const eval)
 - #100744 (Migrate rustc_mir_dataflow to diagnostic structs)
 - #100776 (Migrate `rustc_lint` errors to `SessionDiagnostic`)
 - #100817 (sugg: suggest the usage of boolean value when there is a typo in the keyword)
 - #100836 (Migrate `rustc_attr` crate diagnostics)
 - #100890 (Migrate rustc_driver to SessionDiagnostic)
 - #100900 (on `region_errors.rs`)

Failed merges:

 - #100831 (Migrate `symbol_mangling` module to new diagnostics structs)

r? `@ghost`
`@rustbot` modify labels: rollup
2022-08-27 00:38:06 +00:00
Michael Goulet b54344401a Rollup merge of #100738 - nidnogg:diagnostics_migr_const_eval, r=davidtwco
Diagnostics migr const eval

This PR should eventually contain all diagnostic migrations for the `rustc_const_eval` crate.

r? `@davidtwco`
`@rustbot` label +A-translation
2022-08-26 15:56:23 -07:00
Ralf Jung 30fa931f92 make read_immediate error immediately on uninit, so ImmTy can carry initialized Scalar 2022-08-26 13:20:57 -04:00
Ralf Jung b85178a5fc no alignment check during interning 2022-08-26 08:15:29 -04:00
nidnogg 066796cece Addressing tidy check fail 2022-08-22 12:32:42 -03:00
nidnogg 649749c7b0 Addressing last comment on PR review 2022-08-22 12:14:49 -03:00
nidnogg 4c82845b3a Fixed failing tests (missing labels), added automatic error code in create_feature_err() builder 2022-08-21 23:22:55 -03:00