Commit graph

15067 commits

Author SHA1 Message Date
Michael Goulet
4977640c79 Fix const conditions for RPITITs 2024-12-18 03:02:46 +00:00
Matthias Krüger
4b905c8a5d
Rollup merge of #134423 - jieyouxu:bootstrap-test-valid, r=onur-ozkan
bootstrap: use specific-purpose ui test path for `test_valid` self-test

I wanted to move some ui tests around in #134418, which broke `test_valid` since it was referencing two non-specific-purpose ui tests. This PR instead adds two dummy tests under `tests/ui/bootstrap/self-test/`, for that purpose specifically.

r? bootstrap
2024-12-17 22:34:44 +01:00
Matthias Krüger
53635e5547
Rollup merge of #134408 - rmehri01:rpit-inherits-lifetime, r=compiler-errors
Regression test for RPIT inheriting lifetime from projection

Regression test to close https://github.com/rust-lang/rust/issues/51525
2024-12-17 22:34:43 +01:00
Matthias Krüger
e696f5c180
Rollup merge of #134323 - Zalathar:dismantle-map-data, r=jieyouxu
coverage: Dismantle `map_data.rs` by moving its responsibilities elsewhere

This is a series of incremental changes that combine to let us get rid of `coverageinfo/map_data.rs`, by moving all of its responsibilities into more appropriate places.

Some of the notable consequences are:

- We once again build the per-CGU file table on the fly while preparing individual covfun records, instead of building the whole table up-front. The up-front approach was introduced by #117042 to work around various other problems in generating the covmap/covfun records, but subsequent cleanups have made that approach no longer necessary.
- Expression conversion and mapping-region conversion are now performed directly in `mapgen::covfun`, which should make future changes easier.
- We no longer insert unused function instances into the same map that is also used to track used function instances. This helps to decouple the handling of used vs unused functions.

---

There should be no meaningful change to compiler output. The file table is no longer sorted, because reordering it would invalidate the file indices stored in individual covfun records, but the table order should still be deterministic (albeit arbitrary).

There are some subsequent cleanups that I intend to investigate, but this is enough change for one PR.
2024-12-17 22:34:42 +01:00
bors
1d35638dc3 Auto merge of #130766 - clarfonthey:stable-coverage-attribute, r=wesleywiser
Stabilize #[coverage] attribute

Closes #84605, which passed FCP.

Stabilisation report here: https://github.com/rust-lang/rust/issues/84605#issuecomment-2166514660

Also added to reference here: rust-lang/reference#1628

---

try-job: aarch64-apple
try-job: x86_64-gnu
try-job: x86_64-msvc
2024-12-17 15:56:58 +00:00
许杰友 Jieyou Xu (Joe)
13e8313f15 bootstrap: use specific-purpose ui test path
I wanted to move some ui tests around, which broke `test_valid` since it
was referencing a non-specific-purpose ui test.
2024-12-17 21:01:45 +08:00
bors
f23a80a4c2 Auto merge of #134414 - jhpratt:rollup-4gtfd1h, r=jhpratt
Rollup of 10 pull requests

Successful merges:

 - #134202 (Remove `rustc::existing_doc_keyword` lint)
 - #134354 (Handle fndef rendering together with signature rendering)
 - #134365 (Rename `rustc_mir_build::build` to `builder`)
 - #134368 (Use links to edition guide for edition migrations)
 - #134397 (rustc_borrowck: Suggest changing `&raw const` to `&raw mut` if applicable)
 - #134398 (AIX: add alignment info for test)
 - #134400 (Fix some comments related to upvars handling)
 - #134406 (Fix `-Z input-stats` ordering)
 - #134409 (bootstrap: fix a comment)
 - #134412 (small borrowck cleanup)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-12-17 12:07:32 +00:00
Jacob Pratt
3d0e5e024a
Rollup merge of #134406 - nnethercote:fix-input-stats-ordering, r=jieyouxu
Fix `-Z input-stats` ordering

It currently depends on the hash algorithm.

r? `@Noratrieb`
2024-12-17 05:37:23 -05:00
Jacob Pratt
3e93f2b5d9
Rollup merge of #134398 - mustartt:aix-alignment-test-fix, r=compiler-errors
AIX: add alignment info for test

Supply alignment and size info for test cases for AIX.
2024-12-17 05:37:15 -05:00
Jacob Pratt
40ce4e0ccf
Rollup merge of #134397 - Enselic:raw-mut, r=compiler-errors
rustc_borrowck: Suggest changing `&raw const` to `&raw mut` if applicable

Closes #127562

For reference, here is the diff compared to the original error reported in that issue before #134244 stopped suggesting the invalid syntax:

```
diff --git a/tests/ui/borrowck/no-invalid-mut-suggestion-for-raw-pointer-issue-127562.stderr b/tests/ui/borrowck/no-invalid-mut-suggestion-for-raw-pointer-issue-127562.stderr
index 0da5d15cf7f..dbe834b6b78 100644
--- a/tests/ui/borrowck/no-invalid-mut-suggestion-for-raw-pointer-issue-127562.stderr
+++ b/tests/ui/borrowck/no-invalid-mut-suggestion-for-raw-pointer-issue-127562.stderr
``@@`` -6,8 +6,8 ``@@`` LL |     unsafe { *ptr = 3; }
    |
 help: consider changing this to be a mutable pointer
    |
-LL |     let ptr = &mut raw const val;
-   |                +++
+LL |     let ptr = &raw mut val;
+   |                    ~~~

 error: aborting due to 1 previous error
```
2024-12-17 05:37:11 -05:00
Jacob Pratt
68c56f6274
Rollup merge of #134368 - ehuss:edition-links, r=jieyouxu
Use links to edition guide for edition migrations

This switches the migration lints for the 2024 edition to point to the edition guide documentation instead of the tracking issues. I expect the documentation should be easier to understand for a user, compared to most of the issues which don't have any direct information, and can be a bit confusing to navigate, or have outdated information.
2024-12-17 05:37:04 -05:00
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
lcnr
3350b9faad consistently handle global where-bounds 2024-12-17 08:50:47 +01:00
lcnr
5f548890b8 add tests 2024-12-17 08:50:47 +01:00
Ryan Mehri
a7f61cad1e Regression test for RPIT inheriting lifetime 2024-12-16 22:53:21 -07: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
862950b772 Fix -Z inputs-stats ordering.
In #129533 the main hash function changed and the order of `-Z
input-stats` output changed, which showed that it is dependent on the
hash function, even though it is sorted. That's because entries with the
same cumulative size are ordered in a way that depends on the hash
function.

This commit fixes that by using the entry label as the secondary
ordering key.
2024-12-17 15:17:28 +11: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
Zalathar
154fae1e8d coverage: Build the global file table on the fly 2024-12-17 13:55:19 +11:00
ltdk
cb487cc2fa Stabilize #[coverage] attribute 2024-12-16 21:07:06 -05:00
Henry Jiang
2b7c0a8573 add alignment info for test 2024-12-16 14:59:10 -05:00
Martin Nordholts
70a0dc1f7e rustc_borrowck: Suggest changing &raw const to &raw mut if applicable 2024-12-16 20:44:23 +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
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
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
Guillaume Gomez
2383985342 Also handle cases where attributes are unclosed 2024-12-16 13:59:41 +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
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
许杰友 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
Eric Huss
3e80697972 Use links to edition guide for edition migrations 2024-12-15 20:28:16 -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
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
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
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)
54e2d39494
Rollup merge of #134329 - taiki-e:m68k-target-feature, r=workingjubilee
Add m68k_target_feature

This adds the following unstable target features (tracking issue: https://github.com/rust-lang/rust/issues/134328):

- isa-68000
- isa-68010
- isa-68020
- isa-68030
- isa-68040
- isa-68060
- isa-68881
- isa-68882

The feature names and implied features are match with [definitions in LLVM](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/M68k/M68k.td#L21-L57).

isa-68881 and isa-68882 are FPU ISA features.
isa-68881 is needed to support input/output in floating-point regs in inline assembly. isa-68020 is needed to implement https://github.com/taiki-e/atomic-maybe-uninit/pull/28 more robustly.

cc `@glaubitz` `@ricky26` (designated developers  of [m68k-unknown-linux-gnu](https://doc.rust-lang.org/nightly/rustc/platform-support/m68k-unknown-linux-gnu.html#designated-developers))
r? workingjubilee

`@rustbot` label +O-motorola68k +A-target-feature
2024-12-16 01:52:22 +08:00
bors
d18506299b Auto merge of #133417 - RalfJung:aarch64-float-abi, r=workingjubilee
reject aarch64 target feature toggling that would change the float ABI

~~Stacked on top of https://github.com/rust-lang/rust/pull/133099. Only the last two commits are new.~~

The first new commit lays the groundwork for separately controlling whether a feature may be enabled or disabled. The second commit uses that to make it illegal to *disable* the `neon` feature (which is only possible via `-Ctarget-feature`, and so the new check just adds a warning). Enabling the `neon` feature remains allowed on targets that don't disable `neon` or `fp-armv8`, which is all our built-in targets. This way, the entire PR is not a breaking change.

Fixes https://github.com/rust-lang/rust/issues/131058 for hardfloat targets (together with https://github.com/rust-lang/rust/pull/133102 which fixed it for softfloat targets).

Part of https://github.com/rust-lang/rust/issues/116344.
2024-12-15 16:32:03 +00:00