| Age | Commit message (Collapse) | Author | Lines |
|
|
|
Rollup of 21 pull requests
Successful merges:
- rust-lang/rust#118087 (Add Ref/RefMut try_map method)
- rust-lang/rust#122661 (Change the desugaring of `assert!` for better error output)
- rust-lang/rust#142640 (Implement autodiff using intrinsics)
- rust-lang/rust#143075 (compiler: Allow `extern "interrupt" fn() -> !`)
- rust-lang/rust#144865 (Fix tail calls to `#[track_caller]` functions)
- rust-lang/rust#144944 (E0793: Clarify that it applies to unions as well)
- rust-lang/rust#144947 (Fix description of unsigned `checked_exact_div`)
- rust-lang/rust#145004 (Couple of minor cleanups)
- rust-lang/rust#145005 (strip prefix of temporary file names when it exceeds filesystem name length limit)
- rust-lang/rust#145012 (Tail call diagnostics to include lifetime info)
- rust-lang/rust#145065 (resolve: Introduce `RibKind::Block`)
- rust-lang/rust#145120 (llvm: Accept new LLVM lifetime format)
- rust-lang/rust#145189 (Weekly `cargo update`)
- rust-lang/rust#145235 (Minor `[const]` tweaks)
- rust-lang/rust#145275 (fix(compiler/rustc_codegen_llvm): apply `target-cpu` attribute)
- rust-lang/rust#145322 (Resolve the prelude import in `build_reduced_graph`)
- rust-lang/rust#145331 (Make std use the edition 2024 prelude)
- rust-lang/rust#145369 (Do not ICE on private type in field of unresolved struct)
- rust-lang/rust#145378 (Add `FnContext` in parser for diagnostic)
- rust-lang/rust#145389 ([rustdoc] Revert "rustdoc search: prefer stable items in search results")
- rust-lang/rust#145392 (coverage: Remove intermediate data structures from mapping creation)
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
Patterns: represent constants as valtrees
Const patterns are always valtrees now. Let's represent that in the types. We use `ty::Value` for this since it nicely packages value and type, and has some convenient methods.
Cc `@Nadrieril` `@BoxyUwU`
|
|
|
|
Currently they are skipped, which is a bit weird, and it sometimes
causes malformed output like `Foo<>` and `dyn Bar<, A = u32>`.
Most regions are erased by the time `type_name` does its work. So all
regions are now printed as `'_` in non-optional places. Not perfect, but
better than the status quo.
`c_name` is updated to trim lifetimes from MIR pass names, so that the
`PASS_NAMES` sanity check still works. It is also renamed as
`simplify_pass_type_name` and made non-const, because it doesn't need
to be const and the non-const implementation is much shorter.
The commit also renames `should_print_region` as
`should_print_optional_region`, which makes it clearer that it only
applies to some regions.
Fixes #145168.
|
|
Port the `#[linkage]` attribute to the new attribute system
r? `@jdonszelmann`
|
|
Reduce some queries around associated items
|
|
Co-authored-by: Boxy <rust@boxyuwu.dev>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
More `Printer` cleanups
A sequel to rust-lang/rust#144776.
r? ```@davidtwco```
|
|
|
|
|
|
They now use the enclosing temporary scope as their scope, regardless of
which `ScopeData` was used to mark it.
|
|
|
|
|
|
|
|
|
|
When trying to construct a struct that has a public field of a private type, suggest using `..` if that field has a default value.
```
error[E0603]: struct `Priv1` is private
--> $DIR/non-exhaustive-ctor.rs:25:39
|
LL | let _ = S { field: (), field1: m::Priv1 {} };
| ------ ^^^^^ private struct
| |
| while setting this field
|
note: the struct `Priv1` is defined here
--> $DIR/non-exhaustive-ctor.rs:14:4
|
LL | struct Priv1 {}
| ^^^^^^^^^^^^
help: the field `field1` you're trying to set has a default value, you can use `..` to use it
|
LL | let _ = S { field: (), .. };
| ~~
```
|
|
rename `TraitRef::from_method` to `from_assoc`
also add a note to `GenericArgs::truncate_to`
|
|
Rollup of 23 pull requests
Successful merges:
- rust-lang/rust#141658 (rustdoc search: prefer stable items in search results)
- rust-lang/rust#141828 (Add diagnostic explaining STATUS_STACK_BUFFER_OVERRUN not only being used for stack buffer overruns if link.exe exits with that exit code)
- rust-lang/rust#144823 (coverage: Extract HIR-related helper code out of the main module)
- rust-lang/rust#144883 (Remove unneeded `drop_in_place` calls)
- rust-lang/rust#144923 (Move several more float tests to floats/mod.rs)
- rust-lang/rust#144988 (Add annotations to the graphviz region graph on region origins)
- rust-lang/rust#145010 (Couple of minor abi handling cleanups)
- rust-lang/rust#145017 (Explicitly disable vector feature on s390x baseline of bad-reg test)
- rust-lang/rust#145027 (Optimize `char::is_alphanumeric`)
- rust-lang/rust#145050 (add member constraints tests)
- rust-lang/rust#145073 (update enzyme submodule to handle llvm 21)
- rust-lang/rust#145080 (Escape diff strings in MIR dataflow graphviz)
- rust-lang/rust#145082 (Fix some bad formatting in `-Zmacro-stats` output.)
- rust-lang/rust#145083 (Fix cross-compilation of Cargo)
- rust-lang/rust#145096 (Fix wasm target build with atomics feature)
- rust-lang/rust#145097 (remove unnecessary `TypeFoldable` impls)
- rust-lang/rust#145100 (Rank doc aliases lower than equivalently matched items)
- rust-lang/rust#145103 (rustc_metadata: remove unused private trait impls)
- rust-lang/rust#145115 (defer opaque type errors, generally greatly reduce tainting)
- rust-lang/rust#145119 (rustc_public: fix missing parenthesis in pretty discriminant)
- rust-lang/rust#145124 (Recover `for PAT = EXPR {}`)
- rust-lang/rust#145132 (Refactor map_unit_fn lint)
- rust-lang/rust#145134 (Reduce indirect assoc parent queries)
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
also add a note to `GenericArgs::truncate_to`
|
|
remove unnecessary `TypeFoldable` impls
|
|
add a scope for `if let` guard temporaries and bindings
This fixes my concern with `if let` guard drop order, namely that the guard's bindings and temporaries were being dropped after their arm's pattern's bindings, instead of before (https://github.com/rust-lang/rust/pull/141295#issuecomment-2968975596). The guard's bindings and temporaries now live in a new scope, which extends until (but not past) the end of the arm, guaranteeing they're dropped before the arm's pattern's bindings.
This only introduces a new scope for match arms with guards. Perf results (https://github.com/rust-lang/rust/pull/143376#issuecomment-3034922617) seemed to indicate there wasn't a significant hit to introduce a new scope on all match arms, but guard patterns (rust-lang/rust#129967) will likely benefit from only adding new scopes when necessary (with some patterns requiring multiple nested scopes).
Tracking issue for `if_let_guard`: rust-lang/rust#51114
Tests are adapted from examples by `@traviscross,` `@est31,` and myself on rust-lang/rust#141295.
|
|
atomicrmw on pointers: move integer-pointer cast hacks into backend
Conceptually, we want to have atomic operations on pointers of the form `fn atomic_add(ptr: *mut T, offset: usize, ...)`. However, LLVM does not directly support such operations (https://github.com/llvm/llvm-project/issues/120837), so we have to cast the `offset` to a pointer somewhere.
This PR moves that hack into the LLVM backend, so that the standard library, intrinsic, and Miri all work with the conceptual operation we actually want. Hopefully, one day LLVM will gain a way to represent these operations without integer-pointer casts, and then the hack will disappear entirely.
Cc ```@nikic``` -- this is the best we can do right now, right?
Fixes https://github.com/rust-lang/rust/issues/134617
|
|
Use `tcx.short_string()` in more diagnostics
`TyCtxt::short_string` ensures that user visible type paths aren't overwhelming on the terminal output, and properly saves the long name to disk as a side-channel. We already use these throughout the compiler and have been using them as needed when users find cases where the output is verbose. This is a proactive search of some cases to use `short_string`.
We add support for shortening the path of "trait path only".
Every manual use of `short_string` is a bright marker that that error should be using structured diagnostics instead (as they have proper handling of long types without the maintainer having to think abou tthem).
|
|
|
|
A couple small changes for rust-analyzer next-solver work
Originally written by `@flodiebold`
|
|
coverage: Remove all unstable support for MC/DC instrumentation
Preliminary support for a partial implementation of “Modified Condition/Decision Coverage” instrumentation was added behind the unstable flag `-Zcoverage-options=mcdc` in 2024. These are the most substantial PRs involved:
- rust-lang/rust#123409
- rust-lang/rust#126733
At the time, I accepted these PRs with relatively modest scrutiny, because I did not want to stand in the way of independent work on MC/DC instrumentation. My hope was that ongoing work by interested contributors would lead to the code becoming clearer and more maintainable over time.
---
However, that MC/DC code has proven itself to be a major burden on overall maintenance of coverage instrumentation, and a major obstacle to other planned improvements, such as internal changes needed for proper support of macro expansion regions.
I have also become reluctant to accept any further MC/DC-related changes that would increase this burden.
That tension has resulted in an unhappy impasse. On one hand, the present MC/DC implementation is not yet complete, and shows little sign of being complete at an acceptable level of code quality in the foreseeable future. On the other hand, the continued existence of this partial MC/DC implementation is imposing serious maintenance burdens on every other aspect of coverage instrumentation, and is preventing some of the very improvements that would make it easier to accept expanded MC/DC support in the future.
While I know this will be disappointing to some, I think the healthy way forward is accept that I made the wrong call in accepting the current implementation, and to remove it entirely from the compiler.
|
|
Add support for `ty::Instance` path shortening in diagnostics
Make `ty::Instance` able to use `short_string` and usable in structured errors directly. Remove some ad-hoc type shortening logic.
|
|
This ensures `if let` guard temporaries and bindings are dropped before
the match arm's pattern's bindings.
|
|
`TyCtxt::short_string` ensures that user visible type paths aren't overwhelming on the terminal output, and properly saves the long name to disk as a side-channel. We already use these throughout the compiler and have been using them as needed when users find cases where the output is verbose. This is a proactive search of some cases to use `short_string`.
We add support for shortening the path of "trait path only".
Every manual use of `short_string` is a bright marker that that error should be using structured diagnostics instead (as they have proper handling of long types without the maintainer having to think abou tthem).
When we don't actually print out a shortened type we don't need the "use `--verbose`" note.
On E0599 show type identity to avoid expanding the receiver's generic parameters.
Unify wording on `long_ty_path` everywhere.
|
|
|
|
Replace ad-hoc type path shortening logic for recursive mono instantiation errors to use `tcx.short_string()` instead.
|
|
mir: Do not modify NonUse in `super_projection_elem`
Split from rust-lang/rust#142771.
r? cjgillot
|
|
|
|
|
|
More consistency.
|
|
I find these name clearer, and starting them all with `print_` makes
things more consistent.
|
|
It's not used in `Printer`.
|
|
These details took me some time to work out.
|
|
Simplify dead code lint
This PR scratches a few itches I had when looking at that code.
The perf improvement comes from keeping the `scanned` set through several marking phases. This pretty much divides by 2 the number of HIR traversals.
|
|
The use of `print_value_path` means the value namespace is always used
and the `guess_def_namespace` call is unnecessary. This commit removes
the `guess_def_namespace` call and hard-codes `ValueNS`. It also changes
the `print_value_path` to `print_def_path` for consistency with
`def_path_str_with_args`.
|
|
Dont print arg span in MIR dump for tail call
r? WaffleLapkin
This makes the MIR dump for tail call terminators consistent w/ regular calls.
|
|
Add `InterpCx::project_fields`
I was hoping for a much bigger improvement and this is lukewarm at best ^^'
Still, I think this makes sense.
|
|
Properly reject tail calls to `&FnPtr` or `&FnDef`
Fixes rust-lang/rust#144795
|