summary refs log tree commit diff
path: root/compiler/rustc_metadata/src/rmeta/encoder.rs
AgeCommit message (Collapse)AuthorLines
2022-03-31Merge impl_constness and is_const_fn_raw.Camille GILLOT-0/+4
2022-03-31Create trait_def table.Camille GILLOT-11/+8
2022-03-31Store fn constness in impl_constness.Camille GILLOT-37/+26
2022-03-31Introduce repr_options table.Camille GILLOT-22/+23
2022-03-31Rollup merge of #95497 - nyurik:compiler-spell-comments, r=compiler-errorsDylan DPC-1/+1
Spellchecking compiler comments This PR cleans up the rest of the spelling mistakes in the compiler comments. This PR does not change any literal or code spelling issues.
2022-03-30Auto merge of #95436 - cjgillot:static-mut, r=oli-obkbors-12/+8
Remember mutability in `DefKind::Static`. This allows to compute the `BodyOwnerKind` from `DefKind` only, and removes a direct dependency of some MIR queries onto HIR. As a side effect, it also simplifies metadata, since we don't need 4 flavours of `EntryKind::*Static` any more.
2022-03-30Spellchecking compiler commentsYuri Astrakhan-1/+1
This PR cleans up the rest of the spelling mistakes in the compiler comments. This PR does not change any literal or code spelling issues.
2022-03-30rework implementation for inherent impls for builtin typeslcnr-3/+35
2022-03-29Remember mutability in `DefKind::Static`.Camille GILLOT-12/+8
This allows to compute the `BodyOwnerKind` from `DefKind` only, and removes a direct dependency of some MIR queries onto HIR. As a side effect, it also simplifies metadata, since we don't need 4 flavours of `EntryKind::*Static` any more.
2022-03-11Improve `AdtDef` interning.Nicholas Nethercote-15/+15
This commit makes `AdtDef` use `Interned`. Much the commit is tedious changes to introduce getter functions. The interesting changes are in `compiler/rustc_middle/src/ty/adt.rs`.
2022-03-03Rollup merge of #94057 - lcnr:simplify_type-uwu, r=nikomatsakisMatthias Krüger-2/+2
improve comments for `simplify_type` Should now correctly describe what's going on. Experimented with checking the invariant for projections but that ended up requiring fairly involved changes. I assume that it is not possible to get unsoundness here, at least for now and I can pretty much guarantee that it's impossible to trigger it by accident. r? `````@nikomatsakis````` cc #92721
2022-02-25Rollup merge of #94252 - lcnr:def_kind-encoding, r=cjgillotMatthias Krüger-7/+2
don't special case `DefKind::Ctor` in encoding considering that we still use `DefKind::Ctor` for these in `Res`, this seems weird and definitely felt like a bug when encountering it while working on #89862. r? `@cjgillot`
2022-02-24metadata: Tweak the way in which declarative macros are encodedVadim Petrochenkov-1/+1
To make the `macro_rules` flag more readily available without decoding everything else
2022-02-24resolve: Fix incorrect results of `opt_def_kind` query for some built-in macrosVadim Petrochenkov-1/+1
Previously it always returned `MacroKind::Bang` while some of those macros are actually attributes and derives
2022-02-24don't special case `DefKind::Ctor` in encodinglcnr-7/+2
2022-02-21update docs for `simplify_type`lcnr-2/+2
2022-02-19Add generator_kind table.Camille GILLOT-1/+2
2022-02-19Add fn_arg_names table.Camille GILLOT-18/+12
2022-02-19Add asyncness table.Camille GILLOT-8/+5
2022-02-19Add rendered_const table.Camille GILLOT-16/+13
2022-02-19Add mir_const_qualifs table.Camille GILLOT-4/+6
2022-02-19Drop ImplData.Camille GILLOT-27/+19
2022-02-19Encode metadata using queries.Camille GILLOT-22/+22
2022-02-19Stop interning stability.Camille GILLOT-1/+1
2022-02-17Rollup merge of #94011 - est31:let_else, r=lcnrMatthias Krüger-1/+1
Even more let_else adoptions Continuation of #89933, #91018, #91481, #93046, #93590.
2022-02-16Adopt let_else in even more placesest31-1/+1
2022-02-14fast_reject: remove `StripReferences`lcnr-2/+1
2022-02-09Ensure that queries only return Copy types.Camille GILLOT-1/+1
2022-01-25Auto merge of #93095 - Aaron1011:remove-assoc-ident, r=cjgillotbors-1/+1
Store a `Symbol` instead of an `Ident` in `AssocItem` This is the same idea as #92533, but for `AssocItem` instead of `VariantDef`/`FieldDef`. With this change, we no longer have any uses of `#[stable_hasher(project(...))]`
2022-01-22Use an `indexmap` to avoid sorting `LocalDefId`spierwill-3/+1
Update `indexmap` to 1.8.0. Bless test
2022-01-19Store a `Symbol` instead of an `Ident` in `AssocItem`Aaron Hill-1/+1
This is the same idea as #92533, but for `AssocItem` instead of `VariantDef`/`FieldDef`. With this change, we no longer have any uses of `#[stable_hasher(project(...))]`
2022-01-17Rollup merge of #92164 - WaffleLapkin:rustc_must_implement_one_of_attr, ↵Matthias Krüger-0/+1
r=Aaron1011 Implement `#[rustc_must_implement_one_of]` attribute This PR adds a new attribute — `#[rustc_must_implement_one_of]` that allows changing the "minimal complete definition" of a trait. It's similar to GHC's minimal `{-# MINIMAL #-}` pragma, though `#[rustc_must_implement_one_of]` is weaker atm. Such attribute was long wanted. It can be, for example, used in `Read` trait to make transitions to recently added `read_buf` easier: ```rust #[rustc_must_implement_one_of(read, read_buf)] pub trait Read { fn read(&mut self, buf: &mut [u8]) -> Result<usize> { let mut buf = ReadBuf::new(buf); self.read_buf(&mut buf)?; Ok(buf.filled_len()) } fn read_buf(&mut self, buf: &mut ReadBuf<'_>) -> Result<()> { default_read_buf(|b| self.read(b), buf) } } impl Read for Ty0 {} //^ This will fail to compile even though all `Read` methods have default implementations // Both of these will compile just fine impl Read for Ty1 { fn read(&mut self, buf: &mut [u8]) -> Result<usize> { /* ... */ } } impl Read for Ty2 { fn read_buf(&mut self, buf: &mut ReadBuf<'_>) -> Result<()> { /* ... */ } } ``` For now, this is implemented as an internal attribute to start experimenting on the design of this feature. In the future we may want to extend it: - Allow arbitrary requirements like `a | (b & c)` - Allow multiple requirements like - ```rust #[rustc_must_implement_one_of(a, b)] #[rustc_must_implement_one_of(c, d)] ``` - Make it appear in rustdoc documentation - Change the syntax? - Etc Eventually, we should make an RFC and make this (or rather similar) attribute public. --- I'm fairly new to compiler development and not at all sure if the implementation makes sense, but at least it passes tests :)
2022-01-16Replace NestedVisitorMap with NestedFilterCameron Steffen-5/+5
2022-01-15Reduce use of local_def_id_to_hir_id.Camille GILLOT-8/+6
2022-01-11Store a `Symbol` instead of an `Ident` in `VariantDef`/`FieldDef`Aaron Hill-2/+2
The field is also renamed from `ident` to `name. In most cases, we don't actually need the `Span`. A new `ident` method is added to `VariantDef` and `FieldDef`, which constructs the full `Ident` using `tcx.def_ident_span()`. This method is used in the cases where we actually need an `Ident`. This makes incremental compilation properly track changes to the `Span`, without all of the invalidations caused by storing a `Span` directly via an `Ident`.
2022-01-09Auto merge of #92086 - petrochenkov:modchild, r=jackh726bors-2/+1
rustc_metadata: Optimize and document module children decoding The first commit limits the item in the `item_children`/`each_child_of_item` query to modules (in name resolution sense) and adds a corresponding assertion. The `associated_item_def_ids` query collecting children of traits and impls specifically now uses a simplified implementation not decoding unnecessary data instead of `each_child_of_item`, this gives a nice performance improvement. The second commit does some renaming that clarifies the terminology used for all items in a module vs `use` items only.
2022-01-09Implement `#[rustc_must_implement_one_of]` attributeMaybe Waffle-0/+1
2022-01-09Auto merge of #92497 - bjorn3:remove_lazy_meta_min_size, r=eddybbors-8/+8
Remove LazyMeta::min_size It is extremely conservative and as such barely reduces the size of encoded Lazy distances, but does increase complexity.
2022-01-09rustc_middle: Rename `Export` to `ModChild` and add some commentsVadim Petrochenkov-1/+1
Also rename `module_exports`/`export_map` to `module_reexports`/`reexport_map` for clarity.
2022-01-09rustc_metadata: Optimize and document module children decodingVadim Petrochenkov-1/+0
2022-01-08Remove LazyMeta::min_sizebjorn3-8/+8
It is extremely conservative and as such barely reduces the size of encoded Lazy distances, but does increase complexity.
2022-01-07Add `trait_item_def_id` to `AssocItem`Matthew Jasper-0/+3
This allows avoiding some lookups by name
2022-01-06rustc_middle: Add a method for getting a `SimplifiedType` definition/IDVadim Petrochenkov-2/+2
Import `SimplifiedType` more
2022-01-01Stabilize -Z symbol-mangling-version as -C symbol-mangling-versionJosh Triplett-1/+1
This allows selecting `v0` symbol-mangling without an unstable option. Selecting `legacy` still requires -Z unstable-options. Continue supporting -Z symbol-mangling-version for compatibility for now, but show a deprecation warning for it.
2022-01-01rustc_metadata: Use a query for collecting all traits in encoderVadim Petrochenkov-21/+53
2021-12-29Auto merge of #92244 - petrochenkov:alltraits, r=cjgillotbors-22/+37
rustc_metadata: Encode list of all crate's traits into metadata While working on https://github.com/rust-lang/rust/pull/88679 I noticed that rustdoc is casually doing something quite expensive, something that is used only for error reporting in rustc - collecting all traits from all crates in the dependency tree. This PR trades some minor extra time spent by metadata encoder in rustc for major gains for rustdoc (and for rustc runs with errors, which execute the `all_traits` query for better diagnostics).
2021-12-28rustc_metadata: Encode list of all crate's traits into metadataVadim Petrochenkov-22/+37
2021-12-28rustc_metadata: Merge items from `extern` blocks into their parent modulesVadim Petrochenkov-8/+15
during metadata encoding rather than during metadata decoding
2021-12-22Remove `PartialOrd` and `Ord` from `LocalDefId`pierwill-1/+1
Implement `Ord`, `PartialOrd` for SpanData
2021-12-18Rollup merge of #91926 - ↵Matthias Krüger-3/+3
SylvanB:remove_in_band_lifetimes_from_rustc_metadata, r=nagisa Remove `in_band_lifetimes` from `rustc_metadata` Another for #91867