Skip to content

Add get_line confusable to Stdin::read_line() #1

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
Oct 2, 2024

Conversation

JakenHerman
Copy link
Owner

@JakenHerman JakenHerman commented Oct 2, 2024

This pull request resolves rust-lang#131091


I've updated tests for tests/ui/attributes/rustc_confusables_std_cases in order to verify this change is working as intended.

@myclevorname
Copy link

Thank you for doing this.

@GrigorenkoPV
Copy link

You opened the PR in the wrong repository, you should do it here instead.

Also I think a test case should be added in tests/ui/attributes/rustc_confusables_std_cases.rs

@JakenHerman
Copy link
Owner Author

JakenHerman commented Oct 2, 2024

@GrigorenkoPV Yea, I didn't do it to the rust repository yet because I was still adding tests 😄 I've never added one of these tests, the strategy seems straight forward, but I don't know how to determine that error code that's in the comments. (i.e. //~ERROR E0599)

Edit: Actually, after running rustic --explain E0599, I believe this is the error code that I want.

So I've added:

let mut buffer = String::new();
let stdin = std::io::stdin();
stdin.get_line(&mut buffer).unwrap(); //~ ERROR E0599
//~^ HELP you might have meant to use `read_line`

I've run ./x.py build followed by ./x.py test tests/ui/attributes/rustc_confusables_std_cases.rs, but my tests are failing, so I'm not sure what's going on.. Sorry - first time working on this project, I'll get it worked out before I PR into the rust repository.

Edit (again): I see, my expected output was incorrect.. about to modify PR to target main repository.

@JakenHerman JakenHerman merged commit c0027f6 into master Oct 2, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 3, 2024
Add `get_line` confusable to `Stdin::read_line()`

This pull request resolves rust-lang#131091

---

I've updated tests for `tests/ui/attributes/rustc_confusables_std_cases` in order to verify this change is working as intended.

Before I submitted this pull request, I had a pull request to my local fork. If you're interested in seeing the conversation on that PR, go to JakenHerman#1.

---

**Testing**:
Run `./x.py test tests/ui/attributes/rustc_confusables_std_cases.rs`
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Oct 3, 2024
Rollup merge of rust-lang#131163 - JakenHerman:master, r=Nadrieril

Add `get_line` confusable to `Stdin::read_line()`

This pull request resolves rust-lang#131091

---

I've updated tests for `tests/ui/attributes/rustc_confusables_std_cases` in order to verify this change is working as intended.

Before I submitted this pull request, I had a pull request to my local fork. If you're interested in seeing the conversation on that PR, go to JakenHerman#1.

---

**Testing**:
Run `./x.py test tests/ui/attributes/rustc_confusables_std_cases.rs`
@JakenHerman JakenHerman deleted the get_line_confusable branch October 3, 2024 17:06
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add compiler hint for stdin().get_line() -> stdin().read_line()
3 participants