Commit Graph

285055 Commits

Author SHA1 Message Date
Michael Goulet
b88f85a410 Stop relying on rustc_type_ir in non-type-system crates 2025-03-15 06:42:48 +00:00
Michael Goulet
19c84c8812 Move codec module back into middle 2025-03-15 06:42:48 +00:00
Michael Goulet
f96eb611f8 Fold visit into ty 2025-03-15 06:34:36 +00:00
Michael Goulet
6438b9eca8 Use {Decodable,Encodable}_NoContext in type_ir 2025-03-15 06:34:36 +00:00
Michael Goulet
e5a2220327 Fold visit into ty 2025-03-15 06:34:36 +00:00
Michael Goulet
dc0cdfd753 Squash fold into ty 2025-03-15 06:34:36 +00:00
bors
adea7cbc09 Auto merge of #138379 - estebank:macro-backtrace-note, r=petrochenkov
Do not suggest using `-Zmacro-backtrace` for builtin macros

For macros that are implemented on the compiler, or that are annotated with `rustc_diagnostic_item`, which have arbitrary implementations from the point of view of the user and might as well be intrinsics, we do *not* mention the `-Zmacro-backtrace` flag. This includes `derive`s and standard macros like `panic!` and `format!`.

This PR adds a field to every `Span`'s `ExpnData` stating whether it comes from a builtin macro. This is determined by the macro being annotated with either `#[rustc_builtin_macro]` or `#[rustc_diagnostic_item]`. An alternative to using these attributes that already exist for other uses would be to introduce another attribute like `#[rustc_no_backtrace]` to have finer control on which macros are affected (for example, an error within `vec![]` now doesn't mention the backtrace, but one could make the case that it should). Ideally, instead of carrying this information in the `ExpnData` we'd instead try to query the `DefId` of the macro (that is already stored) to see if it is annotated in some way, but we do not have access to the `TyCtxt` from `rustc_errors`.

r? `@petrochenkov`
2025-03-15 05:29:22 +00:00
bors
282865097d Auto merge of #138523 - fmease:rollup-j2j5h59, r=fmease
Rollup of 9 pull requests

Successful merges:

 - #138056 (rustc_target: Add target features for LoongArch v1.1)
 - #138451 (Build GCC on CI with GCC, not Clang)
 - #138454 (Improve post-merge workflow)
 - #138460 (Pass struct field HirId when check_expr_struct_fields)
 - #138474 (Refactor is_snake_case.)
 - #138482 (Fix HIR printing of parameters)
 - #138507 (Mirror NetBSD sources)
 - #138511 (Make `Parser::parse_expr_cond` public)
 - #138518 (Fix typo in hir lowering lint diag)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-03-15 02:22:46 +00:00
John Kåre Alsaker
b43a29711e Fix record_diagnostic 2025-03-15 03:09:09 +01:00
Alex Macleod
5c031d1f6a Fix from_over_into lint suggesting invalid code (#14409)
fixes [#112502](https://github.com/rust-lang/rust/issues/112502)

changelog: [`from_over_into`]: fix invalid code suggestion when self
parameter has type annotation
2025-03-15 01:31:30 +00:00
许杰友 Jieyou Xu (Joe)
ecce387ef6 Mark myself as unavailable for reviews 2025-03-15 09:26:21 +08:00
KonaeAkira
9c897a20ae Simplify implementation 2025-03-15 00:37:44 +01:00
León Orell Valerian Liehr
9838591694 Rollup merge of #138518 - yotamofek:pr/hir-lint-typo, r=compiler-errors
Fix typo in hir lowering lint diag
2025-03-15 00:18:27 +01:00
León Orell Valerian Liehr
79775921aa Rollup merge of #138511 - mohe2015:rustc-parse-pub-parse-expr-cond, r=oli-obk
Make `Parser::parse_expr_cond` public

This allows usage in rustfmt and rustfmt forks.

I'm using this for custom macro formatting, see 30c83df9e1/src/parse/macros/html.rs (L57)

It would be great if this could be upstreamed so I don't need to rely on a fork.
2025-03-15 00:18:26 +01:00
León Orell Valerian Liehr
9b8a6771bc Rollup merge of #138507 - Kobzol:netbsd-mirror, r=Mark-Simulacrum
Mirror NetBSD sources

Should avoid issues with NetBSD servers.

r? ``@Mark-Simulacrum``

try-job: `*netbsd*`
2025-03-15 00:18:26 +01:00
León Orell Valerian Liehr
370f8fb99d Rollup merge of #138482 - nnethercote:fix-hir-printing, r=compiler-errors
Fix HIR printing of parameters

HIR pretty printing does the wrong thing for anonymous parameters, and there is no test coverage for it. This PR remedies both of those things.

r? ``@lcnr``
2025-03-15 00:18:25 +01:00
León Orell Valerian Liehr
03cda6b022 Rollup merge of #138474 - remexre:refactor-is-snake-case, r=compiler-errors
Refactor is_snake_case.

I wondered what the definition of this actually was, and found the original hard to read. I believe this change preserves the original behavior, but is hopefully clearer.
2025-03-15 00:18:25 +01:00
León Orell Valerian Liehr
43c41a801a Rollup merge of #138460 - xizheyin:issue-138319, r=petrochenkov
Pass struct field HirId when check_expr_struct_fields

Fixes #138319

r? compiler

cc ``@Mark-Simulacrum``
2025-03-15 00:18:24 +01:00
León Orell Valerian Liehr
756b17975f Rollup merge of #138454 - Kobzol:post-merge-workflow-fixes, r=jieyouxu
Improve post-merge workflow

Contains various fixes for the post-merge workflow implemented in https://github.com/rust-lang/rust/pull/138013, which were suggested on Zulip. This PR changes the grouping of test diffs and ignores doctests, as they are too noisy.

I'll post an example output (before/after this PR) in comments below.

r? ```@jieyouxu```
2025-03-15 00:18:23 +01:00
León Orell Valerian Liehr
fc7ac81979 Rollup merge of #138451 - Kobzol:gcc-ci-build-gcc, r=GuillaumeGomez
Build GCC on CI with GCC, not Clang

It seems that GCC built with Clang misbehaves. I have tested that cg_gcc tests [pass](https://github.com/rust-lang/rust/actions/runs/13842365913/job/38732750617?pr=138451) on CI with a downloaded GCC that was built in this way.

Prerequisite for https://github.com/rust-lang/rust/pull/138395.

r? ```@ghost```
2025-03-15 00:18:23 +01:00
León Orell Valerian Liehr
10055fb03a Rollup merge of #138056 - heiher:loong64v1.1-features, r=petrochenkov
rustc_target: Add target features for LoongArch v1.1

This patch adds new target features for LoongArch v1.1:

* div32
* lam-bh
* lamcas
* ld-seq-sa
* scq
2025-03-15 00:18:22 +01:00
bors
d9e5539a39 Auto merge of #138519 - weihanglo:update-cargo, r=weihanglo
Update cargo

15 commits in ab1463d632528e39daf35f263e10c14cbe590ce8..6cf8267012570f63d6b86e85a2ae5627de52df9e
2025-03-08 01:45:05 +0000 to 2025-03-14 15:25:36 +0000
- feat(package): add --exclude-lockfile flag (rust-lang/cargo#15234)
- Redox OS is part of the unix family (rust-lang/cargo#15307)
- docs(ref): Mention `x.y.*` as a kind of version requirement to avoid. (rust-lang/cargo#15310)
- fix(run): Disambiguate bins from different packages that share a name (rust-lang/cargo#15298)
- cargo vendor: Add context which workspace failed to resolve (rust-lang/cargo#15297)
- docs(ref): Note that target-edition is deprecated (rust-lang/cargo#15292)
- refactor(toml): Centralize target descriptions (rust-lang/cargo#15291)
- docs(refs): Add `unsafe` to `extern` while using build scripts in Cargo Book (rust-lang/cargo#15294)
- Replace unmaintained humantime crate with jiff (rust-lang/cargo#15290)
- Add terminal integration via ANSI OSC 9;4 sequences (rust-lang/cargo#14615)
- feat: add completions for add --path (rust-lang/cargo#15288)
- Allow `term.progress.when` to default (rust-lang/cargo#15287)
- docs: spelling and grammar fixes (rust-lang/cargo#15284)
- chore(deps): update cargo-semver-checks to v0.40.0 (rust-lang/cargo#15282)
- Typo fixes (rust-lang/cargo#15280)

r? ghost
2025-03-14 23:15:28 +00:00
KonaeAkira
4a324c9dff Fix from_over_into lint suggesting invalid code 2025-03-15 00:05:32 +01:00
KonaeAkira
da910b14e2 Add failing from_over_into test case 2025-03-15 00:00:01 +01:00
Michael Goulet
ae4a4794e7 Improve upvar analysis for deref of child capture 2025-03-14 22:35:06 +00:00
Yotam Ofek
e6f7ab50c0 Small grammar fix in comment 2025-03-14 21:03:21 +00:00
Yotam Ofek
5da1ba41b3 Fix typo in hir lowering lint diag 2025-03-14 21:03:21 +00:00
Weihang Lo
58e083021e Update cargo 2025-03-14 16:44:43 -04:00
Esteban Küber
915e44216a Do not suggest using -Zmacro-backtrace for builtin macros
For macros that are implemented on the compiler, we do *not* mention the `-Zmacro-backtrace` flag. This includes `derive`s and standard macros.
2025-03-14 19:50:03 +00:00
Esteban Küber
f0b8e13b59 Do not suggest using -Zmacro-backtrace for builtin macros
For macros that are implemented on the compiler, we do *not* mention the `-Zmacro-backtrace` flag. This includes `derive`s and standard macros.
2025-03-14 19:50:03 +00:00
binarycat
409510c088 rustdoc js: add nonnull helper and typecheck src-script.js 2025-03-14 14:39:15 -05:00
Michael Goulet
e54bde6d47 Remove fake borrows of refs that are converted into non-refs in MakeByMoveBody 2025-03-14 19:38:29 +00:00
Eric Holk
c5093ac122 Fix clippy 2025-03-14 12:21:59 -07:00
Eric Holk
635eae2d4f Teach rustfmt to handle postfix yield 2025-03-14 12:21:59 -07:00
Eric Holk
1c0916a2b3 Preserve yield position during pretty printing 2025-03-14 12:21:59 -07:00
Eric Holk
edf65e735c Add support for postfix yield expressions
We had a discussion[1] today about whether postfix yield would make sense.
It's easy enough to support both in the parser, so we might as well have
both and see how people use it while the feature is experimental.

[1]: https://rust-lang.zulipchat.com/#narrow/channel/481571-t-lang.2Fgen/topic/postfix-yield/with/505231568
2025-03-14 12:21:58 -07:00
Moritz Hedtke
66c49c73ee Make Parser::parse_expr_cond public.
This allows usage in rustfmt and rustfmt forks.
2025-03-14 19:55:55 +01:00
Marijn Schouten
50c659fcba Clarify "owned data" in E0515.md
This clarifies the explanation of why this is not allowed and also what to do instead.

Fixes 62071

PS There was suggestion of adding a link to the book. I did not yet do that, but if desired that could be added.
2025-03-14 19:28:59 +01:00
John Kåre Alsaker
9a847b1ea5 Add comments 2025-03-14 18:55:02 +01:00
John Kåre Alsaker
453b51a65a Rename QuerySideEffects to QuerySideEffect 2025-03-14 18:39:27 +01:00
bors
ecade534c6 Auto merge of #138506 - fmease:rollup-ve4h2eq, r=fmease
Rollup of 9 pull requests

Successful merges:

 - #134720 (Display valid crate types in error message for --crate-type flag)
 - #137619 (Provide helpful diagnostics for shebang lookalikes)
 - #138353 (remove must_use from <*const T>::expose_provenance)
 - #138452 (Remove `RUN_CHECK_WITH_PARALLEL_QUERIES`)
 - #138469 (remove comment regarding a removed test directive)
 - #138477 (Deny impls for `BikeshedGuaranteedNoDrop`)
 - #138485 (Rustc dev guide subtree update)
 - #138487 (Pass `CI_JOB_DOC_URL` to Docker)
 - #138495 (Take a break from reviews)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-03-14 17:00:17 +00:00
Jakub Beránek
9e3805d6d3 Mirror NetBSD sources 2025-03-14 17:44:07 +01:00
León Orell Valerian Liehr
401b325fb7 Rollup merge of #138495 - ChrisDenton:vacate, r=ChrisDenton
Take a break from reviews
2025-03-14 17:26:41 +01:00
León Orell Valerian Liehr
c5e3857492 Rollup merge of #138487 - Kobzol:fix-doc-url-docker, r=marcoieni
Pass `CI_JOB_DOC_URL` to Docker

Fix-up for https://github.com/rust-lang/rust/pull/136911. I always forget to pass new environment variables to Docker images.. 🤦‍♂️

r? `@marcoieni`

try-job: x86_64-fuchsia
2025-03-14 17:26:39 +01:00
León Orell Valerian Liehr
8eeecb78ca Rollup merge of #138485 - BoxyUwU:rdg-push, r=jieyouxu
Rustc dev guide subtree update

r? `@jieyouxu`
2025-03-14 17:26:37 +01:00
León Orell Valerian Liehr
c42866f89d Rollup merge of #138477 - compiler-errors:deny-bikeshed-guaranteed-no-drop, r=lcnr
Deny impls for `BikeshedGuaranteedNoDrop`

r? lcnr
2025-03-14 17:26:36 +01:00
León Orell Valerian Liehr
1e7441f145 Rollup merge of #138469 - tshepang:patch-6, r=onur-ozkan
remove comment regarding a removed test directive

Removed in https://github.com/rust-lang/rust/pull/120265
2025-03-14 17:26:32 +01:00
León Orell Valerian Liehr
40ac358b81 Rollup merge of #138452 - Kobzol:remove-run-check-with-parallel-queries, r=Mark-Simulacrum,onur-ozkan
Remove `RUN_CHECK_WITH_PARALLEL_QUERIES`

After https://github.com/rust-lang/rust/pull/132282, I'm pretty sure that this is simply useless? It just runs check with an empty config, lol.

CC `@onur-ozkan`

r? `@Noratrieb`
2025-03-14 17:26:23 +01:00
León Orell Valerian Liehr
ffa96fe451 Rollup merge of #138353 - RalfJung:expose-provenance-must-use, r=ibraheemdev
remove must_use from <*const T>::expose_provenance

`<*mut T>::expose_provenance` does not have this attribute, and in fact the function is documented to have a side-effect, so there are perfectly legitimate use-cases where the return value would be ignored.
2025-03-14 17:26:20 +01:00
León Orell Valerian Liehr
881d237cd9 Rollup merge of #137619 - Pyr0de:issue_137249, r=fmease
Provide helpful diagnostics for shebang lookalikes

When `[` is not found after a `#!`, a note will be added to the exisiting error

```
error: expected `[`, found `/`
 --> src/main.rs:2:3
  |
2 | #!/usr/bin/env -S cargo +nightly -Zscript
  |   ^ expected `[`
  |
  = note: the token sequence `#!` here looks like the start of a shebang interpreter directive but it is not
  = help: if you meant this to be a shebang interpreter directive, move it to the very start of the file
```

Fixes #137249

r? `@fmease`
2025-03-14 17:26:17 +01:00