File tree 3 files changed +17
-1
lines changed
3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -394,6 +394,7 @@ impl Stdin {
394
394
/// in which case it will wait for the Enter key to be pressed before
395
395
/// continuing
396
396
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
397
+ #[ rustc_confusables( "get_line" ) ]
397
398
pub fn read_line ( & self , buf : & mut String ) -> io:: Result < usize > {
398
399
self . lock ( ) . read_line ( buf)
399
400
}
Original file line number Diff line number Diff line change @@ -23,4 +23,8 @@ fn main() {
23
23
//~^ HELP you might have meant to use `push_str`
24
24
String :: new ( ) . append ( "" ) ; //~ ERROR E0599
25
25
//~^ HELP you might have meant to use `push_str`
26
+ let mut buffer = String :: new ( ) ;
27
+ let stdin = std:: io:: stdin ( ) ;
28
+ stdin. get_line ( & mut buffer) . unwrap ( ) ; //~ ERROR E0599
29
+ //~^ HELP you might have meant to use `read_line`
26
30
}
Original file line number Diff line number Diff line change @@ -106,7 +106,18 @@ help: you might have meant to use `push_str`
106
106
LL | String::new().push_str("");
107
107
| ~~~~~~~~
108
108
109
- error: aborting due to 8 previous errors
109
+ error[E0599]: no method named `get_line` found for struct `Stdin` in the current scope
110
+ --> $DIR/rustc_confusables_std_cases.rs:28:11
111
+ |
112
+ LL | stdin.get_line(&mut buffer).unwrap();
113
+ | ^^^^^^^^ method not found in `Stdin`
114
+ |
115
+ help: you might have meant to use `read_line`
116
+ |
117
+ LL | stdin.read_line(&mut buffer).unwrap();
118
+ | ~~~~~~~~~
119
+
120
+ error: aborting due to 9 previous errors
110
121
111
122
Some errors have detailed explanations: E0308, E0599.
112
123
For more information about an error, try `rustc --explain E0308`.
You can’t perform that action at this time.
0 commit comments