Commit Graph

243161 Commits

Author SHA1 Message Date
Matthias Krüger
b3d15ebb08
Rollup merge of #119853 - klensy:rustfmt-ignore, r=cuviper
rustfmt.toml: don't ignore just any tests path, only root one

Previously ignored any `tests` path, now only /tests at repo root.

For reference, https://git-scm.com/docs/gitignore#_pattern_format
2024-01-11 19:42:53 +01:00
Matthias Krüger
ca17ce4558
Rollup merge of #119852 - RalfJung:const-err4, r=compiler-errors
give const-err4 a more descriptive name

Also, doesn't look like this still needs to be per-bitwidth

r? ``@oli-obk``
2024-01-11 19:42:52 +01:00
Matthias Krüger
1a4d3c9c47
Rollup merge of #119845 - RalfJung:rint, r=nagisa
rint: further doc tweaks

r? ``@nagisa``
2024-01-11 19:42:52 +01:00
Matthias Krüger
8294356a5d
Rollup merge of #119842 - Zalathar:kind, r=oli-obk
coverage: Add enums to accommodate other kinds of coverage mappings

Extracted from  #118305.

LLVM supports several different kinds of coverage mapping regions, but currently we only ever emit ordinary “code” regions.  This PR performs the plumbing required to add other kinds of regions as enum variants, but does not add any specific variants other than `Code`.

The main motivation for this change is branch coverage, but it will also allow separate experimentation with gap regions and skipped regions, which might help in producing more accurate and useful coverage reports.

---

``@rustbot`` label +A-code-coverage
2024-01-11 19:42:51 +01:00
Matthias Krüger
f5387a1c38
Rollup merge of #119841 - nnethercote:rm-DiagnosticBuilder-buffer, r=oli-obk
Remove `DiagnosticBuilder::buffer`

`DiagnosticBuilder::buffer` doesn't do much, and part of what it does (for `-Ztreat-err-as-bug`) it shouldn't.

This PR strips it back, replaces its uses, and finally removes it, making a few cleanups in the vicinity along the way.

r? ``@oli-obk``
2024-01-11 19:42:51 +01:00
Matthias Krüger
6beb676990
Rollup merge of #119836 - hi-rustin:rustin-patch-docs-blank-line, r=ChrisDenton
chore: remove unnecessary blank line

It seems no need to add an unnecessary line here.
2024-01-11 19:42:50 +01:00
Matthias Krüger
bd61caf58b
Rollup merge of #119813 - oli-obk:even_more_follow_up_errors2, r=estebank
Silence some follow-up errors [2/x]

this is one piece of the requested cleanups from https://github.com/rust-lang/rust/pull/117449

the `type_of` query frequently uses astconv to convert a `hir::Ty` to a `ty::Ty`. This process is infallible, but may produce errors as it goes. All the error reporting sites that had access to the `ItemCtxt` are now tainting it, causing `type_of` to return a `ty::Error` instead of anything else.
2024-01-11 19:42:49 +01:00
Matthias Krüger
fe97e93166
Rollup merge of #119448 - klensy:annotate-snippets-0.10, r=davidtwco
annotate-snippets: update to 0.10

Ports `annotate-snippets` to 0.10, temporary dupes versions; other crates left that depends on 0.9 is `ui_test` and `rustfmt`.
2024-01-11 19:42:49 +01:00
bors
062e7c6a95 Auto merge of #119802 - nikic:update-llvm-19, r=cuviper
Update LLVM submodule

Fixes https://github.com/rust-lang/rust/issues/118867.
Fixes https://github.com/rust-lang/rust/issues/119160.
Fixes https://github.com/rust-lang/rust/issues/119179.

r? `@cuviper`
2024-01-11 15:28:20 +00:00
Ralf Jung
db860566bc give const-err4 a more descriptive name 2024-01-11 14:57:12 +01:00
hi-rustin
90cc8ba4bc fix: update broken stderr
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2024-01-11 21:39:44 +08:00
bors
68acb393c5 Auto merge of #119791 - Mark-Simulacrum:cut-leb128, r=cjgillot
Remove a large amount of leb128-coded integers

This removes ~41%[^1] of the leb128-encoded integers serialized during libcore compilation by changing enum tags to opportunistically use `u8` where feasible instead of the leb128 coding via `usize`.

This should have effectively zero impact on metadata file sizes, since almost all or all enum tags fit into the 7 bits available in leb128 for single-byte encodings. Perf results indicate this is basically neutral across the board except for an improvement in bootstrap time.

[^1]: More than half the remaining integers still fit into <= 128, so the leb128 coding still makes sense. 32% are zero, and 46% are <= 4.
2024-01-11 13:11:57 +00:00
Ralf Jung
6b6f2a5a28 rint: further doc tweaks 2024-01-11 13:33:27 +01:00
klensy
aa696c5a22 apply fmt 2024-01-11 15:04:48 +03:00
klensy
4580f4ab3f rustfmt.toml: don't ignore just any tests path, only root one 2024-01-11 14:59:59 +03:00
bors
d73bd3fb3b Auto merge of #119654 - onur-ozkan:bump-dependencies, r=clubby789
bump bootstrap dependencies

This PR removes hard-coded patch versions, updates bootstrap's dependency stack to recent versions (some of the versions were released 3-4 years ago), and removes a few dependencies from bootstrap.

Removed dependencies:

![image](https://github.com/rust-lang/rust/assets/39852038/95e86325-aea0-4055-bee5-245c144f662e)
2024-01-11 10:46:43 +00:00
Oli Scherer
55cab535e7 Taint more aggressively in astconv 2024-01-11 09:03:26 +00:00
Oli Scherer
af7f8f9811 Silence follow up errors if astconv already errored 2024-01-11 09:03:26 +00:00
Oli Scherer
252ac15286 Bubble up error type 2024-01-11 09:01:58 +00:00
bors
5278506a71 Auto merge of #119843 - TaKO8Ki:rollup-2y3s55q, r=TaKO8Ki
Rollup of 3 pull requests

Successful merges:

 - #116343 (Stop mentioning internal lang items in no_std binary errors)
 - #119814 (bootstrap: exclude link_jobs from `check_ci_llvm!` checks)
 - #119829 (Add debug info for macOS CI actions)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-01-11 08:21:21 +00:00
Nicholas Nethercote
4fd1db1aa5 Remove DiagnosticBuilder::buffer.
All its uses have been removed.
2024-01-11 18:38:05 +11:00
Nicholas Nethercote
6656413a5c Stop using DiagnosticBuilder::buffer in the parser.
One consequence is that errors returned by
`maybe_new_parser_from_source_str` now must be consumed, so a bunch of
places that previously ignored those errors now cancel them. (Most of
them explicitly dropped the errors before. I guess that was to indicate
"we are explicitly ignoring these", though I'm not 100% sure.)
2024-01-11 18:37:56 +11:00
onur-ozkan
f02f09a08e bless tidy
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-01-11 10:24:41 +03:00
onur-ozkan
8d0f888674 bump bootstrap dependencies
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-01-11 10:24:29 +03:00
Takayuki Maeda
a7713d76e0
Rollup merge of #119829 - ehuss:macos-sip, r=Kobzol
Add debug info for macOS CI actions

This adds some debugging information to the CI logs about the macOS runners to potentially help diagnose performance issues. I think this is unlikely to help, since I think the most likely issue is over-provisioning, but I figured it might be a worthy shot in the dark. The macos-12 runners definitely have issues with SIP randomly being enabled, but I have not seen evidence of that for macos-13.
2024-01-11 15:41:47 +09:00
Takayuki Maeda
ef1e49a641
Rollup merge of #119814 - nagisa:nagisa/releases-the-link-jobs-demons, r=clubby789
bootstrap: exclude link_jobs from `check_ci_llvm!` checks

This option is largely there to help people to manage the memory usage on their systems during the LLVM build. The linking phase is as usual are the heaviest part of the build and if in an unlucky conincidence the circumstances align to kick off N_CORES links at the same time, not even hundreds of GiB of memory may suffice. It makes a lot of sense for developers to set&forget this option unconditionally based on how buff their development device is.

Not to mention, this option does not, in any way, affect the generated code (at least as far as I know.) It really doesn’t matter what option the CI build LLVM used here and/or if it matches with the user’s configuration.

Finally, 0 actual link jobs implied by `download-ci-llvm` is guaranteed to stay within the limits that are reasonable to set with this option.
2024-01-11 15:41:46 +09:00
Takayuki Maeda
6794dc9a5f
Rollup merge of #116343 - Nilstrieb:maybe-dont-mention-all-the-weird-lang-items-just-saying, r=bjorn3
Stop mentioning internal lang items in no_std binary errors

When writing a no_std binary, you'll be greeted with nonsensical errors mentioning lang items like eh_personality and start. That's pretty bad because it makes you think that you need to define them somewhere! But oh no, now you're getting the `internal_features` lint telling you that you shouldn't use them! But you need a no_std binary! What now?

No problem! Writing a no_std binary is super easy. Just use panic=abort and supply your own platform specific entrypoint symbol (like `main`) and you're good to go. Would be nice if the compiler told you that, right?

This makes it so that it does do that.

I don't _love_ the new messages yet, but they're decent I think. They can probably be improved, please suggest improvements.
2024-01-11 15:41:46 +09:00
Nicholas Nethercote
d02150fd45 Fix lifetimes in StringReader.
Two different lifetimes are conflated. This doesn't matter right now,
but needs to be fixed for the next commit to work. And the more
descriptive lifetime names make the code easier to read.
2024-01-11 16:55:10 +11:00
Nicholas Nethercote
fbe68bc40c Stop using DiagnosticBuilder::buffer in BorrowckErrors.
But we can't easily switch from `Vec<Diagnostic>` to
`Vec<DiagnosticBuilder<G>>` because there's a mix of errors and warnings
which result in different `G` types. So we must make
`DiagnosticBuilder::into_diagnostic` public, but that's ok, and it will
get more use in subsequent commits.
2024-01-11 16:55:10 +11:00
Nicholas Nethercote
29c601aa0b Stop using DiagnosticBuilder::buffer in Checker.
This requires cancelling the "secondary" errors when they're not
emitted, to prevent panics due to unconsumed `DiagnosticBuilder`s.
2024-01-11 16:55:10 +11:00
Nicholas Nethercote
2668270dfb Stop using DiagnosticBuilder::buffer in WritebackCx. 2024-01-11 16:55:10 +11:00
Nicholas Nethercote
d5aafb846b Use struct_fatal in new_parser_from_file.
It's a little more concise, and the standard way to do it.
2024-01-11 16:55:10 +11:00
Nicholas Nethercote
f5c0cd0bd1 Inline and remove three functions.
Each of these has a single call site: `source_file_to_parser`,
`try_file_to_source_file`, `file_to_source_file`. Having them separate
just makes the code longer and harder to read.

Also, `maybe_file_to_stream` doesn't need to be `pub`.
2024-01-11 16:55:10 +11:00
Nicholas Nethercote
552bed8048 Remove DiagnosticBuilder::into_diagnostic from -Ztreat-err-as-bug consideration.
It seems very wrong to have a `-Ztreat-err-as-bug` check here before the
error is even emitted.

Once that's done:
- `into_diagnostic` is infallible, so its return type doesn't need the
  `Option`;
- the `&'a DiagCtxt` also isn't needed, because only one callsite uses
  it, and it already have access to it via `self.dcx`;
- the comments about dcx disabling buffering are no longer true, this is
  unconditional now;
- and the `debug!` seems unnecessary... the comment greatly overstates
  its importance because few diagnostics come through `into_diagnostic`,
  and `-Ztrack-diagnostics` exists anyway.
2024-01-11 16:55:10 +11:00
Nicholas Nethercote
a0f5431e23 Move code around.
No point computing `warnings` and `errors` if we're going to return
early before they're used.
2024-01-11 16:55:10 +11:00
Nicholas Nethercote
2aac288c18 Use the right level with -Ztreat-err-as-bug.
Errors in `DiagCtxtInner::emit_diagnostic` are never set to
`Level::Bug`, because the condition never succeeds, because
`self.treat_err_as_bug()` is called *before* the error counts are
incremented.

This commit switches to `self.treat_next_err_as_bug()`, fixing the
problem. This changes the error message output to actually say "internal
compiler error".
2024-01-11 16:55:10 +11:00
Nicholas Nethercote
f0a3684c1e Inline and remove DiagCtxtInner::bump_{lint_err,err}_count.
They have one and two call sites respectively, and they just make the
code harder to read.
2024-01-11 16:54:22 +11:00
Zalathar
124fff0777 coverage: Add enums to accommodate other kinds of coverage mappings 2024-01-11 16:43:12 +11:00
Zalathar
c5932182ad coverage: Store extracted spans as a flat list of mappings
This is less elegant in some ways, since we no longer visit a BCB's spans as a
batch, but will make it much easier to add support for other kinds of coverage
mapping regions (e.g. branch regions or gap regions).
2024-01-11 16:43:01 +11:00
Zalathar
8f98b54a7e coverage: Extract helper function term_for_bcb 2024-01-11 16:07:38 +11:00
bors
3a6bf351a3 Auto merge of #119677 - cjgillot:early-cfg-opt, r=oli-obk
Reorder early post-inlining passes.

`RemoveZsts`, `RemoveUnneededDrops` and `UninhabitedEnumBranching` only depend on types, so they should be executed together early after MIR inlining introduces those types.

This does not change the end-result, but this makes the pipeline a bit more consistent.
2024-01-11 04:09:07 +00:00
bors
65b323b168 Auto merge of #119837 - matthiaskrgr:rollup-l2olpad, r=matthiaskrgr
Rollup of 11 pull requests

Successful merges:

 - #115046 (Use version-sorting for all sorting)
 - #118915 (Add some comments, add `can_define_opaque_ty` check to `try_normalize_ty_recur`)
 - #119006 (Fix is_global special address handling)
 - #119637 (Pass LLVM error message back to pass wrapper.)
 - #119715 (Exhaustiveness: abort on type error)
 - #119763 (Cleanup things in and around `Diagnostic`)
 - #119788 (change function name in comments)
 - #119790 (Fix all_trait* methods to return all traits available in StableMIR)
 - #119803 (Silence some follow-up errors [1/x])
 - #119804 (Stabilize mutex_unpoison feature)
 - #119832 (Meta: Add project const traits to triagebot config)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-01-11 02:10:34 +00:00
Matthias Krüger
1189d230bd
Rollup merge of #119832 - fmease:project-const-traits-triagebot, r=compiler-errors
Meta: Add project const traits to triagebot config

r? compiler-errors or project-const-traits
2024-01-11 03:02:44 +01:00
Matthias Krüger
f92cde4f9a
Rollup merge of #119804 - tmccombs:stabilize-unpoison, r=cuviper
Stabilize mutex_unpoison feature

Closes #96469

`@rustbot` +T-libs-api
2024-01-11 03:02:44 +01:00
Matthias Krüger
d37de53425
Rollup merge of #119803 - oli-obk:even_more_follow_up_errors, r=compiler-errors
Silence some follow-up errors [1/x]

this is one piece of the requested cleanups from https://github.com/rust-lang/rust/pull/117449

When we use `-> impl SomeTrait<_>` as a return type, we are both using the "infer return type suggestion" code path, and the infer opaque type code path within the same function. That can lead to confusing diagnostics, so silence all opaque type diagnostics in that case.
2024-01-11 03:02:43 +01:00
Matthias Krüger
d93df41c1d
Rollup merge of #119790 - celinval:smir-all-traits, r=oli-obk
Fix all_trait* methods to return all traits available in StableMIR

Also provide a mechanism to retrieve traits and implementations for a given crate.

This fixes https://github.com/rust-lang/project-stable-mir/issues/37
2024-01-11 03:02:42 +01:00
Matthias Krüger
6238698ab5
Rollup merge of #119788 - mj10021:issue-119787-fix, r=oli-obk
change function name in comments

fixes #119787 where I believe an incorrect function name is used in the comments
2024-01-11 03:02:42 +01:00
Matthias Krüger
88493fca13
Rollup merge of #119763 - nnethercote:cleanup-Diagnostic, r=oli-obk
Cleanup things in and around `Diagnostic`

These changes all arose when I was looking closely at how to simplify `DiagCtxtInner::emit_diagnostic`.

r? `@compiler-errors`
2024-01-11 03:02:41 +01:00
Matthias Krüger
4dcc5a05ea
Rollup merge of #119715 - Nadrieril:graceful-type-error, r=compiler-errors
Exhaustiveness: abort on type error

This adds an error path to exhaustiveness checking so that we abort instead of ICEing when encountering a stray `ty::Error`.

Fixes https://github.com/rust-lang/rust/issues/119493
Fixes https://github.com/rust-lang/rust/issues/119778

r? `@compiler-errors`
2024-01-11 03:02:41 +01:00
Matthias Krüger
b6ef8b6d94
Rollup merge of #119637 - aoli-al:master, r=cuviper
Pass LLVM error message back to pass wrapper.

When rustc fails to load a plugin, it should provide more detailed error message. Before this PR, rustc prints:

```
error: failed to run LLVM passes: Failed to load pass pluginPLUGIN_NAME.so
```

This PR passes LLVM errors back to rustc. After this PR, rustc prints:

```
error: failed to run LLVM passes: Could not load library 'PLUGIN_NAME.so': PLUGIN_NAME.so: undefined symbol: _ZN4llvm9DebugFlagE
```

This PR only contains usability improvements and does not change any functionality. Thus, no new unit test is implemented.
2024-01-11 03:02:40 +01:00