Ethan Brierley
22c2738573
Minor cleanup: make imports more consistent
2021-09-04 15:47:00 +01:00
Ethan Brierley
85d6029c13
AbstractConst::root
: Always run subst
when Node
is Leaf
2021-09-04 15:44:26 +01:00
Ellen
fcc2badf9b
rename const_evaluatable_checked to generic_const_exprs
...
✨
2021-08-30 11:00:21 +02:00
lcnr
f3996f6a88
review
2021-08-26 11:14:31 +02:00
lcnr
bc0156bace
shrink ty::PredicateKind
again
2021-08-26 11:00:30 +02:00
lcnr
caa975c89e
use ty::Unevaluated
instead of def substs pair
2021-08-26 11:00:30 +02:00
lcnr
ab9108b70f
update TypeFlags
to deal with missing ct substs
2021-08-26 11:00:30 +02:00
lcnr
bfaf13af4e
make unevaluated const substs optional
2021-08-26 11:00:30 +02:00
Ellen
17cd79090e
support as _
and add tests
2021-06-10 14:53:44 +01:00
Ellen
c318364d48
Add more tests + visit_ty in some places
2021-06-09 19:28:41 +01:00
Ellen
8e7299dfcd
Support as casts in abstract consts
2021-06-08 08:02:16 +01:00
Josh Stone
72ebebe474
Use iter::zip in compiler/
2021-03-26 09:32:31 -07:00
Dylan DPC
118aba359b
Rollup merge of #83040 - lcnr:unused-ct-substs, r=oli-obk
...
extract `ConstKind::Unevaluated` into a struct
r? `@oli-obk`
2021-03-21 02:01:36 +01:00
Dylan DPC
3a113f18f8
Rollup merge of #82707 - BoxyUwU:errooaaar, r=oli-obk
...
const_evaluatable_checked: Stop eagerly erroring in `is_const_evaluatable`
Fixes #82279
We don't want to be emitting errors inside of is_const_evaluatable because we may call this during selection where it should be able to fail silently
There were two errors being emitted in `is_const_evaluatable`. The one causing the compile error in #82279 was inside the match arm for `FailureKind::MentionsParam` but I moved the other error being emitted too since it made things cleaner imo
The `NotConstEvaluatable` enum \*should\* have a fourth variant for when we fail to evaluate a concrete const, e.g. `0 - 1` but that cant happen until #81339
cc `@oli-obk` `@lcnr`
r? `@nikomatsakis`
2021-03-21 02:01:34 +01:00
lcnr
7c9b5b4ce0
update const_eval_resolve
2021-03-20 17:22:24 +01:00
lcnr
43ebac119b
extract ConstKind::Unevaluated
into a struct
2021-03-20 17:21:44 +01:00
Oli Scherer
c30c1be1e6
s/ConstantSource/ConstantKind/
2021-03-15 12:06:52 +00:00
Oli Scherer
3127a9c60f
Prepare mir::Constant for ty::Const only supporting valtrees
2021-03-12 12:43:54 +00:00
Oli Scherer
9a2362e5a9
Shrink the size of Rvalue by 16 bytes
2021-03-05 09:33:01 +00:00
Ellen
8e353bb8ea
Fix tidy err and review
2021-03-03 11:26:23 +00:00
Ellen
356ce96fe1
Remove extraneous return statement
2021-03-03 10:04:49 +00:00
Ellen
342ec83629
nits
2021-03-02 19:33:28 +00:00
Ellen
f97e075e92
errooaaar~
2021-03-02 15:47:16 +00:00
Ellen
7e368e57f2
the environment round here is awfully empty
...
capitalism
2021-02-15 11:38:20 +00:00
Camelid
253a970c3d
Miscellaneous small diagnostics cleanup
2021-02-03 22:09:37 -08:00
Jack Huey
3aed8b17a8
Rollup merge of #81544 - JulianKnodt:sat_where, r=lcnr
...
Add better diagnostic for unbounded Abst. Const
~~In the case where a generic abst. const requires a trivial where bound: `where TypeWithConst<const_fn(N)>: ,`,
instead of requiring a where bound, just check that only consts are being substituted in to skip over where check.~~
~~This is pretty sketchy, but I think it works. Presumably, if there is checking for type bounds added later, it can first check nested requirements, and see if they're satisfied by the current `ParamEnv`.~~
Changed the diagnostic to add a better example, which is more practical than what was previously proposed.
r? ```@lcnr```
2021-02-02 16:01:39 -05:00
kadmin
65256717f2
Add better diagnostic for missing where clause
...
Previously, it's not clear what exactly should be added in the suggested where clause,
so this adds an example to demonstrate.
2021-02-02 17:01:53 +00:00
Ellen
7f8530f16b
more things are const evaluatable *sparkles*
2021-02-01 20:05:50 +00:00
Ellen
f4261772d8
comments
2021-01-27 14:46:43 +00:00
Ellen
b0625eb712
boop, ur abstract consts are now expanded
2021-01-27 02:46:19 +00:00
Jack Huey
3dea68de1d
Review changes
2021-01-16 18:56:37 -05:00
oli
cccd40f9b5
Keep an unoptimized duplicate of const fn
around
...
This allows CTFE to reliably detect UB, as otherwise
optimizations may hide UB.
2021-01-04 21:40:38 +00:00
LeSeulArtichaut
e0f3119103
Introduce TypeVisitor::BreakTy
2020-11-14 20:25:27 +01:00
Bastian Kauschke
439171e094
look at assoc ct, check the type of nodes
2020-11-07 12:39:52 +01:00
LeSeulArtichaut
9433eb83fe
Remove implicit Continue
type
2020-10-30 12:27:47 +01:00
LeSeulArtichaut
4fe735b320
TypeVisitor: use ControlFlow
in rustc_{infer,lint,trait_selection}
2020-10-30 12:27:34 +01:00
Bastian Kauschke
60bcc58dce
debug log AbstractConst::new
2020-10-26 14:56:58 +01:00
Bastian Kauschke
0e419efb1c
check for object safety violations in constants
2020-10-25 18:33:45 +01:00
Bastian Kauschke
47cb871f14
review
2020-10-23 15:04:12 +02:00
Bastian Kauschke
6ad140ca19
const_eval_checked: deal with unused nodes + div
2020-10-23 12:16:58 +02:00
Bastian Kauschke
8160bfa39c
query_name_of_opt_const_arg -> query_name_opt_const_arg
2020-10-05 08:49:21 +02:00
Bastian Kauschke
536674fb69
cleanup WithOptConstParam queries
2020-10-04 23:22:08 +02:00
Bastian Kauschke
a4783debe0
const evaluatable: improve TooGeneric
handling
2020-09-28 20:18:06 +02:00
Bastian Kauschke
2f893e458a
review
2020-09-21 23:25:52 +02:00
Bastian Kauschke
30cbc97296
words
2020-09-19 22:27:52 +02:00
Bastian Kauschke
d4039c55c9
wip emit errors during AbstractConst building
2020-09-19 22:17:52 +02:00
Bastian Kauschke
b7641209d7
add const-evaluatable_checked
check back in
2020-09-18 17:36:11 +02:00
Bastian Kauschke
09e6254496
review, small cleanup
2020-09-18 17:11:34 +02:00
Bastian Kauschke
1b275d08ad
document const_evaluatable
2020-09-18 17:11:34 +02:00
Bastian Kauschke
7fff155d2a
remove allow(warnings)
2020-09-18 17:11:34 +02:00