Skip to content

Implement (but don't use) valtree and refactor in preparation of use #82936

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

Merged
merged 27 commits into from
Mar 17, 2021
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a4fbac1
Implement valtree
oli-obk Feb 22, 2021
0fe4f38
Intern valtree field vector
oli-obk Feb 22, 2021
858216c
Add fallible Scalar to ScalarInt conversion method
oli-obk Feb 23, 2021
09f7f91
Add convenience conversion methods for ScalarInt
oli-obk Feb 23, 2021
019dba0
Resolve a FIXME around type equality checks in Relate for constants
oli-obk Mar 2, 2021
4d917fa
Reduce destructuring and re-interning where possible
oli-obk Mar 2, 2021
5e8a89b
Reduce the duplication in the relation logic for constants
oli-obk Mar 2, 2021
b729cc9
Pull out ConstValue relating into its own function
oli-obk Mar 2, 2021
0bb367e
Split pretty printer logic for scalar int and scalar ptr
oli-obk Mar 2, 2021
d5eec65
Use the explicit error constant instead of fake dummies
oli-obk Mar 8, 2021
914df2a
Add `ty` helper function for mir constants
oli-obk Mar 8, 2021
3ecde6f
Directly intern allocations so that we can write a `Lift` impl for them
oli-obk Mar 8, 2021
3127a9c
Prepare mir::Constant for ty::Const only supporting valtrees
oli-obk Mar 8, 2021
20f7379
Replace a custom lift method with a Lift impl
oli-obk Mar 10, 2021
6ca1d87
Visit `mir::Constant::user_ty` for completeness.
oli-obk Mar 12, 2021
c51749a
We won't support trait object constants in type level constants for t…
oli-obk Mar 12, 2021
11ddd22
Run rustfmt
oli-obk Mar 12, 2021
c30c1be
s/ConstantSource/ConstantKind/
oli-obk Mar 15, 2021
bc8641a
Document valtree
oli-obk Mar 15, 2021
f646c1e
Explain why we do not allow const_to_valtree to read from statics
oli-obk Mar 15, 2021
c01c494
Explain how we encode enums at the encoding site
oli-obk Mar 15, 2021
0dd5a1b
Explain pointer and dyn Trait handling in const_to_valtree
oli-obk Mar 15, 2021
9f407ae
Do not expose fallible `to_int` operation on `Scalar`.
oli-obk Mar 15, 2021
1ffd21a
Pacify tidy
oli-obk Mar 15, 2021
f0997fa
Update compiler/rustc_mir/src/const_eval/mod.rs
oli-obk Mar 16, 2021
5b9bd90
Update compiler/rustc_middle/src/ty/consts/valtree.rs
oli-obk Mar 16, 2021
c4d564c
Update compiler/rustc_middle/src/ty/consts/valtree.rs
oli-obk Mar 16, 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
Prev Previous commit
Next Next commit
Update compiler/rustc_middle/src/ty/consts/valtree.rs
Co-authored-by: Ralf Jung <post@ralfj.de>
  • Loading branch information
oli-obk and RalfJung authored Mar 16, 2021
commit 5b9bd903c08cb8bfe453e71f8d2d393bcc43819f
3 changes: 2 additions & 1 deletion compiler/rustc_middle/src/ty/consts/valtree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ use rustc_macros::HashStable;
/// This datastructure is used to represent the value of constants used in the type system.
///
/// We explicitly choose a different datastructure from the way values are processed within
/// CTFE, as in the type system equal values must also have equal representation.
/// CTFE, as in the type system equal values (according to their `PartialEq`) must also have
/// equal representation (`==` on the rustc data structure, e.g. `ValTree`) and vice versa.
/// Since CTFE uses `AllocId` to represent pointers, it often happens that two different
/// `AllocId`s point to equal values. So we may end up with different representations for
/// two constants whose value is `&42`. Furthermore any kind of struct that has padding will
Expand Down