Florian Diebold
d674d7185d
Represent opaque types with TyKind::OpaqueType
...
... instead of using `AliasTy`. Chalk turns the alias type into the
placeholder during unification anyway, which confuses our method
resolution logic.
Fixes #9530 .
2021-07-08 21:40:35 +02:00
bors[bot]
16871f6f93
Merge #9428
...
9428: fix: Fix deduction of `dyn Fn` closure parameter types r=flodiebold a=jonas-schievink
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-07-02 12:49:34 +00:00
Jonas Schievink
88a86d4ff9
Fix deduction of dyn Fn
closure parameter types
2021-06-30 15:04:04 +02:00
Lukas Wirth
af739731db
Implement TypeRef::ForLifetime
2021-06-30 01:34:54 +02:00
Florian Diebold
7c6f764ad6
Hide -> ()
in Fn traits
2021-05-25 15:23:52 +02:00
Jonas Schievink
8ebb8d29e1
internal: intern TypeBound
s
...
Doesn't save much memory (~2 mb), but interning things is generally a
good pattern to follow
2021-05-24 15:13:23 +02:00
Jade
8b147624ff
Add lowering of array lengths in types
...
Now e.g.
```rust
fn a(b: [u8; 2]) {
}
```
will know about the length of b.
2021-05-12 21:22:46 -07:00
Jade
dc63fea427
Add basic support for array lengths in types
...
This recognizes `let a = [1u8, 2, 3]` as having type `[u8; 3]` instead
of the previous `[u8; _]`. Byte strings and `[0u8; 2]` kinds of range
array declarations are unsupported as before.
I don't know why a bunch of our rustc tests had single quotes inside
strings un-escaped by `UPDATE_EXPECT=1 cargo t`, but I don't think it's
bad? Maybe something in a nightly?
2021-05-11 05:25:19 -07:00
Jonas Schievink
20ae41c1a1
Reuse database in LowerCtx
2021-05-06 23:23:50 +02:00
Jonas Schievink
976a3226fe
Don't store call-site text offsets in hygiene info
2021-05-06 19:59:54 +02:00
cynecx
28ef7c20d7
hir_ty: deal with TypeRef::Macro in HirFormatter
2021-04-17 16:24:56 +02:00
cynecx
cf3b4f1e20
hir_ty: Expand macros at type position
2021-04-17 16:24:56 +02:00
Florian Diebold
fbe98047d4
More cleanups / module docs
2021-04-09 14:40:58 +02:00
Florian Diebold
5ca481bbdc
Move ToChalk -> mapping
2021-04-09 14:15:26 +02:00
Florian Diebold
743faa21e7
Reorganize hir_ty modules
...
Chalk isn't really a 'traits' thing anymore, so it doesn't make sense to
have all the Chalk-related stuff in submodules of `traits`.
2021-04-09 14:11:37 +02:00
Florian Diebold
be03db0e3a
Intern Substitutions
...
(Costs a bit of performance, reduces memory usage on RA by ~10%.)
2021-04-08 22:48:47 +02:00
Florian Diebold
a838a60caa
Fix missing match arms
2021-04-08 14:23:17 +02:00
Florian Diebold
dc116f7ce2
Fix return type of Substitution::interned
2021-04-07 20:50:26 +02:00
Florian Diebold
9b4ecd3723
Fix return type of self_type_parameter
2021-04-07 20:41:52 +02:00
Florian Diebold
6777a4975d
Move hir_trait_id to extension trait
2021-04-07 20:40:01 +02:00
Florian Diebold
86feac18e8
Change TraitRef::hir_fmt_ext to free-standing function
2021-04-07 20:34:58 +02:00
Lukas Wirth
a43409fa43
Panic when creating a HirDisplayWrapper with DisplayTarget::SourceCode
2021-04-06 14:42:34 +02:00
Lukas Wirth
ffdb2da49d
Don't use HirDisplayWrapper when displaying SourceCode
2021-04-06 14:21:35 +02:00
Lukas Wirth
9fbba7bc45
Add chalk_ir::Const to TyKind::Array
2021-04-06 11:45:41 +02:00
Lukas Wirth
96756f1b1d
Add Lifetime to TyKind::Ref
2021-04-06 10:45:30 +02:00
Florian Diebold
b67148daea
Substitution::prefix -> subst_prefix
...
I probably want to get rid of this function completely later.
2021-04-05 21:58:53 +02:00
Florian Diebold
788533d380
Move ProjectionTy methods to extension trait
2021-04-05 21:58:01 +02:00
Lukas Wirth
d587ca2991
Replace unused hir_ty::Lifetime with chalk equivalents
2021-04-05 20:46:15 +02:00
Florian Diebold
30a339e038
Add Interner parameter to Binders::substitute
2021-04-05 19:21:01 +02:00
Florian Diebold
05eba0db3d
Binders::subst -> substitute
2021-04-05 19:20:28 +02:00
Florian Diebold
69714d36e6
Hide Binders internals more
2021-04-05 19:19:18 +02:00
Laurențiu Nicola
d7546d8c23
Pass interner to TraitRef::self_type_parameter
2021-04-05 17:38:37 +03:00
Laurențiu Nicola
aefcbf2758
Pass interner to ProjectionTy::self_type_parameter
2021-04-05 17:37:24 +03:00
Laurențiu Nicola
72c54c53cd
Rename TyKind::ForeignType to Foreign
2021-04-05 15:39:06 +03:00
Laurențiu Nicola
65c2e51940
Rename TyKind::Unknown to Error
2021-04-05 15:39:06 +03:00
Florian Diebold
508a1ecad3
Move things in hir_ty into submodules
...
- all the types that will be replaced by Chalk go to `types`
- `TypeWalk` impls go to `walk`
2021-04-04 20:22:00 +02:00
Florian Diebold
ebdfc932e7
Replace Substitution::type_params
2021-04-04 13:16:39 +02:00
Florian Diebold
a4d7bdf1c8
Replace Substitution::bound_vars and ::type_params_for_generics
2021-04-04 13:16:39 +02:00
Florian Diebold
b0fe3d929f
Add TyBuilder::unit() and TyExt::is_unit()
2021-04-04 13:16:38 +02:00
Florian Diebold
c551604b5a
Rename Ty::interned to Ty::kind
...
... since that's the actual method on Chalk side that matches the signature.
2021-04-03 13:08:29 +02:00
Florian Diebold
e480d81988
Introduce GenericArg
like in Chalk
...
Plus some more adaptations to Substitution.
Lots of `assert_ty_ref` that we should revisit when introducing
lifetime/const parameters.
2021-04-03 11:17:13 +02:00
Laurențiu Nicola
9787bddac5
Use arrayvec 0.6
2021-03-25 21:03:20 +02:00
bors[bot]
3af1885bd2
Merge #8144
...
8144: bail out early for source code closures r=Veykril a=hi-rustin
close https://github.com/rust-analyzer/rust-analyzer/issues/8084
Co-authored-by: hi-rustin <rustin.liu@gmail.com>
2021-03-22 12:35:44 +00:00
hi-rustin
2e09714dfe
bail out early for source code closures
...
add closure error
2021-03-22 19:40:07 +08:00
Florian Diebold
1d5c4a77fb
Use QuantifiedWhereClause in generic_predicates as well
...
Still far too much binder skipping going on; I find it hard to imagine
this is all correct, but the tests pass.
2021-03-21 18:01:14 +01:00
Florian Diebold
590c416359
Introduce QuantifiedWhereClause and DynTy analogous to Chalk
...
This introduces a bunch of new binders in lots of places, which we have
to be careful about, but we had to add them at some point.
2021-03-21 18:01:14 +01:00
Florian Diebold
d8f8b495ad
Ignore type bindings in generic_predicates_for_param
...
This allows us to handle more cases without a query cycle, which
includes certain cases that rustc accepted. That in turn means we avoid
triggering salsa-rs/salsa#257 on valid code (it will still happen if the
user writes an actual cycle).
We actually accept more definitions than rustc now; that's because rustc
only ignores bindings when looking up super traits, whereas we now also
ignore them when looking for predicates to disambiguate associated type
shorthand. We could introduce a separate query for super traits if
necessary, but for now I think this should be fine.
2021-03-21 15:29:03 +01:00
Florian Diebold
7ec3b66f7a
Turn Obligation into something similar to chalk_ir::DomainGoal
...
This includes starting to make use of Chalk's `Cast` trait.
2021-03-20 12:47:12 +01:00
Florian Diebold
8e7e405f6a
Remove WhereClause::Error
...
Chalk doesn't have it, and judging from the removed code, it wasn't
useful anyway.
2021-03-20 10:51:00 +01:00
Florian Diebold
7a5fb37cf1
Rename GenericPredicate -> WhereClause
2021-03-20 10:46:36 +01:00