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

Point at match discriminant on type error in match arm pattern #57366

Merged
merged 5 commits into from Jan 14, 2019

Conversation

Projects
None yet
6 participants
@estebank
Copy link
Contributor

estebank commented Jan 6, 2019

error[E0308]: mismatched types
 --> src/main.rs:5:9
  |
4 |    let temp: usize = match a + b {
  |                            ----- this expression has type `usize`
5 |         Ok(num) => num,
  |         ^^^^^^^ expected usize, found enum `std::result::Result`
  |
  = note: expected type `usize`
             found type `std::result::Result<_, _>`

Fix #57279.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Jan 6, 2019

r? @michaelwoerister

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

@estebank estebank changed the title Point at the match discriminant when arm pattern has a type mismatch Point at match discrimant on type error in match arm pattern Jan 6, 2019

@estebank estebank changed the title Point at match discrimant on type error in match arm pattern Point at match discriminant on type error in match arm pattern Jan 6, 2019

@rust-highfive

This comment was marked as resolved.

Copy link
Collaborator

rust-highfive commented Jan 6, 2019

The job x86_64-gnu-llvm-6.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:end:1ca07a40:start=1546737054986853010,finish=1546737055985198461,duration=998345451
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
Setting environment variables from .travis.yml
$ export IMAGE=x86_64-gnu-llvm-6.0
---

[00:03:57] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:03:57] tidy error: /checkout/src/librustc_typeck/check/_match.rs:733: line longer than 100 chars
[00:03:58] some tidy checks failed
[00:03:58] 
[00:03:58] 
[00:03:58] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor" "--quiet"
[00:03:58] 
[00:03:58] 
[00:03:58] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:03:58] Build completed unsuccessfully in 0:00:45
[00:03:58] Build completed unsuccessfully in 0:00:45
[00:03:58] Makefile:69: recipe for target 'tidy' failed
[00:03:58] make: *** [tidy] Error 1
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:0ee694d0
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Sun Jan  6 01:15:06 UTC 2019
---
travis_time:end:0270e3b4:start=1546737307038371472,finish=1546737307042821457,duration=4449985
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:03658b0c
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:255700a1
travis_time:start:255700a1
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:24752204
$ dmesg | grep -i kill

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@michaelwoerister

This comment has been minimized.

Copy link
Contributor

michaelwoerister commented Jan 7, 2019

@varkor, would you be up for giving this a full review? Since my review backlog has grown a second page over the break, I'm glad about anything that I can hand off :)

@varkor

This comment has been minimized.

Copy link
Member

varkor commented Jan 7, 2019

r? @varkor

I'll take a proper look soon.

@michaelwoerister

This comment has been minimized.

Copy link
Contributor

michaelwoerister commented Jan 7, 2019

Thanks a lot, @varkor!

@varkor

varkor approved these changes Jan 9, 2019

Copy link
Member

varkor left a comment

Looks good! r=me with the updated comment.

Show resolved Hide resolved src/librustc_typeck/check/_match.rs
@estebank

This comment has been minimized.

Copy link
Contributor

estebank commented Jan 9, 2019

@bors r=varkor

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 9, 2019

📌 Commit e70390a has been approved by varkor

bors added a commit that referenced this pull request Jan 10, 2019

Auto merge of #57366 - estebank:point-match-discrim, r=varkor
Point at match discriminant on type error in match arm pattern

```
error[E0308]: mismatched types
 --> src/main.rs:5:9
  |
4 |    let temp: usize = match a + b {
  |                            ----- this expression has type `usize`
5 |         Ok(num) => num,
  |         ^^^^^^^ expected usize, found enum `std::result::Result`
  |
  = note: expected type `usize`
             found type `std::result::Result<_, _>`
```
Fix #57279.
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 10, 2019

⌛️ Testing commit e70390a with merge 90db924...

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 10, 2019

💔 Test failed - status-appveyor

@pietroalbini

This comment has been minimized.

Copy link
Member

pietroalbini commented Jan 10, 2019

@bors retry
AppVeyor... what's wrong with you today?

@estebank estebank force-pushed the estebank:point-match-discrim branch from e70390a to 10fbdbf Jan 13, 2019

@estebank

This comment has been minimized.

Copy link
Contributor

estebank commented Jan 13, 2019

rebased to get bors unstuck

@bors r=varkor

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 13, 2019

📌 Commit 10fbdbf has been approved by varkor

Centril added a commit to Centril/rust that referenced this pull request Jan 13, 2019

Rollup merge of rust-lang#57366 - estebank:point-match-discrim, r=varkor
Point at match discriminant on type error in match arm pattern

```
error[E0308]: mismatched types
 --> src/main.rs:5:9
  |
4 |    let temp: usize = match a + b {
  |                            ----- this expression has type `usize`
5 |         Ok(num) => num,
  |         ^^^^^^^ expected usize, found enum `std::result::Result`
  |
  = note: expected type `usize`
             found type `std::result::Result<_, _>`
```
Fix rust-lang#57279.

bors added a commit that referenced this pull request Jan 13, 2019

Auto merge of #57580 - Centril:rollup, r=Centril
Rollup of 4 pull requests

Successful merges:

 - #56874 (Simplify foreign type rendering.)
 - #57113 (Move diagnostics out from QueryJob and optimize for the case with no diagnostics)
 - #57366 (Point at match discriminant on type error in match arm pattern)
 - #57538 (librustc_mir: Fix ICE with slice patterns)

Failed merges:

 - #57381 (Tweak output of type mismatch between "then" and `else` `if` arms)

r? @ghost

@bors bors merged commit 10fbdbf into rust-lang:master Jan 14, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment