Commit Graph

242491 Commits

Author SHA1 Message Date
Michael Woerister
077540cedf Address review comments and add back some #[inline] attrs from removed commits. 2024-01-04 13:51:06 +01:00
Michael Woerister
900a11bbec Provide generalized collect methods for UnordItems 2024-01-04 13:48:57 +01:00
Michael Woerister
5c8eee4275 Make iteration order of collect_return_position_impl_trait_in_trait_tys query stable 2024-01-04 13:48:57 +01:00
Michael Woerister
5449638d7d Make iteration order of supported_target_features query stable 2024-01-04 13:48:57 +01:00
Michael Woerister
7d4f2ee817 Make iteration order of trimmed_def_paths query stable 2024-01-04 13:48:56 +01:00
Michael Woerister
36dd3d4524 Make iteration order of region_scope_tree query stable 2024-01-04 13:48:54 +01:00
Michael Woerister
d4a4c1dd28 Make iteration order of named_variable_map, late_bound_vars_map, and resolve_bound_vars queries stable 2024-01-04 13:37:21 +01:00
Michael Woerister
d189d3efbc Make iteration order of stability_index query stable 2024-01-04 13:37:21 +01:00
Michael Woerister
762e21f8c1 Make iteration order of wasm_import_module_map query stable 2024-01-04 13:37:21 +01:00
Michael Woerister
02c7717ba6 Make iteration order of inferred_outlives_crate query stable 2024-01-04 13:37:21 +01:00
Michael Woerister
0e934190fd Make iteration order of upstream_monomorphizations query stable 2024-01-04 13:37:21 +01:00
Michael Woerister
138cfab9f7 Make iteration order of crate_inherent_impls query result stable. 2024-01-04 13:37:18 +01:00
Michael Woerister
db132c575d Replace a number of FxHashMaps/Sets with stable-iteration-order alternatives. 2024-01-04 13:32:42 +01:00
Michael Woerister
739e5ef49e Split StableCompare trait out of StableOrd trait.
StableCompare is a companion trait to `StableOrd`. Some types like `Symbol` can be compared in a cross-session stable way, but their `Ord` implementation is not stable. In such cases, a `StableOrd` implementation can be provided to offer a lightweight way for stable sorting. (The more heavyweight option is to sort via `ToStableHashKey`, but then sorting needs to have access to a stable hashing context and `ToStableHashKey` can also be expensive as in the case of `Symbol` where it has to allocate a `String`.)
2024-01-04 13:32:42 +01:00
bors
090d5eac72 Auto merge of #119542 - lnicola:sync-from-ra2, r=lnicola
Subtree update of `rust-analyzer`

r? ghost
2024-01-04 07:23:39 +00:00
bors
139fb22146 Auto merge of #119549 - fmease:rollup-jxvbfes, r=fmease
Rollup of 21 pull requests

Successful merges:

 - #119086 (Query panic!() to useful diagnostic)
 - #119239 (Remove unnecessary arm in `check_expr_yield`)
 - #119298 (suppress change-tracker warnings in CI containers)
 - #119319 (Document that File does not buffer reads/writes)
 - #119434 (rc: Take *const T in is_dangling)
 - #119444 (Rename `TyCtxt::is_closure` to `TyCtxt::is_closure_or_coroutine`)
 - #119474 (Update tracking issue of naked_functions)
 - #119476 (Pretty-print always-const trait predicates correctly)
 - #119477 (rustdoc ui: adjust tooltip z-index to be above sidebar)
 - #119479 (Remove two unused feature gates from rustc_query_impl)
 - #119487 (Minor improvements in comment on `freshen.rs`)
 - #119492 (Update books)
 - #119494 (Deny defaults for higher-ranked generic parameters)
 - #119498 (Update deadlinks of `strict_provenance` lints)
 - #119505 (Don't synthesize host effect params for trait associated functions marked const)
 - #119510 (Report I/O errors from rmeta encoding with emit_fatal)
 - #119512 (Mark myself as back from leave)
 - #119514 (coverage: Avoid a query stability hazard in `function_coverage_map`)
 - #119523 (llvm: Allow `noundef` in codegen tests)
 - #119534 (Update `thread_local` examples to use `local_key_cell_methods`)
 - #119544 (Fix: Properly set vendor in i686-win7-windows-msvc target)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-01-03 18:37:41 +00:00
bors
1a47f5b448 Auto merge of #119485 - weihanglo:update-cargo, r=weihanglo
Update cargo

11 commits in ac6bbb33293d8d424c17ecdb42af3aac25fb7295..add15366eaf3f3eb84717d3b8b71902ca36a7c84
2023-12-26 23:22:08 +0000 to 2024-01-02 03:24:42 +0000
- chore(deps): update gix (rust-lang/cargo#13230)
- chore(deps): update alpine docker tag to v3.19 (rust-lang/cargo#13228)
- rustfix: Support inserting new lines. (rust-lang/cargo#13226)
- Fix fix::fix_in_dependency to not rely on rustc (rust-lang/cargo#13220)
- cleanup: Remove error-format special-case in `cargo fix` (rust-lang/cargo#13224)
- `cargo fix`: always inherit the jobserver (rust-lang/cargo#13225)
- Bump cargo-credential to 0.4.3 (rust-lang/cargo#13221)
- `cargo add` - fix for adding features from repository with multiple packages. (rust-lang/cargo#13213)
- Remove repetitive words (rust-lang/cargo#13216)
- Add cargo:rustc-cdylib-link-arg into RESERVED_PREFIXES list (rust-lang/cargo#13212)
- chore(doc): doc for custom subcommands look up. (rust-lang/cargo#13203)
2024-01-03 16:39:17 +00:00
León Orell Valerian Liehr
9b2a44adc2
Rollup merge of #119544 - roblabla:new-win7-targets, r=Nilstrieb
Fix: Properly set vendor in i686-win7-windows-msvc target

In #118150 , setting the `vendor` field of the `i686-win7-windows-msvc` target was forgotten, preventing us from easily checking the target using `cfg(target_vendor)`.

With this PR, we set the target vendor to "win7".
2024-01-03 16:08:33 +01:00
León Orell Valerian Liehr
a79fccc288
Rollup merge of #119534 - tgross35:thread-local-example-updates, r=JohnTitor
Update `thread_local` examples to use `local_key_cell_methods`

`local_key_cell_methods` has been stable for a while and provides a much less clunky way to interface with thread-local

Additionaly add context to the documentation about why types with interior mutability are needed.

r? libs
2024-01-03 16:08:33 +01:00
León Orell Valerian Liehr
fcec407f4a
Rollup merge of #119523 - maurer:fix-sparc-llvm-18, r=nikic
llvm: Allow `noundef` in codegen tests

LLVM 18 will automatically infer `noundef` in some situations. Adjust codegen tests to accept this.

See llvm/llvm-project#76553 for why `noundef` is being generated now.

``@rustbot`` label:+llvm-main
2024-01-03 16:08:32 +01:00
León Orell Valerian Liehr
ea39f19fab
Rollup merge of #119514 - Zalathar:query-stability, r=wesleywiser
coverage: Avoid a query stability hazard in `function_coverage_map`

When #118865 started enforcing the `rustc::potential_query_instability` lint in `rustc_codegen_llvm`, it added an exemption for this site, arguing that the entries are only used to create a list of filenames that is later sorted.

However, the list of entries also gets traversed when creating the function coverage records in LLVM IR, which may be sensitive to hash-based ordering.

This patch therefore changes `function_coverage_map` to use `FxIndexMap`, which should avoid hash-based instability by iterating in insertion order.

cc ``@Enselic``
2024-01-03 16:08:32 +01:00
León Orell Valerian Liehr
c2debecf98
Rollup merge of #119512 - oli-obk:unleave, r=oli-obk
Mark myself as back from leave
2024-01-03 16:08:31 +01:00
León Orell Valerian Liehr
a34754e7d5
Rollup merge of #119510 - saethlin:fatal-io-errors, r=WaffleLapkin,Nilstrieb
Report I/O errors from rmeta encoding with emit_fatal

https://github.com/rust-lang/rust/issues/119456 reminded me that I never did systematic testing to provoke the out-of-disk ICEs so I grepped through a recent crater run (https://github.com/rust-lang/rust/pull/119440#issuecomment-1873393963) for more out-of-disk ICEs on current master and yep there's 2 in there.

So I finally cooked up a way to provoke for these crashes. I wrote a little `cdylib` crate that has a `#[no_mangle] pub extern "C" fn write` which occasionally reports `ENOSPC`, and prints a backtrace when it does.
<details><summary><strong>code for the dylib</strong></summary>
<p>

```rust
// cargo add libc rand backtrace
use rand::Rng;

#[no_mangle]
pub extern "C" fn write(
    fd: libc::c_int,
    buf: *const libc::c_void,
    count: libc::size_t,
) -> libc::ssize_t {
    if fd > 2 && rand::thread_rng().gen::<u8>() == 0 {
        let mut count = 0;
        backtrace::trace(|frame| {
            backtrace::resolve_frame(frame, |symbol| {
                if let Some(name) = symbol.name() {
                    if count > 3 {
                        eprintln!("{}", name);
                    }
                }
                count += 1;
            });
            true
        });

        unsafe {
            *libc::__errno_location() = libc::ENOSPC;
        }
        return -1;
    } else {
        unsafe {
            let res =
                libc::syscall(libc::SYS_write, fd as usize, buf as usize, count as usize) as isize;
            if res < 0 {
                *libc::__errno_location() = -res as i32;
                -1
            } else {
                res
            }
        }
    }
}
```

</p>
</details>

Then `LD_PRELOAD` that dylib and repeatedly build a big project until it ICEs, such as with this:
```bash
while true; do
    cargo clean
    LD_PRELOAD=/home/ben/evil/target/release/libevil.so cargo +stage1 check 2> errors
    if grep "thread 'rustc' panicked" errors; then
        break
    fi
done
```
My "big project" for testing was an otherwise-empty project with `cargo add axum`.

Before this PR, the above procedure finds a crash in between 1 and 15 minutes. With this PR, I have not found a crash in 30 minutes, and I'll be leaving this to run overnight (starting now). (A night has now passed, no crashes were found)

I believe the problem is that even though since https://github.com/rust-lang/rust/pull/117301 we correctly check `FileEncoder` for errors on all paths, we use `emit_err`, so there is a window of time between the call to `emit_err` and the full error reporting where rustc believes it has emitted a valid rmeta file and will permit Cargo to launch a build for a dependent crate. Changing these calls to `emit_fatal` closes that window.

I think there are a number of other cases where `emit_err` has been used instead of the more-correct `emit_fatal` such as e51e98dde6/compiler/rustc_codegen_ssa/src/back/write.rs (L542) but unlike rmeta encoding I am not aware of those cases of those causing problems.

r? ``@WaffleLapkin``
2024-01-03 16:08:31 +01:00
León Orell Valerian Liehr
8bce6fc35e
Rollup merge of #119505 - fmease:no-host-param-for-trait-fns, r=fee1-dead
Don't synthesize host effect params for trait associated functions marked const

Fixes #113378.

r? fee1-dead or compiler
2024-01-03 16:08:30 +01:00
León Orell Valerian Liehr
39c2e6db3f
Rollup merge of #119498 - ShE3py:provenance-lints-doc, r=Nilstrieb
Update deadlinks of `strict_provenance` lints

Some hyperlinks on the following page redirect to 404 pages:
<https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html#explanation-5>

---

```@rustbot``` label +A-docs
2024-01-03 16:08:30 +01:00
León Orell Valerian Liehr
b5618bc222
Rollup merge of #119494 - fmease:deny-hr-param-defaults, r=compiler-errors
Deny defaults for higher-ranked generic parameters

Fixes #119489 (incl. https://github.com/rust-lang/rust/issues/119489#issuecomment-1873399208).
Partially reverts #119042.

cc ```@bvanjoi```
r? ```@compiler-errors``` or compiler
2024-01-03 16:08:29 +01:00
León Orell Valerian Liehr
14226154c4
Rollup merge of #119492 - rustbot:docs-update, r=ehuss
Update books

## rust-lang/reference

1 commits in f9f5b5babd95515e7028c32d6ca4d9790f64c146..3565c7978cfc9662f5963b135690ff9cbbfa0318
2023-12-29 21:01:19 UTC to 2023-12-29 21:01:19 UTC

- Use proper footnote for number literals `_` separator note (rust-lang/reference#1444)

## rust-lang/rust-by-example

1 commits in 4c2b24ff9d9cf19f2fcff799a3a49b9a2c50ae8e..c0be6299e52e4164c30ba6f41bd0ad0aaee64972
2023-12-21 15:22:11 UTC to 2023-12-21 15:22:11 UTC

- point to raw indentifiers, talking about fields (rust-lang/rust-by-example#1789)

## rust-lang/rustc-dev-guide

5 commits in 0610665a8687b1b0aa037917a1598b9f2a21e3ef..d13e85152a977cd0bcaf583cf5f49e86225697de
2023-12-30 09:58:25 UTC to 2023-12-19 10:02:34 UTC

- Prominently mention `profiler = true` on the coverage page (rust-lang/rustc-dev-guide#1844)
- Add a description of `unpretty=hir` to the HIR docs (rust-lang/rustc-dev-guide#1842)
- Fix typo in unsize docs (rust-lang/rustc-dev-guide#1843)
- Suggest `gcc_multi` to make `mir_opts` run on nixos (rust-lang/rustc-dev-guide#1841)
- bootstrapping: Clarify that stage0 std code is not executed to produce stage1 compiler (rust-lang/rustc-dev-guide#1840)
2024-01-03 16:08:29 +01:00
León Orell Valerian Liehr
5d6e35b811
Rollup merge of #119487 - gurry:improve-freshner-comment, r=Nilstrieb
Minor improvements in comment on `freshen.rs`

- Removed a stray "if"
- Changed a numeric "2" to "two" because it reads better
2024-01-03 16:08:28 +01:00
León Orell Valerian Liehr
394aaeed05
Rollup merge of #119479 - bjorn3:remove_unused_feature_gates, r=compiler-errors
Remove two unused feature gates from rustc_query_impl
2024-01-03 16:08:28 +01:00
León Orell Valerian Liehr
493792b37b
Rollup merge of #119477 - lukas-code:tooltip-z-index, r=notriddle
rustdoc ui: adjust tooltip z-index to be above sidebar

In https://github.com/rust-lang/rust/pull/115660 the sidebar's z-index was changed to 100. This PR changes the tooltip's z-index to 101 to be above the sidebar again.

Fixes [after beta-backport] https://github.com/rust-lang/rust/issues/119472.
2024-01-03 16:08:27 +01:00
León Orell Valerian Liehr
b41b16971c
Rollup merge of #119476 - fmease:pp-always-const-trait-preds, r=compiler-errors
Pretty-print always-const trait predicates correctly

Follow-up to #119099.

r? fee1-dead
2024-01-03 16:08:27 +01:00
León Orell Valerian Liehr
699a70bdbd
Rollup merge of #119474 - nbdd0121:naked, r=Nilstrieb
Update tracking issue of naked_functions

The original tracking issue #32408 was superseded by the new one #90957 (constrainted naked functions) and therefore is closed.
2024-01-03 16:08:26 +01:00
León Orell Valerian Liehr
3053ced813
Rollup merge of #119444 - compiler-errors:closure-or-coroutine, r=oli-obk
Rename `TyCtxt::is_closure` to `TyCtxt::is_closure_or_coroutine`

This function has always been used to test whether the def-id was a closure **or** coroutine: https://github.com/rust-lang/rust/pull/118311/files#diff-69ebec59f7d38331dd1be84ede7957977dcaa39e30ed2869b04aa8c99b2079ccR552 -- the name is just confusing because it disagrees with other fns named `is_closure`, like `Ty::is_closure`.

So let's rename it.
2024-01-03 16:08:26 +01:00
León Orell Valerian Liehr
34ef194859
Rollup merge of #119434 - taiki-e:rc-is-dangling, r=Mark-Simulacrum
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`.
2024-01-03 16:08:25 +01:00
León Orell Valerian Liehr
4e265d9fe0
Rollup merge of #119319 - chfogelman:buffered-file-doc, r=the8472
Document that File does not buffer reads/writes

...and refer to `BufReader`/`BufWriter`.

This is a common source of efficiency issues in Rust programs written naively. Including this information with the `File` docs, and adding a link to the wrapper types, will help discoverability.
2024-01-03 16:08:25 +01:00
León Orell Valerian Liehr
907922b472
Rollup merge of #119298 - onur-ozkan:silence-change-tracker-warning-for-ci, r=Mark-Simulacrum
suppress change-tracker warnings in CI containers

Fixes #119296
2024-01-03 16:08:24 +01:00
León Orell Valerian Liehr
893b6f6538
Rollup merge of #119239 - compiler-errors:yield-coercion, r=davidtwco
Remove unnecessary arm in `check_expr_yield`

We always set up the `resume_yield_tys` for async blocks and fns, so this arm was unreachable.
2024-01-03 16:08:24 +01:00
León Orell Valerian Liehr
093bd0888a
Rollup merge of #119086 - RossSmyth:query_panics, r=compiler-errors
Query panic!() to useful diagnostic

Changes some more ICEs from bare panic!()s

Adds an `expect_job()` helper method as that is a moral equivalent of what was happening at the uses.

re:#118955
2024-01-03 16:08:23 +01:00
Ross Smyth
0d421c5ace Add useful panic messages if queries fail to start 2024-01-03 09:51:58 -05:00
bors
2e79c8deb0 Auto merge of #119546 - jdno:temporarily-disable-m1-runners, r=Kobzol
Temporarily disable M1 runners on GitHub Actions

This commit temporarily reverts the addition of M1 runners on GitHub Actions to work around a billing issue related to their beta.

The runners for `dist-aarch64-apple` were originally changed in 821b03d767, and the `aarch64-apple` job was added in 6909992501.
2024-01-03 14:27:31 +00:00
Jan David
0f9844d10c
Temporarily disable M1 runners on GitHub Actions
This commit temporarily reverts the addition of M1 runners on GitHub
Actions to work around a billing issue related to their beta. It also
removes the `aarch64-apple` job, which was only added after the addition
of M1 runners. Since it has never been tested on the prior hardware, we
are skipping the tests to reduce the risk of build failures.
2024-01-03 15:20:03 +01:00
roblabla
d9d23fa68d Fix: Properly set vendor in i686-win7-windows-msvc target 2024-01-03 14:09:31 +01:00
Laurențiu Nicola
b91d1c0cf9 Add proc_macro_def_site to r-a ALLOW_FEATURES 2024-01-03 11:37:06 +02:00
Laurențiu Nicola
a8f2484733 Allow unexpected_cfgs in proc-macro-test imp 2024-01-03 11:36:05 +02:00
Laurențiu Nicola
f0108b9d5e Merge commit '426d2842c1f0e5cc5e34bb37c7ac3ee0945f9746' into sync-from-ra2 2024-01-03 11:35:07 +02:00
Trevor Gross
6f49080fa8 Update thread_local examples to use local_key_cell_methods
`local_key_cell_methods` has been stable for a while and provides a much less
clunky way to interface with thread-local variables.

Additionaly add context to the documentation about why types with interior
mutability are needed.
2024-01-02 22:24:26 -06:00
Matthew Maurer
ee86b1f84c llvm: Allow noundef in codegen tests
LLVM 18 will automatically infer `noundef` in some situations.
Adjust codegen tests to accept this.

See llvm/llvm-project#76553 for why `noundef` is being generated now.
2024-01-02 18:02:17 +00:00
Weihang Lo
dcc043ac2d
Update cargo 2024-01-02 10:45:55 -05:00
bors
426d2842c1 Auto merge of #16222 - rosefromthedead:unresolved-assoc-item, r=Veykril
add unresolved-assoc-item assist

I tried to copy from private-assoc-item for this
2024-01-02 15:06:13 +00:00
bors
86e559bf3f Auto merge of #16211 - tetsuharuohzeki:update-lint, r=Veykril
Use Cargo's [workspace.lints.*] to config clippy

This change begin to use [`[workspace.lints.*]`](https://doc.rust-lang.org/cargo/reference/workspaces.html#the-lints-table) that is stabilized since [Rust 1.74](https://blog.rust-lang.org/2023/11/16/Rust-1.74.0.html).

By this change, we make the configure more readable and simplify `xargo lint` more.
2024-01-02 14:53:22 +00:00