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

On return type `impl Trait` for block with no expr point at last semi #58204

Open
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
7 participants
@estebank
Copy link
Contributor

estebank commented Feb 5, 2019

Partial solution, doesn't actually validate that the last statement in the function body can satisfy the trait bound, but it's a good incremental improvement over the status quo.

error[E0277]: the trait bound `(): Bar` is not satisfied
  --> $DIR/impl-trait-return-trailing-semicolon.rs:3:13
   |
LL | fn foo() -> impl Bar {
   |             ^^^^^^^^ the trait `Bar` is not implemented for `()`
LL |     5;
   |      - consider removing this semicolon
   |
   = note: the return type of a function must have a statically known size

Partially addresses #54771.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Feb 5, 2019

r? @eddyb

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

@estebank

This comment has been minimized.

Copy link
Contributor Author

estebank commented Feb 6, 2019

@cramertj

This comment has been minimized.

Copy link
Member

cramertj commented Feb 7, 2019

Nice! This looks like a great improvement.

@estebank

This comment has been minimized.

Copy link
Contributor Author

estebank commented Feb 7, 2019

@rust-highfive rust-highfive assigned zackmdavis and unassigned eddyb Feb 7, 2019

@zackmdavis
Copy link
Member

zackmdavis left a comment

requested reference comment; otherwise, r=me

Show resolved Hide resolved src/librustc/traits/error_reporting.rs Outdated

@estebank estebank force-pushed the estebank:impl-trait-semi branch from 5134e7c to 0afda05 Feb 7, 2019

@estebank

This comment has been minimized.

Copy link
Contributor Author

estebank commented Feb 8, 2019

@bors r=zackmdavis

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 8, 2019

📌 Commit 0afda05 has been approved by zackmdavis

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

Rollup merge of rust-lang#58204 - estebank:impl-trait-semi, r=zackmdavis
On return type `impl Trait` for block with no expr point at last semi

Partial solution, doesn't actually validate that the last statement in the function body can satisfy the trait bound, but it's a good incremental improvement over the status quo.

```
error[E0277]: the trait bound `(): Bar` is not satisfied
  --> $DIR/impl-trait-return-trailing-semicolon.rs:3:13
   |
LL | fn foo() -> impl Bar {
   |             ^^^^^^^^ the trait `Bar` is not implemented for `()`
LL |     5;
   |      - consider removing this semicolon
   |
   = note: the return type of a function must have a statically known size
```

Partially addresses rust-lang#54771.
@Centril

This comment has been minimized.

Copy link
Contributor

Centril commented Feb 13, 2019

Failed in rollup (#58426 (comment)) due to combination with #58167. @bors r-

@estebank estebank force-pushed the estebank:impl-trait-semi branch from 0afda05 to bf777a9 Feb 14, 2019

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Feb 14, 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:23b4cf5c:start=1550108314477763481,finish=1550108315585247228,duration=1107483747
$ 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:08:47]    Compiling arena v0.0.0 (/checkout/src/libarena)
[00:08:48]    Compiling syntax_pos v0.0.0 (/checkout/src/libsyntax_pos)
[00:08:53]    Compiling rustc_errors v0.0.0 (/checkout/src/librustc_errors)
[00:10:06]    Compiling syntax_ext v0.0.0 (/checkout/src/libsyntax_ext)
[00:10:35] error: internal compiler error: src/librustc/hir/def.rs:257: attempted .def_id() on invalid def: NonMacroAttr(Builtin)
[00:10:35] thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:588:9
[00:10:35] note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
[00:10:35] error: aborting due to previous error
[00:10:35] 
[00:10:35] 
[00:10:35] 
[00:10:35] note: the compiler unexpectedly panicked. this is a bug.
[00:10:35] 
[00:10:35] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:10:35] 
[00:10:35] note: rustc 1.33.0-beta.1 (d1add9723 2019-01-17) running on x86_64-unknown-linux-gnu
[00:10:35] 
[00:10:35] note: compiler flags: -Z force-unstable-if-unmarked -C prefer-dynamic -C opt-level=2 -C prefer-dynamic -C debug-assertions=y -C link-args=-Wl,-rpath,$ORIGIN/../lib --crate-type dylib
[00:10:35] note: some of the compiler flags provided by cargo are hidden
[00:10:35] 
[00:10:35] error: Could not compile `rustc`.
[00:10:35] warning: build failed, waiting for other jobs to finish...
[00:10:35] warning: build failed, waiting for other jobs to finish...
[00:10:38] error: build failed
[00:10:38] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--locked" "--color" "always" "--features" "" "--manifest-path" "/checkout/src/rustc/Cargo.toml" "--message-format" "json"
[00:10:38] expected success, got: exit code: 101
[00:10:38] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap build
[00:10:38] Build completed unsuccessfully in 0:04:01
[00:10:38] Makefile:18: recipe for target 'all' failed
[00:10:38] make: *** [all] Error 1
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:1ea57068
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Thu Feb 14 01:49:25 UTC 2019
---
travis_time:end:11f5a184:start=1550108966414433258,finish=1550108966419982809,duration=5549551
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:02fa62b9
$ 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:324d8646
travis_time:start:324d8646
$ 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:1a2d3b54
$ 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)

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