Commit Graph

1273 Commits

Author SHA1 Message Date
bors
252741673b Auto merge of #107360 - bjorn3:fix_thin_archive_reading, r=wesleywiser
Fix thin archive reading

This includes a revert of https://github.com/rust-lang/rust/pull/105221 to restore fat archive reading with LlvmArchiveBuilder.

Should fix #107162, #107334 and https://github.com/google/shaderc-rs/issues/133
2023-01-28 04:02:25 +00:00
Camille GILLOT
1974b6b68d Introduce GeneratorWitnessMIR. 2023-01-27 18:58:44 +00:00
bors
7919ef0ec5 Auto merge of #107055 - kylematsuda:eb-fn-sig, r=lcnr
Switch to `EarlyBinder` for `fn_sig` query

Part of the work to finish #105779 (also see https://github.com/rust-lang/types-team/issues/78).

Several queries `X` have a `bound_X` variant that wraps the output in [`EarlyBinder`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/subst/struct.EarlyBinder.html). This adds `EarlyBinder` to the return type of the `fn_sig` query and removes `bound_fn_sig`.

r? `@lcnr`
2023-01-27 15:02:44 +00:00
bjorn3
b2e2988531 Revert "Avoid a temporary file when processing macOS fat archives"
This reverts commit bd8e476d8b.
2023-01-27 11:46:20 +00:00
Kyle Matsuda
ab40ba2fb1 add EarlyBinder::no_bound_vars 2023-01-26 20:28:31 -07:00
Kyle Matsuda
c2414dfaa4 change fn_sig query to use EarlyBinder; remove bound_fn_sig query; add EarlyBinder to fn_sig in metadata 2023-01-26 20:28:25 -07:00
bors
db137ba7d4 Auto merge of #106959 - tmiasko:opt-funclets, r=davidtwco
Omit needless funclet partitioning
2023-01-27 03:25:16 +00:00
Kyle Matsuda
e982971ff2 replace usages of fn_sig query with bound_fn_sig 2023-01-26 20:15:36 -07:00
Matthias Krüger
1b442befca
Rollup merge of #106904 - khuey:preserve_debuginfo_for_rlibs, r=davidtwco
Preserve split DWARF files when building archives.

r? ```@davidtwco```
2023-01-26 15:02:19 +01:00
bors
40fda7b3fe Auto merge of #107318 - matthiaskrgr:rollup-776kd81, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #97373 (impl DispatchFromDyn for Cell and UnsafeCell)
 - #106625 (Remove backwards compat for LLVM 12 coverage format)
 - #106779 (Avoid __cxa_thread_atexit_impl on Emscripten)
 - #106811 (Append .dwp to the binary filename instead of replacing the existing extension.)
 - #106836 (Remove optimistic spinning from `mpsc::SyncSender`)
 - #106946 (implement Hash for proc_macro::LineColumn)
 - #107074 (remove unnecessary check for opaque types)
 - #107287 (Improve fn pointer notes)
 - #107304 (Use `can_eq` to compare types for default assoc type error)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-26 09:14:05 +00:00
Matthias Krüger
59fcb7a2ce
Rollup merge of #106811 - khuey:dwp_extension, r=davidtwco
Append .dwp to the binary filename instead of replacing the existing extension.

gdb et al. expect to find the dwp file at `<binary>`.dwp, even if <binary> already has an extension (e.g. libfoo.so's dwp is expected to be at libfoo.so.dwp).
2023-01-26 07:53:23 +01:00
bors
e187f8871e Auto merge of #107314 - matthiaskrgr:rollup-j40lnlj, r=matthiaskrgr
Rollup of 11 pull requests

Successful merges:

 - #106407 (Improve proc macro attribute diagnostics)
 - #106960 (Teach parser to understand fake anonymous enum syntax)
 - #107085 (Custom MIR: Support binary and unary operations)
 - #107086 (Print PID holding bootstrap build lock on Linux)
 - #107175 (Fix escaping inference var ICE in `point_at_expr_source_of_inferred_type`)
 - #107204 (suggest qualifying bare associated constants)
 - #107248 (abi: add AddressSpace field to Primitive::Pointer )
 - #107272 (Implement ObjectSafe and WF in the new solver)
 - #107285 (Implement `Generator` and `Future` in the new solver)
 - #107286 (ICE in new solver if we see an inference variable)
 - #107313 (Add Style Team Triagebot config)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-26 06:23:14 +00:00
bors
885bf62887 Auto merge of #105582 - saethlin:instcombine-assert-inhabited, r=cjgillot
InstCombine away intrinsic validity assertions

This optimization (currently) fires 246 times on the standard library. It seems to fire hardly at all on the big crates in the benchmark suite. Interesting.
2023-01-26 03:10:52 +00:00
Ben Kimock
5bfad5cc85 Thread a ParamEnv down to might_permit_raw_init 2023-01-23 19:25:10 -05:00
Erik Desjardins
009192b01b abi: add AddressSpace field to Primitive::Pointer
...and remove it from `PointeeInfo`, which isn't meant for this.

There are still various places (marked with FIXMEs) that assume all pointers
have the same size and alignment. Fixing this requires parsing non-default
address spaces in the data layout string, which will be done in a followup.
2023-01-22 23:41:39 -05:00
Michael Woerister
72ee14ce39 Allow for more efficient sorting when exporting Unord collections. 2023-01-19 10:40:54 +01:00
Michael Woerister
c3d2573120 Use UnordMap instead of FxHashMap in define_id_collections!(). 2023-01-19 10:40:47 +01:00
Michael Woerister
8a1de57a4a Use UnordSet instead of FxHashSet in define_id_collections!(). 2023-01-19 10:19:07 +01:00
Matthias Krüger
68f12338af
Rollup merge of #104505 - WaffleLapkin:no-double-spaces-in-comments, r=jackh726
Remove double spaces after dots in comments

Most of the comments do not have double spaces, so I assume these are typos.
2023-01-17 20:21:25 +01:00
Maybe Waffle
6a28fb42a8 Remove double spaces after dots in comments 2023-01-17 08:09:33 +00:00
Kyle Huey
783caf3702 Append .dwp to the binary filename instead of replacing the existing extension.
gdb et al. expect to find the dwp file at <binary>.dwp, even if <binary> already
has an extension (e.g. libfoo.so's dwp is expected to be at libfoo.so.dwp).
2023-01-16 17:49:16 -08:00
Tomasz Miąsko
cd92bca49d Omit needless funclet partitioning 2023-01-17 00:00:00 +00:00
Kyle Huey
2b99b9fd25 Preserve split DWARF files when building archives.
The optimization that removes artifacts when building libraries is correct
from the compiler's perspective but not from a debugger's perspective.
Unpacked split debuginfo is referred to by filename and debuggers need
the artifact that contains debuginfo to continue to exist at that path.

Ironically the test expects the correct behavior but it was not running.
2023-01-15 09:40:46 -08:00
bors
44a500c8c1 Auto merge of #106646 - Amanieu:ilp32-object, r=Mark-Simulacrum
Fix aarch64-unknown-linux-gnu_ilp32 target

This was broken because the synthetic object files produced by rustc were for 64-bit AArch64, which caused link failures when combined with 32-bit ILP32 object files.

This PR updates the object crate to 0.30.1 which adds support for generating ILP32 AArch64 object files.
2023-01-14 08:33:09 +00:00
Matthias Krüger
278e02a5b6
Rollup merge of #106797 - FawazTirmizi:dev/issues/104284, r=bjorn3
riscv: Fix ELF header flags

The previous version added both `EF_RISCV_FLOAT_ABI_DOUBLE` and `EF_RISCV_RVC` if the "D" extension was enabled on riscv64 targets. riscv32 targets were not accounted for. This patch changes this so that:

- Only add `EF_RISCV_RVC` if the "C" extension is enabled
- Add `EF_RISCV_FLOAT_ABI_SINGLE` if the "F" extension is enabled and the "D" extension is not
- Add these ELF flags for riscv32 as well

Fixes #104284

r? rust-lang/risc-v
2023-01-13 19:16:45 +01:00
Jonathan Schwender
3bc2970a2e Improve linker-flavor detection
Linker drivers such as gcc, clang or lld often have a version postfix,
e.g clang-12. The previous logic would not account for this and would
fall back to guessing the linker flavor to be the default linker flavor
for the target, which causes linker errors when this is not the case.
By accounting for the possible version postfix and also considering
g++ and clang++, we considerably reduce the amount of times the
fallback guess has to be used.

To simplify matching check for a version postfix and match against the
linker stem without any version postfix.
In contrast to gcc, clang supports all architectures in one binary.
This means there are no variants like `aarch64-linux-gnu-clang` and
there is no need to check for `-clang` variants.
2023-01-13 17:20:37 +01:00
Fawaz
138a1d26b5 riscv: Fix ELF header flags
The previous version added both `EF_RISCV_FLOAT_ABI_DOUBLE` and
`EF_RISCV_RVC` if the "D" extension was enabled on riscv64 targets.
riscv32 targets were not accounted for. This patch changes this
so that:

- Only add `EF_RISCV_RVC` if the "C" extension is enabled
- Add `EF_RISCV_FLOAT_ABI_SINGLE` if the "F" extension is enabled
  and the "D" extension is not
- Add these ELF flags for riscv32 as well
2023-01-12 22:35:38 -08:00
bors
606c390725 Auto merge of #106760 - compiler-errors:rollup-0bogyco, r=compiler-errors
Rollup of 8 pull requests

Successful merges:

 - #103236 (doc: rewrite doc for signed int::{carrying_add,borrowing_sub})
 - #103800 (Stabilize `::{core,std}::pin::pin!`)
 - #106097 (Migrate mir_build diagnostics 2 of 3)
 - #106170 (Move autoderef to `rustc_hir_analysis`)
 - #106323 (Stabilize f16c_target_feature)
 - #106360 (Tweak E0277 `&`-removal suggestions)
 - #106524 (Label `struct/enum constructor` instead of `fn item`, mention that it should be called on type mismatch)
 - #106739 (Remove `<dyn AstConv<'tcx>>::fun(c, ...)` calls in favour of `c.astconv().fun(...)`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-12 10:46:19 +00:00
Michael Goulet
244b90edee
Rollup merge of #106323 - starkat99:stabilize-f16c_target_feature, r=petrochenkov
Stabilize f16c_target_feature

Resolves https://github.com/rust-lang/stdarch/issues/1234

Library PR for stabilizing corresponding intrinsics: https://github.com/rust-lang/stdarch/pull/1366

See also #44839 tracking issue for target_feature
2023-01-11 22:25:48 -08:00
Matthias Krüger
e664cb2154
Rollup merge of #106532 - compiler-errors:dyn-star-to-dyn, r=jackh726
Allow codegen to unsize `dyn*` to `dyn`

`dyn* Trait` is just another type that implements `Trait`, so we should be able to unsize `&dyn* Trait` into `&dyn Trait` perfectly fine, same for `Box` and other unsizeable types.

Fixes #106488
2023-01-12 06:52:35 +01:00
Michael Goulet
70a8d8dcf3 Allow codegen to unsize dyn* to dyn 2023-01-11 19:52:42 +00:00
Cedric
33ebe04183 Fix some typos in code comments. 2023-01-11 16:46:14 +01:00
Tomasz Miąsko
836ef6162d Add comment to cleanup_kinds
based on the original commit message 1ae7ae0c1c
2023-01-10 09:53:18 +01:00
Amanieu d'Antras
a529ba8f67 Fix aarch64-unknown-linux-gnu_ilp32 target
This was broken because the synthetic object files produced by rustc
were for 64-bit AArch64, which caused link failures when combined with
32-bit ILP32 object files.

This PR updates the object crate to 0.30.1 which adds support for
generating ILP32 AArch64 object files.
2023-01-09 17:49:24 +00:00
Matthias Krüger
771cfa5581
Rollup merge of #104543 - JhonnyBillM:migrate-codegen-ssa-to-diagnostics-structs-pt3, r=davidtwco
Migrate `codegen_ssa` to diagnostics structs - [Part 3]

Completes migrating `codegen_ssa` module except 2 outstanding errors that depend on other crates:
1. [`rustc_middle::mir::interpret::InterpError`](b6097f2e1b/compiler/rustc_middle/src/mir/interpret/error.rs (L475)): I saw `rustc_middle` is unassigned, I am open to take this work.

2.  `codegen_llvm`'s use of `fn span_invalid_monomorphization_error`, which I started to replace in the [last commit](9a31b3cdda) of this PR, but would like to know the team's preference on how we should keep replacing the other macros:
2.1. Update macros to expect a `Diagnostic`
2.2. Remove macros and expand the code on each use.
See [some examples of the different options in this experimental commit](64aee83e80)

_Part 2 - https://github.com/rust-lang/rust/pull/103792_

r? ``@davidtwco``
Cc ``@compiler-errors``
2023-01-07 20:43:19 +01:00
bors
d9e317a176 Auto merge of #106224 - bjorn3:staticlib_fixes, r=wesleywiser
Small fixes for --crate-type staticlib

The first commit doesn't have an effect until we start translating error messages. The second commit fixes potential linker errors when combining `--crate-type staticlib` with another crate type and I think `-Cprefer-dynamic`.
2023-01-04 21:35:15 +00:00
bjorn3
7705116708 Fix each_linked_rlib when the current crate has 0 crate types 2023-01-04 13:58:08 +00:00
Rémy Rakic
7770b06b06 only specify --target by default for -Zgcc-ld=lld on wasm
On macOS, it's not yet clear which cases of clang/OS/target/SDK version impact
how to find ld/lld/rust-lld. The --target is not needed on our current targets with
a vanilla config, but may be in some cases. Specifying it all the time breaks the 10.7+
targets on x64 macOS.

We try to only specify it on macOS if the linker flavors are different,
for possible cases of cross-compilation with `-Zgcc-ld=lld` but the
expectation is that it should be passed manually when needed in these
situations.
2023-01-02 23:30:07 +00:00
Kathryn Long
a29425c6d4
Stabilize f16c_target_feature 2022-12-30 23:56:18 -05:00
bjorn3
ed77a61901 Explicitly pass in which crate type to use to each_linked_rlib
Otherwise we may pick the dependency formats for say a dylib when
linking a staticlib.
2022-12-28 17:56:31 +00:00
bjorn3
0b54782cc8 Don't translate --print native-static-libs output
This breaks tools that depend on the prefix
2022-12-28 17:56:31 +00:00
Jhonny Bill Mena
4d63d7d91c UPDATE - migrate outstanding diagnostic in link.rs 2022-12-27 20:59:22 -05:00
Jhonny Bill Mena
29d8c87fe8 DELETE - fn span_invalid_monomorphization_error and localize intrinsics macros 2022-12-27 20:59:22 -05:00
Jhonny Bill Mena
27744460e2 ADD - create and emit Bug support for Diagnostics
UPDATE - migrate constant span_bug to translatable diagnostic.
2022-12-27 20:59:22 -05:00
Jhonny Bill Mena
d1030fab22 UPDATE - migrate fn simd_simple_float_intrinsic error messages 2022-12-27 20:59:21 -05:00
Jhonny Bill Mena
e26366ad99 [WIP] UPDATE - migrate intrinsic.rs to new diagnostic infrastructure
WIP - replacing span_invalid_monomorphization_error function. Still in progress due to its use in codegen_llvm inside macros
2022-12-27 20:59:21 -05:00
Jhonny Bill Mena
d41112a8c5 UPDATE - migrate constant.rs to new diagnostics infrastructure 2022-12-27 20:59:21 -05:00
Jhonny Bill Mena
78796ba637 ADD - fixme in type_names.rs until we are able to translate InterpError 2022-12-27 20:59:21 -05:00
Jhonny Bill Mena
82cf6f204a UPDATE - migrate base.rs to new diagnostics infrastructure 2022-12-27 20:59:19 -05:00
bors
f206533fd4 Auto merge of #105605 - inquisitivecrystal:attr-validation, r=cjgillot
Don't perform invalid checks in `codegen_attrs`

The attributes `#[track_caller]` and `#[cmse_nonsecure_entry]` are only valid on functions. When validating one of these attributes, codegen_attrs previously called `fn_sig`, [which can only be used on functions](https://github.com/rust-lang/rust/pull/105201), on the item the attribute was attached to, assuming that the item was a function without checking. This led to [ICEs in situations where the attribute was incorrectly used on non-functions](https://github.com/rust-lang/rust/issues/105594).

With this change, we skip calling `fn_sig` if the item the attribute is attached to must be a function but isn't, because `check_attr` will reject such cases without codegen_attrs's intervention.

As a side note, some of the attributes in codegen_attrs are only valid on functions, but that property isn't actually checked. I'm planning to fix that in a follow up PR since it's a behavior change that will need to be validated rather than an obvious bugfix. Thankfully, all the attributes like that I've found so far are unstable.

Fixes #105594.

r? `@cjgillot`
2022-12-26 09:06:51 +00:00