Commit Graph

19780 Commits

Author SHA1 Message Date
xizheyin
4a261a1513 Use relative visibility when noting sealed trait to reduce false positive
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-07-05 04:13:52 +08:00
Kivooeo
0f7a86bb2a cleaned up some tests 2025-07-05 00:50:51 +05:00
Kivooeo
7f2e37fc5c moved & deleted tests
opeq.rs was removed as duplicating test logic in other tests
2025-07-05 00:48:10 +05:00
Kivooeo
b28806da23 cleaned up some tests 2025-07-05 00:45:24 +05:00
Kivooeo
9ad98f78d4 moved tests 2025-07-05 00:39:50 +05:00
Scott McMurray
4e615272bf Address PR feedback 2025-07-04 12:29:27 -07:00
Jonathan Brouwer
027126ce0b Port #[non_exhaustive] to the new attribute parsing infrastructure 2025-07-04 20:30:42 +02:00
Michael Goulet
d79b669b09 Fix pretty printing of placeholder types 2025-07-04 18:26:09 +00:00
Michael Goulet
42c9bfd2b9 Remove Symbol for Named LateParam/Bound variants 2025-07-04 18:14:22 +00:00
Lukas Markeffsky
71176a28e6 clean up GVN TypeId test 2025-07-04 19:14:26 +02:00
Folkert de Vries
a3277a1bbb test rust calling a C C-variadic function 2025-07-04 17:27:24 +02:00
dianqk
32115c3a17 Add a regression test for ld64 2025-07-04 23:04:56 +08:00
Matthias Krüger
18b374d5a7 Rollup merge of #143308 - compiler-errors:no-pointer-like, r=oli-obk
Remove `PointerLike` trait

r? oli-obk
2025-07-04 16:22:35 +02:00
Matthias Krüger
324aa5d4ba Rollup merge of #143286 - Muscraft:track-diagnostics-note, r=WaffleLapkin
Make -Ztrack-diagnostics emit like a note

[#t-compiler/diagnostics > Rendering -Ztrack-diagnostics like a note](https://rust-lang.zulipchat.com/#narrow/channel/147480-t-compiler.2Fdiagnostics/topic/Rendering.20-Ztrack-diagnostics.20like.20a.20note/with/526608647)

As discussed on the Zulip thread above, I want to make `-Ztrack-diagnostics` emit like a `note`. This is because I find its current output jarring, and the fact that it gets rendered completely left-aligned, [even in the middle of a snippet](86e05cd300/tests/ui/track-diagnostics/track6.stderr), seems like something that should be changed. Turning it into a `note` seems like the best choice, as it would align it with the rest of the output, and `note` is already used for somewhat similar things, like seeing why a lint was fired.

---

Note: turning `-Ztrack-diagnostics` into a `note` will also make `annotate-snippets` API a bit cleaner
2025-07-04 16:22:35 +02:00
xizheyin
2111525850 Add test false-sealed-traits-note.rs
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-07-04 20:54:45 +08:00
dianne
98659a339d treat box patterns as deref patterns in THIR and usefulness analysis
This removes special-casing of boxes from `rustc_pattern_analysis`, as a
first step in replacing `box_patterns` with `deref_patterns`.
Incidentally, it fixes a bug caused by box patterns being represented as
structs rather than pointers, where `exhaustive_patterns` could generate
spurious `unreachable_patterns` lints on arms required for
exhaustiveness; following the lint's advice would result in an error.
2025-07-04 01:28:35 -07:00
bors
1b61d43bdb Auto merge of #143237 - JonathanBrouwer:no_implicit_prelude_parser, r=jdonszelmann,oli-obk
Port `#[no_implicit_prelude]` to the new attribute parsing infrastructure

Ports no_implicit_prelude to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197

r? `@oli-obk`
cc `@jdonszelmann`
2025-07-04 07:21:46 +00:00
Scott McMurray
caeacba78a Allow all MIR Aggregates to take the operand path (if layout permits) 2025-07-03 22:53:19 -07:00
Scott McMurray
5292554337 Block SIMD in transmute_immediate; delete OperandValueKind
See conversation in <https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Is.20transmuting.20a.20.60T.60.20to.20.60Tx1.60.20.28one-element.20SIMD.20vector.29.20UB.3F/near/526262799>.
2025-07-03 22:23:15 -07:00
Josh Triplett
0403990000 mbe: Gracefully handle macro rules that end after =>
Add a test for various cases of invalid macro definitions.

Closes: https://github.com/rust-lang/rust/issues/143351
2025-07-03 20:56:05 -07:00
Jacob Pratt
01fe1c0b0e Rollup merge of #143381 - fee1-dead-contrib:push-pzxuvlnymxpu, r=GuillaumeGomez
rustdoc: don't treat methods under const impls or traits as const

Fixes rust-lang/rust#143071
2025-07-04 05:47:28 +02:00
Jacob Pratt
9de211b95a Rollup merge of #143307 - compiler-errors:fast-path-nitpicks, r=lcnr
Fast path nitpicks

Miscellaneous commits that I didn't really want to fold into anything else.

Fixes one theoretical bug with the fast path not considering polarity for `T: !Sized` bounds.
2025-07-04 05:47:24 +02:00
bors
837c5dd7de Auto merge of #142890 - kornelski:unused-var-debug, r=saethlin
MIR inliner maintains unused var_debug_info

Only `full` debuginfo level promises variable-level debug information, but the MIR inline pass needlessly preserved the local variable debug info for the `limited` level too.
2025-07-03 23:17:03 +00:00
Michael Goulet
e2e3f5809b Remove PointerLike trait 2025-07-03 20:03:49 +00:00
Jonathan Brouwer
fee5e3c3aa Port #[no_implicit_prelude] to the new attribute parsing infrastructure
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-03 20:59:40 +02:00
Guillaume Gomez
678ec9bbd4 Rollup merge of #141831 - lolbinarycat:rustdoc-extern-reexport-135092, r=GuillaumeGomez
rustdoc: fix attrs of locally reexported foreign items

fixes rust-lang/rust#135092

also tweaks a few outdated/misleading comments.

r? `@GuillaumeGomez`
2025-07-03 19:45:30 +02:00
Esteban Küber
7603adc381 Rework logic and provide structured suggestion 2025-07-03 16:14:20 +00:00
xizheyin
236b392904 Return early when self resolve failure because of let self = ...
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-07-03 23:47:19 +08:00
Deadbeef
510e5d7e66 rustdoc: don't treat methods under const impls or traits as const 2025-07-03 23:16:47 +08:00
xizheyin
000f038e99 Add ui test resolve/false-self-in-macro-issue-143134.rs
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-07-03 23:11:57 +08:00
xizheyin
25ab022f29 move tests/ui/resolve/suggest* to tests/ui/resolve/suggestions/
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-07-03 23:11:57 +08:00
Scott Schafer
6bef238b63 refactor: Make -Ztrack-diagnostics emit like a note 2025-07-03 07:19:25 -06:00
Jana Dönszelmann
f85283b0d4 Rollup merge of #143329 - folkertdev:minicore-diagnostic-on-unimplemented, r=jieyouxu
minicore: use core's `diagnostic::on_unimplemented` messages

Without these attributes, the error message is different. Keeping the diagnostics up-to-date seems related to https://github.com/rust-lang/rust/issues/137531.

The modified test files are reported in https://github.com/rust-lang/rust/issues/143319 as failing for `--target=riscv64gc-unknown-linux-gnu`. Using `minicore` for them makes it easier to troubleshoot this sort of issue.

r? ``@jieyouxu``
2025-07-03 13:29:39 +02:00
Jana Dönszelmann
622722aada Rollup merge of #143083 - JonathanBrouwer:rustdoc-fix, r=jdonszelmann
Fix rustdoc not correctly showing attributes on re-exports

Fixes attributes not being shown correctly in rustdoc on re-exports

Does this need to be backported to beta?

r? ``@jdonszelmann``
2025-07-03 13:29:37 +02:00
Jana Dönszelmann
0aaac883de Rollup merge of #143038 - Qelxiros:142676-private-dependency-traits, r=tgross35
avoid suggesting traits from private dependencies

fixes rust-lang/rust#142676
fixes rust-lang/rust#138191

r? ``@tgross35``
2025-07-03 13:29:36 +02:00
Jana Dönszelmann
5026d0cd8e Rollup merge of #142876 - JonathanBrouwer:target_feature_parser, r=oli-obk
Port `#[target_feature]` to new attribute parsing infrastructure

Ports `target_feature` to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197

r? ``@jdonszelmann``
2025-07-03 13:29:36 +02:00
Jana Dönszelmann
f6d37a25a9 Rollup merge of #134006 - klensy:typos, r=nnethercote
setup typos check in CI

This allows to check typos in CI, currently for compiler only (to reduce commit size with fixes). With current setup, exclude list is quite short, so it worth trying?

Also includes commits with actual typo fixes.

MCP: https://github.com/rust-lang/compiler-team/issues/817

typos check currently turned for:
* ./compiler
* ./library
* ./src/bootstrap
* ./src/librustdoc

After merging, PRs which enables checks for other crates (tools) can be implemented too.

Found typos will **not break** other jobs immediately: (tests, building compiler for perf run). Job will be marked as red on completion in ~ 20 secs, so you will not forget to fix it whenever you want, before merging pr.

Check typos: `python x.py test tidy --extra-checks=spellcheck`
Apply typo fixes: `python x.py test tidy --extra-checks=spellcheck:fix` (in case if there only 1 suggestion of each typo)

Current fail in this pr is expected and shows how typo errors emitted. Commit with error will be removed after r+.
2025-07-03 13:29:35 +02:00
Folkert de Vries
8512e39769 minicore: use core's diagnostic::on_unimplemented messages 2025-07-03 10:22:40 +02:00
klensy
c76d032f01 setup CI and tidy to use typos for spellchecking and fix few typos 2025-07-03 10:51:06 +03:00
Jonathan Brouwer
3d5d72b761 Port #[target_feature] to the new attribute parsing infrastructure
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-03 07:54:19 +02:00
Matthias Krüger
ddda937701 Rollup merge of #143273 - 1c3t3a:enum-check-negative, r=SparrowLii
Make the enum check work for negative discriminants

The discriminant check was not working correctly for negative numbers. This change fixes that by masking out the relevant bits correctly.

Fixes rust-lang/rust#143218.
2025-07-03 05:21:32 +02:00
Matthias Krüger
6d54983ae9 Rollup merge of #143192 - GuillaumeGomez:code-line-number, r=lolbinary
Improve CSS for source code block line numbers

Extract some changes from https://github.com/rust-lang/rust/pull/137229 to make the PR smaller (thanks `@yotamofek` for the suggestion!).

r? notriddle
2025-07-03 05:21:31 +02:00
Jeremy Smart
6b824e8143 avoid suggesting traits from private dependencies 2025-07-02 22:04:51 -04:00
bors
25face9808 Auto merge of #143338 - matthiaskrgr:rollup-ykaxh04, r=matthiaskrgr
Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#131923 (Derive `Copy` and `Hash` for `IntErrorKind`)
 - rust-lang/rust#138340 (Remove some unsized tuple impls now that we don't support unsizing tuples anymore)
 - rust-lang/rust#141219 (Change `{Box,Arc,Rc,Weak}::into_raw` to only work with `A = Global`)
 - rust-lang/rust#142212 (bootstrap: validate `rust.codegen-backends` & `target.<triple>.codegen-backends`)
 - rust-lang/rust#142237 (Detect more cases of unused_parens around types)
 - rust-lang/rust#142964 (Attribute rework: a parser for single attributes without arguments)
 - rust-lang/rust#143070 (Rewrite `macro_rules!` parser to not use the MBE engine itself)
 - rust-lang/rust#143235 (Assemble const bounds via normal item bounds in old solver too)
 - rust-lang/rust#143261 (Feed `explicit_predicates_of` instead of `predicates_of`)
 - rust-lang/rust#143276 (loop match: handle opaque patterns)
 - rust-lang/rust#143306 (Add `track_caller` attributes to trace origin of Clippy lints)

r? `@ghost`
`@rustbot` modify labels: rollup

try-job: aarch64-apple
try-job: x86_64-msvc-1
try-job: x86_64-gnu
try-job: dist-i586-gnu-i586-i686-musl
try-job: test-various
2025-07-02 23:29:03 +00:00
bors
6677875279 Auto merge of #143337 - matthiaskrgr:rollup-lqwhe0i, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#141847 (Explain `TOCTOU` on the top of `std::fs`, and reference it in functions)
 - rust-lang/rust#142138 (Add `Vec::into_chunks`)
 - rust-lang/rust#142321 (Expose elf abi on ppc64 targets)
 - rust-lang/rust#142886 (ci: aarch64-gnu: Stop skipping `panic_abort_doc_tests`)
 - rust-lang/rust#143194 (fix bitcast of single-element SIMD vectors)
 - rust-lang/rust#143231 (Suggest use another lifetime specifier instead of underscore lifetime)
 - rust-lang/rust#143232 ([COMPILETEST-UNTANGLE 3/N] Use "directives" consistently within compiletest)
 - rust-lang/rust#143258 (Don't recompute `DisambiguatorState` for every RPITIT in trait definition)
 - rust-lang/rust#143274 (ci: support optional jobs)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-07-02 20:25:23 +00:00
наб
a0111ec7a1 awhile -> a while where appropriate 2025-07-02 20:17:29 +02:00
Matthias Krüger
0617a9eb95 Rollup merge of #143276 - folkertdev:loop-match-opaque-pattern, r=Nadrieril
loop match: handle opaque patterns

tracking issue https://github.com/rust-lang/rust/issues/132306
fixes https://github.com/rust-lang/rust/issues/143203

I believe the `Opaque` comes up because the range pattern is invalid? Because we do handle float patterns already so those should be fine.

r? `@Nadrieril`
2025-07-02 19:29:38 +02:00
Matthias Krüger
2ce579da73 Rollup merge of #143235 - compiler-errors:const-item-bound, r=oli-obk
Assemble const bounds via normal item bounds in old solver too

Fixes the first example in https://rust-lang.zulipchat.com/#narrow/channel/144729-t-types/topic/elaboration.20of.20const.20bounds.3F/with/526378135

The code duplication here is not that nice, but it's at least very localized.

cc `@davidtwco`

r? oli-obk
2025-07-02 19:29:37 +02:00
Matthias Krüger
383f107867 Rollup merge of #143070 - joshtriplett:macro-rules-parse, r=petrochenkov
Rewrite `macro_rules!` parser to not use the MBE engine itself

The `macro_rules!` parser was written to match the series of rules using the macros-by-example (MBE) engine and a hand-written equivalent of the left-hand side of a MBE macro. This was complex to read, difficult to extend, and produced confusing error messages. Because it was using the MBE engine, any parse failure would be reported as if some macro was being applied to the `macro_rules!` invocation itself; for instance, errors would talk about "macro invocation", "macro arguments", and "macro call", when they were actually about the macro *definition*.

And in practice, the `macro_rules!` parser only used the MBE engine to extract the left-hand side and right-hand side of each rule as a token tree, and then parsed the rest using a separate parser.

Rewrite it to parse the series of rules using a simple loop, instead. This makes it more extensible in the future, and improves error messages. For instance, omitting a semicolon between rules will result in "expected `;`" and "unexpected token", rather than the confusing "no rules expected this token in macro call".

This work was greatly aided by pair programming with Vincenzo Palazzo (`@vincenzopalazzo)` and Eric Holk (`@eholk).`

For review, I recommend reading the two commits separately.
2025-07-02 19:29:37 +02:00
Matthias Krüger
2dbb9be326 Rollup merge of #142964 - GrigorenkoPV:attributes/argless, r=oli-obk
Attribute rework: a parser for single attributes without arguments

Part of rust-lang/rust#131229

r? `@jdonszelmann`

I think code (with comments) speaks for itself.

The only subtlety: now `#[cold]`, `#[no_mangle]`, & `#[track_caller]` do not get thrown away when malformed (i.e. have arguments). This doesn't matter too much (I think), because an error gets emitted either way, so the compilation will not finish.
2025-07-02 19:29:36 +02:00