| Age | Commit message (Collapse) | Author | Lines |
|
mir: Do not modify NonUse in `super_projection_elem`
Split from rust-lang/rust#142771.
r? cjgillot
|
|
r=cjgillot
simplifycfg: Mark as changed when start is modified in collapse goto chain
Split from rust-lang/rust#142771.
r? cjgillot
|
|
Fortify generic param default checks
* Hard-reject instead of lint-reject type param defaults in generic assoc consts (GACs) (feature: `generic_const_items`).
* In https://github.com/rust-lang/rust/pull/113522, I explicitly handled the free const item case and forgot about the assoc const one.
* This led rustc to assume the default of emitting the deny-by-default lint `invalid_type_param_default`.
* GCIs are unstable, thus we're not bound by backward compat
* Hard-reject instead of lint-reject type param defaults in foreign items.
* We already hard-reject generic params on foreign items, so this isn't a breaking change.
* There's no reason why we need to lint-reject.
* Refactor the way we determine where generic param defaults are allowed:
* Don't default to emitting lint `invalid_type_param_defaults` for nodes that aren't explicitly handled but instead panic.
* This would've caught my GAC oversight from above much earlier via fuzzing
* Prevents us from accidentally stabilizing more invalid type param defaults in the future
* Streamline the phrasing of the diagnostic
|
|
Gate const trait syntax
Missed this during my review of rust-lang/rust#143879, huge apologies!
Fixes [after beta backport] https://github.com/rust-lang/rust/issues/144958.
cc ``@fee1-dead``
r? ``@BoxyUwU`` or anyone
|
|
we only merge candidates for trait and normalizes-to goals
so change `fn try_merge_responses` to `fn try_merge_candidates` and just use candidates everywhere.
Potentially slightly faster than the alternative :3
r? ``@compiler-errors`` ``@BoxyUwU``
|
|
Enforce tail call type is related to body return type in borrowck
Like all call terminators, tail call terminators instantiate the binder of the callee signature with region variables and equate the arg operand types with that signature's args to ensure that the call is valid.
However, unlike normal call terminators, we were forgetting to also relate the return type of the call terminator to anything. In the case of tail call terminators, the correct thing is to relate it to the return type of the caller function (or in other words, the return local `_0`).
This meant that if the caller's return type had some lifetime constraint, then that constraint wouldn't flow through the signature and affect the args.
This is what's happening in the example test I committed:
```rust
fn link(x: &str) -> &'static str {
become passthrough(x);
}
fn passthrough<T>(t: T) -> T { t }
fn main() {
let x = String::from("hello, world");
let s = link(&x);
drop(x);
println!("{s}");
}
```
Specifically, the type `x` is `'?0 str`, where `'?0` is some *universal* arg. The type of `passthrough` is `fn(&'?1 str) -> &'?1 str`. Equating the args sets `'?0 = '?1`. However, we need to also equate the return type `&'?1 str` to `&'static str` so that we eventually require that `'?0 = 'static`, which is a borrowck error!
-----
Look at the first commit for the functional change, and the second commit is just a refactor because we don't need to pass `Option<BasicBlock>` to `check_call_dest`, but just whether or not the terminator is expected to be diverging (i.e. if the return type is `!`).
Fixes rust-lang/rust#144916
|
|
Anonymize binders in tail call sig
See the comment for explanation
Fixes rust-lang/rust#144826
r? WaffleLapkin
|
|
Port `#[coroutine]` to the new attribute system
Related to https://github.com/rust-lang/rust/issues/131229#issue-2565886367.
r? `````@jdonszelmann`````
|
|
Parser: Recover from attributes applied to types and generic args
r? compiler
Add clearer error messages for invalid attribute usage in types or generic types
fixes rust-lang/rust#135017
fixes rust-lang/rust#144132
|
|
Rollup of 12 pull requests
Successful merges:
- rust-lang/rust#144552 (Rehome 33 `tests/ui/issues/` tests to other subdirectories under `tests/ui/`)
- rust-lang/rust#144676 (Add documentation for unstable_feature_bound)
- rust-lang/rust#144836 (Change visibility of Args new function)
- rust-lang/rust#144910 (Add regression tests for seemingly fixed issues)
- rust-lang/rust#144913 ([rustdoc] Fix wrong `i` tooltip icon)
- rust-lang/rust#144924 (compiletest: add hint for when a ui test produces no errors)
- rust-lang/rust#144926 (Correct the use of `must_use` on btree::IterMut)
- rust-lang/rust#144928 (Drop `rust-version` from `rustc_thread_pool`)
- rust-lang/rust#144945 (Autolabel PRs that change explicit tail call tests as `F-explicit_tail_calls`)
- rust-lang/rust#144954 (run-make: Allow blessing snapshot files that don't exist yet)
- rust-lang/rust#144971 (num: Rename `isolate_most_least_significant_one` functions)
- rust-lang/rust#144978 (Fix some doc links for intrinsics)
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
Drop `rust-version` from `rustc_thread_pool`
The current `rust-version = "1.63"` was inherited from rayon, but it
doesn't make sense to limit this in the compiler workspace. Having any
setting at all has effects on tools like `cargo info` that try to infer
the MSRV when the workspace itself doesn't specify it. Since we are the
compiler, our only MSRV is whatever bootstrapping requires.
|
|
r=bjorn3
Preserve the .debug_gdb_scripts section
Make sure that compiler and linker don't optimize the section's contents
away by adding the global holding the data to `llvm.used`. This
eliminates the need for a volatile load in the main shim; since the LLVM
codegen backend is the only implementer of the corresponding trait
function, remove it entirely.
Pretty printers in dylib dependencies are now emitted by the main crate
instead of the dylib; apart from matching how rlibs are handled, this
approach has the advantage that `omit_gdb_pretty_printer_section` keeps
working with dylib dependencies.
r? `@bjorn3`
|
|
|
|
|
|
Instead of collecting pretty printers transitively when building
executables/staticlibs/cdylibs, let the debugger find each crate's
pretty printers via its .debug_gdb_scripts section. This covers the case
where libraries defining custom pretty printers are loaded dynamically.
|
|
|
|
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.
|
|
|
|
|
|
Make sure that compiler and linker don't optimize the section's contents
away by adding the global holding the data to "llvm.used". The volatile
load in the main shim is retained because "llvm.used", which translates
to SHF_GNU_RETAIN on ELF targets, requires a reasonably recent linker;
emitting the volatile load ensures compatibility with older linkers, at
least when libstd is used.
Pretty printers in dylib dependencies are now emitted by the main crate
instead of the dylib; apart from matching how rlibs are handled, this
approach has the advantage that `omit_gdb_pretty_printer_section` keeps
working with dylib dependencies.
|
|
|
|
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.
|
|
coverage: Various small cleanups
This PR is a collection of small coverage-related changes that I accumulated while working towards other coverage improvements.
Each change should hopefully be fairly straightforward.
|
|
Remove `SHOULD_EMIT_LINTS` in favor of `should_emit`
r? ``@jdonszelmann``
|
|
Properly reject tail calls to `&FnPtr` or `&FnDef`
Fixes rust-lang/rust#144795
|
|
`Printer` cleanups
The trait `Printer` is implemented by six types, and the sub-trait `PrettyPrinter` is implemented by three of those types. The traits and the impls are complex and a bit of a mess. This PR starts to clean them up.
r? ``@davidtwco``
|
|
fix: Error on illegal `[const]`s inside blocks within legal positions
Fixes rust-lang/rust#132067
I initially considered moving `[const]` validations to `rustc_ast_lowering`, but that approach would require adding constness information to `AssocCtxt`, which introduces significant changes - especially within `rustc_expand` - just to support a single use case here:
https://github.com/rust-lang/rust/blob/3fb1b53a9dbfcdf37a4b67d35cde373316829930/compiler/rustc_ast_passes/src/ast_validation.rs#L1596-L1610
Instead, I believe it's sufficient to simply "reset" `[const]` allowness whenever we enter a new block.
|
|
|
|
|
|
The current `rust-version = "1.63"` was inherited from rayon, but it
doesn't make sense to limit this in the compiler workspace. Having any
setting at all has effects on tools like `cargo info` that try to infer
the MSRV when the workspace itself doesn't specify it. Since we are the
compiler, our only MSRV is whatever bootstrapping requires.
|
|
|
|
|
|
Related to https://github.com/rust-lang/rust/issues/131229#issue-2565886367.
|
|
|
|
|
|
|
|
subtree-update_cg_gcc_2025-08-04
|
|
- don't need type alias to default type argument
- `Residual` impl allows to use more std APIs (like `<[T; N]>::try_map`)
|
|
|
|
|
|
Distinguish prepending and replacing self ty in predicates
There are two kinds of functions called `with_self_ty`:
1. Prepends the `Self` type onto an `ExistentialPredicate` which lacks it in its internal representation.
2. Replaces the `Self` type of an existing predicate, either for diagnostics purposes or in the new trait solver when normalizing that self type.
This PR distinguishes these two because I often want to only grep for one of them. Namely, let's call it `with_replaced_self_ty` when all we're doing is replacing the self type.
|
|
Using an enum here was historically not worth the extra hassle, but now we can
lean on `#[derive(TryFromU32)]` to hide most of the boilerplate.
|
|
|
|
|
|
This flag turned out to be less useful than anticipated, and interferes with
work towards expansion support.
|
|
Having this helper function in the loop was confusing, because it doesn't rely
on anything that changes between loop iterations.
|
|
|
|
resolve: Cleanups and micro-optimizations to extern prelude
This is what can be done without changing the structure of `ExternPreludeEntry`, like in https://github.com/rust-lang/rust/pull/144737.
See individual commits for details.
|
|
Do not give function allocations alignment in consteval and Miri.
We do not yet have a (clear and T-lang approved) design for how `#[align(N)]` on functions should affect function pointers' addresses on various platforms, so for now do not give function pointers alignment in consteval and Miri.
----
Old summary:
Not a full solution to <https://github.com/rust-lang/rust/issues/144661>, but fixes the immediate issue by making function allocations all have alignment 1 in consteval, ignoring `#[rustc_align(N)]`, so the compiler doesn't know if any offset other than 0 is non-null.
A more "principlied" solution would probably be to make function pointers to `#[instruction_set(arm::t32)]` functions be at offset 1 of an align-`max(2, align attribute)` allocation instead of at offset 0 of their allocation during consteval, and on wasm to either disallow `#[align(N)]` where N > 1, or to pad the function table such that the function pointer of a `#[align(N)]` function is a multiple of `N` at runtime.
|