about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
AgeCommit message (Collapse)AuthorLines
2023-11-28Add with_opt_const_effect_param helper, simplifyMichael Goulet-0/+17
2023-11-28Fix PartialEq args when #[const_trait] is enabledMichael Goulet-0/+34
2023-11-28resolve: Feed the `def_kind` query immediately on `DefId` creationVadim Petrochenkov-97/+6
2023-11-27Auto merge of #117200 - rmehri01:repeated_help, r=WaffleLapkinbors-30/+65
Don't add redundant help for object safety violations Fixes #117186 r? WaffleLapkin
2023-11-27Print list of missing target features when calling a function with target ↵Eduardo Sánchez Muñoz-3/+10
features outside an unsafe block
2023-11-27Rollup merge of #118340 - compiler-errors:tweaks, r=lqdTakayuki Maeda-10/+10
Use helper functions in `pretty.rs` instead of accessing the `Cell`s manually Pulled this out of another PR that I never landed.
2023-11-26Use helpersMichael Goulet-10/+10
2023-11-26Auto merge of #118316 - Mark-Simulacrum:delete-copy-to-upvars, r=cjgillotbors-0/+7
Remove borrowck Upvar duplication This cuts out an extra allocation and copying over from the already cached closure capture information.
2023-11-26Remove Upvar duplicationMark Rousskov-0/+7
This cuts out an extra allocation and copying over from the already cached closure capture information.
2023-11-26don't add redundant help for object safety violationsRyan Mehri-30/+65
2023-11-26Auto merge of #118319 - GuillaumeGomez:rollup-vte50yq, r=GuillaumeGomezbors-18/+22
Rollup of 4 pull requests Successful merges: - #118296 (rustdoc: replace `elemIsInParent` with `Node.contains`) - #118302 (Clean dead codes) - #118311 (merge `DefKind::Coroutine` into `Defkind::Closure`) - #118318 (Remove myself from users on vacation) r? `@ghost` `@rustbot` modify labels: rollup
2023-11-26Rollup merge of #118311 - bvanjoi:merge_coroutinue_into_closure, r=petrochenkovGuillaume Gomez-18/+22
merge `DefKind::Coroutine` into `Defkind::Closure` Related to #118188 We no longer need to be concerned about the precise type whether it's `DefKind::Closure` or `DefKind::Coroutine`. Furthermore, thanks for the great work done by `@petrochenkov` on investigating https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Why.20does.20it.20hang.20when.20querying.20.EF.BB.BF.60opt_def_kind.60.3F r? `@petrochenkov`
2023-11-26Auto merge of #117301 - saethlin:finish-rmeta-encoding, r=WaffleLapkinbors-2/+5
Call FileEncoder::finish in rmeta encoding Fixes https://github.com/rust-lang/rust/issues/117254 The bug here was that rmeta encoding never called FileEncoder::finish. Now it does. Most of the changes here are needed to support that, since rmeta encoding wants to finish _then_ access the File in the encoder, so finish can't move out. I tried adding a `cfg(debug_assertions)` exploding Drop impl to FileEncoder that checked for finish being called before dropping, but fatal errors cause unwinding so this isn't really possible. If we encounter a fatal error with a dirty FileEncoder, the Drop impl ICEs even though the implementation is correct. If we try to paper over that by wrapping FileEncoder in ManuallyDrop then that just erases the fact that Drop automatically checks that we call finish on all paths. I also changed the name of DepGraph::encode to DepGraph::finish_encoding, because that's what it does and it makes the fact that it is the path to FileEncoder::finish less confusing. r? `@WaffleLapkin`
2023-11-26merge `DefKind::Coroutine` into `DefKind::Closure`bohan-18/+22
2023-11-26rustc: `hir().local_def_id_to_hir_id()` -> `tcx.local_def_id_to_hir_id()` ↵Vadim Petrochenkov-21/+16
cleanup
2023-11-26Auto merge of #118250 - petrochenkov:optdefkind, r=compiler-errorsbors-30/+9
rustc: Make `def_kind` mandatory for all `DefId`s Prerequisite for https://github.com/rust-lang/rust/pull/118188.
2023-11-25Rollup merge of #118288 - compiler-errors:is_some_and, r=lqd,dtolnayMichael Goulet-1/+1
Use `is_{some,ok}_and` more in the compiler slightly more fluent-reading code
2023-11-25Rollup merge of #118201 - compiler-errors:obligation-causes, r=cjgillotMichael Goulet-13/+2
Miscellaneous `ObligationCauseCode` cleanups Remove some dead code/unused `ObligationCauseCode`s.
2023-11-25Rollup merge of #118158 - nnethercote:reduce-fluent-boilerplate, ↵Michael Goulet-4/+1
r=compiler-errors Reduce fluent boilerplate Best reviewed one commit at a time. r? `@davidtwco`
2023-11-25Remove 3 more unused ObligationCauseCodesMichael Goulet-9/+0
2023-11-25Remove some more unused codepaths in (region) error reportingMichael Goulet-1/+2
2023-11-25Remove unused ObligationCauseCode::ProjectionWfMichael Goulet-3/+0
2023-11-26Use `rustc_fluent_macro::fluent_messages!` directly.Nicholas Nethercote-3/+1
Currently we always do this: ``` use rustc_fluent_macro::fluent_messages; ... fluent_messages! { "./example.ftl" } ``` But there is no need, we can just do this everywhere: ``` rustc_fluent_macro::fluent_messages! { "./example.ftl" } ``` which is shorter.
2023-11-26Avoid need for `{D,Subd}iagnosticMessage` imports.Nicholas Nethercote-1/+0
The `fluent_messages!` macro produces uses of `crate::{D,Subd}iagnosticMessage`, which means that every crate using the macro must have this import: ``` use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage}; ``` This commit changes the macro to instead use `rustc_errors::{D,Subd}iagnosticMessage`, which avoids the need for the imports.
2023-11-25Rollup merge of #118199 - compiler-errors:qpath, r=lcnrGuillaume Gomez-1/+1
Remove `HirId` from `QPath::LangItem` Remove `HirId` from `QPath::LangItem`, since there was only *one* use-case (`ObligationCauseCode::AwaitableExpr`), which we can instead recover by walking the HIR tree.
2023-11-25Rollup merge of #117871 - klensy:unused-pub, r=cjgillotGuillaume Gomez-128/+0
remove unused pub fns This removes some unused `pub fn`; also fixes few obsoleted fn names or added fixmes with reminders to update them.
2023-11-25is_{some,ok}_andMichael Goulet-1/+1
2023-11-25Remove HirId from QPath::LangItemMichael Goulet-1/+1
2023-11-25Review commentMichael Goulet-0/+11
2023-11-25Remove mir::Const::from_anon_constMichael Goulet-99/+7
2023-11-25rustc: Make `def_kind` mandatory for all `DefId`sVadim Petrochenkov-30/+9
2023-11-25Rollup merge of #118271 - compiler-errors:float, r=RalfJungLeón Orell Valerian Liehr-2/+5
Separate `NaN`/`Inf` floats with `_` r? RalfJung Fixes #118221 No test 🤷 unless you know a good way to print an `ImmTy` in a unit test?
2023-11-25Auto merge of #118227 - Mark-Simulacrum:worker-local-outline, r=cjgillotbors-4/+4
Optimize QueryArena allocation This shifts the WorkerLocal wrapper to be outside the QueryArena, meaning that instead of having each query allocate distinct arenas per-worker we allocate the full set of arenas per-worker. This is primarily a code size optimization (locally, ~85 kilobytes, [perf is reporting >100 kilobytes](https://perf.rust-lang.org/compare.html?start=1fd418f92ed13db88a21865ba5d909abcf16b6cc&end=884c95a3f1fe8d28630ec3cdb0c8f95b2e539fde&stat=instructions%3Au&tab=artifact-size)), saving a bunch of code in the initialization of the arenas which was previously duplicated lots of times (per arena type). Additionally this tells LLVM that the thread count can't be zero in this code (I believe this is true?) which shaves some small amount of bytes off as well since we eliminate checks for zero in the vec allocations.
2023-11-24Separate Nan/Inf floats with _Michael Goulet-2/+5
2023-11-24Auto merge of #118189 - compiler-errors:cache-flags-for-const, r=nnethercotebors-33/+82
Cache flags for `ty::Const` Not sure if this has been attempted yet, but worth a shot. It does make the code simpler in `rustc_type_ir`, since we can assume that consts have a `flags` method that is no-cost. r? `@ghost`
2023-11-23Move WorkerLocal out of QueryArenasMark Rousskov-4/+4
This cuts librustc_driver.so code size by ~85 kilobytes.
2023-11-23few moreklensy-17/+0
2023-11-23remove unused pub fnklensy-111/+0
2023-11-22Call FileEncoder::finish in rmeta encodingBen Kimock-2/+5
2023-11-22Cache flags for ty::ConstMichael Goulet-33/+82
2023-11-22Auto merge of #118120 - compiler-errors:closure-kind, r=lcnrbors-12/+0
Remove `PredicateKind::ClosureKind` We don't need the `ClosureKind` predicate kind -- instead, `Fn`-family trait goals are left as ambiguous, and we only need to make progress on `FnOnce` projection goals for inference purposes. This is similar to how we do confirmation of `Fn`-family trait and projection goals in the new trait solver, which also doesn't use the `ClosureKind` predicate. Some hacky logic is added in the second commit so that we can keep the error messages the same.
2023-11-22Auto merge of #118178 - compiler-errors:rollup-0i11w85, r=compiler-errorsbors-4/+2
Rollup of 6 pull requests Successful merges: - #118012 (Add support for global allocation in smir) - #118013 (Enable Rust to use the EHCont security feature of Windows) - #118100 (Enable profiler in dist-powerpc64-linux) - #118142 (Tighten up link attributes for llvm-wrapper bindings) - #118147 (Fix some unnecessary casts) - #118161 (Allow defining opaques in `check_coroutine_obligations`) r? `@ghost` `@rustbot` modify labels: rollup
2023-11-22Rollup merge of #118161 - compiler-errors:coroutine-obligation-opaques, r=lcnrMichael Goulet-1/+1
Allow defining opaques in `check_coroutine_obligations` In the new trait solver, when an obligation stalls on an unresolved coroutine witness, we will stash away the *root* obligation, even if the stalled obligation is only a distant descendent of the root obligation, since the new solver is purely recursive. This means that we may need to reprocess alias-relate obligations (and others) which may define opaque types in the new solver. Currently, we use the coroutine's def id as the defining anchor in `check_coroutine_obligations`, which will allow defining no opaque types, resulting in errors like: ``` error[E0271]: type mismatch resolving `{coroutine@<source>:6:5: 6:17} <: impl Clone` --> <source>:6:5 | 6 | / move |_: ()| { 7 | | let () = yield (); 8 | | } | |_____^ types differ ``` So this PR fixes the defining anchor and does the same trick as `check_opaque_well_formed`, where we manually compare opaques that were defined against their hidden types to make sure they weren't defined differently when processing these stalled coroutine obligations. r? `@lcnr` cc `@cjgillot`
2023-11-22Rollup merge of #118147 - Nilstrieb:no-redundant-casts, r=WaffleLapkinMichael Goulet-3/+1
Fix some unnecessary casts `x clippy compiler -Aclippy::all -Wclippy::unnecessary_cast --fix` with some manual review to ensure every fix is correct.
2023-11-22Auto merge of #118133 - Urgau:stabilize_trait_upcasting, r=WaffleLapkinbors-1/+1
Stabilize RFC3324 dyn upcasting coercion This PR stabilize the `trait_upcasting` feature, aka https://github.com/rust-lang/rfcs/pull/3324. The FCP was completed here: https://github.com/rust-lang/rust/issues/65991#issuecomment-1817552398. ~~And also remove the `deref_into_dyn_supertrait` lint which is now handled by dyn upcasting coercion.~~ Heavily inspired by https://github.com/rust-lang/rust/pull/101718 Fixes https://github.com/rust-lang/rust/issues/65991
2023-11-22Stabilize RFC3324 dyn upcasting coercionUrgau-1/+1
Aka trait_upcasting feature. And also adjust the `deref_into_dyn_supertrait` lint.
2023-11-22Replace `no_ord_impl` with `orderable`.Nicholas Nethercote-0/+7
Similar to the previous commit, this replaces `newtype_index`'s opt-out `no_ord_impl` attribute with the opt-in `orderable` attribute.
2023-11-22Replace `custom_encodable` with `encodable`.Nicholas Nethercote-0/+10
By default, `newtype_index!` types get a default `Encodable`/`Decodable` impl. You can opt out of this with `custom_encodable`. Opting out is the opposite to how Rust normally works with autogenerated (derived) impls. This commit inverts the behaviour, replacing `custom_encodable` with `encodable` which opts into the default `Encodable`/`Decodable` impl. Only 23 of the 59 `newtype_index!` occurrences need `encodable`. Even better, there were eight crates with a dependency on `rustc_serialize` just from unused default `Encodable`/`Decodable` impls. This commit removes that dependency from those eight crates.
2023-11-22Allow defining opaques in check_coroutine_obligationsMichael Goulet-1/+1
2023-11-22Auto merge of #117582 - compiler-errors:uplift-canonical-var, r=jackh726bors-160/+48
Uplift `CanonicalVarInfo` and friends into `rustc_type_ir` Depends on #117580 and #117578 Uplift `CanonicalVarInfo` and friends into `rustc_type_ir` so they can be consumed by an interner-agnostic `Canonicalizer` implementation for the new trait solver ❤️ r? `@ghost`