Commit Graph

111 Commits

Author SHA1 Message Date
Jonas Schievink
b365b6119c Treat extern blocks as item containers 2021-12-07 17:31:26 +01:00
Lukas Wirth
ec07bb98f8 fix: Omit generic defaults for types in hover messages 2021-11-22 18:27:03 +01:00
Alex Veber
24f816c481 fix: better Fn traits formatting 2021-11-21 02:39:22 +02:00
Jonas Schievink
9f4c26e780 Format Fn traits using parentheses 2021-11-19 19:58:00 +01:00
Aramis Razzaghipour
9583dd5725
Replace if let with match where appropriate 2021-10-05 09:00:21 +11:00
Dezhi Wu
87436a08fa fix super path wrong display 2021-09-07 17:49:46 +08:00
Dezhi Wu
880af425d4 fix path wrong display 2021-09-07 16:54:02 +08:00
Dezhi Wu
82ae228d98 fix: path display error when start with crate 2021-09-07 14:44:30 +08:00
Lukas Wirth
36a5ce9790 minor: fix some clippy lints 2021-09-03 16:00:50 +02:00
Dawer
6c366ade00 Clean up 2021-08-12 21:20:28 +05:00
Dawer
14898729f4 Account sized bounds in parentheses printing inside of ptr/ref of rpit. 2021-08-08 00:54:38 +05:00
Dawer
0f6621fbfa Fix tests. 2021-08-04 20:20:14 +05:00
Dawer
5f2486e9a8 Handle impl ?Sized. Fix tests. 2021-08-04 20:20:10 +05:00
Dawer
421979bc68 HirDisplay prints ?Sized bounds now; impl Trait: Sized by default. 2021-08-04 20:05:46 +05:00
Dawer
3981373b93 internal: add implicit Sized bounds to type parameters. 2021-08-04 19:04:21 +05:00
Aleksey Kladov
12d7f5b56e internal: explain that we don't ref in style.md 2021-08-02 15:59:28 +03:00
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 TypeBounds
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