Skip to content

Separate projection bounds and predicates#73905

Merged
bors merged 34 commits intorust-lang:masterfrom
matthewjasper:projection-bounds-2
Oct 6, 2020
Merged

Separate projection bounds and predicates#73905
bors merged 34 commits intorust-lang:masterfrom
matthewjasper:projection-bounds-2

Conversation

@matthewjasper
Copy link
Contributor

Follow up to #72788.

Opening for a perf and crater runs.

r? @nikomatsakis

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 30, 2020
@matthewjasper
Copy link
Contributor Author

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion

@bors
Copy link
Collaborator

bors commented Jun 30, 2020

⌛ Trying commit b90c0fc3abf884ef96b717f49991f6b226e1598b with merge b037eadcbfea58d037fe042f10297285ed9fac05...

@rust-highfive
Copy link
Contributor

The job x86_64-gnu-llvm-8 of your PR failed (pretty log, 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.
##[section]Starting: Linux x86_64-gnu-llvm-8
##[section]Starting: Initialize job
Agent name: 'Azure Pipelines 4'
Agent machine name: 'fv-az578'
Current agent version: '2.171.1'
##[group]Operating System
16.04.6
LTS
LTS
##[endgroup]
##[group]Virtual Environment
Environment: ubuntu-16.04
Version: 20200621.1
Included Software: https://github.com/actions/virtual-environments/blob/ubuntu16/20200621.1/images/linux/Ubuntu1604-README.md
##[endgroup]
Agent running as: 'vsts'
Prepare build directory.
Set build variables.
Download all required tasks.
Download all required tasks.
Downloading task: Bash (3.171.1)
Checking job knob settings.
   Knob: AgentToolsDirectory = /opt/hostedtoolcache Source: ${AGENT_TOOLSDIRECTORY} 
   Knob: AgentPerflog = /home/vsts/perflog Source: ${VSTS_AGENT_PERFLOG} 
Start tracking orphan processes.
##[section]Finishing: Initialize job
##[section]Starting: Configure Job Name
==============================================================================
---
========================== Starting Command Output ===========================
[command]/bin/bash --noprofile --norc /home/vsts/work/_temp/16ffe6b3-ad6e-4a8a-8f72-46126bbaf6de.sh

##[section]Finishing: Disable git automatic line ending conversion
##[section]Starting: Checkout rust-lang/rust@refs/pull/73905/merge to s
Task         : Get sources
Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
Version      : 1.0.0
Author       : Microsoft
---
##[command]git remote add origin https://github.com/rust-lang/rust
##[command]git config gc.auto 0
##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
##[command]git config --get-all http.proxy
##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/73905/merge:refs/remotes/pull/73905/merge
---
 ---> 31fea614d2f3
Step 5/8 : ENV RUST_CONFIGURE_ARGS       --build=x86_64-unknown-linux-gnu       --llvm-root=/usr/lib/llvm-8       --enable-llvm-link-shared       --set rust.thin-lto-import-instr-limit=10
 ---> Using cache
 ---> 4195cadf126d
Step 6/8 : ENV SCRIPT python2.7 ../x.py test --exclude src/tools/tidy &&            python2.7 ../x.py test src/test/mir-opt --pass=build                                   --target=armv5te-unknown-linux-gnueabi &&            python2.7 ../x.py test src/tools/tidy
 ---> 4e90f6b48f05
Step 7/8 : ENV NO_DEBUG_ASSERTIONS=1
 ---> Using cache
 ---> dfa0a356d899
---
Set({"src/librustc_parse_format"}) not skipped for "bootstrap::test::CrateLibrustc" -- not in ["src/tools/tidy"]
Set({"src/librustc_passes"}) not skipped for "bootstrap::test::CrateLibrustc" -- not in ["src/tools/tidy"]
Set({"src/librustc_plugin_impl"}) not skipped for "bootstrap::test::CrateLibrustc" -- not in ["src/tools/tidy"]
Set({"src/librustc_privacy"}) not skipped for "bootstrap::test::CrateLibrustc" -- not in ["src/tools/tidy"]
Set({"src/librustc_query_system"}) not skipped for "bootstrap::test::CrateLibrustc" -- not in ["src/tools/tidy"]
Set({"src/librustc_save_analysis"}) not skipped for "bootstrap::test::CrateLibrustc" -- not in ["src/tools/tidy"]
Set({"src/librustc_serialize"}) not skipped for "bootstrap::test::CrateLibrustc" -- not in ["src/tools/tidy"]
Set({"src/librustc_session"}) not skipped for "bootstrap::test::CrateLibrustc" -- not in ["src/tools/tidy"]
Set({"src/librustc_span"}) not skipped for "bootstrap::test::CrateLibrustc" -- not in ["src/tools/tidy"]
---
Set({"src/librustc_parse_format"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
Set({"src/librustc_passes"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
Set({"src/librustc_plugin_impl"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
Set({"src/librustc_privacy"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
Set({"src/librustc_query_system"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
Set({"src/librustc_save_analysis"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
Set({"src/librustc_serialize"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
Set({"src/librustc_session"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
Set({"src/librustc_span"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
---
   Compiling rustc_parse_format v0.0.0 (/checkout/src/librustc_parse_format)
   Compiling tracing v0.1.15
   Compiling rustc_ast_pretty v0.0.0 (/checkout/src/librustc_ast_pretty)
   Compiling rustc_hir v0.0.0 (/checkout/src/librustc_hir)
   Compiling rustc_query_system v0.0.0 (/checkout/src/librustc_query_system)
   Compiling chalk-engine v0.14.0
   Compiling rustc_hir_pretty v0.0.0 (/checkout/src/librustc_hir_pretty)
   Compiling rustc_parse v0.0.0 (/checkout/src/librustc_parse)
   Compiling rustc_ast_lowering v0.0.0 (/checkout/src/librustc_ast_lowering)
---
   Compiling rustc_parse_format v0.0.0 (/checkout/src/librustc_parse_format)
   Compiling tracing v0.1.15
   Compiling rustc_ast_pretty v0.0.0 (/checkout/src/librustc_ast_pretty)
   Compiling rustc_hir v0.0.0 (/checkout/src/librustc_hir)
   Compiling rustc_query_system v0.0.0 (/checkout/src/librustc_query_system)
   Compiling chalk-engine v0.14.0
   Compiling rustc_hir_pretty v0.0.0 (/checkout/src/librustc_hir_pretty)
   Compiling chalk-solve v0.14.0
   Compiling rustc_parse v0.0.0 (/checkout/src/librustc_parse)
---
..................................i................................................................. 1900/10421
.................................................................................................... 2000/10421
...................................................i..i............................................. 2100/10421
.................................................................................................... 2200/10421
..........................................iiiii..................................................... 2300/10421
.................................................................................................... 2500/10421
.................................................................................................... 2600/10421
.................................................................................................... 2700/10421
.................................................................................................... 2800/10421
---
..i................................................................................................. 5300/10421
.................................................................................................... 5400/10421
...................................i................................................................ 5500/10421
.............................i...................................................................... 5600/10421
.................................................ii.ii........i...i................................. 5700/10421
..................i................................................................................. 5900/10421
...............i.................................................................................... 6000/10421
.........................................................................ii......................... 6100/10421
............i....................................................................................... 6200/10421
............i....................................................................................... 6200/10421
.................................................................................................... 6300/10421
.................................................................................................... 6400/10421
.....................................ii...i..ii...........i......................................... 6500/10421
.................................................................................................... 6700/10421
.................................................................................................... 6800/10421
.................................................................................................... 6800/10421
.........................................................................i..ii...................... 6900/10421
.................................................................................................... 7100/10421
.................................................................................................... 7200/10421
..............................i..................................................................... 7300/10421
.................................................................................................... 7400/10421
---
.................................................................................................... 8300/10421
.................................................................................................... 8400/10421
.................................................................................i.................. 8500/10421
.................................................................................................... 8600/10421
...................................iiiiii..iiiiii.i................................................. 8700/10421
.................................................................................................... 8900/10421
.................................................................................................... 9000/10421
.................................................................................................... 9100/10421
.................................................................................................... 9200/10421
---
Suite("src/test/codegen") not skipped for "bootstrap::test::Codegen" -- not in ["src/tools/tidy"]
Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)

running 202 tests
iiii......i..i...............ii..i..........i...........i............i...........i..i........i...... 100/202
..i....i.............i.i.i...iii..iiii....................................iii.................ii.... 200/202
test result: ok. 170 passed; 0 failed; 32 ignored; 0 measured; 0 filtered out

 finished in 7.742
Suite("src/test/codegen-units") not skipped for "bootstrap::test::CodegenUnits" -- not in ["src/tools/tidy"]
---
Suite("src/test/assembly") not skipped for "bootstrap::test::Assembly" -- not in ["src/tools/tidy"]
Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)

running 22 tests
iiiiiiiiiiiiiiiiiiiiii

 finished in 0.183
Suite("src/test/incremental") not skipped for "bootstrap::test::Incremental" -- not in ["src/tools/tidy"]
Check compiletest suite=incremental mode=incremental (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
---
Suite("src/test/debuginfo") not skipped for "bootstrap::test::Debuginfo" -- not in ["src/tools/tidy"]
Check compiletest suite=debuginfo mode=debuginfo (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)

running 116 tests
iiiii..i.....i..i...i..i.i.i..i..i..ii....i.i....ii..........iiii.........i.....i...i.......ii.i.ii. 100/116
....iiii.....ii.

 finished in 16.611
Suite("src/test/ui-fulldeps") not skipped for "bootstrap::test::UiFullDeps" -- not in ["src/tools/tidy"]
Uplifting stage1 rustc (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
---

   Doc-tests core

running 2587 tests
......iiiii......................................................................................... 100/2587
.................................................................................................ii. 200/2587
.......................................i............................................................ 400/2587
...............................................................................................i..i. 500/2587
...............................................................................................i..i. 500/2587
.................iiii............................................................................... 600/2587
.................................................................................................... 800/2587
.................................................................................................... 900/2587
.................................................................................................... 1000/2587
.................................................................................................... 1100/2587
---

running 1043 tests
i................................................................................................... 100/1043
.................................................................................................... 200/1043
...................iii......i......i...i.........i.................................................. 300/1043
..........................................................i....i.................................... 500/1043
...................ii............................................................................... 600/1043
.................................................................................................... 700/1043
.................................................................................................... 700/1043
...................................................................iiii............................. 800/1043
.................................................................................................... 900/1043
..........................................................................................iiii...... 1000/1043
test result: ok. 1023 passed; 0 failed; 20 ignored; 0 measured; 0 filtered out

 finished in 172.598
Set({"src/libterm"}) not skipped for "bootstrap::test::Crate" -- not in ["src/tools/tidy"]
---
Set({"src/librustc_parse_format"}) not skipped for "bootstrap::test::CrateLibrustc" -- not in ["src/tools/tidy"]
Set({"src/librustc_passes"}) not skipped for "bootstrap::test::CrateLibrustc" -- not in ["src/tools/tidy"]
Set({"src/librustc_plugin_impl"}) not skipped for "bootstrap::test::CrateLibrustc" -- not in ["src/tools/tidy"]
Set({"src/librustc_privacy"}) not skipped for "bootstrap::test::CrateLibrustc" -- not in ["src/tools/tidy"]
Set({"src/librustc_query_system"}) not skipped for "bootstrap::test::CrateLibrustc" -- not in ["src/tools/tidy"]
Set({"src/librustc_save_analysis"}) not skipped for "bootstrap::test::CrateLibrustc" -- not in ["src/tools/tidy"]
Set({"src/librustc_serialize"}) not skipped for "bootstrap::test::CrateLibrustc" -- not in ["src/tools/tidy"]
Set({"src/librustc_session"}) not skipped for "bootstrap::test::CrateLibrustc" -- not in ["src/tools/tidy"]
Set({"src/librustc_span"}) not skipped for "bootstrap::test::CrateLibrustc" -- not in ["src/tools/tidy"]
---
Set({"src/librustc_parse_format"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
Set({"src/librustc_passes"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
Set({"src/librustc_plugin_impl"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
Set({"src/librustc_privacy"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
Set({"src/librustc_query_system"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
Set({"src/librustc_save_analysis"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
Set({"src/librustc_serialize"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
Set({"src/librustc_session"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
Set({"src/librustc_span"}) not skipped for "bootstrap::doc::Rustc" -- not in ["src/tools/tidy"]
---
  = note: cannot satisfy `_: std::ops::Try`
  = note: required by `std::ops::Try::into_result`
help: consider specifying the type argument in the method call
  |
5 |     let v: Vec<bool> = results.collect::<B>()?;

error: aborting due to previous error

For more information about this error, try `rustc --explain E0283`.
For more information about this error, try `rustc --explain E0283`.
Some expected error codes were not found: ["E0284"]
failures:
    /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md - Rust_Compiler_Error_Index::E0284 (line 5059)

test result: FAILED. 921 passed; 1 failed; 19 ignored; 0 measured; 0 filtered out
---
  local time: Tue Jun 30 23:52:03 UTC 2020
  network time: Tue, 30 Jun 2020 23:52:03 GMT
== end clock drift check ==

##[error]Bash exited with code '1'.
##[section]Finishing: Run build
##[section]Starting: Checkout rust-lang/rust@refs/pull/73905/merge to s
Task         : Get sources
Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
Version      : 1.0.0
Author       : Microsoft
Author       : Microsoft
Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
==============================================================================
Cleaning any cached credential from repository: rust-lang/rust (GitHub)
##[section]Finishing: Checkout rust-lang/rust@refs/pull/73905/merge to s
Cleaning up task key
Start cleaning up orphan processes.
Terminate orphan process: pid (4266) (python)
##[section]Finishing: Finalize Job

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 @rust-lang/infra. (Feature Requests)

@bors
Copy link
Collaborator

bors commented Jul 1, 2020

☀️ Try build successful - checks-actions, checks-azure
Build commit: b037eadcbfea58d037fe042f10297285ed9fac05 (b037eadcbfea58d037fe042f10297285ed9fac05)

@rust-timer
Copy link
Collaborator

Queued b037eadcbfea58d037fe042f10297285ed9fac05 with parent 16957bd, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit (b037eadcbfea58d037fe042f10297285ed9fac05): comparison url.

@matthewjasper
Copy link
Contributor Author

@craterbot check

@craterbot
Copy link
Collaborator

👌 Experiment pr-73905 created and queued.
🤖 Automatically detected try build b037eadcbfea58d037fe042f10297285ed9fac05
🔍 You can check out the queue and this experiment's details.

ℹ️ 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 Jul 1, 2020
@matthewjasper
Copy link
Contributor Author

matthewjasper commented Jul 1, 2020

Actually, it looks like some of the of the perf crates failed to build, I'll cancel if that's the case locally.

@matthewjasper
Copy link
Contributor Author

@craterbot cancel

@matthewjasper
Copy link
Contributor Author

@craterbot abort

@craterbot
Copy link
Collaborator

🗑️ Experiment pr-73905 deleted!

ℹ️ 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 Jul 1, 2020
Copy link
Contributor

@nikomatsakis nikomatsakis left a comment

Choose a reason for hiding this comment

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

Generally 👍, left some comments/thoughts

Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: not grammatical, and a bit "closed mouthed". An example would be good. Is this accurate?

Elaborated version of the predicates from explicit_item_bounds.

Example: if the explicit bounds are T: Eq, then this would return [T: Eq, T: PartialEq]

Does this also include bounds from parent items? We should say so.

Copy link
Contributor

Choose a reason for hiding this comment

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

(I think the answer is "no", does not include bounds from parent items.)

Copy link
Contributor

Choose a reason for hiding this comment

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

Is this something you plan to do as part of this PR series? (Or maybe I'll find that in a future commit you already did so...)

Copy link
Contributor

Choose a reason for hiding this comment

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

well that looks like it was a dubious helper =)

Copy link
Contributor

@estebank estebank Jul 7, 2020

Choose a reason for hiding this comment

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

Pretty sure I'm the culprit 👋

Edit: Yep: #69745

Copy link
Contributor

Choose a reason for hiding this comment

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

Pre-existing, I guess, but translate_predicate_substs injects impl_ty_value, can we add an assertion (perhaps in that function) that impl_ty_value has no late-bound-regions, and the same for rebased_substs? Otherwise, doing this substitution inside the binder is not safe.

Copy link
Contributor

Choose a reason for hiding this comment

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

But also -- I feel like we should be able to do this with just an ordinary substitution. Why can't we?

Like, we're taking the bound declared in the trait -- which might be like <Self as Foo>::Bar<'a>: PartialEq<B> or something, and we're converting it to the impl, right? So why can't we just apply the rebased_subst and be done with it?

Copy link
Contributor

Choose a reason for hiding this comment

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

So given <T as Iterator>::Item, we are no longer checking that T: Iterator is WF, is that correct? say a bit more about what's going on here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Pre-existing, but can we add a comment indicating what this function does?

I believe what it does is to

  • look for an obligation like <T as Foo>::Bar: Baz, where the self-type is a projection or opaque type
  • look at the bounds declared on Bar to see if any of them match Baz
  • if there is one, it returns the <T as Foo>::Bar: Baz bound declared within the trait or on the opaque type

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you elaborate a bit on the motivation here? Is this just a redundant check? i.e., each place that specifies the type of the opaque type is also doing these checks, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

heh I've been meaning to change that "cause" info for years...

Copy link
Contributor

Choose a reason for hiding this comment

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

Uh..?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So, the cycle is broken with this PR because bounds don't need to be proven to prove that the trait is well-formed. This makes the code work like it does currently.

@matthewjasper matthewjasper force-pushed the projection-bounds-2 branch 2 times, most recently from a23032d to 9d2c078 Compare July 2, 2020 21:03
@matthewjasper
Copy link
Contributor Author

So this PR as is currently breaks the following:

trait Op where Self::Output: Copy {
    type Output;
}

// This now requires an explicit `where T::Output: Copy `
// like any other kind of where clause on the trait, except super traits.
fn f<T: Op>() {}

Since this apparently never comes up in rustc/perf/the tests I'm leaving it in for the crater run to satisfy my curiosity about whether anyone is writing bounds like this. I'll probably fix it even if crater can't find anyone doing this.

@nikomatsakis
Copy link
Contributor

So this PR as is currently breaks the following:

I was going to ask about that...thanks for reminding me. I too am curious how much it matters.

@erikdesjardins
Copy link
Contributor

FWIW mogwai does this: https://github.com/schell/mogwai/blob/f21d6e00c4dc8780115ee9a636b4317649209ed9/mogwai/src/component.rs#L123-L128

pub trait Component
where
  Self: Sized + 'static,
  Self::ModelMsg: Clone,
  Self::ViewMsg: Clone,
  Self::DomNode: JsCast + AsRef<Node> + Clone,

@bors
Copy link
Collaborator

bors commented Jul 4, 2020

☔ The latest upstream changes (presumably #74019) made this pull request unmergeable. Please resolve the merge conflicts.

@matthewjasper matthewjasper force-pushed the projection-bounds-2 branch from 9d2c078 to c879e01 Compare July 4, 2020 11:16
@matthewjasper
Copy link
Contributor Author

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion

@jackh726 jackh726 mentioned this pull request May 4, 2022
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged-by-bors This PR was explicitly merged by bors. relnotes Marks issues that should be documented in the release notes of the next release. relnotes-perf Performance improvements that should be mentioned in the release notes. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.