Commit Graph

268940 Commits

Author SHA1 Message Date
bors
662180b34d Auto merge of #131949 - Noratrieb:fxhashup-thanks-alona, r=WaffleLapkin
Update rustc-hash to version 2 but again

it's like #129533 but not closed by bors and rebased

r? WaffleLapkin meow
2024-10-20 19:01:54 +00:00
bors
de977a5acf Auto merge of #131970 - matthiaskrgr:rollup-nr32ksd, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #121560 (Allow `#[deny]` inside `#[forbid]` as a no-op)
 - #131365 (Fix missing rustfmt in msi installer #101993)
 - #131647 (Register `src/tools/unicode-table-generator` as a runnable tool)
 - #131843 (compiler: Error on layout of enums with invalid reprs)
 - #131926 (Align boolean option descriptions in `configure.py`)
 - #131961 (compiletest: tidy up how `tidy` and `tidy` (html version) are disambiguated)
 - #131962 (Make `llvm::set_section` take a `&CStr`)
 - #131964 (add latest crash tests)
 - #131965 (remove outdated comment)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-10-20 16:34:35 +00:00
Matthias Krüger
a860657c04
Rollup merge of #131965 - ChrisDenton:outdated-comment, r=jieyouxu
remove outdated comment

https://github.com/rust-lang/rust/issues/44234 was closed, apparently solved by https://github.com/rust-lang/rust/pull/45353
2024-10-20 16:54:13 +02:00
Matthias Krüger
5533c96132
Rollup merge of #131964 - matthiaskrgr:crashes2010, r=jieyouxu
add latest crash tests

r? `@jieyouxu`
2024-10-20 16:54:12 +02:00
Matthias Krüger
da8a11550c
Rollup merge of #131962 - Zalathar:llvm-set-section, r=Swatinem,workingjubilee
Make `llvm::set_section` take a `&CStr`

There's no reason to convert the section name to an intermediate `String`, when the LLVM-C API wants a C string anyway.

Follow-up to #131876.
2024-10-20 16:54:12 +02:00
Matthias Krüger
0d4cf0521e
Rollup merge of #131961 - jieyouxu:dirty, r=Zalathar
compiletest: tidy up how `tidy` and `tidy` (html version) are disambiguated

Rename `has_tidy` -> `has_html_tidy` (`tidy` is also a bootstrap tool, but rustdoc uses a html tidy that has the same binary name). Follow-up to #131941.

Also apparently `runtest.rs` is short enough now, we can delete the `tidy` (bootstrap version) ignore for file length.
2024-10-20 16:54:11 +02:00
Matthias Krüger
2f77343eec
Rollup merge of #131926 - clubby789:configure-enable, r=Kobzol
Align boolean option descriptions in `configure.py`

Boolean options are currently printed as
```
Options
        --enable-debug  OR  --disable-debug enables debugging environment; does not affect optimization of bootstrapped code
        --enable-docs  OR  --disable-docs build standard library documentation
        --enable-compiler-docs  OR  --disable-compiler-docs build compiler documentation
        --enable-optimize-tests  OR  --disable-optimize-tests build tests with optimizations
        --enable-verbose-tests  OR  --disable-verbose-tests enable verbose output when running tests
        --enable-ccache  OR  --disable-ccache invoke gcc/clang via ccache to reuse object files between builds
        --enable-sccache  OR  --disable-sccache invoke gcc/clang via sccache to reuse object files between builds
        --enable-local-rust  OR  --disable-local-rust use an installed rustc rather than downloading a snapshot
        --local-rust-root=VAL          set prefix for local rust binary
        --enable-local-rebuild  OR  --disable-local-rebuild assume local-rust matches the current version, for rebuilds; implies local-rust, and is implied if local-rust already matches the current version
```
as of #131117

imo, this is a little difficult to skim. This PR changes this to align the `OR`s and push the description onto a newline:

```
Options
        --enable-debug                     OR --disable-debug
                enables debugging environment; does not affect optimization of bootstrapped code
        --enable-docs                      OR --disable-docs
                build standard library documentation
        --enable-compiler-docs             OR --disable-compiler-docs
                build compiler documentation
        --enable-optimize-tests            OR --disable-optimize-tests
                build tests with optimizations
        --enable-verbose-tests             OR --disable-verbose-tests
                enable verbose output when running tests
        --enable-ccache                    OR --disable-ccache
                invoke gcc/clang via ccache to reuse object files between builds
        --enable-sccache                   OR --disable-sccache
                invoke gcc/clang via sccache to reuse object files between builds
        --enable-local-rust                OR --disable-local-rust
                use an installed rustc rather than downloading a snapshot
        --local-rust-root=VAL          set prefix for local rust binary
        --enable-local-rebuild             OR --disable-local-rebuild
                assume local-rust matches the current version, for rebuilds; implies local-rust, and is implied if local-rust already matches the current version
    ```
2024-10-20 16:54:10 +02:00
Matthias Krüger
6d43de643e
Rollup merge of #131843 - workingjubilee:thaw-impossible-reprs, r=lukas-code
compiler: Error on layout of enums with invalid reprs

Surprising no one, the ICEs with the same message have the same root cause.

Invalid reprs can reach layout computation for various reasons. For instance, the compiler may want to use its layout computations to discern if a combination of layout-affecting attributes results in a valid type to begin with by e.g. computing its size. When the input is bad, return an error reflecting that the answer to the question is not a useful one.
2024-10-20 16:54:10 +02:00
Matthias Krüger
fb42a4581b
Rollup merge of #131647 - jieyouxu:unicode-table-generator, r=Mark-Simulacrum
Register `src/tools/unicode-table-generator` as a runnable tool

It seems like `src/tools/unicode-table-generator` is not currently managed by bootstrap. This PR wires it up with bootstrap as a runnable tool.

This tool seems to take two possible args:

1. (Mandatory) path to `library/core/src/unicode/unicode_data.rs`, and
2. (Optional) path to generate a test file.

I only passed the mandatory path to `unicode_data.rs` in bootstrap and didn't do anything about (2). I'm not sure about how this tool is supposed to be run.

`Cargo.lock` is modified because I renamed `unicode-table-generator`'s bin name to match the tool name, as bootstrap's tool running logic expects the bin name to be derived from the tool name.

I also added a triagebot message to remind to not manually edit the library source file and edit the tool then regenerate instead, but this should probably be a tidy check (if that's desirable then that can be in a follow-up PR, though may be overkill).

Helps with #131640 but does not close it because still no docs.

r? `@Mark-Simulacrum` (since I think you authored this tool?)
2024-10-20 16:54:09 +02:00
Matthias Krüger
17ac4c8fb5
Rollup merge of #131365 - heiseish:fix-issue-101993, r=Mark-Simulacrum
Fix missing rustfmt in msi installer #101993

# Context
- Fixed missing `rustfmt`, `clippy`, `miri` and `rust-analyzer` in msi installer
- Fixed missing `rustfmt` for apple darwin installer
- Closes #101993

r​? `@jyn514`
- Please let me know if I should request from someone else instead. I divided the changes into 3 separate commits for the ease of review. The refactoring commit `fbdfd5c03c3c979bcf105ccdd05ff4ab9f37a763` is a bit more involved, but I think it helps in the long term for readability and to avoid bugs.
- I changed `build-manifest` to `build_manifest` in order to invoke it as a library. Not sure if this is gonna break any upstream processes. I checked `generate-manifest-list` and `generate-release` but didn't find any obvious reference
- Will push fixes for linting later
2024-10-20 16:54:09 +02:00
Matthias Krüger
7b714d4735
Rollup merge of #121560 - Noratrieb:stop-lint-macro-nonsense, r=jieyouxu
Allow `#[deny]` inside `#[forbid]` as a no-op

Forbid cannot be overriden. When someome tries to do this anyways, it results in a hard error. That makes sense.

Except it doesn't, because macros. Macros may reasonably use `#[deny]` (or `#[warn]` for an allow-by-default lint) in their expansion to assert that their expanded code follows the lint. This is doesn't work when the output gets expanded into a `forbid()` context. This is pretty silly, since both the macros and the code agree on the lint!

By making it a warning instead, we remove the problem with the macro, which is now nothing as warnings are suppressed in macro expanded code, while still telling users that something is up.

fixes #121483
2024-10-20 16:54:08 +02:00
Jubilee Young
9f4c9155d4 compiler: Reject impossible reprs during enum layout 2024-10-20 02:12:58 -07:00
Jubilee Young
68d1fd9427 compiler: pre-move code for fixing enum layout ICEs 2024-10-20 02:09:22 -07:00
Chris Denton
ef5a56f7bc
Remove outdated comment
#44234 is resolved
2024-10-20 08:34:25 +00:00
Matthias Krüger
eca5359b83 add latest crash tests 2024-10-20 10:05:39 +02:00
Noratrieb
0c8d81b4df Stop relying on hashmap iteration for unused macro rules arms 2024-10-20 00:12:52 -07:00
Noratrieb
3efd5926f6 Stop relying on hashmap iteration for hir stat printing
Just because the code says it's OK does not mean that it actually is OK.
Nodes with the same total size were not sorted, their order relied on
hashmap iteration.
2024-10-20 00:12:52 -07:00
Noratrieb
4348383a0f Update rustc-hash to version 2
This brings in the new algorithm.
2024-10-20 00:12:49 -07:00
许杰友 Jieyou Xu (Joe)
e32a5be3b0 compiletest: disambiguate between tidy and tidy (html version) 2024-10-20 14:30:52 +08:00
Zalathar
3310419d35 Make llvm::set_section take a &CStr 2024-10-20 17:08:05 +11:00
bors
bfab34af4c Auto merge of #131957 - GuillaumeGomez:rm-unused, r=notriddle
Remove unused `recoverable` argument in collect_intra_doc_links

r? `@notriddle`
2024-10-20 05:58:20 +00:00
bors
d68c327796 Auto merge of #131958 - Zalathar:rollup-gkuk3n1, r=Zalathar
Rollup of 4 pull requests

Successful merges:

 - #131876 (compiler: Use LLVM's Comdat support)
 - #131941 (compiletest: disambiguate html-tidy from rust tidy tool)
 - #131942 (compiler: Adopt rust-analyzer impls for `LayoutCalculatorError`)
 - #131945 (rustdoc: Clean up footnote handling)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-10-20 03:34:09 +00:00
Stuart Cook
456821be88
Rollup merge of #131945 - aDotInTheVoid:footnote-time, r=notriddle
rustdoc: Clean up footnote handling

Best reviewed commit by commit.

Extracts footnote handling logic into it's own file (first commit) and then makes that file slightly nicer to read/understand.

No functional changes, but lays the groundwork for making more changes to footnotes (eg #131901, #131946)
2024-10-20 14:06:05 +11:00
Stuart Cook
63fccf0c2f
Rollup merge of #131942 - workingjubilee:reduce-haruspicy, r=lukas-code,lnicola
compiler: Adopt rust-analyzer impls for `LayoutCalculatorError`

We're about to massively churn the internals of `rustc_abi`. To minimize the immediate and future impact on rust-analyzer, as a subtree that depends on this crate, grow some API on `LayoutCalculatorError` that reflects their uses of it. This way we can nest the type in theirs, and they can just call functions on it without having to inspect and flatten-out its innards.
2024-10-20 14:06:04 +11:00
Stuart Cook
28a5ef9175
Rollup merge of #131941 - lolbinarycat:compiletest-need-html-tidy, r=clubby789
compiletest: disambiguate html-tidy from rust tidy tool

when i first saw this error message i was very confused, i thought it was talking about `src/tools/tidy`.  now it should be much more clear what tool should be installed.
2024-10-20 14:06:03 +11:00
Stuart Cook
0bfc49b053
Rollup merge of #131876 - workingjubilee:llvm-c-c-c-comdat, r=Zalathar
compiler: Use LLVM's Comdat support

Acting on these long-ago issues:
- https://github.com/rust-lang/rust/issues/46437
- https://github.com/rust-lang/rust/issues/68955
2024-10-20 14:06:03 +11:00
Guillaume Gomez
3e67fbda5e Remove unused recoverable argument in collect_intra_doc_links 2024-10-20 04:46:29 +02:00
bors
54791efd82 Auto merge of #131911 - lcnr:probe-no-more-leak-2, r=compiler-errors
refactor fudge_inference, handle effect vars

this makes it easier to use fudging outside of `fudge_inference_if_ok`, which is likely necessary to handle inference variable leaks on rollback.

We now also uses exhaustive matches where possible and improve the code to handle effect vars.

r? `@compiler-errors` `@BoxyUwU`
2024-10-20 00:59:01 +00:00
bors
b596184f3b Auto merge of #131948 - matthiaskrgr:rollup-c9rvzu6, r=matthiaskrgr
Rollup of 12 pull requests

Successful merges:

 - #116863 (warn less about non-exhaustive in ffi)
 - #127675 (Remove invalid help diagnostics for const pointer)
 - #131772 (Remove `const_refs_to_static` TODO in proc_macro)
 - #131789 (Make sure that outer opaques capture inner opaques's lifetimes even with precise capturing syntax)
 - #131795 (Stop inverting expectation in normalization errors)
 - #131920 (Add codegen test for branchy bool match)
 - #131921 (replace STATX_ALL with (STATX_BASIC_STATS | STATX_BTIME) as former is deprecated)
 - #131925 (Warn on redundant `--cfg` directive when revisions are used)
 - #131931 (Remove unnecessary constness from `lower_generic_args_of_path`)
 - #131932 (use tracked_path in rustc_fluent_macro)
 - #131936 (feat(rustdoc-json-types): introduce rustc-hash feature)
 - #131939 (Get rid of `OnlySelfBounds`)

Failed merges:

 - #131181 (Compiletest: Custom differ)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-10-19 22:33:42 +00:00
Matthias Krüger
2ecfdbaea7
Rollup merge of #131939 - compiler-errors:predicate-filter, r=fmease
Get rid of `OnlySelfBounds`

We turn `PredicateFilter` into a newtyped bool called `OnlySelfBounds`. There's no reason to lose the information of the `PredicateFilter`, so let's just pass it all the way through.
2024-10-19 22:01:01 +02:00
Matthias Krüger
ab7e0d0bdd
Rollup merge of #131936 - jalil-salame:rustdoc-types-rustc-hash, r=aDotInTheVoid
feat(rustdoc-json-types): introduce rustc-hash feature

This allows the public `rustdoc-types` crate to expose this feature easily and allows consumers of the crate to get the performance advantages from doing so.

The reasoning for this was discussed on [Zulip][1]

Changes:
- Make `rustc-hash` optional but default to including it
- Rename all occurrences of `FxHashMap` to `HashMap`.
- Feature gate the import and rename the imported `FxHashMap` to `HashMap`
- Introduce a type alias `FxHashMap` which resolves to the currently used `HashMap` (`rustc_hash::FxHashMap` or `std::collections::HashMap`) for use in `src/librustdoc`.

[1]: https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/rustc-hash.20and.20performance.20of.20rustdoc-types

**extra context from the zulip thread:**

- `@obi1kenobi` requested benchmarks of the switch to `rustc-hash`
- I benchmarked switching `rustdoc-types` to `rustc-hash` which yielded a ~300ms improvement to `cargo-semver-checks`'s index building step (this step is done twice so the improvements are ~150ms per index).
- The benchmarks were presented in Zulip and people were in favor of introducing `rustc-hash` to the public `rustdoc-types` crate.
- There were differing opinions on how to introduce the dependency:
  1. "Hard" dependency: remove use of `std::collections::HashMap` in favor of `FxHashMap`.
  2. "Soft" dependency: make optional and introduce a feature then enable/disable it by default (this PR).
  3. ~~Make `rustdoc-types` generic and expose the `RandomState`~~ (a lot of work & complexity for little gain over a feature gate).

`@obi1kenobi` and I prefer the feature gate so that is what I am adding here.

My reasons for the preference are:
- `cargo-semver-checks` is especially perf sensitive, we don't expect people to care about ~150ms extra time when reading in a 500MB file (the size of the sample we used for benchmarking).
- Keeping `rustdoc-types` lean by having its only direct dependency be `serde` is nice for the general consumer of the crate.
- `rustc-hash` is not HashDOS resistant (but it is questionable whether `rustdoc-types` would be used on adversarial inputs).

r? `@aDotInTheVoid`
2024-10-19 22:01:00 +02:00
Matthias Krüger
d077d9b868
Rollup merge of #131932 - usamoi:tracked-path, r=Nadrieril
use tracked_path in rustc_fluent_macro

According to comments in https://github.com/rust-lang/rust/issues/99515#issuecomment-2135003881, the trick used in `rustc_fluent_macro` may be broken by caching decl macros. So use `proc_macro::tracked_path::path` to ensure it works.
2024-10-19 22:01:00 +02:00
Matthias Krüger
426e90682e
Rollup merge of #131931 - compiler-errors:constness-valid, r=fmease
Remove unnecessary constness from `lower_generic_args_of_path`

We pass `NotConst` to all callsites of `lower_generic_args_of_path` except for `lower_poly_trait_ref`, so let's not do that.
2024-10-19 22:00:59 +02:00
Matthias Krüger
efd940d24a
Rollup merge of #131925 - clubby789:redundant-revision-cfg, r=jieyouxu
Warn on redundant `--cfg` directive when revisions are used

r? ``@jieyouxu``

Fixes #131390
Not sure of the best way to test this
2024-10-19 22:00:59 +02:00
Matthias Krüger
d881cc6723
Rollup merge of #131921 - klensy:statx_all, r=ChrisDenton
replace STATX_ALL with (STATX_BASIC_STATS | STATX_BTIME) as former is deprecated

STATX_ALL was deprecated in 581701b7ef and suggested to use equivalent (STATX_BASIC_STATS | STATX_BTIME) combination, to prevent future surprises.
2024-10-19 22:00:58 +02:00
Matthias Krüger
91e46844c8
Rollup merge of #131920 - clubby789:108395-test, r=jieyouxu
Add codegen test for branchy bool match

Closes #108395
2024-10-19 22:00:58 +02:00
Matthias Krüger
559f8ce726
Rollup merge of #131795 - compiler-errors:expectation, r=Nadrieril
Stop inverting expectation in normalization errors

We have some funky special case logic to invert the expectation and actual type for normalization errors depending on their cause code. IMO most of the error messages get better, except for `try {}` blocks' type expectations. I think that these need to be special cased in some other way, rather than via this hack.

Fixes #131763
2024-10-19 22:00:57 +02:00
Matthias Krüger
bc22740882
Rollup merge of #131789 - compiler-errors:capture-more, r=fmease
Make sure that outer opaques capture inner opaques's lifetimes even with precise capturing syntax

When lowering an opaque, we must capture and duplicate all of the lifetimes in the opaque's bounds to correctly lower the opaque's bounds. We do this *even if* the lifetime is not captured according to the `+ use<>` precise capturing bound; in that case, we will later reject that captured lifetime. For example, Given an opaque like `impl Sized + 'a + use<>`, we will still duplicate `'a` but later error that it is not mentioned in the `use<>` bound.

The current heuristic was not properly handling cases like:

```
//@ edition: 2024
fn foo<'a>() -> impl Trait<Assoc = impl Trait2> + use<> {}
```

Which forces the outer `impl Trait` to capture `'a` since `impl Trait2` *implicitly* captures `'a` due to the new lifetime capture rules for edition 2024. We were only capturing lifetimes syntactically mentioned in the bounds. (Note that this still is an error; we just need to capture `'a` so it is handled later in the compiler correctly -- hence the ICE in #131769 where a late-bound lifetime was being referenced outside of its binder).

This PR reworks the way we collect lifetimes to capture and duplicate in AST lowering to fix this.

Fixes #131769
2024-10-19 22:00:57 +02:00
Matthias Krüger
e0b8e787c1
Rollup merge of #131772 - GnomedDev:remove-proc_macro-todo, r=petrochenkov
Remove `const_refs_to_static` TODO in proc_macro

Noticed this TODO, and with `const_refs_to_static` being stable now we can sort it out.
2024-10-19 22:00:56 +02:00
Matthias Krüger
268fa31596
Rollup merge of #127675 - chenyukang:yukang-fix-127562-addr, r=petrochenkov
Remove invalid help diagnostics for const pointer

Partially addresses #127562
2024-10-19 22:00:55 +02:00
Matthias Krüger
b2d132f10e
Rollup merge of #116863 - workingjubilee:non-exhaustive-is-not-ffi-unsafe, r=jieyouxu
warn less about non-exhaustive in ffi

Bindgen allows generating `#[non_exhaustive] #[repr(u32)]` enums. This results in nonintuitive nonlocal `improper_ctypes` warnings, even when the types are otherwise perfectly valid in C.

Adjust for actual tooling expectations by avoiding warning on simple enums with only unit variants.

Closes https://github.com/rust-lang/rust/issues/116831
2024-10-19 22:00:54 +02:00
bors
da935398d5 Auto merge of #131907 - saethlin:update-compiler-builtins, r=tgross35
Update `compiler-builtins` to 0.1.134

I'm modeling this PR after https://github.com/rust-lang/rust/pull/131314.

This pulls in https://github.com/rust-lang/compiler-builtins/pull/713 which should mitigate the problem reported and discussed in https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Hello.20World.20on.20sparc-unknown-none-elf.20crashes
2024-10-19 20:00:08 +00:00
Alona Enraght-Moony
9435afc0fb rustdoc: Refractor footnote handling 2024-10-19 19:24:54 +00:00
binarycat
53974b1786 compiletest: disambiguate html-tidy from rust tidy tool 2024-10-19 13:11:26 -05:00
Jubilee Young
e1d6164607 rust-analyzer: Nest LayoutCalculatorError in hir_ty::LayoutError 2024-10-19 11:09:24 -07:00
Jubilee Young
6a834b4df8 compiler: Adopt rust-analyzer impls for LayoutCalculatorError 2024-10-19 11:09:09 -07:00
Michael Goulet
70746d078e Make sure that outer opaques capture inner opaques's lifetimes even with precise capturing syntax 2024-10-19 18:02:26 +00:00
Michael Goulet
9989b1b0d5 Use PredicateFilter instead of OnlySelfBounds 2024-10-19 18:02:11 +00:00
Jubilee Young
492760020e llvm: Delete LLVMRustSetComdat 2024-10-19 10:46:10 -07:00
Jubilee Young
45d61b0d26 cg_llvm: Reuse LLVM-C Comdat support
Migrate `llvm::set_comdat` and `llvm::SetUniqueComdat` to LLVM-C FFI.

Note, now we can call `llvm::set_comdat` only when the target actually
supports adding comdat. As this has no convenient LLVM-C API, we
implement this as `TargetOptions::supports_comdat`.

Co-authored-by: Stuart Cook <Zalathar@users.noreply.github.com>
2024-10-19 10:46:10 -07:00