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 cause for expectation in return type type error #57723

Merged
merged 7 commits into from Jan 19, 2019

Conversation

Projects
None yet
4 participants
@estebank
Copy link
Contributor

estebank commented Jan 18, 2019

Various improvements and fixes for type errors in return expressions.

Fix #57664.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Jan 18, 2019

r? @davidtwco

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

@estebank estebank changed the title [WIP] Point at cause for expectation in return type type error Point at cause for expectation in return type type error Jan 18, 2019

@rust-highfive

This comment was marked as resolved.

Copy link
Collaborator

rust-highfive commented Jan 18, 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:08a74d63:start=1547789008476605961,finish=1547789090052119992,duration=81575514031
$ 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:14] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:03:15] tidy error: /checkout/src/librustc_typeck/check/coercion.rs:1227: TODO is deprecated; use FIXME
[00:03:16] some tidy checks failed
[00:03:16] 
[00:03:16] 
[00:03:16] 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:16] 
[00:03:16] 
[00:03:16] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:03:16] Build completed unsuccessfully in 0:00:45
[00:03:16] Build completed unsuccessfully in 0:00:45
[00:03:16] make: *** [tidy] Error 1
[00:03:16] Makefile:69: recipe for target 'tidy' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:161c7ef8
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Fri Jan 18 05:28:15 UTC 2019
---
travis_time:end:0d7057a0:start=1547789296099987131,finish=1547789296105449300,duration=5462169
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:0b945529
$ 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:03cad704
travis_time:start:03cad704
$ 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:0532b5a4
$ 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)

@estebank estebank force-pushed the estebank:fix branch from 293148c to 954769e Jan 18, 2019

@estebank
Copy link
Contributor Author

estebank left a comment

| ^^^^ expected i32, found u32
|
= note: expected type `i32`
found type `u32`

This comment has been minimized.

@estebank

estebank Jan 18, 2019

Author Contributor

Should these errors also point at the impl Trait return type?

This comment has been minimized.

@davidtwco

davidtwco Jan 18, 2019

Member

I think they could and that would be a tad better but the errors aren't much worse off for the lack of it.

This comment has been minimized.

@estebank

estebank Jan 18, 2019

Author Contributor

filed #57743

@@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/liveness-forgot-ret.rs:3:19
|
LL | fn f(a: isize) -> isize { if god_exists(a) { return 5; }; }
| - ^^^^^ expected isize, found () - expected because of this statement
| - ^^^^^ expected isize, found ()

This comment has been minimized.

@estebank

estebank Jan 18, 2019

Author Contributor

Yay, drive by fixes :)

@davidtwco
Copy link
Member

davidtwco left a comment

LGTM. r=me if you aren't going to make any further changes or improvements relating to the other review comments.

@estebank

This comment has been minimized.

Copy link
Contributor Author

estebank commented Jan 18, 2019

@bors r=davidtwco

@davidtwco I'll mull on it and maybe have a follow up PR adding that. It should be a fairly small change, but the wording will be tricky to get right. Let's land this as it fixes a regression as well.

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 18, 2019

📌 Commit 2e06d9c has been approved by davidtwco

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

Rollup merge of rust-lang#57723 - estebank:fix, r=davidtwco
Point at cause for expectation in return type type error

Various improvements and fixes for type errors in return expressions.

Fix rust-lang#57664.

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

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

Successful merges:

 - #57452 (Improve docs for Formatter)
 - #57689 (Redo `hir::Stmt`)
 - #57723 (Point at cause for expectation in return type type error)
 - #57736 (Remove delay_span_bug from qualify_min_const_fn)

Failed merges:

r? @ghost

@bors bors merged commit 2e06d9c into rust-lang:master Jan 19, 2019

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