Commit Graph

271152 Commits

Author SHA1 Message Date
lcnr
4813fda2e6 rustdoc: yeet TypingEnv::from_param_env 2024-11-19 18:35:41 +01:00
lcnr
f74951fdf1 generic_const_exprs: yeet TypingEnv::from_param_env 2024-11-19 18:06:20 +01:00
lcnr
ffd7a50314 impl trait overcaptures, yeet TypingMode::from_param_env 2024-11-19 18:06:20 +01:00
lcnr
07a5272476 pattern lowering, yeet TypingEnv::from_param_env 2024-11-19 18:06:20 +01:00
lcnr
decf37bd16 liveness checking, yeet TypingEnv::from_param_env 2024-11-19 18:06:20 +01:00
lcnr
1ec964873e unconditional recursion, yeet TypingEnv::from_param_env 2024-11-19 18:06:20 +01:00
lcnr
948cec0fad move fn is_item_raw to TypingEnv 2024-11-19 18:06:20 +01:00
bors
89b6885529 Auto merge of #133164 - RalfJung:promoted-oom, r=jieyouxu
interpret: do not ICE when a promoted fails with OOM

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

try-job: aarch64-apple
try-job: dist-x86_64-linux
2024-11-19 13:24:09 +00:00
bors
7d40450b2d Auto merge of #132623 - nnethercote:rustc_borrowck-cleanups-2, r=Nadrieril
`rustc_borrowck` cleanups, part 2

The code under `do_mir_borrowck` is pretty messy, especially the various types like `MirBorrowckCtxt`, `BorrowckInferCtxt`, `MirTypeckResults`, `MirTypeckRegionConstraints`, `CreateResult`, `TypeChecker`, `TypeVerifier`, `LivenessContext`, `LivenessResults`. This PR does some tidying up, though there's still plenty of mess left afterwards.

A sequel to #132250.

r? `@compiler-errors`
2024-11-19 08:32:27 +00:00
bors
e6c1e14e5d Auto merge of #133193 - fmease:rollup-v38ayvk, r=fmease
Rollup of 9 pull requests

Successful merges:

 - #132758 (Improve `{BTreeMap,HashMap}::get_key_value` docs.)
 - #133180 ([rustdoc] Fix items with generics not having their jump to def link generated)
 - #133181 (Update books)
 - #133182 (const_panic: inline in bootstrap builds to avoid f16/f128 crashes)
 - #133185 (rustdoc-search: use smart binary search in bitmaps)
 - #133186 (Document s390x-unknown-linux targets)
 - #133187 (Add reference annotations for diagnostic attributes)
 - #133191 (rustdoc book: Move `--test-builder(--wrapper)?` docs to unstable section.)
 - #133192 (RELEASES.md: Don't document unstable `--test-build-wrapper`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-11-19 05:14:06 +00:00
León Orell Valerian Liehr
56747f30b4
Rollup merge of #133192 - aDotInTheVoid:changelog-cleanup, r=fmease
RELEASES.md: Don't document unstable `--test-build-wrapper`

#114651 added this as an unstable flag, so it doesn't make sense to go in the release notes.

Discovered while working on #133191.
2024-11-19 04:01:33 +01:00
León Orell Valerian Liehr
27acd5e5ec
Rollup merge of #133191 - aDotInTheVoid:whoops-thats-not-stable-and-might-never-be, r=fmease
rustdoc book: Move `--test-builder(--wrapper)?` docs to unstable section.

Tracking issue: https://github.com/rust-lang/rust/issues/102981

These have always been unstable, but were documented in the stable section in #114651
2024-11-19 04:01:33 +01:00
León Orell Valerian Liehr
739fdaf969
Rollup merge of #133187 - ehuss:reference-diagnostic, r=jieyouxu
Add reference annotations for diagnostic attributes

This adds reference annotations for `diagnostic::on_unimplmented` and the `diagnostic` namespace in general.

There's also a rename for a test that looks like it was put in the wrong location.
2024-11-19 04:01:32 +01:00
León Orell Valerian Liehr
49ca6c6b3e
Rollup merge of #133186 - uweigand:s390x-maintainer, r=wesleywiser
Document s390x-unknown-linux targets

This adds documentation for the following existing targets:
  s390x-unknown-linux-gnu (Tier 2 with host tools)
  s390x-unknown-linux-musl (Tier 3)

I volunteer as maintainer for these targets going forward.
2024-11-19 04:01:32 +01:00
León Orell Valerian Liehr
5f537c410e
Rollup merge of #133185 - notriddle:notriddle/roaringbitmap, r=notriddle
rustdoc-search: use smart binary search in bitmaps

Addresses a comment from [jsha's benchmarking], where the `contains` function showed up in the profiler. This commit pulls it from about 5% of the runtime to about 0.5%.

Before: https://share.firefox.dev/3ANVjon

After: https://share.firefox.dev/3OeM3gk

[jsha's benchmarking]: https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/search.20profiling/near/481868761
2024-11-19 04:01:31 +01:00
León Orell Valerian Liehr
17ffefcf00
Rollup merge of #133182 - RalfJung:const-panic-inline, r=tgross35
const_panic: inline in bootstrap builds to avoid f16/f128 crashes

This should fix https://github.com/rust-lang/rust/issues/133177. ``@uweigand`` could you test that?
2024-11-19 04:01:30 +01:00
León Orell Valerian Liehr
09838ae70d
Rollup merge of #133181 - rustbot:docs-update, r=ehuss
Update books

## rust-lang/edition-guide

2 commits in 2d482e203eb6d6e353814cf1415c5f94e590b9e0..915f9b319c2823f310430ecdecd86264a7870d7e
2024-11-06 07:23:07 UTC to 2024-11-05 09:03:41 UTC

- 2021: Update for raw lifetimes (rust-lang/edition-guide#330)
- CI: Switch to merge queue (rust-lang/edition-guide#333)

## rust-lang/nomicon

1 commits in 456b904f791751892b01282fd2757904993c4c26..eac89a3cbe6c4714e5029ae8b5a1c556fd4e8c42
2024-11-16 14:05:28 UTC to 2024-11-16 14:05:28 UTC

- Fix typo in what-unsafe-does (rust-lang/nomicon#469)

## rust-lang/reference

10 commits in da0f6dad767670da0e8cd5af8a7090db3272f626..41ccb0e6478305401dad92e8fd3d04a4304edb4c
2024-11-15 21:45:16 UTC to 2024-11-05 21:46:30 UTC

- Add identifiers to attributes.md and its subchapters (rust-lang/reference#1560)
- Fix 2 typos (rust-lang/reference#1674)
- Add examples to clarify the casting rules (rust-lang/reference#686)
- Explaining how to link mixed C/Rust binaries. (rust-lang/reference#838)
- Add Arm64EC to inline-assembly documentation (rust-lang/reference#1653)
- Add three more WebAssembly features to the list of accepted ones (rust-lang/reference#1638)
- Add s390x to inline-assembly documentation (rust-lang/reference#1643)
- trait object constraint correction (rust-lang/reference#1670)
- Update some "default" representation references (rust-lang/reference#1667)
- Update lifetimes for pre-expansion validation (rust-lang/reference#1668)

## rust-lang/rustc-dev-guide

12 commits in 6a5accdaf10255882b1e6c59dfe5f1c79ac95484..b679e71c2d66c6fe13e06b99ac61773b866213f0
2024-11-18 08:18:15 UTC to 2024-11-05 07:22:17 UTC

- Mention `RUSTC_BOOTSTRAP` for misc testing (rust-lang/rustc-dev-guide#2136)
- Document how to acquire `cdb.exe` (rust-lang/rustc-dev-guide#2137)
- Document `max-llvm-major-version` directive (rust-lang/rustc-dev-guide#2129)
- Document `exact-llvm-major-version` directive (rust-lang/rustc-dev-guide#2135)
- Note Rustfmt for separate rust-analyzer directory (rust-lang/rustc-dev-guide#2134)
- still accurate (rust-lang/rustc-dev-guide#2133)
- typo (rust-lang/rustc-dev-guide#2132)
- add valid date-check marker (rust-lang/rustc-dev-guide#2131)
- Update parallel-rustc.md (rust-lang/rustc-dev-guide#1926)
- Rename `{ignore,only}-debug` -> `{ignore,needs}-{rustc,std}-debug-assertions` (rust-lang/rustc-dev-guide#2101)
- update const stability docs (rust-lang/rustc-dev-guide#2111)
- Ask folks to use the Oxford comma in diagnostics (rust-lang/rustc-dev-guide#2093)
2024-11-19 04:01:30 +01:00
León Orell Valerian Liehr
f66e1749c0
Rollup merge of #133180 - GuillaumeGomez:jump-to-def-links-generics, r=notriddle
[rustdoc] Fix items with generics not having their jump to def link generated

Because the span originally included the generics, during the highlighting, it was not retrieved and therefore its jump to def link was not generated.

r? ``@notriddle``
2024-11-19 04:01:29 +01:00
León Orell Valerian Liehr
22265415c4
Rollup merge of #132758 - nnethercote:improve-get_key_value-docs, r=cuviper
Improve `{BTreeMap,HashMap}::get_key_value` docs.

They are unusual methods. The docs don't really describe the cases when they might be useful (as opposed to just `get`), and the examples don't demonstrate the interesting cases at all.

This commit improves the docs and the examples.
2024-11-19 04:01:28 +01:00
bors
5926e82dd1 Auto merge of #124780 - Mark-Simulacrum:lockless-cache, r=lcnr
Improve VecCache under parallel frontend

This replaces the single Vec allocation with a series of progressively larger buckets. With the cfg for parallel enabled but with -Zthreads=1, this looks like a slight regression in i-count and cycle counts (~1%).

With the parallel frontend at -Zthreads=4, this is an improvement (-5% wall-time from 5.788 to 5.4688 on libcore) than our current Lock-based approach, likely due to reducing the bouncing of the cache line holding the lock. At -Zthreads=32 it's a huge improvement (-46%: 8.829 -> 4.7319 seconds).

try-job: i686-gnu-nopt
try-job: dist-x86_64-linux
2024-11-19 02:07:48 +00:00
Nicholas Nethercote
75108b6067 Pass flow_inits by value.
It's simpler that way, and we don't need the explicit `drop`.
2024-11-19 11:46:33 +11:00
Nicholas Nethercote
af50fe407e Put param_env into infcx.
Because they get passed around together a lot.
2024-11-19 11:44:07 +11:00
Nicholas Nethercote
c9283f8fa9 Pass constraints to RegionInferenceContext::new.
Instead of destructuring it in advance and passing all the components
individually. It's less code that way.
2024-11-19 11:33:48 +11:00
Nicholas Nethercote
801b150737 Don't refcount PlaceholderIndices.
It's not necessary.
2024-11-19 11:33:48 +11:00
Nicholas Nethercote
fe3c49fe9a Inline and remove TypeVerifier::new.
It has a single call site.
2024-11-19 11:33:48 +11:00
Nicholas Nethercote
2709dc8a13 Compute upvars lazily.
It can be computed from `tcx` on demand, instead of computing it eagerly
and passing it around.
2024-11-19 11:33:48 +11:00
Nicholas Nethercote
952c6d5c96 Clean up UniversalRegions.
There is an `Rc<UniversalRegions>` within `UniversalRegionRelations`,
and yet the two types get passed around in tandem a lot.

This commit makes `UniversalRegionRelations` own `UniversalRegions`,
removing the `Rc` (which wasn't truly needed) and the tandem-passing.
This requires adding a `universal_relations` method to
`UniversalRegionRelations`, and renaming a couple of existing methods
producing iterators to avoid a name clash.
2024-11-19 11:33:48 +11:00
Nicholas Nethercote
ed11fbe5df Make TypeChecker::region_bound_pairs owned.
No reason not to be, and it's simpler that way.
2024-11-19 11:33:48 +11:00
Nicholas Nethercote
227ecc803f Make TypeChecker::known_type_outlives_obligations owned.
This avoids the need to arena allocate it. `ConstraintConversion` needs
some simple lifetime adjustments to allow this.
2024-11-19 11:33:48 +11:00
Nicholas Nethercote
4c8a23ab0d Don't pass universal_regions unnecessarily.
`TypeChecker` already has it in a field.
2024-11-19 11:33:48 +11:00
Alona Enraght-Moony
d20a310582 RELEASES.md: Don't document unstable --test-build-wrapper 2024-11-18 23:29:27 +00:00
Alona Enraght-Moony
ed465f2090 rustdoc book: Move --test-builder(--wrapper)? docs to unstable section. 2024-11-18 23:20:41 +00:00
bors
b71fb5edc0 Auto merge of #132460 - lcnr:questionable-uwu, r=compiler-errors
Use `TypingMode` throughout the compiler instead of `ParamEnv`

Hopefully the biggest single PR as part of https://github.com/rust-lang/types-team/issues/128.

## `infcx.typing_env` while defining opaque types

I don't know how'll be able to correctly handle opaque types when using something taking a `TypingEnv` while defining opaque types. To correctly handle the opaques we need to be able to pass in the current `opaque_type_storage` and return constraints, i.e. we need to use a proper canonical query. We should migrate all the queries used during HIR typeck and borrowck where this matters to proper canonical queries. This is

## `layout_of` and `Reveal::All`

We convert the `ParamEnv` to `Reveal::All` right at the start of the `layout_of` query, so I've changed callers of `layout_of` to already use a post analysis `TypingEnv` when encountering it.

ca87b535a0/compiler/rustc_ty_utils/src/layout.rs (L51)

## `Ty::is_[unpin|sized|whatever]`

I haven't migrated `fn is_item_raw` to use `TypingEnv`, will do so in a followup PR, this should significantly reduce the amount of `typing_env.param_env`. At some point there will probably be zero such uses as using the type system while ignoring the `typing_mode` is incorrect.

## `MirPhase` and phase-transitions

When inside of a MIR-body, we can mostly use its `MirPhase` to figure out the right `typing_mode`. This does not work during phase transitions, most notably when transitioning from `Analysis` to `Runtime`:

dae7ac133b/compiler/rustc_mir_transform/src/lib.rs (L606-L625)

All these passes still run with `MirPhase::Analysis`, but we should only use `Reveal::All` once we're run the `RevealAll` pass. This required me to manually construct the right `TypingEnv` in all these passes. Given that it feels somewhat easy to accidentally miss this going forward, I would maybe like to change `Body::phase` to an `Option` and replace it at the start of phase transitions. This then makes it clear that the MIR is currently in a weird state.

r? `@ghost`
2024-11-18 21:07:05 +00:00
Michael Howell
826d023561 rustdoc-search: add descriptive comments to bitmap class 2024-11-18 13:37:53 -07:00
Ulrich Weigand
3ae8036f66
Update src/doc/rustc/src/platform-support/s390x-unknown-linux-gnu.md
Co-authored-by: Josh Stone <cuviper@gmail.com>
2024-11-18 21:31:39 +01:00
Ralf Jung
c6974344a5 interpret: do not ICE when a promoted fails with OOM 2024-11-18 20:48:03 +01:00
rustbot
3adbc16385 Update books 2024-11-18 10:47:40 -08:00
Eric Huss
1b0e78738b Add reference annotations for diagnostic attributes
This adds reference annotations for `diagnostic::on_unimplmented` and
the `diagnostic` namespace in general.
2024-11-18 10:45:26 -08:00
Ulrich Weigand
8f95079cfc Document s390x-unknown-linux targets
This adds documentation for the following existing targets:
  s390x-unknown-linux-gnu (Tier 2 with host tools)
  s390x-unknown-linux-musl (Tier 3)

I volunteer as maintainer for these targets going forward.

Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
2024-11-18 19:44:25 +01:00
Michael Howell
3fbcc1f4b9 rustdoc-search: use smart binary search in bitmaps
Addresses a comment from [jsha's benchmarking], where the `contains`
function showed up in the profiler. This commit pulls it from about
5% of the runtime to about 0.5%.

[jsha's benchmarking]: https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/search.20profiling/near/481868761
2024-11-18 11:38:25 -07:00
bors
03ee484519 Auto merge of #133179 - GuillaumeGomez:rollup-ro5rtts, r=GuillaumeGomez
Rollup of 5 pull requests

Successful merges:

 - #133156 (typo in config.example.toml)
 - #133157 (stability: remove skip_stability_check_due_to_privacy)
 - #133163 (remove pointless cold_path impl in interpreter)
 - #133169 (Update autolabels for T-compiler and T-bootstrap)
 - #133171 (Add the missing quotation mark in comment)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-11-18 17:58:35 +00:00
Ralf Jung
31f5c3ba69 const_panic: inline in bootstrap builds to avoid f16/f128 crashes 2024-11-18 18:17:02 +01:00
Guillaume Gomez
8b0f8cb73c Add regression test for jump to def links on items with generics 2024-11-18 18:11:50 +01:00
Guillaume Gomez
786b7477f6 Fix items with generics not having their jump to def link generated 2024-11-18 17:58:57 +01:00
Guillaume Gomez
62d0235a4a
Rollup merge of #133171 - binchengqu:master, r=jieyouxu
Add the missing quotation mark in comment
2024-11-18 17:17:44 +01:00
Guillaume Gomez
36180d9c71
Rollup merge of #133169 - jieyouxu:update-triagebot-labels, r=WaffleLapkin
Update autolabels for T-compiler and T-bootstrap

- Tag more test suite changes with `T-compiler`.
- Tag `src/build_helper` with `T-bootstrap`.
2024-11-18 17:17:44 +01:00
Guillaume Gomez
4baf540fce
Rollup merge of #133163 - RalfJung:cold, r=saethlin
remove pointless cold_path impl in interpreter

This has a fallback impl so the interpreter impl is not needed.

r? ``@saethlin``
2024-11-18 17:17:43 +01:00
Guillaume Gomez
86ba13ba2f
Rollup merge of #133157 - RalfJung:skip_stability_check_due_to_privacy, r=compiler-errors
stability: remove skip_stability_check_due_to_privacy

This was added in https://github.com/rust-lang/rust/pull/38689 to deal with https://github.com/rust-lang/rust/issues/38412. However, even after removing the check, the relevant tests still pass. Let's see if CI finds any other tests that rely on this. If not, it seems like logic elsewhere in the compiler changed so this is not required any more.
2024-11-18 17:17:42 +01:00
Guillaume Gomez
1a0bc61314
Rollup merge of #133156 - tshepang:patch-5, r=jieyouxu
typo in config.example.toml
2024-11-18 17:17:41 +01:00
Guillaume Gomez
8ea02578cd Fix typo 2024-11-18 17:00:44 +01:00