Commit graph

273336 commits

Author SHA1 Message Date
Jacob Pratt
e7407b3029
Rollup merge of #134354 - oli-obk:push-nlrxswvpqnuk, r=compiler-errors
Handle fndef rendering together with signature rendering

Pulled out of https://github.com/rust-lang/rust/pull/134353

Changes some highlighting in type mismatch errors around fndefs
2024-12-17 05:36:56 -05:00
Jacob Pratt
52b4557639
Rollup merge of #134202 - nnethercote:rm-existing_doc_keyword, r=GuillaumeGomez
Remove `rustc::existing_doc_keyword` lint

The check doesn't require a lint.

r? ``@GuillaumeGomez``
2024-12-17 05:36:52 -05:00
bors
978c659b72 Auto merge of #134302 - bjorn3:remove_driver_queries, r=oli-obk,jieyouxu
Remove queries from the driver interface

All uses of driver queries in the public api of rustc_driver have been removed in https://github.com/rust-lang/rust/pull/134130 already. This removes driver queries from rustc_interface and does a couple of cleanups around TyCtxt construction and entering enabled by this removal.

Finishes the removal of driver queries started with https://github.com/rust-lang/rust/pull/126834.
2024-12-17 04:57:40 +00:00
Nicholas Nethercote
121e87bf14 Remove rustc::existing_doc_keyword lint.
`CheckAttrVisitor::check_doc_keyword` checks `#[doc(keyword = "..")]`
attributes to ensure they are on an empty module, and that the value is
a non-empty identifier.

The `rustc::existing_doc_keyword` lint checks these attributes to ensure
that the value is the name of a keyword.

It's silly to have two different checking mechanisms for these
attributes. This commit does the following.
- Changes `check_doc_keyword` to check that the value is the name of a
  keyword (avoiding the need for the identifier check, which removes a
  dependency on `rustc_lexer`).
- Removes the lint.
- Updates tests accordingly.

There is one hack: the `SelfTy` FIXME case used to used to be handled by
disabling the lint, but now is handled with a special case in
`is_doc_keyword`. That hack will go away if/when the FIXME is fixed.

Co-Authored-By: Guillaume Gomez <guillaume1.gomez@gmail.com>
2024-12-17 13:56:10 +11:00
Nicholas Nethercote
f10169c4ec Move doc(keyword = "while").
All the other unconditional keywords are in the alphabetical order, but
`while` is for some reason not.
2024-12-17 13:40:08 +11:00
bors
52f4785f80 Auto merge of #134132 - MarcoIeni:linux-4c-to-ubuntu-22, r=Kobzol
CI: update linux 4c from ubuntu 20 to ubuntu 22
2024-12-17 01:49:31 +00:00
bors
13b77c687c Auto merge of #134095 - Kobzol:datadog-lockfile, r=MarcoIeni
[CI] Use a lockfile for installing the `datadog` package

Without a lockfile, it could fail to compile when the dependencies have changed. Reported [here](https://rust-lang.zulipchat.com/#narrow/channel/242791-t-infra/topic/CI.20failure.20in.20DataDog.20upload).

r? `@jdno`

try-job: x86_64-msvc-ext2
2024-12-16 23:07:24 +00:00
bors
6d9f6ae36a Auto merge of #134395 - matthiaskrgr:rollup-4j2gx1x, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #134124 (CI: use free runners for x86_64-gnu-llvm jobs)
 - #134197 (rustc_mir_build: Clarify that 'mirrored' does not mean 'flipped' or 'reversed')
 - #134260 (Correctly handle comments in attributes in doctests source code)
 - #134277 (rustdoc-search: handle `impl Into<X>` better)
 - #134284 (Keep track of patterns that could have introduced a binding, but didn't)
 - #134337 (reject unsound toggling of RISCV target features)
 - #134371 (Check for array lengths that aren't actually `usize`)
 - #134385 (tests/ui/asm: Remove uses of rustc_attrs, lang_items, and decl_macro features by using minicore)
 - #134386 (Some trait method vs impl method signature difference diagnostic cleanups)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-12-16 20:09:47 +00:00
Matthias Krüger
9a0dab2b5b
Rollup merge of #134386 - oli-obk:some-trait-impl-diff-diagnostic-cleanups, r=compiler-errors
Some trait method vs impl method signature difference diagnostic cleanups

Just some things I noticed while debugging a weird diagnostic in https://github.com/rust-lang/rust/pull/134353

best reviewed commit by commit
2024-12-16 20:00:29 +01:00
Matthias Krüger
528275e939
Rollup merge of #134385 - taiki-e:ui-asm-minicore, r=compiler-errors
tests/ui/asm: Remove uses of rustc_attrs, lang_items, and decl_macro features by using minicore

Follow-up to https://github.com/rust-lang/rust/pull/132516#issuecomment-2452986287.
This PR do similar things for remaining tests in tests/ui/asm.

r? jieyouxu
2024-12-16 20:00:27 +01:00
Matthias Krüger
7c301ecdf5
Rollup merge of #134371 - scottmcm:fix-134352, r=oli-obk
Check for array lengths that aren't actually `usize`

I wish typeck wouldn't give us `ty::Array`s that have this problem in the first place, but we can check for it.

Fixes #134352
cc ``@matthiaskrgr``
2024-12-16 20:00:26 +01:00
Matthias Krüger
dffaad8332
Rollup merge of #134337 - RalfJung:riscv-target-features, r=workingjubilee
reject unsound toggling of RISCV target features

~~Stacked on top of https://github.com/rust-lang/rust/pull/133417, only the last commit is new.~~

Works towards https://github.com/rust-lang/rust/issues/132618 (but more [remains to be done](https://github.com/rust-lang/rust/pull/134337#issuecomment-2544228958))
Part of https://github.com/rust-lang/rust/issues/116344

Cc ``@beetrees`` I hope I got everything.  I didn't do anything about "The f and zfinx features are incompatible" and that's not an ABI thing (right?) and I am not sure how to handle it with these ABI checks.
r? ``@workingjubilee``

Ideally we'd also reject target specs that disable the `f` feature but set an ABI that requires `f`... but I don't want to duplicate this logic. I have some ideas for how maybe the entire float ABI check logic should be different, now that we have some examples of what these ABI checks look like, but that will be a future PR.
2024-12-16 20:00:24 +01:00
Matthias Krüger
86db97e2b3
Rollup merge of #134284 - estebank:issue-74863, r=lcnr
Keep track of patterns that could have introduced a binding, but didn't

When we recover from a pattern parse error, or a pattern uses `..`, we keep track of that and affect resolution error for missing bindings that could have been provided by that pattern. We differentiate between `..` and parse recovery. We silence resolution errors likely caused by the pattern parse error.

```
error[E0425]: cannot find value `title` in this scope
  --> $DIR/struct-pattern-with-missing-fields-resolve-error.rs:18:30
   |
LL |     if let Website { url, .. } = website {
   |            ------------------- this pattern doesn't include `title`, which is available in `Website`
LL |         println!("[{}]({})", title, url);
   |                              ^^^^^ not found in this scope
```

Fix #74863.
2024-12-16 20:00:22 +01:00
Matthias Krüger
d9ba4bf6fe
Rollup merge of #134277 - notriddle:notriddle/inline-into, r=GuillaumeGomez
rustdoc-search: handle `impl Into<X>` better

This PR fixes two bugs I ran into while searching the compiler docs:

- It omitted an `impl Trait` entry in the type signature field, producing `TyCtxt, , Symbol -> bool`
- It didn't let me search for `TyCtxt, DefId, Symbol -> bool` even though that's a perfectly good description of the function I was looking for (the function actually used `impl Into<DefId>`

r? ``@GuillaumeGomez`` cc ``@lolbinarycat``
2024-12-16 20:00:20 +01:00
Matthias Krüger
9451a6132a
Rollup merge of #134260 - GuillaumeGomez:doctest-attrs, r=notriddle
Correctly handle comments in attributes in doctests source code

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

The problem was that attributes are "inlined" (backlines are stripped), then when there is an inline comment inside it, the attribute is never considered valid (since unclosed). Fix was to simply put back backlines in case it's a multiline attribute.

r? ``@notriddle``
2024-12-16 20:00:17 +01:00
Matthias Krüger
d03e3c8612
Rollup merge of #134197 - Enselic:mirror, r=lcnr
rustc_mir_build: Clarify that 'mirrored' does not mean 'flipped' or 'reversed'

My intuition for 'mirrored' is that it means 'flipped' or 'reversed'. Clarify that that is not what is meant to 'mirror' the THIR from the HIR.
2024-12-16 20:00:13 +01:00
Matthias Krüger
0ff00b6adb
Rollup merge of #134124 - MarcoIeni:split-llvm-jobs, r=Kobzol
CI: use free runners for x86_64-gnu-llvm jobs

try-job: x86_64-gnu-llvm-19-1
try-job: x86_64-gnu-llvm-19-2
try-job: x86_64-gnu-llvm-19-3
try-job: x86_64-gnu-llvm-18-1
try-job: x86_64-gnu-llvm-18-2
try-job: x86_64-gnu-llvm-18-3
2024-12-16 20:00:09 +01:00
Guillaume Gomez
c367cc3ef5 Remove unneeded handling of backlines in doctest attributes 2024-12-16 17:59:07 +01:00
Taiki Endo
86e0eabc8d tests/ui/asm: Remove uses of rustc_attrs, lang_items, and decl_macro features by using minicore 2024-12-17 01:12:36 +09:00
Oli Scherer
1d834c2257 Avoid wrapping fn sig in a fn pointer when we want to just print the sig 2024-12-16 16:02:05 +00:00
Oli Scherer
1c7d54eb7b Deduplicate some pretty printing logic 2024-12-16 16:02:05 +00:00
Oli Scherer
4032b9ddbd Avoid wrapping a trivially defaultable type in Option 2024-12-16 16:02:05 +00:00
Oli Scherer
f387b9d909 Properly name a def id variable 2024-12-16 16:02:05 +00:00
Oli Scherer
bdb88c9d4a Avoid creating a fn sig type just to unwrap it again to get at its signature 2024-12-16 16:02:05 +00:00
bors
83ab648e00 Auto merge of #134377 - lnicola:sync-from-ra, r=lnicola
Subtree update of `rust-analyzer`

r? `@ghost`
2024-12-16 13:07:24 +00:00
Guillaume Gomez
2383985342 Also handle cases where attributes are unclosed 2024-12-16 13:59:41 +01:00
Jakub Beránek
6e22b84296
[CI] Use a lockfile for installing the datadog package
Without a lockfile, it could fail to compile when the dependencies have changed.
2024-12-16 12:35:09 +01:00
Guillaume Gomez
9c4a61ff52 Add ui regression test for #134221 2024-12-16 11:47:56 +01:00
Oli Scherer
e40a494f5c Handle fndef rendering together with signature rendering 2024-12-16 10:15:57 +00:00
bors
eedc229049 Auto merge of #134374 - matthiaskrgr:rollup-2tbbrxq, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #134314 (Make sure to use normalized ty for unevaluated const in default struct value)
 - #134342 (crashes: more tests)
 - #134357 (Fix `trimmed_def_paths` ICE in the function ptr comparison lint)
 - #134369 (Update spelling of "referring")
 - #134372 (Disable `tests/ui/associated-consts/issue-93775.rs` on windows msvc)

Failed merges:

 - #134365 (Rename `rustc_mir_build::build` to `builder`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-12-16 08:26:32 +00:00
Matthias Krüger
0a779720f4
Rollup merge of #134372 - jieyouxu:disable-flaky-test, r=Noratrieb
Disable `tests/ui/associated-consts/issue-93775.rs` on windows msvc

This test seems to be quite flaky. See:

- https://github.com/rust-lang/rust/issues/132111
- https://github.com/rust-lang/rust/issues/133432
2024-12-16 08:03:35 +01:00
Matthias Krüger
0bc3f48c11
Rollup merge of #134369 - antonok-edm:refering-referring, r=jieyouxu
Update spelling of "referring"

I noticed that `referring` was spelled incorrectly in the output of `unexpected 'cfg' condition name` warnings; it looks like it was also incorrectly spelled in a doc comment. I've update both instances.
2024-12-16 08:03:34 +01:00
Matthias Krüger
551de164e6
Rollup merge of #134357 - Urgau:fn-ptr-134345, r=compiler-errors
Fix `trimmed_def_paths` ICE in the function ptr comparison lint

This PR fixes an ICE with `trimmed_def_paths` ICE in the function ptr comparison lint, specifically when pretty-printing user types but then not using the resulting pretty-printing.

Fixes #134345
r? `@saethlin`
2024-12-16 08:03:33 +01:00
Matthias Krüger
248823836b
Rollup merge of #134342 - matthiaskrgr:tests1512, r=compiler-errors
crashes: more tests

try-job: aarch64-apple
try-job: x86_64-msvc
try-job: x86_64-gnu
2024-12-16 08:03:33 +01:00
Matthias Krüger
050e0cc6eb
Rollup merge of #134314 - compiler-errors:default-struct-value-const, r=estebank
Make sure to use normalized ty for unevaluated const in default struct value

This cleans up the way that we construct the `mir::Const::Unevaluated` for default struct values. We were previously using `from_unevaluated`, which doesn't normalize the type, and is really only used for inline assembly. Other codepaths (such as `ExprKind::NamedConst`) use the type from the body.

Also, let's stop using `literal_operand`, which also is really not meant for calls other than for literal comparisons in pattern lowering.

Also move all of the tests to a separate subdirectory so they don't need to have the same prefix on all the test files.

Fixes #134298
r? estebank or reassign
2024-12-16 08:03:32 +01:00
Ralf Jung
934ed85e79 tweak comments 2024-12-16 07:56:03 +01:00
许杰友 Jieyou Xu (Joe)
1cde4a4045 Disable tests\ui\associated-consts\issue-93775.rs on windows msvc
This test seems to be quite flaky. See:

- https://github.com/rust-lang/rust/issues/132111
- https://github.com/rust-lang/rust/issues/133432
2024-12-16 14:27:36 +08:00
Scott McMurray
43a79a0f4b Check for array lengths that aren't actually usize 2024-12-15 22:18:09 -08:00
Anton Lazarev
e9df8216d5
spell "referring" correctly 2024-12-15 19:36:35 -08:00
Esteban Küber
733fd03f0f Use span_label as it looks better when we show pattern missing binding in order 2024-12-15 22:58:16 +00:00
Esteban Küber
8c8e8d35bc Use ErrorGuaranteed more 2024-12-15 22:48:05 +00:00
Urgau
3f105be05c Fix trimmed_def_paths ICE in the function ptr comparison lint 2024-12-15 23:46:42 +01:00
bors
f2b91ccbc2 Auto merge of #131808 - jdonszelmann:hir-attributes, r=oli-obk,petrochenkov
Hir attributes

This PR needs some explanation, it's somewhat large.

- This is step one as described in https://github.com/rust-lang/compiler-team/issues/796. I've added a new `hir::Attribute` which is a lowered version of `ast::Attribute`. Right now, this has few concrete effects, however every place that after this PR parses a `hir::Attribute` should later get a pre-parsed attribute as described in https://github.com/rust-lang/compiler-team/issues/796 and transitively https://github.com/rust-lang/rust/issues/131229.
- an extension trait `AttributeExt` is added, which is implemented for both `ast::Attribute` and `hir::Atribute`. This makes `hir::Attributes` mostly compatible with code that used to parse `ast::Attribute`. All its methods are also added as inherent methods to avoid having to import the trait everywhere in the compiler.
  - Incremental can not not hash `ast::Attribute` at all.
2024-12-15 22:05:33 +00:00
Ralf Jung
171223e01b reject unsound toggling of RISCV target features 2024-12-15 20:33:34 +01:00
bors
c26db435bf Auto merge of #134349 - jieyouxu:rollup-zqn0jox, r=jieyouxu
Rollup of 4 pull requests

Successful merges:

 - #134111 (Fix `--nocapture` for run-make tests)
 - #134329 (Add m68k_target_feature)
 - #134331 (bootstrap: make ./x test error-index work)
 - #134339 (Pass `TyCtxt` to early diagostics decoration)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-12-15 19:14:24 +00:00
Laurențiu Nicola
5c6bae0fc0
Merge pull request #18693 from Veykril/push-wzoomkkmuolm
fix: Fix proc-macro dylib names on windows
2024-12-15 18:32:38 +00:00
Jonathan Dönszelmann
1d5ec2cd6a
Remove some leftover dead code 2024-12-15 19:18:46 +01:00
Jonathan Dönszelmann
d50c0a5480
Add hir::Attribute 2024-12-15 19:18:46 +01:00
许杰友 Jieyou Xu (Joe)
56545cae69
Rollup merge of #134339 - Urgau:tcx-in-early-diag, r=jieyouxu
Pass `TyCtxt` to early diagostics decoration

This PR pass a `TyCtxt` to the early diagnostics decoration code so that diagnostics code that take advantage of (a very limited but still useful) `TyCtxt` in their note, help, suggestions, ...

This is particulary useful for #133221 which wants to get the crate name of a `DefId`, which is possible with `tcx.crate_name(...)`.

I highly recommend reviewing this PR commit by commit.

r? `@jieyouxu`
2024-12-16 01:52:23 +08:00
许杰友 Jieyou Xu (Joe)
b5602cff44
Rollup merge of #134331 - RalfJung:bootstrap-error-index, r=onur-ozkan
bootstrap: make ./x test error-index work

This makes it more likely that someone who sees an error index CI failure will be able to figure out how to reproduce that locally. Note that bootstrap already prints "Testing stage2 error-index", which is misleading since the test is actually called error_index_generator.
2024-12-16 01:52:23 +08:00