about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
AgeCommit message (Collapse)AuthorLines
2023-12-18Check FnPtr/FnDef built-in fn traits correctly with effectsMichael Goulet-1/+1
2023-12-18Replace some instances of FxHashMap/FxHashSet with stable alternatives ↵Michael Woerister-3/+3
(mostly in rustc_hir and rustc_ast_lowering) Part of https://github.com/rust-lang/compiler-team/issues/533
2023-12-18dont discard overflow from normalizes-to goalslcnr-0/+3
2023-12-18track the source of nested goalslcnr-4/+28
2023-12-18Rename many `DiagCtxt` arguments.Nicholas Nethercote-3/+3
2023-12-18Rename `Session::span_diagnostic` as `Session::dcx`.Nicholas Nethercote-5/+5
2023-12-18Rename `HandlerInner` as `DiagCtxtInner`.Nicholas Nethercote-1/+1
2023-12-18Rename `Handler` as `DiagCtxt`.Nicholas Nethercote-2/+2
2023-12-18resolve: Replace visibility table in resolver outputs with query feedingVadim Petrochenkov-2/+5
Also feed missing visibilities for import stems and trait impl items, which were previously evaluated lazily.
2023-12-16Provide better suggestions for T == &T and &T == Tsjwang05-1/+18
2023-12-16Remove unnecessary constness from ProjectionCandidateMichael Goulet-4/+2
2023-12-15Rollup merge of #119003 - matthiaskrgr:nein_clone, r=NadrierilJubilee-4/+4
NFC: do not clone types that are copy
2023-12-15NFC: do not clone types that are copyMatthias Krüger-4/+4
2023-12-15Rollup merge of #118727 - compiler-errors:lint-decorate, r=WaffleLapkinJubilee-46/+13
Don't pass lint back out of lint decorator Change the decorator function in the signature of the `emit_lint`/`span_lint`/etc family of methods from `impl for<'a, 'b> FnOnce(&'b mut DiagnosticBuilder<'a, ()>) -> &'b mut DiagnosticBuilder<'a, ()>` to `impl for<'a, 'b> FnOnce(&'b mut DiagnosticBuilder<'a, ()>)`. I consider it easier to read this way, especially when there's control flow involved. r? nnethercote though feel free to reassign
2023-12-15Fix commentsMichael Goulet-26/+3
2023-12-15Don't pass lint back out of lint decoratorMichael Goulet-20/+10
2023-12-15Annotate some more bugsMichael Goulet-7/+4
2023-12-15Rollup merge of #118888 - compiler-errors:uplift-more-things, r=jackh726Matthias Krüger-98/+33
Uplift `TypeAndMut` and `ClosureKind` to `rustc_type_ir` Uplifts `TypeAndMut` and `ClosureKind` I know I said I was just going to get rid of `TypeAndMut` (https://github.com/rust-lang/types-team/issues/124) but I think this is much simpler, lol r? `@jackh726` or `@lcnr`
2023-12-14Rollup merge of #118933 - nnethercote:cleanup-errors-even-more, ↵Jubilee-2/+4
r=compiler-errors Cleanup errors handlers even more A sequel to #118587. r? `@compiler-errors`
2023-12-15Change `msg: impl Into<String>` for bug diagnostics.Nicholas Nethercote-2/+4
To `msg: impl Into<DiagnosticMessage>`, like all the other diagnostics. For consistency.
2023-12-14Move special methods from ClosureKind back into rustcMichael Goulet-24/+20
2023-12-14update use of feature flagslcnr-2/+2
2023-12-14rename `-Ztrait-solver` to `-Znext-solver`lcnr-6/+2
2023-12-14Auto merge of #117749 - aliemjay:perf-canon-cache, r=lcnrbors-3/+70
cache param env canonicalization Canonicalize ParamEnv only once and store it. Then whenever we try to canonicalize `ParamEnvAnd<'tcx, T>` we only have to canonicalize `T` and then merge the results. Prelimiary results show ~3-4% savings in diesel and serde benchmarks. Best to review commits individually. Some commits have a short description. Initial implementation had a soundness bug (https://github.com/rust-lang/rust/pull/117749#issuecomment-1840453387) due to cache invalidation: - When canonicalizing `Ty<'?0>` we first try to resolve region variables in the current InferCtxt which may have a constraint `?0 == 'static`. This means that we register `Ty<'?0> => Canonical<Ty<'static>>` in the cache, which is obviously incorrect in another inference context. - This is fixed by not doing region resolution when canonicalizing the query *input* (vs. response), which is the only place where ParamEnv is used, and then in a later commit we *statically* guard against any form of inference variable resolution of the cached canonical ParamEnv's. r? `@ghost`
2023-12-14make infcx optional in canonicalizerAli MJ Al-Nasrawy-2/+10
This doesn't change behavior. It should prevent unintentional resolution of inference variables during canonicalization, which previously caused a soundness bug. See PR description for more.
2023-12-13Tweak `short_ty_string` to reduce number of filesEsteban Küber-9/+11
When shortening types and writing them to disk, make `short_ty_string` capable of reusing the same file, instead of writing a file per shortened type.
2023-12-13fix small perf regressionsAli MJ Al-Nasrawy-1/+11
2023-12-13don't store OriginalQueryValues::universe_mapAli MJ Al-Nasrawy-4/+11
ParamEnv is canonicalized in *queries input* rather than query response. In such case we don't "preserve universes" of canonical variable. This means that `universe_map` always has the default value, which is wasteful to store in the cache.
2023-12-13global param_env canonicalization cacheAli MJ Al-Nasrawy-2/+44
2023-12-12Uplift TypeAndMutMichael Goulet-22/+8
2023-12-12Uplift ClosureKindMichael Goulet-76/+29
2023-12-12Move some methods from `tcx.hir()` to `tcx`zetanumbers-62/+72
Renamings: - find -> opt_hir_node - get -> hir_node - find_by_def_id -> opt_hir_node_by_def_id - get_by_def_id -> hir_node_by_def_id Fix rebase changes using removed methods Use `tcx.hir_node_by_def_id()` whenever possible in compiler Fix clippy errors Fix compiler Apply suggestions from code review Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com> Add FIXME for `tcx.hir()` returned type about its removal Simplify with with `tcx.hir_node_by_def_id`
2023-12-12Auto merge of #118841 - compiler-errors:always-copy, r=jackh726bors-5/+2
Make most `rustc_type_ir` kinds `Copy` by default 1. There's no reason why `TyKind` and `ConstKind`/`ConstData` can't be `Copy`. This allows us to avoid needing a typed arena for the two types. 2. Simplify some impls into derives.
2023-12-12Make ConstKind and TyKind CopyMichael Goulet-5/+2
2023-12-11remove some redundant clonesMatthias Krüger-1/+1
2023-12-11Auto merge of #118661 - fee1-dead-contrib:restore-const-partialEq, ↵bors-41/+25
r=compiler-errors Restore `const PartialEq` And thus fixes a number of tests. There is a bug that still needs to be fixed, so WIP for now. r? `@compiler-errors`
2023-12-10fix clippyDeadbeef-10/+9
2023-12-10Auto merge of #118692 - surechen:remove_unused_imports, r=petrochenkovbors-38/+14
remove redundant imports detects redundant imports that can be eliminated. for #117772 : In order to facilitate review and modification, split the checking code and removing redundant imports code into two PR. r? `@petrochenkov`
2023-12-10clean up leftover FIXMEDeadbeef-30/+5
2023-12-10fix testsDeadbeef-1/+2
2023-12-10Revert "Don't print host effect param in pretty path_generic_args"Deadbeef-26/+33
This reverts commit f1bf874fb13703d706fc8184407c6df12555d8e9.
2023-12-10filter out trailing effect param in `own_args_no_defaults`Deadbeef-0/+2
2023-12-10Auto merge of #118788 - compiler-errors:const-pretty, r=fee1-deadbors-41/+38
Don't print host effect param in pretty `path_generic_args` Make `own_args_no_defaults` pass back the `GenericParamDef`, so that we can pass both the args *and* param definitions into `path_generic_args`. That allows us to use the `GenericParamDef` to filter out effect params. This allows us to filter out the host param regardless of whether it's `sym::host` or `true`/`false`. This also renames a couple of `const_effect_param` -> `host_effect_param`, and restores `~const` pretty printing to `TraitPredPrintModifiersAndPath`. cc #118785 r? `@fee1-dead` cc `@oli-obk`
2023-12-10remove redundant importssurechen-38/+14
detects redundant imports that can be eliminated. for #117772 : In order to facilitate review and modification, split the checking code and removing redundant imports code into two PR.
2023-12-09Auto merge of #118308 - Nadrieril:sound-exhaustive-patterns-take-3, ↵bors-10/+31
r=compiler-errors Don't warn an empty pattern unreachable if we're not sure the data is valid Exhaustiveness checking used to be naive about the possibility of a place containing invalid data. This could cause it to emit an "unreachable pattern" lint on an arm that was in fact reachable, as in https://github.com/rust-lang/rust/issues/117119. This PR fixes that. We now track whether a place that is matched on may hold invalid data. This also forced me to be extra precise about how exhaustiveness manages empty types. Note that this now errs in the opposite direction: the following arm is truly unreachable (because the binding causes a read of the value) but not linted as such. I'd rather not recommend writing a `match ... {}` that has the implicit side-effect of loading the value. [Never patterns](https://github.com/rust-lang/rust/issues/118155) will solve this cleanly. ```rust match union.value { _x => unreachable!(), } ``` I recommend reviewing commit by commit. I went all-in on the test suite because this went through a lot of iterations and I kept everything. The bit I'm least confident in is `is_known_valid_scrutinee` in `check_match.rs`. Fixes https://github.com/rust-lang/rust/issues/117119.
2023-12-09Print constness in TraitPredPrintModifiersAndPathMichael Goulet-3/+6
2023-12-09s/const_effect/host_effectMichael Goulet-5/+6
2023-12-09Don't print host effect param in pretty path_generic_argsMichael Goulet-33/+26
2023-12-09Auto merge of #116170 - matthewjasper:remove-thir-destruction-scopes, r=cjgillotbors-8/+2
Don't include destruction scopes in THIR They are not used by anyone, and add memory/performance overhead.
2023-12-09Rollup merge of #118198 - Zalathar:if-not, r=cjgillotJubilee-0/+8
coverage: Use `SpanMarker` to improve coverage spans for `if !` expressions Coverage instrumentation works by extracting source code spans from MIR. However, some kinds of syntax are effectively erased during MIR building, so their spans don't necessarily exist anywhere in MIR, making them invisible to the coverage instrumentor (unless we resort to various heuristics and hacks to recover them). This PR introduces `CoverageKind::SpanMarker`, which is a new variant of `StatementKind::Coverage`. Its sole purpose is to represent spans that would otherwise not appear in MIR, so that the coverage instrumentor can extract them. When coverage is enabled, the MIR builder can insert these dummy statements as needed, to improve the accuracy of spans used by coverage mappings. Fixes #115468. --- ```@rustbot``` label +A-code-coverage