1. 15 7月, 2023 1 次提交
    • B
      Auto merge of #112157 - erikdesjardins:align, r=nikic · 4f16abdf
      bors 提交于
      Resurrect: rustc_target: Add alignment to indirectly-passed by-value types, correcting the alignment of byval on x86 in the process.
      
      Same as #111551, which I [accidentally closed](https://github.com/rust-lang/rust/pull/111551#issuecomment-1571222612) :/
      
      ---
      
      This resurrects PR #103830, which has sat idle for a while.
      
      Beyond #103830, this also:
      - fixes byval alignment for types containing vectors on Darwin (see `tests/codegen/align-byval-vector.rs`)
      - fixes byval alignment for overaligned types on x86 Windows (see `tests/codegen/align-byval.rs`)
      - fixes ABI for types with 128bit requested alignment on ARM64 Linux (see `tests/codegen/aarch64-struct-align-128.rs`)
      
      r? `@nikic`
      
      ---
      
      `@pcwalton's` original PR description is reproduced below:
      
      Commit 88e4d2c2 from five years ago removed
      support for alignment on indirectly-passed arguments because of problems with
      the `i686-pc-windows-msvc` target. Unfortunately, the `memcpy` optimizations I
      recently added to LLVM 16 depend on this to forward `memcpy`s. This commit
      attempts to fix the problems with `byval` parameters on that target and now
      correctly adds the `align` attribute.
      
      The problem is summarized in [this comment] by `@EddyB.` Briefly, 32-bit x86 has
      special alignment rules for `byval` parameters: for the most part, their
      alignment is forced to 4. This is not well-documented anywhere but in the Clang
      source. I looked at the logic in Clang `TargetInfo.cpp` and tried to replicate
      it here. The relevant methods in that file are
      `X86_32ABIInfo::getIndirectResult()` and
      `X86_32ABIInfo::getTypeStackAlignInBytes()`. The `align` parameter attribute
      for `byval` parameters in LLVM must match the platform ABI, or miscompilations
      will occur. Note that this doesn't use the approach suggested by eddyb, because
      I felt it was overkill to store the alignment in `on_stack` when special
      handling is really only needed for 32-bit x86.
      
      As a side effect, this should fix #80127, because it will make the `align`
      parameter attribute for `byval` parameters match the platform ABI on LLVM
      x86-64.
      
      [this comment]: #80822 (comment)
      4f16abdf
  2. 14 7月, 2023 1 次提交
  3. 11 7月, 2023 3 次提交
  4. 08 7月, 2023 1 次提交
  5. 06 7月, 2023 1 次提交
  6. 05 7月, 2023 1 次提交
  7. 30 6月, 2023 1 次提交
  8. 29 6月, 2023 1 次提交
    • N
      Avoid unnecessary line lookup. · 9db001df
      Nicholas Nethercote 提交于
      `lookup_debug_loc` calls `SourceMap::lookup_line`, which does a binary
      search over the files, and then a binary search over the lines within
      the found file. It then calls `SourceFile::line_begin_pos`, which redoes
      the binary search over the lines within the found file.
      
      This commit removes the second binary search over the lines, instead
      getting the line starting pos directly using the result of the first
      binary search over the lines.
      
      (And likewise for `get_span_loc`, in the cranelift backend.)
      9db001df
  9. 27 6月, 2023 1 次提交
  10. 20 6月, 2023 1 次提交
  11. 19 6月, 2023 2 次提交
  12. 18 6月, 2023 1 次提交
  13. 17 6月, 2023 1 次提交
  14. 16 6月, 2023 1 次提交
  15. 14 6月, 2023 1 次提交
    • B
      Auto merge of #112314 - ferrocene:pa-core-alloc-abort, r=bjorn3 · 2445d740
      bors 提交于
      Ignore `core`, `alloc` and `test` tests that require unwinding on `-C panic=abort`
      
      Some of the tests for `core` and `alloc` require unwinding through their use of `catch_unwind`. These tests fail when testing using `-C panic=abort` (in my case through a target without unwinding support, and `-Z panic-abort-tests`), while they should be ignored as they don't indicate a failure.
      
      This PR marks all of these tests with this attribute:
      
      ```rust
      #[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
      ```
      
      I'm not aware of a way to test this on rust-lang/rust's CI, as we don't test any target with `-C panic=abort`, but I tested this locally on a Ferrocene target and it does indeed make the test suite pass.
      2445d740
  16. 13 6月, 2023 1 次提交
  17. 05 6月, 2023 1 次提交
  18. 03 6月, 2023 1 次提交
  19. 01 6月, 2023 2 次提交
  20. 30 5月, 2023 2 次提交
    • N
      Rollup merge of #112060 - lcnr:early-binder, r=jackh726 · 04dca8f1
      Nilstrieb 提交于
      `EarlyBinder::new` -> `EarlyBinder::bind`
      
      for consistency with `Binder::bind`. it may make sense to also add `EarlyBinder::dummy` in places where we know that no parameters exist, but I left that out of this PR.
      
      r? `@jackh726` `@kylematsuda`
      04dca8f1
    • M
      Rollup merge of #111827 - AngelicosPhosphoros:add_docs_to_cranelift, r=bjorn3 · a2a8589a
      Matthias Krüger 提交于
      Add build instructions for cranelift backend as part of Rust repo
      
      All other instructions assume that user works with separate repository than Rust compiler repository. When one follows default instructions, cranelift codegen tries to use different sys-root and compiler internal crates which leads to compiler errors when building it.
      
      I needed to do all this steps while adding new intrinsic to rustc.
      
      r? bjorn3
      a2a8589a
  21. 29 5月, 2023 2 次提交
  22. 27 5月, 2023 1 次提交
  23. 26 5月, 2023 5 次提交
    • M
      Rollup merge of #111950 - cjgillot:expn-noinline, r=oli-obk · 2f250c73
      Michael Goulet 提交于
      Remove ExpnKind::Inlined.
      
      Suggested in https://github.com/rust-lang/rust/pull/111815#issuecomment-1561903339
      
      r? ``@oli-obk``
      2f250c73
    • A
      Added build instructions for cranelift backend as part of Rust repo · 8aa3eba5
      AngelicosPhosphoros 提交于
      All other instructions assume that user works with separate repository than Rust compiler repository. When one follows default instructions, cranelift codegen tries to use different sys-root and compiler internal crates which leads to compiler errors when building it.
      
      I needed to do all this steps while adding new intrinsic to rustc.
      8aa3eba5
    • C
      Remove DesugaringKind::Replace. · 03f275bc
      Camille GILLOT 提交于
      03f275bc
    • B
      Auto merge of #86844 - bjorn3:global_alloc_improvements, r=pnkfelix · e6d1a0ed
      bors 提交于
      Support #[global_allocator] without the allocator shim
      
      This makes it possible to use liballoc/libstd in combination with `--emit obj` if you use `#[global_allocator]`. This is what rust-for-linux uses right now and systemd may use in the future. Currently they have to depend on the exact implementation of the allocator shim to create one themself as `--emit obj` doesn't create an allocator shim.
      
      Note that currently the allocator shim also defines the oom error handler, which is normally required too. Once `#![feature(default_alloc_error_handler)]` becomes the only option, this can be avoided. In addition when using only fallible allocator methods and either `--cfg no_global_oom_handling` for liballoc (like rust-for-linux) or `--gc-sections` no references to the oom error handler will exist.
      
      To avoid this feature being insta-stable, you will have to define `__rust_no_alloc_shim_is_unstable` to avoid linker errors.
      
      (Labeling this with both T-compiler and T-lang as it originally involved both an implementation detail and had an insta-stable user facing change. As noted above, the `__rust_no_alloc_shim_is_unstable` symbol requirement should prevent unintended dependence on this unstable feature.)
      e6d1a0ed
    • C
      Remove ExpnKind::Inlined. · f9dabd8b
      Camille GILLOT 提交于
      f9dabd8b
  24. 24 5月, 2023 1 次提交
  25. 18 5月, 2023 1 次提交
  26. 17 5月, 2023 1 次提交
    • N
      Remove `LangItems::require` · 74ab27c2
      Nilstrieb 提交于
      It's just a short wrapper used by `tcx.require_lang_item`. Deleting it
      gives us a negative diff.
      74ab27c2
  27. 16 5月, 2023 1 次提交
    • N
      Avoid `&format("...")` calls in error message code. · 8a9b38fd
      Nicholas Nethercote 提交于
      Error message all end up passing into a function as an `impl
      Into<{D,Subd}iagnosticMessage>`. If an error message is creatd as
      `&format("...")` that means we allocate a string (in the `format!`
      call), then take a reference, and then clone (allocating again) the
      reference to produce the `{D,Subd}iagnosticMessage`, which is silly.
      
      This commit removes the leading `&` from a lot of these cases. This
      means the original `String` is moved into the
      `{D,Subd}iagnosticMessage`, avoiding the double allocations. This
      requires changing some function argument types from `&str` to `String`
      (when all arguments are `String`) or `impl
      Into<{D,Subd}iagnosticMessage>` (when some arguments are `String` and
      some are `&str`).
      8a9b38fd
  28. 11 5月, 2023 3 次提交