Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
5f6cfd2
mention `remove` in `swap_remove`
Nov 1, 2021
169b84f
Replace where-bounded Clean impl with function
camelid Nov 10, 2021
cf6a73c
Remove where bound from `clean_fn_decl_with_args`
camelid Nov 10, 2021
c615b11
Remove unnecessary reborrows
camelid Nov 10, 2021
c20ee3e
Add comments ensuring that generics are cleaned before args
camelid Nov 10, 2021
1642fdf
Add `-Zassert-incr-state` to assert state of incremental cache
pierwill Oct 31, 2021
498ebc4
require full validity when determining the discriminant of a value
RalfJung Nov 14, 2021
cf6f64a
Make slice->str conversion and related functions const
WaffleLapkin Nov 5, 2021
a7261c3
Avoid suggesting literal formatting that turns into member access
notriddle Nov 17, 2021
91e0217
rustc: Remove `#[rustc_synthetic]`
petrochenkov Nov 18, 2021
530eaa8
Clean up mess for --show-coverage documentation
GuillaumeGomez Nov 8, 2021
573a00e
Fill in tracking issues for `const_str_from_utf8` and `const_str_from…
WaffleLapkin Nov 18, 2021
728b3f2
Rollup merge of #90386 - pierwill:assert-incr-state-85864, r=Aaron1011
JohnTitor Nov 18, 2021
153e4dc
Rollup merge of #90438 - GuillaumeGomez:doc-show-coverage, r=camelid
JohnTitor Nov 18, 2021
3e97d9b
Rollup merge of #90480 - r00ster91:remove, r=kennytm
JohnTitor Nov 18, 2021
77c985f
Rollup merge of #90607 - WaffleLapkin:const_str_from_utf8, r=oli-obk
JohnTitor Nov 18, 2021
47c1bd1
Rollup merge of #90750 - camelid:rm-tuple-impls-1, r=jyn514
JohnTitor Nov 18, 2021
0a2b7d7
Rollup merge of #90895 - RalfJung:read-discriminant-valid, r=oli-obk
JohnTitor Nov 18, 2021
dfbbb3b
Rollup merge of #90989 - notriddle:notriddle/rustc-suggest-float-endi…
JohnTitor Nov 18, 2021
08c1639
Rollup merge of #91002 - petrochenkov:nosynth, r=davidtwco
JohnTitor Nov 18, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions compiler/rustc_const_eval/src/interpret/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,12 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
}
sym::discriminant_value => {
let place = self.deref_operand(&args[0])?;
if M::enforce_validity(self) {
// This is 'using' the value, so make sure the validity invariant is satisfied.
// (Also see https://github.com/rust-lang/rust/pull/89764.)
self.validate_operand(&place.into())?;
}

let discr_val = self.read_discriminant(&place.into())?.0;
self.write_scalar(discr_val, dest)?;
}
Expand Down
6 changes: 6 additions & 0 deletions compiler/rustc_const_eval/src/interpret/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,12 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {

Discriminant(place) => {
let op = self.eval_place_to_op(place, None)?;
if M::enforce_validity(self) {
// This is 'using' the value, so make sure the validity invariant is satisfied.
// (Also see https://github.com/rust-lang/rust/pull/89764.)
self.validate_operand(&op)?;
}

let discr_val = self.read_discriminant(&op)?.0;
self.write_scalar(discr_val, &dest)?;
}
Expand Down