about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2025-05-09ReviewMichael Goulet-5/+20
2025-05-09Only include associated type bounds for Self:Sized associated types if they ↵Michael Goulet-5/+9
are provided
2025-05-09Don't delay a bug on malformed meta items involving interpolated tokensLeón Orell Valerian Liehr-9/+6
Co-authored-by: Jana Dönszelmann <jana@donsz.nl>
2025-05-02set subsections_via_symbols for ld64 helper sectionsusamoi-0/+6
(cherry picked from commit b1a38313cb0dee9a7c5573ae37ad48b0a347cb7c)
2025-04-24Revert overzealous parse recovery for single colonsLeón Orell Valerian Liehr-13/+18
(cherry picked from commit 16da97be2f1e94a550985f22289975db4b32c18d)
2025-04-24Don't warn about `v128` in wasm ABI transitionAlex Crichton-0/+6
This has other warnings if necessary and doesn't need extra warnings from this FCW. cc #138762 (cherry picked from commit 19e44d463bf671f6ec1b02b32837ad54dd5d626f)
2025-04-24Ignore zero-sized types in wasm future-compat warningAlex Crichton-0/+5
This commit fixes a false positive of the warning triggered for #138762 and the fix is to codify that zero-sized types are "safe" in both the old and new ABIs. (cherry picked from commit f9091e24a0af713378ee705c86689c1435d0b157)
2025-04-24Do not mix normalized and unnormalized caller bounds when constructing ↵Michael Goulet-13/+22
param-env for receiver_is_dispatchable (cherry picked from commit 4f2baaa9c6b75d4267eea9e1096339d56d380615)
2025-04-17Revert "Deduplicate template parameter creation"Vadim Petrochenkov-26/+45
This reverts commit 6adc2c1fd6ecde7bf83c8b8fbc71f402ced87054. (cherry picked from commit 38f7060a73acd5ec6ed7d4820dccbf2aa584fc68)
2025-04-10Revert "Remove `prev_index_to_index` field from `CurrentDepGraph`"John Kåre Alsaker-144/+185
This reverts commit 60e4a1b8f37c48cfc4c8c78aaafc5ff2f8d02ca1.
2025-03-31replace version placeholderBoxy-8/+8
2025-03-28Rollup merge of #139075 - oli-obk:resolver-item-lifetime, r=compiler-errorsMatthias Krüger-1/+4
Do not treat lifetimes from parent items as influencing child items ```rust struct A; impl Bar<'static> for A { const STATIC: &str = ""; // ^ no future incompat warning } ``` has no future incompat warning, because there is no ambiguity. But ```rust struct C; impl Bar<'_> for C { // ^^ this lifeimte const STATIC: &'static str = { struct B; impl Bar<'static> for B { const STATIC: &str = ""; // causes ^ to emit a future incompat warning } "" }; } ``` had one before this PR, because the impl for `B` (which is just a copy of `A`) thought it was influenced by a lifetime on the impl for `C`. I double checked all other `lifetime_ribs` iterations and all of them do check for `Item` boundaries. This feels very fragile tho, and ~~I think we should do not even be able to see ribs from parent items, but that's a different refactoring that I'd rather not do at the same time as a bugfix~~. EDIT: ah nevermind, this is needed for improving diagnostics like "use of undeclared lifetime" being "can't use generic parameters from outer item" instead. r? `@compiler-errors`
2025-03-28Rollup merge of #139063 - fmease:fix-tait-atpit-gating, r=oli-obkMatthias Krüger-0/+7
Fix TAIT & ATPIT feature gating in the presence of anon consts Fixes #139055 (https://github.com/rust-lang/rust/issues/119924#issuecomment-1928659690). r? oli-obk or anybody else
2025-03-28Fix TAIT & ATPIT feature gating in the presence of anon constsLeón Orell Valerian Liehr-0/+7
2025-03-28Do not treat lifetimes from parent items as influencing child itemsOli Scherer-1/+4
2025-03-28Auto merge of #139054 - matthiaskrgr:rollup-2bk2fb4, r=matthiaskrgrbors-36/+26
Rollup of 7 pull requests Successful merges: - #137889 (update outdated doc with new example) - #138104 (Greatly simplify doctest parsing and information extraction) - #138678 (rustc_resolve: fix instability in lib.rmeta contents) - #138986 (feat(config): Add ChangeId enum for suppressing warnings) - #139038 (Update target maintainers for thumb targets to reflect new REWG Arm team name) - #139045 (bootstrap: update `test_find` test) - #139047 (Remove ScopeDepth) Failed merges: - #139044 (bootstrap: Avoid cloning `change-id` list) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-28Rollup merge of #139047 - m-ou-se:remove-scope-depth, r=oli-obkMatthias Krüger-31/+18
Remove ScopeDepth The scope depth was tracked, but never seemed to be used for anything. Every single place that used `(Scope, ScopeDepth)`, matched it on `(p, _)`.
2025-03-28Rollup merge of #138678 - durin42:rmeta-stability, r=fmeaseMatthias Krüger-3/+6
rustc_resolve: fix instability in lib.rmeta contents rust-lang/rust@23032f31c91f2 accidentally introduced some nondeterminism in the ordering of lib.rmeta files, which we caught in our bazel-based builds only recently due to being further behind than normal. In my testing, this fixes the issue.
2025-03-28Rollup merge of #137889 - mu001999-contrib:update-doc, r=wesleywiserMatthias Krüger-2/+2
update outdated doc with new example update the illegal definition example because we can compile `struct Ref<'a, T> { x: &'a T }` ([play](https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=2eb2f8800d423c316b545c864623ae16))
2025-03-28Auto merge of #138503 - bjorn3:string_merging, r=tmiaskobors-1/+7
Avoid wrapping constant allocations in packed structs when not necessary This way LLVM will set the string merging flag if the alloc is a nul terminated string, reducing binary sizes. try-job: armhf-gnu
2025-03-28Add test and commentbjorn3-0/+5
2025-03-28Avoid wrapping constant allocations in packed structs when not necessarybjorn3-1/+2
This way LLVM will set the string merging flag if the alloc is a nul terminated string, reducing binary sizes.
2025-03-28Remove outdated comment.Mara Bos-1/+0
2025-03-28Remove ScopeDepth entirely.Mara Bos-30/+18
The scope depth was tracked, but never actually used for anything.
2025-03-28Auto merge of #139037 - jhpratt:rollup-4c74y8a, r=jhprattbors-114/+314
Rollup of 6 pull requests Successful merges: - #138720 (Specify a concrete stack size in channel tests) - #139010 (Improve `xcrun` error handling) - #139021 (std: get rid of pre-Vista fallback code) - #139025 (Do not trim paths in MIR validator) - #139026 (Use `abs_diff` where applicable) - #139030 (saethlin goes on vacation) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-28Auto merge of #138965 - nnethercote:less-kw-Empty-hir-Lifetime, r=lcnrbors-79/+140
Remove `kw::Empty` uses from `hir::Lifetime::ident` `hir::Lifetime::ident` is sometimes set to `kw::Empty` and it's really confusing. This PR stops that. Helps with #137978. r? `@lcnr`
2025-03-27Rollup merge of #139026 - yotamofek:pr/abs-diff, r=compiler-errorsJacob Pratt-6/+2
Use `abs_diff` where applicable Very small cleanup, dogfooding a [new clippy lint](https://github.com/rust-lang/rust-clippy/pull/14482) I'm trying to add
2025-03-27Rollup merge of #139025 - compiler-errors:trim-validator-err, r=jieyouxuJacob Pratt-26/+31
Do not trim paths in MIR validator From my inline comment: ``` // The type checker formats a bunch of strings with type names in it, but these strings // are not always going to be encountered on the error path since the inliner also uses // the validator, and there are certain kinds of inlining (even for valid code) that // can cause validation errors (mostly around where clauses and rigid projections). ``` Fixes https://github.com/rust-lang/rust/issues/138979 r? `@jieyouxu`
2025-03-27Rollup merge of #139010 - madsmtm:parse-xcrun-better, r=wesleywiserJacob Pratt-82/+281
Improve `xcrun` error handling The compiler invokes `xcrun` on macOS when linking Apple targets, to find the Xcode SDK which contain all the necessary linker stubs. The error messages that `xcrun` outputs aren't always that great though, so this PR tries to improve that by providing extra context when an error occurs. Fixes https://github.com/rust-lang/rust/issues/56829. Fixes https://github.com/rust-lang/rust/issues/84534. Part of https://github.com/rust-lang/rust/issues/129432. See also the alternative https://github.com/rust-lang/rust/pull/131433. Tested on: - `x86_64-apple-darwin`, MacBook Pro running Mac OS X 10.12.6 - With no tooling installed - With Xcode 9.2 - With Xcode 9.2 Commandline Tools - `aarch64-apple-darwin`, MacBook M2 Pro running macOS 14.7.4 - With Xcode 13.4.1 - With Xcode 16.2 - Inside `nix-shell -p xcbuild` (nixpkgs' `xcrun` shim) - `aarch64-apple-darwin`, VM running macOS 15.3.1 - With no tooling installed - With Xcode 16.2 Commandline Tools ``@rustbot`` label O-apple r? compiler CC ``@BlackHoleFox`` ``@thomcc``
2025-03-28Don't use `kw::Empty` in `hir::Lifetime::ident`.Nicholas Nethercote-46/+131
`hir::Lifetime::ident` currently sometimes uses `kw::Empty` for elided lifetimes and sometimes uses `kw::UnderscoreLifetime`, and the distinction is used when creating some error suggestions, e.g. in `Lifetime::suggestion` and `ImplicitLifetimeFinder::visit_ty`. I found this *really* confusing, and it took me a while to understand what was going on. This commit replaces all uses of `kw::Empty` in `hir::Lifetime::ident` with `kw::UnderscoreLifetime`. It adds a new field `hir::Lifetime::is_path_anon` that mostly replaces the old empty/underscore distinction and makes things much clearer. Some other notable changes: - Adds a big comment to `Lifetime` talking about permissable field values. - Adds some assertions in `new_named_lifetime` about what ident values are permissible for the different `LifetimeRes` values. - Adds a `Lifetime::new` constructor that does some checking to make sure the `is_elided` and `is_anonymous` states are valid. - `add_static_impl_trait_suggestion` now looks at `Lifetime::res` instead of the ident when creating the suggestion. This is the one case where `is_path_anon` doesn't replace the old empty/underscore distinction. - A couple of minor pretty-printing improvements.
2025-03-28Remove `ImplicitObjectLifetimeDefault` case from `suggestion`.Nicholas Nethercote-15/+10
It has no effect on anything in the test suite. This means it can also be rewritten as a neater pairwise `match`.
2025-03-28Remove `LifetimeSuggestionPosition` and `Lifetime::suggestion_position`.Nicholas Nethercote-32/+13
They both are only used in `Lifetime::suggestion`. This commit inlines and removes them.
2025-03-27Use `abs_diff` where applicableYotam Ofek-6/+2
2025-03-27Drive-by get rid of a bunch of unnecessary :?Michael Goulet-25/+23
2025-03-27Do not trim paths in MIR validatorMichael Goulet-1/+8
2025-03-27Rollup merge of #139014 - xizheyin:issue-138931, r=oli-obkJacob Pratt-34/+74
Improve suggest construct with literal syntax instead of calling Closing #138931 When constructing a structure through a format similar to calling a constructor, we can use verbose suggestions to hint at using literal syntax for clearer advice. The case of multiple fields is also considered here, provided that the field has the same number of arguments as CallExpr. r? compiler
2025-03-27Rollup merge of #138989 - m-ou-se:clean-up-things, ↵Jacob Pratt-47/+35
r=jdonszelmann,dingxiangfei2009 Clean up a few things in rustc_hir_analysis::check::region Each commit is independent. They are all small clean-ups in rustc_hir_analysis::check::region.
2025-03-27Rollup merge of #138926 - nnethercote:less-kw-Empty-rustc_middle, r=lcnrJacob Pratt-14/+8
Remove `kw::Empty` uses from `rustc_middle`. There are several places in `rustc_middle` that check for an empty lifetime name. These checks appear to be totally unnecessary, because empty lifetime names aren't produced here. (Empty lifetime names *are* possible in `hir::Lifetime`. Perhaps there was some confusion between it and the `rustc_middle` types?) This commit removes the `kw::Empty` checks. r? `@lcnr`
2025-03-27Rollup merge of #138844 - petrochenkov:cfgtrace2, r=nnethercoteJacob Pratt-34/+38
expand: Leave traces when expanding `cfg` attributes This is the same as https://github.com/rust-lang/rust/pull/138515, but for `cfg(true)` instead of `cfg_attr`. The difference is that `cfg(true)`s already left "traces" after themselves - the `cfg` attributes themselves, with `expanded_inert_attrs` set to true, with full tokens, available to proc macros. This is not a reasonably expected behavior, but it could not be removed without a replacement, because a [major rustdoc feature](https://github.com/rust-lang/rfcs/pull/3631) and a number of clippy lints rely on it. This PR implements a replacement. This needs a crater run, because it changes observable behavior (in an intended way) - proc macros can no longer see expanded `cfg(true)` attributes. (Some minor unnecessary special casing for `sym::cfg_attr` is also removed in this PR.) r? `@nnethercote`
2025-03-27rustc_resolve: prevent iteration of refids for completenessAugie Fackler-2/+3
This came up in review, and it should help some future author not introduce non-deterministic output here.
2025-03-27Improve suggest construct with literal syntax instead of callingxizheyin-34/+74
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-03-27Auto merge of #139012 - Zalathar:rollup-qgt5yfo, r=Zalatharbors-261/+562
Rollup of 10 pull requests Successful merges: - #130883 (Add environment variable query) - #138624 (Add mipsel maintainer) - #138672 (Avoiding calling queries when collecting active queries) - #138935 (Update wg-prio triagebot config) - #138946 (Un-bury chapters from the chapter list in rustc book) - #138964 (Implement lint against using Interner and InferCtxtLike in random compiler crates) - #138977 (Don't deaggregate InvocationParent just to reaggregate it again) - #138980 (Collect items referenced from var_debug_info) - #138985 (Use the correct binder scope for elided lifetimes in assoc consts) - #138987 (Always emit `native-static-libs` note, even if it is empty) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-27Rollup merge of #138987 - madsmtm:fix-108825, r=jieyouxuStuart Cook-9/+5
Always emit `native-static-libs` note, even if it is empty Fixes https://github.com/rust-lang/rust/issues/108825. Retry of https://github.com/rust-lang/rust/pull/121216, finally got around to fixing the test, the errors in that PR were because `libcore` uses the `#[link]` attribute on MSVC. try-job: x86_64-msvc r? wesleywiser
2025-03-27Rollup merge of #138985 - oli-obk:push-mvlqmtmyozro, r=compiler-errorsStuart Cook-25/+35
Use the correct binder scope for elided lifetimes in assoc consts Beyond diagnostics this has no real effect, and it's also just about a future incompat lint. But it causes ICEs in some refactorings that I'm doing, so trying to get it out of the way
2025-03-27Rollup merge of #138980 - tmiasko:collect-var-debug-info, r=compiler-errorsStuart Cook-1/+6
Collect items referenced from var_debug_info The collection is limited to full debuginfo builds to match behavior of FunctionCx::compute_per_local_var_debug_info. Fixes #138942.
2025-03-27Rollup merge of #138977 - oli-obk:invoc-parent-keep-aggregated, ↵Stuart Cook-24/+15
r=compiler-errors Don't deaggregate InvocationParent just to reaggregate it again Also makes it easier to add more things to it in the future (which I am doing in some local experiments, so not really a reason to do this just now, but I think this PR stands on its own).
2025-03-27Rollup merge of #138964 - compiler-errors:usage-of-interner, r=lcnrStuart Cook-47/+108
Implement lint against using Interner and InferCtxtLike in random compiler crates Often `Interner` defines similar methods to `TyCtxt` (but often simplified due to the simpler API surface of the type system layer for the new solver), which people will either unintentionally or intentionally import and use. Let's discourage that. r? lcnr
2025-03-27Rollup merge of #138672 - Zoxc:deferred-queries-in-deadlock-handler, r=oli-obkStuart Cook-148/+311
Avoiding calling queries when collecting active queries This PR changes active query collection to no longer call queries. Instead the fields needing queries have their computation delayed to when an cycle error is emitted or when printing the query backtrace in a panic. This is done by splitting the fields in `QueryStackFrame` needing queries into a new `QueryStackFrameExtra` type. When collecting queries `QueryStackFrame` will contain a closure that can create `QueryStackFrameExtra`, which does make use of queries. Calling `lift` on a `QueryStackFrame` or `CycleError` will convert it to a variant containing `QueryStackFrameExtra` using those closures. This also only calls queries needed to collect information on a cycle errors, instead of information on all active queries. Calling queries when collecting active queries is a bit odd. Calling queries should not be done in the deadlock handler at all. This avoids the out of memory scenario in https://github.com/rust-lang/rust/issues/124901.
2025-03-27Rollup merge of #130883 - madsmtm:env-var-query, r=petrochenkovStuart Cook-7/+82
Add environment variable query Generally, `rustc` prefers command-line arguments, but in some cases, an environment variable really is the most sensible option. We should make sure that this works properly with the compiler's change-tracking mechanisms, such that changing the relevant environment variable causes a rebuild. This PR is a first step forwards in doing that. Part of the work needed to do https://github.com/rust-lang/rust/issues/118204, see https://github.com/rust-lang/rust/pull/129342 for some discussion. r? ``@petrochenkov``
2025-03-27Auto merge of #138915 - compiler-errors:binder-tweak, r=lcnrbors-32/+16
Instantiate binder before registering nested obligations for auto/built-in traits Instead of turning a `Binder<Vec<Ty>>` into a bunch of higher-ranked predicates, instantiate the binder eagerly *once* and turn them into a bunch of non-higher-ranked predicates. Right now this feels like a noop, but this `enter_forall_and_leak_universe` call would be the singular place where we could instantiate bound lifetime assumptions for coroutine witnesses... if we had them. Thus consolidating the binder instantiation here is useful if we want to fix the coroutine-auto-trait problem. r? lcnr