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

Rustup to rustc 1.36.0-nightly (acc7e652f 2019-05-10) #4080

Merged
merged 11 commits into from
May 11, 2019
Merged

Rustup to rustc 1.36.0-nightly (acc7e652f 2019-05-10) #4080

merged 11 commits into from
May 11, 2019

Conversation

Manishearth
Copy link
Member

@Manishearth Manishearth commented May 11, 2019

Fixes breakages from rust-lang/rust#59288

Not finished yet, help appreciated.

Todo:

@Manishearth Manishearth force-pushed the rustup branch 2 times, most recently from af9e59d to 3e598cf Compare May 11, 2019 02:40
@Manishearth
Copy link
Member Author

Builds now.

@Manishearth
Copy link
Member Author

if_same_then_else is overzealous now, and the question_mark lint isn't triggering. Will investigate later. Feel free to push fixes.

@Manishearth
Copy link
Member Author

Manishearth commented May 11, 2019

@Centril are chained ifs now just nested matches? It seems like if_same_then_else is hitting this.

@Centril
Copy link
Contributor

Centril commented May 11, 2019

@Manishearth Yeah; the HIR lowering for this part just operates recursively on one expression at a time so you'll get matches within matches. Also note that I changed the desugaring of if let to use _ => {}, for the else part rather than _ => (),

@Centril
Copy link
Contributor

Centril commented May 11, 2019

As for if-let-chains (allowing &&), those are not implemented yet. Just the refactoring has been done for now.

@Manishearth
Copy link
Member Author

Found the bug, if blocks without else desugar to empty match arms (not missing match arms)

@Manishearth
Copy link
Member Author

Nope, still have a bunch of failures :/

@Manishearth
Copy link
Member Author

Never mind, I didn't clear test results properly and ran update-all-references 😄

We only have two test failures now:

diff --git a/tests/ui/block_in_if_condition.stderr b/tests/ui/block_in_if_condition.stderr
index 0876d5db..105a71f6 100644
--- a/tests/ui/block_in_if_condition.stderr
+++ b/tests/ui/block_in_if_condition.stderr
@@ -50,13 +50,5 @@ LL | |             x == target
 LL | |         },
    | |_________^
 
-error: this boolean expression can be simplified
-  --> $DIR/block_in_if_condition.rs:77:8
-   |
-LL |     if true && x == 3 {
-   |        ^^^^^^^^^^^^^^ help: try: `x == 3`
-   |
-   = note: `-D clippy::nonminimal-bool` implied by `-D warnings`
-
-error: aborting due to 5 previous errors
+error: aborting due to 4 previous errors
 
diff --git a/tests/ui/booleans.stderr b/tests/ui/booleans.stderr
index eebab8c3..23ebfe90 100644
--- a/tests/ui/booleans.stderr
+++ b/tests/ui/booleans.stderr
@@ -175,29 +175,5 @@ error: this boolean expression can be simplified
 LL |     let _ = !c ^ c || !a.is_some();
    |             ^^^^^^^^^^^^^^^^^^^^^^ help: try: `!c ^ c || a.is_none()`
 
-error: this boolean expression can be simplified
-  --> $DIR/booleans.rs:128:8
-   |
-LL |     if !res.is_ok() {}
-   |        ^^^^^^^^^^^^ help: try: `res.is_err()`
-
-error: this boolean expression can be simplified
-  --> $DIR/booleans.rs:129:8
-   |
-LL |     if !res.is_err() {}
-   |        ^^^^^^^^^^^^^ help: try: `res.is_ok()`
-
-error: this boolean expression can be simplified
-  --> $DIR/booleans.rs:132:8
-   |
-LL |     if !res.is_some() {}
-   |        ^^^^^^^^^^^^^^ help: try: `res.is_none()`
-
-error: this boolean expression can be simplified
-  --> $DIR/booleans.rs:133:8
-   |
-LL |     if !res.is_none() {}
-   |        ^^^^^^^^^^^^^^ help: try: `res.is_some()`
-
-error: aborting due to 25 previous errors
+error: aborting due to 21 previous errors

@Manishearth
Copy link
Member Author

Looks like if foo && bar is being treated differently?

@Manishearth
Copy link
Member Author

But that part isn't implemented yet.

But also, nonminimal_bool doesn't deal with if blocks at all. Something's fishy

@Manishearth
Copy link
Member Author

(it's possible that hir::intravisit broke)

@Manishearth
Copy link
Member Author

Ah, the macro check is catching it.

@Manishearth Manishearth marked this pull request as ready for review May 11, 2019 06:40
@Manishearth
Copy link
Member Author

It works! r? @oli-obk

span.ctxt().outer().expn_info().is_some()
if let Some(info) = span.ctxt().outer().expn_info() {
if let ExpnFormat::CompilerDesugaring(..) = info.format {
false
Copy link
Member Author

Choose a reason for hiding this comment

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

Do we actually want this in the macro check? As you can see it inadvertently fixed a bug in into_iter_on_ref.rs, but there may be cases where we don't care about desugarings. Perhaps we should just have both kinds of checks.

The nonminimal bool test fails without this because the visitor bails when it sees the if desugaring.

Copy link
Contributor

Choose a reason for hiding this comment

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

we may be able to do this more fine-grained in the future by passing in more than a span (e.g. a CompilerDesugaring variant that we allow). For now it seems ok, since this can only happen in HIR anyway, and our HIR lints already know about the compiler expansions they care about

let right_pat = self.next("right");
// handle if desugarings
// TODO add more desugarings here
if let Some((cond, then, opt_else)) = higher::if_block(&expr) {
Copy link
Member Author

Choose a reason for hiding this comment

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

This diff is basically just me adding this if let and sticking the rest of the function in the else.

@Manishearth Manishearth changed the title WIP rustup to rustc 1.36.0-nightly (acc7e652f 2019-05-10) Rustup to rustc 1.36.0-nightly (acc7e652f 2019-05-10) May 11, 2019
@oli-obk
Copy link
Contributor

oli-obk commented May 11, 2019 via email

@Manishearth
Copy link
Member Author

No problem, but yeah in the future advance warning would be good so we can start prepping the fix while it goes through review, and catch any issues early in the process.

Also to be clear this should pass CI, I don't think there's more work to be done.

@oli-obk
Copy link
Contributor

oli-obk commented May 11, 2019

@bors r+

Also to be clear this should pass CI, I don't think there's more work to be done.

Yea I was on mobile and didn't see the further messages ;)

@bors
Copy link
Contributor

bors commented May 11, 2019

📌 Commit 19cfb84 has been approved by oli-obk

@bors
Copy link
Contributor

bors commented May 11, 2019

⌛ Testing commit 19cfb84 with merge 3710ec5...

bors added a commit that referenced this pull request May 11, 2019
Rustup to rustc 1.36.0-nightly (acc7e65 2019-05-10)

Fixes breakages from rust-lang/rust#59288

Not finished yet, help appreciated.

Todo:

 - [x] Needs to build
 - [x] Util should handle DropTemps, #4080 (comment)
 - [x] Author lint should spit out higher::if_block checks
 - [x] Unsure what to do in consts.rs
 - [x] Needs to pass tests
@bors
Copy link
Contributor

bors commented May 11, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: oli-obk
Pushing 3710ec5 to master...

@bors bors merged commit 19cfb84 into master May 11, 2019
@bors bors mentioned this pull request May 11, 2019
@flip1995 flip1995 deleted the rustup branch May 13, 2019 09:23
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 14, 2021
Reintroduce hir::ExprKind::If

Basically copied and paste rust-lang#59288/rust-lang/rust-clippy#4080 with some modifications.

The vast majority of tests were fixed and now there are only a few remaining. Since I am still unable to figure out the missing pieces, any help with the following list is welcome.

- [ ] **Unnecessary `typeck` exception**: [Cheated on this one to make CI green.](https://github.com/rust-lang/rust/pull/79328/files#diff-3faee9ba23fc54a12b7c43364ba81f8c5660045c7e1d7989a02a0cee1c5b2051)
- [x] **Incorrect span**: [Span should reference `then` and `else` separately.](https://github.com/rust-lang/rust/pull/79328/files#diff-cf2c46e82222ee4b1037a68fff8a1af3c4f1de7a6b3fd798aacbf3c0475abe3d)
- [x] **New note regarding `assert!`**: [Modified but not "wrong". Maybe can be a good thing?](https://github.com/rust-lang/rust/pull/79328/files#diff-9e0d7c89ed0224e2b62060c957177c27db43c30dfe3c2974cb6b5091cda9cfb5)
- [x] **Inverted report location**: [Modified but not "wrong". Locations were inverted.](https://github.com/rust-lang/rust/pull/79328/files#diff-f637ce7c1f68d523a165aa9651765df05e36c4d7d279194b1a6b28b48a323691)
- [x] **`src/test/ui/point-to-type-err-cause-on-impl-trait-return.rs` has weird errors**: [Not sure why this is happening.](https://github.com/rust-lang/rust/pull/79328/files#diff-c823c09660f5b112f95e97e8ff71f1797b6c7f37dbb3d16f8e98bbaea8072e95)
- [x] **Missing diagnostic**: [???](https://github.com/rust-lang/rust/pull/79328/files#diff-6b8ab09360d725ba4513933827f9796b42ff9522b0690f80b76de067143af2fc)
flip1995 pushed a commit to flip1995/rust-clippy that referenced this pull request Jan 15, 2021
Reintroduce hir::ExprKind::If

Basically copied and paste #59288/rust-lang#4080 with some modifications.

The vast majority of tests were fixed and now there are only a few remaining. Since I am still unable to figure out the missing pieces, any help with the following list is welcome.

- [ ] **Unnecessary `typeck` exception**: [Cheated on this one to make CI green.](https://github.com/rust-lang/rust/pull/79328/files#diff-3faee9ba23fc54a12b7c43364ba81f8c5660045c7e1d7989a02a0cee1c5b2051)
- [x] **Incorrect span**: [Span should reference `then` and `else` separately.](https://github.com/rust-lang/rust/pull/79328/files#diff-cf2c46e82222ee4b1037a68fff8a1af3c4f1de7a6b3fd798aacbf3c0475abe3d)
- [x] **New note regarding `assert!`**: [Modified but not "wrong". Maybe can be a good thing?](https://github.com/rust-lang/rust/pull/79328/files#diff-9e0d7c89ed0224e2b62060c957177c27db43c30dfe3c2974cb6b5091cda9cfb5)
- [x] **Inverted report location**: [Modified but not "wrong". Locations were inverted.](https://github.com/rust-lang/rust/pull/79328/files#diff-f637ce7c1f68d523a165aa9651765df05e36c4d7d279194b1a6b28b48a323691)
- [x] **`src/test/ui/point-to-type-err-cause-on-impl-trait-return.rs` has weird errors**: [Not sure why this is happening.](https://github.com/rust-lang/rust/pull/79328/files#diff-c823c09660f5b112f95e97e8ff71f1797b6c7f37dbb3d16f8e98bbaea8072e95)
- [x] **Missing diagnostic**: [???](https://github.com/rust-lang/rust/pull/79328/files#diff-6b8ab09360d725ba4513933827f9796b42ff9522b0690f80b76de067143af2fc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants