Commit Graph

286180 Commits

Author SHA1 Message Date
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
Ralf Jung
742b378371 make hover_feature test less fragile 2025-04-08 12:13:17 +02:00
xizheyin
c66d35e946
update if let to match in universal_regions.rs
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-04-08 17:39:15 +08:00
xizheyin
a8b0eb7c65
Update compiler/rustc_borrowck/src/diagnostics/region_errors.rs
Co-authored-by: lcnr <rust@lcnr.de>
2025-04-08 17:36:44 +08:00
bors
e5fefc359b Auto merge of #139474 - jieyouxu:bump-rustc-perf, r=Kobzol
rustc-perf: update to `c0f3b53c8e5de87714d18a5f42998859302ae03a`

Hopefully unblocks https://github.com/rust-lang/rust/pull/139279.

r? `@Kobzol` (or compiler)
`@bors` rollup=never
2025-04-08 08:56:34 +00:00
Ralf Jung
e44f5c9f05
Merge pull request #4257 from RalfJung/bump-tokio
test_dependencies: bump tokio
2025-04-08 08:34:56 +00:00
Jieyou Xu
603685cd74
compiletest: drop dependency on anyhow
Currently `compiletest` panics all over the place but doesn't really use
`anyhow` anyway. I'd like to introduce some more principled error
handling and disciplined diagnostic reporting in the near future.
2025-04-08 16:11:26 +08:00
Jieyou Xu
3dec37f1cc
compiletest: sort dependencies alphabetically 2025-04-08 16:09:03 +08:00
Ralf Jung
e160d93e60 test_dependencies: bump tokio 2025-04-08 10:07:38 +02:00
Michael Goulet
d940038636 Remove unnecessary dyn Display in favor of str 2025-04-08 06:09:04 +00:00
Michael Goulet
c5320454ed Improve presentation of closure signature mismatch from Fn trait goal 2025-04-08 05:54:57 +00:00
xizheyin
c7272a6cbc
clean code: remove Deref<Target=RegionKind> impl for Region and use .kind()
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-04-08 10:51:41 +08:00
Nicholas Nethercote
e177921ae9 Allow for reparsing failure when reparsing a pasted metavar.
Fixes #139445.

The additional errors aren't great but the first one is still good and
it's the most important, and imperfect errors are better than ICEing.
2025-04-08 12:06:42 +10:00
Nicholas Nethercote
eb5d8923fc Allow for missing invisible close delim when reparsing an expression.
This can happen when invalid syntax is passed to a declarative macro. We
shouldn't be too strict about the token stream position once the parser
has rejected the invalid syntax.

Fixes #139248.
2025-04-08 12:06:40 +10:00
Tshepang Mbambo
eb4bc2ccfb
add missing word in doc comment (part 2) 2025-04-08 03:48:14 +02:00
Scott McMurray
502f7f9c24 Address PR feedback 2025-04-07 18:12:06 -07:00
Tshepang Mbambo
8501dcbd4b
remove unusual indentation
This also fixes markdown rendering
2025-04-08 02:59:48 +02:00
Tshepang Mbambo
01e44b140d
add missing word in doc comment 2025-04-08 02:44:06 +02:00
Michael Goulet
b08e9c2a60 Fix stack overflow in exhaustiveness due to recursive HIR opaque type values 2025-04-07 22:41:48 +00:00
lcnr
d35ad8d836 add negative impl 2025-04-08 00:34:40 +02:00
lcnr
474ec7a3f4 move ClosureRegionRequirements to rustc_borrowck 2025-04-08 00:34:40 +02:00
lcnr
f05a23be5c borrowck typeck children together with their parent 2025-04-08 00:34:40 +02:00
Jonathan Gruner
4aab8e88e4 document panic behavior of Vec::resize and Vec::resize_with 2025-04-08 00:00:38 +02:00
bors
c6c179662d Auto merge of #133781 - cjgillot:shallow-allowed-lints, r=petrochenkov
Do not visit whole crate to compute `lints_that_dont_need_to_run`.

This allows to reuse the computed lint levels instead of re-visiting the whole crate.
2025-04-07 21:03:55 +00:00
Michael Goulet
268c56e144 Implement overflow for infinite implied lifetime bounds 2025-04-07 21:01:24 +00:00
Michael Goulet
250b848272 Make error message for missing fields with .. and without .. more consistent 2025-04-07 20:45:08 +00:00
Santiago Pastorino
4a0ea02e3a
Only clone mir body if tcx.features().ergonomic_clones() 2025-04-07 16:53:12 -03:00
Santiago Pastorino
d6ad9e6191
Remove crash test that do not ICE anymore 2025-04-07 16:53:12 -03:00
Santiago Pastorino
dfa58e39c8
rustfmt does not support use closures yet 2025-04-07 16:53:11 -03:00
Santiago Pastorino
20f93c9e8e
Add codegen test to be sure we get rid of uneeded clones after monomorphization 2025-04-07 16:53:11 -03:00
Santiago Pastorino
a0856eaff6
Add mir opt tests to be sure we generate copy, clones and moves when corresponds 2025-04-07 16:53:11 -03:00
Santiago Pastorino
9f69c66a47
Optimize codegen of use values that are copy post monomorphization 2025-04-07 16:53:11 -03:00
Santiago Pastorino
b9159e09a7
Use a local var for tcx 2025-04-07 16:53:11 -03:00
Santiago Pastorino
b078564fe6
Make use generated TerminatorKind::Call have call_source Use 2025-04-07 16:53:11 -03:00
Bennet Bleßmann
bc2912386f
Revert "remove rust-analyser support for extern "rust-intrinsic" blocks"
This reverts commit 51b51b51d7.
2025-04-07 20:30:27 +02:00
Michael Goulet
14d1215719 Restrict some queries by def-kind more 2025-04-07 18:10:28 +00:00
Ralf Jung
a7400a8b90 update intrinsics/mod.rs comment about const intrinsics 2025-04-07 19:06:34 +02:00
rustbot
2fb550bd54 Update books 2025-04-07 19:01:05 +02:00
Vadim Petrochenkov
fd854a772e compiletest: Avoid ignoring empty diagnostics in one more place
This catches some silly notes emitted by rustc, which should ideally be fixed
2025-04-07 19:43:41 +03:00