Skip to content

Conversation

estebank
Copy link
Contributor

@estebank estebank commented Dec 14, 2017

CC #46302.

@rust-highfive
Copy link
Contributor

r? @arielb1

(rust_highfive has picked a reviewer for you, use r? to override)

@kennytm kennytm added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 14, 2017
@arielb1
Copy link
Contributor

arielb1 commented Dec 15, 2017

This is still wrong in a case such as this:

fn main() {
    let x = 0;
    match x {
        _ => {
            4 //~ ERROR
        }
    } // (there's a missing semicolon here)
    println!("hi!");
}

I would prefer to have a tag on ExpectHasType unit expectations so we can tell where they come from (missing semicolons, default return type, etc.)

@bors

This comment has been minimized.

@arielb1
Copy link
Contributor

arielb1 commented Dec 25, 2017

r? @nikomatsakis

@estebank estebank closed this Jan 3, 2018
@estebank
Copy link
Contributor Author

Reopening as although it is imperfect I want to reduce the incidence of incorrect hints.

err.span_label(span, "possibly return type missing here?");
}
(&hir::FunctionRetTy::DefaultReturn(span), _, _) => {
(&hir::FunctionRetTy::DefaultReturn(span), _, false, true) => {
// `fn main()` must return `()`, do not suggest changing return type
Copy link
Contributor

Choose a reason for hiding this comment

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

Note that this is not strictly true anymore -- main can return other types!

@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Collaborator

bors commented Jun 28, 2018

📌 Commit 6752a5c has been approved by nikomatsakis

@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 Jun 28, 2018
@bors
Copy link
Collaborator

bors commented Jun 28, 2018

⌛ Testing commit 6752a5c with merge 184bef4...

bors added a commit that referenced this pull request Jun 28, 2018
Fix incorrect type mismatch label pointing at return type

CC #46302.
@bors

This comment has been minimized.

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 28, 2018
@rust-highfive

This comment has been minimized.

1 similar comment
@rust-highfive

This comment has been minimized.

@estebank
Copy link
Contributor Author

@bors retry

@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 Jun 28, 2018
@bors
Copy link
Collaborator

bors commented Jun 29, 2018

⌛ Testing commit 6752a5c with merge 73917eb0007c5fce6074abf656bb11e60026fdcc...

@bors
Copy link
Collaborator

bors commented Jun 29, 2018

💔 Test failed - status-appveyor

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 29, 2018
@kennytm
Copy link
Member

kennytm commented Jun 29, 2018

Legit, UI test not up-to-date.

---- [ui] ui\suggestions\issue-46302.rs stdout ----
diff of stderr:
2	  --> $DIR/issue-46302.rs:13:27
3	   |
4	LL |   let u: &str = if true { s[..2] } else { s };
-	   |                           ^^^^^^ expected &str, found str
+	   |                           ^^^^^^
+	   |                           |
+	   |                           expected &str, found str
+	   |                           help: consider borrowing here: `&s[..2]`
6	   |
7	   = note: expected type `&str`
8	              found type `str`

@kennytm kennytm added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 29, 2018
@estebank
Copy link
Contributor Author

@kennytm very recent change, updated.

@bors r=nikomatsakis

@bors
Copy link
Collaborator

bors commented Jun 29, 2018

📌 Commit 2636b31 has been approved by nikomatsakis

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 29, 2018
@bors
Copy link
Collaborator

bors commented Jun 29, 2018

⌛ Testing commit 2636b31 with merge 1029775...

bors added a commit that referenced this pull request Jun 29, 2018
Fix incorrect type mismatch label pointing at return type

CC #46302.
@bors
Copy link
Collaborator

bors commented Jun 29, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: nikomatsakis
Pushing 1029775 to master...

@bors bors merged commit 2636b31 into rust-lang:master Jun 29, 2018
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants