Commit Graph

242491 Commits

Author SHA1 Message Date
Taiki Endo
2c23c06c32 rc: Take *const T in is_dangling
It is not important which one is used since `is_dangling` does not access
memory, but `*const` removes the needs of `*const T` -> `*mut T` casts
in `from_raw_in`.
2023-12-30 16:28:00 +09:00
bors
fe2cfd4505 Auto merge of #119367 - Mark-Simulacrum:relative-spans, r=wesleywiser
Shrink span encoding further

Spans are now stored in a more compact form which cuts down on at least 1 byte per span (indirect/direct encoding) and at most 3 bytes per span (indirect/direct encoding, context byte, length byte). As a result, libcore metadata shrinks by 1.5MB.

I'm not a huge fan of the fairly manual encoding/decoding from bits implemented here. Something like Tokio's pack abstraction (https://github.com/tokio-rs/tokio/blob/master/tokio/src/util/bit.rs) might be desirable to cut down on some of the shifting etc. We might also say that this isn't worth doing :)

I took a look at copying the span encoding we use in memory (described [here](https://github.com/rust-lang/rust/blob/master/compiler/rustc_span/src/span_encoding.rs)). I think the format there makes a lot more sense for in-memory storage where prioritizing a fixed length (i.e., 4 or 8 bytes) is much more important. In metadata, it's much easier for us to have variable-length values, so there's less of a cliff if we don't quite fit. The bit packing scheme there would need changes to fit the varint scheme since it has a lot of all-1s patterns as the "relative offset" form.
2023-12-30 05:43:39 +00:00
bors
8d76d07666 Auto merge of #116012 - cjgillot:gvn-const, r=oli-obk
Implement constant propagation on top of MIR SSA analysis

This implements the idea I proposed in https://github.com/rust-lang/rust/pull/110719#issuecomment-1718324700

Based on https://github.com/rust-lang/rust/pull/109597

The value numbering "GVN" pass formulates each rvalue that appears in MIR with an abstract form (the `Value` enum), and assigns an integer `VnIndex` to each. This abstract form can be used to deduplicate values, reusing an earlier local that holds the same value instead of recomputing. This part is proposed in #109597.

From this abstract representation, we can perform more involved simplifications, for example in https://github.com/rust-lang/rust/pull/111344.

With the abstract representation `Value`, we can also attempt to evaluate each to a constant using the interpreter. This builds a `VnIndex -> OpTy` map. From this map, we can opportunistically replace an operand or a rvalue with a constant if their value has an associated `OpTy`.

The most relevant commit is [Evaluated computed values to constants.](2767c4912e)"

r? `@oli-obk`
2023-12-30 03:45:58 +00:00
Mark Rousskov
09e619d62e Shrink span encoding further
Spans are now stored in a more compact form which cuts down on at least
1 byte per span (indirect/direct encoding) and at most 3 bytes per span
(indirect/direct encoding, context byte, length byte). As a result,
libcore metadata shrinks by 1.5MB.
2023-12-29 21:52:53 -05:00
bors
03b50195ab Auto merge of #119421 - matthiaskrgr:rollup-dbera1b, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #119322 (Couple of random coroutine pass simplifications)
 - #119374 (Italicise "bytes" in the docs of some `Vec` methods)
 - #119388 (rustc_lint: Prevent triplication of various lints)
 - #119406 (Add non-regression test for ATPIT ICE #114325)
 - #119410 (Rename test to be more descriptive)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-12-30 01:44:41 +00:00
Urgau
a25e0236df Fix invalid check-cfg Cargo feature diagnostic help 2023-12-30 01:06:03 +01:00
Urgau
621e241748 Add check-cfg test for Cargo feature without value 2023-12-30 01:04:15 +01:00
onur-ozkan
48309f4c9f apply bootstrap lock unconditionally
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2023-12-30 00:50:19 +03:00
onur-ozkan
ca9950d3a0 bootstrap: bump fd-lock
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2023-12-30 00:43:11 +03:00
Miguel Ojeda
dd928c8f75 Primitive docs: fix confusing Send in &T's list
The two lists in this document describe what traits are implemented on
references when their underlying `T` also implements them. However,
while it is true that `T: Send + Sync` implies `&T: Send` (which is
what the sentence is trying to explain), it is confusing to have `Send`
in the list because `T: Send` is not needed for that. In particular,
the "also require" part may be interpreted as "both `T: Send` and
`T: Sync` are required".

Instead, move `Send` back to where it was before commit 7a477869b7
("Makes docs for references a little less confusing"), i.e. to the `&mut`
list (where no extra nota is needed, i.e. it fits naturally) and move the
`Sync` definition/note to the bottom as something independent.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2023-12-29 22:26:23 +01:00
Matthias Krüger
bfc1643071
Rollup merge of #119410 - est31:fix_if_guard_unused, r=Nilstrieb
Rename test to be more descriptive

As suggested in https://github.com/rust-lang/rust/pull/119402#discussion_r1438171079

r? ``@Nilstrieb``
2023-12-29 21:40:24 +01:00
Matthias Krüger
7c5c948f2e
Rollup merge of #119406 - lqd:issue-114325, r=compiler-errors
Add non-regression test for ATPIT ICE #114325

ATPIT issue #114325 had been unknowingly fixed by https://github.com/rust-lang/rust/pull/107421, so this PR adds its [MCVE](https://github.com/rust-lang/rust/issues/114325#issuecomment-1721561552) as a non-regression test.

Closes #114325.
2023-12-29 21:40:23 +01:00
Matthias Krüger
c8d42740c5
Rollup merge of #119388 - Enselic:prevent-lint-triplication, r=cjgillot
rustc_lint: Prevent triplication of various lints

Prevent triplication of various lints. The triplication happens because we run the same lint three times (or less in some cases):
* In `BuiltinCombinedPreExpansionLintPass`
* In `BuiltinCombinedEarlyLintPass`
* In `shallow_lint_levels_on()`

Only run the lints one time by checking the `lint_added_lints` bool.

Set your GitHub diff setting to ignore whitespaces changes when reviewing this PR, since I had to enclose a block inside an if.

Closes #73301

(I found this while exploring the code related to [this](https://github.com/rust-lang/rust/pull/119251#discussion_r1435677330) comment.)
2023-12-29 21:40:23 +01:00
Matthias Krüger
ef55e757b3
Rollup merge of #119374 - gurry:119149-improve-vec-docs, r=cuviper
Italicise "bytes" in the docs of some `Vec` methods

On a cursory read it's easy to miss that the limit is in terms of bytes not no. of elements. The italics should help with that.

Fixes #119149
2023-12-29 21:40:22 +01:00
Matthias Krüger
b75ba15062
Rollup merge of #119322 - compiler-errors:async-gen-resume-ty, r=cjgillot
Couple of random coroutine pass simplifications

Just aesthetic changes, except for a random `Ty::new_task_context(tcx)` call that was redundant.
2023-12-29 21:40:22 +01:00
bors
3cdd004e55 Auto merge of #118911 - Young-Flash:fix_issue_118819, r=fmease
fix: correct the args for `disambiguate the associated function` diagnostic

This is somehow silimar to https://github.com/rust-lang/rust/pull/118502, we shouldn't take receiver as first arg all the cases.

close https://github.com/rust-lang/rust/issues/118819
2023-12-29 18:39:23 +00:00
bors
e1e4626ff5 Auto merge of #16206 - cuishuang:master, r=lnicola
Fix some comments
2023-12-29 18:09:02 +00:00
bors
29abb90bbf Auto merge of #119373 - Kobzol:missing-tools-bootstrap, r=onur-ozkan
Remove usage of deprecated `missing-tools` bootstrap flag

This PR removes the usage of `--enable-missing-tools` in CI, as this config option is no longer used. It also removes `dist.missing-tools` config completely.

Let me know which commits should I remove (if any).

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

r? `@onur-ozkan`
2023-12-29 16:35:36 +00:00
Tetsuharu Ohzeki
efc87092b3 Use Cargo's [workspace.lints.*] to config clippy 2023-12-29 23:51:32 +09:00
bors
dc450f9dcb Auto merge of #119259 - cjgillot:single-crate-id, r=Mark-Simulacrum
Only store StableCrateId once in DefPathTable.

https://github.com/rust-lang/rust/pull/119238 made me think of this.

cc `@Mark-Simulacrum`
2023-12-29 14:37:40 +00:00
Tetsuharu Ohzeki
25444cdd04 Bump rust-version to 1.74 2023-12-29 23:23:34 +09:00
est31
740378cdde Rename test 2023-12-29 13:49:23 +01:00
bors
1a7e97f1ef Auto merge of #119387 - flip1995:clippy-subtree-sync, r=matthiaskrgr
Clippy subtree update

r? `@Manishearth`
2023-12-29 12:39:43 +00:00
bors
b74f5c4e8b Auto merge of #119407 - matthiaskrgr:rollup-bsoz7bn, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #119375 (Merge Coroutine lowering functions)
 - #119393 (Use filter instead of filter_map in Parser::expected_one_of_not_found)
 - #119401 (coverage: Avoid a possible query stability hazard in `CoverageCounters`)
 - #119402 (Also walk bindings created by if-let guards)
 - #119404 (Enable profiler in dist-powerpc-linux)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-12-29 10:41:45 +00:00
Matthias Krüger
761e0589c2
Rollup merge of #119404 - ecnelises:ppc_profiler, r=Kobzol
Enable profiler in dist-powerpc-linux
2023-12-29 11:19:29 +01:00
Matthias Krüger
efd9fd66ba
Rollup merge of #119402 - est31:fix_if_guard_unused, r=compiler-errors
Also walk bindings created by if-let guards

This change makes the `unused_variables` lint pick up unused bindings created by if-let guards.

Fixes #119383
2023-12-29 11:19:28 +01:00
Matthias Krüger
4b9a76cddf
Rollup merge of #119401 - Zalathar:query-stability, r=Nilstrieb
coverage: Avoid a possible query stability hazard in `CoverageCounters`

#119252 revealed a possible query stability hazard in `CoverageCounters`: we iterate over the entries of an `FxHashMap` in a way that allows the iteration order to potentially affect the relative creation order of MIR blocks.

I'm not sure whether there's an actual stability problem or not in practice, but it's certainly a hazard, and I don't see any reason not to switch over to `FxIndexMap` to avoid potential issues.

---

This can either be merged on its own, or incorporated into #119252.

cc `@Enselic`
r? `@cjgillot`
2023-12-29 11:19:28 +01:00
Matthias Krüger
12ad777221
Rollup merge of #119393 - DaniPopes:unmap-a-filter, r=Nilstrieb
Use filter instead of filter_map in Parser::expected_one_of_not_found
2023-12-29 11:19:27 +01:00
Matthias Krüger
559c864904
Rollup merge of #119375 - Swatinem:merge-coroutine-lowering, r=compiler-errors
Merge Coroutine lowering functions

Instead of having separate `make_async/etc_expr` functions, this merges them them into one, reducing code duplication a bit.
2023-12-29 11:19:27 +01:00
Rémy Rakic
21e8710ed3 add non-regression test for issue 114325 2023-12-29 10:01:53 +00:00
Qiu Chaofan
f7ed423f50 Enable profiler in dist-powerpc-linux 2023-12-29 16:50:24 +08:00
onur-ozkan
8dd6faca46 don't return suggestion message if no changes detected
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2023-12-29 10:45:58 +03:00
onur-ozkan
f521b4c5c1 suppress change-tracker warnings in containers
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2023-12-29 10:45:48 +03:00
Gurinder Singh
e3aca01343 Italicise "bytes" in the docs of some Vec methods
because on a cursory read it's easy to miss that the limit is
in terms of bytes not no. of elements. The italics should help
with that.
2023-12-29 09:53:29 +05:30
bors
95613d1b23 Auto merge of #119392 - compiler-errors:args-parts, r=Nilstrieb
make `ClosureArgsParts` and `CoroutineArgsParts` not generic

I hope a few extra calls to `expect_ty` will not affect perf...
2023-12-29 04:21:41 +00:00
cui fliter
638df27f99 Fix some comments
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-12-29 11:50:24 +08:00
est31
ab60a7df64 Also walk bindings created by if-let guards 2023-12-29 03:38:09 +01:00
bors
dfb1f5e37b Auto merge of #119395 - Nilstrieb:walk-pat, r=est31
Use `Pat::walk_always` instead of manual walk

It's also a bit faster, but I doubt that it will have a noticeable perf impact. Mostly doing it because it's shorter and nicer.
2023-12-29 02:03:10 +00:00
Zalathar
8529b63e2b coverage: Avoid a possible query stability hazard in CoverageCounters
The iteration order of this hashmap can potentially affect the relative
creation order of MIR blocks.
2023-12-29 12:33:52 +11:00
Michael Goulet
d71f7be218 Couple of random coroutine pass simplifications 2023-12-29 00:19:33 +00:00
bors
63623043f7 Auto merge of #119378 - onur-ozkan:utilize-llvm-tools, r=albertlarsan68
utilize the unused `llvm-tools` option

This field was not functioning as described in its comment in `config.example.toml`. Also, updated the default value to `true` to keep the bootstrapping behavior as it was before.

cc `@Zalathar`
2023-12-29 00:04:34 +00:00
Nilstrieb
8fe4d0d156 Use Pat::walk_always instead of manual walk 2023-12-28 23:21:55 +01:00
bors
fb5ed726f7 Auto merge of #119174 - compiler-errors:movability, r=cjgillot
Remove movability from `TyKind::Coroutine`

There's no reason to store movability in the generator struct directly. It is computed from the HIR, and can be pulled into a query to access when necessary.
2023-12-28 20:41:44 +00:00
Arpad Borsos
2480a0f3f6
Merge Coroutine lowering functions
Instead of having separate `make_async/etc_expr` functions, this merges them them into one, reducing code duplication a bit.
2023-12-28 21:24:24 +01:00
DaniPopes
c7a67747d3
Use filter instead of filter_map in Parser::expected_one_of_not_found 2023-12-28 21:19:41 +01:00
Michael Goulet
2b69399fea make ClosureArgsParts not generic 2023-12-28 20:17:09 +00:00
Jakub Beránek
fdeb8c5027
Remove is_optional_tool from ToolBuild 2023-12-28 20:23:16 +01:00
Jakub Beránek
0e7f9ec2ca
Add change tracker entry 2023-12-28 20:23:12 +01:00
Martin Nordholts
7ca4e9fcb2 rustc_lint: Prevent triplication of 'unknown lint' lint 2023-12-28 19:46:51 +01:00
Martin Nordholts
741884dab2 rustc_lint: Prevent multiple 'incompatible with previous forbid' lints 2023-12-28 19:46:40 +01:00