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

Wrap some query results in `Lrc`. #55778

Merged
merged 1 commit into from Nov 15, 2018

Conversation

Projects
None yet
6 participants
@nnethercote
Contributor

nnethercote commented Nov 8, 2018

So that the frequent clones in try_get are cheaper.

@rust-highfive

This comment has been minimized.

Collaborator

rust-highfive commented Nov 8, 2018

r? @varkor

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

@eddyb

This comment has been minimized.

Member

eddyb commented Nov 8, 2018

@rust-highfive rust-highfive assigned nikomatsakis and unassigned varkor Nov 8, 2018

} else {
tcx.predicates_of(def_id).predicates
tcx.predicates_of(def_id).predicates.clone()

This comment has been minimized.

@eddyb

eddyb Nov 8, 2018

Member

Unnecessary clone, can just keep the whole Lrc in the predicates variable and change the loop below.

This comment has been minimized.

@nnethercote

nnethercote Nov 8, 2018

Contributor

I tried and failed to do that. I can't use the Rc directly, because that would move it. I can't use a reference, because it doesn't live long enough.

This comment has been minimized.

@nnethercote

nnethercote Nov 8, 2018

Contributor

Ok, I worked out a different way to do it.

This comment has been minimized.

@eddyb

eddyb Nov 8, 2018

Member

I don't see any reason this can't work:

            let predicates = if def_id.is_local() {
                tcx.explicit_predicates_of(def_id)
            } else {
                tcx.predicates_of(def_id)
            };

Then you do predicates.predicates.iter() below instead of predicates.into_iter().

@@ -1794,7 +1795,7 @@ fn explicit_predicates_of<'a, 'tcx>(
// on a trait we need to add in the supertrait bounds and bounds found on
// associated types.
if let Some((_trait_ref, _)) = is_trait {
predicates.extend(tcx.super_predicates_of(def_id).predicates);
predicates.extend(tcx.super_predicates_of(def_id).predicates.iter().map(|p| *p));

This comment has been minimized.

@eddyb

eddyb Nov 8, 2018

Member

I think the .map(|p| *p) here and elsewhere could be replaced by .cloned().

This comment has been minimized.

@nnethercote

nnethercote Nov 8, 2018

Contributor

Won't that cause additional refcounting that the .map(|p| *p) won't?

This comment has been minimized.

@eddyb

eddyb Nov 8, 2018

Member

No, it does .map(|p| p.clone()) which is the same as .map(|p| *p) when the latter works because the latter only works when typeof(*p): Copy and Copy implies Clone is just a copy.

@@ -1112,8 +1112,8 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
{
let tcx = self.tcx();
let bounds = self.get_type_parameter_bounds(span, ty_param_def_id)
.predicates.into_iter().filter_map(|(p, _)| p.to_opt_poly_trait_ref());
let predicates = &self.get_type_parameter_bounds(span, ty_param_def_id).predicates;

This comment has been minimized.

@eddyb

eddyb Nov 8, 2018

Member

Hah, it's cool that this works! (I think it's a case of the generalization of let x = &f();)

let predicates = tcx.predicates_of(self.did).predicates;
if predicates.into_iter().any(|(p, _)| p == sized_predicate) {
let predicates = &tcx.predicates_of(self.did).predicates;
if predicates.into_iter().any(|(p, _)| *p == sized_predicate) {

This comment has been minimized.

@eddyb

eddyb Nov 8, 2018

Member

You changed into_iter to iter elsewhere, can you do it here too?

@@ -127,7 +127,7 @@ define_queries! { <'tcx>
/// predicate gets in the way of some checks, which are intended
/// to operate over only the actual where-clauses written by the
/// user.)
[] fn predicates_of: PredicatesOfItem(DefId) -> ty::GenericPredicates<'tcx>,
[] fn predicates_of: PredicatesOfItem(DefId) -> Lrc<ty::GenericPredicates<'tcx>>,

This comment has been minimized.

@eddyb

eddyb Nov 8, 2018

Member

Please also change predicates_defined_on and type_param_predicates.

@rust-highfive

This comment has been minimized.

Collaborator

rust-highfive commented Nov 8, 2018

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.
travis_time:end:09a8471e:start=1541664697556926973,finish=1541664750763816100,duration=53206889127
$ 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-5.0
---
[00:41:43]    Compiling parking_lot_core v0.3.0
[00:41:43]    Compiling tempfile v3.0.3
[00:41:44]    Compiling parking_lot v0.6.4
[00:41:45]    Compiling rustdoc v0.0.0 (/checkout/src/librustdoc)
[00:41:48] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::rc::Rc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:41:48]     --> librustdoc/clean/mod.rs:1981:69
[00:41:48]      |
[00:41:48] 1981 |                                 &cx.tcx.predicates_of(self.def_id)).clean(cx);
[00:41:48]      |
[00:41:48]      = help: items from traits can only be used if the trait is implemented and in scope
[00:41:48]      = help: items from traits can only be used if the trait is implemented and in scope
[00:41:48]      = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:41:48]              candidate #1: `clean::Clean`
[00:41:48] 
[00:41:48] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::rc::Rc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:41:48]     --> librustdoc/clean/mod.rs:2049:75
[00:41:48]      |
[00:41:48] 2049 |                     let generics = (cx.tcx.generics_of(did), &predicates).clean(cx);
[00:41:48]      |
[00:41:48]      = help: items from traits can only be used if the trait is implemented and in scope
[00:41:48]      = help: items from traits can only be used if the trait is implemented and in scope
[00:41:48]      = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:41:48]              candidate #1: `clean::Clean`
^^
[00:41:49]     |
[00:41:49]     = help: items from traits can only be used if the trait is implemented and in scope
[00:41:49]     = help: items from traits can only be used if the trait is implemented and in scope
[00:41:49]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:41:49]             candidate #1: `clean::Clean`
[00:41:49] 
[00:41:49] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::rc::Rc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:41:49]    --> librustdoc/clean/inline.rs:233:58
[00:41:49]     |
[00:41:49] 233 |         generics: (cx.tcx.generics_of(did), &predicates).clean(cx),
[00:41:49]     |
[00:41:49]     = help: items from traits can only be used if the trait is implemented and in scope
[00:41:49]     = help: items from traits can only be used if the trait is implemented and in scope
[00:41:49]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:41:49]             candidate #1: `clean::Clean`
[00:41:49] 
[00:41:49] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::rc::Rc<rustc::ty::GenericPredicates<'_>>)` in the curreemented and in scope
[00:41:49]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:41:49]             candidate #1: `clean::Clean`
[00:41:49] 
[00:41:49] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::rc::Rc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:41:49]    --> librustdoc/clean/inline.rs:272:58
[00:41:49]     |
[00:41:49] 272 |         generics: (cx.tcx.generics_of(did), &predicates).clean(cx),
[00:41:49]     |
[00:41:49]     = help: items from traits can only be used if the trait is implemented and in scope
[00:41:49]     = help: items from traits can only be used if the trait is implemented and in scope
[00:41:49]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:41:49]             candidate #1: `clean::Clean`
[00:41:49] 
[00:41:49] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::rc::Rc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:41:49]    --> librustdoc/clean/inline.rs:349:49
[00:41:49]     |
[00:41:49] 349 |             (tcx.generics_of(did), &predicates).clean(cx),
[00:41:49]     |
[00:41:49]     = help: items from traits can only be used if the trait is implemented and in scope
[00:41:49]     = help: items from traits can only be used if the trait is implemented and in scope
[00:41:49]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:41:49]             candidate #1: `clean::Clean`
[00:41:49] 
[00:41:49] error[E0277]: the size for values of type `[clean::Item]` cannot be known at compilation time
[00:41:49]    --> librustdoc/clean/inline.rs:328:10
[00:41:49]     |
[00:41:49] 328 |     let (trait_items, generics) = if let Some(nodeid) = tcx.hir.as_local_node_id(did) {
[00:41:49]     |
[00:41:49]     |
[00:41:49]     = help: the trait `std::marker::Sized` is not implemented for `[clean::Item]`
[00:41:49]     = note: all local variables must have a statically known size
[00:41:49]     = help: unsized locals are gated as an unstable feature
[00:41:49] 
[00:41:49] error[E0308]: mismatched types
[00:41:49] error[E0308]: mismatched types
[00:41:49]    --> librustdoc/clean/inline.rs:382:20
[00:41:49]     |
[00:41:49] 382 |             items: trait_items,
[00:41:49]     |                    ^^^^^^^^^^^
[00:41:49]     |                    |
[00:41:49]     |                    expected struct `std::vec::Vec`, found slice
[00:41:49]     |                    help: try using a conversion method: `trait_items.to_vec()`
[00:41:49]     |
[00:41:49]     = note: expected type `std::vec::Vec<clean::Item>`
[00:41:49]                found type `[clean::Item]`
[00:41:49] 
[00:41:49] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::rc::Rc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:41:49]    --> librustdoc/clean/auto_trait.rs:577:27
[00:41:49]     |
[00:41:49] 577 |         } = full_generics.clean(self.cx);
[00:41:49]     |
[00:41:49]     = help: items from traits can only be used if the trait is implemented and in scope
[00:41:49]     = help: items from traits can only be used if the trait is implemented and in scope
[00:41:49]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:41:49]             candidate #1: `clean::Clean`
[00:41:49] 
[00:41:49] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::rc::Rc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:41:49]    --> librustdoc/clean/blanket_impl.rs:158:69
[00:41:49]     |
[00:41:49] 158 |                                 generics: (t_generics, &predicates).clean(self.cx),
[00:41:49]     |
[00:41:49]     = help: items from traits can only be used if the trait is implemented and in scope
[00:41:49]     = help: items from traits can only be used if the trait is implemented and in scope
[00:41:49]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:41:49]             candidate #1: `clean::Clean`
73608919831,duration=525918928
travis_fold:end:after_failure.1
travis_fold:start:after_failure.2
travis_time:start:2454ae50
---
travis_time:end:01c2bf8f:start=1541667273625624969,finish=1541667273630198488,duration=4573519
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:034d09c0
$ 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:

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)

@nnethercote nnethercote force-pushed the nnethercote:LrcPreds branch from 62a7c38 to d98c0c9 Nov 9, 2018

@nnethercote

This comment has been minimized.

Contributor

nnethercote commented Nov 9, 2018

@eddyb: I've updated, addressing the comments, and converting the remaining GenericPredicates cases.

@rust-highfive

This comment has been minimized.

Collaborator

rust-highfive commented Nov 9, 2018

The job mingw-check 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:2d2cff9a:start=1541738235842135476,finish=1541738290292293505,duration=54450158029
$ 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=mingw-check
---
[00:07:30]     Checking parking_lot_core v0.3.0
[00:07:30]     Checking tempfile v3.0.3
[00:07:30]     Checking parking_lot v0.6.4
[00:07:31]     Checking rustdoc v0.0.0 (/checkout/src/librustdoc)
[00:07:33] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::sync::Arc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:07:33]     --> librustdoc/clean/mod.rs:1981:69
[00:07:33]      |
[00:07:33] 1981 |                                 &cx.tcx.predicates_of(self.def_id)).clean(cx);
[00:07:33]      |
[00:07:33]      = help: items from traits can only be used if the trait is implemented and in scope
[00:07:33]      = help: items from traits can only be used if the trait is implemented and in scope
[00:07:33]      = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:07:33]              candidate #1: `clean::Clean`
[00:07:33] 
[00:07:33] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::sync::Arc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:07:33]     --> librustdoc/clean/mod.rs:2049:75
[00:07:33]      |
[00:07:33] 2049 |                     let generics = (cx.tcx.generics_of(did), &predicates).clean(cx);
[00:07:33]      |
[00:07:33]      = help: items from traits can only be used if the trait is implemented and in scope
[00:07:33]      = help: items from traits can only be used if the trait is implemented and in scope
[00:07:33]      = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:07:33]              candidate #1: `clean::Clean`
[00:07:33] 
[00:07:33] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::sync::Arc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:07:33]    --> librustdoc/clean/inline.rs:191:59
[00:07:33]     |
[00:07:33] 191 |     let generics = (cx.tcx.generics_of(did), &predicates).clean(cx);
[00:07:33]     |
[00:07:33]     = help: items from traits can only be used if the trait is implemented and in scope
[00:07:33]     = help: items from traits can only be used if the trait is implemented and in scope
[00:07:33]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:07:33]             candidate #1: `clean::Clean`
[00:07:33] 
[00:07:33] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::sync::Arc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:07:33]    --> librustdoc/clean/inline.rs:219:58
[00:07:33]     |
[00:07:33] 219 |         generics: (cx.tcx.generics_of(did), &predicates).clean(cx),
[00:07:33]     |
[00:07:33]     = help: items from traits can only be used if the trait is implemented and in scope
[00:07:33]     = help: items from traits can only be used if the trait is implemented and in scope
[00:07:33]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:07:33]             candidate #1: `clean::Clean`
[00:07:33] 
[00:07:33] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::sync::Arc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:07:33]    --> librustdoc/clean/inline.rs:233:58
[00:07:33]     |
[00:07:33] 233 |         generics: (cx.tcx.generics_of(did), &predicates).clean(cx),
[00:07:33]     |
[00:07:33]     = help: items from traits can only be used if the trait is implemented and in scope
[00:07:33]     = help: items from traits can only be used if the trait is implemented and in scope
[00:07:33]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:07:33]             candidate #1: `clean::Clean`
[00:07:33] 
[00:07:33] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::sync::Arc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:07:33]    --> librustdoc/clean/inline.rs:249:58
[00:07:33]     |
[00:07:33] 249 |         generics: (cx.tcx.generics_of(did), &predicates).clean(cx),
[00:07:33]     |
[00:07:33]     = help: items from traits can only be used if the trait is implemented and in scope
[00:07:33]     = help: items from traits can only be used if the trait is implemented and in scope
[00:07:33]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:07:33]             candidate #1: `clean::Clean`
[00:07:33] 
[00:07:33] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::sync::Arc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:07:33]    --> librustdoc/clean/inline.rs:261:58
[00:07:33]     |
[00:07:33] 261 |         generics: (cx.tcx.generics_of(did), &predicates).clean(cx),
[00:07:33]     |
[00:07:33]     = help: items from traits can only be used if the trait is implemented and in scope
[00:07:33]     = help: items from traits can only be used if the trait is implemented and in scope
[00:07:33]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:07:33]             candidate #1: `clean::Clean`
[00:07:33] 
[00:07:33] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::sync::Arc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:07:33]    --> librustdoc/clean/inline.rs:272:58
[00:07:33]     |
[00:07:33] 272 |         generics: (cx.tcx.generics_of(did), &predicates).clean(cx),
[00:07:33]     |
[00:07:33]     = help: items from traits can only be used if the trait is implemented and in scope
[00:07:33]     = help: items from traits can only be used if the trait is implemented and in scope
[00:07:33]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:07:33]             candidate #1: `clean::Clean`
[00:07:33] 
[00:07:33] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::sync::Arc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:07:33]    --> librustdoc/clean/inline.rs:349:49
[00:07:33]     |
[00:07:33] 349 |             (tcx.generics_of(did), &predicates).clean(cx),
[00:07:33]     |
[00:07:33]     = help: items from traits can only be used if the trait is implemented and in scope
[00:07:33]     = help: items from traits can only be used if the trait is implemented and in scope
[00:07:33]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:07:33]             candidate #1: `clean::Clean`
[00:07:33] 
[00:07:33] error[E0277]: the size for values of type `[clean::Item]` cannot be known at compilation time
[00:07:33]    --> librustdoc/clean/inline.rs:328:10
[00:07:33]     |
[00:07:33] 328 |     let (trait_items, generics) = if let Some(nodeid) = tcx.hir.as_local_node_id(did) {
[00:07:33]     |
[00:07:33]     |
[00:07:33]     = help: the trait `std::marker::Sized` is not implemented for `[clean::Item]`
[00:07:33]     = note: all local variables must have a statically known size
[00:07:33]     = help: unsized locals are gated as an unstable feature
[00:07:33] 
[00:07:34] error[E0308]: mismatched types
[00:07:34] error[E0308]: mismatched types
[00:07:34]    --> librustdoc/clean/inline.rs:382:20
[00:07:34]     |
[00:07:34] 382 |             items: trait_items,
[00:07:34]     |                    ^^^^^^^^^^^
[00:07:34]     |                    |
[00:07:34]     |                    expected struct `std::vec::Vec`, found slice
[00:07:34]     |                    help: try using a conversion method: `trait_items.to_vec()`
[00:07:34]     |
[00:07:34]     = note: expected type `std::vec::Vec<clean::Item>`
[00:07:34]                found type `[clean::Item]`
[00:07:34] 
[00:07:34] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::sync::Arc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:07:34]    --> librustdoc/clean/auto_trait.rs:577:27
[00:07:34]     |
[00:07:34] 577 |         } = full_generics.clean(self.cx);
[00:07:34]     |
[00:07:34]     = help: items from traits can only be used if the trait is implemented and in scope
[00:07:34]     = help: items from traits can only be used if the trait is implemented and in scope
[00:07:34]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:07:34]             candidate #1: `clean::Clean`
[00:07:34] 
[00:07:34] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::sync::Arc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:07:34]    --> librustdoc/clean/blanket_impl.rs:158:69
[00:07:34]     |
[00:07:34] 158 |                                 generics: (t_generics, &predicates).clean(self.cx),
[00:07:34]     |
[00:07:34]     = help: items from traits can only be used if the trait is implemented and in scope
[00:07:34]     = help: items from traits can only be used if the trait is implemented and in scope
[00:07:34]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:07:34]             candidate #1: `clean::Clean`
[00:07:36] error: aborting due to 13 previous errors
[00:07:36] 
[00:07:36] Some errors occurred: E0277, E0308, E0599.
[00:07:36] For more information about an error, try `rustc --explain E0277`.
[00:07:36] For more information about an error, try `rustc --explain E0277`.
[00:07:36] error: Could not compile `rustdoc`.
[00:07:36] 
[00:07:36] To learn more, run the command again with --verbose.
[00:07:36] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "check" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--color" "always" "--manifest-path" "/checkout/src/tools/rustdoc/Cargo.toml" "--message-format" "json"
[00:07:36] expected success, got: exit code: 101
[00:07:36] thread 'main' panicked at 'cargo must succeed', bootstrap/compile.rs:1101:9
[00:07:36] travis_fold:end:stage0-rustdoc

[00:07:36] travis_time:end:stage0-rustdoc:start=1541738747093566655,finish=1541738756699158691,duration=9605592036

---
travis_time:end:03d93c1e:start=1541738757410500918,finish=1541738757414933064,duration=4432146
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:0735bc70
$ 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:04815e5e
travis_time:start:04815e5e
$ 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:06543366
$ 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)

parent: None,
predicates: vec![],
},
}),
|parent| {
let icx = ItemCtxt::new(tcx, parent);
icx.get_type_parameter_bounds(DUMMY_SP, def_id)

This comment has been minimized.

@eddyb

eddyb Nov 9, 2018

Member

If you clone the GenericPredicates here you don't need an extra variable.

@nikomatsakis

Seems fine, but maybe we could make it read a bit nicer? I've found that this use-case is very well handled by the make_mut family of functions; it might even be worth adding an extend or something that first invokes make_mut, so that we can just do predicates.extend(...) and make it just work. (Key thing would be to avoid doing anything if there are no items to extend with)

Thoughts?

icx.type_parameter_bounds_in_generics(ast_generics, param_id, ty, OnlySelfBounds(true)));
let mut preds = result.predicates.clone();
preds.extend(extra_preds);

This comment has been minimized.

@nikomatsakis

nikomatsakis Nov 12, 2018

Contributor

should we maybe check if extra_preds.is_empty and avoid the clone?

This comment has been minimized.

@nikomatsakis

nikomatsakis Nov 12, 2018

Contributor

I can't quite tell what the type of result is here though

This comment has been minimized.

@eddyb

eddyb Nov 12, 2018

Member

The correct solution is make_mut, IMO, as discussed on IRC.

let explicit = tcx.explicit_predicates_of(def_id);
let span = tcx.def_span(def_id);
let predicates = explicit.predicates.into_iter().chain(
let predicates = explicit.predicates.iter().cloned().chain(

This comment has been minimized.

@nikomatsakis

nikomatsakis Nov 12, 2018

Contributor

A lot of time, inferred_outlives_of will be empty -- maybe we should check for that?

If we added Lrc::make_mut, we could do:

let mut predicates = tcx.explicit_predicates_of(def_id);
let inferred_outlives = tcx.inferred_outlives_of(def_id);
if !inferred_outlives.is_empty() {
    let predicates = Lrc::make_mut(&mut predicates);
    predicates.predicates.extend(inferred_outlives.iter().map(|&p| (p, span)));
}

or something like that

let span = tcx.def_span(def_id);
predicates.push((ty::TraitRef::identity(tcx, def_id).to_predicate(), span));
}
preds.push((ty::TraitRef::identity(tcx, def_id).to_predicate(), span));

This comment has been minimized.

@nikomatsakis

nikomatsakis Nov 12, 2018

Contributor

Similarly here we could do this more elegant with make_mut I think

@nnethercote nnethercote force-pushed the nnethercote:LrcPreds branch from d98c0c9 to 7b25382 Nov 13, 2018

@nnethercote

This comment has been minimized.

Contributor

nnethercote commented Nov 13, 2018

I have updated the code to use make_mut in three functions. It's looking nicer, thank you for the suggestions.

r? @eddyb

@rust-highfive rust-highfive assigned eddyb and unassigned nikomatsakis Nov 13, 2018

@rust-highfive

This comment has been minimized.

Collaborator

rust-highfive commented Nov 13, 2018

The job mingw-check 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:1dad8e69:start=1542069042721364227,finish=1542069100510171992,duration=57788807765
$ 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=mingw-check
---
[00:07:01]     Checking parking_lot_core v0.3.0
[00:07:01]     Checking tempfile v3.0.3
[00:07:01]     Checking parking_lot v0.6.4
[00:07:02]     Checking rustdoc v0.0.0 (/checkout/src/librustdoc)
[00:07:04] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::sync::Arc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:07:04]     --> librustdoc/clean/mod.rs:1981:69
[00:07:04]      |
[00:07:04] 1981 |                                 &cx.tcx.predicates_of(self.def_id)).clean(cx);
[00:07:04]      |
[00:07:04]      = help: items from traits can only be used if the trait is implemented and in scope
[00:07:04]      = help: items from traits can only be used if the trait is implemented and in scope
[00:07:04]      = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:07:04]              candidate #1: `clean::Clean`
[00:07:04] 
[00:07:04] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::sync::Arc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:07:04]     --> librustdoc/clean/mod.rs:2049:75
[00:07:04]      |
[00:07:04] 2049 |                     let generics = (cx.tcx.generics_of(did), &predicates).clean(cx);
[00:07:04]      |
[00:07:04]      = help: items from traits can only be used if the trait is implemented and in scope
[00:07:04]      = help: items from traits can only be used if the trait is implemented and in scope
[00:07:04]      = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:07:04]              candidate #1: `clean::Clean`
[00:07:04] 
[00:07:04] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::sync::Arc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:07:04]    --> librustdoc/clean/inline.rs:191:59
[00:07:04]     |
[00:07:04] 191 |     let generics = (cx.tcx.generics_of(did), &predicates).clean(cx);
[00:07:04]     |
[00:07:04]     = help: items from traits can only be used if the trait is implemented and in scope
[00:07:04]     = help: items from traits can only be used if the trait is implemented and in scope
[00:07:04]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:07:04]             candidate #1: `clean::Clean`
[00:07:04] 
[00:07:04] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::sync::Arc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:07:04]    --> librustdoc/clean/inline.rs:219:58
[00:07:04]     |
[00:07:04] 219 |         generics: (cx.tcx.generics_of(did), &predicates).clean(cx),
[00:07:04]     |
[00:07:04]     = help: items from traits can only be used if the trait is implemented and in scope
[00:07:04]     = help: items from traits can only be used if the trait is implemented and in scope
[00:07:04]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:07:04]             candidate #1: `clean::Clean`
[00:07:04] 
[00:07:04] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::sync::Arc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:07:04]    --> librustdoc/clean/inline.rs:233:58
[00:07:04]     |
[00:07:04] 233 |         generics: (cx.tcx.generics_of(did), &predicates).clean(cx),
[00:07:04]     |
[00:07:04]     = help: items from traits can only be used if the trait is implemented and in scope
[00:07:04]     = help: items from traits can only be used if the trait is implemented and in scope
[00:07:04]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:07:04]             candidate #1: `clean::Clean`
[00:07:04] 
[00:07:04] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::sync::Arc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:07:04]    --> librustdoc/clean/inline.rs:249:58
[00:07:04]     |
[00:07:04] 249 |         generics: (cx.tcx.generics_of(did), &predicates).clean(cx),
[00:07:04]     |
[00:07:04]     = help: items from traits can only be used if the trait is implemented and in scope
[00:07:04]     = help: items from traits can only be used if the trait is implemented and in scope
[00:07:04]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:07:04]             candidate #1: `clean::Clean`
[00:07:04] 
[00:07:04] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::sync::Arc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:07:04]    --> librustdoc/clean/inline.rs:261:58
[00:07:04]     |
[00:07:04] 261 |         generics: (cx.tcx.generics_of(did), &predicates).clean(cx),
[00:07:04]     |
[00:07:04]     = help: items from traits can only be used if the trait is implemented and in scope
[00:07:04]     = help: items from traits can only be used if the trait is implemented and in scope
[00:07:04]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:07:04]             candidate #1: `clean::Clean`
[00:07:04] 
[00:07:04] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::sync::Arc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:07:04]    --> librustdoc/clean/inline.rs:272:58
[00:07:04]     |
[00:07:04] 272 |         generics: (cx.tcx.generics_of(did), &predicates).clean(cx),
[00:07:04]     |
[00:07:04]     = help: items from traits can only be used if the trait is implemented and in scope
[00:07:04]     = help: items from traits can only be used if the trait is implemented and in scope
[00:07:04]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:07:04]             candidate #1: `clean::Clean`
[00:07:04] 
[00:07:04] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::sync::Arc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:07:04]    --> librustdoc/clean/inline.rs:349:49
[00:07:04]     |
[00:07:04] 349 |             (tcx.generics_of(did), &predicates).clean(cx),
[00:07:04]     |
[00:07:04]     = help: items from traits can only be used if the trait is implemented and in scope
[00:07:04]     = help: items from traits can only be used if the trait is implemented and in scope
[00:07:04]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:07:04]             candidate #1: `clean::Clean`
[00:07:04] 
[00:07:04] error[E0277]: the size for values of type `[clean::Item]` cannot be known at compilation time
[00:07:04]    --> librustdoc/clean/inline.rs:328:10
[00:07:04]     |
[00:07:04] 328 |     let (trait_items, generics) = if let Some(nodeid) = tcx.hir.as_local_node_id(did) {
[00:07:04]     |
[00:07:04]     |
[00:07:04]     = help: the trait `std::marker::Sized` is not implemented for `[clean::Item]`
[00:07:04]     = note: all local variables must have a statically known size
[00:07:04]     = help: unsized locals are gated as an unstable feature
[00:07:04] 
[00:07:04] error[E0308]: mismatched types
[00:07:04] error[E0308]: mismatched types
[00:07:04]    --> librustdoc/clean/inline.rs:382:20
[00:07:04]     |
[00:07:04] 382 |             items: trait_items,
[00:07:04]     |                    ^^^^^^^^^^^
[00:07:04]     |                    |
[00:07:04]     |                    expected struct `std::vec::Vec`, found slice
[00:07:04]     |                    help: try using a conversion method: `trait_items.to_vec()`
[00:07:04]     |
[00:07:04]     = note: expected type `std::vec::Vec<clean::Item>`
[00:07:04]                found type `[clean::Item]`
[00:07:04] 
[00:07:05] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::sync::Arc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:07:05]    --> librustdoc/clean/auto_trait.rs:577:27
[00:07:05]     |
[00:07:05] 577 |         } = full_generics.clean(self.cx);
[00:07:05]     |
[00:07:05]     = help: items from traits can only be used if the trait is implemented and in scope
[00:07:05]     = help: items from traits can only be used if the trait is implemented and in scope
[00:07:05]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:07:05]             candidate #1: `clean::Clean`
[00:07:05] 
[00:07:05] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::sync::Arc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:07:05]    --> librustdoc/clean/blanket_impl.rs:158:69
[00:07:05]     |
[00:07:05] 158 |                                 generics: (t_generics, &predicates).clean(self.cx),
[00:07:05]     |
[00:07:05]     = help: items from traits can only be used if the trait is implemented and in scope
[00:07:05]     = help: items from traits can only be used if the trait is implemented and in scope
[00:07:05]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:07:05]             candidate #1: `clean::Clean`
[00:07:06] error: aborting due to 13 previous errors
[00:07:06] 
[00:07:06] Some errors occurred: E0277, E0308, E0599.
[00:07:06] For more information about an error, try `rustc --explain E0277`.
[00:07:06] For more information about an error, try `rustc --explain E0277`.
[00:07:06] error: Could not compile `rustdoc`.
[00:07:06] 
[00:07:06] To learn more, run the command again with --verbose.
[00:07:06] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "check" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--color" "always" "--manifest-path" "/checkout/src/tools/rustdoc/Cargo.toml" "--message-format" "json"
[00:07:06] expected success, got: exit code: 101
[00:07:06] thread 'main' panicked at 'cargo must succeed', bootstrap/compile.rs:1101:9
[00:07:06] travis_fold:end:stage0-rustdoc

[00:07:06] travis_time:end:stage0-rustdoc:start=1542069526863098628,finish=1542069535977155251,duration=9114056623

---
travis_time:end:0341ec0b:start=1542069536698251311,finish=1542069536703661699,duration=5410388
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:1ca64540
$ 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:1326a6b4
travis_time:start:1326a6b4
$ 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:0e5cdbba
$ 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)

@nnethercote

This comment has been minimized.

Contributor

nnethercote commented Nov 13, 2018

@bors try

@bors

This comment has been minimized.

Contributor

bors commented Nov 13, 2018

⌛️ Trying commit 7b25382 with merge 0efff4d...

bors added a commit that referenced this pull request Nov 13, 2018

Auto merge of #55778 - nnethercote:LrcPreds, r=<try>
Wrap some query results in `Lrc`.

So that the frequent clones in `try_get` are cheaper.
@bors

This comment has been minimized.

Contributor

bors commented Nov 13, 2018

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

Show resolved Hide resolved src/librustdoc/clean/mod.rs Outdated

@nnethercote nnethercote force-pushed the nnethercote:LrcPreds branch from 7b25382 to 6a52d8f Nov 13, 2018

@nnethercote

This comment has been minimized.

Contributor

nnethercote commented Nov 13, 2018

Updated to address the most recent comment.

@eddyb

eddyb approved these changes Nov 13, 2018

@rust-highfive

This comment has been minimized.

Collaborator

rust-highfive commented Nov 13, 2018

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.
travis_time:end:0faa3490:start=1542097378742963785,finish=1542097435815265325,duration=57072301540
$ 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-5.0
---
[00:40:40]    Compiling parking_lot_core v0.3.0
[00:40:40]    Compiling tempfile v3.0.3
[00:40:41]    Compiling parking_lot v0.6.4
[00:40:42]    Compiling rustdoc v0.0.0 (/checkout/src/librustdoc)
[00:40:45] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::rc::Rc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:40:45]     --> librustdoc/clean/mod.rs:1981:69
[00:40:45]      |
[00:40:45] 1981 |                                 &cx.tcx.predicates_of(self.def_id)).clean(cx);
[00:40:45]      |
[00:40:45]      = help: items from traits can only be used if the trait is implemented and in scope
[00:40:45]      = help: items from traits can only be used if the trait is implemented and in scope
[00:40:45]      = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:40:45]              candidate #1: `clean::Clean`
[00:40:45] 
[00:40:45] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::rc::Rc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:40:45]     --> librustdoc/clean/mod.rs:2049:75
[00:40:45]      |
[00:40:45] 2049 |                     let generics = (cx.tcx.generics_of(did), &predicates).clean(cx);
[00:40:45]      |
[00:40:45]      = help: items from traits can only be used if the trait is implemented and in scope
[00:40:45]      = help: items from traits can only be used if the trait is implemented and in scope
[00:40:45]      = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:40:45]              candidate #1: `clean::Clean`
[00:40:45] 
[00:40:46] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::rc::Rc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:40:46]    --> librustdoc/clean/inline.rs:191:59
[00:40:46]     |
[00:40:46] 191 |     let generics = (cx.tcx.generics_of(did), &predicates).clean(cx);
[00:40:46]     |
[00:40:46]     = help: items from traits can only be used if the trait is implemented and in scope
[00:40:46]     = help: items from traits can only be used if the trait is implemented and in scope
[00:40:46]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:40:46]             candidate #1: `clean::Clean`
[00:40:46] 
[00:40:46] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::rc::Rc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:40:46]    --> librustdoc/clean/inline.rs:219:58
[00:40:46]     |
[00:40:46] 219 |         generics: (cx.tcx.generics_of(did), &predicates).clean(cx),
[00:40:46]     |
[00:40:46]     = help: items from traits can only be used if the trait is implemented and in scope
[00:40:46]     = help: items from traits can only be used if the trait is implemented and in scope
[00:40:46]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:40:46]             candidate #1: `clean::Clean`
[00:40:46] 
[00:40:46] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::rc::Rc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:40:46]    --> librustdoc/clean/inline.rs:233:58
[00:40:46]     |
[00:40:46] 233 |         generics: (cx.tcx.generics_of(did), &predicates).clean(cx),
[00:40:46]     |
[00:40:46]     = help: items from traits can only be used if the trait is implemented and in scope
[00:40:46]     = help: items from traits can only be used if the trait is implemented and in scope
[00:40:46]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:40:46]             candidate #1: `clean::Clean`
[00:40:46] 
[00:40:46] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::rc::Rc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:40:46]    --> librustdoc/clean/inline.rs:249:58
[00:40:46]     |
[00:40:46] 249 |         generics: (cx.tcx.generics_of(did), &predicates).clean(cx),
[00:40:46]     |
[00:40:46]     = help: items from traits can only be used if the trait is implemented and in scope
[00:40:46]     = help: items from traits can only be used if the trait is implemented and in scope
[00:40:46]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:40:46]             candidate #1: `clean::Clean`
[00:40:46] 
[00:40:46] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::rc::Rc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:40:46]    --> librustdoc/clean/inline.rs:261:58
[00:40:46]     |
[00:40:46] 261 |         generics: (cx.tcx.generics_of(did), &predicates).clean(cx),
[00:40:46]     |
[00:40:46]     = help: items from traits can only be used if the trait is implemented and in scope
[00:40:46]     = help: items from traits can only be used if the trait is implemented and in scope
[00:40:46]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:40:46]             candidate #1: `clean::Clean`
[00:40:46] 
[00:40:46] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::rc::Rc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:40:46]    --> librustdoc/clean/inline.rs:272:58
[00:40:46]     |
[00:40:46] 272 |         generics: (cx.tcx.generics_of(did), &predicates).clean(cx),
[00:40:46]     |
[00:40:46]     = help: items from traits can only be used if the trait is implemented and in scope
[00:40:46]     = help: items from traits can only be used if the trait is implemented and in scope
[00:40:46]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:40:46]             candidate #1: `clean::Clean`
[00:40:46] 
[00:40:46] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::rc::Rc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:40:46]    --> librustdoc/clean/inline.rs:349:49
[00:40:46]     |
[00:40:46] 349 |             (tcx.generics_of(did), &predicates).clean(cx),
[00:40:46]     |
[00:40:46]     = help: items from traits can only be used if the trait is implemented and in scope
[00:40:46]     = help: items from traits can only be used if the trait is implemented and in scope
[00:40:46]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:40:46]             candidate #1: `clean::Clean`
[00:40:46] 
[00:40:46] error[E0277]: the size for values of type `[clean::Item]` cannot be known at compilation time
[00:40:46]    --> librustdoc/clean/inline.rs:328:10
[00:40:46]     |
[00:40:46] 328 |     let (trait_items, generics) = if let Some(nodeid) = tcx.hir.as_local_node_id(did) {
[00:40:46]     |
[00:40:46]     |
[00:40:46]     = help: the trait `std::marker::Sized` is not implemented for `[clean::Item]`
[00:40:46]     = note: all local variables must have a statically known size
[00:40:46]     = help: unsized locals are gated as an unstable feature
[00:40:46] 
[00:40:46] error[E0308]: mismatched types
[00:40:46] error[E0308]: mismatched types
[00:40:46]    --> librustdoc/clean/inline.rs:382:20
[00:40:46]     |
[00:40:46] 382 |             items: trait_items,
[00:40:46]     |                    ^^^^^^^^^^^
[00:40:46]     |                    |
[00:40:46]     |                    expected struct `std::vec::Vec`, found slice
[00:40:46]     |                    help: try using a conversion method: `trait_items.to_vec()`
[00:40:46]     |
[00:40:46]     = note: expected type `std::vec::Vec<clean::Item>`
[00:40:46]                found type `[clean::Item]`
[00:40:46] 
[00:40:46] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::rc::Rc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:40:46]    --> librustdoc/clean/auto_trait.rs:577:27
[00:40:46]     |
[00:40:46] 577 |         } = full_generics.clean(self.cx);
[00:40:46]     |
[00:40:46]     = help: items from traits can only be used if the trait is implemented and in scope
[00:40:46]     = help: items from traits can only be used if the trait is implemented and in scope
[00:40:46]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:40:46]             candidate #1: `clean::Clean`
[00:40:46] 
[00:40:46] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::rc::Rc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:40:46]    --> librustdoc/clean/blanket_impl.rs:158:69
[00:40:46]     |
[00:40:46] 158 |                                 generics: (t_generics, &predicates).clean(self.cx),
[00:40:46]     |
[00:40:46]     = help: items from traits can only be used if the trait is implemented and in scope
[00:40:46]     = help: items from traits can only be used if the trait is implemented and in scope
[00:40:46]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:40:46]             candidate #1: `clean::Clean`
3994148 .
1651492 ./obj
1651452 ./obj/build
1196984 ./.git
---
163296 ./.git/modules/src/tools/lldb/objects/pack
151412 ./src/tools/clang
150256 ./obj/build/bootstrap/debug/incremental
134668 ./obj/build/bootstrap/debug/incremental/bootstrap-zemjd6kcyh2u
134664 ./obj/build/bootstrap/debug/incremental/bootstrap-zemjd6kcyh2u/s-f6mlux815q-6qy1hk-2bn657r7yjulg
120932 ./obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu
120928 ./obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release
118732 ./obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps
111088 ./src/llvm/test/CodeGen
---
travis_time:end:0273ebf2:start=1542099896355549577,finish=1542099896364651722,duration=9102145
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:23af2580
$ 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:2edfd8f0
$ cat ./o

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

This comment has been minimized.

Contributor

bors commented Nov 13, 2018

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

@nnethercote nnethercote force-pushed the nnethercote:LrcPreds branch from 6a52d8f to 5ddf50d Nov 13, 2018

@nnethercote

This comment has been minimized.

Contributor

nnethercote commented Nov 13, 2018

I rebased and reinstated the Rc in clean/mod.rs because it was necessary for rustdoc builds and I thought it was better than adding * to 11 callsites.

@bors r=eddyb

@bors

This comment has been minimized.

Contributor

bors commented Nov 13, 2018

📌 Commit 5ddf50d has been approved by eddyb

@rust-highfive

This comment has been minimized.

Collaborator

rust-highfive commented Nov 13, 2018

The job mingw-check 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:09c06ae0:start=1542144737065003200,finish=1542144739396210925,duration=2331207725
$ 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=mingw-check
---
[00:06:54]     Checking parking_lot_core v0.3.0
[00:06:54]     Checking tempfile v3.0.3
[00:06:55]     Checking parking_lot v0.6.4
[00:06:55]     Checking rustdoc v0.0.0 (/checkout/src/librustdoc)
[00:06:57] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::sync::Arc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:06:57]     --> librustdoc/clean/mod.rs:1984:69
[00:06:57]      |
[00:06:57] 1984 |                                 &cx.tcx.predicates_of(self.def_id)).clean(cx);
[00:06:57]      |
[00:06:57]      = help: items from traits can only be used if the trait is implemented and in scope
[00:06:57]      = help: items from traits can only be used if the trait is implemented and in scope
[00:06:57]      = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:06:57]              candidate #1: `clean::Clean`
[00:06:57] 
[00:06:57] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::sync::Arc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:06:57]     --> librustdoc/clean/mod.rs:2052:75
[00:06:57]      |
[00:06:57] 2052 |                     let generics = (cx.tcx.generics_of(did), &predicates).clean(cx);
[00:06:57]      |
[00:06:57]      = help: items from traits can only be used if the trait is implemented and in scope
[00:06:57]      = help: items from traits can only be used if the trait is implemented and in scope
[00:06:57]      = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:06:57]              candidate #1: `clean::Clean`
[00:06:57] 
[00:06:57] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::sync::Arc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:06:57]    --> librustdoc/clean/inline.rs:191:59
[00:06:57]     |
[00:06:57] 191 |     let generics = (cx.tcx.generics_of(did), &predicates).clean(cx);
[00:06:57]     |
[00:06:57]     = help: items from traits can only be used if the trait is implemented and in scope
[00:06:57]     = help: items from traits can only be used if the trait is implemented and in scope
[00:06:57]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:06:57]             candidate #1: `clean::Clean`
[00:06:57] 
[00:06:57] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::sync::Arc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:06:57]    --> librustdoc/clean/inline.rs:219:58
[00:06:57]     |
[00:06:57] 219 |         generics: (cx.tcx.generics_of(did), &predicates).clean(cx),
[00:06:57]     |
[00:06:57]     = help: items from traits can only be used if the trait is implemented and in scope
[00:06:57]     = help: items from traits can only be used if the trait is implemented and in scope
[00:06:57]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:06:57]             candidate #1: `clean::Clean`
[00:06:57] 
[00:06:57] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::sync::Arc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:06:57]    --> librustdoc/clean/inline.rs:233:58
[00:06:57]     |
[00:06:57] 233 |         generics: (cx.tcx.generics_of(did), &predicates).clean(cx),
[00:06:57]     |
[00:06:57]     = help: items from traits can only be used if the trait is implemented and in scope
[00:06:57]     = help: items from traits can only be used if the trait is implemented and in scope
[00:06:57]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:06:57]             candidate #1: `clean::Clean`
[00:06:57] 
[00:06:57] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::sync::Arc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:06:57]    --> librustdoc/clean/inline.rs:249:58
[00:06:57]     |
[00:06:57] 249 |         generics: (cx.tcx.generics_of(did), &predicates).clean(cx),
[00:06:57]     |
[00:06:57]     = help: items from traits can only be used if the trait is implemented and in scope
[00:06:57]     = help: items from traits can only be used if the trait is implemented and in scope
[00:06:57]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:06:57]             candidate #1: `clean::Clean`
[00:06:57] 
[00:06:57] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::sync::Arc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:06:57]    --> librustdoc/clean/inline.rs:261:58
[00:06:57]     |
[00:06:57] 261 |         generics: (cx.tcx.generics_of(did), &predicates).clean(cx),
[00:06:57]     |
[00:06:57]     = help: items from traits can only be used if the trait is implemented and in scope
[00:06:57]     = help: items from traits can only be used if the trait is implemented and in scope
[00:06:57]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:06:57]             candidate #1: `clean::Clean`
[00:06:57] 
[00:06:57] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::sync::Arc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:06:57]    --> librustdoc/clean/inline.rs:272:58
[00:06:57]     |
[00:06:57] 272 |         generics: (cx.tcx.generics_of(did), &predicates).clean(cx),
[00:06:57]     |
[00:06:57]     = help: items from traits can only be used if the trait is implemented and in scope
[00:06:57]     = help: items from traits can only be used if the trait is implemented and in scope
[00:06:57]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:06:57]             candidate #1: `clean::Clean`
[00:06:57] 
[00:06:57] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::sync::Arc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:06:57]    --> librustdoc/clean/inline.rs:349:49
[00:06:57]     |
[00:06:57] 349 |             (tcx.generics_of(did), &predicates).clean(cx),
[00:06:57]     |
[00:06:57]     = help: items from traits can only be used if the trait is implemented and in scope
[00:06:57]     = help: items from traits can only be used if the trait is implemented and in scope
[00:06:57]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:06:57]             candidate #1: `clean::Clean`
[00:06:57] 
[00:06:57] error[E0277]: the size for values of type `[clean::Item]` cannot be known at compilation time
[00:06:57]    --> librustdoc/clean/inline.rs:328:10
[00:06:57]     |
[00:06:57] 328 |     let (trait_items, generics) = if let Some(nodeid) = tcx.hir.as_local_node_id(did) {
[00:06:57]     |
[00:06:57]     |
[00:06:57]     = help: the trait `std::marker::Sized` is not implemented for `[clean::Item]`
[00:06:57]     = note: all local variables must have a statically known size
[00:06:57]     = help: unsized locals are gated as an unstable feature
[00:06:57] 
[00:06:57] error[E0308]: mismatched types
[00:06:57] error[E0308]: mismatched types
[00:06:57]    --> librustdoc/clean/inline.rs:382:20
[00:06:57]     |
[00:06:57] 382 |             items: trait_items,
[00:06:57]     |                    ^^^^^^^^^^^
[00:06:57]     |                    |
[00:06:57]     |                    expected struct `std::vec::Vec`, found slice
[00:06:57]     |                    help: try using a conversion method: `trait_items.to_vec()`
[00:06:57]     |
[00:06:57]     = note: expected type `std::vec::Vec<clean::Item>`
[00:06:57]                found type `[clean::Item]`
[00:06:57] 
[00:06:58] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::sync::Arc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:06:58]    --> librustdoc/clean/auto_trait.rs:577:27
[00:06:58]     |
[00:06:58] 577 |         } = full_generics.clean(self.cx);
[00:06:58]     |
[00:06:58]     = help: items from traits can only be used if the trait is implemented and in scope
[00:06:58]     = help: items from traits can only be used if the trait is implemented and in scope
[00:06:58]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:06:58]             candidate #1: `clean::Clean`
[00:06:58] 
[00:06:58] error[E0599]: no method named `clean` found for type `(&rustc::ty::Generics, &std::sync::Arc<rustc::ty::GenericPredicates<'_>>)` in the current scope
[00:06:58]    --> librustdoc/clean/blanket_impl.rs:158:69
[00:06:58]     |
[00:06:58] 158 |                                 generics: (t_generics, &predicates).clean(self.cx),
[00:06:58]     |
[00:06:58]     = help: items from traits can only be used if the trait is implemented and in scope
[00:06:58]     = help: items from traits can only be used if the trait is implemented and in scope
[00:06:58]     = note: the following trait defines an item `clean`, perhaps you need to implement it:
[00:06:58]             candidate #1: `clean::Clean`
[00:06:59] error: aborting due to 13 previous errors
[00:06:59] 
[00:06:59] Some errors occurred: E0277, E0308, E0599.
[00:06:59] For more information about an error, try `rustc --explain E0277`.
[00:06:59] For more information about an error, try `rustc --explain E0277`.
[00:06:59] error: Could not compile `rustdoc`.
[00:06:59] 
[00:06:59] To learn more, run the command again with --verbose.
[00:06:59] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "check" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--color" "always" "--manifest-path" "/checkout/src/tools/rustdoc/Cargo.toml" "--message-format" "json"
[00:06:59] travis_fold:end:stage0-rustdoc

[00:06:59] travis_time:end:stage0-rustdoc:start=1542145158883809897,finish=1542145166934514893,duration=8050704996


[00:06:59] thread 'main' panicked at 'cargo must succeed', bootstrap/compile.rs:1101:9
[00:06:59] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap check
[00:06:59] Build completed unsuccessfully in 0:04:55
travis_time:end:0e46d803:start=1542144747404107435,finish=1542145167168883933,duration=419764776498
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 1.
---
travis_time:end:01ad7488:start=1542145167605219920,finish=1542145167609740192,duration=4520272
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:0a38c3cb
$ 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:014273af
travis_time:start:014273af
$ 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:32597eb9
$ 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)

Wrap some query results in `Lrc`.
So that the frequent clones in `try_get` are cheaper.

Fixes #54274.

@nnethercote nnethercote force-pushed the nnethercote:LrcPreds branch from 5ddf50d to 98dab33 Nov 14, 2018

@nnethercote

This comment has been minimized.

Contributor

nnethercote commented Nov 14, 2018

Oh, that Rc needs to be Lrc.

@bors r=eddyb

@bors

This comment has been minimized.

Contributor

bors commented Nov 14, 2018

📌 Commit 98dab33 has been approved by eddyb

pietroalbini added a commit to pietroalbini/rust that referenced this pull request Nov 15, 2018

Rollup merge of rust-lang#55778 - nnethercote:LrcPreds, r=eddyb
Wrap some query results in `Lrc`.

So that the frequent clones in `try_get` are cheaper.

bors added a commit that referenced this pull request Nov 15, 2018

Auto merge of #55974 - pietroalbini:rollup, r=pietroalbini
Rollup of 17 pull requests

Successful merges:

 - #55182 (Redox: Update to new changes)
 - #55211 (Add BufWriter::buffer method)
 - #55507 (Add link to std::mem::size_of to size_of intrinsic documentation)
 - #55530 (Speed up String::from_utf16)
 - #55556 (Use `Mmap` to open the rmeta file.)
 - #55622 (NetBSD: link libstd with librt in addition to libpthread)
 - #55750 (Make `NodeId` and `HirLocalId` `newtype_index`)
 - #55778 (Wrap some query results in `Lrc`.)
 - #55781 (More precise spans for temps and their drops)
 - #55785 (Add mem::forget_unsized() for forgetting unsized values)
 - #55852 (Rewrite `...` as `..=` as a `MachineApplicable` 2018 idiom lint)
 - #55865 (Unix RwLock: avoid racy access to write_locked)
 - #55901 (fix various typos in doc comments)
 - #55926 (Change sidebar selector to fix compatibility with docs.rs)
 - #55930 (A handful of hir tweaks)
 - #55932 (core/char: Speed up `to_digit()` for `radix <= 10`)
 - #55956 (add tests for some fixed ICEs)

Failed merges:

r? @ghost

@bors bors merged commit 98dab33 into rust-lang:master Nov 15, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@nnethercote nnethercote deleted the nnethercote:LrcPreds branch Nov 15, 2018

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