Commit Graph

286277 Commits

Author SHA1 Message Date
bors
de5b8a4c77 Auto merge of #139536 - matthiaskrgr:rollup-j6goald, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #139476 (rm `RegionInferenceContext::var_infos`)
 - #139485 (compiletest: Stricter parsing for diagnostic kinds)
 - #139491 (Update books)
 - #139500 (document panic behavior of Vec::resize and Vec::resize_with)
 - #139501 (Fix stack overflow in exhaustiveness due to recursive HIR opaque hidden types)
 - #139504 (add missing word in doc comment)
 - #139509 (clean: remove Deref<Target=RegionKind> impl for Region and use `.kind()`)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-04-08 22:51:10 +00:00
Jane Losare-Lusby
6f55015835 fix "still mutable" ice while metrics are enabled 2025-04-08 15:00:37 -07:00
Nadrieril
f458151b7a Remove redundant assignment 2025-04-08 23:33:53 +02:00
Nadrieril
6588018fb4 Return a type from check_pat_inner 2025-04-08 23:33:53 +02:00
Nadrieril
38adb9931c Reorganize check_pat_inner 2025-04-08 23:33:52 +02:00
Nadrieril
19950b52c7 Turn the peeling loop into a recursive call 2025-04-08 23:26:48 +02:00
Nadrieril
9f57903e9c Insert adjustments incrementally 2025-04-08 23:26:48 +02:00
Nadrieril
a0d9c87266 Inline calc_default_binding_mode 2025-04-08 23:26:48 +02:00
Vadim Petrochenkov
b3f75353a2 UI tests: add missing diagnostic kinds where possible 2025-04-08 23:06:31 +03:00
Matthias Krüger
f2fd24df00
Rollup merge of #139547 - joshtriplett:library-tracking-issue-template, r=Amanieu
Update library tracking issue template to set S-tracking-unimplemented

This will help people notice the `S-tracking-*` labels, and if the
tracking issue *is* implemented, they can change the label.

Discussed in a `@rust-lang/libs-api` meeting.

r? `@Amanieu`
2025-04-08 21:26:03 +02:00
Matthias Krüger
8a64ba5c3f
Rollup merge of #139541 - compiler-errors:transmute, r=lcnr
Instantiate higher-ranked transmute goal w/ placeholders before emitting sub-obligations

This avoids an ICE where we weren't keeping track of bound variables correctly in the `Freeze` obligations we emit for transmute goals. We could use `rebind` instead on that goal, but I think it's better just to instantiate the binder.

Fixes #139538

r? `@lcnr` or reassign
2025-04-08 21:26:02 +02:00
Matthias Krüger
049d897bae
Rollup merge of #139528 - Zalathar:no-logfile, r=jieyouxu
compiletest: Remove the `--logfile` flag

This flag is deprecated in libtest (#134283), and there's no evidence in-tree of this flag actually being passed to compiletest.

For detailed information about test results, bootstrap parses JSON output from compiletest instead (#108659).

As part of my experimental work on removing the libtest dependency from compiletest, it's useful to be able to disconnect libtest functionality that isn't needed.
2025-04-08 21:26:02 +02:00
Matthias Krüger
51bc376737
Rollup merge of #139526 - smanilov:issue-139505, r=RalfJung
Fix deprecation note for std::intrinsics

Also checked the rest of the mentions of std::mem in the changed file and they look good to me.

Fixes #139505
2025-04-08 21:26:01 +02:00
Matthias Krüger
87dfd1245f
Rollup merge of #139523 - BoxyUwU:rgd-push, r=jieyouxu
Rustc dev guide subtree update

r? `@jieyouxu`
2025-04-08 21:26:00 +02:00
Matthias Krüger
40be0470b5
Rollup merge of #139520 - jieyouxu:compiletest-maintenance-1, r=lqd
compiletest maintenance: sort deps and drop dep on `anyhow`

Two changes:

1. Sort compiletest deps alphabetically because it was annoying me (harder to quickly glance what deps compiletest is using).
2. Drop dependency on `anyhow`. There's only one usage of `anyhow`, which is for `with_context` on sth that would immediately panic anyway.
2025-04-08 21:26:00 +02:00
Matthias Krüger
b41e2bd807
Rollup merge of #139515 - compiler-errors:sig-mismatch, r=lcnr
Improve presentation of closure signature mismatch from `Fn` trait goal

Flip the order of "expected" and "found" since that wasn't correct.

Don't present the arguments as a tuple, since it leaves a trailing comma. Instead, just use `fn(arg, arg)`.

Finally, be better with binders since we were just skipping binders.

r? oli-obk or reassign
2025-04-08 21:25:59 +02:00
Matthias Krüger
df9796f20d
Rollup merge of #139506 - tshepang:patch-6, r=jieyouxu
add missing word in doc comment (part 2)
2025-04-08 21:25:59 +02:00
Matthias Krüger
7661224f1e
Rollup merge of #139496 - Skgland:139455-went-too-far, r=Veykril
Revert r-a changes of rust-lang/rust#139455

I discovered https://github.com/rust-lang/rust/issues/132735#issuecomment-2784205477 that I might have done too much in rust-lang/rust#132735 by also removing support in r-a.
So this reverts the commit with the changes to r-a.

r? RalfJung
2025-04-08 21:25:58 +02:00
Matthias Krüger
894f471d1e
Rollup merge of #139494 - compiler-errors:restrict-queries, r=oli-obk
Restrict some queries by def-kind more

Random cleanup. I prefer things to assert more so as to catch bugs :)

r? oli-obk
2025-04-08 21:25:57 +02:00
Jonathan Gruner
6d71fc15d8 for large assignment lint, use the correct span for checking for duplicate lints 2025-04-08 21:22:20 +02:00
Jonathan Gruner
df6254f7a2 report call site of inlined scopes for large assignment lints 2025-04-08 20:49:50 +02:00
Santiago Pastorino
ca4a58241b
Add spawn thread test 2025-04-08 14:05:19 -03:00
Michael Goulet
68692b7fbb Instantiate higher-ranked transmute goal 2025-04-08 17:00:29 +00:00
Santiago Pastorino
3f21ebcb7a
Test interaction between RFC 2229 migration and use closures 2025-04-08 13:57:46 -03:00
Santiago Pastorino
c717c59960
Add multiple closure use variants 2025-04-08 13:50:27 -03:00
Santiago Pastorino
ec3820a10d
Add .use block test 2025-04-08 13:50:27 -03:00
Matthias Krüger
1cbf8b56af
Rollup merge of #139509 - xizheyin:issue-139359, r=lcnr
clean: remove Deref<Target=RegionKind> impl for Region and use `.kind()`

Closes #139359

r? `@lcnr`
2025-04-08 18:05:34 +02:00
Matthias Krüger
74c2a9be5b
Rollup merge of #139504 - tshepang:patch-5, r=jieyouxu
add missing word in doc comment
2025-04-08 18:05:32 +02:00
Matthias Krüger
9ea9339435
Rollup merge of #139501 - compiler-errors:suppress-stack-overflow, r=lcnr
Fix stack overflow in exhaustiveness due to recursive HIR opaque hidden types

This fixes several spicy non-trivial recursive opaque definitions inferred from HIR typeck, ensuring that they don't cause stack overflows in exhaustiveness code, which currently reveals opaques manually in a way that is not overflow aware (as opposed to something like the normalizer folders).

These should eventually be outright rejected, but today (some) non-trivial recursive opaque definitions are accepted, and changing that requires an FCP, so for now just make sure we don't stack overflow :^)

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

r? lcnr
2025-04-08 18:05:31 +02:00
Matthias Krüger
890c6de310
Rollup merge of #139500 - jogru0:117437, r=tgross35
document panic behavior of Vec::resize and Vec::resize_with

This adds panic documentation to ´Vec::resize´ and ´Vec::resize_with´. Fixes #117437.
2025-04-08 18:05:29 +02:00
Matthias Krüger
7bc1d3abb9
Rollup merge of #139491 - rustbot:docs-update, r=ehuss
Update books

## rust-lang/reference

12 commits in e95ebdfee02514d93f79ec92ae310a804e87f01f..46435cd4eba11b66acaa42c01da5c80ad88aee4b
2025-04-07 14:21:21 UTC to 2025-03-25 20:13:17 UTC

- Update book.toml fix the authors field (rust-lang/reference#1780)
- Update precedence table for borrow operators (rust-lang/reference#1776)
- Add the ability for rules to be specified in link definitions (rust-lang/reference#1775)
- Rework trait parameter patterns (rust-lang/reference#1771)
- Fix header rules (rust-lang/reference#1770)
- Add test wrappers (rust-lang/reference#1774)
- Update tools to Rust 2024 (rust-lang/reference#1773)
- Define byte (rust-lang/reference#1772)
- Fix CSS for new footnote style (rust-lang/reference#1777)
- do not reference LLVM in our definition of UB (rust-lang/reference#1750)
- Tweak reference for precise capturing in traits (rust-lang/reference#1769)
- Add edition admonitions (rust-lang/reference#1764)

## rust-lang/rust-by-example

2 commits in 6f69823c28ae8d929d6c815181c73d3e99ef16d3..0d7964d5b22cf920237ef1282d869564b4883b88
2025-04-07 11:19:31 UTC to 2025-03-29 02:25:52 UTC

- Rename count to index for clarity (rust-lang/rust-by-example#1920)
- Fixing grammar in panic section (rust-lang/rust-by-example#1916)
2025-04-08 18:05:25 +02:00
Matthias Krüger
df57bdf741
Rollup merge of #139485 - petrochenkov:errkind-light, r=oli-obk,jieyouxu
compiletest: Stricter parsing for diagnostic kinds

Non-controversial parts of https://github.com/rust-lang/rust/pull/139427 not requiring many changes in the test suite.

r? ``@jieyouxu``
2025-04-08 18:05:22 +02:00
Matthias Krüger
75f3bd6ed0
Rollup merge of #139476 - lcnr:rm-var_infos, r=compiler-errors
rm `RegionInferenceContext::var_infos`

we already track this info in the `definitions` field

r? types
2025-04-08 18:05:19 +02:00
bors
d4f880f8ce Auto merge of #138499 - lcnr:borrowck-typeck_root, r=oli-obk
borrowck typeck children together with their root

This introduces new cycle errors, even with `feature(inline_const_pat)` removed, see the `non-structural-match-types-cycle-err.rs` test.

The new cycle error happens as the layout of `async`-blocks relies on their `optimized_mir`. As that now depends on `mir_borrowck` of its typeck parent, computing the layout of an `async`-block during MIR building, e.g. when evaluating a named `const` pattern. I think there's currently no way to have a named const pattern whose type references an async block while being allowed? cc `@oli-obk` `@RalfJung`

I cannot think of other cases where we currently rely on the MIR of a typeck children while borrowchecking their parent. The crater run came back without any breakage. My work here will prevent any future features which rely on this as we'll get locked into borrowchecking them together as I continue to work on https://github.com/rust-lang/types-team/issues/129, cc `@rust-lang/types.`

r? compiler-errors
2025-04-08 16:01:37 +00:00
Josh Triplett
fe079c4e57 Update library tracking issue template to set S-tracking-unimplemented
This will help people notice the `S-tracking-*` labels, and if the
tracking issue *is* implemented, they can change the label.
2025-04-08 08:10:41 -07:00
Gabriel Bjørnager Jensen
f2dee82052 Update 'u8'-to-and-from-'i8' suggestions; 2025-04-08 17:07:50 +02:00
Zalathar
63fcd2419d compiletest: Remove the --logfile flag
This flag is deprecated in libtest, and there's no evidence in-tree of this
flag actually being passed to compiletest.

(For detailed information about test results, bootstrap parses JSON output from
compiletest instead.)
2025-04-08 22:17:58 +10:00
bors
f820b75fee Auto merge of #139525 - Zalathar:rollup-5t5xsrw, r=Zalathar
Rollup of 10 pull requests

Successful merges:

 - #138676 (Implement overflow for infinite implied lifetime bounds)
 - #139024 (Make error message for missing fields with `..` and without `..` more consistent)
 - #139098 (Tell LLVM about impossible niche tags)
 - #139124 (compiler: report error when trait object type param reference self)
 - #139321 (Update to new rinja version (askama))
 - #139346 (Don't construct preds w escaping bound vars in `diagnostic_hir_wf_check`)
 - #139386 (make it possible to use stage0 libtest on compiletest)
 - #139421 (Fix trait upcasting to dyn type with no principal when there are projections)
 - #139464 (Allow for reparsing failure when reparsing a pasted metavar.)
 - #139490 (Update some comment/docs related to "extern intrinsic" removal)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-04-08 12:05:54 +00:00
Stan Manilov
245cf8e734 Fix deprecation note for std::intrinsics
Also checked the rest of the mentions of std::mem in the changed file
and they look good to me.
2025-04-08 14:36:12 +03:00
Zalathar
34e97592f4 compiletest: Trim whitespace from environment variable names 2025-04-08 21:31:53 +10:00
Stuart Cook
42fdd7deee
Rollup merge of #139490 - RalfJung:unstable-intrinsics-docs, r=oli-obk
Update some comment/docs related to "extern intrinsic" removal

Follow-up to https://github.com/rust-lang/rust/pull/139455.

r? `@oli-obk`
2025-04-08 20:55:12 +10:00
Stuart Cook
24369adae7
Rollup merge of #139464 - nnethercote:fix-139248-AND-fix-139445, r=petrochenkov
Allow for reparsing failure when reparsing a pasted metavar.

Fix some metavar reparsing issues.

Fixes #139248 and #139445.

r? `@petrochenkov`
2025-04-08 20:55:11 +10:00
Stuart Cook
056756c7c4
Rollup merge of #139421 - compiler-errors:upcast-no-principal-with-proj, r=oli-obk
Fix trait upcasting to dyn type with no principal when there are projections

#126660 (which I had originally authored, lol) had a subtle bug that is the moral equivalent of #114036, which is that when upcasting from `dyn Principal<Projection = Ty> + AutoTrait` to `dyn AutoTrait`, we were dropping the trait ref for `Principal` but not its projections (if there were any).

With debug assertions enabled, this triggers the assertion I luckily added in a2a0cfe825, but even without debug assertions this is a logical bug since we had a dyn type with just a projection bound but no principal, so it caused a type mismatch.

This does not need an FCP because this should've been covered by the FCP in #126660, but we just weren't testing a case when casting from a `dyn` type with projections 😸

Fixes #139418

r? ````@oli-obk```` (or anyone)
2025-04-08 20:55:09 +10:00
Stuart Cook
ab80f575c4
Rollup merge of #139386 - onur-ozkan:configurable-compiletest-libtest, r=jieyouxu,kobzol
make it possible to use stage0 libtest on compiletest

With https://github.com/rust-lang/rust/pull/119899, building the library tree will require a stage 1 compiler. This is because `compiletest` is defined as a `ToolStd` (since https://github.com/rust-lang/rust/pull/68019) in order to use the in-tree library. As a result, https://github.com/rust-lang/rust/pull/119899 makes certain development workflows more difficult as changes on the compiler tree will now require recompiling `compiletest` each time.

This PR allows switching `ToolStd` to `ToolBootstrap` with a simple boolean option in `bootstrap.toml` to allow `compiletest` to use the stage 0 `libtest` instead.

The changes under `src/ci` are clearly intended to make sure that `compiletest` doesn't break during future bootstrap beta bumps.
2025-04-08 20:55:08 +10:00
Stuart Cook
133cec7363
Rollup merge of #139346 - compiler-errors:non-lifetime-binder-diag-hir-wf-check, r=oli-obk
Don't construct preds w escaping bound vars in `diagnostic_hir_wf_check`

See comment inline.

Fixes #139330

r? oli-obk
2025-04-08 20:55:07 +10:00
Stuart Cook
dd682f7750
Rollup merge of #139321 - GuillaumeGomez:update-rinja, r=notriddle,lolbinarycat,yotamofek
Update to new rinja version (askama)

Askama maintenance was handed over to rinja maintainers so new `rinja` release is actually `askama`. More information [here](https://blog.guillaume-gomez.fr/articles/2025-03-19+Askama+and+Rinja+merge).

r? ``@notriddle``
2025-04-08 20:55:05 +10:00
Stuart Cook
5913c5248b
Rollup merge of #139124 - xtexx:gh-139082, r=compiler-errors
compiler: report error when trait object type param reference self

Fixes #139082.

Emits an error when `Self` is found in the projection bounds of a trait
object. In type aliases, `Self` has no meaning, so `type A = &'static
dyn B` where `trait B = Fn() -> Self` will expands to `type A = &'static
Fn() -> Self` which is illegal, causing the region solver to bail out
when hitting the uninferred Self.

r? ````@compiler-errors```` ````@fee1-dead````
2025-04-08 20:55:04 +10:00
Stuart Cook
7ffa56c3a3
Rollup merge of #139098 - scottmcm:assert-impossible-tags, r=WaffleLapkin
Tell LLVM about impossible niche tags

I was trying to find a better way of emitting discriminant calculations, but sadly had no luck.

So here's a fairly small PR with the bits that did seem worth bothering:

1. As the [`TagEncoding::Niche` docs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_abi/enum.TagEncoding.html#variant.Niche) describe, it's possible to end up with a dead value in the input that's not already communicated via the range parameter attribute nor the range load metadata attribute.  So this adds an `llvm.assume` in non-debug mode to tell LLVM about that.  (That way it can tell that the sides of the `select` have disjoint possible values.)

2. I'd written a bunch more tests, or at least made them parameterized, in the process of trying things out, so this checks in those tests to hopefully help future people not trip on the same weird edge cases, like when the tag type is `i8` but yet there's still a variant index and discriminant of `258` which doesn't fit in that tag type because the enum is really weird.
2025-04-08 20:55:03 +10:00
Stuart Cook
6257825c8f
Rollup merge of #139024 - compiler-errors:tweak-default-value-err, r=lcnr
Make error message for missing fields with `..` and without `..` more consistent

When `..` is not present, we say "missing field `bar` in initializer", but when it is present we say "missing mandatory field `bar`". I don't see why the primary error message should change, b/c the root cause is the same.

Let's harmonize these error messages and instead use a label to explain that `..` is required b/c it's not defaulted.

r? estebank
2025-04-08 20:55:01 +10:00
Stuart Cook
2b1afcbd1a
Rollup merge of #138676 - compiler-errors:overflow-implied-bounds, r=lcnr
Implement overflow for infinite implied lifetime bounds

Not a great error message, but better than a hang

Fixes #138665
Fixes #102966
Fixes #115407

r? lcnr
2025-04-08 20:54:58 +10:00