Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

sugg: suggest the usage of boolean value when there is a typo in the keyword #100817

Merged
merged 1 commit into from
Aug 27, 2022

Conversation

vincenzopalazzo
Copy link
Member

Fixes #100686

This adds a new suggestion when there is a well-known typo

With the following program

fn main() {
    let x = True;
}

Now we have the following suggestion

error[E0425]: cannot find value `True` in this scope
 --> test.rs:2:13
  |
2 |     let x = True;
  |             ^^^^ not found in this scope
  |
help: you may want to use a bool value instead
  |
2 |     let x = true;
  |             ~~~~

error: aborting due to previous error

Signed-off-by: Vincenzo Palazzo vincenzopalazzodev@gmail.com

@rust-highfive
Copy link
Collaborator

r? @davidtwco

(rust-highfive has picked a reviewer for you, use r? to override)

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Aug 20, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 20, 2022
@vincenzopalazzo vincenzopalazzo force-pushed the macros/bool_spelling_sugg branch 2 times, most recently from 2a197f5 to 9d8711f Compare August 20, 2022 21:04
Copy link
Member

@davidtwco davidtwco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, a couple comments

compiler/rustc_resolve/src/late/diagnostics.rs Outdated Show resolved Hide resolved
compiler/rustc_resolve/src/late/diagnostics.rs Outdated Show resolved Hide resolved
…keyword

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
@davidtwco
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Aug 23, 2022

📌 Commit 69715c9 has been approved by davidtwco

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 23, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Aug 25, 2022
…ng_sugg, r=davidtwco

sugg: suggest the usage of boolean value when there is a typo in the keyword

Fixes rust-lang#100686

This adds a new suggestion when there is a well-known typo

With the following program

```rust
fn main() {
    let x = True;
}
```

Now we have the following suggestion

```
error[E0425]: cannot find value `True` in this scope
 --> test.rs:2:13
  |
2 |     let x = True;
  |             ^^^^ not found in this scope
  |
help: you may want to use a bool value instead
  |
2 |     let x = true;
  |             ~~~~

error: aborting due to previous error
```

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Aug 25, 2022
…ng_sugg, r=davidtwco

sugg: suggest the usage of boolean value when there is a typo in the keyword

Fixes rust-lang#100686

This adds a new suggestion when there is a well-known typo

With the following program

```rust
fn main() {
    let x = True;
}
```

Now we have the following suggestion

```
error[E0425]: cannot find value `True` in this scope
 --> test.rs:2:13
  |
2 |     let x = True;
  |             ^^^^ not found in this scope
  |
help: you may want to use a bool value instead
  |
2 |     let x = true;
  |             ~~~~

error: aborting due to previous error
```

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
@compiler-errors
Copy link
Member

@bors rollup

bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 27, 2022
…mpiler-errors

Rollup of 9 pull requests

Successful merges:

 - rust-lang#100724 (Migrate ast lowering to session diagnostic)
 - rust-lang#100735 (Migrate `rustc_ty_utils` to `SessionDiagnostic`)
 - rust-lang#100738 (Diagnostics migr const eval)
 - rust-lang#100744 (Migrate rustc_mir_dataflow to diagnostic structs)
 - rust-lang#100776 (Migrate `rustc_lint` errors to `SessionDiagnostic`)
 - rust-lang#100817 (sugg: suggest the usage of boolean value when there is a typo in the keyword)
 - rust-lang#100836 (Migrate `rustc_attr` crate diagnostics)
 - rust-lang#100890 (Migrate rustc_driver to SessionDiagnostic)
 - rust-lang#100900 (on `region_errors.rs`)

Failed merges:

 - rust-lang#100831 (Migrate `symbol_mangling` module to new diagnostics structs)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 5474460 into rust-lang:master Aug 27, 2022
@rustbot rustbot added this to the 1.65.0 milestone Aug 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

If True is not in scope and is used, suggest the valid true
8 participants