about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorEduard-Mihai Burtescu <edy.burt@gmail.com>2016-08-14 20:29:51 +0300
committerGitHub <noreply@github.com>2016-08-14 20:29:51 +0300
commit80510b800a633895247811049faef321bd6bff92 (patch)
treed786d4926ce44aa5785c8487aacbd4fd7d4ae2ef /src/rustllvm/RustWrapper.cpp
parent7aaa83a7d8da9fcc3f9f1e017041e5adf9919799 (diff)
parent42247372c6c507beed4d309ea5867579d5b65511 (diff)
downloadrust-80510b800a633895247811049faef321bd6bff92.tar.gz
rust-80510b800a633895247811049faef321bd6bff92.zip
Rollup merge of #35611 - jonathandturner:ptr-helper, r=nikomatsakis
Improve &-ptr printing

This PR replaces printing `&-ptr` with a more readable description.  To do so it uses a few heuristics.

If the name of the type is unknown, too long (longer than just saying "reference"), or too complex (a type with explicit lifetime annotations), it will instead opt to print either "reference" or "mutable reference", depending on the mutability of the type.

Before:

```
error[E0308]: mismatched types
  --> src/test/compile-fail/issue-7061.rs:14:46
   |
14 |     fn foo(&'a mut self) -> Box<BarStruct> { self }
   |                                              ^^^^ expected box, found &-ptr
   |
   = note: expected type `Box<BarStruct>`
   = note:    found type `&'a mut BarStruct`

error: aborting due to previous error
```

After:

```
error[E0308]: mismatched types
  --> src/test/compile-fail/issue-7061.rs:14:46
   |
14 |     fn foo(&'a mut self) -> Box<BarStruct> { self }
   |                                              ^^^^ expected box, found mutable reference
   |
   = note: expected type `Box<BarStruct>`
   = note:    found type `&'a mut BarStruct`

error: aborting due to previous error
```
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions