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] Move Self: Trait predicate to trait items instead of the trait itself #50183

Closed

Conversation

tmandry
Copy link
Member

@tmandry tmandry commented Apr 23, 2018

The predicates_of query on a trait Foo should only return where clauses on that trait. Right now, it includes Self: Foo, which causes problems when lowering to new chalk-style logic.

This PR moves Self: Foo to the trait items, rather than the trait itself.

Status: Functional enough to compile std, but some tests failing; needs cleanup.

r? @nikomatsakis

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 23, 2018
@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

@tmandry
Copy link
Member Author

tmandry commented Apr 24, 2018

TODO (for my own sanity):

@bors
Copy link
Contributor

bors commented Apr 24, 2018

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

@tmandry tmandry force-pushed the move-self-trait-predicate-to-items branch from 32d2cab to 293c60f Compare April 27, 2018 02:37
@rust-highfive

This comment has been minimized.

@tmandry tmandry force-pushed the move-self-trait-predicate-to-items branch from 293c60f to defc7e9 Compare April 27, 2018 02:49
@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

@tmandry tmandry force-pushed the move-self-trait-predicate-to-items branch from cfc20f0 to edeb9c4 Compare April 30, 2018 06:01
@rust-highfive

This comment has been minimized.

This can matter for obligation causes that get reported as errors,
when there are more than one of the same obligation in the forest.
@tmandry tmandry force-pushed the move-self-trait-predicate-to-items branch from 3ccb69d to 9374cd2 Compare May 2, 2018 01:24
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-3.9 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:09:25] .............................................................................ii.....................
[01:10:22] .........................................i.............................test [run-pass] run-pass/saturating-float-casts.rs has been running for over 60 seconds
[01:10:32] .......................i.ii..
[01:11:26] ....................................................................................................
[01:11:54] ..iiiiiii...........................................................................................
[01:13:02] ....................................................................................................
[01:13:32] ...........................................................................
[01:13:32] test result: ok. 2956 passed; 0 failed; 19 ignored; 0 measured; 0 filtered out
[01:13:32] 
---
travis_time:start:test_rustdoc
Check compiletest suite=rustdoc mode=rustdoc (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:26:46] 
[01:26:46] running 231 tests
[01:29:10] ...................i...................................F.....................................FFF.F..
', tools/compiletest/src/runtest.rs:2965:9
[01:31:03] 
[01:31:03] ---- [rustdoc] rustdoc/issue-20727-2.rs stdout ----
[01:31:03]  
[01:31:03]  
[01:31:03] error: htmldocck failed!
[01:31:03] status: exit code: 1
[01:31:03] command: "/usr/bin/python2.7" "/checkout/src/etc/htmldocck.py" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc/issue-20727-2.stage2-x86_64-unknown-linux-gnu" "/checkout/src/test/rustdoc/issue-20727-2.rs"
[01:31:03] ------------------------------------------
[01:31:03] 
[01:31:03] ------------------------------------------
[01:31:03] stderr:
[01:31:03] stderr:
[01:31:03] ------------------------------------------
[01:31:03] 30: @has check failed
[01:31:03]  `XPATH PATTERN` did not match
[01:31:03]      // @has - '//*[@class="rust trait"]' 'fn add(self, rhs: RHS) -> Self::Output;'
[01:31:03] Encountered 1 errors
[01:31:03] 
[01:31:03] ------------------------------------------
[01:31:03] 
[01:31:03] 
[01:31:03] thread '[rustdoc] rustdoc/issue-20727-2.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:2965:9
[01:31:03] 
[01:31:03] ---- [rustdoc] rustdoc/issue-20727-3.rs stdout ----
[01:31:03]  
[01:31:03] error: htmldocck failed!
[01:31:03] status: exit code: 1
[01:31:03] command: "/usr/bin/python2.7" "/checkout/src/etc/htmldocck.py" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc/issue-20727-3.stage2-x86_64-unknown-linux-gnu" "/checkout/src/test/rustdoc/issue-20727-3.rs"
[01:31:03] ------------------------------------------
[01:31:03] 
[01:31:03] ------------------------------------------
[01:31:03] stderr:
[01:31:03] stderr:
[01:31:03] ------------------------------------------
[01:31:03] 32: @has check failed
[01:31:03]  `XPATH PATTERN` did not match
[01:31:03]      // @has - '//*[@class="rust trait"]' 'fn deref(&self) -> Self::Target;'
[01:31:03] Encountered 1 errors
[01:31:03] 
[01:31:03] ------------------------------------------
[01:31:03] 
[01:31:03] 
[01:31:03] thread '[rustdoc] rustdoc/issue-20727-3.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:2965:9
[01:31:03] 
[01:31:03] ---- [rustdoc] rustdoc/issue-20727-4.rs stdout ----
[01:31:03]  
[01:31:03] error: htmldocck failed!
[01:31:03] status: exit code: 1
[01:31:03] command: "/usr/bin/python2.7" "/checkout/src/etc/htmldocck.py" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc/issue-20727-4.stage2-x86_64-unknown-linux-gnu" "/checkout/src/test/rustdoc/issue-20727-4.rs"
[01:31:03] ------------------------------------------
[01:31:03] 
[01:31:03] ------------------------------------------
[01:31:03] stderr:
[01:31:03] stderr:
[01:31:03] ------------------------------------------
[01:31:03] 47: @has check failed
[01:31:03]  `XPATH PATTERN` did not match
[01:31:03]      // @has - '//*[@class="rust trait"]' 'fn index_mut(&mut self, index: Idx) -> &mut Self::Output;'
[01:31:03] Encountered 1 errors
[01:31:03] 
[01:31:03] ------------------------------------------
[01:31:03] 
[01:31:03] 
[01:31:03] thread '[rustdoc] rustdoc/issue-20727-4.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:2965:9
[01:31:03] 
[01:31:03] ---- [rustdoc] rustdoc/issue-20727.rs stdout ----
[01:31:03]  
[01:31:03] error: htmldocck failed!
[01:31:03] status: exit code: 1
[01:31:03] command: "/usr/bin/python2.7" "/checkout/src/etc/htmldocck.py" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc/issue-20727.stage2-x86_64-unknown-linux-gnu" "/checkout/src/test/rustdoc/issue-20727.rs"
[01:31:03] ------------------------------------------
[01:31:03] 
[01:31:03] ------------------------------------------
[01:31:03] stderr:
[01:31:03] stderr:
[01:31:03] ------------------------------------------
[01:31:03] 31: @has check failed
[01:31:03]  `XPATH PATTERN` did not match
[01:31:03]      // @has - '//*[@class="rust trait"]' "fn deref(&'a self) -> &'a Self::Target;"
[01:31:03] Encountered 1 errors
[01:31:03] 
[01:31:03] ------------------------------------------
[01:31:03] 
---
[01:31:03] test result: FAILED. 224 passed; 5 failed; 2 ignored; 0 measured; 0 filtered out
[01:31:03] 
[01:31:03] 
[01:31:03] 
[01:31:03] 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-3.9/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" "3.9.1\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:31:03] 
[01:31:03] 
[01:31:03] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:31:03] Build completed unsuccessfully in 0:36:01
[01:31:03] Build completed unsuccessfully in 0:36:01
[01:31:03] Makefile:58: recipe for target 'check' failed
[01:31:03] make: *** [check] Error 1

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:1067cea5
$ 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)

@tmandry
Copy link
Member Author

tmandry commented May 2, 2018

Okay, this now passes all tests up until rustdoc (I'll get to that as soon as I can.) I think it's ready for an initial review, @nikomatsakis.

EDIT: I had mentioned a possible refactoring here, but I'm already confused by what I meant :)

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-3.9 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:08:51] .............................................................................ii.....................
[01:09:48] .........................................i...............................test [run-pass] run-pass/saturating-float-casts.rs has been running for over 60 seconds
[01:09:57] .....................i.ii..
[01:10:50] ....................................................................................................
[01:11:18] ..iiiiiii...........................................................................................
[01:12:24] ....................................................................................................
[01:12:51] ...........................................................................
[01:12:51] test result: ok. 2956 passed; 0 failed; 19 ignored; 0 measured; 0 filtered out
[01:12:51] 
---
travis_time:start:test_rustdoc
Check compiletest suite=rustdoc mode=rustdoc (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:26:05] 
[01:26:05] running 231 tests
[01:28:29] ...................i...................................F.....................................FFF.F..
[01:30:21] ...............................
[01:30:21] failures:
[01:30:21] thread 'main' panicked at 'Some tests failed', tools/compiletest/src/main.rs:488:22
[01:30:21] 
[01:30:21] 
[01:30:21] ---- [rustdoc] rustdoc/inline-default-methods.rs stdout ----
[01:30:21]  
[01:30:21] error: htmldocck failed!
[01:30:21] status: exit code: 1
[01:30:21] command: "/usr/bin/python2.7" "/checkout/src/etc/htmldocck.py" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc/inline-default-methods.stage2-x86_64-unknown-linux-gnu" "/checkout/src/test/rustdoc/inline-default-methods.rs"
[01:30:21] ------------------------------------------
[01:30:21] 
[01:30:21] ------------------------------------------
[01:30:21] stderr:
[01:30:21] stderr:
[01:30:21] ------------------------------------------
[01:30:21] 17: @has check failed
[01:30:21]  `XPATH PATTERN` did not match
[01:30:21]  // @has - '//*[@class="rust trait"]' 'fn bar(&self);'
[01:30:21] 18: @has check failed
[01:30:21]  `XPATH PATTERN` did not match
[01:30:21]  // @has - '//*[@class="rust trait"]' 'fn foo(&mut self) { ... }'
[01:30:21] Encountered 2 errors
[01:30:21] 
[01:30:21] ------------------------------------------
[01:30:21] 
[01:30:21] 
[01:30:21] thread '[rustdoc] rustdoc/inline-default-methods.rs' panicked at 'explicit panic---------------------------
[01:30:21] 32: @has check failed
[01:30:21]  `XPATH PATTERN` did not match
[01:30:21]      // @has - '//*[@class="rust trait"]' 'fn deref(&self) -> Self::Target;'
[01:30:21] Encountered 1 errors
[01:30:21] 
[01:30:21] ------------------------------------------
[01:30:21] 
[01:30:21] 
[01:30:21] thread '[rustdoc] rustdoc/issue-20727-3.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:2965:9
[01:30:21] 
[01:30:21] ---- [rustdoc] rustdoc/issue-20727-4.rs stdout ----
[01:30:21]  
[01:30:21] error: htmldocck failed!
[01:30:21] status: exit code: 1
[01:30:21] command: "/usr/bin/python2.7" "/checkout/src/etc/htmldocck.py" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc/issue-20727-4.stage2-x86_64-unknown-linux-gnu" "/checkout/src/test/rustdoc/issue-20727-4.rs"
[01:30:21] ------------------------------------------
[01:30:21] 
[01:30:21] ------------------------------------------
[01:30:21] stderr:
[01:30:21] stderr:
[01:30:21] ------------------------------------------
[01:30:21] 47: @has check failed
[01:30:21]  `XPATH PATTERN` did not match
[01:30:21]      // @has - '//*[@class="rust trait"]' 'fn index_mut(&mut self, index: Idx) -> &mut Self::Output;'
[01:30:21] Encountered 1 errors
[01:30:21] 
[01:30:21] ------------------------------------------
[01:30:21] 
[01:30:21] 
[01:30:21] thread '[rustdoc] rustdoc/issue-20727-4.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:2965:9
[01:30:21] 
[01:30:21] ---- [rustdoc] rustdoc/issue-20727.rs stdout ----
[01:30:21]  
[01:30:21] error: htmldocck failed!

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)

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.

Looking good, but I've got a lot of questions. As I mentioned on gitter, might be best if I clone and run some experiments to understand better. =)

@@ -2742,6 +2747,23 @@ fn param_env<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
traits::normalize_param_env_or_error(tcx, def_id, unnormalized_env, cause)
}

pub fn is_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> bool {
if let Some(id) = tcx.hir.as_local_node_id(def_id) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This check doesn't look it is returning the right thing across crates I would prefer to inspect the def-key, as you see here:

crate fn program_clauses_for<'a, 'tcx>(
tcx: TyCtxt<'a, 'tcx, 'tcx>,
def_id: DefId,
) -> Clauses<'tcx> {
match tcx.def_key(def_id).disambiguated_data.data {
DefPathData::Trait(_) => program_clauses_for_trait(tcx, def_id),
DefPathData::Impl => program_clauses_for_impl(tcx, def_id),
DefPathData::AssocTypeInImpl(..) => program_clauses_for_associated_type_value(tcx, def_id),
_ => Slice::empty(),
}
}

these lines in particular:

match tcx.def_key(def_id).disambiguated_data.data {
DefPathData::Trait(_) => program_clauses_for_trait(tcx, def_id),

Some(trait_ref.to_predicate())
} else {
None
};
Copy link
Contributor

Choose a reason for hiding this comment

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

This feels a bit ad-hoc to me. Can you remember why you added this? Also, when does this "has escaping regions" check return false? I would think .. never ? You could add a assert!(!trait_ref.has_escaping_regions()); instead (and perhaps prove me wrong).

If I understand correctly, this is saying that, to prove that trait Foo { .. } is well-formed, we have to prove that Self: Foo? I'm not sure why that would be useful.

Copy link
Member Author

Choose a reason for hiding this comment

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

There are indeed places where trait_ref has escaping regions. There is a call skip_binder() above (look for (*)).

I believe an example that triggers this is here:

fn takes_lifetime(_f: for<'a> fn(&'a ()) -> <() as Lifetime<'a>>::Out) {
}

If the trait ref does have escaping regions, it would get filtered out below anyway. Except that trait_ref.to_predicate() invokes ty::Binder::dummy, which has the assertion you mentioned and we get a panic. Using ty::Binder::bind is incorrect and messes up our indices.

On a related note, this fn was copied and modified from the above. I should find a way to remove the repetition.

Copy link
Member Author

Choose a reason for hiding this comment

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

If I understand correctly, this is saying that, to prove that trait Foo { .. } is well-formed, we have to prove that Self: Foo? I'm not sure why that would be useful.

It gets used to check bounds on fn items as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm. I'll have to double check what's going on here then, I was confused.


// A `Self: Trait` predicate on trait items breaks selection, so filter it out.
// FIXME: This is a big hack!
if let Some(trait_def_id) = trait_m_predicates.parent {
Copy link
Contributor

Choose a reason for hiding this comment

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

What error do you get here? This feels surprising too! I would rather that -- instead of "filtering this out" -- we add something to the environment that allows it to be proven true, if needed. But it seems like the presence of this should fall out from changes elsewhere.

Copy link
Member Author

Choose a reason for hiding this comment

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

A full explanation is here: https://paper.dropbox.com/doc/Removing-SelfTrait-from-predicates_of-notes-neNFC7UaxCj353Du3Dd2d#:h2=Other-questions

That whole doc is really just for this particular change (the title implies that it's for the whole task.)

Copy link
Member Author

Choose a reason for hiding this comment

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

TL;DR: The extra predicate breaks downstream winnowing logic

Copy link
Contributor

Choose a reason for hiding this comment

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

I wondered if that would happen.

let parent_id = tcx.hir.get_parent(node_id);
let parent_def_id = tcx.hir.local_def_id(parent_id);
debug_assert!(ty::is_trait_node(tcx, parent_id));
predicates.push(ty::TraitRef::identity(tcx, parent_def_id).to_predicate());
Copy link
Contributor

Choose a reason for hiding this comment

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

This feels right! ✅

@shepmaster shepmaster added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label May 6, 2018
@shepmaster shepmaster removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 6, 2018
@shepmaster
Copy link
Member

Ping from triage @tmandry and @nikomatsakis — are there clear next steps for this PR?

@tmandry
Copy link
Member Author

tmandry commented May 8, 2018

@shepmaster: Waiting on some feedback from @nikomatsakis, who is traveling this week. We still need to discern whether this is the right approach.

@pietroalbini pietroalbini added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 14, 2018
@pietroalbini
Copy link
Member

Ping from triage @nikomatsakis! The author needs some feedback!

leoyvens added a commit to leoyvens/rust that referenced this pull request May 17, 2018
Skip the binder in less places during WF check. I thought this might help fix rust-lang#50781, but I couldn't actually observe any effect for this changes. Maybe it's still a worthwhile refactoring since skipping binders is generally a bad thing. There is a (manageble) conflict with rust-lang#50183.
@pietroalbini pietroalbini added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label May 21, 2018
@pietroalbini
Copy link
Member

Ping from triage! The PR author needs some feedback, can @nikomatsakis or someone else from @rust-lang/compiler give it?

1 similar comment
@pietroalbini
Copy link
Member

Ping from triage! The PR author needs some feedback, can @nikomatsakis or someone else from @rust-lang/compiler give it?

@pietroalbini
Copy link
Member

Ping from triage @rust-lang/compiler! This PR has been ignored for more than three weeks, can we get someone to check in on it?

@tmandry
Copy link
Member Author

tmandry commented Jun 5, 2018

So it looks like rustdoc never used predicates_of query for a Trait, but rather the hir where clause directly. That's how it sidestepped the Self: Trait appearing in the docs.

For trait items however, it does use predicates_of. For example,

ty::AssociatedKind::Method => {
let generics = (cx.tcx.generics_of(self.def_id),
&cx.tcx.predicates_of(self.def_id)).clean(cx);

ty::AssociatedKind::Type => {
let my_name = self.name.clean(cx);
if let ty::TraitContainer(did) = self.container {
// When loading a cross-crate associated type, the bounds for this type
// are actually located on the trait/impl itself, so we need to load
// all of the generics from there and then look for bounds that are
// applied to this associated type in question.
let predicates = cx.tcx.predicates_of(did);
let generics = (cx.tcx.generics_of(did), &predicates).clean(cx);

There is already some logic to do cleanup for Sized bounds in this method, but this is another place we'll have to filter out our new predicate. I'll try doing that next; not sure yet if it's going to be trivial.

@TimNN
Copy link
Contributor

TimNN commented Jun 12, 2018

Ping from triage @nikomatsakis / @rust-lang/compiler this PR needs your review!

@tmandry
Copy link
Member Author

tmandry commented Jun 14, 2018

Thought I'd post an update for anyone wondering what's going on with this PR. Most communication over this PR has been going on in the WG-traits Discord.

In short, we've been wrestling with some idiosyncrasies of the type system that make this change much trickier than originally anticipated.

@nikomatsakis has been experimenting with some changes to the approach, but is traveling this week. I haven't had much time to dig in myself lately, but it may be beyond me at this point :)

Given that making further progress on this probably requires an extensive understanding of the type checker and there are many other edition-related priorities, this PR was getting starved for attention. However, it has gotten more lately, and I expect that will continue since it's starting to block progress on #49177!

@pietroalbini
Copy link
Member

Ping from triage @nikomatsakis! This PR needs your review.

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-3.9 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:start:test_rustdoc
Check compiletest suite=rustdoc mode=rustdoc (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:06:00] 
[01:06:00] running 240 tests
[01:07:15] ....................i..................................F.........................................FFF
[01:08:00] .F...........i......................................................................................
nu/test/rustdoc/issue-20727" "/checkout/src/test/rustdoc/issue-20727.rs"
[01:08:11] ------------------------------------------
[01:08:11] 
[01:08:11] ------------------------------------------
[01:08:11] stderr:
[01:08:11] stderr:
[01:08:11] ------------------------------------------
[01:08:11] 31: @has check failed
[01:08:11]  `XPATH PATTERN` did not match
[01:08:11]      // @has - '//*[@class="rust trait"]' "fn deref(&'a self) -> &'a Self::Target;"
[01:08:11] Encountered 1 errors
[01:08:11] 
[01:08:11] ------------------------------------------
[01:08:11] 
---
[01:08:11] 
[01:08:11] thread 'main' panicked at 'Some tests failed', tools/compiletest/src/main.rs:498:22
[01:08:11] 
[01:08:11] 
[01:08:11] 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-3.9/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" "3.9.1\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:11] 
[01:08:11] 
[01:08:11] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:08:11] Build completed unsuccessfully in 0:23:51
[01:08:11] Build completed unsuccessfully in 0:23:51
[01:08:11] make: *** [check] Error 1
[01:08:11] Makefile:58: recipe for target 'check' failed

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:0236e4b6
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Sat Jun 23 21:30:33 UTC 2018
Sat, 23 Jun 2018 21:30:33 GMT
travis_time:end:0236e4b6:start=1529789433636410920,fin89435643665249,duration=7632151
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:1cfb6ec9
$ head -30 ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
head: cannot open ‘./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers’ for reading: No such file or directory
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:0bebf10b
$ 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)

@nikomatsakis
Copy link
Contributor

So I've reworked these commits. I'm going to close and re-open this PR with a new branch at this point I think.

@nikomatsakis
Copy link
Contributor

(Just so we can have some fresh conversation!)

bors added a commit that referenced this pull request Jul 4, 2018
…s, r=scalexm

Move self trait predicate to items

This is a "reimagination" of @tmandry's PR #50183. The main effect is described in this comment from one of the commits:

---

Before we had the following results for `predicates_of`:

```rust
trait Foo { // predicates_of: Self: Foo
  fn bar(); // predicates_of: Self: Foo (inherited from trait)
}
```

Now we have removed the `Self: Foo` from the trait. However, we still
add it to the trait ITEM. This is because when people do things like
`<T as Foo>::bar()`, they still need to prove that `T: Foo`, and
having it in the `predicates_of` seems to be the cleanest way to
ensure that happens right now (otherwise, we'd need special case code
in various places):

```rust
trait Foo { // predicates_of: []
  fn bar(); // predicates_of: Self: Foo
}
```

However, we sometimes want to get the list of *just* the predicates
truly defined on a trait item (e.g., for chalk, but also for a few
other bits of code). For that, we define `predicates_defined_on`,
which does not contain the `Self: Foo` predicate yet, and we plumb
that through metadata and so forth.

---

I'm assigning @eddyb as the main reviewer, but I thought I might delegate to scalexm for this one in any case. I also want to post an alternative that I'll leave in the comments; it occurred to me as I was writing. =)

r? @eddyb
cc @scalexm @tmandry @leodasvacas
@tmandry tmandry added the WG-traits Working group: Traits, https://internals.rust-lang.org/t/announcing-traits-working-group/6804 label May 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-traits Working group: Traits, https://internals.rust-lang.org/t/announcing-traits-working-group/6804
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants