Commit Graph

278450 Commits

Author SHA1 Message Date
Jubilee
aa8bc2563e
Rollup merge of #134940 - compiler-errors:scrape, r=lcnr
Make sure to scrape region constraints from deeply normalizing type outlives assumptions in borrowck

Otherwise we're just randomly registering these region relations into the infcx which isn't good

r? lcnr
2025-01-14 19:56:30 -08:00
Jubilee
8f7e62268a
Rollup merge of #134913 - rhelmot:master, r=jieyouxu
bootstrap: do not rely on LIBRARY_PATH env variable

Closes https://github.com/rust-lang/rust/issues/134811

try-job: test-various
try-job: armhf-gnu
try-job: x86_64-apple-1
try-job: x86_64-apple-2
try-job: aarch64-apple
try-job: x86_64-msvc
try-job: i686-msvc
try-job: x86_64-mingw-1
try-job: x86_64-mingw-2
try-job: i686-mingw
2025-01-14 19:56:29 -08:00
bors
93ba568ab9 Auto merge of #135385 - rust-lang:cargo_update, r=clubby789
Weekly `cargo update`

Automation to keep dependencies in `Cargo.lock` current.

The following is the output from `cargo update`:

```txt

compiler & tools dependencies:
     Locking 27 packages to latest compatible versions
    Updating bitflags v2.6.0 -> v2.7.0
    Updating clap v4.5.23 -> v4.5.26
    Updating clap_builder v4.5.23 -> v4.5.26
    Updating clap_complete v4.5.40 -> v4.5.42
    Updating clap_derive v4.5.18 -> v4.5.24
    Updating handlebars v6.2.0 -> v6.3.0
    Updating libz-sys v1.1.20 -> v1.1.21
    Updating linux-raw-sys v0.4.14 -> v0.4.15
    Updating phf v0.11.2 -> v0.11.3
    Updating phf_codegen v0.11.2 -> v0.11.3
    Updating phf_generator v0.11.2 -> v0.11.3
    Updating phf_shared v0.11.2 -> v0.11.3
    Updating pin-project-lite v0.2.15 -> v0.2.16
    Updating proc-macro2 v1.0.92 -> v1.0.93
    Updating rustix v0.38.42 -> v0.38.43
    Updating serde_json v1.0.134 -> v1.0.135
      Adding siphasher v1.0.1
    Updating syn v2.0.94 -> v2.0.96
    Updating thiserror v2.0.9 -> v2.0.11
    Updating thiserror-impl v2.0.9 -> v2.0.11
    Updating tokio v1.42.0 -> v1.43.0
    Updating uuid v1.11.0 -> v1.11.1
    Updating wasm-encoder v0.222.0 -> v0.223.0
      Adding wasmparser v0.223.0
    Updating wast v222.0.0 -> v223.0.0
    Updating wat v1.222.0 -> v1.223.0
    Updating xattr v1.3.1 -> v1.4.0
note: pass `--verbose` to see 39 unchanged dependencies behind latest

library dependencies:
     Locking 0 packages to latest compatible versions
note: pass `--verbose` to see 4 unchanged dependencies behind latest

rustbook dependencies:
     Locking 27 packages to latest compatible versions
    Updating bitflags v2.6.0 -> v2.7.0
    Updating cc v1.2.7 -> v1.2.8
    Updating clap v4.5.23 -> v4.5.26
    Updating clap_builder v4.5.23 -> v4.5.26
    Updating clap_complete v4.5.40 -> v4.5.42
    Updating clap_derive v4.5.18 -> v4.5.24
      Adding darling v0.20.10
      Adding darling_core v0.20.10
      Adding darling_macro v0.20.10
      Adding derive_builder v0.20.2
      Adding derive_builder_core v0.20.2
      Adding derive_builder_macro v0.20.2
    Updating handlebars v6.2.0 -> v6.3.0
      Adding ident_case v1.0.1
    Updating linux-raw-sys v0.4.14 -> v0.4.15
    Updating phf v0.11.2 -> v0.11.3
    Updating phf_codegen v0.11.2 -> v0.11.3
    Updating phf_generator v0.11.2 -> v0.11.3
    Updating phf_shared v0.11.2 -> v0.11.3
    Updating proc-macro2 v1.0.92 -> v1.0.93
    Updating rustix v0.38.42 -> v0.38.43
    Updating serde_json v1.0.134 -> v1.0.135
      Adding siphasher v1.0.1
    Updating syn v2.0.94 -> v2.0.96
    Updating thiserror v2.0.9 -> v2.0.11
    Updating thiserror-impl v2.0.9 -> v2.0.11
    Updating winnow v0.6.22 -> v0.6.24
```
2025-01-15 03:54:21 +00:00
Trevor Gross
a911da13dd Use a C-safe return type for __rust_[ui]128_* overflowing intrinsics
Combined with [1], this will change the overflowing multiplication
operations to return an `extern "C"`-safe type.

Link: https://github.com/rust-lang/compiler-builtins/pull/735 [1]
2025-01-15 03:49:39 +00:00
cod10129
67f49010ad add tidy warning for unrecognized directives
This makes tidy warn on the presence of any directives it does not recognize.

There are changes in compiletest because that file used "tidy-alphabet" instead of "tidy-alphabetical".
2025-01-14 20:24:11 -06:00
bors
dd333ca66f Auto merge of #135180 - tgross35:update-builtins, r=tgross35
Update compiler-builtins to 0.1.141

0.1.141 syncs changes from `libm`. Most of the `libm` changes are testing- or configuration-related.
2025-01-14 23:46:20 +00:00
Chris Krycho
7bae381274
TRPL: incorporate all backward-compatible Edition changes
This incorporates all the backwards-compatible changes for the 2024
Edition. There will also be a follow-on PR to land revisions to the new
chapter on async so it can be as ready as possible when officially
released with 1.85 and the 2024 Edition.

Additionally, there are a few other, non-backward-compatible, changes
(largely around `use<..>`) we can only land using the stable edition,
which we may or may not be able to land in 1.85 by using the beta
toolchain in the example code. Those may or may not be ported over,
depending on how that does or does not play with the infrastructure.
2025-01-14 15:52:41 -07:00
Guillaume Gomez
62d5562bc6 Fix clippy lints 2025-01-14 23:32:17 +01:00
binarycat
4f6902d1ef fix underlining of hovered intra-doc links.
fixes https://github.com/rust-lang/rust/issues/133484
2025-01-14 15:16:19 -06:00
bors
8361aef0d7 Auto merge of #135496 - matthiaskrgr:rollup-ps0cjzn, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #134216 (Enable "jump to def" feature on patterns)
 - #134880 (Made `Path::name` only have item name rather than full name)
 - #135466 (Leak check in `impossible_predicates` to avoid monomorphizing impossible instances)
 - #135476 (Remove remnant of asmjs)
 - #135479 (mir borrowck: cleanup late-bound region handling)
 - #135493 (Fix legacy symbol mangling of closures)
 - #135495 (Add missing closing backtick in commit hook message 🐸)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-01-14 20:52:08 +00:00
Jakub Beránek
6ad9c1dc54 Run clippy for rustc_codegen_gcc 2025-01-14 21:21:38 +01:00
Michael Goulet
5775190dba Make sure to scrape region constraints from deeply normalizing type outlives assumptions in borrowck 2025-01-14 19:13:18 +00:00
Michael Goulet
2743df848b Enforce syntactical stability of const traits in HIR 2025-01-14 19:12:08 +00:00
Michael Goulet
b89a6e4932 Consider more erroneous layouts as LayoutError::ReferencesError to suppress spurious errors 2025-01-14 19:07:37 +00:00
Michael Goulet
2669f2a7c7 Do not consider traits that have unsatisfied const conditions to be conditionally const 2025-01-14 18:52:42 +00:00
Michael Goulet
3cd75812c8 Normalize field before checking PhantomData in coerce/dispatch impl validation 2025-01-14 18:47:23 +00:00
Michael Goulet
516a93353d Make sure we can produce ConstArgHasWrongType errors for valtree consts 2025-01-14 18:46:04 +00:00
Michael Goulet
3d9dcf4636 Un-spaghettify the control flow of generate_lint_output
Co-authored-by: Eric Huss <eric@huss.org>
2025-01-14 18:43:30 +00:00
Trevor Gross
fcc34b2c44 Update compiler-builtins to 0.1.141
0.1.141 syncs changes from `libm`. Most of the `libm` changes are
testing- or configuration-related.
2025-01-14 18:36:45 +00:00
Matthias Krüger
eb763f81a7
Rollup merge of #135495 - yotamofek:close-backtick, r=Kobzol
Add missing closing backtick in commit hook message 🐸

This has been really bugging me 😮‍💨
2025-01-14 19:25:09 +01:00
Matthias Krüger
f9c2c1256b
Rollup merge of #135493 - compiler-errors:legacy-mangle-closure, r=lqd
Fix legacy symbol mangling of closures

When this code was written, there was no `type_of` implementation for closures. That has long since been changed.

In the UI test:

```
trait A where
    [(); (|| {}, 1).1]: Sized,
{
}
```

We tried to walk up the def path tree for the closure, from closure -> anon const -> trait. When we reached the trait, we tried to call `type_of` on it which obviously doesn't do the right thing and ICEs.

Fixes #135418
2025-01-14 19:25:08 +01:00
Matthias Krüger
7354f6e73b
Rollup merge of #135479 - lcnr:method-calls-on-opaques, r=compiler-errors
mir borrowck: cleanup late-bound region handling

r? types
2025-01-14 19:25:07 +01:00
Matthias Krüger
e0e2f6a200
Rollup merge of #135476 - kleisauke:remove-asmjs-remnant, r=Kobzol
Remove remnant of asmjs

See: https://github.com/rust-lang/rust/issues/131467#issuecomment-2529314603.
2025-01-14 19:25:07 +01:00
Matthias Krüger
866e61aae0
Rollup merge of #135466 - compiler-errors:leak-check-impossible, r=lcnr
Leak check in `impossible_predicates` to avoid monomorphizing impossible instances

Fixes #135462

r? lcnr
2025-01-14 19:25:06 +01:00
Matthias Krüger
ca9a9d2f35
Rollup merge of #134880 - as1100k-forks:fix-rustdoc-json-path-name, r=aDotInTheVoid
Made `Path::name` only have item name rather than full name

Closes #134853

This PR makes `Path::name` to only have item name rather than full name, i.e. with the following code

```rust
pub mod foo {
    pub struct Bar;
}

pub fn get_bar() -> foo::Bar {
    foo::Bar
}
```
and running `./rustdoc ./demo.rs -wjson -Zunstable-options` gives:
```json
{
    "41": {
        "id": 41,
        "name": "get_bar",
        "inner": {
            "function": {
                "sig": {
                    "inputs": [],
                    "output": {
                        "resolved_path": {
                            "name": "Bar",
                            "id": 0,
                            "args": { "angle_bracketed": { "args": [], "constraints": [] }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
_Information which isn't useful here was trimmed_

r? aDotInTheVoid
2025-01-14 19:25:05 +01:00
Matthias Krüger
aeadee0642
Rollup merge of #134216 - GuillaumeGomez:jump-to-def-pats, r=fmease
Enable "jump to def" feature on patterns

Part of https://github.com/rust-lang/rust/issues/89095.

Pattern (as in "patterns in pattern matching") were not handled by the feature, it's now added.

It all started when I realized that prelude values like `Some` or `Err` were not getting a link generated either (added support for it in the first commit).

r? ``@fmease``
2025-01-14 19:25:04 +01:00
Michael Goulet
bf545ce2fe Prefer lower TraitUpcasting candidates 2025-01-14 17:59:54 +00:00
bors
3736b85779 Auto merge of #135313 - compiler-errors:needs-mono, r=BoxyUwU
Eagerly mono drop for structs with lifetimes

That is, use `!generics.requires_monomorphization()` rather than `generics.is_empty()` like the rest of the mono collector code.
2025-01-14 17:55:26 +00:00
Yotam Ofek
c141f506bc Add missing closing backtick in commit hook message 🐸 2025-01-14 17:25:22 +00:00
许杰友 Jieyou Xu (Joe)
98f673e93a tests: port extern-fn-reachable to rmake.rs
Co-authored-by: binarycat <binarycat@envs.net>
2025-01-15 01:05:16 +08:00
Michael Goulet
faafa5c310 Fix legacy symbol mangling of closures 2025-01-14 16:33:03 +00:00
binarycat
f5e23d5c7b fix typo and unit test 2025-01-14 09:51:55 -06:00
binarycat
244316f711 add disclaimer to --disable-minification 2025-01-14 08:54:55 -06:00
bors
8c39ce5b4f Auto merge of #135278 - tgross35:ignore-std-dep-crates, r=SparrowLii
Exclude dependencies of `std` for diagnostics

Currently crates in the sysroot can show up in diagnostic suggestions, such as in https://github.com/rust-lang/rust/issues/135232. To prevent this, duplicate `all_traits` into `visible_traits` which only shows traits in non-private crates.

Setting `#![feature(rustc_private)]` overrides this and makes items in private crates visible as well, since `rustc_private` enables use of `std`'s private dependencies.

This may be reviewed per-commit.

Fixes: https://github.com/rust-lang/rust/issues/135232
2025-01-14 14:15:39 +00:00
Nikita Popov
a40c659cef Update to LLVM 19.1.7 2025-01-14 14:46:09 +01:00
lcnr
99657aa338 mir borrowck: cleanup late-bound region handling 2025-01-14 14:16:12 +01:00
Zalathar
e70112caf8 Add DenseBitSet::union_not
This is similar to the existing `union`, except that bits in the RHS are
negated before being incorporated into the LHS.

Currently only `DenseBitSet` is supported. Supporting other bitset types is
possible, but non-trivial, and currently isn't needed.
2025-01-14 23:49:10 +11:00
Zalathar
1a23a6fd8b Add wrapper type ReversedGraph for swapping successors/predecessors 2025-01-14 23:49:10 +11:00
joboet
2c28cc45c8
add comments explaining main thread identification 2025-01-14 13:37:28 +01:00
joboet
1d25252604
make sure that the allocator is actually called in allocator test
Originally authored by GnomedDev
2025-01-14 13:37:28 +01:00
joboet
14f7f4b7bf
std: lazily allocate the main thread handle
Thereby, we also allow accessing thread::current before main: as the runtime no longer tries to install its own handle, this will no longer trigger an abort. Rather, the name returned from name will only be "main" after the runtime initialization code has run, but I think that is acceptable.

This new approach also requires some changes to the signal handling code, as calling `thread::current` would now allocate when called on the main thread, which is not acceptable. I fixed this by adding a new function (`with_current_name`) that performs all the naming logic without allocation or without initializing the thread ID (which could allocate on some platforms).
2025-01-14 13:37:28 +01:00
joboet
0e5ee891b2
Revert "Remove the Arc rt::init allocation for thread info"
This reverts commit 0747f2898e.
2025-01-14 13:37:25 +01:00
bors
c074d8eee7 Auto merge of #135442 - antoyo:subtree-update_cg_gcc_2025_01_12, r=GuillaumeGomez
Subtree update cg_gcc 2025/01/12

r? GuillaumeGomez
2025-01-14 11:28:34 +00:00
Oli Scherer
a907c56a77 Add hir::HeaderSafety to make follow up commits simpler 2025-01-14 10:54:11 +00:00
Kleis Auke Wolthuizen
3a66b97b9b Remove remnant of asmjs
See: https://github.com/rust-lang/rust/issues/131467#issuecomment-2529314603.
2025-01-14 10:49:32 +01:00
lcnr
94ffced667
add note to test 2025-01-14 10:06:22 +01:00
Trevor Gross
ed63539282 Mark dependencies of the standard library as private by default
In order to avoid diagnostics suggesting stdlib-private dependencies,
make everything that is a direct dependency of any `std` crates private
by default. Note that this will be overridden, if the same crate is
public elsewhere in the crate graph then that overrides the private
default.

It may also be feasible to do this in the library crate, marking `std`'s
dependencies private via Cargo. However, given that the feature is still
rather unstable, doing this within the compiler seems more
straightforward.

Fixes: https://github.com/rust-lang/rust/issues/135232 [1]
2025-01-14 08:51:19 +00:00
Trevor Gross
2da9accab9 Add tcx.visible_traits() and use it for producing diagnostics
Add an alternative to `tcx.all_traits()` that only shows traits that the
user might be able to use, for diagnostic purposes. With this available,
make use of it for diagnostics including associated type errors, which
is part of the problem with [1].

Includes a few comment updates for related API.

[1]: https://github.com/rust-lang/rust/issues/135232
2025-01-14 08:51:19 +00:00
Trevor Gross
9c34253762 Make #[rustc_private] override dependency visibility
Really this is always-visible override only needs to happen when the
crate is a dependency of itself. However, this is a very internal
feature, so it doesn't seem worth doing any additional filtering here.
2025-01-14 08:51:19 +00:00
Trevor Gross
4dc866c642 rustc_metadata: Rename root to dep_root
Currently `root` or `crate_root` is used to refer to an instance of
`CrateRoot` (representation of a crate's serialized metadata), but the
name `root` sometimes also refers to a `CratePath` representing a "root"
node in the dependency graph. In order to disambiguate, rename all
instances of the latter to `dep_root`.
2025-01-14 08:51:19 +00:00