Commit Graph

27 Commits

Author SHA1 Message Date
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
Harald van Dijk 95e096d623
Change x64 size checks to not apply to x32.
Rust contains various size checks conditional on target_arch = "x86_64",
but these checks were never intended to apply to
x86_64-unknown-linux-gnux32. Add target_pointer_width = "64" to the
conditions.
2021-03-06 16:02:48 +00:00
Simon Vandel Sillesen a6dccfeb23 New mir-opt pass to simplify gotos with const values
Fixes #77355
2021-02-22 21:03:57 +01:00
Guillaume Gomez 2d39300e2f
Rollup merge of #82176 - RalfJung:mir-fn-ptr-pretty, r=oli-obk
fix MIR fn-ptr pretty-printing

An uninitialized function pointer would get printed as `{{uninit  fn()}` (notice the unbalanced parentheses), and a dangling fn ptr would ICE. This fixes both of that.

However, I have no idea how to add tests for this.

Also, I don't understand this MIR pretty-printing code. Somehow the print function `pretty_print_const_scalar` actually *returns* a transformed form of the const (but there is no doc comment explaining what is being returned); some match arms do `p!` while others do `self =`, and there's a wild mixture of `p!` and `write!`... all very mysterious and confusing.^^

r? ``@oli-obk``
2021-02-20 20:37:00 +01:00
Tomasz Miąsko d06a2a368d Pass MPlaceTy by reference not value 2021-02-16 23:52:05 +01:00
Tomasz Miąsko fe0c46d07e Pass PlaceTy by reference not value 2021-02-16 23:52:05 +01:00
Tomasz Miąsko e915cf45dc Pass OpTy by reference not value 2021-02-16 23:52:05 +01:00
Tomasz Miąsko 6c9d7fbeed Add size assertions for interpreter data structures 2021-02-16 23:34:50 +01:00
Ralf Jung b08bc7836b fix MIR fn-ptr pretty-printing 2021-02-16 09:59:38 +01:00
Ralf Jung 944237f6cd codegen: assume constants cannot fail to evaluate
also don't submit code to LLVM when the session has errors
2021-01-30 12:29:57 +01:00
Mara Bos 5ffccc4dfa
Rollup merge of #78742 - vn-ki:fix-issue-78655, r=oli-obk
make intern_const_alloc_recursive return error

fix #78655

r? ``@oli-obk``
2020-11-05 10:29:59 +01:00
Vishnunarayan K I bd7229daf0 make intern_const_alloc_recursive return error fix #78655 2020-11-04 23:22:14 +05:30
oli 500af76831 Add helper for getting an `int` out of a `Scalar` 2020-11-04 10:13:59 +00:00
oli 8282d526e0 Replace `Scalar::zst` with a `Scalar::ZST` constant 2020-11-04 10:12:41 +00:00
oli df4d717d0b s/Scalar::Raw/Scalar::Int 2020-11-04 10:11:31 +00:00
Oliver Scherer 362123dd75 Split the "raw integer bytes" part out of `Scalar` 2020-11-04 09:58:59 +00:00
Bastian Kauschke 8752a560b9 Lift: take self by value 2020-10-21 23:59:35 +02:00
est31 a0fc455d30 Replace absolute paths with relative ones
Modern compilers allow reaching external crates
like std or core via relative paths in modules
outside of lib.rs and main.rs.
2020-10-13 14:16:45 +02:00
ecstatic-morse 30f1bab7e6
Rollup merge of #76581 - lcnr:bound-too-generic, r=eddyb
do not ICE on bound variables, return `TooGeneric` instead

fixes #73260, fixes #74634, fixes #76595

r? @nikomatsakis
2020-09-21 20:40:47 -07:00
Bastian Kauschke 39245400c5 fix InterpCx resolve 2020-09-21 12:09:08 +02:00
Bastian Kauschke 2a00dda902 miri: correctly deal with `ConstKind::Bound` 2020-09-20 08:22:35 +02:00
Oliver Scherer 888afd50d9 Unify the names of const eval queries and their return types 2020-09-19 10:36:36 +02:00
Oliver Scherer dd9702a059 Do not call the `const_eval` query in mir interpretation except for caching of nulary intrinsics 2020-09-19 10:36:36 +02:00
Oliver Scherer 2d7ac728e4 Stop using the `const_eval` query for initializers of statics
As a side effect, we now represent most promoteds as `ConstValue::Scalar` again. This is useful because all implict promoteds are just references anyway and most explicit promoteds are numeric arguments to `asm!` or SIMD instructions.
2020-09-19 10:36:36 +02:00
LeSeulArtichaut 3e14b684dd Change ty.kind to a method 2020-09-04 17:47:51 +02:00
mark 9e5f7d5631 mv compiler to compiler/ 2020-08-30 18:45:07 +03:00