Commit Graph

250941 Commits

Author SHA1 Message Date
bjorn3
69363cf9e7
Merge pull request #1472 from rust-lang/debuginfo_improvements2
Add debuginfo for statics
2024-03-27 19:22:09 +01:00
bors
0157da41ee Auto merge of #122460 - jieyouxu:rmake-example-refactor, r=Nilstrieb
Rework rmake support library API

### Take 1: Strongly-typed API

Context: https://github.com/rust-lang/rust/pull/122448#discussion_r1523774427

> My 2 cents: from my experience with writing similar "test DSLs", I would suggest to create these helpers as soon as possible in the process (basically the first time someone needs them, not only after N similar usages), and basically treat any imperative code in these high-level tests as a maintenance burden, basically making them as declarative as possible. Otherwise it might be a bit annoying to keep refactoring the tests later once such helpers are available.
>
> I would even discourage the arg method and create explicit methods for setting things like unpretty, the output file etc., but this might be more controversial, as it will make the invoked command-line arguments more opaque.

cc `@Kobzol` for the testing DSL suggestion.

Example:

```rs
let output = Rustc::new()
    .input_file("main.rs")
    .emit(&[EmitKind::Metadata])
    .extern_("stable", &stable_path)
    .output();
```

### Take 2: xshell-based macro API

Example:

```rs
let sh = Shell::new()?;
let stable_path = stable_path.to_string_lossy();
let output = cmd!(sh, "rustc main.rs --emit=metadata --extern stable={stable_path}").output()?;
```

### Take 3: Weakly-typed API with a few helper methods

```rs
let output = Rustc::new()
    .input("main.rs")
    .emit("metadata")
    .extern_("stable", &stable_path)
    .output();
```
2024-03-27 17:43:20 +00:00
Scott McMurray
336ff42367 num::NonZero::get can be 1 transmute instead of 3 2024-03-27 10:25:56 -07:00
bjorn3
4b80941ae3 Add debuginfo for statics
Most types are still unimplemented and get a placeholder byte array
instead.
2024-03-27 16:53:57 +00:00
bors
d5db7fb537 Auto merge of #123006 - compiler-errors:defer-suggestion-work, r=fee1-dead
Stop doing expensive work in `opt_suggest_box_span` eagerly

This PR defers the `can_coerce` and `predicate_must_hold_modulo_regions` calls in `opt_suggest_box_span`, and instead defers it until error reporting. This requires pulling the logic out of `note_obligation_cause_code` and into coercion, where we have access to the trait solver.

This also allows us to remove `TypeVariableOriginKind::OpaqueTypeInference`.
2024-03-27 15:29:00 +00:00
Kornel
443e29cd97 Less generic code for Vec allocations 2024-03-27 15:27:47 +00:00
Vagelis Prokopiou
cc4a1f42e6 Some wording improvement 2024-03-27 17:26:18 +02:00
Jules Bertholet
528d45af18
Feature gate 2024-03-27 11:20:28 -04:00
Kornel
826ddb3018 Suggest correct path in include_bytes! 2024-03-27 15:16:25 +00:00
bjorn3
f086e7abaf Allow debuginfo to reference global variables 2024-03-27 15:01:25 +00:00
Kornel
89ceced6f6 Helper function for resolve_path 2024-03-27 14:57:37 +00:00
xiaoxiangxianzi
3157114f0b chore: fix some comments
Signed-off-by: xiaoxiangxianzi <zhaoyizheng@outlook.com>
2024-03-27 22:32:53 +08:00
Oli Scherer
bd6a96f04e Int constants must be valtrees in pattern lowering 2024-03-27 14:28:50 +00:00
bjorn3
1f75f0fcad Move FileId caching to DebugContext::add_source_file 2024-03-27 14:14:30 +00:00
Michael Goulet
864e1fbc81 Remove TypeVariableOriginKind::OpaqueInference 2024-03-27 10:08:14 -04:00
Michael Goulet
2fe936f17d Stop doing expensive work in opt_suggest_box_span eagerly 2024-03-27 10:08:14 -04:00
bjorn3
68b59311fa
Merge pull request #1470 from rust-lang/debuginfo_improvements
Various small debuginfo improvements
2024-03-27 15:08:07 +01:00
Oli Scherer
d03df0a6b3 Add rustdoc hack 2024-03-27 14:02:17 +00:00
Oli Scherer
cf3ab41c83 Ensure no one re-adds Partial/Ord impls for DefId 2024-03-27 14:02:17 +00:00
Oli Scherer
5f4ac61ebd Remove DefId's Partial/Ord impls 2024-03-27 14:02:17 +00:00
Oli Scherer
e522d2906d Stop sorting DefIds in the compiler 2024-03-27 14:02:17 +00:00
Oli Scherer
5676326c72 Sort somem diagnostics by DefPathStr instead of DefId 2024-03-27 14:02:16 +00:00
Oli Scherer
6be79cb103 Sort a diagnostic by DefPathStr instead of DefId 2024-03-27 14:02:16 +00:00
Oli Scherer
57f68c3555 Sort method suggestions by DefPath instead of DefId 2024-03-27 14:02:16 +00:00
Oli Scherer
727807293b Don't sort DefIds in suggestions 2024-03-27 14:02:16 +00:00
Oli Scherer
150a5e5f92 Do not sort DefIds in diagnostics 2024-03-27 14:02:16 +00:00
Oli Scherer
28363ea4eb Remove Partial/Ord from EarlyParamRegion 2024-03-27 14:02:16 +00:00
Oli Scherer
1d662c9eee Remove Partial/Ord from AdtDef 2024-03-27 14:02:16 +00:00
Oli Scherer
459ea32a27 Remove Partial/Ord from BoundRegion 2024-03-27 14:02:16 +00:00
Oli Scherer
e87d10846e Remove Ord from BoundTy 2024-03-27 14:02:16 +00:00
Oli Scherer
dd9fe01d06 Remove Ord from Binder 2024-03-27 14:02:16 +00:00
Oli Scherer
dc95bd69f2 Remove Ord from Ty, Const, and Region 2024-03-27 14:02:16 +00:00
Oli Scherer
939df293d8 Sort diagnostics by rendered trait ref instead of its def ids 2024-03-27 14:02:16 +00:00
Oli Scherer
5ae546e108 Use FxIndexMap instead of BTreeMap to avoid sorting DefIds 2024-03-27 14:02:15 +00:00
Oli Scherer
ae24fef028 Use TraitRef::to_string sorting in favor of TraitRef::ord, as the latter compares DefIds which we need to avoid 2024-03-27 14:02:15 +00:00
Oli Scherer
2707ac9606 Remove unnecessary Partial/Ord derive 2024-03-27 14:02:15 +00:00
Jules Bertholet
e0da13f25f
Implement mut ref/mut ref mut 2024-03-27 09:53:23 -04:00
bjorn3
41246b2cf6 Remove fixed todos 2024-03-27 13:35:32 +00:00
bjorn3
a64387bb6b Emit DW_AT_external if applicable 2024-03-27 13:28:40 +00:00
DianQK
47ed73a7b5
Eliminate UbCheck for non-standard libraries 2024-03-27 21:02:40 +08:00
bjorn3
98eaaeda11 Match unit names with cg_llvm 2024-03-27 12:57:24 +00:00
Bryanskiy
0cd9708de6 Delegation: fix ICE on wrong instantiation 2024-03-27 15:51:48 +03:00
bjorn3
e48d7d242f Emit namespace debuginfo 2024-03-27 12:43:47 +00:00
Oli Scherer
86e750f0f7 Inline primary_body_of into its sole call site 2024-03-27 11:16:41 +00:00
Oli Scherer
7786ee3c92 Remove a call-site to primary_body_of as it is only interested in the body id 2024-03-27 11:13:34 +00:00
Oli Scherer
d0eb9c86f1 move type inference for missing types on constants into its own method 2024-03-27 11:12:21 +00:00
bjorn3
c76c269aa4 Reduce debuginfo divergence between cg_llvm and cg_clif 2024-03-27 11:04:35 +00:00
Oli Scherer
804c047657 Load missing type of impl associated constant from trait definition 2024-03-27 11:02:53 +00:00
bjorn3
09ec683ae7 Emit DW_AT_frame_base debuginfo attribute 2024-03-27 10:57:13 +00:00
John Kåre Alsaker
9936a399df Add a CurrentGcx type to let the deadlock handler access TyCtxt 2024-03-27 11:44:32 +01:00