about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2024-12-20add commentslcnr-3/+6
2024-12-20Auto merge of #134550 - jhpratt:rollup-wsfmo59, r=jhprattbors-583/+712
Rollup of 6 pull requests Successful merges: - #126118 (docs: Mention `spare_capacity_mut()` in `Vec::set_len`) - #132830 (Rename `elem_offset` to `element_offset`) - #133103 (Pass FnAbi to find_mir_or_eval_fn) - #134321 (Hide `= _` as associated constant value inside impl blocks) - #134518 (fix typos in the example code in the doc comments of `Ipv4Addr::from_bits()`, `Ipv6Addr::from_bits()` & `Ipv6Addr::to_bits()`) - #134521 (Arbitrary self types v2: roll loop.) r? `@ghost` `@rustbot` modify labels: rollup
2024-12-20Rollup merge of #134521 - adetaylor:roll-loop, r=wesleywiserJacob Pratt-17/+10
Arbitrary self types v2: roll loop. Just for slightly more concise code - no functional changes. r? `@wesleywiser` Part of #44874
2024-12-20Rollup merge of #134518 - hltj:typo-fix, r=tgross35Jacob Pratt-3/+3
fix typos in the example code in the doc comments of `Ipv4Addr::from_bits()`, `Ipv6Addr::from_bits()` & `Ipv6Addr::to_bits()`
2024-12-20Rollup merge of #134321 - dtolnay:docassocconst, r=fmeaseJacob Pratt-100/+201
Hide `= _` as associated constant value inside impl blocks Closes #134320. ### Before: <img src="https://github.com/user-attachments/assets/19d28811-45d2-4563-9726-f40c6af411c6" width="300">&nbsp;<img src="https://github.com/user-attachments/assets/1ecf8764-97ce-47f0-87fa-3b174d2fc578" width="300"> ### After: <img src="https://github.com/user-attachments/assets/6408c4ca-b1c4-42e4-884b-248833a4865f" width="300">&nbsp;<img src="https://github.com/user-attachments/assets/df2f6981-16f6-409f-8abb-73c0a4a71d6b" width="300"> r? `@fmease`
2024-12-20Rollup merge of #133103 - tiif:fnabi, r=RalfJungJacob Pratt-455/+484
Pass FnAbi to find_mir_or_eval_fn https://github.com/rust-lang/miri/issues/4013 needs information from ``FnAbi``, hence it is passed to ``find_mir_or_eval_fn``. r? `@RalfJung`
2024-12-20Rollup merge of #132830 - wr7:substr_range_documentation, r=tgross35Jacob Pratt-7/+8
Rename `elem_offset` to `element_offset` Tracking issue: #126769 Renames `slice::elem_offset` to `slice::element_offset` and improves the documentation of it and its related methods. The current documentation can be misinterpreted (as explained [here](https://github.com/rust-lang/rust/issues/126769#issuecomment-2453363897)).
2024-12-20Rollup merge of #126118 - jan-ferdinand:docs_for_vec_set_len, r=the8472Jacob Pratt-1/+6
docs: Mention `spare_capacity_mut()` in `Vec::set_len` I recently went down a small rabbit hole when trying to identify safe use of `Vec::set_len`. The solution was `Vec::spare_capacity_mut`. I think the docs on `Vec::set_len` benefit from mentioning this method. A possible counter-argument could be that the [clippy lint `uninit_vec`](https://rust-lang.github.io/rust-clippy/master/index.html#/uninit_vec) already nudges people in the right direction. However, I think a working example on `Vec::set_len` is still beneficial. Happy to hear your thoughts on the matter. :blush:
2024-12-20Auto merge of #134438 - lqd:const-qualif-bitsets, r=compiler-errorsbors-5/+15
Use `MixedBitSet`s in const qualif These analyses' domains should be very homogeneous, having compressed bitmaps on huge cfgs should make a difference (and doesn’t have an impact on the smaller / regular cfgs in our benchmarks). This is a >40% walltime reduction on [this stress test](https://github.com/Manishearth/icu4x_compile_sample) extracted from a real world ICU case, and a 10x or so max-rss reduction. cc `@oli-obk` `@RalfJung` Should help with (or fix) issue #134404.
2024-12-20fix typos in the example code in the doc comments of ↵hltj-3/+3
`Ipv4Addr::from_bits()`, `Ipv6Addr::from_bits()` & `Ipv6Addr::to_bits()`
2024-12-20Auto merge of #134433 - MarcoIeni:ubuntu-22-large-runners, r=Kobzolbors-3/+3
ci: use ubuntu-22 for large runners
2024-12-19Auto merge of #134516 - matthiaskrgr:rollup-aqwxii0, r=matthiaskrgrbors-488/+531
Rollup of 5 pull requests Successful merges: - #134463 (compiletest: don't register predefined `MSVC`/`NONMSVC` FileCheck prefixes) - #134487 (Add reference annotations for the `coverage` attribute) - #134497 (coverage: Store coverage source regions as `Span` until codegen (take 2)) - #134502 (Update std libc version to 0.2.169) - #134506 (Remove a duplicated check that doesn't do anything anymore.) r? `@ghost` `@rustbot` modify labels: rollup
2024-12-19Auto merge of #133793 - nnethercote:speed-up-expected_tokens, r=spastorinobors-844/+1415
Speed up `Parser::expected_tokens` The constant pushing/clearing of `Parser::expected_tokens` during parsing is slow. This PR speeds it up greatly. r? `@estebank`
2024-12-19Rename TyMethodItem -> RequiredMethodItemDavid Tolnay-20/+24
2024-12-19Rename TyAssocTypeItem -> RequiredAssocTypeItemDavid Tolnay-23/+25
2024-12-19Suppress `= _` on associated constants in implsDavid Tolnay-14/+47
2024-12-19Add test for rustdoc showing underscore as assoc const valueDavid Tolnay-0/+27
2024-12-19Split AssocConstItem into ProvidedAssocConstItem and ImplAssocConstItemDavid Tolnay-34/+62
2024-12-19Rename TyAssocConstItem -> RequiredAssocConstItemDavid Tolnay-22/+29
2024-12-19Auto merge of #134486 - compiler-errors:drop-for-lint, r=nikomatsakisbors-41/+461
Make sure we handle `backwards_incompatible_lint` drops appropriately in drop elaboration In #131326, a new kind of scheduled drop (`drop_kind: DropKind::Value` + `backwards_incompatible_lint: true`) was added so that we could insert a new kind of no-op MIR statement (`backward incompatible drop`) for linting purposes. These drops were intended to have *no side-effects*, but drop elaboration code forgot to handle these drops specially and they were handled otherwise as normal drops in most of the code. This ends up being **unsound** since we insert more than one drop call for some values, which means that `Drop::drop` could be called more than once. This PR fixes this by splitting out the `DropKind::ForLint` and adjusting the code. I'm not totally certain if all of the places I've adjusted are either reachable or correct, but I'm pretty certain that it's *more* correct than it was previously. cc `@dingxiangfei2009` r? nikomatsakis Fixes #134482
2024-12-19Arbitrary self types v2: roll loop.Adrian Taylor-17/+10
Just for slightly more concise code - no functional changes. r? @wesleywiser
2024-12-19pacify merciless fmtNiko Matsakis-5/+5
2024-12-19Rollup merge of #134506 - oli-obk:push-mrrulszyuslt, r=jieyouxuMatthias Krüger-42/+18
Remove a duplicated check that doesn't do anything anymore. fixes #134005 This code didn't actually `lub` the type of the previous expressions, but just the current type over and over again. Changing it to using the actual expression type does not change anything either, so may as well remove the entire loop.
2024-12-19Rollup merge of #134502 - SergioGasquez:feat/libc-0.2.169, r=tgross35Matthias Krüger-5/+5
Update std libc version to 0.2.169 Bumps `libc` to the latest release version [0.2.169](https://github.com/rust-lang/libc/releases/tag/0.2.169) which includes several fixes and additions, including mirroring `c_char` configuration (https://github.com/rust-lang/rust/pull/132975) for many targets.
2024-12-19Rollup merge of #134497 - Zalathar:spans, r=jieyouxuMatthias Krüger-271/+299
coverage: Store coverage source regions as `Span` until codegen (take 2) This is an attempt to re-land #133418: > Historically, coverage spans were converted into line/column coordinates during the MIR instrumentation pass. > This PR moves that conversion step into codegen, so that coverage spans spend most of their time stored as Span instead. > In addition to being conceptually nicer, this also reduces the size of coverage mappings in MIR, because Span is smaller than 4x u32. That PR was reverted by #133608, because in some circumstances not covered by our test suite we were emitting coverage metadata that was causing `llvm-cov` to exit with an error (#133606). --- The implementation here is *mostly* the same, but adapted for subsequent changes in the relevant code (e.g. #134163). I believe that the changes in #134163 should be sufficient to prevent the problem that required the original PR to be reverted. But I haven't been able to reproduce the original breakage in a regression test, and the `llvm-cov` error message is extremely unhelpful, so I can't completely rule out the possibility of this breaking again. r? jieyouxu (reviewer of the original PR)
2024-12-19Rollup merge of #134487 - ehuss:reference-coverage, r=compiler-errorsMatthias Krüger-103/+123
Add reference annotations for the `coverage` attribute This adds reference annotations for the `coverage` attribute.
2024-12-19Rollup merge of #134463 - jieyouxu:filecheck-prefix, r=ZalatharMatthias Krüger-67/+86
compiletest: don't register predefined `MSVC`/`NONMSVC` FileCheck prefixes This was fragile as it was based on host target passed to compiletest, but the user could cross-compile and run test for a different target (e.g. cross from linux to msvc, but msvc won't be set on the target). Furthermore, it was also very surprising as normally revision names (other than `CHECK`) was accepted as FileCheck prefixes. This partially reverts the `MSVC`/`NONMSVC` predefined FileCheck prefix registration introduced historically for some codegen tests. This makes some codegen tests more verbose since they now need to explicitly introduce `MSVC`/`NONMSVC` revisions, but I think that's less surprising, e.g.: ```rs //@ revisions: MSVC NONMSVC //`@[MSVC]` only-msvc //`@[NONMSVC]` ignore-msvc ``` Note that revisions are not *only* FileCheck prefixes in FileCheck-based test suites, as they also can be used to conditionally apply certain compiletest directives. r? `@Zalathar` (or reroll a `r/? compiletest` reviewer) try-job: x86_64-msvc try-job: i686-msvc try-job: x86_64-mingw-1 try-job: i686-mingw
2024-12-19Pass FnAbi to find_mir_or_eval_fntiif-455/+484
2024-12-19explain how `build_scope_drops` worksNiko Matsakis-2/+38
2024-12-19Explicitly register `MSVC`/`NONMSVC` revisions for some codegen tests许杰友 Jieyou Xu (Joe)-50/+76
2024-12-19compiletest: don't register `MSVC`/`NONMSVC` FileCheck prefixes许杰友 Jieyou Xu (Joe)-17/+10
This was fragile as it was based on host target passed to compiletest, but the user could cross-compile and run test for a different target (e.g. cross from linux to msvc, but msvc won't be set on the target). Furthermore, it was also very surprising as normally revision names (other than `CHECK`) was accepted as FileCheck prefixes.
2024-12-19Auto merge of #134499 - jieyouxu:rollup-zmaveur, r=jieyouxubors-367/+446
Rollup of 7 pull requests Successful merges: - #133702 (Variants::Single: do not use invalid VariantIdx for uninhabited enums) - #134427 (ci: remove duplicate task definition) - #134432 (Fix intra doc links not generated inside footnote definitions) - #134437 (reduce compiler `Assemble` complexity) - #134474 (Forbid overwriting types in typeck) - #134477 (move lint_unused_mut into sub-fn) - #134491 (Some destructor/drop related tweaks) r? `@ghost` `@rustbot` modify labels: rollup
2024-12-19coverage: Add a synthetic test for when all spans are discardedZalathar-3/+67
2024-12-19Remove a duplicated check that doesn't do anything anymore.Oli Scherer-42/+18
2024-12-19build: Update libc versionSergio Gasquez-5/+5
2024-12-19Fix `Parser` size assertion on s390x.Nicholas Nethercote-3/+3
For some reason the memory layout is different on s390x.
2024-12-19Rollup merge of #134491 - compiler-errors:dtor-tweaks, r=lqd许杰友 Jieyou Xu (Joe)-53/+46
Some destructor/drop related tweaks Two random tweaks I got from investigating some stuff around drops in edition 2024: 1. Use the `TypingEnv` of the mir builder, rather than making it over again. 2. Rename the `id` field from `Scope` to `local_id`, to reflect that it's a local id, and remove the `item_local_id()` accessor which just returned the id field.
2024-12-19Rollup merge of #134477 - lcnr:move-lint-into-subfn, r=lqd许杰友 Jieyou Xu (Joe)-29/+33
move lint_unused_mut into sub-fn also, stop `mem::take`-ing stuff we only use by reference :shrug:
2024-12-19Rollup merge of #134474 - oli-obk:push-yomnkntvzlxw, r=compiler-errors许杰友 Jieyou Xu (Joe)-26/+33
Forbid overwriting types in typeck While trying to figure out some type setting logic in https://github.com/rust-lang/rust/pull/134248 I realized that we sometimes set a type twice. While hopefully that would have been the same type, we didn't ensure that at all and just silently accepted it. So now we reject setting it twice, unless errors are happening, then we don't care. Best reviewed commit by commit. No behaviour change is intended.
2024-12-19Rollup merge of #134437 - onur-ozkan:improve-compiler-build, r=jieyouxu许杰友 Jieyou Xu (Joe)-30/+34
reduce compiler `Assemble` complexity `compile::Assemble` is already complicated by its nature (as it handles core internals like recursive building logic, etc.) and also handles half of `LldWrapper` tool logic for no good reason since it should be done in the build step directly. This change moves it there to reduce complexity of `compile::Assemble` logic.
2024-12-19Rollup merge of #134432 - GuillaumeGomez:intra-doc-in-footnotes, r=notriddle许杰友 Jieyou Xu (Joe)-16/+74
Fix intra doc links not generated inside footnote definitions Fixes #132208. The problem was that we were running the `Footnote` "pass" before the `LinkReplacer` one. Sadly, the change is bigger than it should because we can't specialize the `Iterator` trait implementation, forcing me to add a new type to handle the other `Iterator` kind (the one which still has the `Range`). r? ``@notriddle``
2024-12-19Rollup merge of #134427 - MarcoIeni:ci-remove-code-duplication, r=Kobzol许杰友 Jieyou Xu (Joe)-49/+41
ci: remove duplicate task definition 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 try-job: i686-gnu-1 try-job: i686-gnu-2 try-job: i686-gnu-nopt-1 try-job: i686-gnu-nopt-2
2024-12-19Rollup merge of #133702 - RalfJung:single-variant, r=oli-obk许杰友 Jieyou Xu (Joe)-164/+185
Variants::Single: do not use invalid VariantIdx for uninhabited enums ~~Stacked on top of https://github.com/rust-lang/rust/pull/133681, only the last commit is new.~~ Currently, `Variants::Single` for an empty enum contains a `VariantIdx` of 0; looking that up in the enum variant list will ICE. That's quite confusing. So let's fix that by adding a new `Variants::Empty` case for types that have 0 variants. try-job: i686-msvc
2024-12-19Auto merge of #133961 - lcnr:borrowck-cleanup, r=jackh726bors-66/+194
cleanup region handling: add `LateParamRegionKind` The second commit is to enable a split between `BoundRegionKind` and `LateParamRegionKind`, by avoiding `BoundRegionKind` where it isn't necessary. The third comment then adds `LateParamRegionKind` to avoid having the same late-param region for separate bound regions. This fixes #124021. r? `@compiler-errors`
2024-12-19coverage: Identify source files by ID, not by interned filenameZalathar-37/+33
2024-12-19coverage: Store coverage source regions as `Span` until codegenZalathar-217/+189
2024-12-19coverage: Quietly skip functions that end up having no mappingsZalathar-7/+2
In codegen, a used function with `FunctionCoverageInfo` but no mappings has historically indicated a bug. However, that will no longer be the case after moving some fallible span-processing steps into codegen.
2024-12-19coverage: Rename some FFI fields from `span` to `cov_span`Zalathar-9/+10
This will avoid confusion with actual `Span` spans.
2024-12-19Auto merge of #134492 - jhpratt:rollup-elpdwd9, r=jhprattbors-393/+718
Rollup of 8 pull requests Successful merges: - #132056 (Stabilize `#[diagnostic::do_not_recommend]`) - #133643 (-Znext-solver: modify candidate preference rules) - #134388 (Update books) - #134418 (Advent of `tests/ui` (misc cleanups and improvements) [3/N]) - #134473 (chore: fix some typos) - #134481 (Point at lint name instead of whole attr for gated lints) - #134484 (Add nnethercote to the `triagebot.toml` vacation list.) - #134490 (Fix typo in ptr/mod.rs) r? `@ghost` `@rustbot` modify labels: rollup
2024-12-19Make `TokenType::from_u32` foolproof.Nicholas Nethercote-115/+126
Currently it relies on having the right integer for every variant, and if you add a variant you need to adjust the integers for all subsequent variants, which is a pain. This commit introduces a match guard formulation that takes advantage of the enum-to-integer conversion to avoid specifying the integer for each variant. And it does this via a macro to avoid lots of boilerplate.