Commit graph

45798 commits

Author SHA1 Message Date
Kivooeo
834e476a0c Add diagnostics and suggestions for raw pointer arithmetic assignments 2025-04-21 22:14:44 +05:00
bors
afa859f812 Auto merge of #136926 - wesleywiser:stabilize_dwarf-version, r=petrochenkov
Stabilize `-Zdwarf-version` as `-Cdwarf-version`

I propose stabilizing `-Zdwarf-version` as `-Cdwarf-version`. This PR adds a new `-Cdwarf-version` flag, leaving the unstable `-Z` flag as is to ease the transition period. The `-Z` flag will be removed in the future.

# `-Zdwarf-version` stabilization report

## What is the RFC for this feature and what changes have occurred to the user-facing design since the RFC was finalized?

No RFC/MCP, this flag was added in https://github.com/rust-lang/rust/pull/98350 and was not deemed large enough to require additional process.

The tracking issue for this feature is #103057.

## What behavior are we committing to that has been controversial? Summarize the major arguments pro/con.

None that has been extensively debated but there are a few questions that could have been chosen differently:

1. What should the flag name be?
  The current flag name is very specific to DWARF. Other debuginfo formats exist (msvc's CodeView format or https://en.wikipedia.org/wiki/Stabs) so we could have chosen to generalize the flag name (`-{C,Z} debuginfo-version=dwarf-5` for example). While this would extend cleanly to support formats other than DWARF, there are some downsides to this design. Neither CodeView nor Stabs have specification or format versions so it's not clear what values would be supported beyond `dwarf-{2,3,4,5}` or `codeview`. We would also need to take care to ensure the name does not lead users to think they can pick a format other than one supported by the target. For instance, what would `--target x86_64-pc-windows-msvc -Cdebuginfo-version=dwarf-5` do?

2. What is the behavior when flag is used on targets that do not support DWARF?
  Currently, passing `-{C,Z} dwarf-version` on targets like `*-windows-msvc` does not do anything. It may be preferable to emit a warning alerting the user that the flag has no effect on the target platform. Alternatively, we could emit an error but this could be annoying since it would require the use of target specific RUSTFLAGS to use the flag correctly (and there isn't a way to target "any platform that uses DWARF" using cfgs).

3. Does the precompiled standard library potentially using a different version of DWARF a problem?
  I don't believe this is an issue as debuggers (and other such tools) already must deal with the possibility that an application uses different DWARF versions across its statically or dynamically linked libraries.

## Are there extensions to this feature that remain unstable? How do we know that we are not accidentally committing to those.

No extensions per se, although future DWARF versions could be considered as such. At present, we validate the requested DWARF version is between 2 and 5 (inclusive) so new DWARF versions will not automatically be supported until the validation logic is adjusted.

## Summarize the major parts of the implementation and provide links into the code (or to PRs)

- Targets define their preferred or default DWARF version: 34a5ea911c/compiler/rustc_target/src/spec/mod.rs (L2369)
- We use the target default but this can be overriden by `-{C,Z} dwarf-version` 34a5ea911c/compiler/rustc_session/src/session.rs (L738)
- The flag is validated 34a5ea911c/compiler/rustc_session/src/session.rs (L1253-L1258)
- When debuginfo is generated, we tell LLVM to use the requested value or the target default 34a5ea911c/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs (L106)

## Summarize existing test coverage of this feature

- Test that we actually generate the appropriate DWARF version
  - https://github.com/rust-lang/rust/blob/master/tests/assembly/dwarf5.rs
  - https://github.com/rust-lang/rust/blob/master/tests/assembly/dwarf4.rs
- Test that LTO with different DWARF versions picks the highest version
  - https://github.com/rust-lang/rust/blob/master/tests/assembly/dwarf-mixed-versions-lto.rs
- Test DWARF versions 2-5 are valid while 0, 1 and 6 report an error
  - https://github.com/rust-lang/rust/blob/master/tests/ui/debuginfo/dwarf-versions.rs
- Ensure LLVM does not report a warning when LTO'ing different DWARF versions together
  - https://github.com/rust-lang/rust/blob/master/tests/ui/lto/dwarf-mixed-versions-lto.rs

## Has a call-for-testing period been conducted? If so, what feedback was received?

No call-for-testing has been conducted but Rust for Linux has been using this flag without issue.

## What outstanding bugs in the issue tracker involve this feature? Are they stabilization-blocking?

All reported bugs have been resolved.

## Summarize contributors to the feature by name for recognition and assuredness that people involved in the feature agree with stabilization

- Initial implementation in https://github.com/rust-lang/rust/pull/98350 by `@pcwalton`
- Stop emitting `.debug_pubnames` and `.debug_pubtypes` when using DWARF 5 in https://github.com/rust-lang/rust/pull/117962 by `@weihanglo.`
- Refactoring & cleanups (#135739), fix LLVM warning on LTO with different DWARF versions (#136659) and argument validation (#136746) by `@wesleywiser`

## What FIXMEs are still in the code for that feature and why is it ok to leave them there?

No FIXMEs related to this feature.

## What static checks are done that are needed to prevent undefined behavior?

This feature cannot cause undefined behavior.
We ensure the DWARF version is one of the supported values [here](34a5ea911c/compiler/rustc_session/src/session.rs (L1255-L1257)).

## In what way does this feature interact with the reference/specification, and are those edits prepared?

No changes to reference/spec, unstable rustc docs are moved to the stable book as part of the stabilization PR.

## Does this feature introduce new expressions and can they produce temporaries? What are the lifetimes of those temporaries?

No.

## What other unstable features may be exposed by this feature?

`-Zembed-source` requires use of DWARF 5 extensions but has its own feature gate.

## What is tooling support like for this feature, w.r.t rustdoc, clippy, rust-analzyer, rustfmt, etc.?

No support needed for rustdoc, clippy, rust-analyzer, rustfmt or rustup.

Cargo could expose this as an option in build profiles but I would expect the decision as to what version should be used would be made for the entire crate graph at build time rather than by individual package authors.

cc-rs has support for detecting the presence of `-{C,Z} dwarf-version` in `RUSTFLAGS` and providing the corresponding flag to Clang/gcc (https://github.com/rust-lang/cc-rs/pull/1395).

---

Closes #103057
2025-04-16 06:38:00 +00:00
bors
efb1e3d676 Auto merge of #139768 - compiler-errors:split-fold, r=lcnr
Split `TypeFolder` and `FallibleTypeFolder` atwain

Right now there is a coherence problem with `TypeFolder` and `FallibleTypeFolder`. Namely, it's impossible to implement a `FallibleTypeFolder` that is generic over interner, b/c it has a *downstream* conflict with the blanket impl:

```
impl<I, F> FallibleTypeFolder<I> for F where F: TypeFolder<I> {}
```

Because downstream crates may implement `TypeFolder<SomeLocalInterner>` for the fallible type folder.

This PR removes the relationship between `FallibleTypeFolder` and `TypeFolder`; it leads to *modest* code duplication, but otherwise does not affect perf and really doesn't matter in general.
2025-04-16 01:46:01 +00:00
bors
cacb9eed38 Auto merge of #139878 - petrochenkov:revllvmclean2, r=compiler-errors
Revert "Deduplicate template parameter creation"

This reverts commit 6adc2c1fd6.

More precise subset of https://github.com/rust-lang/rust/pull/139874.
2025-04-15 22:35:30 +00:00
bors
38c560ae68 Auto merge of #139881 - matthiaskrgr:rollup-7x6zcrc, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #138455 (`librustdoc`: more `impl fmt::Display`)
 - #139818 (Normalize ADT field in `find_tails_for_unsizing`)
 - #139819 (Use `rust-cache` to speed-up `citool` compilation)
 - #139824 (Remove safe remove)
 - #139848 ( Reduce kw::Empty usage, part 5)
 - #139859 (CI: rename MacOS runner)
 - #139877 (Add warning comment to `Take::get_ref` and `Chain::get_ref`)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-04-15 19:21:06 +00:00
Matthias Krüger
2144c940ce
Rollup merge of #139848 - nnethercote:kw-Empty-5, r=compiler-errors
Reduce kw::Empty usage, part 5

Another step towards https://github.com/rust-lang/rust/issues/137978.

r? `@davidtwco`
2025-04-15 21:16:05 +02:00
Matthias Krüger
8bb01ff117
Rollup merge of #139824 - ChrisDenton:non-canonical, r=petrochenkov
Remove safe remove

`safe_remove_dir_all` and `safe_remove_file` use `canonicalize` to workaround a `MAX_PATH` limitation. However, this has not been needed in a long time, since the standard library handles this situation itself.

I've kept `safe_remove_file` (without `canonicalize`) because it also returns `Ok` if the file is not found. While, `safe_remove_file` is only used twice, matching on the error kind is sufficiently verbose that maybe it's still worth it?
2025-04-15 21:16:05 +02:00
Matthias Krüger
27f1f4d27b
Rollup merge of #139818 - compiler-errors:normalize-tails, r=oli-obk
Normalize ADT field in `find_tails_for_unsizing`

See the comment inline and in the test.

TL;DR is that we're getting getting a type from a `type_of` query and then matching on it structurally in codegen, so we're obligated to normalize it. The fact that this wasn't triggered earlier is that all of the types that have `CoerceUnsized` implementations never encounter aliases when peeling the ADT down to their base reference/ptr type.

**NOTE**: I also renamed some things and reorganized the function a bit.

Fixes #139812
Fixes #74451, which I didn't think was interesting enough to add another test.

r? oli-obk
2025-04-15 21:16:03 +02:00
Michael Goulet
c774adcbb5 Split TypeFolder and FallibleTypeFolder 2025-04-15 18:30:35 +00:00
Vadim Petrochenkov
38f7060a73 Revert "Deduplicate template parameter creation"
This reverts commit 6adc2c1fd6.
2025-04-15 21:00:11 +03:00
bors
414da5b63d Auto merge of #138906 - thaliaarchi:unsupported-test-exe, r=bjorn3
Reject test executables when not supported by target

Currently, compiling tests for SOLID produces an ICE, because SOLID does not support executables.

See https://github.com/rust-lang/rust/issues/138047
2025-04-15 16:05:15 +00:00
bors
f433fa46b0 Auto merge of #139845 - Zalathar:rollup-u5u5y1v, r=Zalathar
Rollup of 17 pull requests

Successful merges:

 - #138374 (Enable contracts for const functions)
 - #138380 (ci: add runners for vanilla LLVM 20)
 - #138393 (Allow const patterns of matches to contain pattern types)
 - #139517 (std: sys: process: uefi: Use NULL stdin by default)
 - #139554 (std: add Output::exit_ok)
 - #139660 (compiletest: Add an experimental new executor to replace libtest)
 - #139669 (Overhaul `AssocItem`)
 - #139671 (Proc macro span API redesign: Replace proc_macro::SourceFile by Span::{file, local_file})
 - #139750 (std/thread: Use default stack size from menuconfig for NuttX)
 - #139772 (Remove `hir::Map`)
 - #139785 (Let CStrings be either 1 or 2 byte aligned.)
 - #139789 (do not unnecessarily leak auto traits in item bounds)
 - #139791 (drop global where-bounds before merging candidates)
 - #139798 (normalize: prefer `ParamEnv` over `AliasBound` candidates)
 - #139822 (Fix: Map EOPNOTSUPP to ErrorKind::Unsupported on Unix)
 - #139833 (Fix some HIR pretty-printing problems)
 - #139836 (Basic tests of MPMC receiver cloning)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-04-15 08:02:23 +00:00
Nicholas Nethercote
c12b4aade0 Use a dummy ident for a lint_if_path_starts_with_module call.
This is pretty weird code. As the `HACK` comment indicates, we push the
empty ident here only to make the path longer, so certain checks to
occur within `lint_if_path_starts_with_module`. `dummy` is a better
choice because it explicitly communicates that the actual value doesn't
matter.
2025-04-15 16:05:13 +10:00
Nicholas Nethercote
2b43e66496 Remove a kw::Empty usage in symbol mangling.
Field names are never empty, so the unwrap is unnecessary.
2025-04-15 16:05:13 +10:00
Nicholas Nethercote
f3847f0639 Remove some "name isn't empty" assertions.
These were low value even before #137978 resulted in empty names being
used much less. (Why check for non-emptiness in these three places?
There are thousands of places in the compiler you could check.)
2025-04-15 16:04:11 +10:00
Stuart Cook
4d5284a866
Rollup merge of #139833 - nnethercote:fix-139633, r=oli-obk
Fix some HIR pretty-printing problems

r? `@oli-obk`
2025-04-15 15:47:32 +10:00
Stuart Cook
b21c5cd025
Rollup merge of #139798 - lcnr:where-bounds-gt-alias-bound, r=compiler-errors
normalize: prefer `ParamEnv` over `AliasBound` candidates

cc https://github.com/rust-lang/trait-system-refactor-initiative/issues/175 not the only issue affecting bevy sadly

r? ``@compiler-errors``
2025-04-15 15:47:30 +10:00
Stuart Cook
e8c9dcc79e
Rollup merge of #139791 - lcnr:ignore-global-where-bounds, r=compiler-errors
drop global where-bounds before merging candidates

fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/172

r? ```@compiler-errors```
2025-04-15 15:47:30 +10:00
Stuart Cook
8118fca7fd
Rollup merge of #139789 - lcnr:opaques-auto-trait-leakage, r=compiler-errors
do not unnecessarily leak auto traits in item bounds

fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/158

Not a fix for https://github.com/rust-lang/trait-system-refactor-initiative/issues/173 as you may have realized/tried yourself, cc #139788. However, fixing this feels desirable regardless and I don't see any reason not to.

r? ```@compiler-errors```
2025-04-15 15:47:29 +10:00
Stuart Cook
9d6c95d146
Rollup merge of #139772 - nnethercote:rm-hir-Map, r=Zalathar
Remove `hir::Map`

A follow-up to https://github.com/rust-lang/rust/pull/139232.

r? `@Zalathar`
2025-04-15 15:47:28 +10:00
Stuart Cook
bc4e7ad248
Rollup merge of #139671 - m-ou-se:proc-macro-span, r=dtolnay
Proc macro span API redesign: Replace proc_macro::SourceFile by Span::{file, local_file}

Simplification/redesign of the unstable proc macro span API, tracked in https://github.com/rust-lang/rust/issues/54725:

Before:

```rust
impl Span {
    pub fn line(&self) -> usize;
    pub fn column(&self) -> usize;
    pub fn source_file(&self) -> SourceFile;
}

#[derive(Clone, Debug, PartialEq, Eq)]
pub struct SourceFile { .. }

impl !Send for SourceFile {}
impl !Sync for SourceFile {}

impl SourceFile {
    pub fn path(&self) -> PathBuf;
    pub fn is_real(&self) -> bool;
}
```

After:

```rust
impl Span {
    pub fn line(&self) -> usize;
    pub fn column(&self) -> usize;
    pub fn file(&self) -> String; // Mapped file name, for display purposes.
    pub fn local_file(&self) -> Option<PathBuf>; // Real file name as it exists on disk.
}
```

This resolves the last blocker for stabilizing these methods. (Stabilizing will be a separate PR with FCP.)
2025-04-15 15:47:27 +10:00
Stuart Cook
13cd5256ac
Rollup merge of #139669 - nnethercote:overhaul-AssocItem, r=oli-obk
Overhaul `AssocItem`

`AssocItem` has multiple fields that only make sense some of the time. E.g. the `name` can be empty if it's an RPITIT associated type. It's clearer and less error prone if these fields are moved to the relevant `kind` variants.

r? ``@fee1-dead``
2025-04-15 15:47:27 +10:00
Stuart Cook
aa9a80cc34
Rollup merge of #138393 - oli-obk:pattern-type-in-pattern, r=BoxyUwU
Allow const patterns of matches to contain pattern types

Trying to pattern match on a type containing a pattern type will currently fail with an ICE

```rust
error: internal compiler error: compiler/rustc_mir_build/src/builder/matches/test.rs:459:18: invalid type for non-scalar compare: (u32) is 1..
  --> src/main.rs:22:5
   |
22 |     TWO => {}
   |     ^^^
```

because the compiler tries to generate a MIR `BinOp(Eq)` operation on a pattern type, which is not supported. While we could support that, there are side effects of allowing this (none that would compile, but the compiler would simultaneously think it could `==` pattern types and that it could not because `PartialEq` is not implemented. So instead I change the logic for pattern matching to transmute pattern types to their base type before comparing.

r? ```@BoxyUwU```

cc #123646 ```@scottmcm``` ```@joshtriplett```
2025-04-15 15:47:25 +10:00
Stuart Cook
380ad1b5d4
Rollup merge of #138374 - celinval:issue-136925-const-contract, r=compiler-errors,oli-obk,RalfJung
Enable contracts for const functions

Use `const_eval_select!()` macro to enable contract checking only at runtime. The existing contract logic relies on closures, which are not supported in constant functions.

This commit also removes one level of indirection for ensures clauses since we no longer build a closure around the ensures predicate.

Resolves #136925

**Call-out:** This is still a draft PR since CI is broken due to a new warning message for unreachable code when the bottom of the function is indeed unreachable. It's not clear to me why the warning wasn't triggered before.

r? ```@compiler-errors```
2025-04-15 15:47:24 +10:00
bors
58c2dd9a54 Auto merge of #139826 - matthiaskrgr:rollup-0q0qvkd, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #139745 (Avoid unused clones in `Cloned<I>` and `Copied<I>`)
 - #139757 (opt-dist: use executable-extension for host llvm-profdata)
 - #139778 (Add test for issue 34834)
 - #139783 (Use `compiletest-ignore-dir` for bootstrap self-tests)
 - #139797 (Allow (but don't require) `#[unsafe(naked)]` so that `compiler-builtins` can upgrade to it)
 - #139799 (Specify `--print info=file` syntax in `--help`)
 - #139811 (Use `newtype_index!`-generated types more idiomatically)
 - #139813 (Miri subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-04-15 04:50:15 +00:00
Wesley Wiser
e216915295 Stabilize -Zdwarf-version as -Cdwarf-version 2025-04-14 21:26:41 -05:00
Nicholas Nethercote
16670e1676 Fix HIR pretty-printing of fns with just a variadic arg.
Avoid the extraneous comma.
2025-04-15 10:41:10 +10:00
Nicholas Nethercote
f8edc831ca Pretty-print PatKind::Missing as _.
Printing "no pattern" as `_` isn't ideal, but better than crashing, and
HIR pretty-printing already has plenty of imperfections. The added `f2`
and `f6` examples are ones that triggered the crash.

Note that some of the added examples are printed badly, e.g.
`fn(, ...)`. The next commit will fix those.

Fixes #139633.
2025-04-15 10:40:58 +10:00
Nicholas Nethercote
78599d83e7 Move name field from AssocItem to AssocKind variants.
To accurately reflect that RPITIT assoc items don't have a name. This
avoids the use of `kw::Empty` to mean "no name", which is error prone.

Helps with #137978.
2025-04-15 08:07:15 +10:00
Nicholas Nethercote
89e93a51c8 Move two methods from AssocKind to AssocItem.
Because all the other similar methods are on `AssocItem`.
2025-04-15 08:07:15 +10:00
Nicholas Nethercote
b26f3d4347 Move opt_rpitit_info field to hir::AssocKind::Type.
From `hir::AssocItem`.
2025-04-15 08:06:59 +10:00
Matthias Krüger
04d10520f0
Rollup merge of #139811 - yotamofek:pr/newtype_cleanups, r=oli-obk
Use `newtype_index!`-generated types more idiomatically

Continuation of sorts of #139674
Shouldn't affect anything, just makes some code simpler
2025-04-14 21:55:40 +02:00
Matthias Krüger
7dc3feccdd
Rollup merge of #139799 - clubby789:print=file, r=jieyouxu
Specify `--print info=file` syntax in `--help`

Closes #139794

I moved the listing of information that can be printed to the help string as it's getting rather long and it makes the `[=FILE]` part easier to see
2025-04-14 21:55:39 +02:00
Matthias Krüger
1bceed826e
Rollup merge of #139797 - folkertdev:naked-allow-unsafe, r=tgross35
Allow (but don't require) `#[unsafe(naked)]` so that `compiler-builtins` can upgrade to it

tracking issue: https://github.com/rust-lang/rust/issues/138997

Per https://github.com/rust-lang/rust/pull/134213#issuecomment-2755984503, we want to make the `#[naked]` attribute an unsafe attribute. Making that change runs into a cyclic dependency with `compiler-builtins` which uses `#[naked]`, where `rustc` needs an updated `compiler-builtins` and vice versa.

So based on https://github.com/rust-lang/rust/pull/139753 and [#t-compiler/help > updating &#96;compiler-builtins&#96; and &#96;rustc&#96;](https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/updating.20.60compiler-builtins.60.20and.20.60rustc.60), this PR allows, but does not require `#[unsafe(naked)]`, and makes that change for some of the tests to check that both `#[naked]` and `#[unsafe(naked)]` are accepted.

Then we can upgrade and synchronize `compiler-builtins`, and then make `#[naked]` (without `unsafe`) invalid.

r? `@traviscross` (or someone from t-compiler if you're faster and this look allright)
2025-04-14 21:55:39 +02:00
bors
2da29dbe8f Auto merge of #139577 - davidtwco:sizedness-go-vroom, r=oli-obk
re-use `Sized` fast-path

There's an existing fast path for the `type_op_prove_predicate` predicate, checking for trivially `Sized` types, which can be re-used when evaluating obligations within queries. This should improve performance and was found to be beneficial in #137944.

r? types
2025-04-14 19:54:27 +00:00
Chris Denton
1d757833c6
Remove safe remove 2025-04-14 18:47:15 +00:00
Folkert de Vries
cb22c1d5e9
Allow (but don't require) #[unsafe(naked)] so that compiler-builtins can upgrade to it 2025-04-14 20:44:15 +02:00
Michael Goulet
3df7882272 Normalize ADT fields in find_tails_for_unsizing 2025-04-14 16:51:00 +00:00
Yotam Ofek
4b63362f3d Use newtype_index!-generated types more idiomatically 2025-04-14 16:17:06 +00:00
Matthias Krüger
87c319a770
Rollup merge of #139777 - compiler-errors:debuggier-proj, r=lcnr
Remove `define_debug_via_print` for `ExistentialProjection`, use regular structural debug impl

The pretty print impl for `ExistentialProjection` always prints `AssocItem = Ty`:

6e83046233/compiler/rustc_middle/src/ty/print/pretty.rs (L3293-L3299)

We can't change this, b/c it's used for both pretty printing dyn types and for legacy symbol mangling.

Unfortunately, we also use this printing procedure for `Debug` impls. That means that it leaves out the *trait name* and *trait args* when debug printing an `ExistentialProjection` (or an `ExistentialPredicate` which has a variant for `ExistentialProjection`). This leads to awkward situations, like the two seemingly identical existential projection predicates present in a `dyn Trait` type using the definition below:

```rust
trait Super { type Assoc; }

trait Foo: Super<A, Assoc = i32> + Super<B, Assoc = i32> {}
```

Namely, they both just render as `Projection(Assoc = i32)`! This makes debugging `dyn Trait` type system bugs really hard, so let's use the *regular* debug impl for `ExistentialProjection`.
2025-04-14 18:15:32 +02:00
Matthias Krüger
143f5d7696
Rollup merge of #139767 - compiler-errors:www, r=oli-obk
Visit place in `BackwardIncompatibleDropHint` statement

Remove a weird hack from the `LocalUpdater` where we were manually visiting the place stored in a `StatementKind::BackwardIncompatibleDropHint` because the MIR visitor impls weren't doing so.

Also, clean up `BackwardIncompatibleDropHint`s in `CleanupPostBorrowck`, since they're not needed for runtime MIR.
2025-04-14 18:15:32 +02:00
Matthias Krüger
bf49dfc943
Rollup merge of #139392 - compiler-errors:raw-expr, r=oli-obk
Detect and provide suggestion for `&raw EXPR`

When emitting an error in the parser, and we detect that the previous token was `raw` and we *could* have consumed `const`/`mut`, suggest that this may have been a mistyped raw ref expr. To do this, we add `const`/`mut` to the expected token set when parsing `&raw` as an expression (which does not affect the "good path" of parsing, for the record).

This is kind of a rudimentary error improvement, since it doesn't actually attempt to recover anything, leading to some other knock-on errors b/c we still treat `&raw` as the expression that was parsed... but at least we add the suggestion! I don't think the parser grammar means we can faithfully recover `&raw EXPR` early, i.e. during `parse_expr_borrow`.

Fixes #133231
2025-04-14 18:15:31 +02:00
Matthias Krüger
a4adc005a1
Rollup merge of #139127 - compiler-errors:prim-ty-hack, r=oli-obk
Fix up partial res of segment in primitive resolution hack

There is a hack in the resolver:

```
// In `a(::assoc_item)*` `a` cannot be a module. If `a` does resolve to a module we
// don't report an error right away, but try to fallback to a primitive type.
```

This fixes up the resolution for primitives which would otherwise resolve to a module, but we weren't also updating the res of the path segment, leading to weird diagnostics.

We explicitly call `self.r.partial_res_map.insert` instead of `record_partial_res` b/c we have recorded a partial res already, and we specifically want to override it.

cc https://github.com/rust-lang/rust/issues/139095#issuecomment-2764371934
2025-04-14 18:15:30 +02:00
Michael Goulet
83ea3454df Remove define_debug_via_print for ExistentialProjection 2025-04-14 15:37:31 +00:00
Michael Goulet
13b4734e31 Derive Obligation's fold impls 2025-04-14 14:47:59 +00:00
Oli Scherer
7ad16974b9 Allow const patterns of matches to contain pattern types 2025-04-14 14:27:35 +00:00
clubby789
1b46969a11 Specify --print info=file syntax in --help 2025-04-14 14:52:27 +01:00
lcnr
9c88eb6c43 normalize: prefer ParamEnv over AliasBound 2025-04-14 14:46:48 +02:00
lcnr
ce9d8678ca do not leak auto traits in item bounds 2025-04-14 13:26:13 +02:00
lcnr
2c2c9df653 drop global where-bounds before merging candidates 2025-04-14 12:59:22 +02:00