File tree Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -394,6 +394,7 @@ impl Stdin {
394394 /// in which case it will wait for the Enter key to be pressed before
395395 /// continuing
396396 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
397+ #[ rustc_confusables( "get_line" ) ]
397398 pub fn read_line ( & self , buf : & mut String ) -> io:: Result < usize > {
398399 self . lock ( ) . read_line ( buf)
399400 }
Original file line number Diff line number Diff line change @@ -23,4 +23,8 @@ fn main() {
2323 //~^ HELP you might have meant to use `push_str`
2424 String :: new ( ) . append ( "" ) ; //~ ERROR E0599
2525 //~^ 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`
2630}
Original file line number Diff line number Diff line change @@ -106,7 +106,18 @@ help: you might have meant to use `push_str`
106106LL | String::new().push_str("");
107107 | ~~~~~~~~
108108
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
110121
111122Some errors have detailed explanations: E0308, E0599.
112123For more information about an error, try `rustc --explain E0308`.
You can’t perform that action at this time.
0 commit comments