summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty/layout.rs
AgeCommit message (Collapse)AuthorLines
2022-09-13Address code review commentsEric Holk-6/+5
2022-09-12Make dyn-trait-method workMichael Goulet-3/+16
2022-09-12Rename some variantsMichael Goulet-7/+4
2022-09-12Construct dyn* during const interpMichael Goulet-8/+2
2022-09-12Call destructors when dyn* object goes out of scopeEric Holk-3/+12
2022-09-12dyn* through more typechecking and MIREric Holk-2/+24
2022-09-12Plumb dyn trait representation through ty::DynamicEric Holk-1/+2
2022-09-07Use niche-filling optimization even when multiple variants have data.Michael Benfield-116/+198
Fixes #46213
2022-09-07Change name of "dataful" variant to "untagged"Michael Benfield-10/+10
This is in anticipation of a new enum layout, in which the niche optimization may be applied even when multiple variants have data.
2022-09-04Make `const_eval_select` a real intrinsicDeadbeef-86/+89
2022-08-31Fix a bunch of typoDezhi Wu-1/+1
This PR will fix some typos detected by [typos]. I only picked the ones I was sure were spelling errors to fix, mostly in the comments. [typos]: https://github.com/crate-ci/typos
2022-08-27Auto merge of #100999 - nnethercote:shrink-FnAbi, r=bjorn3bors-2/+2
Shrink `FnAbi` Because they can take up a lot of memory in debug and release builds. r? `@bjorn3`
2022-08-26Change `FnAbi::args` to a boxed slice.Nicholas Nethercote-1/+1
2022-08-26Change `FnAbi::fixed_count` to a `u32`.Nicholas Nethercote-1/+1
2022-08-24add `depth_limit` in `QueryVTable`SparrowLii-36/+25
2022-08-01move layout sanity check to its own fileRalf Jung-290/+4
2022-08-01tighter checks for (some) ScalarPair layoutsRalf Jung-16/+102
2022-08-01check that Scalar layout is newtype around a suitable typeRalf Jung-40/+135
2022-07-31check 'size multiple of align' for all layoutsRalf Jung-0/+4
2022-07-30Fix the size of niche enums with ZST alignmentJosh Stone-2/+8
For enums with an aligned ZST variant, like `[T; 0]`, the niche layout was not computing a sufficient size to be consistent with alignment. Now we pad that size up to the alignment, and also make sure to only use the niche variant's ABI when the size and alignment still match.
2022-07-22do not mark interior mutable shared refs as dereferenceableRalf Jung-5/+10
2022-07-22rename PointerKind::Shared → SharedMutable to indicate this is NOT the ↵Ralf Jung-4/+4
usual shared reference
2022-07-20consistently use VTable over Vtable (matching stable stdlib API RawWakerVTable)Ralf Jung-1/+1
2022-07-19Add flag to configure `noalias` on `Box<T>`nils-2/+7
To aid making an informed decision about the aliasing rules of box, give users an option to remove `noalias` from box.
2022-07-16Rollup merge of #99342 - TaKO8Ki:avoid-symbol-to-string-conversions, ↵Matthias Krüger-2/+2
r=compiler-errors Avoid some `Symbol` to `String` conversions This patch removes some Symbol to String conversions.
2022-07-17avoid some `Symbol` to `String` conversionsTakayuki Maeda-2/+2
2022-07-13Rename `debugging_opts` to `unstable_opts`Joshua Nelson-2/+2
This is no longer used only for debugging options (e.g. `-Zoutput-width`, `-Zallow-features`). Rename it to be more clear.
2022-07-11Hide niches in SIMD types, tooOli Scherer-6/+1
2022-07-11More obvious closure nameOli Scherer-4/+4
2022-07-08Create a custom layout path for UnsafeCell instead of piggy backing on the ↵Oli Scherer-21/+39
layout_scalar_valid_range logic
2022-07-07`UnsafeCell` now has no niches, ever.Oli Scherer-22/+26
2022-07-06Rollup merge of #98968 - RalfJung:scalar-sanity, r=oli-obkDylan DPC-3/+2
assert Scalar sanity With https://github.com/rust-lang/rust/pull/96814 having landed, finally our `Scalar` layouts have the invariants they deserve. :)
2022-07-06Auto merge of #98206 - eggyal:align-to-chalk-folding-api, r=jackh726bors-1/+1
Split TypeVisitable from TypeFoldable Impl of rust-lang/compiler-team#520 following MCP approval. r? `@ghost`
2022-07-06Update TypeVisitor pathsAlan Egerton-1/+1
2022-07-05finally enable Scalar layout sanity checksRalf Jung-3/+2
2022-07-05fix the layout of repr(align) enumsRalf Jung-3/+3
2022-05-30Add support for emitting functions with `coldcc` in LLVMScott McMurray-1/+2
The eventual goal is to try using this for things like the internal panicking stuff, to see whether it helps.
2022-05-22Lifetime variance fixes for rustcMichael Goulet-1/+1
2022-05-17Auto merge of #96959 - nbdd0121:unwind, r=Amanieubors-0/+8
Prevent unwinding when `-C panic=abort` is used regardless declared ABI Ensures that Rust code will abort with `-C panic=abort` regardless ABI used. ```rust extern "C-unwind" { fn may_unwind(); } // Will be nounwind with `-C panic=abort`, despite `C-unwind` ABI. pub unsafe extern "C-unwind" fn rust_item_that_can_unwind() { may_unwind(); } ``` Current behaviour is that unwind will propagate through. While the current behaviour won't cause unsoundness it is inconsistent with the text reading of [RFC2945](https://rust-lang.github.io/rfcs/2945-c-unwind-abi.html). I tweaked `fn_can_unwind` instead of tweaking `AbortUnwindingCalls` because this approach would allow Rust (non-direct) callers to also see that this function is nounwind, so it can prevent excessive landing pads generation. For more discussions: https://rust-lang.zulipchat.com/#narrow/stream/210922-project-ffi-unwind/topic/soundness.20in.20mixed.20panic.20mode. cc `@alexcrichton,` `@BatmanAoD` r? `@Amanieu` `@rustbot` label: T-compiler T-lang F-c_unwind
2022-05-13Add bound_fn_sigJack Huey-4/+3
2022-05-12Prevent unwinding when `-C panic=abort` is used regardless declared ABIGary Guo-0/+8
2022-05-10Introduce EarlyBinderJack Huey-5/+6
2022-05-10Rollup merge of #96872 - RalfJung:layout-sanity, r=eddybDylan DPC-9/+127
make sure ScalarPair enums have ScalarPair variants; add some layout sanity checks `@eddyb` suggested that it might be reasonable for `ScalarPair` enums to simply adjust the ABI of their variants accordingly, such that the layout invariant Miri expects actually holds. This PR implements that. I should note though that I don't know much about this layout computation code and what non-Miri consumers expect from it, so tread with caution! I also added a function to sanity-check that computed layouts are internally consistent. This helped a lot in figuring out the final shape of this PR, though I am also not 100% sure that these sanity checks are the right ones. Cc `@oli-obk` Fixes https://github.com/rust-lang/rust/issues/96221
2022-05-09also sanity-check Abi::Vector, and slight refactoringRalf Jung-26/+43
2022-05-09make sure ScalarPair enums have ScalarPair variants; add some layout sanity ↵Ralf Jung-11/+112
checks
2022-05-09move `panic-in-drop=abort` check for `drop_in_place`lcnr-20/+21
Whether `drop_in_place` can abort does depend on the `panic-in-drop` option while compiling the current crate, not `core`
2022-04-26Rollup merge of #94703 - kjetilkjeka:nvptx-kernel-args-abi2, r=nagisaGuillaume Gomez-0/+16
Fix codegen bug in "ptx-kernel" abi related to arg passing I found a codegen bug in the nvptx abi related to that args are passed as ptrs ([see comment](https://github.com/rust-lang/rust/issues/38788#issuecomment-1048999928)), this is not as specified in the [ptx-interoperability doc](https://docs.nvidia.com/cuda/ptx-writers-guide-to-interoperability/) or how C/C++ does it. It will also almost always fail in practice since device/host uses different memory spaces for most hardware. This PR fixes the bug and add tests for passing structs to ptx kernels. I observed that all nvptx assembly tests had been marked as [ignore a long time ago](https://github.com/rust-lang/rust/pull/59752#issuecomment-501713428). I'm not sure if the new one should be marked as ignore, it passed on my computer but it might fail if ptx-linker is missing on the server? I guess this is outside scope for this PR and should be looked at in a different issue/PR. I only fixed the nvptx64-nvidia-cuda target and not the potential code paths for the non-existing 32bit target. Even though 32bit nvptx is not a supported target there are still some code under the hood supporting codegen for 32 bit ptx. I was advised to create an MCP to find out if this code should be removed or updated. Perhaps ``@RDambrosio016`` would have interest in taking a quick look at this.
2022-04-19Fix a bug in the ptx-kernel calling convention where structs was passed ↵Kjetil Kjeka-0/+16
indirectly Structs being passed indirectly is suprpising and have a high chance not to work as the device and host usually do not share memory.
2022-04-18mark payload fields of ScalarPair enums as Scalar::Union when they're not ↵Erik Desjardins-16/+21
always initialized
2022-04-09Auto merge of #95524 - oli-obk:cached_stable_hash_cleanups, r=nnethercotebors-40/+28
Cached stable hash cleanups r? `@nnethercote` Add a sanity assertion in debug mode to check that the cached hashes are actually the ones we get if we compute the hash each time. Add a new data structure that bundles all the hash-caching work to make it easier to re-use it for different interned data structures