1. 27 8月, 2021 22 次提交
  2. 26 8月, 2021 18 次提交
    • B
      Auto merge of #88308 - eddyb:cooked-layouts, r=nagisa · 4b9f4b22
      bors 提交于
      Morph `layout_raw` query into `layout_of`.
      
      Before this PR, `LayoutCx::layout_of` wrapped the `layout_raw` query, to:
      * normalize the type, before attempting to compute the layout
      * pass the layout to `record_layout_for_printing`, for `-Zprint-type-sizes`
      
      Moving those two responsibilities into the query may reduce overhead (due to cached calls skipping those steps), but I want to do a perf run to know.
      
      One of the changes I had to make was changing the return type of the query, to be able to both get out the type produced by normalizing inside the query *and* to match the signature of the old `TyCtxt::layout_of`. This change may be worse, perf-wise, so that's another reason I want to check.
      
      r? `@nagisa` cc `@oli-obk`
      4b9f4b22
    • A
      RustWrapper: adapt to LLVM change 0f45c16f2caa · 027db5d0
      Augie Fackler 提交于
      The above-mentioned commit (part of the LLVM 14 development cycle)
      removes a method that rustc uses somewhat extensively. We mostly switch
      to lower-level methods that exist in all versions of LLVM we use, so no
      new ifdef logic is required in most cases.
      027db5d0
    • S
      Add argument types tait tests · 4924e345
      Santiago Pastorino 提交于
      4924e345
    • W
      Add test for stepping though `match` expressions · 84a26614
      Wesley Wiser 提交于
      84a26614
    • B
      Auto merge of #83698 - erikdesjardins:undefconst, r=RalfJung,oli-obk · 20997f6a
      bors 提交于
      Use undef for uninitialized bytes in constants
      
      Fixes #83657
      
      This generates good code when the const is fully uninit, e.g.
      
      ```rust
      #[no_mangle]
      pub const fn fully_uninit() -> MaybeUninit<[u8; 10]> {
          const M: MaybeUninit<[u8; 10]> = MaybeUninit::uninit();
          M
      }
      ```
      generates
      ```asm
      fully_uninit:
      	ret
      ```
      
      as you would expect.
      
      There is no improvement, however, when it's partially uninit, e.g.
      
      ```rust
      pub struct PartiallyUninit {
          x: u64,
          y: MaybeUninit<[u8; 10]>
      }
      
      #[no_mangle]
      pub const fn partially_uninit() -> PartiallyUninit {
          const X: PartiallyUninit = PartiallyUninit { x: 0xdeadbeefcafe, y: MaybeUninit::uninit() };
          X
      }
      ```
      generates
      ```asm
      partially_uninit:
      	mov	rax, rdi
      	mov	rcx, qword ptr [rip + .L__unnamed_1+16]
      	mov	qword ptr [rdi + 16], rcx
      	movups	xmm0, xmmword ptr [rip + .L__unnamed_1]
      	movups	xmmword ptr [rdi], xmm0
      	ret
      
      .L__unnamed_1:
      	.asciz	"\376\312\357\276\255\336\000"
      	.zero	16
      	.size	.L__unnamed_1, 24
      ```
      which copies a bunch of zeros in place of the undef bytes, the same as before this change.
      
      Edit: generating partially-undef constants isn't viable at the moment anyways due to #84565, so it's disabled
      20997f6a
    • L
      rebase · 7cbfa2ee
      lcnr 提交于
      7cbfa2ee
    • L
      optimize `HasTypeFlagsVisitor` · eb5bbab3
      lcnr 提交于
      eb5bbab3
    • L
      inline stuff · 97712459
      lcnr 提交于
      97712459
    • L
      add fixme · bc0983df
      lcnr 提交于
      bc0983df
    • L
      type flags · c58d749c
      lcnr 提交于
      c58d749c
    • L
      review · f3996f6a
      lcnr 提交于
      f3996f6a
    • L
      shrink `ty::PredicateKind` again · bc0156ba
      lcnr 提交于
      bc0156ba
    • L
      is_polymorphic doesn't matter for tests · 283e0e67
      lcnr 提交于
      283e0e67
    • L
      update mir diffs · 5ba8f4d2
      lcnr 提交于
      5ba8f4d2
    • L
      ignore const substs in `implicit_infer` · 6755b2da
      lcnr 提交于
      6755b2da
    • L
      use `ty::Unevaluated` instead of def substs pair · caa975c8
      lcnr 提交于
      caa975c8
    • L
      check for cycles in `default_anon_const_substs` · 03124389
      lcnr 提交于
      03124389
    • L
      don't just compare `ty::Const` · 2140016d
      lcnr 提交于
      2140016d