about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty/parameterized.rs
AgeCommit message (Collapse)AuthorLines
2023-11-20Unify defined_lib_features and lib_features queriesMichael Goulet-0/+1
2023-10-20s/Generator/Coroutine/Oli Scherer-2/+2
2023-09-23Enable drop_tracking_mir by default.Camille GILLOT-1/+0
2023-09-21Record asyncness span in HIRMichael Goulet-0/+1
2023-07-14Use u64 for incr comp allocation offsetsBen Kimock-0/+1
2023-06-22Migrate item_bounds to ty::ClauseMichael Goulet-0/+1
2023-06-19s/Clause/ClauseKindMichael Goulet-1/+1
2023-06-01Remember names of `cfg`-ed out items to mention them in diagnosticsNilstrieb-0/+1
`#[cfg]`s are frequently used to gate crate content behind cargo features. This can lead to very confusing errors when features are missing. For example, `serde` doesn't have the `derive` feature by default. Therefore, `serde::Serialize` fails to resolve with a generic error, even though the macro is present in the docs. This commit adds a list of all stripped item names to metadata. This is filled during macro expansion and then, through a fed query, persisted in metadata. The downstream resolver can then access the metadata to look at possible candidates for mentioning in the errors. This slightly increases metadata (800k->809k for the feature-heavy windows crate), but not enough to really matter.
2023-05-16Move DebuggerVisualizerFile types from rustc_span to rustc_middleMichael Woerister-1/+1
2023-04-24Split `{Idx, IndexVec, IndexSlice}` into their own modulesMaybe Waffle-1/+1
2023-03-14Encode opt_rpitit_info for associated typesMichael Goulet-0/+1
2023-02-16Rename some region-specific stuffMichael Goulet-1/+1
2023-02-10Resolve documentation links in rustc and store the results in metadataVadim Petrochenkov-0/+2
This commit implements MCP https://github.com/rust-lang/compiler-team/issues/584 It also removes code that is no longer used, and that includes code cloning resolver, so issue #83761 is fixed.
2023-01-27Separate witness type computation from the generator transform.Camille GILLOT-0/+1
2023-01-19Encode whether foreign opaques are TAITs or notMichael Goulet-0/+1
2023-01-14add EarlyBinder::subst_identity; impl ParameterizedOverTcx (needed for ↵Kyle Matsuda-0/+4
rustc_metadata) and Value for EarlyBinder
2023-01-09Use newtype for unused generic parametersNilstrieb-0/+1
2022-12-15Rollup merge of #105758 - Nilstrieb:typeck-results-mod, r=compiler-errorsMatthias Krüger-22/+16
Move `TypeckResults` to separate module `ty::context` is really big and the typeck results aren't directly related to `TyCtxt`, so move them to a separate module. Also contains a small drive-by macro "improvement".
2022-12-15Small cleanup in parameterizedNilstrieb-22/+16
2022-12-15Merge `SimplifiedTypeGen<D>` into `SimplifiedType`.Nicholas Nethercote-2/+2
`SimplifiedTypeGen<DefId>` is the only instantiation used, so we don't need the generic parameter.
2022-11-29Make inferred_outlives_crate return ClauseSantiago Pastorino-1/+2
2022-11-25Add empty ConstKind::Abstractkadmin-2/+0
Initial pass at expr/abstract const/s Address comments Switch to using a list instead of &[ty::Const], rm `AbstractConst` Remove try_unify_abstract_consts Update comments Add edits Recurse more More edits Prevent equating associated consts Move failing test to ui Changes this test from incremental to ui, and mark it as failing and a known bug. Does not cause the compiler to ICE, so should be ok.
2022-11-22Split `MacArgs` in two.Nicholas Nethercote-1/+1
`MacArgs` is an enum with three variants: `Empty`, `Delimited`, and `Eq`. It's used in two ways: - For representing attribute macro arguments (e.g. in `AttrItem`), where all three variants are used. - For representing function-like macros (e.g. in `MacCall` and `MacroDef`), where only the `Delimited` variant is used. In other words, `MacArgs` is used in two quite different places due to them having partial overlap. I find this makes the code hard to read. It also leads to various unreachable code paths, and allows invalid values (such as accidentally using `MacArgs::Empty` in a `MacCall`). This commit splits `MacArgs` in two: - `DelimArgs` is a new struct just for the "delimited arguments" case. It is now used in `MacCall` and `MacroDef`. - `AttrArgs` is a renaming of the old `MacArgs` enum for the attribute macro case. Its `Delimited` variant now contains a `DelimArgs`. Various other related things are renamed as well. These changes make the code clearer, avoids several unreachable paths, and disallows the invalid values.
2022-10-21Introduce deduced parameter attributes, and use them for deducing `readonly` onPatrick Walton-0/+1
indirect immutable freeze by-value function parameters. Right now, `rustc` only examines function signatures and the platform ABI when determining the LLVM attributes to apply to parameters. This results in missed optimizations, because there are some attributes that can be determined via analysis of the MIR making up the function body. In particular, `readonly` could be applied to most indirectly-passed by-value function arguments (specifically, those that are freeze and are observed not to be mutated), but it currently is not. This patch introduces the machinery that allows `rustc` to determine those attributes. It consists of a query, `deduced_param_attrs`, that, when evaluated, analyzes the MIR of the function to determine supplementary attributes. The results of this query for each function are written into the crate metadata so that the deduced parameter attributes can be applied to cross-crate functions. In this patch, we simply check the parameter for mutations to determine whether the `readonly` attribute should be applied to parameters that are indirect immutable freeze by-value. More attributes could conceivably be deduced in the future: `nocapture` and `noalias` come to mind. Adding `readonly` to indirect function parameters where applicable enables some potential optimizations in LLVM that are discussed in [issue 103103] and [PR 103070] around avoiding stack-to-stack memory copies that appear in functions like `core::fmt::Write::write_fmt` and `core::panicking::assert_failed`. These functions pass a large structure unchanged by value to a subfunction that also doesn't mutate it. Since the structure in this case is passed as an indirect parameter, it's a pointer from LLVM's perspective. As a result, the intermediate copy of the structure that our codegen emits could be optimized away by LLVM's MemCpyOptimizer if it knew that the pointer is `readonly nocapture noalias` in both the caller and callee. We already pass `nocapture noalias`, but we're missing `readonly`, as we can't determine whether a by-value parameter is mutated by examining the signature in Rust. I didn't have much success with having LLVM infer the `readonly` attribute, even with fat LTO; it seems that deducing it at the MIR level is necessary. No large benefits should be expected from this optimization *now*; LLVM needs some changes (discussed in [PR 103070]) to more aggressively use the `noalias nocapture readonly` combination in its alias analysis. I have some LLVM patches for these optimizations and have had them looked over. With all the patches applied locally, I enabled LLVM to remove all the `memcpy`s from the following code: ```rust fn main() { println!("Hello {}", 3); } ``` which is a significant codegen improvement over the status quo. I expect that if this optimization kicks in in multiple places even for such a simple program, then it will apply to Rust code all over the place. [issue 103103]: https://github.com/rust-lang/rust/issues/103103 [PR 103070]: https://github.com/rust-lang/rust/pull/103070
2022-10-07Rewrite representabilityCameron Steffen-0/+1
2022-09-23Serialize RPITIT values in libsMichael Goulet-0/+5
2022-09-07rustc: Parameterize `ty::Visibility` over used IDVadim Petrochenkov-2/+2
It allows using `LocalDefId` instead of `DefId` when possible, and also encode cheaper `Visibility<DefIndex>` into metadata.
2022-08-30Separate macro_rules and macro_definition.Camille GILLOT-1/+1
2022-08-30Use tables for macros.Camille GILLOT-1/+1
2022-08-30Move AssocContainer to a metadata table.Camille GILLOT-0/+1
2022-08-29Rollup merge of #99821 - cjgillot:ast-lifetimes-2, r=compiler-errorsDylan DPC-0/+1
Remove separate indexing of early-bound regions ~Based on https://github.com/rust-lang/rust/pull/99728.~ This PR copies some modifications from https://github.com/rust-lang/rust/pull/97839 around object lifetime defaults. These modifications allow to stop counting generic parameters during lifetime resolution, and rely on the indexing given by `rustc_typeck::collect`.
2022-08-03Compute `object_lifetime_default` per parameter.Camille GILLOT-0/+1
2022-07-26Implement `#[rustc_default_body_unstable]`Maybe Waffle-0/+1
This attribute allows to mark default body of a trait function as unstable. This means that implementing the trait without implementing the function will require enabling unstable feature. This is useful in conjunction with `#[rustc_must_implement_one_of]`, we may want to relax requirements for a trait, for example allowing implementing either of `PartialEq::{eq, ne}`, but do so in a safe way -- making implementation of only `PartialEq::ne` unstable.
2022-07-12Move abstract const to rustc_middle::tykadmin-1/+1
2022-05-24Make Lazy not care about lifetimes until decodeMichael Goulet-0/+119