diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2017-08-11 10:20:21 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-08-11 10:20:21 +0200 |
| commit | 03abb9d97fe72c929e7d767c278f1446dafdc6ba (patch) | |
| tree | d37681ee19702812c9d1a2f10109c62837ba78df /src/rustllvm/RustWrapper.cpp | |
| parent | e9d39094c9653c16a8412cbf750d9995a8003151 (diff) | |
| parent | fac6ce79e54a2d5bdbdc5157c645970a479e2fb1 (diff) | |
| download | rust-03abb9d97fe72c929e7d767c278f1446dafdc6ba.tar.gz rust-03abb9d97fe72c929e7d767c278f1446dafdc6ba.zip | |
Rollup merge of #43721 - natboehm:patch-1, r=steveklabnik
Provide more explanation for Deref in String docs While working on a different project I encountered a point of confusion where using `&String` to dereference a `String` into `&str` did not compile. I found the explanation of [String Deref](https://doc.rust-lang.org/std/string/struct.String.html#deref), thought that it matched what I was trying to do, and was confused as to why my program did not compile when the docs stated that it would work with 'any function which takes a `&str`'. At the bottom it is mentioned that this will 'generally' work, unless `String` is needed, but I found this statement confusing based on the previous claim of 'any'. Looking further into the docs I was able to find the function `as_str()` that works instead. I thought it might be helpful to mention here deref coercion, an instance in which using `&String` does not work, to explain why it does not work, then direct users to a different option that should work in this instance. A user casually skimming the page will likely come to this explanation first, then find `as_str()` later, but be no the wiser as to what potentially went wrong. r? @steveklabnik
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
