Commit graph

15362 commits

Author SHA1 Message Date
Ralf Jung
541b2c6009 also skip abi_required_features check in rustdoc
(cherry picked from commit 4c939db0e7)
2025-03-14 14:12:37 -07:00
Ralf Jung
207a543c21 add test
(cherry picked from commit dc04c0ca48)
2025-03-14 14:12:37 -07:00
Josh Stone
eb2bae3fa6 Bless rustdoc-ui differences
These changed in the stable backport because we don't have the rewording
that came in #133154.
2025-03-12 13:43:25 -07:00
Michael Howell
23322f301d doctests: build test bundle and harness separately
This prevents the included test case from getting at nightly-only
features when run on stable. The harness builds with
RUSTC_BOOTSTRAP, but the bundle doesn't.

(cherry picked from commit 9cf531d26f)
2025-03-12 13:18:11 -07:00
Jubilee Young
e5ba20b0ef Revert "Stabilize extended_varargs_abi_support"
This reverts commit 685f189b43.
2025-02-13 08:52:53 -08:00
Lukas Markeffsky
a061e7eb65 fix ensure_monomorphic_enough
(cherry picked from commit c1da4f1d3c)
2025-02-13 08:52:47 -08:00
Lukas Markeffsky
4991b29a36 add test for const type_id misoptimization
(cherry picked from commit 4898753d5d)
2025-02-13 08:52:47 -08:00
dianne
8ee0fcb51b add more pattern migration tests
Most of these are meant to test possible future improvements, but since
they cover cases the existing test suite didn't, I figure including them
now may be helpful.

(cherry picked from commit f1e4d94fa4)
2025-02-10 23:42:03 -08:00
dianne
909010ebe6 try to suggest eliding redundant binding modifiers
(cherry picked from commit b32a5331dc)
2025-02-10 23:40:02 -08:00
dianne
ee0838fcab reword default binding mode notes
(cherry picked from commit a5cc4cbe64)
2025-02-10 23:39:29 -08:00
dianne
215bfdd07d separate labels for default binding mode spans into their own notes
(cherry picked from commit 767f82039c)
2025-02-10 23:38:56 -08:00
dianne
97cb2d553a don't include trailing open parens in labels for reference patterns
(cherry picked from commit a064e78663)
2025-02-10 23:33:10 -08:00
dianne
6ff2d19d1c experimentally label the spans for default binding modes
(cherry picked from commit 203d3109d8)
2025-02-10 23:32:54 -08:00
dianne
2ee601ced6 highlight the whole problem subpattern when pointing out the default binding mode
(cherry picked from commit 4331f55b72)
2025-02-10 23:21:22 -08:00
dianne
f8b23cdb75 add tests for label formatting
(cherry picked from commit 9202001c1c)
2025-02-10 23:20:55 -08:00
dianne
a9465deb4b use more specific wording for subpatterns from macro expansions
(cherry picked from commit bbe40acb9a)
2025-02-10 23:20:14 -08:00
dianne
1a18daac77 reword pattern migration diagnostic to make sense in all editions
This aligns the main error message a bit more with the phrasing in the
Edition Guide and provides a bit more information on the labels to
(hopefully!) aid in understanding.

(cherry picked from commit bdc6c4d07b)
2025-02-10 23:19:28 -08:00
Rémy Rakic
940548094b add tests for issue 135671
(cherry picked from commit c69dea90d7)
2025-02-06 09:53:26 -08:00
Rémy Rakic
197b416baf Revert "Auto merge of #133734 - scottmcm:lower-indexing-to-ptrmetadata, r=davidtwco,RalfJung"
This reverts commit b57d93d8b9, reversing
changes made to 0aeaa5eb22.

(cherry picked from commit 122a55bb44)
2025-02-06 09:53:26 -08:00
Rémy Rakic
c6063d45b7 Revert "Rollup merge of #134371 - scottmcm:fix-134352, r=oli-obk"
This reverts commit 7c301ecdf5, reversing
changes made to dffaad8332.

(cherry picked from commit 0bb4880581)
2025-02-06 09:53:26 -08:00
Rémy Rakic
7302b302d0 Revert "Auto merge of #134330 - scottmcm:no-more-rvalue-len, r=matthewjasper"
This reverts commit e108481f74, reversing
changes made to 303e8bd768.

(cherry picked from commit ca1c17c88d)
2025-02-06 09:53:26 -08:00
Esteban Küber
f264675a80 modify test to side-step platform-dependent stderr output
(cherry picked from commit 592f2c90da)
2025-02-06 09:53:26 -08:00
Esteban Küber
e98d52408c Add check for missing fields in enum variant pattern
(cherry picked from commit d44f021904)
2025-02-06 09:53:26 -08:00
Esteban Küber
887965ddb9 Ensure that we don't try to access fields on a non-struct pattern type in diagnostic
Fix #135209.

(cherry picked from commit 5f04f98c9a)
2025-02-06 09:53:26 -08:00
Kyle Huey
4595e112d0 When LLVM's location discriminator value limit is exceeded, emit locations with dummy spans instead of dropping them entirely
Revert most of #133194 (except the test and the comment fixes). Then refix
not emitting locations at all when the correct location discriminator value
exceeds LLVM's capacity.

(cherry picked from commit 45ef92731b)
2025-01-23 08:45:35 -08:00
lcnr
f6aed49d14 add test
(cherry picked from commit 0910173b35)
2025-01-23 08:45:25 -08:00
lcnr
953a1a0031 avoid running the overlap check twice
(cherry picked from commit ebbcfd4e77)
2025-01-23 08:45:25 -08:00
Michael Goulet
e126c8d50e Make sure to mark IMPL_TRAIT_REDUNDANT_CAPTURES as Allow in edition 2024
(cherry picked from commit 1b068a0dea)
2025-01-16 17:50:08 -08:00
Josh Stone
ce4e43f0d2 Bless test UI changes in backport 2025-01-10 16:32:06 -08:00
Michael Goulet
18d3153837 Try to explain borrow for tail expr temporary drop order change in 2024
(cherry picked from commit c55eefe8bc)
2025-01-10 16:17:51 -08:00
Michael Goulet
1b8413e296 Don't do AccessDepth::Drop for types with no drop impl
(cherry picked from commit 4a099b29cd)
2025-01-10 15:54:24 -08:00
Michael Goulet
273873a671 Don't create cycles by normalizing opaques defined in the body we're checking
(cherry picked from commit 197f6d8081)
2025-01-10 15:54:24 -08:00
Ding Xiang Fei
44755086c8 run borrowck tests on BIDs and emit tail-expr-drop-order lints for
potential violations

(cherry picked from commit 045271cccc)
2025-01-10 15:54:24 -08:00
Noratrieb
031ad72d4d
Pass objcopy args for stripping on OSX
When `-Cstrip` was changed to use the bundled rust-objcopy instead of
/usr/bin/strip on OSX, strip-like arguments were preserved.

But strip and objcopy are, while being the same binary, different, they
have different defaults depending on which binary they are.
Notably, strip strips everything by default, and objcopy doesn't strip
anything by default.

Additionally, `-S` actually means `--strip-all`, so debuginfo stripped
everything and symbols didn't strip anything.

We now correctly pass `--strip-debug` and `--strip-all`.
2025-01-07 20:22:48 +01:00
bors
319f5292a1 Auto merge of #135059 - matthiaskrgr:rollup-0ka9o3h, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #131729 (Make the `test` cfg a userspace check-cfg)
 - #134241 (more concrete source url of std docs [V2])
 - #135042 (taint fcx on selection errors during unsizing)
 - #135049 (Remove unused fields from RepeatElementCopy obligation)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-01-03 09:34:23 +00:00
Matthias Krüger
e0f4dc955a
Rollup merge of #135042 - lukas-code:taint-dyn-incompat, r=compiler-errors
taint fcx on selection errors during unsizing

With `feature(dyn_compatible_for_dispatch)` we only check for dyn-compatibility by checking the `T: Unsize<dyn Trait>` predicate during the unsizing coercions checks. If the predicate doesn't hold, we emit an error, but pretend the coercion succeeded to prevent further errors. To prevent const eval from attempting to actually perform this coercion, we need to taint the fcx after reporting the trait errors in the coercion check.

fixes https://github.com/rust-lang/rust/issues/135021
fixes https://github.com/rust-lang/rust/issues/130521
2025-01-03 07:57:26 +01:00
Matthias Krüger
8439ae7422
Rollup merge of #131729 - Urgau:check-cfg-test-userspace, r=petrochenkov
Make the `test` cfg a userspace check-cfg

This PR implements MCP https://github.com/rust-lang/compiler-team/issues/785, which makes the `test` cfg a "userspace" check-cfg, i.e. no longer included in the well known cfg list.

Things to do:

- [x] Accept the MCP (https://github.com/rust-lang/compiler-team/issues/785#issuecomment-2424121886)
- [x] Mark `test` in Cargo (https://github.com/rust-lang/cargo/pull/14963)

`@rustbot` labels +S-waiting-on-MCP +F-check_cfg
r? `@petrochenkov`
2025-01-03 07:57:24 +01:00
bors
ac00fe89a1 Auto merge of #134692 - GrigorenkoPV:sync_poision, r=tgross35
Move some things to `std::sync::poison` and reexport them in `std::sync`

Tracking issue: #134646

r? `@tgross35`

I've used `sync_poison_mod` feature flag instead, because `sync_poison` had already been used back in 1.2.

try-job: x86_64-msvc
2025-01-03 06:40:28 +00:00
bors
ab3924b298 Auto merge of #122565 - Zoxc:atomic-panic-msg, r=the8472
Try to write the panic message with a single `write_all` call

This writes the panic message to a buffer before writing to stderr. This allows it to be printed with a single `write_all` call, preventing it from being interleaved with other outputs. It also adds newlines before and after the message ensuring that only the panic message will have its own lines.

Before:
```
thread 'thread 'thread 'thread 'thread '<unnamed>thread 'thread 'thread 'thread '<unnamed><unnamed>thread '<unnamed>' panicked at ' panicked at <unnamed><unnamed><unnamed><unnamed><unnamed>' panicked at <unnamed>' panicked at src\heap.rssrc\heap.rs'
panicked at ' panicked at ' panicked at ' panicked at ' panicked at src\heap.rs' panicked at src\heap.rs::src\heap.rssrc\heap.rssrc\heap.rssrc\heap.rssrc\heap.rs:src\heap.rs:455455:::::455:455::455455455455455:455:99:::::9:9:
:
999:
999:
assertion failed: size <= (*queue).block_size:
:
assertion failed: size <= (*queue).block_size:
assertion failed: size <= (*queue).block_size:
:
:
assertion failed: size <= (*queue).block_sizeassertion failed: size <= (*queue).block_sizeassertion failed: size <= (*queue).block_size

assertion failed: size <= (*queue).block_size
assertion failed: size <= (*queue).block_sizeassertion failed: size <= (*queue).block_sizeerror: process didn't exit successfully: `target\debug\direct_test.exe` (exit code: 0xc0000409, STATUS_STACK_BUFFER_OVERRUN)
```
After:
```

thread '<unnamed>' panicked at src\heap.rs:455:9:
assertion failed: size <= (*queue).block_size

thread '<unnamed>' panicked at src\heap.rs:455:9:
assertion failed: size <= (*queue).block_size

thread '<unnamed>' panicked at src\heap.rs:455:9:
assertion failed: size <= (*queue).block_size

error: process didn't exit successfully: `target\debug\direct_test.exe` (exit code: 0xc0000409, STATUS_STACK_BUFFER_OVERRUN)
```

---

try-jobs: x86_64-gnu-llvm-18
2025-01-02 22:06:09 +00:00
Lukas Markeffsky
93bb639ad6 taint fcx on selection errors during unsizing 2025-01-02 19:16:00 +01:00
Urgau
e8a4792b3e Make the test cfg a "userspace" check-cfg 2025-01-02 16:49:55 +01:00
Pavel Grigorenko
ee2ad4dfb1 Move some things to std::sync::poison and reexport them in std::sync 2025-01-02 15:21:41 +03:00
Matthias Krüger
92dbfcc2c0
Rollup merge of #135000 - compiler-errors:opaque-captures-dupe, r=lqd
Fix ICE when opaque captures a duplicated/invalid lifetime

See description on test.

Fixes #132766
Fixes #133693
Fixes #134780
2025-01-01 22:04:18 +01:00
Michael Goulet
d3c6067275 Fix ICE when opaque captures a duplicated/invalid lifetime 2025-01-01 19:32:51 +00:00
John Kåre Alsaker
4bf85c25ec Try to write the panic message with a single write_all call 2025-01-01 15:58:29 +01:00
Stuart Cook
65cb7c66d0
Rollup merge of #134979 - estebank:default-lint-sugg, r=compiler-errors
Provide structured suggestion for `impl Default` of type where all fields have defaults

```
error: `Default` impl doesn't use the declared default field values
  --> $DIR/manual-default-impl-could-be-derived.rs:28:1
   |
LL | / impl Default for B {
LL | |     fn default() -> Self {
LL | |         B {
LL | |             x: s(),
   | |                --- this field has a default value
LL | |             y: 0,
   | |                - this field has a default value
...  |
LL | | }
   | |_^
   |
help: to avoid divergence in behavior between `Struct { .. }` and `<Struct as Default>::default()`, derive the `Default`
   |
LL ~ #[derive(Default)] struct B {
   |
```

Note that above the structured suggestion also includes completely removing the manual `impl`, but the rendering doesn't.
2025-01-01 16:35:32 +11:00
Stuart Cook
f91bfd97bf
Rollup merge of #134945 - compiler-errors:map-mutate-nits, r=estebank
Some small nits to the borrowck suggestions for mutating a map through index

1. Suggesting users to either use `.insert` or `.get_mut` (which do totally different things) can be a bit of a footgun, so let's make that a bit more nuanced.
2. I find the suggestion of `.get_mut(|val| { *val = whatever; })` to be a bit awkward. I changed this to be an if-let instead.
3. Fix a bug which was suppressing the structured suggestion for some mutations via the index operator on `HashMap`/`BTreeMap`.

r? estebank or reassign
2025-01-01 16:35:31 +11:00
Stuart Cook
1ea1db5b08
Rollup merge of #134877 - DavisRayM:129966-format-string-help-message, r=estebank
add suggestion for wrongly ordered format parameters

Add suggestion for wrongly ordered format parameters like `?#`.

Supersedes #131004
Fix #129966
2025-01-01 16:35:30 +11:00
Stuart Cook
0204259780
Rollup merge of #133292 - dianne:e0277-suggest-deref, r=estebank
E0277: suggest dereferencing function arguments in more cases

This unifies and generalizes some of the logic in `TypeErrCtxt::suggest_dereferences` so that it will suggest dereferencing arguments to function/method calls in order to satisfy trait bounds in more cases.

Previously it would only fire on reference types, and it had two separate cases (one specifically to get through custom `Deref` impls when passing by-reference, and one specifically to catch #87437). I've based the new checks loosely on what's done for `E0308` in `FnCtxt::suggest_deref_or_ref`: it will suggest dereferences to satisfy trait bounds whenever the referent is `Copy`, is boxed (& so can be moved out of the boxes), or is being passed by reference.

This doesn't make the suggestion fire in contexts other than function arguments or binary operators (which are in a separate case that this doesn't touch), and doesn't make it suggest a combination of `&`-removal and dereferences. Those would require a bit more restructuring, so I figured just doing this would be a decent first step.

Closes #90997
2025-01-01 16:35:30 +11:00
Trevor Gross
ac4546c9fd
Rollup merge of #134971 - dxsullivan:fix-typo, r=lqd
chore: fix typos

I hope my typo corrections will help you. Thank you for your work.
2024-12-31 18:42:24 -05:00