| Age | Commit message (Collapse) | Author | Lines |
|
Allocate some query results on an arena
This avoids a cloning few `Lrc` and `Vec`s in the queries.
|
|
|
|
Don't import integer and float modules, use assoc consts
Stop importing the standard library integer and float modules to reach the `MIN`, `MAX` and other constants. They are available directly on the primitive types now.
This PR is a follow up of #69860 which made sure we use the new constants in documentation.
This type of change touches a lot of files, and previously all my assoc int consts PRs had collisions and were accepted only after a long delay. So I'd prefer to do it in smaller steps now. Just removing these imports seem like a good next step.
r? @dtolnay
|
|
|
|
|
|
Finding the `SourceFile` associated with a `FileName` called `get_source_file` on
the `SourceMap`, which does a linear search through all files in the `SourceMap`.
This resolves the issue by passing the SourceFile in from the caller (which already
had it available).
|
|
Add hash of source files in debug info
LLVM supports placing the hash of source files inside the debug info.
This information can be used by a debugger to verify that the source code matches
the executable.
This change adds support for both hash algorithms supported by LLVM, MD5 and SHA1, controlled by a target option.
* DWARF only supports MD5
* LLVM IR supports MD5 and SHA1 (and SHA256 in LLVM 11).
* CodeView (.PDB) supports MD5, SHA1, and SHA256.
Fixes #68980.
Tracking issue: #70401
rustc dev guide PR with further details: https://github.com/rust-lang/rustc-dev-guide/pull/623
|
|
Place TLS initializers with relocations in .tdata
Should fix #70673, although I'm not sure how to test this. Perhaps @joshlf could find a MCVE?
Also adds more context to the FIXME.
r? @oli-obk
|
|
Stabilize float::to_int_unchecked
This renames and stabilizes unsafe floating point to integer casts, which are intended to be the substitute for the currently unsound `as` behavior, once that changes to safe-but-slower saturating casts. As such, I believe this also likely unblocks #10184 (our oldest I-unsound issue!), as once this rolls out to stable it would be far easier IMO to change the behavior of `as` to be safe by default.
This does not stabilize the trait or the associated method, as they are deemed internal implementation details (and consumers should not, generally, want to expose them, as in practice all callers likely know statically/without generics what the return type is).
Closes #67058
|
|
* Adds either an MD5 or SHA1 hash to the debug info.
* Adds new unstable option `-Z src-hash-algorithm` to control the hashing algorithm.
|
|
|
|
|
|
|
|
rustc_target::abi: rename FieldPlacement to FieldsShape.
Originally suggested by @eddyb.
|
|
Add `can_unwind` field to `FnAbi`
This is a pure refactoring with no behavior changes.
Extracted out of #70467
r? @eddyb
|
|
|
|
|
|
This is a pure refactoring with no behavior changes.
|
|
|
|
(clippy::single_match)
Makes code more compact and reduces nestig.
|
|
|
|
|
|
|
|
Rename TyLayout to TyAndLayout.
|
|
This renames and stabilizes unsafe floating point to integer casts, which are
intended to be the substitute for the currently unsound `as` behavior, once that
changes to safe-but-slower saturating casts.
|
|
|
|
Rollup of 5 pull requests
Successful merges:
- #70345 (Remove `no_integrated_as` mode.)
- #70434 (suggest `;` on expr `mac!()` which is good as stmt `mac!()`)
- #70457 (non-exhastive diagnostic: add note re. scrutinee type)
- #70478 (Refactor type_of for constants)
- #70480 (clarify hir_id <-> node_id method names)
Failed merges:
r? @ghost
|
|
Remove `no_integrated_as` mode.
Specifically, remove both `-Z no_integrated_as` and
`TargetOptions::no_integrated_as`. The latter was only used for the
`msp430_none_elf` platform, for which it's no longer required.
r? @alexcrichton
|
|
Move the query system to a dedicated crate
The query system `rustc::ty::query` is split out into the `rustc_query_system` crate.
Some commits are unformatted, to ease rebasing.
Based on #67761 and #69910.
r? @Zoxc
|
|
|
|
Rename asm! to llvm_asm!
As per https://github.com/rust-lang/rfcs/pull/2843, this PR renames `asm!` to `llvm_asm!`. It also renames the compiler's internal `InlineAsm` data structures to `LlvmInlineAsm` in preparation for the new `asm!` functionality specified in https://github.com/rust-lang/rfcs/pull/2850.
This PR doesn't actually deprecate `asm!` yet, it just makes it redirect to `llvm_asm!`. This is necessary because we first need to update the submodules (in particular stdarch) to use `llvm_asm!`.
|
|
Specifically, remove both `-Z no_integrated_as` and
`TargetOptions::no_integrated_as`. The latter was only used for the
`msp430_none_elf` platform, for which it's no longer required.
|
|
r=alexcrichton
Refactor object file handling
Some preliminary clean-ups that grease the path to #66961.
r? @alexcrichton
|
|
asm! is left as a wrapper around llvm_asm! to maintain compatibility.
|
|
|
|
It makes things a little clearer.
|
|
Currently, there are three fields in `ModuleConfig` that dictate
how object files are emitted: `emit_obj`, `obj_is_bitcode`, and
`embed_bitcode`.
Some of the combinations of these fields are nonsensical, in particular
having both `obj_is_bitcode` and `embed_bitcode` true at the same time.
Also, currently:
- we needlessly emit and then delete a bytecode file if `obj_is_bitcode`
is true but `emit_obj` is false;
- we needlessly embed bitcode in the LLVM module if `embed_bitcode` is
true and `emit_obj` is false.
This commit combines the three fields into one, with a new type
`EmitObj` (and the auxiliary `BitcodeSection`) which can encode five
different possibilities.
In the old code, `set_flags` would set `obj_is_bitcode` and
`embed_bitcode` on all three of the configs (`modules`, `allocator`,
`metadata`) if the relevant other conditions were met, even if no object
code needed to be emitted for one or more of them. Whereas
`start_async_codegen` would set `emit_obj`, but only for those configs
that need it.
In the new code, `start_async_codegen` does all the work of setting
`emit_obj`, and it only does that for the configs that need it.
`set_flags` no longer sets anything related to object file emission.
|
|
use checked casts and arithmetic in Miri engine
This is unfortunately pretty annoying because we have to cast back and forth between `u64` and `usize` more often that should be necessary, and that cast is considered fallible.
For example, should [this](https://doc.rust-lang.org/nightly/nightly-rustc/rustc/mir/interpret/value/enum.ConstValue.html) really be `usize`?
Also, `LayoutDetails` uses `usize` for field indices, but in Miri we use `u64` to be able to also handle array indexing. Maybe methods like `mplace_field` should be suitably generalized to accept both `u64` and `usize`?
r? @oli-obk Cc @eddyb
|
|
|
|
r=michaelwoerister
Clean up debugging options
I found various sub-optimal things when I was looking at option handling.
|
|
normalize some imports & prefer direct ones
r? @Mark-Simulacrum
|
|
|
|
Refactor `codegen`
`codegen` in `src/librustc_codegen_llvm/back/write.rs` is long and has complex control flow. These commits refactor it and make it easier to understand.
|
|
Because it uses `parse_bool` and defaults to true, it is actually
impossible to set it to false. Inverting its sense to `-Z
no-generate-arange-section` makes it usable.
|
|
rustc: keep upvars tupled in {Closure,Generator}Substs.
Previously, each closure/generator capture's (aka "upvar") type was tracked as one "synthetic" type parameter in the closure/generator substs, and figuring out where the parent `fn`'s generics end and the synthetics start involved slicing at `tcx.generics_of(def_id).parent_count`.
Needing to query `generics_of` limited @davidtwco (who wants to compute some `TypeFlags` differently for parent generics vs upvars, and `TyCtxt` is not available there), which is how I got started on this, but it's also possible that the `generics_of` queries are slowing down `{Closure,Generator}Substs` methods.
To give an example, for a `foo::<T, U>::{closure#0}` with captures `x: X` and `y: Y`, substs are:
* before this PR: `[T, U, /*kind*/, /*signature*/, X, Y]`
* after this PR: `[T, U, /*kind*/, /*signature*/, (X, Y)]`
You can see that, with this PR, no matter how many captures, the last 3 entries in the substs (or 5 for a generator) are always the "synthetic" ones, with the last one being the tuple of capture types.
r? @nikomatsakis cc @Zoxc
|
|
librustc_codegen_llvm: Replace deprecated API usage
|
|
-Cdebuginfo=1.
|
|
-Cdebuginfo=1.
|
|
|
|
|