Commit graph

244935 commits

Author SHA1 Message Date
Zalathar fde1702db8 coverage: Hoist special handling of async function spans
This sidesteps the normal span refinement code in cases where we know that we
are only dealing with the special signature span that represents having called
an async function.
2024-02-05 10:09:50 +11:00
Zalathar dd6d7f27e4 coverage: Make unexpansion of closure bodies more precise
This improves the coverage instrumentation of closures declared in macros, as
seen in `closure_macro.rs` and `closure_macro_async.rs`.
2024-02-05 10:09:46 +11:00
Zalathar 8dd2b37462 coverage: Add a test for #[coverage(..)] on closures 2024-02-05 10:07:19 +11:00
Zalathar fe420dc46e coverage: Test for closure body that is a single bang-macro 2024-02-05 10:07:18 +11:00
bors 268dbbbc4b Auto merge of #120624 - matthiaskrgr:rollup-3gvcl20, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #120484 (Avoid ICE when is_val_statically_known is not of a supported type)
 - #120516 (pattern_analysis: cleanup manual impls)
 - #120517 (never patterns: It is correct to lower `!` to `_`.)
 - #120523 (Improve `io::Read::read_buf_exact` error case)
 - #120528 (Store SHOULD_CAPTURE as AtomicU8)
 - #120529 (Update data layouts in custom target tests for LLVM 18)
 - #120531 (Remove a bunch of `has_errors` checks that have no meaningful or the wrong effect)
 - #120533 (Correct paths for hexagon-unknown-none-elf platform doc)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-02-04 20:51:28 +00:00
bors 4e3eed4892 Auto merge of #120620 - matthiaskrgr:rollup-sscmbsm, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #119543 (add avx512fp16 to x86 target features)
 - #120004 (Release notes for 1.76)
 - #120562 (Revert unsound libcore changes)
 - #120566 (coverage: Use normal `edition:` headers in coverage tests)
 - #120570 (Suggest changing type to const parameters if we encounter a type in the trait bound position)
 - #120571 (Miscellaneous diagnostics cleanups)
 - #120573 (Remove `BorrowckErrors::tainted_by_errors`)
 - #120592 (Remove unnecessary `.to_string()`/`.as_str()`s)
 - #120610 (hir: Remove the generic type parameter from `MaybeOwned`)
 - #120616 (Fix ICE on field access on a tainted type after const-eval failure)

Failed merges:

 - #120569 (coverage: Improve handling of function/closure spans)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-02-04 18:51:28 +00:00
bors 671eb38a4e Auto merge of #120543 - ehuss:macos-ninja, r=Mark-Simulacrum
CI: Use ninja on apple builders

This switches the apple builders to use ninja when building LLVM. My hope is that this should resolve the timeouts we have been experiencing since December. My theory is that something in the image update from [Dec 20](dec20a5272) is causing an issue with our build (or, perhaps more remotely, some [update to LLVM itself](https://github.com/rust-lang/rust/commits/master/src/llvm-project)).

The symptoms are that during the LLVM build it just hangs just before the install step. The last thing it prints is `[100%] Built target llvm-reduce` and then just hangs. Normally the next part should be `Install the project...` where it starts installing LLVM. I'm able to reproduce this without too much difficulty. I've been testing ninja, and it seems to be working better (however, my test isn't quite equivalent, since I'm getting sccache misses, and I can't update the S3 bucket).

Installing ninja takes about 7 to 10 seconds, so it shouldn't impact things. I can't determine if it will affect the overall build timing due to not being able to test with a warm S3 cache.
2024-02-04 15:14:19 +00:00
Matthias Krüger edd24948bc
Rollup merge of #120533 - androm3da:bcain/update_hex_docs, r=wesleywiser
Correct paths for hexagon-unknown-none-elf platform doc

Update the library paths to correctly refer to libdemo{1,2}_hexagon and switch to the release build instead.

Update references to libstandalone to the specific G0/PIC archive instead.
2024-02-03 22:25:17 +01:00
Matthias Krüger 7d516c57df
Rollup merge of #120531 - oli-obk:track_errors7, r=estebank
Remove a bunch of `has_errors` checks that have no meaningful or the wrong effect

r? `@nnethercote`
2024-02-03 22:25:16 +01:00
Matthias Krüger 69920786ba
Rollup merge of #120529 - nikic:llvm-18-datalayout-fixes, r=cuviper
Update data layouts in custom target tests for LLVM 18

Apply the data layout changes from https://github.com/rust-lang/rust/pull/116672 to custom target specs as well, as we started validating them since https://github.com/rust-lang/rust/pull/120062.

Fixes https://github.com/rust-lang/rust/issues/120492.

r? ```@cuviper```
2024-02-03 22:25:16 +01:00
Matthias Krüger 3e24351677
Rollup merge of #120528 - GnomedDev:atomicu8-backtrace-style, r=cuviper
Store SHOULD_CAPTURE as AtomicU8

`BacktraceStyle` easily fits into a u8, so `SHOULD_CAPTURE`, which is just `Atomic<Option<BacktraceStyle>>`, should be stored as `AtomicU8`
2024-02-03 22:25:16 +01:00
Matthias Krüger a3ea64719b
Rollup merge of #120523 - a1phyr:improve_read_buf_exact, r=the8472
Improve `io::Read::read_buf_exact` error case

- Use `const_io_error` instead of `Error::new`
- Use the same message as `read_exact`
2024-02-03 22:25:15 +01:00
Matthias Krüger ceeaa8a852
Rollup merge of #120517 - Nadrieril:lower-never-as-wildcard, r=compiler-errors
never patterns: It is correct to lower `!` to `_`.

This is just a comment update but a non-trivial one: it is correct to lower `!` patterns as `_`. The reasoning is that `!` matches all the possible values of the type, since the type is empty. Moreover, we do want to warn that the `Err` is redundant in:
```rust
match x {
  !,
  Err(!),
}
```
which is consistent with `!` behaving like a wildcard.

I did try to introduce `Constructor::Never` and it ended up needing to behave exactly like `Constructor::Wildcard`.

r? ```@compiler-errors```
2024-02-03 22:25:15 +01:00
Matthias Krüger f3ebf1e50f
Rollup merge of #120516 - Nadrieril:cleanup-impls, r=compiler-errors
pattern_analysis: cleanup manual impls

https://github.com/rust-lang/rust/pull/120420 introduced some unneeded manual impls. I remove them here.

r? ```@Nilstrieb```
2024-02-03 22:25:14 +01:00
Matthias Krüger 6f24836a5b
Rollup merge of #120484 - Teapot4195:issue-120480-fix, r=compiler-errors
Avoid ICE when is_val_statically_known is not of a supported type

2 ICE with 1 stone!
1. Implement `llvm.is.constant.ptr` to avoid first ICE in linked issue.
2. return `false` when the argument is not one of `i*`/`f*`/`ptr` to avoid second ICE.

fixes #120480
2024-02-03 22:25:14 +01:00
Matthias Krüger 326839bf7f
Rollup merge of #120616 - fmease:fix-ice-const-eval-fail-undef-field-access, r=compiler-errors
Fix ICE on field access on a tainted type after const-eval failure

Fixes #120615.

r? oli-obk or compiler
2024-02-03 21:29:45 +01:00
Matthias Krüger 2a8fc94697
Rollup merge of #120610 - petrochenkov:maybeownogen, r=cjgillot
hir: Remove the generic type parameter from `MaybeOwned`

It's only ever used with a reference to `OwnerInfo` as an argument.

Follow up to https://github.com/rust-lang/rust/pull/120346.
2024-02-03 21:29:44 +01:00
Matthias Krüger 968cff7cf3
Rollup merge of #120592 - trevyn:cleanup-to-string, r=Nilstrieb
Remove unnecessary `.to_string()`/`.as_str()`s
2024-02-03 21:29:43 +01:00
Matthias Krüger 019d28151d
Rollup merge of #120573 - nnethercote:rm-BorrowckErrors-tainted_by_errors, r=oli-obk
Remove `BorrowckErrors::tainted_by_errors`

This PR removes one of the `tainted_by_errors` occurrences, replacing it with direct use of `ErrorGuaranteed`.

r? `@oli-obk`
2024-02-03 21:29:43 +01:00
Matthias Krüger b9c87b41d3
Rollup merge of #120571 - nnethercote:misc-diagnostics, r=oli-obk
Miscellaneous diagnostics cleanups

All found while working on some speculative, invasive changes, but worth doing in their own right.

r? `@oli-obk`
2024-02-03 21:29:42 +01:00
Matthias Krüger 7c932d9940
Rollup merge of #120570 - fmease:change-ty-to-ct-param-sugg, r=compiler-errors
Suggest changing type to const parameters if we encounter a type in the trait bound position

The first commit is just drive-by cleanup.

Provide a structured suggestion if the user forgot to prefix a “const parameter” with `const`, e.g., in `struct Tagged<TAG: u64>;`. This happens to me from time to time. Maybe C++ devs are also prone to this mistake given template syntax looks like `template<typename T, uint32_t N>`.
2024-02-03 21:29:42 +01:00
Matthias Krüger 892b0fd787
Rollup merge of #120566 - Zalathar:edition, r=compiler-errors
coverage: Use normal `edition:` headers in coverage tests

Some of these tests were originally written as part of a custom `run-make` test, so at that time they weren't able to use the normal compiletest header directive parser.

Now that they're properly integrated, there's no need for them to use `compile-flags` to specify the edition, since they can use `edition` instead.

In most cases the `.cov-map` snapshot isn't affected at all, but in a few cases we add or remove a line, which slightly disturbs the first line number in each instrumented function.
2024-02-03 21:29:41 +01:00
Matthias Krüger 977945d285
Rollup merge of #120562 - oli-obk:revert_stuff, r=cuviper
Revert unsound libcore changes

fixes #120537

these were introduced in #119911
2024-02-03 21:29:41 +01:00
Matthias Krüger 98d0d4595e
Rollup merge of #120004 - Mark-Simulacrum:relnotes-1.76, r=Mark-Simulacrum
Release notes for 1.76

Cargo, library stabilizations and some cleanups, particularly to future compat, still pending.

cc `@cuviper` `@rust-lang/release`
2024-02-03 21:29:40 +01:00
Matthias Krüger 17670ca5df
Rollup merge of #119543 - usamoi:avx512fp16, r=oli-obk
add avx512fp16 to x86 target features

std_detect avx512fp16: https://github.com/rust-lang/stdarch/pull/1508
2024-02-03 21:29:40 +01:00
León Orell Valerian Liehr 4f773af1cc
Check for presence of field in typeck results before visiting it
Co-authored-by: Michael Goulet <michael@errs.io>
2024-02-03 19:41:18 +01:00
Mark Rousskov 8f1573a585 Release notes for 1.76 2024-02-03 13:38:44 -05:00
bors b11fbfbf35 Auto merge of #120617 - Mark-Simulacrum:bump-version, r=Mark-Simulacrum
Bump to 1.78

r? `@Mark-Simulacrum`
2024-02-03 18:21:03 +00:00
Mark Rousskov 8ef369be88 Bump to 1.78 2024-02-03 13:14:34 -05:00
Vadim Petrochenkov c5eca333fc hir: Remove the generic type parameter from MaybeOwned
It's only ever used with a reference to `OwnerInfo` as an argument.
2024-02-03 15:50:14 +03:00
trevyn ef37dcb7db Remove unnecessary .to_string()/.as_str()s 2024-02-02 15:16:05 -08:00
Nicholas Nethercote be64802854 Use StringPart more. 2024-02-03 09:02:50 +11:00
Nicholas Nethercote 0621cd46f2 Simplify future breakage control flow.
`emit_future_breakage` calls
`self.dcx().take_future_breakage_diagnostics()` and then passes the
result to `self.dcx().emit_future_breakage_report(diags)`. This commit
removes the first of these and lets `emit_future_breakage_report` do the
taking.

It also inlines and removes what is left of `emit_future_breakage`,
which has a single call site.
2024-02-03 09:02:50 +11:00
Nicholas Nethercote b506cce579 Fix an incorrect comment. 2024-02-03 09:02:50 +11:00
Nicholas Nethercote cd4c5cd8b8 Improve a local variable name. 2024-02-03 09:02:50 +11:00
Nicholas Nethercote 6fdaf3ef7f Use DiagnosticArgName in a few more places. 2024-02-03 09:02:50 +11:00
Nicholas Nethercote df322fc29f Remove some unnecessary clone calls. 2024-02-03 09:02:50 +11:00
Nicholas Nethercote 8ba25d0989 SilentEmitter::fatal_note doesn't need to be optional. 2024-02-03 09:02:50 +11:00
Nicholas Nethercote a9a2e1565a Diagnostic cleanups
- `emitted_at` isn't used outside the crate.
- `code` and `messages` are public fields, so there's no point have
  trivial getters/setters for them.
- `suggestions` is public, so the comment about "functionality on
  `Diagnostic`" isn't needed.
2024-02-03 09:02:50 +11:00
Nicholas Nethercote 585367f15f Remove an out-of-date comment.
`DiagnosticBuilderInner` was removed some time ago.
2024-02-03 09:02:50 +11:00
Nicholas Nethercote 54c4f94896 Make some fatal errors more concise. 2024-02-03 09:02:50 +11:00
Nicholas Nethercote b6a4f03306 Rename BorrowckErrors as BorrowckDiags.
And some related things. Because it can hold non-error diagnostics.
2024-02-02 14:35:51 +11:00
Nicholas Nethercote 2e6bea5968 Inline and remove DiagnosticBuilder::into_diagnostic.
It now has a single call site.
2024-02-02 14:35:51 +11:00
Nicholas Nethercote 5fd824de44 Remove BorrowckErrors::tainted_by_errors.
`BorrowckErrors` stores a mix of error and non-error diags in
`buffered`. As a result, it downgrades `DiagnosticBuilder`s to
`Diagnostic`s, losing the emission guarantees, and so has to use a
`tainted_by_errors` field to record whether an error has occurred.

This commit splits `buffered` into `buffered_errors` and
`buffered_non_errors`, keeping them as `DiagnosticBuilder`s and
preserving the emission guarantees.

This also requires fixing a bunch of incorrect lifetimes on
`DiagnosticBuilder` use points.
2024-02-02 14:35:46 +11:00
Nicholas Nethercote 3a02ebcac2 Remove BorrowckErrors::set_tainted_by_errors.
It has no effect. Note that `infcx.set_tainted_by_errors()` is still
called, so taintedness is still being propagated.
2024-02-02 13:27:57 +11:00
Nicholas Nethercote f066be5f29 Rename buffer_non_error_diag as buffer_non_error.
To match `buffer_error`.
2024-02-02 13:27:57 +11:00
León Orell Valerian Liehr 5906237b32
Suggest changing ty to const params if appropriate 2024-02-02 03:25:04 +01:00
León Orell Valerian Liehr 3f7b1a5f49
Clean up some things in the name resolver
* Get rid of a typo in a function name
* Rename `currently_processing_generics`: The old name confused me at first since
  I assumed it referred to generic *parameters* when it was in fact referring to
  generic *arguments*. Generics are typically short for generic params.
* Get rid of a few unwraps by properly leveraging slice patterns
2024-02-02 02:51:48 +01:00
Zalathar c9c049b2b4 coverage: Use normal edition: headers in coverage tests
Some of these tests were originally written as part of a custom `run-make`
test, so at that time they weren't able to use the normal compiletest header
directive parser.

Now that they're properly integrated, there's no need for them to use
`compile-flags` to specify the edition, since they can use `edition` instead.
2024-02-02 11:17:05 +11:00
Oli Scherer 6ac035df44 Revert unsound libcore changes of #119911 2024-02-01 22:53:25 +00:00