bors
8575f8f91b
Auto merge of #104342 - mweber15:add_file_location_to_more_types, r=wesleywiser
...
Require `type_map::stub` callers to supply file information
This change attaches file information (`DIFile` reference and line number) to struct debug info nodes.
Before:
```
; foo.ll
...
!5 = !DIFile(filename: "<unknown>", directory: "")
...
!16 = !DICompositeType(tag: DW_TAG_structure_type, name: "MyType", scope: !2 , file: !5 , size: 32, align: 32, elements: !17 , templateParams: !19 , identifier: "4cb373851db92e732c4cb5651b886dd0")
...
```
After:
```
; foo.ll
...
!3 = !DIFile(filename: "foo.rs", directory: "/home/matt/src/rust98678", checksumkind: CSK_SHA1, checksum: "bcb9f08512c8f3b8181ef4726012bc6807bc9be4")
...
!16 = !DICompositeType(tag: DW_TAG_structure_type, name: "MyType", scope: !2 , file: !3 , line: 3, size: 32, align: 32, elements: !17 , templateParams: !19 , identifier: "9e5968c7af39c148acb253912b7f409f")
...
```
Fixes #98678
r? `@wesleywiser`
2024-12-03 12:49:57 +00:00
lcnr
9cba14b95b
use TypingEnv when no infcx is available
...
the behavior of the type system not only depends on the current
assumptions, but also the currentnphase of the compiler. This is
mostly necessary as we need to decide whether and how to reveal
opaque types. We track this via the `TypingMode`.
2024-11-18 10:38:56 +01:00
Matt Weber
f9ac7aca5d
Add location info for f16
2024-11-06 22:26:18 -05:00
Matt Weber
21c58b1b2c
Rename option and add doc
2024-11-06 22:26:18 -05:00
Matt Weber
4692d46a46
Add additional option checks
2024-11-06 22:26:17 -05:00
Matt Weber
a4833a8089
Move additional source location info behind -Z option
2024-11-06 22:26:17 -05:00
Matt Weber
27b1b01daa
Refactor type_stub from DefId to tuple
2024-11-06 22:25:04 -05:00
Matt Weber
af6b0deaf3
Add file and line metadata for struct/union members
2024-11-06 22:25:04 -05:00
Matt Weber
f3da828185
Refactor type_map::stub parameters
...
Push span lookup into `type_map::stub` and pass the `DefId` instead of
doing the lookup outside and passing in the location metadata.
2024-11-06 22:12:03 -05:00
Matt Weber
94669d9d47
Add file and line metadata for closures
2024-11-06 22:12:03 -05:00
Matt Weber
2f00b6affd
Require type_map::stub callers to supply file information
...
This change attaches file information (`DIFile` reference and line
number) to struct debug info nodes.
Before:
```
; foo.ll
...
!5 = !DIFile(filename: "<unknown>", directory: "")
...
!16 = !DICompositeType(tag: DW_TAG_structure_type, name: "MyType", scope: !2 , file: !5 , size: 32, align: 32, elements: !17 , templateParams: !19 , identifier: "4cb373851db92e732c4cb5651b886dd0")
...
```
After:
```
; foo.ll
...
!3 = !DIFile(filename: "foo.rs", directory: "/home/matt/src/rust98678", checksumkind: CSK_SHA1, checksum: "bcb9f08512c8f3b8181ef4726012bc6807bc9be4")
...
!16 = !DICompositeType(tag: DW_TAG_structure_type, name: "MyType", scope: !2 , file: !3 , line: 3, size: 32, align: 32, elements: !17 , templateParams: !19 , identifier: "9e5968c7af39c148acb253912b7f409f")
...
```
Fixes #98678
2024-11-06 22:12:02 -05:00
Jubilee Young
b895bf4fdc
compiler: Directly use rustc_abi in codegen
2024-11-03 12:30:32 -08:00
Zalathar
ce3e14a448
Remove support for -Zprofile (gcov-style coverage instrumentation)
2024-10-31 09:09:25 +11:00
Zalathar
4bd84b23a8
Use a type-safe helper to cast &str and &[u8] to *const c_char
2024-10-28 21:31:32 +11:00
Urgau
018ba0528f
Use wide pointers consistenly across the compiler
2024-10-04 14:06:48 +02:00
Jacob Kiesel
bb5a8276be
add unstable support for outputting file checksums for use in cargo
2024-10-01 21:23:20 -06:00
bors
4cbfcf1b7f
Auto merge of #130389 - Luv-Ray:LLVMMDNodeInContext2, r=nikic
...
llvm: replace some deprecated functions
`LLVMMDStringInContext` and `LLVMMDNodeInContext` are deprecated, replace them with `LLVMMDStringInContext2` and `LLVMMDNodeInContext2`.
Also replace `Value` with `Metadata` in some function signatures for better consistency.
2024-09-24 12:07:48 +00:00
Michael Goulet
c682aa162b
Reformat using the new identifier sorting from rustfmt
2024-09-22 19:11:29 -04:00
Michael Goulet
914193c8f4
Do not unnecessarily eval consts in codegen
2024-09-20 20:38:11 -04:00
Nicholas Nethercote
1f359405cb
Reformat some comments.
...
So they are less than 100 chars.
2024-09-19 20:11:28 +10:00
Luv-Ray
b7c5656713
replace some deprecated functions
2024-09-19 09:39:28 +08:00
Pavel Grigorenko
f6e8a84eea
Make Ty::boxed_ty return an Option
2024-09-06 00:30:36 +03:00
Ralf Jung
d0aedfbb90
interpret, codegen: tweak some comments and checks regarding Box with custom allocator
2024-08-31 11:29:02 +02:00
Trevor Gross
9c26ebe32e
Rollup merge of #126985 - Mrmaxmeier:dwarf-embed-source, r=davidtwco
...
Implement `-Z embed-source` (DWARFv5 source code embedding extension)
Implement https://github.com/rust-lang/compiler-team/issues/764 MCP which adds an unstable flag that exposes LLVM's [DWARFv5 source code embedding](https://dwarfstd.org/issues/180201.1.html ) support.
2024-08-27 01:46:49 -05:00
Matthias Krüger
110c3df7fd
Rollup merge of #126013 - nnethercote:unreachable_pub, r=Urgau
...
Add `#[warn(unreachable_pub)]` to a bunch of compiler crates
By default `unreachable_pub` identifies things that need not be `pub` and tells you to make them `pub(crate)`. But sometimes those things don't need any kind of visibility. So they way I did these was to remove the visibility entirely for each thing the lint identifies, and then add `pub(crate)` back in everywhere the compiler said it was necessary. (Or occasionally `pub(super)` when context suggested that was appropriate.) Tedious, but results in more `pub` removal.
There are plenty more crates to do but this seems like enough for a first PR.
r? `@compiler-errors`
2024-08-27 00:41:57 +02:00
Josh Stone
e424e7fcaa
Avoid extra cast()s after CStr::as_ptr()
...
These used to be `&str` literals that did need a pointer cast, but that
became a no-op after switching to `c""` literals in #118566 .
2024-08-20 14:04:48 -07:00
Nicholas Nethercote
61627438eb
Add warn(unreachable_pub) to rustc_codegen_llvm.
2024-08-16 08:46:57 +10:00
Nicholas Nethercote
c4717cc9d1
Shrink TyKind::FnPtr.
...
By splitting the `FnSig` within `TyKind::FnPtr` into `FnSigTys` and
`FnHeader`, which can be packed more efficiently. This reduces the size
of the hot `TyKind` type from 32 bytes to 24 bytes on 64-bit platforms.
This reduces peak memory usage by a few percent on some benchmarks. It
also reduces cache misses and page faults similarly, though this doesn't
translate to clear cycles or wall-time improvements on CI.
2024-08-09 14:33:25 +10:00
Mrmaxmeier
0b87af9d4f
Add -Z embed-source=yes to embed source code in DWARF debug info
2024-07-29 12:35:36 +02:00
Nicholas Nethercote
84ac80f192
Reformat use declarations.
...
The previous commit updated `rustfmt.toml` appropriately. This commit is
the outcome of running `x fmt --all` with the new formatting options.
2024-07-29 08:26:52 +10:00
Jubilee Young
ce7b069fd8
compiler: Never debug_assert in codegen
...
The gains in performance are not worth the costs in correctness.
This is partly because the gains are zero and the costs are unknown.
2024-07-20 00:16:44 -07:00
bors
8672b2b763
Auto merge of #127001 - beetrees:f16-debuginfo, r=michaelwoerister
...
Add Natvis visualiser and debuginfo tests for `f16`
To render `f16`s in debuggers on MSVC targets, this PR changes the compiler to output `f16`s as `struct f16 { bits: u16 }`, and includes a Natvis visualiser that manually converts the `f16`'s bits to a `float` which is can then be displayed by debuggers. `gdb`, `lldb` and `cdb` tests are also included for `f16` .
`f16`/`f128` MSVC debug info issue: #121837
Tracking issue: #116909
2024-07-09 09:07:42 +00:00
beetrees
b058de90a3
Add Natvis visualiser and debuginfo tests for f16
2024-07-09 03:47:50 +01:00
bjorn3
e9ea578147
Move vcall_visibility_metadata optimization hint out of a debuginfo generation method
2024-06-21 19:26:06 +00:00
Dario Nieuwenhuis
9c25d40784
Honor collapse_debuginfo for statics.
...
fixes #126363
2024-06-13 02:44:14 +02:00
Michael Goulet
333458c2cb
Uplift TypeRelation and Relate
2024-06-01 12:50:58 -04:00
Nicholas Nethercote
8e94226e61
Remove #[macro_use] extern crate tracing from rustc_codegen_llvm.
2024-05-23 18:02:40 +10:00
Michael Goulet
1c19b6ad60
Rename Generics::params to Generics::own_params
2024-05-09 20:58:46 -04:00
Urgau
fefb8f1f9c
Replace Session should_remap_filepaths with filename_display_preference
2024-03-28 18:47:26 +01:00
Urgau
4f4fa42b0e
Introduce FileNameMapping::to_real_filename and use it everywhere
2024-03-28 18:47:26 +01:00
Urgau
ee2898d3f1
Make local_crate_source_file return a RealFileName
...
so it can be remapped (or not) by callers
2024-03-28 18:47:26 +01:00
Urgau
106146fd95
Replace RemapFileNameExt::for_codegen with explicit calls
2024-03-28 18:47:26 +01:00
Urgau
777c6b46cc
Simplify trim-paths feature by merging all debuginfo options together
2024-03-28 18:47:26 +01:00
Michael Goulet
ff0c31e6b9
Programmatically convert some of the pat ctors
2024-03-22 11:13:29 -04:00
Oli Scherer
d3514a036d
Ensure nested allocations in statics do not get deduplicated
2024-03-12 05:53:46 +00:00
Ralf Jung
f391c0793b
only set noalias on Box with the global allocator
2024-03-05 15:03:33 +01:00
Trevor Gross
02778b3e0e
Add f16 and f128 LLVM intrinsics
2024-03-01 13:59:06 -05:00
Trevor Gross
e3f63d9375
Add f16 and f128 to rustc_type_ir::FloatTy and rustc_abi::Primitive
...
Make changes necessary to support these types in the compiler.
2024-02-28 12:58:32 -05:00
Michael Goulet
34ed554d81
Build DebugInfo for coroutine-closure
2024-02-09 16:01:29 +00:00
Michael Goulet
fcb42b42d6
Remove movability from TyKind::Coroutine
2023-12-28 16:35:01 +00:00