forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#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 rust-lang#69512.
- Loading branch information
Showing
8 changed files
with
138 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
use std::net::TcpStream; | ||
|
||
fn main() { | ||
let stream = TcpStream::new(); //~ ERROR no function or associated item named `new` found | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
error[E0599]: no function or associated item named `new` found for struct `TcpStream` in the current scope | ||
--> $DIR/fn-new-doesnt-exist.rs:4:28 | ||
| | ||
LL | 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 | ||
--> $SRC_DIR/std/src/net/tcp.rs:LL:COL | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0599`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters