1
Fork 0
Commit graph

277335 commits

Author SHA1 Message Date
Matthias Krüger
0e48e96e65
Rollup merge of #135171 - notriddle:notriddle/stable-path-is-better, r=GuillaumeGomez
rustdoc: use stable paths as preferred canonical paths

This accomplishes something like 16a4ad7d7b, but with the `rustc_allowed_through_unstable_modules` attribute instead of the path length.

Fixes #131676
2025-01-07 21:39:41 +01:00
Matthias Krüger
3e12d4d152
Rollup merge of #135149 - compiler-errors:mangle, r=oli-obk
Use a post-monomorphization typing env when mangling components that come from impls

When mangling associated methods of impls, we were previously using the wrong param-env. Instead of using a fully monomorphized param-env like we usually do in codegen, we were taking the post-analysis param-env, and treating it as an early binder to *re-substitute* the impl args. I've pointed out the problematic old code in an inline comment.

This would give us param-envs with possibly trivial predicates that would prevent normalization via param-env shadowing.

In the example test linked below, `tests/ui/symbol-names/normalize-in-param-env.rs`, this happens when we mangle the impl `impl<P: Point2> MyFrom<P::S> for P` with the substitution `P = Vec2`. Because the where clause of the impl is `P: Point2`, which elaborates to `[P: Point2, P: Point, <P as Point>::S projects-to <P as Point2>::S2]` and the fact that `impl Point2 for Vec2` normalizes `Vec2::S2` to `Vec2::S`, this causes a cycle.

The proper fix here is to use a fully monomorphized param-env for the case where the impl is properly substituted.

Fixes #135143

While #134081 uncovered this bug for legacy symbol mangling, it was preexisting for v0 symbol mangling. This PR fixes both. The test requires a "hack" because we strip the args of the instance we're printing for legacy symbol mangling except for drop glue, so we box a closure to ensure we generate drop glue.

r? oli-obk
2025-01-07 21:39:41 +01:00
Matthias Krüger
a20d0d5a5c
Rollup merge of #134989 - max-niederman:guard-patterns-hir, r=oli-obk
Lower Guard Patterns to HIR.

Implements lowering of [guard patterns](https://rust-lang.github.io/rfcs/3637-guard-patterns.html) (see the [tracking issue](#129967)) to HIR.
2025-01-07 21:39:40 +01:00
Matthias Krüger
c371a94e78
Rollup merge of #134745 - compiler-errors:better-arg-span-in-typeck, r=BoxyUwU
Normalize each signature input/output in `typeck_with_fallback` with its own span

Applies the same hack as #106582 but to the args in typeck. Greatly improves normalization error spans from a signature.
2025-01-07 21:39:39 +01:00
Matthias Krüger
191fb23940
Rollup merge of #133810 - lcnr:remove-verify_bound, r=compiler-errors
remove unnecessary `eval_verify_bound`

This does not impact any tests. I feel like any cases where this could useful should instead be fixed by a general improvement to `eval_verify_bound` to avoid having to promote this `TypeTest` in the first place 🤔

r? types cc ``@nikomatsakis``
2025-01-07 21:39:38 +01:00
bors
ad211ced81 Auto merge of #135202 - GuillaumeGomez:rollup-9xgs39t, r=GuillaumeGomez
Rollup of 9 pull requests

Successful merges:

 - #135081 (bootstrap: Build jemalloc with support for 64K pages)
 - #135174 ([AIX] Port test case run-make/reproducible-build )
 - #135177 (llvm: Ignore error value that is always false)
 - #135182 (Transmute from NonNull to pointer when elaborating a box deref (MCP807))
 - #135187 (apply a workaround fix for the release roadblock)
 - #135189 (Remove workaround from pull request template)
 - #135193 (don't bless `proc_macro_deps.rs` unless it's necessary)
 - #135198 (Avoid naming variables `str`)
 - #135199 (Eliminate an unnecessary `Symbol::to_string`; use `as_str`)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-01-07 15:22:00 +00:00
Guillaume Gomez
225ffebc0a
Rollup merge of #135199 - joshtriplett:unnecessary-to-string, r=lqd
Eliminate an unnecessary `Symbol::to_string`; use `as_str`
2025-01-07 15:30:28 +01:00
Guillaume Gomez
ec266207cb
Rollup merge of #135198 - joshtriplett:str-is-a-type, r=jieyouxu
Avoid naming variables `str`

This renames variables named `str` to other names, to make sure `str`
always refers to a type.

It's confusing to read code where `str` (or another standard type name)
is used as an identifier. It also produces misleading syntax
highlighting.
2025-01-07 15:30:28 +01:00
Guillaume Gomez
ccaa0f331c
Rollup merge of #135193 - onur-ozkan:tidy-cache-invalidation, r=jieyouxu
don't bless `proc_macro_deps.rs` unless it's necessary

Running tidy with `--bless` flag is breaking the build cache as tidy updates mtime of `proc_macro_deps.rs` (https://github.com/rust-lang/rust/pull/134865) unconditionally and that leads cargo to recompile tidy.

This patch fixes that.
2025-01-07 15:30:27 +01:00
Guillaume Gomez
ebf2e51c3e
Rollup merge of #135189 - Urgau:triagebot-html-ignored, r=lqd
Remove workaround from pull request template

This PR removes the workaround (`\`) from our pull request template as triagebot/rustbot now ignores HTML blocks.

cf. https://github.com/rust-lang/triagebot/pull/1869
cc `@jieyouxu`
r? `@ehuss`
2025-01-07 15:30:27 +01:00
Guillaume Gomez
2598d607b5
Rollup merge of #135187 - onur-ozkan:release-fix, r=pietroalbini
apply a workaround fix for the release roadblock

This has been a problem since the last two releases.

r? pietroalbini
2025-01-07 15:30:26 +01:00
Guillaume Gomez
a33da79fa9
Rollup merge of #135182 - scottmcm:box-deref-via-transmute, r=oli-obk
Transmute from NonNull to pointer when elaborating a box deref (MCP807)

Since per https://github.com/rust-lang/compiler-team/issues/807 we have to stop projecting into `NonNull`.

cc https://github.com/rust-lang/rust/issues/133652
2025-01-07 15:30:25 +01:00
Guillaume Gomez
020d8758f4
Rollup merge of #135177 - maurer:rename-module, r=nikic
llvm: Ignore error value that is always false

See llvm/llvm-project#121851

For LLVM 20+, this function (`renameModuleForThinLTO`) has no return value. For prior versions of LLVM, this never failed, but had a signature which allowed an error value people were handling.

`@rustbot` label: +llvm-main
r? `@nikic`

Wait a moment before approving while the llvm-main infrastructure picks it up.
2025-01-07 15:30:25 +01:00
Guillaume Gomez
2338e573e1
Rollup merge of #135174 - xingxue-ibm:reproducible-build-aix, r=jieyouxu
[AIX] Port test case run-make/reproducible-build

The test case `run-make/reproducible-build` verifies that two identical invocations of the compiler produce the same output by comparing the linker arguments, resulting binaries, and other artifacts. However, the AIX linker command includes an argument that specifies the file containing exported symbols, with a file path that contains a randomly generated substring to prevent collisions between different linking processes. Additionally, the AIX XCOFF file header includes a 4-byte timestamp. This PR replaces the random substring with a placeholder and nullifies the timestamp field in the XCOFF files for the comparisons.
2025-01-07 15:30:24 +01:00
Guillaume Gomez
2b97db2ff7
Rollup merge of #135081 - mrkajetanp:jemalloc-64k, r=Kobzol
bootstrap: Build jemalloc with support for 64K pages

By default, jemalloc is built to only support the same page size as the host machine. Set an env variable so that jemalloc is built with support for page sizes up to 64K regardless of the host machine.

r? `@Kobzol`

Resolves #134563
Potentially resolves #133748 (needs verification)

----

Results from local rustc-perf testing below, within 0.5% on every metric except max-rss.
AArch64:
![Screenshot 2025-01-03 at 5 53 13 pm](https://github.com/user-attachments/assets/71705c59-7d7b-4753-a184-8c784233e603)
x86_64:
![Screenshot 2025-01-03 at 5 54 16 pm](https://github.com/user-attachments/assets/ea28aded-3b90-43f4-a965-b081b07b95ab)
2025-01-07 15:30:23 +01:00
Josh Triplett
bb6bbfa13f Avoid naming variables str
This renames variables named `str` to other names, to make sure `str`
always refers to a type.

It's confusing to read code where `str` (or another standard type name)
is used as an identifier. It also produces misleading syntax
highlighting.
2025-01-07 14:30:02 +02:00
Josh Triplett
7cc99a864a Eliminate an unnecessary Symbol::to_string; use as_str 2025-01-07 14:24:47 +02:00
onur-ozkan
b0324cc108 don't bless proc_macro_deps.rs unless it's necessary
Running tidy with `--bless` flag is breaking the build cache as tidy updates mtime
of `proc_macro_deps.rs` unconditionally and that leads cargo to recompile tidy.

This patch fixes that.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-01-07 09:44:05 +00:00
bors
fb546ee09b Auto merge of #135173 - pietroalbini:pa-fix-rvp, r=workingjubilee
Avoid replacing the definition of `CURRENT_RUSTC_VERSION`

Before this PR, replace-version-placeholder hardcoded the path defining CURRENT_RUSTC_VERSION (to avoid replacing it). After a refactor moved the file defining it without changing the hardcoded path, the tool started replacing the constant itself with the version number.

To avoid this from happening in the future, this changes the definition of the constant to avoid the tool from ever matching it.

r? `@workingjubilee`
2025-01-07 07:21:09 +00:00
Urgau
70123283be Remove workaround from pull request template
as triagebot/rustbot now ignores HTML blocks.

cf. https://github.com/rust-lang/triagebot/pull/1869
2025-01-07 07:35:08 +01:00
onur-ozkan
614dc1c933 apply a workaround fix for the release blocker issue
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-01-07 09:12:54 +03:00
Kajetan Puchalski
53a5857fa3 bootstrap: Build jemalloc for AArch64 with support for 64K pages
By default, jemalloc is built to only support the same page size as the
host machine. For AArch64 targets, set an env variable so that jemalloc
is built with support for page sizes up to 64K regardless of the host machine.
2025-01-06 23:46:43 -05:00
bors
6f2ca607bc Auto merge of #135183 - jhpratt:rollup-qwg4pm0, r=jhpratt
Rollup of 9 pull requests

Successful merges:

 - #131830 (Add support for wasm exception handling to Emscripten target)
 - #132345 (Improve diagnostics for `HostEffectPredicate` in the new solver)
 - #134568 (Release notes for 1.84.0)
 - #134744 (Don't ice on bad transmute in typeck in new solver)
 - #135090 (Suggest to replace tuple constructor through projection)
 - #135116 (rustdoc: Fix mismatched capitalization in sidebar)
 - #135126 (mark deprecated option as deprecated in rustc_session to remove copypasta and small refactor)
 - #135139 ([generic_assert] Constify methods used by the formatting system)
 - #135170 (Update triagebot.toml: celinval vacation is over)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-01-07 04:35:05 +00:00
Jacob Pratt
ee55b347c9
Rollup merge of #135170 - celinval:chores-vacation-end, r=jieyouxu
Update triagebot.toml: celinval vacation is over

I'm also removing myself from the MIR syntax changes notifications.
2025-01-06 22:04:18 -05:00
Jacob Pratt
e78b1321e5
Rollup merge of #135139 - c410-f3r:8-years-rfc, r=jhpratt
[generic_assert] Constify methods used by the formatting system

cc #44838

Starts the "constification" of all the elements required to allow the execution of the formatting system in constant environments.

```rust
const _: () = { panic!("{:?}", 1i32); };
```

Further stuff is blocked by #133999.
2025-01-06 22:04:17 -05:00
Jacob Pratt
44808ae798
Rollup merge of #135126 - klensy:deprecated-and-do-nothing, r=jieyouxu
mark deprecated option as deprecated in rustc_session to remove copypasta and small refactor

This marks deprecated options as deprecated via flag in options table in rustc_session, which removes copypasted deprecation text from rustc_driver_impl.

This also adds warning for deprecated `-C ar` option, which didn't emitted any warnings before.
Makes `inline_threshold` `[UNTRACKED]`, as it do nothing.
Adds few tests.

See individual commits.
2025-01-06 22:04:17 -05:00
Jacob Pratt
1b370d32d6
Rollup merge of #135116 - camelid:sidebar-case, r=fmease
rustdoc: Fix mismatched capitalization in sidebar

Previously, the main content used "Aliased Type", while the sidebar said "Aliased type". Now, they both say "Aliased Type", which is the more common capitalization in Rustdoc.

See the following link for an example.
https://doc.rust-lang.org/1.83.0/std/io/type.Result.html
2025-01-06 22:04:16 -05:00
Jacob Pratt
8b54f951e5
Rollup merge of #135090 - compiler-errors:invalid-tuple-ctor-projection, r=lqd,jieyouxu
Suggest to replace tuple constructor through projection

See the code example. when `Self::Assoc` normalizes to a struct that has a tuple constructor, you cannot construct the type via `Self::Assoc(field, field)`. Instead, suggest to replace it with the correct named struct.

Fixes #120871
2025-01-06 22:04:15 -05:00
Jacob Pratt
3deb5c289e
Rollup merge of #134744 - compiler-errors:transmute-non-wf, r=lcnr
Don't ice on bad transmute in typeck in new solver

Old trait solver ends up getting its infcx tainted because we try to normalize the type, but the new trait solver doesn't. This means we try to compute the stalled transmute obligations, which tries to normalize a type an ICEs. Let's make this a delayed bug.

r? lcnr
2025-01-06 22:04:15 -05:00
Jacob Pratt
65f35be9fc
Rollup merge of #134568 - BoxyUwU:relnotes_1_84, r=pietroalbini
Release notes for 1.84.0

cc ``@rust-lang/release`` r? ``@Mark-Simulacrum``
2025-01-06 22:04:14 -05:00
Jacob Pratt
b642740e4f
Rollup merge of #132345 - compiler-errors:fx-diag, r=lcnr
Improve diagnostics for `HostEffectPredicate` in the new solver

Adds derived cause for host effect predicates. Some diagnostics regress, but that's connected to the fact that our predicate visitor doesn't play well with aliases just yet.
2025-01-06 22:04:13 -05:00
Jacob Pratt
4e4a93c2dd
Rollup merge of #131830 - hoodmane:emscripten-wasm-eh, r=workingjubilee
Add support for wasm exception handling to Emscripten target

This is a draft because we need some additional setting for the Emscripten target to select between the old exception handling and the new exception handling. I don't know how to add a setting like that, would appreciate advice from Rust folks. We could maybe choose to use the new exception handling if `Ctarget-feature=+exception-handling` is passed? I tried this but I get errors from llvm so I'm not doing it right.
2025-01-06 22:04:13 -05:00
Scott McMurray
ad5f912d96 Transmute from NonNull to pointer when elaborating a box deref (MCP807) 2025-01-06 18:43:40 -08:00
Matthew Maurer
fc32dd49cb llvm: Ignore error value that is always false
See llvm/llvm-project#121851

For LLVM 20+, this function (`renameModuleForThinLTO`) has no return
value. For prior versions of LLVM, this never failed, but had a
signature which allowed an error value people were handling.
2025-01-07 01:02:22 +00:00
bors
0f1e965fec Auto merge of #135172 - matthiaskrgr:rollup-8fe3fxi, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #134742 (Use `PostBorrowckAnalysis` in `check_coroutine_obligations`)
 - #134771 (Report correct `SelectionError` for `ConstArgHasType` in new solver fulfill)
 - #134951 (Suppress host effect predicates if underlying trait doesn't hold)
 - #135097 (bootstrap: Consolidate coverage test suite steps into a single step)
 - #135146 (Don't enable anyhow's `backtrace` feature in opt-dist)
 - #135153 (chore: remove redundant words in comment)
 - #135157 (Move the has_errors check in rustdoc back to after TyCtxt is created)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-01-06 22:39:16 +00:00
Noah Lev
b0aaa386d8 rustdoc: Fix mismatched capitalization in sidebar
Previously, the main content used "Aliased Type", while the sidebar said
"Aliased type". Now, they both say "Aliased Type", which is the more common
capitalization in Rustdoc.

See the following link for an example.
https://doc.rust-lang.org/1.83.0/std/io/type.Result.html
2025-01-06 14:26:07 -08:00
Xing Xue
7f31b579c7 Replace the random substring of a linker argument with a placeholder and nullify the timestamp field of XCOFF files for file comparison. 2025-01-06 16:59:46 -05:00
Pietro Albini
80cdaeac3d
avoid replacing the definition of CURRENT_RUSTC_VERSION
Before this commit, replace-version-placeholder hardcoded the path
defining CURRENT_RUSTC_VERSION (to avoid replacing it). After a refactor
moved the file defining it without changing the hardcoded path, the tool
started replacing the constant itself with the version number.

To avoid this from happening in the future, this changes the definition
of the constant to avoid the tool from ever matching it.
2025-01-06 21:53:48 +01:00
Matthias Krüger
873ae7a5ad
Rollup merge of #135157 - bjorn3:fix_rustdoc_error_abort, r=jieyouxu,GuillaumeGomez
Move the has_errors check in rustdoc back to after TyCtxt is created

This was accidentally moved before TyCtxt creation by https://github.com/rust-lang/rust/pull/134302.
2025-01-06 20:59:36 +01:00
Matthias Krüger
7d4b6dc861
Rollup merge of #135153 - crystalstall:master, r=workingjubilee
chore: remove redundant words in comment
2025-01-06 20:59:35 +01:00
Matthias Krüger
8e2631bdb6
Rollup merge of #135146 - Zalathar:anyhow-backtrace, r=jieyouxu
Don't enable anyhow's `backtrace` feature in opt-dist

As of the stabilization of `std::backtrace` in Rust 1.65, this package flag has no effect other than to enable an unused dependency on the `backtrace` crate.

(See <af0937ef72/Cargo.toml (L18-L23)>.)

While the presence of this feature in opt-dist doesn't cause other tools (which use anyhow) to actually *build* backtrace, it does affect the global crate graph used for dependency version resolution. After removing this feature, we can use `cargo tree --invert --package backtrace` to see that the only remaining reverse-dependency of backtrace is `color-eyre`, which is used by `ui_test`.
2025-01-06 20:59:35 +01:00
Matthias Krüger
c31a4b9ac4
Rollup merge of #135097 - Zalathar:coverage-test-step, r=Kobzol
bootstrap: Consolidate coverage test suite steps into a single step

Now that I have more understanding of bootstrap steps, and a renewed distaste for unnecessary macros, I have managed to express the subtleties of the `tests/coverage` test suite in a single step defined in ordinary code, with no need for helper macros.

Deciding which modes to run is still a bit clunky due to limitations in existing ShouldRun/PathSet APIs, but I think it's a net improvement over having to declare several different steps to handle the suite path and aliases.

The interaction with `--skip` isn't as nice as I'd like, but all of the known limitations are limitations that already existed in the previous implementation.

One minor change is that by default compiletest is now invoked in `coverage-run` mode even when cross-compiling. However, in that situation compiletest still knows that it should skip all of the individual coverage-run tests.

r? jieyouxu (or reassign)
2025-01-06 20:59:34 +01:00
Matthias Krüger
68791efa29
Rollup merge of #134951 - compiler-errors:double-trait-err-msg, r=davidtwco
Suppress host effect predicates if underlying trait doesn't hold

Don't report two errors for when the (`HostEffectPredicate`) `T: const Trait` isn't implemented because (`TraitPredicate`) `T: Trait` doesn't even hold.
2025-01-06 20:59:33 +01:00
Matthias Krüger
44c6e83b49
Rollup merge of #134771 - compiler-errors:const-arg-has-type-err, r=lcnr
Report correct `SelectionError` for `ConstArgHasType` in new solver fulfill

r? ``@BoxyUwU``
2025-01-06 20:59:32 +01:00
Matthias Krüger
49b05ed7c1
Rollup merge of #134742 - compiler-errors:post-borrowck-analysis, r=lcnr
Use `PostBorrowckAnalysis` in `check_coroutine_obligations`

This currently errors with:

```
error: concrete type differs from previous defining opaque type use
  --> tests/ui/coroutine/issue-52304.rs:10:21
   |
10 | pub fn example() -> impl Coroutine {
   |                     ^^^^^^^^^^^^^^ expected `{example::{closure#0} upvar_tys=() resume_ty=() yield_ty=&'{erased} i32 return_ty=() witness={example::{closure#0}}}`, got `{example::{closure#0} upvar_tys=() resume_ty=() yield_ty=&'static i32 return_ty=() witness={example::{closure#0}}}`
   |
   = note: previous use here
```

This is because we end up redefining the opaque in `check_coroutine_obligations` but with the `yield_ty = &'erased i32` from hir typeck, which causes the *equality* check for opaques to fail.

The coroutine obligtions in question (when `-Znext-solver` is enabled) are:

```
Binder { value: TraitPredicate(<Opaque(DefId(0:5 ~ issue_52304[4c6d]::example::{opaque#0}), []) as std::marker::Sized>, polarity:Positive), bound_vars: [] }

Binder { value: AliasRelate(Term::Ty(Alias(Opaque, AliasTy { args: [], def_id: DefId(0:5 ~ issue_52304[4c6d]::example::{opaque#0}), .. })), Equate, Term::Ty(Coroutine(DefId(0:6 ~ issue_52304[4c6d]::example::{closure#0}), [(), (), &'{erased} i32, (), CoroutineWitness(DefId(0:6 ~ issue_52304[4c6d]::example::{closure#0}), []), ()]))), bound_vars: [] }

Binder { value: AliasRelate(Term::Ty(Coroutine(DefId(0:6 ~ issue_52304[4c6d]::example::{closure#0}), [(), (), &'{erased} i32, (), CoroutineWitness(DefId(0:6 ~ issue_52304[4c6d]::example::{closure#0}), []), ()])), Subtype, Term::Ty(Alias(Opaque, AliasTy { args: [], def_id: DefId(0:5 ~ issue_52304[4c6d]::example::{opaque#0}), .. }))), bound_vars: [] }
```

Ignoring the fact that we end up stalling some really dumb obligations here (lol), I think it makes more sense for us to be using post borrowck analysis for this check anyways.

r? lcnr
2025-01-06 20:59:31 +01:00
Michael Howell
c7a806ad08 rustdoc: use stable paths as preferred canonical paths
This accomplishes something like 16a4ad7d7b,
but with the `rustc_allowed_through_unstable_modules` attribute instead
of the path length.
2025-01-06 11:58:52 -07:00
Celina G. Val
5172364b67
Update triagebot.toml: celinval vacation is over
I'm also removing myself from the MIR syntax changes notifications.
2025-01-06 10:50:58 -08:00
Michael Goulet
304ccf45d1 Suggest to replace tuple constructor through projection 2025-01-06 18:04:33 +00:00
Michael Goulet
ebdf19a8bb Recurse on GAT where clauses in fulfillment error proof tree visitor 2025-01-06 17:58:42 +00:00
Michael Goulet
5a566005c1 Normalize each signature input/output in typeck_with_fallback with its own span 2025-01-06 17:58:30 +00:00