- 10 4月, 2022 1 次提交
-
-
由 Camille GILLOT 提交于
This allows to avoid looking at HIR from borrowck.
-
- 07 4月, 2022 1 次提交
-
-
由 Oli Scherer 提交于
-
- 05 4月, 2022 1 次提交
-
-
由 David Wood 提交于
`MultiSpan` contains labels, which are more complicated with the introduction of diagnostic translation and will use types from `rustc_errors` - however, `rustc_errors` depends on `rustc_span` so `rustc_span` cannot use types like `DiagnosticMessage` without dependency cycles. Introduce a new `rustc_error_messages` crate that can contain `DiagnosticMessage` and `MultiSpan`. Signed-off-by: NDavid Wood <david.wood@huawei.com>
-
- 31 3月, 2022 1 次提交
-
-
由 Oli Scherer 提交于
-
- 29 3月, 2022 1 次提交
-
-
由 Oli Scherer 提交于
This reverts commit 6499c5e7, reversing changes made to 78450d2d.
-
- 16 3月, 2022 1 次提交
-
-
由 mark 提交于
There are a few places were we have to construct it, though, and a few places that are more invasive to change. To do this, we create a constructor with a long obvious name.
-
- 11 3月, 2022 1 次提交
-
-
由 Nicholas Nethercote 提交于
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`.
-
- 07 3月, 2022 2 次提交
-
-
由 Nicholas Nethercote 提交于
`Layout` is another type that is sometimes interned, sometimes not, and we always use references to refer to it so we can't take any advantage of the uniqueness properties for hashing or equality checks. This commit renames `Layout` as `LayoutS`, and then introduces a new `Layout` that is a newtype around an `Interned<LayoutS>`. It also interns more layouts than before. Previously layouts within layouts (via the `variants` field) were never interned, but now they are. Hence the lifetime on the new `Layout` type. Unlike other interned types, these ones are in `rustc_target` instead of `rustc_middle`. This reflects the existing structure of the code, which does layout-specific stuff in `rustc_target` while `TyAndLayout` is generic over the `Ty`, allowing the type-specific stuff to occur in `rustc_middle`. The commit also adds a `HashStable` impl for `Interned`, which was needed. It hashes the contents, unlike the `Hash` impl which hashes the pointer.
-
由 Nicholas Nethercote 提交于
Currently some `Allocation`s are interned, some are not, and it's very hard to tell at a use point which is which. This commit introduces `ConstAllocation` for the known-interned ones, which makes the division much clearer. `ConstAllocation::inner()` is used to get the underlying `Allocation`. In some places it's natural to use an `Allocation`, in some it's natural to use a `ConstAllocation`, and in some places there's no clear choice. I've tried to make things look as nice as possible, while generally favouring `ConstAllocation`, which is the type that embodies more information. This does require quite a few calls to `inner()`. The commit also tweaks how `PartialOrd` works for `Interned`. The previous code was too clever by half, building on `T: Ord` to make the code shorter. That caused problems with deriving `PartialOrd` and `Ord` for `ConstAllocation`, so I changed it to build on `T: PartialOrd`, which is slightly more verbose but much more standard and avoided the problems.
-
- 04 3月, 2022 1 次提交
-
-
由 Camille GILLOT 提交于
-
- 03 3月, 2022 3 次提交
- 02 3月, 2022 1 次提交
-
-
由 mark 提交于
-
- 25 2月, 2022 1 次提交
-
-
由 Mark Rousskov 提交于
-
- 24 2月, 2022 3 次提交
-
-
由 Oli Scherer 提交于
-
由 Oli Scherer 提交于
-
由 Oli Scherer 提交于
-
- 21 2月, 2022 3 次提交
- 20 2月, 2022 1 次提交
-
-
由 est31 提交于
-
- 19 2月, 2022 1 次提交
-
-
由 Camille GILLOT 提交于
-
- 15 2月, 2022 6 次提交
-
-
由 Nicholas Nethercote 提交于
Specifically, rename the `Const` struct as `ConstS` and re-introduce `Const` as this: ``` pub struct Const<'tcx>(&'tcx Interned<ConstS>); ``` This now matches `Ty` and `Predicate` more closely, including using pointer-based `eq` and `hash`. Notable changes: - `mk_const` now takes a `ConstS`. - `Const` was copy, despite being 48 bytes. Now `ConstS` is not, so need a we need separate arena for it, because we can't use the `Dropless` one any more. - Many `&'tcx Const<'tcx>`/`&Const<'tcx>` to `Const<'tcx>` changes - Many `ct.ty` to `ct.ty()` and `ct.val` to `ct.val()` changes. - Lots of tedious sigil fiddling.
-
由 Nicholas Nethercote 提交于
The variant names are exported, so we can use them directly (possibly with a `ty::` qualifier). Lots of places already do this, this commit just increases consistency.
-
由 Nicholas Nethercote 提交于
Specifically, change `Region` from this: ``` pub type Region<'tcx> = &'tcx RegionKind; ``` to this: ``` pub struct Region<'tcx>(&'tcx Interned<RegionKind>); ``` This now matches `Ty` and `Predicate` more closely. Things to note - Regions have always been interned, but we haven't been using pointer-based `Eq` and `Hash`. This is now happening. - I chose to impl `Deref` for `Region` because it makes pattern matching a lot nicer, and `Region` can be viewed as just a smart wrapper for `RegionKind`. - Various methods are moved from `RegionKind` to `Region`. - There is a lot of tedious sigil changes. - A couple of types like `HighlightBuilder`, `RegionHighlightMode` now have a `'tcx` lifetime because they hold a `Ty<'tcx>`, so they can call `mk_region`. - A couple of test outputs change slightly, I'm not sure why, but the new outputs are a little better.
-
由 Nicholas Nethercote 提交于
Specifically, change `Ty` from this: ``` pub struct Predicate<'tcx> { inner: &'tcx PredicateInner<'tcx> } ``` to this: ``` pub struct Predicate<'tcx>(&'tcx Interned<PredicateS<'tcx>>) ``` where `PredicateInner` is renamed as `PredicateS`. This (plus a few other minor changes) makes the parallels with `Ty` and `TyS` much clearer, and makes the uniqueness more explicit.
-
由 Nicholas Nethercote 提交于
Specifically, change `Ty` from this: ``` pub type Ty<'tcx> = &'tcx TyS<'tcx>; ``` to this ``` pub struct Ty<'tcx>(Interned<'tcx, TyS<'tcx>>); ``` There are two benefits to this. - It's now a first class type, so we can define methods on it. This means we can move a lot of methods away from `TyS`, leaving `TyS` as a barely-used type, which is appropriate given that it's not meant to be used directly. - The uniqueness requirement is now explicit, via the `Interned` type. E.g. the pointer-based `Eq` and `Hash` comes from `Interned`, rather than via `TyS`, which wasn't obvious at all. Much of this commit is boring churn. The interesting changes are in these files: - compiler/rustc_middle/src/arena.rs - compiler/rustc_middle/src/mir/visit.rs - compiler/rustc_middle/src/ty/context.rs - compiler/rustc_middle/src/ty/mod.rs Specifically: - Most mentions of `TyS` are removed. It's very much a dumb struct now; `Ty` has all the smarts. - `TyS` now has `crate` visibility instead of `pub`. - `TyS::make_for_test` is removed in favour of the static `BOOL_TY`, which just works better with the new structure. - The `Eq`/`Ord`/`Hash` impls are removed from `TyS`. `Interned`s impls of `Eq`/`Hash` now suffice. `Ord` is now partly on `Interned` (pointer-based, for the `Equal` case) and partly on `TyS` (contents-based, for the other cases). - There are many tedious sigil adjustments, i.e. adding or removing `*` or `&`. They seem to be unavoidable.
-
由 Nicholas Nethercote 提交于
This will let us introduce a more widely-used `Interned` type in the next commit.
-
- 12 2月, 2022 1 次提交
-
-
由 Michael Goulet 提交于
-
- 11 2月, 2022 1 次提交
-
-
由 Oli Scherer 提交于
This reverts commit e7cc3bdd, reversing changes made to 734368a2.
-
- 10 2月, 2022 2 次提交
-
-
由 Camille GILLOT 提交于
-
由 Camille GILLOT 提交于
-
- 09 2月, 2022 1 次提交
-
-
由 Mark Rousskov 提交于
This replaces the per-shard counters with a single global counter, simplifying the JobId struct down to just a u64 and removing the need to pipe a DepKind generic through a bunch of code. The performance implications on non-parallel compilers are likely minimal (this switches to `Cell<u64>` as the backing storage over a `u64`, but the latter was already inside a `RefCell` so it's not really a significance divergence). On parallel compilers, the cost of a single global u64 counter may be more significant: it adds a serialization point in theory. On the other hand, we can imagine changing the counter to have a thread-local component if it becomes worrisome or some similar structure. The new design is sufficiently simpler that it warrants the potential for slight changes down the line if/when we get parallel compilation to be more of a default. A u64 counter, instead of u32 (the old per-shard width), is chosen to avoid possibly overflowing it and causing problems; it is effectively impossible that we would overflow a u64 counter in this context.
-
- 02 2月, 2022 1 次提交
-
-
由 Oli Scherer 提交于
```rust fn foo() -> impl MyTrait { panic!(); MyStruct } struct MyStruct; trait MyTrait {} impl MyTrait for MyStruct {} ```
-
- 27 1月, 2022 1 次提交
-
-
由 Camille GILLOT 提交于
If hir_owner is Owner(_), the LocalDefId is pointing to an owner, so the ItemLocalId is 0. If the HIR node does not exist, we store Phantom. Otherwise, we store the HirId associated to the LocalDefId.
-
- 22 1月, 2022 2 次提交
-
-
由 Nicholas Nethercote 提交于
-
由 Nicholas Nethercote 提交于
`Decoder` has two impls: - opaque: this impl is already partly infallible, i.e. in some places it currently panics on failure (e.g. if the input is too short, or on a bad `Result` discriminant), and in some places it returns an error (e.g. on a bad `Option` discriminant). The number of places where either happens is surprisingly small, just because the binary representation has very little redundancy and a lot of input reading can occur even on malformed data. - json: this impl is fully fallible, but it's only used (a) for the `.rlink` file production, and there's a `FIXME` comment suggesting it should change to a binary format, and (b) in a few tests in non-fundamental ways. Indeed #85993 is open to remove it entirely. And the top-level places in the compiler that call into decoding just abort on error anyway. So the fallibility is providing little value, and getting rid of it leads to some non-trivial performance improvements. Much of this commit is pretty boring and mechanical. Some notes about a few interesting parts: - The commit removes `Decoder::{Error,error}`. - `InternIteratorElement::intern_with`: the impl for `T` now has the same optimization for small counts that the impl for `Result<T, E>` has, because it's now much hotter. - Decodable impls for SmallVec, LinkedList, VecDeque now all use `collect`, which is nice; the one for `Vec` uses unsafe code, because that gave better perf on some benchmarks.
-
- 21 1月, 2022 2 次提交
-
-
由 Nicholas Nethercote 提交于
I have found this code very confusing at times. This commit clarifies things. In particular, the commit explains the requirements that the `Borrow` impls put on the `Eq` and `Hash` impls, which are non-obvious. And it puts the `Borrow` impls first, since they force `Eq` and `Hash` to have particular forms. The commit also notes `TyS`'s uniqueness requirements.
-
由 Nicholas Nethercote 提交于
-