Commit Graph

259719 Commits

Author SHA1 Message Date
Zalathar 9b2c58d1fa coverage: Test for handling of nested item spans 2024-07-08 20:24:15 +10:00
bors 7fdefb804e Auto merge of #127476 - jieyouxu:rollup-16wyb0b, r=jieyouxu
Rollup of 10 pull requests

Successful merges:

 - #126841 ([`macro_metavar_expr_concat`] Add support for literals)
 - #126881 (Make `NEVER_TYPE_FALLBACK_FLOWING_INTO_UNSAFE` a deny-by-default lint in edition 2024)
 - #126921 (Give VaList its own home)
 - #127367 (Run alloc sync tests)
 - #127431 (Use field ident spans directly instead of the full field span in diagnostics on local fields)
 - #127437 (Uplift trait ref is knowable into `rustc_next_trait_solver`)
 - #127439 (Uplift elaboration into `rustc_type_ir`)
 - #127451 (Improve `run-make/output-type-permutations` code and improve `filename_not_in_denylist` API)
 - #127452 (Fix intrinsic const parameter counting with `effects`)
 - #127459 (rustdoc-json: add type/trait alias tests)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-07-08 06:47:12 +00:00
许杰友 Jieyou Xu (Joe) 76be8f1048
Rollup merge of #127459 - its-the-shrimp:rustdocjson_add_alias_tests, r=aDotInTheVoid
rustdoc-json: add type/trait alias tests

Not sure if this tests everything there is to test in them though.

Updates #81359
2024-07-08 13:04:34 +08:00
许杰友 Jieyou Xu (Joe) 73593b9aca
Rollup merge of #127452 - fee1-dead-contrib:fx-intrinsic-counting, r=fmease
Fix intrinsic const parameter counting with `effects`

r? project-const-traits
2024-07-08 13:04:34 +08:00
许杰友 Jieyou Xu (Joe) 033283456a
Rollup merge of #127451 - GuillaumeGomez:improve-output-type-permutations, r=kobzol
Improve `run-make/output-type-permutations` code and improve `filename_not_in_denylist` API

r? ``@Kobzol``
2024-07-08 13:04:33 +08:00
许杰友 Jieyou Xu (Joe) ffb93361b4
Rollup merge of #127439 - compiler-errors:uplift-elaborate, r=lcnr
Uplift elaboration into `rustc_type_ir`

Allows us to deduplicate and consolidate elaboration (including these stupid elaboration duplicate fns i added for pretty printing like 3 years ago) so I'm pretty hyped about this change :3

r? lcnr
2024-07-08 13:04:33 +08:00
许杰友 Jieyou Xu (Joe) 928d71f17b
Rollup merge of #127437 - compiler-errors:uplift-trait-ref-is-knowable, r=lcnr
Uplift trait ref is knowable into `rustc_next_trait_solver`

Self-explanatory. Eliminates one more delegate method.

r? lcnr cc ``@fmease``
2024-07-08 13:04:32 +08:00
许杰友 Jieyou Xu (Joe) bd4ab30e9c
Rollup merge of #127431 - oli-obk:feed_item_attrs, r=compiler-errors
Use field ident spans directly instead of the full field span in diagnostics on local fields

This improves diagnostics and avoids having to store the `DefId`s of fields
2024-07-08 13:04:32 +08:00
许杰友 Jieyou Xu (Joe) e76b01775c
Rollup merge of #127367 - ChrisDenton:run-sync, r=Nilstrieb
Run alloc sync tests

I was browsing the code and this struck me as weird. We're not running some doc tests because, the comment says, Windows builders deadlock. That should absolutely not happen, at least with our current implementation. And if it does happen I'd like to know.

Just to be sure though I'll do some try builds.

try-job: x86_64-msvc
try-job: i686-msvc
try-job: i686-mingw
try-job: x86_64-mingw
2024-07-08 13:04:31 +08:00
许杰友 Jieyou Xu (Joe) adbcb1a8a9
Rollup merge of #126921 - workingjubilee:outline-va-list, r=Nilstrieb
Give VaList its own home

Just rearranging things internally and reexporting.
2024-07-08 13:04:31 +08:00
许杰友 Jieyou Xu (Joe) 29c1a43403
Rollup merge of #126881 - WaffleLapkin:unsafe-code-affected-by-fallback-hard-in-2024, r=compiler-errors
Make `NEVER_TYPE_FALLBACK_FLOWING_INTO_UNSAFE` a deny-by-default lint in edition 2024

I don't actually really care about this, but ``@traviscross`` asked me to do this, because lang team briefly discussed this before.

(TC here:)

Specifically, our original FCPed plan included this step:

- Add a lint against fallback affecting a generic that is passed to an `unsafe` function.
   - Perhaps make this lint `deny-by-default` or a hard error in Rust 2024.

That is, we had left as an open question strengthening this in Rust 2024, and had marked it as an open question on the tracking issue.  We're nominating here to address the open question.  (Closing the remaining open question helps us to fully mark this off for Rust 2024.)

r? ``@compiler-errors``

Tracking:

- https://github.com/rust-lang/rust/issues/123748
2024-07-08 13:04:30 +08:00
许杰友 Jieyou Xu (Joe) 2c16d65c1e
Rollup merge of #126841 - c410-f3r:concat-again, r=petrochenkov
[`macro_metavar_expr_concat`] Add support for literals

Adds support for things like `${concat($variable, 123)}` or `${concat("hello", "_world")}` .

cc #124225
2024-07-08 13:04:30 +08:00
bors 9af6fee87d Auto merge of #113128 - WaffleLapkin:become_trully_unuwuable, r=oli-obk,RalfJung
Support tail calls in mir via `TerminatorKind::TailCall`

This is one of the interesting bits in tail call implementation — MIR support.

This adds a new `TerminatorKind` which represents a tail call:
```rust
    TailCall {
        func: Operand<'tcx>,
        args: Vec<Operand<'tcx>>,
        fn_span: Span,
    },
```

*Structurally* this is very similar to a normal `Call` but is missing a few fields:
- `destination` — tail calls don't write to destination, instead they pass caller's destination to the callee (such that eventual `return` will write to the caller of the function that used tail call)
- `target` — similarly to `destination` tail calls pass the caller's return address to the callee, so there is nothing to do
- `unwind` — I _think_ this is applicable too, although it's a bit confusing
- `call_source` — `become` forbids operators and is not created as a lowering of something else; tail calls always come from HIR (at least for now)

It might be helpful to read the interpreter implementation to understand what `TailCall` means exactly, although I've tried documenting it too.

-----

There are a few `FIXME`-questions still left, ideally we'd be able to answer them during review ':)

-----

r? `@oli-obk`
cc `@scottmcm` `@DrMeepster` `@JakobDegen`
2024-07-08 04:35:04 +00:00
bors b1de36ff34 Auto merge of #127421 - cjgillot:cache-iter, r=fmease
Cache hir_owner_nodes in ParentHirIterator.

Lint level computation may traverse deep HIR trees using that iterator. This calls `hir_owner_nodes` many times for the same HIR owner, which is wasterful.

This PR caches the value to allow a more efficient iteration scheme.

r? ghost for perf
2024-07-08 01:19:32 +00:00
bors 89aefb9c53 Auto merge of #127172 - compiler-errors:full-can_eq-everywhere, r=lcnr
Make `can_eq` process obligations (almost) everywhere

Move `can_eq` to an extension trait on `InferCtxt` in `rustc_trait_selection`, and change it so that it processes obligations. This should strengthen it to be more accurate in some cases, but is most important for the new trait solver which delays relating aliases to `AliasRelate` goals. Without this, we always basically just return true when passing aliases to `can_eq`, which can lead to weird errors, for example #127149.

I'm not actually certain if we should *have* `can_eq` be called on the good path. In cases where we need `can_eq`, we probably should just be using a regular probe.

Fixes #127149

r? lcnr
2024-07-07 23:03:48 +00:00
bors 20ae37c18d Auto merge of #127385 - weihanglo:update-cargo, r=weihanglo
Update cargo

20 commits in a515d463427b3912ec0365d106791f88c1c14e1b..154fdac39ae9629954e19e9986fd2cf2cdd8d964
2024-07-02 20:53:36 +0000 to 2024-07-07 01:28:23 +0000
- test: relax redactions for rust-lang/rust (rust-lang/cargo#14203)
- use "bootstrap" instead of "rustbuild" (rust-lang/cargo#14207)
- test: migrate serveral files to snapbox (rust-lang/cargo#14180)
- Add rustdocflags to Unit's Debug impl (rust-lang/cargo#14201)
- Allow enabling `config-include` feature in config (rust-lang/cargo#14196)
- fix(test): Restore `does_not_contain` for check (rust-lang/cargo#14198)
- test: migrate patch, pkgid, proc_macro and progress to snapbox (rust-lang/cargo#14181)
- test: Migrate jobserver to snapbox (rust-lang/cargo#14191)
- chore(deps): update msrv (3 versions) to v1.77 (rust-lang/cargo#14186)
- test: migrate build_plan and build_script to snapbox (rust-lang/cargo#14193)
- test: migrate cfg and check to snapbox (rust-lang/cargo#14185)
- test: migrate install* and inheritable_workspace_fields to snapbox (rust-lang/cargo#14170)
- Pass rustflags to artifacts built with implicit targets when using target-applies-to-host (rust-lang/cargo#13900)
- test: Migrate network tests to snapbox (rust-lang/cargo#14187)
- test: migrate some files to snapbox (rust-lang/cargo#14113)
- test: Auto-redact `... after last build at ...`; Migrate `freshness` to Snapbox (rust-lang/cargo#14161)
- chore: fix some typos (rust-lang/cargo#14182)
- fix: improve message for inactive weak optional feature with edition2024 through unused dep collection (rust-lang/cargo#14026)
- test:migrate `doc/directory/docscrape` to snapbox (rust-lang/cargo#14171)
- test: Migrate git_auth to snapbox (rust-lang/cargo#14172)
2024-07-07 19:54:14 +00:00
Maybe Lapkin 14e5d5fbee Fixup a typo in a comment in a test 2024-07-07 20:18:42 +02:00
Maybe Lapkin 39eaefc15d Fixup conflict with r-l/r/126567 2024-07-07 20:16:48 +02:00
bors 0ca92de473 Auto merge of #127454 - matthiaskrgr:rollup-k3vfen2, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #127179 (Print `TypeId` as hex for debugging)
 - #127189 (LinkedList's Cursor: method to get a ref to the cursor's list)
 - #127236 (doc: update config file path in platform-support/wasm32-wasip1-threads.md)
 - #127297 (Improve std::Path's Hash quality by avoiding prefix collisions)
 - #127308 (Attribute cleanups)
 - #127354 (Describe Sized requirements for mem::offset_of)
 - #127409 (Emit a wrap expr span_bug only if context is not tainted)
 - #127447 (once_lock: make test not take as long in Miri)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-07-07 16:29:52 +00:00
Maybe Lapkin 7fd0c55a1a Fix conflicts after rebase
- r-l/r 126784
- r-l/r 127113
- r-l/miri 3562
2024-07-07 18:16:38 +02:00
Maybe Lapkin 54e11cf378 add an assertion that machine hook doesn't return NoCleanup 2024-07-07 18:16:38 +02:00
Maybe Waffle dd5a447b5a Do renames proposed by review 2024-07-07 18:16:38 +02:00
Maybe Waffle 236352024b make `StackPop` field names less confusing 2024-07-07 18:16:38 +02:00
Maybe Waffle cda6f0c25d doc fixups from review 2024-07-07 18:16:38 +02:00
Maybe Waffle 6d4995f4e6 add miri tests and a fixme 2024-07-07 18:16:38 +02:00
Maybe Waffle cda25e56c8 Refactor & fixup interpreter implementation of tail calls 2024-07-07 18:16:38 +02:00
Michael Goulet 15d16f1cd6 Finish uplifting supertraits 2024-07-07 11:28:01 -04:00
Michael Goulet 66eb346770 Get rid of the redundant elaboration in middle 2024-07-07 11:28:01 -04:00
Michael Goulet 90423a7abb Uplift elaboration 2024-07-07 11:28:01 -04:00
Maybe Waffle 30b18d7c36 Add support for `mir::TerminatorKind::TailCall` in clippy 2024-07-07 17:11:05 +02:00
Maybe Waffle 5f4caae11c Fix unconditional recursion lint wrt tail calls 2024-07-07 17:11:05 +02:00
Maybe Waffle 45c70318f7 Refactor common part of evaluating `Call`&`TailCall` in the interpreter 2024-07-07 17:11:05 +02:00
Maybe Waffle 3b5a5ee6c8 Support tail calls in the interpreter 2024-07-07 17:11:05 +02:00
DrMeepster 4187cdc013 Properly handle drops for tail calls 2024-07-07 17:11:05 +02:00
Maybe Waffle 484152d562 Support tail calls in mir via `TerminatorKind::TailCall` 2024-07-07 17:11:04 +02:00
Michael Goulet ab27c2fa77 Get rid of trait_ref_is_knowable from delegate 2024-07-07 11:10:48 -04:00
Michael Goulet a982471e07 Uplift trait_ref_is_knowable and friends 2024-07-07 11:10:32 -04:00
Michael Goulet b2e30bdec4 Add fundamental to trait def 2024-07-07 11:10:32 -04:00
Weihang Lo d58a2391f5
Update cargo 2024-07-07 10:21:28 -04:00
bors 959a2eb275 Auto merge of #127455 - Nilstrieb:blazing-tidy, r=jieyouxu
Make tidy problematic const checking fast again

fixes pathological tidy performance described in #127453 by reverting #127428

i think anyone can approve this ASAP, it makes working on this repo significantly worse.
2024-07-07 14:15:33 +00:00
schvv31n 8e7314f6e0 rustdoc-json: add trait/type alias tests 2024-07-07 15:02:30 +01:00
Nilstrieb 1cfc89ad69 Add note about performance of tidy problematic consts 2024-07-07 14:23:36 +02:00
Nilstrieb 76ba11994e Revert "remove regexes"
This reverts commit 8d8504300f.

The regexes are important for performance.
2024-07-07 14:22:06 +02:00
Matthias Krüger b564c510c1
Rollup merge of #127447 - RalfJung:once_lock_miri, r=joboet
once_lock: make test not take as long in Miri

Allocating 1000 list elements takes a while (`@zachs18` reported >5min), so let's reduce the iteration count when running in Miri. Unfortunately due to this clever `while let i @ 0..LEN =` thing, the count needs to be a constants, and constants cannot be shadowed, so we need to use another trick to hide the `cfg!(miri)` from the docs. (I think this loop condition may be a bit too clever, it took me a bit to decipher. Ideally this would be `while let i = ... && i < LEN`, but that is not stable yet.)
2024-07-07 14:22:03 +02:00
Matthias Krüger 1ee6345b7b
Rollup merge of #127409 - gurry:127332-ice-with-expr-not-struct, r=oli-obk
Emit a wrap expr span_bug only if context is not tainted

Fixes #127332

The ICE occurs because of this `span_bug`: 51917e2e69/compiler/rustc_hir_typeck/src/expr_use_visitor.rs (L732-L738)
which is triggered by the fact that we're trying to use an `enum` in a `with` expression instead of a `struct`.

The issue originates in commit 814bfe9335   from PR #127202. As per the title of that commit the ICEing code should not be reachable any more, but looks like it still is.

This PR changes the code so that the `span_bug` will be emitted only if the context is not tainted by a previous error.
2024-07-07 14:22:02 +02:00
Matthias Krüger c40530d0de
Rollup merge of #127354 - nicholasbishop:bishop-sized-doc, r=Nilstrieb
Describe Sized requirements for mem::offset_of

The container doesn't have to be sized, but the field must be sized (at least until https://github.com/rust-lang/rust/issues/126151 is stable).
2024-07-07 14:22:02 +02:00
Matthias Krüger 510020ad4c
Rollup merge of #127308 - nnethercote:Attribute-cleanups, r=petrochenkov
Attribute cleanups

More refactoring done while trying to fix the final remaining test failure for #124141.

r? `@petrochenkov`
2024-07-07 14:22:01 +02:00
Matthias Krüger 56557c4555
Rollup merge of #127297 - the8472:path-new-hash, r=Nilstrieb
Improve std::Path's Hash quality by avoiding prefix collisions

This adds a bit rotation to the already existing state so that the same sequence of characters chunked at different offsets into separate path components results in different hashes.

The tests are from #127255

Closes #127254
2024-07-07 14:22:00 +02:00
Matthias Krüger d84d2214cd
Rollup merge of #127236 - iawia002:wasip1-threads-doc, r=Nilstrieb
doc: update config file path in platform-support/wasm32-wasip1-threads.md

The config content described in the `Building the target` section should be the configuration used for building Rust itself:

7d97c59438/config.example.toml (L845-L848)

I believe this is different from Cargo's configuration. There seems to be some misunderstanding in the discussion here: https://github.com/rust-lang/rust/pull/112922#discussion_r1272263810.
2024-07-07 14:22:00 +02:00
Matthias Krüger 94d07befe7
Rollup merge of #127189 - GrigorenkoPV:linkedlist-cursor-list, r=Nilstrieb
LinkedList's Cursor: method to get a ref to the cursor's list

We're already providing `.back()` & `.front()`, for which we hold onto a reference to the parent list, so why not share it? Useful for when you got `LinkedList` -> `CursorMut` -> `Cursor` and cannot take another ref to the list, even though you should be able to. This seems to be completely safe & sound.

The name is, of course, bikesheddable.
2024-07-07 14:21:59 +02:00