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

[WIP] rustc_typeck: ensure type alias bounds are implied by the type being well-formed. #54090

Closed
wants to merge 3 commits into from

Conversation

eddyb
Copy link
Member

@eddyb eddyb commented Sep 9, 2018

NOTE: this is mainly for crater, we'll only emit hard errors on Rust 2018.
This is the second half to a plan outlined in comment on #49441 (see #54033 for the first half).

Fixes #21903 (by disallowing currently unenforceable bounds instead of enforcing them).

This PR includes two hacks: first to not check (usually implied) T: Sized bounds, as they're a common source of breakage and would probably be too annoying in practice, and a second to remove some overlap with #54033, so adding missing bounds is not required to test this PR.
A decision should be made about the former hack, while the latter is only a temporary convenience.

r? @nikomatsakis

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 9, 2018
@eddyb
Copy link
Member Author

eddyb commented Sep 9, 2018

@bors try (hoping for a crater check run)

@bors
Copy link
Contributor

bors commented Sep 9, 2018

⌛ Trying commit ab3e0d2 with merge 3a2610c2a16575649896925631bf8cec4f4b1961...

@Mark-Simulacrum
Copy link
Member

You should be able to start the crater run yourself via the bot, see directions here: https://github.com/rust-lang-nursery/crater/blob/master/docs/bot-usage.md

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-5.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.
[01:07:13] 
[01:07:13] running 258 tests
[01:07:40] .......................i............................................................................
[01:08:04] .........................i..........................................................................
 type Golf<T> where T: Clone = (T, T);
[01:08:13]    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::clone::Clone` is not implemented for `T`
[01:08:13]    |
[01:08:13]    = help: consider adding a `where T: std::clone::Clone` bound
[01:08:13] error: Compilation failed, aborting rustdoc
[01:08:13] 
[01:08:13] 
[01:08:13] ------------------------------------------
---
[01:08:13] 
[01:08:13] thread 'main' panicked at 'Some tests failed', tools/compiletest/src/main.rs:497:22
[01:08:13] 
[01:08:13] 
[01:08:13] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--rustdoc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc" "--src-base" "/checkout/src/test/rustdoc" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "rustdoc" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-5.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options " "--target-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "5.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[01:08:13] 
[01:08:13] 
[01:08:13] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:08:13] Build completed unsuccessfully in 0:22:08
[01:08:13] Build completed unsuccessfully in 0:22:08
[01:08:13] Makefile:58: recipe for target 'check' failed
[01:08:13] make: *** [check] Error 1

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:18c9276c
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)

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)

@bors
Copy link
Contributor

bors commented Sep 9, 2018

☀️ Test successful - status-travis
State: approved= try=True

@Mark-Simulacrum
Copy link
Member

@craterbot run p=1 start=master#f50b7758f4dc85dc1c5e38258adaa94213ac6ed1 end=try#3a2610c2a16575649896925631bf8cec4f4b1961 cap-lints=warn mode=check-only

@craterbot
Copy link
Collaborator

👌 Experiment pr-54090 created and queued.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 10, 2018
@craterbot
Copy link
Collaborator

🚧 Experiment pr-54090 is now running on agent aws-2.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot
Copy link
Collaborator

🎉 Experiment pr-54090 is completed!
📰 Open the full report.

⚠️ If you notice any spurious failure please add them to the blacklist!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Sep 10, 2018
@eddyb
Copy link
Member Author

eddyb commented Sep 11, 2018

Most of the failures come from diesel, and are probably caused by the fact that this is only one half of the check. There are a few legitimate ones. Overall, this seems like not a dent in the ecosystem.

@RalfJung
Copy link
Member

About that Sized hack, can we make it so that type Foo<T: Sized> = Box<T> causes an error? I.e., just implicit Sized is ignored?

@eddyb
Copy link
Member Author

eddyb commented Sep 17, 2018

@RalfJung I don't want to keep the Sized hack in, I'd rather have an automatically applicable suggestion to add ?Sized - see also #49441 (comment).

@eddyb
Copy link
Member Author

eddyb commented Sep 18, 2018

(you can see above I opened 4 PRs - I want to reuse the type_alias_bounds lint name)

bors bot added a commit to gfx-rs/gfx that referenced this pull request Sep 18, 2018
2409: Don't #[allow(type_alias_bounds)]. r=kvark a=eddyb

rust-lang/rust#54090 will fix false positives (not relevant here) and make it an error in the upcoming Rust 2018 edition, which means that if you want to migrate to Rust 2018, it shouldn't be ignored.

See also rust-lang/rust#49441 (comment) for the decision and some background.

Co-authored-by: Eduard-Mihai Burtescu <edy.burt@gmail.com>
@TimNN TimNN added A-allocators Area: Custom and system allocators and removed A-allocators Area: Custom and system allocators labels Sep 25, 2018
bors added a commit that referenced this pull request Sep 28, 2018
rustc: keep a Span for each predicate in ty::GenericPredicates.

This should allow finer-grained diagnostics, including migration suggestions for #54090.
(Note that I haven't changed most of the users of `predicates_of` to use the new spans)

r? @nikomatsakis
bors added a commit that referenced this pull request Sep 29, 2018
rustc: keep a Span for each predicate in ty::GenericPredicates.

This should allow finer-grained diagnostics, including migration suggestions for #54090.
(Note that I haven't changed most of the users of `predicates_of` to use the new spans)

r? @nikomatsakis
@TimNN
Copy link
Contributor

TimNN commented Oct 16, 2018

Ping from triage! IIUC, this is waiting on some other PRs to be submitted, so I'm marking this as blocked.

@TimNN TimNN added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 16, 2018
@Centril Centril added P-high High priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. I-nominated labels Oct 19, 2018
@nikomatsakis
Copy link
Contributor

I'm going to close this PR for now. I do plan to start opening some PRs and issuing warnings, per the plan discussed in #55222

@apiraino apiraino removed I-nominated P-high High priority labels Feb 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-blocked Status: Blocked on something else such as an RFC or other implementation work. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Trait bounds are not yet enforced in type definitions
10 participants