]> git.lizzy.rs Git - rust.git/commitdiff
Merge #4570
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>
Fri, 22 May 2020 17:31:39 +0000 (17:31 +0000)
committerGitHub <noreply@github.com>
Fri, 22 May 2020 17:31:39 +0000 (17:31 +0000)
4570: Use Chalk's built-in impls r=matklad a=flodiebold

This contains two changes:
 - Chalk has begun adding built-in representations of primitive types; use these in our type conversion logic. There's one somewhat 'iffy' part here, namely references; we don't keep track of lifetimes, but Chalk does, so it will expect a lifetime parameter on references. If we didn't provide that, it could cause crashes in Chalk code that expects the lifetime, so I rather hackily add an (always the same) lifetime placeholder during conversion. I expect that we'll fully switch to using Chalk's types everywhere before we add lifetime support, so I think this is the best solution for now.
 - let Chalk know about well-known traits (from lang items), so it can apply its built-in impls.

Before:
```
Total expressions: 181485
Expressions of unknown type: 2940 (1%)
Expressions of partially unknown type: 2884 (1%)
Type mismatches: 901
Inference: 37.821210245s, 0b allocated 0b resident
Total: 53.399467609s, 0b allocated 0b resident
```

After:
```
Total expressions: 181485
Expressions of unknown type: 2923 (1%)
Expressions of partially unknown type: 2879 (1%)
Type mismatches: 734
Inference: 39.157752509s, 0b allocated 0b resident
Total: 54.110767621s, 0b allocated 0b resident
```

(I will start splitting up `chalk.rs` in a separate PR, since it's getting pretty big...)

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>

Trivial merge