Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update rustc version incrementally to nightly-2022-12-06 #811

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
867db8b
Updated to `nightly-2022-08-22`, the latest version not requiring any…
kkysen Jan 4, 2023
74f703f
Used `Default::default()` instead of `Vec::new()` so that `ThinVec::n…
kkysen Jan 4, 2023
9416506
Updated to `nightly-2022-08-23` after the `Vec::new()` => `Default::d…
kkysen Jan 4, 2023
9f4e406
Updated to `nightly-2022-08-29`, the latest version not requiring any…
kkysen Jan 4, 2023
a2738de
Updated to `nightly-2022-09-30`, changing `.basic_blocks()` => `.basi…
kkysen Jan 4, 2023
de457a9
Updated to `nightly-2022-09-08`, changing `StatementKind::{CopyNonOve…
kkysen Jan 4, 2023
23d9928
`cargo clippy --fix` after the update to `nightly-2022-09-08`.
kkysen Jan 4, 2023
848a7e9
Updated to `nightly-2022-09-17`, the latest version not requiring an…
kkysen Jan 4, 2023
bf95e95
`cargo clippy --fix && cargo fmt` after the update to `nightly-2022-0…
kkysen Jan 5, 2023
4a740ab
In `c2rust_instrument::into_operand::make_const`, use `ConstantKind::…
kkysen Jan 5, 2023
76be307
Updated to `nightly-2022-09-19`, which seems to change the PDG by eli…
kkysen Jan 5, 2023
674d0e2
Updated to `nightly-2022-09-21`, adding a `match` arm for `Projection…
kkysen Jan 5, 2023
5ea3998
Updated to `nightly-2022-10-08`, the latest version not requiring any…
kkysen Jan 5, 2023
6ede894
`cargo clippy --fix` after the update to `nightly-2022-10-08`.
kkysen Jan 5, 2023
78d36f2
Trivial `clippy` fixes after the update to `nightly-2022-10-08`.
kkysen Jan 5, 2023
7fd06e3
Updated to `nightly-2022-10-09`, changing `CastKind{Misc => PtrToPtr}…
kkysen Jan 5, 2023
9e6a899
Updated to `nightly-2022-12-06`, the latest version not requiring any…
kkysen Jan 5, 2023
3bb66d6
`cargo clippy --fix && cargo fmt` after the update to `nightly-2022-1…
kkysen Jan 5, 2023
d835ba6
Trivial `clippy` fixes after the update to `nightly-2022-12-06`.
kkysen Jan 5, 2023
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
Prev Previous commit
Next Next commit
In c2rust_instrument::into_operand::make_const, use `ConstantKind::…
…from_bits`, not `ty::Const::from_bits`, since the latter requires `ConstantKind::Ty`.

When using `ConstantKind::Ty` explicitly, it tells `rustc` that the constant is coming from the type system.
This is not the case for our `u32` indices that have nothing to do with the type system (e.x. a const generic parameter).
A change in `nightly-2022-09-19` reworked the constant evaluator
and requires such `ConstantKind::Ty`s to use `ConstKind::Param` (e.x. a const generic parameter),
but `ty::Const::from_bits` uses `ConstKind::Value`, and thus there is a runtime crash.
Thus, now we switch to using `ConstantKind::from_bits` directly,
which lets the `rustc` code choose the correct `ConstantKind` (in practice, `ConstantKind::Val`),
which avoids the `ConstKind::Param` runtime check.

Although this change arose from a crash due to additions in `nightly-2022-09-19`,
I'm including it as a separate commit before that
because it appears we were using `ConstantKind::Ty` wrong the whole time,
and this recent change just added more stirngent checks and exposed our error.
  • Loading branch information
kkysen committed Feb 1, 2023
commit 4a740ab2f3db148e11e5a5ae92fecf2c5f6669e7
8 changes: 2 additions & 6 deletions dynamic_instrumentation/src/into_operand.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use rustc_middle::{
mir::{Constant, ConstantKind, Local, Operand, Place},
ty::{self, ParamEnv, TyCtxt},
ty::{ParamEnv, TyCtxt},
};
use rustc_span::DUMMY_SP;

@@ -37,10 +37,6 @@ fn make_const(tcx: TyCtxt, idx: u32) -> Operand {
Operand::Constant(Box::new(Constant {
span: DUMMY_SP,
user_ty: None,
literal: ConstantKind::Ty(ty::Const::from_bits(
tcx,
idx.into(),
ParamEnv::empty().and(tcx.types.u32),
)),
literal: ConstantKind::from_bits(tcx, idx.into(), ParamEnv::empty().and(tcx.types.u32)),
}))
}