about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/errors.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-11-07 02:05:30 +0000
committerbors <bors@rust-lang.org>2023-11-07 02:05:30 +0000
commit4e0fb98a5c41be1227845219b81ab147708fd99a (patch)
treefa2d761194464641ebfeeec0aa4d7ba4ed1dccf8 /compiler/rustc_parse/src/errors.rs
parent7b97a5ca8422d1495a8918106d3249aa405812d4 (diff)
parentf926031ea50ef58c1c8bfccd98da73d86d5fc937 (diff)
downloadrust-4e0fb98a5c41be1227845219b81ab147708fd99a.tar.gz
rust-4e0fb98a5c41be1227845219b81ab147708fd99a.zip
Auto merge of #117006 - estebank:issue-69512, r=compiler-errors
When not finding assoc fn on type, look for builder fn

When we have a resolution error when looking at a fully qualified path on a type, look for all associated functions on inherent impls that return `Self` and mention them to the user.

```
error[E0599]: no function or associated item named `new` found for struct `TcpStream` in the current scope
   --> tests/ui/resolve/fn-new-doesnt-exist.rs:4:28
    |
4   |    let stream = TcpStream::new();
    |                            ^^^ function or associated item not found in `TcpStream`
    |
note: if you're trying to build a new `TcpStream` consider using one of the following associated functions:
      TcpStream::connect
      TcpStream::connect_timeout
   --> /home/gh-estebank/rust/library/std/src/net/tcp.rs:156:5
    |
156 |     pub fn connect<A: ToSocketAddrs>(addr: A) -> io::Result<TcpStream> {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
172 |     pub fn connect_timeout(addr: &SocketAddr, timeout: Duration) -> io::Result<TcpStream> {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
Fix #69512.
Diffstat (limited to 'compiler/rustc_parse/src/errors.rs')
0 files changed, 0 insertions, 0 deletions