Commit Graph

1379 Commits

Author SHA1 Message Date
yukang
07e6dd95bd report pat no field error no recoverd struct variant 2024-07-11 00:18:47 +08:00
bors
ba1d7f4a08 Auto merge of #120639 - fee1-dead-contrib:new-effects-desugaring, r=oli-obk
Implement new effects desugaring

cc `@rust-lang/project-const-traits.` Will write down notes once I have finished.

* [x] See if we want `T: Tr` to desugar into `T: Tr, T::Effects: Compat<true>`
* [x] Fix ICEs on `type Assoc: ~const Tr` and `type Assoc<T: ~const Tr>`
* [ ] add types and traits to minicore test
* [ ] update rustc-dev-guide

Fixes #119717
Fixes #123664
Fixes #124857
Fixes #126148
2024-06-29 20:08:10 +00:00
Deadbeef
72e8244e64 implement new effects desugaring 2024-06-28 10:57:35 +00:00
Michael Goulet
81c2c57519 Make queries more explicit 2024-06-27 12:03:57 -04:00
Michael Goulet
ffd72b1700 Fix remaining cases 2024-06-21 19:00:18 -04:00
Oli Scherer
7ba82d61eb Use a dedicated type instead of a reference for the diagnostic context
This paves the way for tracking more state (e.g. error tainting) in the diagnostic context handle
2024-06-18 15:42:11 +00:00
Oli Scherer
c91edc3888 Prefer dcx methods over fields or fields' methods 2024-06-18 13:45:08 +00:00
Michael Goulet
342c1b03d6 Rename InstanceDef -> InstanceKind 2024-06-16 21:35:21 -04:00
Vadim Petrochenkov
14da80c372 rustc_span: Minor improvements
Introduce `{IndexNewtype,SyntaxContext}::from_u16` for convenience because small indices are sometimes encoded as `u16`.
Use `SpanData::span` instead of `Span::new` where appropriate.
Add a clarifying comment about decoding span parents.
2024-06-16 14:08:25 +03:00
Michael Goulet
93ff86ed7c Use is_lang_item more aggressively 2024-06-14 16:54:29 -04:00
Michael Goulet
4b188d9d66 Only compute specializes query if specialization is enabled in the crate of the specialized impl 2024-06-07 15:58:50 -04:00
Jubilee
4c771d3117
Rollup merge of #126099 - Nilstrieb:crate-loader-cleanups, r=jieyouxu
Crate loader cleanups

Minor cleanups I found while trying to understand how all of this works
2024-06-06 21:10:10 -07:00
bors
98489f2487 Auto merge of #126068 - lqd:revert-124976, r=petrochenkov
Revert "use `tcx.used_crates(())` more" before it reaches beta

There are more open issues caused by #124976 than will be fixed by #125493 alone. The beta cut is soon, so let's revert it and buy some time to analyze and fix these issues in our own time.

fixes https://github.com/rust-lang/rust/issues/125474
fixes https://github.com/rust-lang/rust/issues/125484
fixes https://github.com/rust-lang/rust/issues/125646
fixes https://github.com/rust-lang/rust/issues/125707
fixes #126066
fixes #125934
fixes https://github.com/rust-lang/rust/issues/126021

r? `@petrochenkov`
`@bors` p=1
2024-06-06 20:18:43 +00:00
Nilstrieb
4c2b21a2ef Simplify string operations in crate loader 2024-06-06 21:53:29 +02:00
Nilstrieb
3a02cdb54f Remove constant parameter from CrateLocator::new 2024-06-06 21:50:24 +02:00
Rémy Rakic
0a4176a831 Revert "Rollup merge of #124976 - petrochenkov:usedcrates, r=oli-obk"
This reverts commit eda4a35f36, reversing
changes made to eb6b35b5bc.
2024-06-06 10:06:28 +00:00
Santiago Pastorino
bac72cf7cf
Add safe/unsafe to static inside extern blocks 2024-06-04 14:19:43 -03:00
bors
99cb42c296 Auto merge of #124662 - zetanumbers:needs_async_drop, r=oli-obk
Implement `needs_async_drop` in rustc and optimize async drop glue

This PR expands on #121801 and implements `Ty::needs_async_drop` which works almost exactly the same as `Ty::needs_drop`, which is needed for #123948.

Also made compiler's async drop code to look more like compiler's regular drop code, which enabled me to write an optimization where types which do not use `AsyncDrop` can simply forward async drop glue to `drop_in_place`. This made size of the async block from the [async_drop test](67980dd6fb/tests/ui/async-await/async-drop.rs) to decrease by 12%.
2024-05-31 10:12:24 +00:00
Oli Scherer
a34c26e7ec Make body_owned_by return the body directly.
Almost all callers want this anyway, and now we can use it to also return fed bodies
2024-05-29 10:04:08 +00:00
Daria Sukhonina
a47173c4f7 Start implementing needs_async_drop and related 2024-05-29 12:50:44 +03:00
Michael Goulet
bbcdb4fd3e Give EarlyBinder a tcx parameter
We are gonna need it to uplift EarlyBinder
2024-05-26 20:04:05 -04:00
bors
8679004993 Auto merge of #125434 - nnethercote:rm-more-extern-tracing, r=jackh726
Remove more `#[macro_use] extern crate tracing`

Because explicit importing of macros via use items is nicer (more standard and readable) than implicit importing via `#[macro_use]`. Continuing the work from #124511 and #124914.

r? `@jackh726`
2024-05-23 21:36:54 +00:00
Matthias Krüger
c9e457dbd6
Rollup merge of #125409 - tbu-:pr_raw_dylib_only_windows, r=lcnr
Rename `FrameworkOnlyWindows` to `RawDylibOnlyWindows`

Frameworks are Apple-specific, no idea why it had "framework" in the name before.
2024-05-23 14:09:24 +02:00
Matthias Krüger
eda4a35f36
Rollup merge of #124976 - petrochenkov:usedcrates, r=oli-obk
rustc: Use `tcx.used_crates(())` more

And explain when it should be used.

Addresses comments from https://github.com/rust-lang/rust/pull/121167.
2024-05-23 14:09:23 +02:00
Nicholas Nethercote
d787fb062c Remove #[macro_use] extern crate tracing from rustc_metadata. 2024-05-23 18:02:40 +10:00
bors
22f5bdc42b Auto merge of #124686 - saethlin:rust-file-footer, r=fmease
Add a footer in FileEncoder and check for it in MemDecoder

We have a few reports of ICEs due to decoding failures, where the fault does not lie with the compiler. The goal of this PR is to add some very lightweight and on-by-default validation to the compiler's outputs. If validation fails, we emit a fatal error for rmeta files in general that mentions the path that didn't load, and for incremental compilation artifacts we emit a verbose warning that tries to explain the situation and treat the artifacts as outdated.

The validation currently implemented here is very crude, and yet I think we have 11 ICE reports currently open (you can find them by searching issues for `1002111927320821928687967599834759150`) which this simple validation would have detected. The structure of the code changes here should permit the addition of further validation code, such as a checksum, if it is merited. I would like to have code to detect corruption such as reported in https://github.com/rust-lang/rust/issues/124719, but I'm not yet sure how to do that efficiently, and this PR is already a good size.

The ICE reports I have in mind that this PR would have smoothed over are:
https://github.com/rust-lang/rust/issues/124469
https://github.com/rust-lang/rust/issues/123352
https://github.com/rust-lang/rust/issues/123376 [^1]
https://github.com/rust-lang/rust/issues/99763
https://github.com/rust-lang/rust/issues/93900.

---

[^1]: This one might be a compiler bug, but even if it is I think the workflow described is pushing the envelope of what we can support. This issue is one of the reasons this warning still asks people to file an issue.
2024-05-22 15:59:56 +00:00
Vadim Petrochenkov
711338bd9f rustc: Use tcx.used_crates(()) more
And explain when it should be used.
2024-05-22 18:02:51 +03:00
Tobias Bucher
72968e5198 Rename FrameworkOnlyWindows to RawDylibOnlyWindows
Frameworks are Apple-specific, no idea why it had "framework" in the
name before.
2024-05-22 16:29:27 +02:00
Ben Kimock
c3a606237d PR feedback 2024-05-21 20:12:30 -04:00
Ben Kimock
95150d7246 Add a footer in FileEncoder and check for it in MemDecoder 2024-05-21 20:12:29 -04:00
Xiretza
98dd6c7e8f Rename buffer_lint_with_diagnostic to buffer_lint 2024-05-21 20:16:39 +00:00
Xiretza
8004e6a379 Make early lints translatable 2024-05-21 20:16:39 +00:00
Xiretza
b7abf014ec Convert uses of BuiltinLintDiag::Normal to custom variants
This ensures all diagnostic messages are created at diagnostic emission
time, making them translatable.
2024-05-21 20:16:39 +00:00
Nicholas Nethercote
d8ea468994 Reorder some use items. 2024-05-21 14:55:37 +10:00
Nicholas Nethercote
eb10eb2b45 Reorder top-level attributes.
And remove an unnecessary `feature(try_blocks)`.
2024-05-21 14:55:37 +10:00
Nicholas Nethercote
00cfb45b54 Remove extern crate rustc_middle from rustc_metadata. 2024-05-13 08:20:18 +10:00
Michael Goulet
1c19b6ad60 Rename Generics::params to Generics::own_params 2024-05-09 20:58:46 -04:00
Guillaume Gomez
871f047c4c
Rollup merge of #124582 - RalfJung:std-not-found, r=Nilstrieb
always print nice 'std not found' error when std is not found

Fixes https://github.com/rust-lang/miri/issues/3529

Arguably Miri is doing something odd by letting people create no-std sysroots for arbitrary targets -- but equally arguably, there's no good reason for rustc to special-case the host triple here. Being a non-host triple does not imply the target is a no-std target, after all.
2024-05-02 15:11:22 +02:00
Mark Rousskov
a64f941611 Step bootstrap cfgs 2024-05-01 22:19:11 -04:00
Ralf Jung
6115cf6f41 always print nice 'std not found error' when std is not found 2024-05-01 17:11:49 +02:00
Nicholas Nethercote
4814fd0a4b Remove extern crate rustc_macros from numerous crates. 2024-04-29 10:21:54 +10:00
Oli Scherer
aef0f4024a Error on using yield without also using #[coroutine] on the closure
And suggest adding the `#[coroutine]` to the closure
2024-04-24 08:05:29 +00:00
bors
244da22fab Auto merge of #123126 - oli-obk:feed_crate_num, r=davidtwco
Enable `CrateNum` query feeding via `TyCtxt`

Instead of having a magic function that violates some `TyCtxtFeed` invariants, add a `create_def` equivalent for `CrateNum`s.

Note that this still isn't tracked by the query system (unlike `create_def`), and that feeding most `CrateNum` queries for crates other than the local one will likely cause performance regressions.

These things should be attempted on their own separately, but this PR should stand on its own
2024-04-23 20:46:48 +00:00
Matthias Krüger
36316df9fe
Rollup merge of #124067 - RalfJung:weak-lang-items, r=davidtwco
weak lang items are not allowed to be #[track_caller]

For instance the panic handler will be called via this import
```rust
        extern "Rust" {
            #[lang = "panic_impl"]
            fn panic_impl(pi: &PanicInfo<'_>) -> !;
        }
```
A `#[track_caller]` would add an extra argument and thus make this the wrong signature.

The 2nd commit is a consistency rename; based on the docs [here](https://doc.rust-lang.org/unstable-book/language-features/lang-items.html) and [here](https://rustc-dev-guide.rust-lang.org/lang-items.html) I figured "lang item" is more widely used. (In the compiler output, "lang item" and "language item" seem to be pretty even.)
2024-04-23 12:10:25 +02:00
Markus Reiter
33e68aadc9
Stabilize generic NonZero. 2024-04-22 18:48:47 +02:00
Oli Scherer
9e63e991e9 Prepare for CrateNum query feeding on creation 2024-04-19 14:16:18 +00:00
Oli Scherer
0025c9cc50 Isolate CrateNum creation to TyCtxt methods 2024-04-19 14:16:18 +00:00
Oli Scherer
fbc9b94064 Move stable_crate_ids from CrateStore to Untracked
This way it's like `Definitions`, which creates `DefId`s by interning `DefPathData`s, but for interning stable crate hashes
2024-04-19 14:16:18 +00:00
Oli Scherer
10be74569c Create new CrateNum only after knowing it's going to succeed 2024-04-19 14:09:19 +00:00
Ralf Jung
8b35be741f consistency rename: language item -> lang item 2024-04-17 13:00:43 +02:00