about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
AgeCommit message (Collapse)AuthorLines
2022-08-01make `PlaceholderConst` not store the type of the constEllen-4/+4
2022-08-01move layout sanity check to its own fileRalf Jung-290/+304
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-08-01fix ICE in Definitions::create_defGoldstein-2/+2
2022-08-01Improve size assertions.Nicholas Nethercote-21/+23
- For any file with four or more size assertions, move them into a separate module (as is already done for `hir.rs`). - Add some more for AST nodes and THIR nodes. - Put the `hir.rs` ones in alphabetical order.
2022-07-31Rollup merge of #99973 - RalfJung:layout-things, r=eddybMatthias Krüger-0/+4
Layout things These two commits are pretty independent, but didn't seem worth doing individual PRs for: - Always check that size is a multiple of align, even without debug assertions - Change Layout debug printing to put `variants` last, since it often huge and not usually the part we are most interested in Cc `@eddyb`
2022-07-31Rollup merge of #99186 - camsteffen:closure-localdefid, r=cjgillotDylan DPC-55/+54
Use LocalDefId for closures more
2022-07-31check 'size multiple of align' for all layoutsRalf Jung-0/+4
2022-07-30Auto merge of #99959 - cuviper:niche-size, r=eddybbors-2/+8
Fix the size of niche enums with ZST alignment 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. Fixes #99836 r? `@eddyb`
2022-07-30avoid assertion failures in try_to_scalar_intRalf Jung-1/+3
2022-07-30Use LocalDefId for closures moreCameron Steffen-55/+54
2022-07-30Inline a few short methods.Camille GILLOT-0/+9
2022-07-30Simplify implementation for par_for_each_module.Camille GILLOT-19/+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-30Rollup merge of #99900 - lcnr:hash-stable-fun, r=cjgillotDylan DPC-89/+10
remove some manual hash stable impls
2022-07-30Rollup merge of #99311 - kckeiks:clean-up-body-owner-methods, r=cjgillotDylan DPC-12/+14
change maybe_body_owned_by to take local def id Issue https://github.com/rust-lang/rust/issues/96341 r? `@cjgillot`
2022-07-29Change enclosing_body_owner to return LocalDefIdMiguel Guarniz-4/+4
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-07-29Rename local_did to def_idMiguel Guarniz-3/+3
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-07-29Change maybe_body_owned_by to take local def idMiguel Guarniz-9/+11
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-07-29Auto merge of #99730 - lcnr:bound-vars-anon, r=jackh726bors-72/+154
anonymize all bound vars, not just regions fixes #98702 r? types
2022-07-29remove some manual hash stable implslcnr-89/+10
2022-07-29optimize bound vars replacement :3lcnr-18/+22
2022-07-28anonymize all bound vars, not just regionslcnr-7/+75
2022-07-28`BoundVarReplacer`: trait object instead of 3 fnslcnr-66/+76
2022-07-28Use line numbers relative to function in mir opt testsNilstrieb-6/+12
This adds a new option, `-Zmir-pretty-relative-line-numbers`, that is then used in compiletest for the mir-opt tests.
2022-07-27safe transmute: revise `Hash`, `PartialEq` impls on `VariantDef`, `FieldDef`Jack Wrenn-12/+61
Exhaustively destructure parameter(s) so that changes to type definitions will lead to compile errors, thus reminding contributors to re-assess the assumptions underpinning these impls. ref: https://github.com/rust-lang/rust/pull/92268/#discussion_r925241377 ref: https://github.com/rust-lang/rust/pull/92268/#discussion_r925241718
2022-07-27Initial (incomplete) implementation of transmutability trait.Jack Wrenn-1/+45
This initial implementation handles transmutations between types with specified layouts, except when references are involved. Co-authored-by: Igor null <m1el.2027@gmail.com>
2022-07-27Rollup merge of #99728 - cjgillot:ast-lifetimes-anon-clean, r=petrochenkovGuillaume Gomez-1/+0
Clean up HIR-based lifetime resolution Based on https://github.com/rust-lang/rust/pull/97313. Fixes #98932. r? `@petrochenkov`
2022-07-27Rollup merge of #99651 - compiler-errors:fn-and-raw-ptr-in-const-generics, ↵Guillaume Gomez-1/+1
r=oli-obk Deeply deny fn and raw ptrs in const generics I think this is right -- just because we wrap a fn ptr in a wrapper type does not mean we should allow it in a const parameter. We now reject both of these in the same way: ``` #![feature(adt_const_params)] #[derive(Eq, PartialEq)] struct Wrapper(); fn foo<const W: Wrapper>() {} fn foo2<const F: fn()>() {} ``` This does regress one test (`src/test/ui/consts/refs_check_const_eq-issue-88384.stderr`), but I'm not sure it should've passed in the first place. cc: ``@b-naber`` who introduced that test^ fixes #99641
2022-07-27Rollup merge of #99358 - compiler-errors:issue-99325, r=oli-obkGuillaume Gomez-21/+15
Allow `ValTree::try_to_raw_bytes` on `u8` array Fixes #99325 cc `@b-naber` I think who touched this last in 705d818bd52a6324d5e7693cc4306457395eebc8
2022-07-27Rollup merge of #99704 - fee1-dead-contrib:add_self_tilde_const_trait, r=oli-obkYuki Okushi-1/+9
Add `Self: ~const Trait` to traits with `#[const_trait]` r? `@oli-obk`
2022-07-26Auto merge of #99574 - durin42:allocator-patch-redux, r=nikicbors-1/+7
codegen: use new {re,de,}allocator annotations in llvm This obviates the patch that teaches LLVM internals about _rust_{re,de}alloc functions by putting annotations directly in the IR for the optimizer. The sole test change is required to anchor FileCheck to the body of the `box_uninitialized` method, so it doesn't see the `allocalign` on `__rust_alloc` and get mad about the string `alloca` showing up. Since I was there anyway, I added some checks on the attributes to prove the right attributes got set. r? `@nikic`
2022-07-26Stop creating anonymous late lifetimes.Camille GILLOT-1/+0
2022-07-26Fix diagnostics for unfulfilled obligationsDeadbeef-0/+8
2022-07-26Add `Self: ~const Trait` to traits with `#[const_trait]`Deadbeef-1/+1
2022-07-26codegen: use new {re,de,}allocator annotations in llvmAugie Fackler-1/+7
This obviates the patch that teaches LLVM internals about _rust_{re,de}alloc functions by putting annotations directly in the IR for the optimizer. The sole test change is required to anchor FileCheck to the body of the `box_uninitialized` method, so it doesn't see the `allocalign` on `__rust_alloc` and get mad about the string `alloca` showing up. Since I was there anyway, I added some checks on the attributes to prove the right attributes got set. While we're here, we also emit allocator attributes on __rust_alloc_zeroed. This should allow LLVM to perform more optimizations for zeroed blocks, and probably fixes #90032. [This comment](https://github.com/rust-lang/rust/issues/24194#issuecomment-308791157) mentions "weird UB-like behaviour with bitvec iterators in rustc_data_structures" so we may need to back this change out if things go wrong. The new test cases require LLVM 15, so we copy them into LLVM 14-supporting versions, which we can delete when we drop LLVM 14.
2022-07-26remove commented out codeMaybe Waffle-1/+0
2022-07-26Implement `#[rustc_default_body_unstable]`Maybe Waffle-1/+69
This attribute allows to mark default body of a trait function as unstable. This means that implementing the trait without implementing the function will require enabling unstable feature. This is useful in conjunction with `#[rustc_must_implement_one_of]`, we may want to relax requirements for a trait, for example allowing implementing either of `PartialEq::{eq, ne}`, but do so in a safe way -- making implementation of only `PartialEq::ne` unstable.
2022-07-26Rollup merge of #99748 - compiler-errors:better-impl-trait-printing, r=fee1-deadDylan DPC-4/+4
Use full type name instead of just saying `impl Trait` in "captures lifetime" error I think this is very useful, especially when there's >1 `impl Trait`, and it just means passing around a bit more info that we already have access to.
2022-07-26Allow try_to_raw_bytes on u8 arrayMichael Goulet-21/+15
2022-07-26Use real opaque type instead of just saying impl TraitMichael Goulet-4/+4
2022-07-26Rollup merge of #99353 - compiler-errors:gat-where-clause-mismatch, r=cjgillotYuki Okushi-16/+15
Slightly improve mismatched GAT where clause error This makes the error reporting a bit more standardized between `where` on GATs and functions. cc #99206 (`@BoxyUwU),` don't want to mark this as as "fixed" because they're still not perfect, but this is still an improvement IMO so I want to land it incrementally. regarding "consider adding where clause to trait definition", we don't actually do that for methods as far as i can tell? i could file an issue to look into that maybe.
2022-07-26Rollup merge of #97077 - ouz-a:Optimize-backend, r=oli-obkYuki Okushi-0/+14
Simplify some code that depend on Deref Now that we can assume #97025 works, it's safe to expect Deref is always in the first place of projections. With this, I was able to simplify some code that depended on Deref's place in projections. When we are able to move Derefer before `ElaborateDrops` successfully we will be able to optimize more places. r? `@oli-obk`
2022-07-25Auto merge of #99600 - tmiasko:subst-folder, r=petrochenkovbors-55/+72
Tweak `SubstFolder` implementation
2022-07-25Auto merge of #98770 - klensy:no-string-dupes-ugly, r=cjgillotbors-1/+7
rmeta: avoid embedding `StabilityLevel::Unstable` reason multiple times into .rmeta\.rlib files Avoids bloating size of some rmeta\rlib files by not placing default string for `StabilityLevel::Unstable` reason multiple times, affects only stdlib\rustc artifacts. For stdlib cuts about 3% (diff of total size for patched\unpatched *.rmeta files of stage1-std) of file size, depending on crates. fixes #88180
2022-07-25Deeply deny fn and raw ptrs in const genericsMichael Goulet-1/+1
2022-07-24Combine redundant obligation cause codesMichael Goulet-16/+15
2022-07-24Rollup merge of #99644 - RalfJung:interpret-int-ptr-transmute, r=oli-obkRalf Jung-0/+18
remove some provenance-related machine hooks that Miri no longer needs Then we can make `scalar_to_ptr` a method on `Scalar`. :) Fixes https://github.com/rust-lang/miri/issues/2188 r? `@oli-obk`
2022-07-24make sure has_deref is correctouz-a-0/+2