Skip to content

Commit 2705a69

Browse files
committed
Add tests for addition of #[rustc_confusables("get_line")]
1 parent a4246b8 commit 2705a69

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

tests/ui/attributes/rustc_confusables_std_cases.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff 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
}

tests/ui/attributes/rustc_confusables_std_cases.stderr

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,18 @@ help: you might have meant to use `push_str`
106106
LL | 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

111122
Some errors have detailed explanations: E0308, E0599.
112123
For more information about an error, try `rustc --explain E0308`.

0 commit comments

Comments
 (0)