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

generalize impl trait to permit multiple lifetime bounds #61775

Conversation

@nikomatsakis
Copy link
Contributor

commented Jun 12, 2019

Generalizes the region solver to support "pick constraints". These have the form:

pick R0 from [R1..Rn]

where R1..Rn are called the "option regions". The idea is that R0 must be equal to some region in the set R1..Rn. These constraints are then used to handle cases like this:

fn foo<'a, 'b>(...) -> impl Trait<'a, 'b> { .. }

The problem here is that every region R in the hidden type must be equal to either 'a or 'b (or 'static) -- in the past, the only kinds of constraints we had were outlives constraints, and since 'a and 'b are unrelated, there was no outlives constraint we could issue that would enforce that (R: 'a and R: 'b are both too strict, for example). But now we can issue a pick constraint: pick R from ['a, 'b].

In general, solving pick constraints is tricky. We integrate them into the solver as follows. In general, during the propagation phase, we are monotonically growing a set of inference regions. To handle a case like pick R from [O...], where O... represents the option regions, we do the following:

  • Look for all the lower bounds of the region R -- that is, every region LB such that R: LB must hold.
  • Look for all the upper bounds of the region R -- that is, every region UB such that UB: R must hold.
  • Let the viable options be each option region O such that UB: O and O: LB for each UB, LB bound.
  • Find the minimal viable option M, where O: M holds for every option region O.

If there is such a minimal viable option, then we make R: M. (This may in turn influence other bits of inference.) If there is no minimal viable option, either because all options were eliminated or because none of the remaining options are minimal, we do nothing. Ultimately, if the pick constraint is not satisfied, an error is reported.

For this logic, we currently require that the option regions O are always lifetime parameters. To determine the bounds, we walk the various outlives edges that were otherwise introduced.

r? @matthewjasper
cc @cramertj

Fixes #56238

TODO:

  • Error messages include region variable info sometimes, how to fix?
  • Tests for bare existential type and other impl Trait usage
@nikomatsakis

This comment has been minimized.

Copy link
Contributor Author

commented Jun 12, 2019

One problem I realize I never solved: the error messages for display regions presently talk about the hidden region being a region variable... I'm not entirely sure how to do better there yet.

@nikomatsakis

This comment has been minimized.

Copy link
Contributor Author

commented Jun 12, 2019

Another problem: We need some tests for this in conjunction with impl Trait used in other locations.

@rust-highfive

This comment was marked as resolved.

Copy link
Collaborator

commented Jun 12, 2019

The job x86_64-gnu-llvm-6.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:end:1573ad64:start=1560354076917196095,finish=1560354079178142583,duration=2260946488
$ 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
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
$ export AWS_ACCESS_KEY_ID=AKIA46X5W6CZEJZ6XT55
---

[00:04:27] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:04:27] tidy error: /checkout/src/librustc_data_structures/graph/vec_graph/mod.rs: too many trailing newlines (2)
[00:04:27] tidy error: /checkout/src/librustc_mir/borrow_check/nll/pick_constraints.rs:1: TODO is deprecated; use FIXME
[00:04:27] tidy error: /checkout/src/librustc_mir/borrow_check/nll/region_infer/mod.rs:1488: TODO is deprecated; use FIXME
[00:04:27] tidy error: /checkout/src/librustc_mir/borrow_check/nll/region_infer/mod.rs:1495: line longer than 100 chars
[00:04:27] tidy error: /checkout/src/librustc_mir/borrow_check/nll/region_infer/mod.rs:1500: line longer than 100 chars
[00:04:27] tidy error: /checkout/src/librustc_mir/borrow_check/nll/region_infer/mod.rs:1507: XXX is deprecated; use FIXME
[00:04:27] tidy error: /checkout/src/librustc_mir/borrow_check/nll/type_check/mod.rs:2519: TODO is deprecated; use FIXME
[00:04:27] tidy error: /checkout/src/librustc/infer/canonical/mod.rs:310: line longer than 100 chars
[00:04:27] tidy error: /checkout/src/librustc/infer/region_constraints/mod.rs:976: line longer than 100 chars
[00:04:32] some tidy checks failed
[00:04:32] 
[00:04:32] 
[00:04:32] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor" "--quiet"
[00:04:32] 
[00:04:32] 
[00:04:32] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:04:32] Build completed unsuccessfully in 0:01:12
---
travis_time:end:0003d492:start=1560354364239362990,finish=1560354364244276019,duration=4913029
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:0216ec6a
$ 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:0e3d870f
travis_time:start:0e3d870f
$ 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:099dc04d
$ 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)

@bors

This comment was marked as resolved.

Copy link
Contributor

commented Jun 12, 2019

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

@rust-highfive

This comment was marked as resolved.

Copy link
Collaborator

commented Jun 12, 2019

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:04baf64a:start=1560354730290925912,finish=1560354732605148173,duration=2314222261
$ 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
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
$ export AWS_ACCESS_KEY_ID=AKIA46X5W6CZEJZ6XT55
---
[00:05:27]     Checking syntax_pos v0.0.0 (/checkout/src/libsyntax_pos)
[00:05:28]     Checking rustc_errors v0.0.0 (/checkout/src/librustc_errors)
[00:05:28]     Checking fmt_macros v0.0.0 (/checkout/src/libfmt_macros)
[00:06:20]     Checking syntax_ext v0.0.0 (/checkout/src/libsyntax_ext)
[00:06:37] error[E0277]: `std::rc::Rc<std::vec::Vec<&ty::sty::RegionKind>>` cannot be shared between threads safely
[00:06:37]      |
[00:06:37] 1500 |     join(|| {
[00:06:37] 1500 |     join(|| {
[00:06:37]      |     ^^^^ `std::rc::Rc<std::vec::Vec<&ty::sty::RegionKind>>` cannot be shared between threads safely
[00:06:37]      |
[00:06:37]      = help: within `infer::region_constraints::PickConstraint<'_>`, the trait `std::marker::Sync` is not implemented for `std::rc::Rc<std::vec::Vec<&ty::sty::RegionKind>>`
[00:06:37]      = note: required because it appears within the type `infer::region_constraints::PickConstraint<'_>`
[00:06:37]      = note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<infer::region_constraints::PickConstraint<'_>>`
[00:06:37]      = note: required because it appears within the type `alloc::raw_vec::RawVec<infer::region_constraints::PickConstraint<'_>>`
[00:06:37]      = note: required because it appears within the type `std::vec::Vec<infer::region_constraints::PickConstraint<'_>>`
[00:06:37]      = note: required because it appears within the type `infer::canonical::QueryRegionConstraints<'_>`
[00:06:37]      = note: required because it appears within the type `infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>`
[00:06:37]      = note: required because it appears within the type `infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>`
[00:06:37]      = note: required because of the requirements on the impl of `std::marker::Send` for `&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>`
[00:06:37]      = note: required because it appears within the type `std::result::Result<&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>, traits::query::NoSolution>`
[00:06:37]      = note: required because it appears within the type `ty::query::plumbing::QueryValue<std::result::Result<&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>, traits::query::NoSolution>>`
[00:06:37]      = note: required because it appears within the type `(infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, ty::sty::ProjectionTy<'_>>>, ty::query::plumbing::QueryValue<std::result::Result<&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>, traits::query::NoSolution>>)`
[00:06:37]      = note: required because of the requirements on the impl of `std::marker::Send` for `hashbrown::raw::RawTable<(infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, ty::sty::ProjectionTy<'_>>>, ty::query::plumbing::QueryValue<std::result::Result<&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>, traits::query::NoSolution>>)>`
[00:06:37]      = note: required because it appears within the type `hashbrown::map::HashMap<infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, ty::sty::ProjectionTy<'_>>>, ty::query::plumbing::QueryValue<std::result::Result<&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>, traits::query::NoSolution>>, std::hash::BuildHasherDefault<rustc_data_structures::fx::FxHasher>>`
[00:06:37]      = note: required because it appears within the type `std::collections::HashMap<infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, ty::sty::ProjectionTy<'_>>>, ty::query::plumbing::QueryValue<std::result::Result<&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>, traits::query::NoSolution>>, std::hash::BuildHasherDefault<rustc_data_structures::fx::FxHasher>>`
[00:06:37]      = note: required because it appears within the type `ty::query::plumbing::QueryCache<'tcx, ty::query::queries::normalize_projection_ty<'tcx>>`
[00:06:37]      = note: required because of the requirements on the impl of `std::marker::Sync` for `lock_api::mutex::Mutex<parking_lot::raw_mutex::RawMutex, ty::query::plumbing::QueryCache<'tcx, ty::query::queries::normalize_projection_ty<'tcx>>>`
[00:06:37]      = note: required because it appears within the type `rustc_data_structures::sync::Lock<ty::query::plumbing::QueryCache<'tcx, ty::query::queries::normalize_projection_ty<'tcx>>>`
[00:06:37]      = note: required because it appears within the type `ty::query::Queries<'tcx>`
[00:06:37]      = note: required because it appears within the type `ty::context::GlobalCtxt<'tcx>`
[00:06:37]      = note: required because it appears within the type `&'tcx ty::context::GlobalCtxt<'tcx>`
[00:06:37]      = note: required because it appears within the type `ty::context::TyCtxt<'_, 'tcx, '_>`
[00:06:37]      = note: required because of the requirements on the impl of `std::marker::Send` for `&ty::context::TyCtxt<'_, 'tcx, '_>`
[00:06:37]      = note: required because it appears within the type `[closure@src/librustc/lint/context.rs:1500:10: 1505:6 tcx:&ty::context::TyCtxt<'_, 'tcx, '_>, builtin_lints:impl FnOnce() -> T + Send]`
[00:06:37]      = note: required by `rustc_rayon_core::join::join`
[00:06:37] 
[00:06:37] error[E0277]: `std::rc::Rc<std::vec::Vec<&ty::sty::RegionKind>>` cannot be sent between threads safely
[00:06:37]      |
[00:06:37] 1500 |     join(|| {
[00:06:37] 1500 |     join(|| {
[00:06:37]      |     ^^^^ `std::rc::Rc<std::vec::Vec<&ty::sty::RegionKind>>` cannot be sent between threads safely
[00:06:37]      |
[00:06:37]      = help: within `infer::region_constraints::PickConstraint<'_>`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<std::vec::Vec<&ty::sty::RegionKind>>`
[00:06:37]      = note: required because it appears within the type `infer::region_constraints::PickConstraint<'_>`
[00:06:37]      = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<infer::region_constraints::PickConstraint<'_>>`
[00:06:37]      = note: required because it appears within the type `alloc::raw_vec::RawVec<infer::region_constraints::PickConstraint<'_>>`
[00:06:37]      = note: required because it appears within the type `std::vec::Vec<infer::region_constraints::PickConstraint<'_>>`
[00:06:37]      = note: required because it appears within the type `infer::canonical::QueryRegionConstraints<'_>`
[00:06:37]      = note: required because it appears within the type `infer::canonical::QueryResponse<'_, &ty::TyS<'_>>`
[00:06:37]      = note: required because it appears within the type `infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, &ty::TyS<'_>>>`
[00:06:37]      = note: required because it appears within the type `traits::query::method_autoderef::MethodAutoderefBadTy<'_>`
[00:06:37]      = note: required because of the requirements on the impl of `std::marker::Send` for `std::sync::Arc<traits::query::method_autoderef::MethodAutoderefBadTy<'_>>`
[00:06:37]      = note: required because it appears within the type `std::option::Option<std::sync::Arc<traits::query::method_autoderef::MethodAutoderefBadTy<'_>>>`
[00:06:37]      = note: required because it appears within the type `traits::query::method_autoderef::MethodAutoderefStepsResult<'_>`
[00:06:37]      = note: required because it appears within the type `ty::query::plumbing::QueryValue<traits::query::method_autoderef::MethodAutoderefStepsResult<'_>>`
[00:06:37]      = note: required because it appears within the type `(infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, &ty::TyS<'_>>>, ty::query::plumbing::QueryValue<traits::query::method_autoderef::MethodAutoderefStepsResult<'_>>)`
[00:06:37]      = note: required because of the requirements on the impl of `std::marker::Send` for `hashbrown::raw::RawTable<(infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, &ty::TyS<'_>>>, ty::query::plumbing::QueryValue<traits::query::method_autoderef::MethodAutoderefStepsResult<'_>>)>`
[00:06:37]      = note: required because it appears within the type `hashbrown::map::HashMap<infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, &ty::TyS<'_>>>, ty::query::plumbing::QueryValue<traits::query::method_autoderef::MethodAutoderefStepsResult<'_>>, std::hash::BuildHasherDefault<rustc_data_structures::fx::FxHasher>>`
[00:06:37]      = note: required because it appears within the type `std::collections::HashMap<infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, &ty::TyS<'_>>>, ty::query::plumbing::QueryValue<traits::query::method_autoderef::MethodAutoderefStepsResult<'_>>, std::hash::BuildHasherDefault<rustc_data_structures::fx::FxHasher>>`
[00:06:37]      = note: required because it appears within the type `ty::query::plumbing::QueryCache<'tcx, ty::query::queries::method_autoderef_steps<'tcx>>`
[00:06:37]      = note: required because of the requirements on the impl of `std::marker::Sync` for `lock_api::mutex::Mutex<parking_lot::raw_mutex::RawMutex, ty::query::plumbing::QueryCache<'tcx, ty::query::queries::method_autoderef_steps<'tcx>>>`
[00:06:37]      = note: required because it appears within the type `rustc_data_structures::sync::Lock<ty::query::plumbing::QueryCache<'tcx, ty::query::queries::method_autoderef_steps<'tcx>>>`
[00:06:37]      = note: required because it appears within the type `ty::query::Queries<'tcx>`
[00:06:37]      = note: required because it appears within the type `ty::context::GlobalCtxt<'tcx>`
[00:06:37]      = note: required because it appears within the type `&'tcx ty::context::GlobalCtxt<'tcx>`
[00:06:37]      = note: required because it appears within the type `ty::context::TyCtxt<'_, 'tcx, '_>`
[00:06:37]      = note: required because of the requirements on the impl of `std::marker::Send` for `&ty::context::TyCtxt<'_, 'tcx, '_>`
[00:06:37]      = note: required because it appears within the type `[closure@src/librustc/lint/context.rs:1500:10: 1505:6 tcx:&ty::context::TyCtxt<'_, 'tcx, '_>, builtin_lints:impl FnOnce() -> T + Send]`
[00:06:37]      = note: required by `rustc_rayon_core::join::join`
[00:06:37] 
[00:06:42] error[E0277]: `std::rc::Rc<std::vec::Vec<&ty::sty::RegionKind>>` cannot be shared between threads safely
[00:06:42]      |
[00:06:42]      |
[00:06:42] 2776 |         par_iter(&self.hir().krate().body_ids).for_each(|&body_id| {
[00:06:42]      |                                                ^^^^^^^^ `std::rc::Rc<std::vec::Vec<&ty::sty::RegionKind>>` cannot be shared between threads safely
[00:06:42]      |
[00:06:42]      = help: within `infer::region_constraints::PickConstraint<'_>`, the trait `std::marker::Sync` is not implemented for `std::rc::Rc<std::vec::Vec<&ty::sty::RegionKind>>`
[00:06:42]      = note: required because it appears within the type `infer::region_constraints::PickConstraint<'_>`
[00:06:42]      = note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<infer::region_constraints::PickConstraint<'_>>`
[00:06:42]      = note: required because it appears within the type `alloc::raw_vec::RawVec<infer::region_constraints::PickConstraint<'_>>`
[00:06:42]      = note: required because it appears within the type `std::vec::Vec<infer::region_constraints::PickConstraint<'_>>`
[00:06:42]      = note: required because it appears within the type `infer::canonical::QueryRegionConstraints<'_>`
[00:06:42]      = note: required because it appears within the type `infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>`
[00:06:42]      = note: required because it appears within the type `infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>`
[00:06:42]      = note: required because of the requirements on the impl of `std::marker::Send` for `&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>`
[00:06:42]      = note: required because it appears within the type `std::result::Result<&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>, traits::query::NoSolution>`
[00:06:42]      = note: required because it appears within the type `ty::query::plumbing::QueryValue<std::result::Result<&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>, traits::query::NoSolution>>`
[00:06:42]      = note: required because it appears within the type `(infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, ty::sty::ProjectionTy<'_>>>, ty::query::plumbing::QueryValue<std::result::Result<&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>, traits::query::NoSolution>>)`
[00:06:42]      = note: required because of the requirements on the impl of `std::marker::Send` for `hashbrown::raw::RawTable<(infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, ty::sty::ProjectionTy<'_>>>, ty::query::plumbing::QueryValue<std::result::Result<&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>, traits::query::NoSolution>>)>`
[00:06:42]      = note: required because it appears within the type `hashbrown::map::HashMap<infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, ty::sty::ProjectionTy<'_>>>, ty::query::plumbing::QueryValue<std::result::Result<&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>, traits::query::NoSolution>>, std::hash::BuildHasherDefault<rustc_data_structures::fx::FxHasher>>`
[00:06:42]      = note: required because it appears within the type `std::collections::HashMap<infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, ty::sty::ProjectionTy<'_>>>, ty::query::plumbing::QueryValue<std::result::Result<&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>, traits::query::NoSolution>>, std::hash::BuildHasherDefault<rustc_data_structures::fx::FxHasher>>`
[00:06:42]      = note: required because it appears within the type `ty::query::plumbing::QueryCache<'gcx, ty::query::queries::normalize_projection_ty<'gcx>>`
[00:06:42]      = note: required because of the requirements on the impl of `std::marker::Sync` for `lock_api::mutex::Mutex<parking_lot::raw_mutex::RawMutex, ty::query::plumbing::QueryCache<'gcx, ty::query::queries::normalize_projection_ty<'gcx>>>`
[00:06:42]      = note: required because it appears within the type `rustc_data_structures::sync::Lock<ty::query::plumbing::QueryCache<'gcx, ty::query::queries::normalize_projection_ty<'gcx>>>`
[00:06:42]      = note: required because it appears within the type `ty::query::Queries<'gcx>`
[00:06:42]      = note: required because it appears within the type `ty::context::GlobalCtxt<'gcx>`
[00:06:42]      = note: required because it appears within the type `&'gcx ty::context::GlobalCtxt<'gcx>`
[00:06:42]      = note: required because it appears within the type `ty::context::TyCtxt<'_, 'gcx, '_>`
[00:06:42]      = note: required because it appears within the type `&ty::context::TyCtxt<'_, 'gcx, '_>`
[00:06:42]      = note: required because it appears within the type `[closure@src/librustc/ty/mod.rs:2776:57: 2778:10 f:&F, self:&ty::context::TyCtxt<'_, 'gcx, '_>]`
[00:06:42] 
[00:06:42] error[E0277]: `std::rc::Rc<std::vec::Vec<&ty::sty::RegionKind>>` cannot be sent between threads safely
[00:06:42]      |
[00:06:42]      |
[00:06:42] 2776 |         par_iter(&self.hir().krate().body_ids).for_each(|&body_id| {
[00:06:42]      |                                                ^^^^^^^^ `std::rc::Rc<std::vec::Vec<&ty::sty::RegionKind>>` cannot be sent between threads safely
[00:06:42]      |
[00:06:42]      = help: within `infer::region_constraints::PickConstraint<'_>`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<std::vec::Vec<&ty::sty::RegionKind>>`
[00:06:42]      = note: required because it appears within the type `infer::region_constraints::PickConstraint<'_>`
[00:06:42]      = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<infer::region_constraints::PickConstraint<'_>>`
[00:06:42]      = note: required because it appears within the type `alloc::raw_vec::RawVec<infer::region_constraints::PickConstraint<'_>>`
[00:06:42]      = note: required because it appears within the type `std::vec::Vec<infer::region_constraints::PickConstraint<'_>>`
[00:06:42]      = note: required because it appears within the type `infer::canonical::QueryRegionConstraints<'_>`
[00:06:42]      = note: required because it appears within the type `infer::canonical::QueryResponse<'_, &ty::TyS<'_>>`
[00:06:42]      = note: required because it appears within the type `infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, &ty::TyS<'_>>>`
[00:06:42]      = note: required because it appears within the type `traits::query::method_autoderef::MethodAutoderefBadTy<'_>`
[00:06:42]      = note: required because of the requirements on the impl of `std::marker::Send` for `std::sync::Arc<traits::query::method_autoderef::MethodAutoderefBadTy<'_>>`
[00:06:42]      = note: required because it appears within the type `std::option::Option<std::sync::Arc<traits::query::method_autoderef::MethodAutoderefBadTy<'_>>>`
[00:06:42]      = note: required because it appears within the type `traits::query::method_autoderef::MethodAutoderefStepsResult<'_>`
[00:06:42]      = note: required because it appears within the type `ty::query::plumbing::QueryValue<traits::query::method_autoderef::MethodAutoderefStepsResult<'_>>`
[00:06:42]      = note: required because it appears within the type `(infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, &ty::TyS<'_>>>, ty::query::plumbing::QueryValue<traits::query::method_autoderef::MethodAutoderefStepsResult<'_>>)`
[00:06:42]      = note: required because of the requirements on the impl of `std::marker::Send` for `hashbrown::raw::RawTable<(infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, &ty::TyS<'_>>>, ty::query::plumbing::QueryValue<traits::query::method_autoderef::MethodAutoderefStepsResult<'_>>)>`
[00:06:42]      = note: required because it appears within the type `hashbrown::map::HashMap<infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, &ty::TyS<'_>>>, ty::query::plumbing::QueryValue<traits::query::method_autoderef::MethodAutoderefStepsResult<'_>>, std::hash::BuildHasherDefault<rustc_data_structures::fx::FxHasher>>`
[00:06:42]      = note: required because it appears within the type `std::collections::HashMap<infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, &ty::TyS<'_>>>, ty::query::plumbing::QueryValue<traits::query::method_autoderef::MethodAutoderefStepsResult<'_>>, std::hash::BuildHasherDefault<rustc_data_structures::fx::FxHasher>>`
[00:06:42]      = note: required because it appears within the type `ty::query::plumbing::QueryCache<'gcx, ty::query::queries::method_autoderef_steps<'gcx>>`
[00:06:42]      = note: required because of the requirements on the impl of `std::marker::Sync` for `lock_api::mutex::Mutex<parking_lot::raw_mutex::RawMutex, ty::query::plumbing::QueryCache<'gcx, ty::query::queries::method_autoderef_steps<'gcx>>>`
[00:06:42]      = note: required because it appears within the type `rustc_data_structures::sync::Lock<ty::query::plumbing::QueryCache<'gcx, ty::query::queries::method_autoderef_steps<'gcx>>>`
[00:06:42]      = note: required because it appears within the type `ty::query::Queries<'gcx>`
[00:06:42]      = note: required because it appears within the type `ty::context::GlobalCtxt<'gcx>`
[00:06:42]      = note: required because it appears within the type `&'gcx ty::context::GlobalCtxt<'gcx>`
[00:06:42]      = note: required because it appears within the type `ty::context::TyCtxt<'_, 'gcx, '_>`
[00:06:42]      = note: required because it appears within the type `&ty::context::TyCtxt<'_, 'gcx, '_>`
[00:06:42]      = note: required because it appears within the type `[closure@src/librustc/ty/mod.rs:2776:57: 2778:10 f:&F, self:&ty::context::TyCtxt<'_, 'gcx, '_>]`
[00:06:42] 
[00:06:45] error[E0277]: `std::rc::Rc<std::vec::Vec<&ty::sty::RegionKind>>` cannot be shared between threads safely
[00:06:45]     --> src/librustc/ty/context.rs:2012:13
[00:06:45]      |
[00:06:45] 2012 |             sync::assert_sync::<ImplicitCtxt<'_, '_, '_>>();
[00:06:45]      |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::rc::Rc<std::vec::Vec<&ty::sty::RegionKind>>` cannot be shared between threads safely
[00:06:45]      |
[00:06:45]      = help: within `infer::region_constraints::PickConstraint<'_>`, the trait `std::marker::Sync` is not implemented for `std::rc::Rc<std::vec::Vec<&ty::sty::RegionKind>>`
[00:06:45]      = note: required because it appears within the type `infer::region_constraints::PickConstraint<'_>`
[00:06:45]      = note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<infer::region_constraints::PickConstraint<'_>>`
[00:06:45]      = note: required because it appears within the type `alloc::raw_vec::RawVec<infer::region_constraints::PickConstraint<'_>>`
[00:06:45]      = note: required because it appears within the type `std::vec::Vec<infer::region_constraints::PickConstraint<'_>>`
[00:06:45]      = note: required because it appears within the type `infer::canonical::QueryRegionConstraints<'_>`
[00:06:45]      = note: required because it appears within the type `infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>`
[00:06:45]      = note: required because it appears within the type `infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>`
[00:06:45]      = note: required because of the requirements on the impl of `std::marker::Send` for `&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>`
[00:06:45]      = note: required because it appears within the type `std::result::Result<&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>, traits::query::NoSolution>`
[00:06:45]      = note: required because it appears within the type `ty::query::plumbing::QueryValue<std::result::Result<&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>, traits::query::NoSolution>>`
[00:06:45]      = note: required because it appears within the type `(infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, ty::sty::ProjectionTy<'_>>>, ty::query::plumbing::QueryValue<std::result::Result<&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>, traits::query::NoSolution>>)`
[00:06:45]      = note: required because of the requirements on the impl of `std::marker::Send` for `hashbrown::raw::RawTable<(infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, ty::sty::ProjectionTy<'_>>>, ty::query::plumbing::QueryValue<std::result::Result<&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>, traits::query::NoSolution>>)>`
[00:06:45]      = note: required because it appears within the type `hashbrown::map::HashMap<infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, ty::sty::ProjectionTy<'_>>>, ty::query::plumbing::QueryValue<std::result::Result<&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>, traits::query::NoSolution>>, std::hash::BuildHasherDefault<rustc_data_structures::fx::FxHasher>>`
[00:06:45]      = note: required because it appears within the type `std::collections::HashMap<infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, ty::sty::ProjectionTy<'_>>>, ty::query::plumbing::QueryValue<std::result::Result<&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>, traits::query::NoSolution>>, std::hash::BuildHasherDefault<rustc_data_structures::fx::FxHasher>>`
[00:06:45]      = note: required because it appears within the type `ty::query::plumbing::QueryCache<'_, ty::query::queries::normalize_projection_ty<'_>>`
[00:06:45]      = note: required because of the requirements on the impl of `std::marker::Sync` for `lock_api::mutex::Mutex<parking_lot::raw_mutex::RawMutex, ty::query::plumbing::QueryCache<'_, ty::query::queries::normalize_projection_ty<'_>>>`
[00:06:45]      = note: required because it appears within the type `rustc_data_structures::sync::Lock<ty::query::plumbing::QueryCache<'_, ty::query::queries::normalize_projection_ty<'_>>>`
[00:06:45]      = note: required because it appears within the type `ty::query::Queries<'_>`
[00:06:45]      = note: required because it appears within the type `ty::context::GlobalCtxt<'_>`
[00:06:45]      = note: required because it appears within the type `&ty::context::GlobalCtxt<'_>`
[00:06:45]      = note: required because it appears within the type `ty::context::TyCtxt<'_, '_, '_>`
[00:06:45]      = note: required because it appears within the type `ty::context::tls::ImplicitCtxt<'_, '_, '_>`
[00:06:45]      = note: required by `rustc_data_structures::sync::assert_sync`
[00:06:45] 
[00:06:45] error[E0277]: `std::rc::Rc<std::vec::Vec<&ty::sty::RegionKind>>` cannot be sent between threads safely
[00:06:45]     --> src/librustc/ty/context.rs:2012:13
[00:06:45]      |
[00:06:45] 2012 |             sync::assert_sync::<ImplicitCtxt<'_, '_, '_>>();
[00:06:45]      |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::rc::Rc<std::vec::Vec<&ty::sty::RegionKind>>` cannot be sent between threads safely
[00:06:45]      |
[00:06:45]      = help: within `infer::region_constraints::PickConstraint<'_>`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<std::vec::Vec<&ty::sty::RegionKind>>`
[00:06:45]      = note: required because it appears within the type `infer::region_constraints::PickConstraint<'_>`
[00:06:45]      = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<infer::region_constraints::PickConstraint<'_>>`
[00:06:45]      = note: required because it appears within the type `alloc::raw_vec::RawVec<infer::region_constraints::PickConstraint<'_>>`
[00:06:45]      = note: required because it appears within the type `std::vec::Vec<infer::region_constraints::PickConstraint<'_>>`
[00:06:45]      = note: required because it appears within the type `infer::canonical::QueryRegionConstraints<'_>`
[00:06:45]      = note: required because it appears within the type `infer::canonical::QueryResponse<'_, &ty::TyS<'_>>`
[00:06:45]      = note: required because it appears within the type `infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, &ty::TyS<'_>>>`
[00:06:45]      = note: required because it appears within the type `traits::query::method_autoderef::MethodAutoderefBadTy<'_>`
[00:06:45]      = note: required because of the requirements on the impl of `std::marker::Send` for `std::sync::Arc<traits::query::method_autoderef::MethodAutoderefBadTy<'_>>`
[00:06:45]      = note: required because it appears within the type `std::option::Option<std::sync::Arc<traits::query::method_autoderef::MethodAutoderefBadTy<'_>>>`
[00:06:45]      = note: required because it appears within the type `traits::query::method_autoderef::MethodAutoderefStepsResult<'_>`
[00:06:45]      = note: required because it appears within the type `ty::query::plumbing::QueryValue<traits::query::method_autoderef::MethodAutoderefStepsResult<'_>>`
[00:06:45]      = note: required because it appears within the type `(infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, &ty::TyS<'_>>>, ty::query::plumbing::QueryValue<traits::query::method_autoderef::MethodAutoderefStepsResult<'_>>)`
[00:06:45]      = note: required because of the requirements on the impl of `std::marker::Send` for `hashbrown::raw::RawTable<(infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, &ty::TyS<'_>>>, ty::query::plumbing::QueryValue<traits::query::method_autoderef::MethodAutoderefStepsResult<'_>>)>`
[00:06:45]      = note: required because it appears within the type `hashbrown::map::HashMap<infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, &ty::TyS<'_>>>, ty::query::plumbing::QueryValue<traits::query::method_autoderef::MethodAutoderefStepsResult<'_>>, std::hash::BuildHasherDefault<rustc_data_structures::fx::FxHasher>>`
[00:06:45]      = note: required because it appears within the type `std::collections::HashMap<infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, &ty::TyS<'_>>>, ty::query::plumbing::QueryValue<traits::query::method_autoderef::MethodAutoderefStepsResult<'_>>, std::hash::BuildHasherDefault<rustc_data_structures::fx::FxHasher>>`
[00:06:45]      = note: required because it appears within the type `ty::query::plumbing::QueryCache<'_, ty::query::queries::method_autoderef_steps<'_>>`
[00:06:45]      = note: required because of the requirements on the impl of `std::marker::Sync` for `lock_api::mutex::Mutex<parking_lot::raw_mutex::RawMutex, ty::query::plumbing::QueryCache<'_, ty::query::queries::method_autoderef_steps<'_>>>`
[00:06:45]      = note: required because it appears within the type `rustc_data_structures::sync::Lock<ty::query::plumbing::QueryCache<'_, ty::query::queries::method_autoderef_steps<'_>>>`
[00:06:45]      = note: required because it appears within the type `ty::query::Queries<'_>`
[00:06:45]      = note: required because it appears within the type `ty::context::GlobalCtxt<'_>`
[00:06:45]      = note: required because it appears within the type `&ty::context::GlobalCtxt<'_>`
[00:06:45]      = note: required because it appears within the type `ty::context::TyCtxt<'_, '_, '_>`
[00:06:45]      = note: required because it appears within the type `ty::context::tls::ImplicitCtxt<'_, '_, '_>`
[00:06:45]      = note: required by `rustc_data_structures::sync::assert_sync`
[00:06:46] error: aborting due to 6 previous errors
[00:06:46] 
[00:06:46] For more information about this error, try `rustc --explain E0277`.
[00:06:47] error: Could not compile `rustc`.
---
travis_time:end:0488e6c9:start=1560355151751656374,finish=1560355151757342798,duration=5686424
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:31bfd8ee
$ 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:03d67f32
travis_time:start:03d67f32
$ 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:06047961
$ 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)

@Centril

This comment has been minimized.

Copy link
Member

commented Jun 13, 2019

cc #61773

@Centril Centril removed the I-nominated label Jun 16, 2019

@Centril

This comment has been minimized.

Copy link
Member

commented Jun 16, 2019

We discussed this on Thursday's language team meeting. The conclusion was that @nikomatsakis will write more elaborate descriptions and a section to the rustc guide / or an RFC at their option. Moreover, the bits for explicit impl Trait syntax should be feature gated initially so that we can ship the narrower subset for async fn.

@eddyb

This comment has been minimized.

Copy link
Member

commented Jun 16, 2019

I am was confused about the naming "pick", how does it differ from this (which I've employed recently):

fn foo<'a: 'c, 'b: 'c, 'c>(...) -> impl Trait<'a, 'b> + 'c { .. }

Well, I just re-read the PR description and I think the implication there (that should probably be written out) is that the new "pick" constraint is used to type-check the body of foo, not its users.
That is, externally, there is no lifetime constraint, only the knowledge that 'a and 'b were captured.

The problem here is that every region R in the hidden type must be equal to either 'a or 'b

There's another implication here, that the hidden type starts out with region inference variables, which must be resolved somehow. The "pick" constraint guides resolution to use one of the captured lifetimes.

A couple more nits with the description:

  • "pick" is a bit too imperative to count as a "constraint" IMO (compared to, say, set membership)
    • i.e. R0 ∈ {R1..Rn} instead of pick R0 from [R1..Rn]
  • "option" in the context of Rust seems ambiguous
    • "choice" or "alternative" might be better? not sure

For this logic, we currently require that the option regions O are always lifetime parameters.

This gives me two ideas:

  • does this have to be a constraint? could the solving algorithm described "simply" be ran, without any side-effects, once the hidden type is known, and the resulting "exported version" unified back in?
  • do we have to restrict the lifetimes to the captured ones, or could we start with a version that is less specific and "simply" looks for a parameter? aka MustBeParam(R) or even Escapes(R)
    • for e.g. fn foo<'a>(x: &'a T) -> impl Trait { x } this could find 'a and tell you to mention 'a in the return type, e.g. + Captures<'a> (or whatever solution we'll end up with)
@nikomatsakis

This comment has been minimized.

Copy link
Contributor Author

commented Jun 17, 2019

@eddyb

Well, I just re-read the PR description and I think the implication there (that should probably be written out) is that the new "pick" constraint is used to type-check the body of foo, not its users.

I plan to write out a more complete description, I'll try to make that clear.

  • "pick" is a bit too imperative to count as a "constraint" IMO (compared to, say, set membership)
  • "option" in the context of Rust seems ambiguous

I initially called them "in constraints", i.e., the region must be "in" this set, but I found it very hard to write about. I suppose "member" constraints would be ok. I like the term pick because it is relatively unique. I'll consider changing to 'm member of ['c...] where 'c are the choice regions.

does this have to be a constraint? could the solving algorithm described "simply" be ran, without any side-effects, once the hidden type is known, and the resulting "exported version" unified back in?

I don't really know what this means. But the reason it is expressed as a constraint is because it affects region variables -- those variables could be related to other variables, and so when we apply the pick constraint, we might affect other regions that do not directly appear in the hidden type.

I think one way to think of it is that we are dynamically growing the set of "outlives" constraints, but we can't tell (yet) which outlives constraint to apply -- we have to get part-way through solving before we can see that.

do we have to restrict the lifetimes to the captured ones, could we start with a version that is less specific and "simply" looks for a parameter? aka MustBeParam(R) or even Escapes(R)

It is not enough to just capture "some" parameter, that might still yield errors. It would probably suffice for simple async fn examples, though, as there is only one reasonable choice, and all lifetime parameters are captured. It wouldn't simplify the code that much I don't think, though -- I guess a little. (It would also be less useful as a starting point for let x: impl Trait<'_>, I imagine.)

for e.g. fn foo<'a>(x: &'a T) -> impl Trait { x } this could find 'a and tell you to mention 'a in the return type

we do try to give useful errors of this kind already, I think, but that seems somewhat separable.

@nikomatsakis nikomatsakis force-pushed the nikomatsakis:issue-56238-multiple-lifetimes-async-fn-region-solver branch from 0e450f2 to 038d97a Jun 17, 2019

@nikomatsakis

This comment has been minimized.

Copy link
Contributor Author

commented Jun 17, 2019

@eddyb

Regarding this example, a few more thoughts. It is true that a workaround like this works as well:

fn foo<'a: 'c, 'b: 'c, 'c>(...) -> impl Trait<'a, 'b> + 'c { .. }

I think that this workaround will work in all cases, but it does require changing the function declaration. As you noted, the approach in this PR is internal to the function, and so it doesn't affect the "public interface". However, as such it is also less general than the workaround, since it can't handle cases like this (which I noted in a comment somewhere);

fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Foo<'a, 'b> { if something { a } else { b } }

The problem here is that the resulting lifetime cannot be either 'a or 'b, but is rather their "intersection". Translating to the format you suggested gives a name to that intersection ('c) and hence works.

It would be possible to introduce such an "intersection lifetime" when desugaring async fn. We considered that approach but it also wouldn't help any other impl Trait users -- I'm also not sure how difficult it would be to do. Sad to say that our desugaring infrastructure doesn't usually make that sort of thing easy, but maybe things have improved.

I don't believe we can do such a workaround internally -- or at least, not on the current infrastructure. I had hoped is that, longer term, we could support the example above by extending the grammar of regions -- e.g., in polonius, where regions are sets of loans, it would be (I think) relatively natural to permit the compiler to have regions of the form a|b (i.e., the set-union of a and b). We could then infer the hidden type above to be &(a|b) u32. I think this would flow relatively naturally from Polonius's setup, but I confess I've not given it a lot of deep thought. We did talk a bit on Zulip about what it would take to support that in the current solver, and it seemed like it would be hard. It seems a bit surprising to me that it would be fundamentally easier in Polonius, so it's probably worth thinking that through a bit to see if I'm .. um .. missing something (it's easy to get confused).

(Of course, there has also been discussion of extending the type system with "existential regions". Then the idea would be that the hidden type would be inferred to something like exists<'c> where ('a: 'c, 'b: 'c) &'c u32. Plausibly something like that could be made sound but it is a pretty subtle extension so I'm not inclined to think about it now.)

In my view, the current approach is fairly conservative (i.e., it doesn't affect the type system in any deep way, though it does influence the inferencer deeply) and yet far-reaching (it affects not only async fn but other impl Trait users as well). It is not the most conservative thing we could do, though, which would probably be to introduce a dummy intersection lifetime for async fn desugaring.

@rust-highfive

This comment was marked as outdated.

Copy link
Collaborator

commented Jun 17, 2019

The job x86_64-gnu-llvm-6.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:end:084e7edc:start=1560781049601578949,finish=1560781051989292389,duration=2387713440
$ 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
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
$ export AWS_ACCESS_KEY_ID=AKIA46X5W6CZEJZ6XT55
---
[00:56:43] .................................................................................................... 1400/5693
[00:56:46] .................................................................................................... 1500/5693
[00:56:49] .................................................................................................... 1600/5693
[00:56:51] .................................................................................................... 1700/5693
[00:56:55] ..i................................................................................................. 1800/5693
[00:56:58] ...........................................................................F........................ 1900/5693
[00:57:06] .................................................................................................... 2100/5693
[00:57:09] ........................................................i........................................... 2200/5693
[00:57:13] .................................................................................................... 2300/5693
[00:57:17] .................................................................................................... 2400/5693
---
[00:59:28] 1 error: lifetime may not live long enough
[00:59:28] -   --> $DIR/error-handling.rs:10:1
[00:59:28] +   --> $DIR/error-handling.rs:13:56
[00:59:28] 3    |
[00:59:28] - LL | existential type E<'a, 'b>: Sized;
[00:59:28] -    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ opaque type requires that `'a` must outlive `'static`
[00:59:28] - ...
[00:59:28] 7 LL | fn foo<'a, 'b, 'c>(x: &'static i32, mut y: &'a i32) -> E<'b, 'c> {
[00:59:28] -    |        -- lifetime `'a` defined here
[00:59:28] +    |        -- lifetime `'a` defined here                   ^^^^^^^^^ opaque type requires that `'a` must outlive `'static`
[00:59:28] 9 help: to allow this `impl Trait` to capture borrowed data with lifetime `'a`, add `'a` as a constraint
[00:59:28] 10    |
[00:59:28] 11 LL | existential type E<'a, 'b>: Sized; + 'a
[00:59:28] 
[00:59:28] The actual stderr differed from the expected stderr.
[00:59:28] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/impl-trait/multiple-lifetimes/error-handling/error-handling.stderr
[00:59:28] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/impl-trait/multiple-lifetimes/error-handling/error-handling.stderr
[00:59:28] To update references, rerun the tests and pass the `--bless` flag
[00:59:28] To only update this specific test, also pass `--test-args impl-trait/multiple-lifetimes/error-handling.rs`
[00:59:28] error: 1 errors occurred comparing output.
[00:59:28] status: exit code: 1
[00:59:28] status: exit code: 1
[00:59:28] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/impl-trait/multiple-lifetimes/error-handling.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/impl-trait/multiple-lifetimes/error-handling" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Zborrowck=mir" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/impl-trait/multiple-lifetimes/error-handling/auxiliary" "-A" "unused"
[00:59:28] ------------------------------------------
[00:59:28] 
[00:59:28] ------------------------------------------
[00:59:28] stderr:
[00:59:28] stderr:
[00:59:28] ------------------------------------------
[00:59:28] error: lifetime may not live long enough
[00:59:28]   --> /checkout/src/test/ui/impl-trait/multiple-lifetimes/error-handling.rs:13:56
[00:59:28]    |
[00:59:28] LL | fn foo<'a, 'b, 'c>(x: &'static i32, mut y: &'a i32) -> E<'b, 'c> {
[00:59:28]    |        -- lifetime `'a` defined here                   ^^^^^^^^^ opaque type requires that `'a` must outlive `'static`
[00:59:28] help: to allow this `impl Trait` to capture borrowed data with lifetime `'a`, add `'a` as a constraint
[00:59:28]    |
[00:59:28] LL | existential type E<'a, 'b>: Sized; + 'a
[00:59:28] 
[00:59:28] error: aborting due to previous error
[00:59:28] 
[00:59:28] 
---
[00:59:28] thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:521:22
[00:59:28] note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
[00:59:28] 
[00:59:28] 
[00:59:28] 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" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-6.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -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" "6.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[00:59:28] 
[00:59:28] 
[00:59:28] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[00:59:28] Build completed unsuccessfully in 0:54:44
---
travis_time:end:01056e7d:start=1560784632740936657,finish=1560784632745644949,duration=4708292
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:097f87a2
$ 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:170bce05
travis_time:start:170bce05
$ 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:0365ad1d
$ 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)

@rust-highfive

This comment was marked as outdated.

Copy link
Collaborator

commented Jun 17, 2019

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:0d6fda7c:start=1560803083624994072,finish=1560803086050584147,duration=2425590075
$ 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
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
$ export AWS_ACCESS_KEY_ID=AKIA46X5W6CZEJZ6XT55
---
[00:05:55]     Checking syntax_pos v0.0.0 (/checkout/src/libsyntax_pos)
[00:05:57]     Checking rustc_errors v0.0.0 (/checkout/src/librustc_errors)
[00:05:57]     Checking fmt_macros v0.0.0 (/checkout/src/libfmt_macros)
[00:06:57]     Checking syntax_ext v0.0.0 (/checkout/src/libsyntax_ext)
[00:07:17] error[E0277]: `std::rc::Rc<std::vec::Vec<&ty::sty::RegionKind>>` cannot be shared between threads safely
[00:07:17]      |
[00:07:17] 1494 |     join(|| {
[00:07:17] 1494 |     join(|| {
[00:07:17]      |     ^^^^ `std::rc::Rc<std::vec::Vec<&ty::sty::RegionKind>>` cannot be shared between threads safely
[00:07:17]      |
[00:07:17]      = help: within `infer::region_constraints::PickConstraint<'_>`, the trait `std::marker::Sync` is not implemented for `std::rc::Rc<std::vec::Vec<&ty::sty::RegionKind>>`
[00:07:17]      = note: required because it appears within the type `infer::region_constraints::PickConstraint<'_>`
[00:07:17]      = note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<infer::region_constraints::PickConstraint<'_>>`
[00:07:17]      = note: required because it appears within the type `alloc::raw_vec::RawVec<infer::region_constraints::PickConstraint<'_>>`
[00:07:17]      = note: required because it appears within the type `std::vec::Vec<infer::region_constraints::PickConstraint<'_>>`
[00:07:17]      = note: required because it appears within the type `infer::canonical::QueryRegionConstraints<'_>`
[00:07:17]      = note: required because it appears within the type `infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>`
[00:07:17]      = note: required because it appears within the type `infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>`
[00:07:17]      = note: required because of the requirements on the impl of `std::marker::Send` for `&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>`
[00:07:17]      = note: required because it appears within the type `std::result::Result<&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>, traits::query::NoSolution>`
[00:07:17]      = note: required because it appears within the type `ty::query::plumbing::QueryValue<std::result::Result<&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>, traits::query::NoSolution>>`
[00:07:17]      = note: required because it appears within the type `(infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, ty::sty::ProjectionTy<'_>>>, ty::query::plumbing::QueryValue<std::result::Result<&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>, traits::query::NoSolution>>)`
[00:07:17]      = note: required because of the requirements on the impl of `std::marker::Send` for `hashbrown::raw::RawTable<(infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, ty::sty::ProjectionTy<'_>>>, ty::query::plumbing::QueryValue<std::result::Result<&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>, traits::query::NoSolution>>)>`
[00:07:17]      = note: required because it appears within the type `hashbrown::map::HashMap<infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, ty::sty::ProjectionTy<'_>>>, ty::query::plumbing::QueryValue<std::result::Result<&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>, traits::query::NoSolution>>, std::hash::BuildHasherDefault<rustc_data_structures::fx::FxHasher>>`
[00:07:17]      = note: required because it appears within the type `std::collections::HashMap<infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, ty::sty::ProjectionTy<'_>>>, ty::query::plumbing::QueryValue<std::result::Result<&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>, traits::query::NoSolution>>, std::hash::BuildHasherDefault<rustc_data_structures::fx::FxHasher>>`
[00:07:17]      = note: required because it appears within the type `ty::query::plumbing::QueryCache<'tcx, ty::query::queries::normalize_projection_ty<'tcx>>`
[00:07:17]      = note: required because of the requirements on the impl of `std::marker::Sync` for `lock_api::mutex::Mutex<parking_lot::raw_mutex::RawMutex, ty::query::plumbing::QueryCache<'tcx, ty::query::queries::normalize_projection_ty<'tcx>>>`
[00:07:17]      = note: required because it appears within the type `rustc_data_structures::sync::Lock<ty::query::plumbing::QueryCache<'tcx, ty::query::queries::normalize_projection_ty<'tcx>>>`
[00:07:17]      = note: required because it appears within the type `ty::query::Queries<'tcx>`
[00:07:17]      = note: required because it appears within the type `ty::context::GlobalCtxt<'tcx>`
[00:07:17]      = note: required because it appears within the type `&'tcx ty::context::GlobalCtxt<'tcx>`
[00:07:17]      = note: required because it appears within the type `ty::context::TyCtxt<'tcx>`
[00:07:17]      = note: required because of the requirements on the impl of `std::marker::Send` for `&ty::context::TyCtxt<'tcx>`
[00:07:17]      = note: required because it appears within the type `[closure@src/librustc/lint/context.rs:1494:10: 1499:6 tcx:&ty::context::TyCtxt<'tcx>, builtin_lints:impl FnOnce() -> T + Send]`
[00:07:17]      = note: required by `rustc_rayon_core::join::join`
[00:07:17] 
[00:07:17] error[E0277]: `std::rc::Rc<std::vec::Vec<&ty::sty::RegionKind>>` cannot be sent between threads safely
[00:07:17]      |
[00:07:17] 1494 |     join(|| {
[00:07:17] 1494 |     join(|| {
[00:07:17]      |     ^^^^ `std::rc::Rc<std::vec::Vec<&ty::sty::RegionKind>>` cannot be sent between threads safely
[00:07:17]      |
[00:07:17]      = help: within `infer::region_constraints::PickConstraint<'_>`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<std::vec::Vec<&ty::sty::RegionKind>>`
[00:07:17]      = note: required because it appears within the type `infer::region_constraints::PickConstraint<'_>`
[00:07:17]      = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<infer::region_constraints::PickConstraint<'_>>`
[00:07:17]      = note: required because it appears within the type `alloc::raw_vec::RawVec<infer::region_constraints::PickConstraint<'_>>`
[00:07:17]      = note: required because it appears within the type `std::vec::Vec<infer::region_constraints::PickConstraint<'_>>`
[00:07:17]      = note: required because it appears within the type `infer::canonical::QueryRegionConstraints<'_>`
[00:07:17]      = note: required because it appears within the type `infer::canonical::QueryResponse<'_, &ty::TyS<'_>>`
[00:07:17]      = note: required because it appears within the type `infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, &ty::TyS<'_>>>`
[00:07:17]      = note: required because it appears within the type `traits::query::method_autoderef::MethodAutoderefBadTy<'_>`
[00:07:17]      = note: required because of the requirements on the impl of `std::marker::Send` for `std::sync::Arc<traits::query::method_autoderef::MethodAutoderefBadTy<'_>>`
[00:07:17]      = note: required because it appears within the type `std::option::Option<std::sync::Arc<traits::query::method_autoderef::MethodAutoderefBadTy<'_>>>`
[00:07:17]      = note: required because it appears within the type `traits::query::method_autoderef::MethodAutoderefStepsResult<'_>`
[00:07:17]      = note: required because it appears within the type `ty::query::plumbing::QueryValue<traits::query::method_autoderef::MethodAutoderefStepsResult<'_>>`
[00:07:17]      = note: required because it appears within the type `(infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, &ty::TyS<'_>>>, ty::query::plumbing::QueryValue<traits::query::method_autoderef::MethodAutoderefStepsResult<'_>>)`
[00:07:17]      = note: required because of the requirements on the impl of `std::marker::Send` for `hashbrown::raw::RawTable<(infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, &ty::TyS<'_>>>, ty::query::plumbing::QueryValue<traits::query::method_autoderef::MethodAutoderefStepsResult<'_>>)>`
[00:07:17]      = note: required because it appears within the type `hashbrown::map::HashMap<infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, &ty::TyS<'_>>>, ty::query::plumbing::QueryValue<traits::query::method_autoderef::MethodAutoderefStepsResult<'_>>, std::hash::BuildHasherDefault<rustc_data_structures::fx::FxHasher>>`
[00:07:17]      = note: required because it appears within the type `std::collections::HashMap<infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, &ty::TyS<'_>>>, ty::query::plumbing::QueryValue<traits::query::method_autoderef::MethodAutoderefStepsResult<'_>>, std::hash::BuildHasherDefault<rustc_data_structures::fx::FxHasher>>`
[00:07:17]      = note: required because it appears within the type `ty::query::plumbing::QueryCache<'tcx, ty::query::queries::method_autoderef_steps<'tcx>>`
[00:07:17]      = note: required because of the requirements on the impl of `std::marker::Sync` for `lock_api::mutex::Mutex<parking_lot::raw_mutex::RawMutex, ty::query::plumbing::QueryCache<'tcx, ty::query::queries::method_autoderef_steps<'tcx>>>`
[00:07:17]      = note: required because it appears within the type `rustc_data_structures::sync::Lock<ty::query::plumbing::QueryCache<'tcx, ty::query::queries::method_autoderef_steps<'tcx>>>`
[00:07:17]      = note: required because it appears within the type `ty::query::Queries<'tcx>`
[00:07:17]      = note: required because it appears within the type `ty::context::GlobalCtxt<'tcx>`
[00:07:17]      = note: required because it appears within the type `&'tcx ty::context::GlobalCtxt<'tcx>`
[00:07:17]      = note: required because it appears within the type `ty::context::TyCtxt<'tcx>`
[00:07:17]      = note: required because of the requirements on the impl of `std::marker::Send` for `&ty::context::TyCtxt<'tcx>`
[00:07:17]      = note: required because it appears within the type `[closure@src/librustc/lint/context.rs:1494:10: 1499:6 tcx:&ty::context::TyCtxt<'tcx>, builtin_lints:impl FnOnce() -> T + Send]`
[00:07:17]      = note: required by `rustc_rayon_core::join::join`
[00:07:17] 
[00:07:23] error[E0277]: `std::rc::Rc<std::vec::Vec<&ty::sty::RegionKind>>` cannot be shared between threads safely
[00:07:23]      |
[00:07:23]      |
[00:07:23] 2775 |         par_iter(&self.hir().krate().body_ids).for_each(|&body_id| {
[00:07:23]      |                                                ^^^^^^^^ `std::rc::Rc<std::vec::Vec<&ty::sty::RegionKind>>` cannot be shared between threads safely
[00:07:23]      |
[00:07:23]      = help: within `infer::region_constraints::PickConstraint<'_>`, the trait `std::marker::Sync` is not implemented for `std::rc::Rc<std::vec::Vec<&ty::sty::RegionKind>>`
[00:07:23]      = note: required because it appears within the type `infer::region_constraints::PickConstraint<'_>`
[00:07:23]      = note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<infer::region_constraints::PickConstraint<'_>>`
[00:07:23]      = note: required because it appears within the type `alloc::raw_vec::RawVec<infer::region_constraints::PickConstraint<'_>>`
[00:07:23]      = note: required because it appears within the type `std::vec::Vec<infer::region_constraints::PickConstraint<'_>>`
[00:07:23]      = note: required because it appears within the type `infer::canonical::QueryRegionConstraints<'_>`
[00:07:23]      = note: required because it appears within the type `infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>`
[00:07:23]      = note: required because it appears within the type `infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>`
[00:07:23]      = note: required because of the requirements on the impl of `std::marker::Send` for `&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>`
[00:07:23]      = note: required because it appears within the type `std::result::Result<&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>, traits::query::NoSolution>`
[00:07:23]      = note: required because it appears within the type `ty::query::plumbing::QueryValue<std::result::Result<&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>, traits::query::NoSolution>>`
[00:07:23]      = note: required because it appears within the type `(infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, ty::sty::ProjectionTy<'_>>>, ty::query::plumbing::QueryValue<std::result::Result<&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>, traits::query::NoSolution>>)`
[00:07:23]      = note: required because of the requirements on the impl of `std::marker::Send` for `hashbrown::raw::RawTable<(infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, ty::sty::ProjectionTy<'_>>>, ty::query::plumbing::QueryValue<std::result::Result<&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>, traits::query::NoSolution>>)>`
[00:07:23]      = note: required because it appears within the type `hashbrown::map::HashMap<infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, ty::sty::ProjectionTy<'_>>>, ty::query::plumbing::QueryValue<std::result::Result<&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>, traits::query::NoSolution>>, std::hash::BuildHasherDefault<rustc_data_structures::fx::FxHasher>>`
[00:07:23]      = note: required because it appears within the type `std::collections::HashMap<infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, ty::sty::ProjectionTy<'_>>>, ty::query::plumbing::QueryValue<std::result::Result<&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>, traits::query::NoSolution>>, std::hash::BuildHasherDefault<rustc_data_structures::fx::FxHasher>>`
[00:07:23]      = note: required because it appears within the type `ty::query::plumbing::QueryCache<'tcx, ty::query::queries::normalize_projection_ty<'tcx>>`
[00:07:23]      = note: required because of the requirements on the impl of `std::marker::Sync` for `lock_api::mutex::Mutex<parking_lot::raw_mutex::RawMutex, ty::query::plumbing::QueryCache<'tcx, ty::query::queries::normalize_projection_ty<'tcx>>>`
[00:07:23]      = note: required because it appears within the type `rustc_data_structures::sync::Lock<ty::query::plumbing::QueryCache<'tcx, ty::query::queries::normalize_projection_ty<'tcx>>>`
[00:07:23]      = note: required because it appears within the type `ty::query::Queries<'tcx>`
[00:07:23]      = note: required because it appears within the type `ty::context::GlobalCtxt<'tcx>`
[00:07:23]      = note: required because it appears within the type `&'tcx ty::context::GlobalCtxt<'tcx>`
[00:07:23]      = note: required because it appears within the type `ty::context::TyCtxt<'tcx>`
[00:07:23]      = note: required because it appears within the type `&ty::context::TyCtxt<'tcx>`
[00:07:23]      = note: required because it appears within the type `[closure@src/librustc/ty/mod.rs:2775:57: 2777:10 f:&F, self:&ty::context::TyCtxt<'tcx>]`
[00:07:23] 
[00:07:23] error[E0277]: `std::rc::Rc<std::vec::Vec<&ty::sty::RegionKind>>` cannot be sent between threads safely
[00:07:23]      |
[00:07:23]      |
[00:07:23] 2775 |         par_iter(&self.hir().krate().body_ids).for_each(|&body_id| {
[00:07:23]      |                                                ^^^^^^^^ `std::rc::Rc<std::vec::Vec<&ty::sty::RegionKind>>` cannot be sent between threads safely
[00:07:23]      |
[00:07:23]      = help: within `infer::region_constraints::PickConstraint<'_>`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<std::vec::Vec<&ty::sty::RegionKind>>`
[00:07:23]      = note: required because it appears within the type `infer::region_constraints::PickConstraint<'_>`
[00:07:23]      = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<infer::region_constraints::PickConstraint<'_>>`
[00:07:23]      = note: required because it appears within the type `alloc::raw_vec::RawVec<infer::region_constraints::PickConstraint<'_>>`
[00:07:23]      = note: required because it appears within the type `std::vec::Vec<infer::region_constraints::PickConstraint<'_>>`
[00:07:23]      = note: required because it appears within the type `infer::canonical::QueryRegionConstraints<'_>`
[00:07:23]      = note: required because it appears within the type `infer::canonical::QueryResponse<'_, &ty::TyS<'_>>`
[00:07:23]      = note: required because it appears within the type `infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, &ty::TyS<'_>>>`
[00:07:23]      = note: required because it appears within the type `traits::query::method_autoderef::MethodAutoderefBadTy<'_>`
[00:07:23]      = note: required because of the requirements on the impl of `std::marker::Send` for `std::sync::Arc<traits::query::method_autoderef::MethodAutoderefBadTy<'_>>`
[00:07:23]      = note: required because it appears within the type `std::option::Option<std::sync::Arc<traits::query::method_autoderef::MethodAutoderefBadTy<'_>>>`
[00:07:23]      = note: required because it appears within the type `traits::query::method_autoderef::MethodAutoderefStepsResult<'_>`
[00:07:23]      = note: required because it appears within the type `ty::query::plumbing::QueryValue<traits::query::method_autoderef::MethodAutoderefStepsResult<'_>>`
[00:07:23]      = note: required because it appears within the type `(infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, &ty::TyS<'_>>>, ty::query::plumbing::QueryValue<traits::query::method_autoderef::MethodAutoderefStepsResult<'_>>)`
[00:07:23]      = note: required because of the requirements on the impl of `std::marker::Send` for `hashbrown::raw::RawTable<(infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, &ty::TyS<'_>>>, ty::query::plumbing::QueryValue<traits::query::method_autoderef::MethodAutoderefStepsResult<'_>>)>`
[00:07:23]      = note: required because it appears within the type `hashbrown::map::HashMap<infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, &ty::TyS<'_>>>, ty::query::plumbing::QueryValue<traits::query::method_autoderef::MethodAutoderefStepsResult<'_>>, std::hash::BuildHasherDefault<rustc_data_structures::fx::FxHasher>>`
[00:07:23]      = note: required because it appears within the type `std::collections::HashMap<infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, &ty::TyS<'_>>>, ty::query::plumbing::QueryValue<traits::query::method_autoderef::MethodAutoderefStepsResult<'_>>, std::hash::BuildHasherDefault<rustc_data_structures::fx::FxHasher>>`
[00:07:23]      = note: required because it appears within the type `ty::query::plumbing::QueryCache<'tcx, ty::query::queries::method_autoderef_steps<'tcx>>`
[00:07:23]      = note: required because of the requirements on the impl of `std::marker::Sync` for `lock_api::mutex::Mutex<parking_lot::raw_mutex::RawMutex, ty::query::plumbing::QueryCache<'tcx, ty::query::queries::method_autoderef_steps<'tcx>>>`
[00:07:23]      = note: required because it appears within the type `rustc_data_structures::sync::Lock<ty::query::plumbing::QueryCache<'tcx, ty::query::queries::method_autoderef_steps<'tcx>>>`
[00:07:23]      = note: required because it appears within the type `ty::query::Queries<'tcx>`
[00:07:23]      = note: required because it appears within the type `ty::context::GlobalCtxt<'tcx>`
[00:07:23]      = note: required because it appears within the type `&'tcx ty::context::GlobalCtxt<'tcx>`
[00:07:23]      = note: required because it appears within the type `ty::context::TyCtxt<'tcx>`
[00:07:23]      = note: required because it appears within the type `&ty::context::TyCtxt<'tcx>`
[00:07:23]      = note: required because it appears within the type `[closure@src/librustc/ty/mod.rs:2775:57: 2777:10 f:&F, self:&ty::context::TyCtxt<'tcx>]`
[00:07:23] 
[00:07:27] error[E0277]: `std::rc::Rc<std::vec::Vec<&ty::sty::RegionKind>>` cannot be shared between threads safely
[00:07:27]     --> src/librustc/ty/context.rs:2011:13
[00:07:27]      |
[00:07:27] 2011 |             sync::assert_sync::<ImplicitCtxt<'_, '_>>();
[00:07:27]      |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::rc::Rc<std::vec::Vec<&ty::sty::RegionKind>>` cannot be shared between threads safely
[00:07:27]      |
[00:07:27]      = help: within `infer::region_constraints::PickConstraint<'_>`, the trait `std::marker::Sync` is not implemented for `std::rc::Rc<std::vec::Vec<&ty::sty::RegionKind>>`
[00:07:27]      = note: required because it appears within the type `infer::region_constraints::PickConstraint<'_>`
[00:07:27]      = note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<infer::region_constraints::PickConstraint<'_>>`
[00:07:27]      = note: required because it appears within the type `alloc::raw_vec::RawVec<infer::region_constraints::PickConstraint<'_>>`
[00:07:27]      = note: required because it appears within the type `std::vec::Vec<infer::region_constraints::PickConstraint<'_>>`
[00:07:27]      = note: required because it appears within the type `infer::canonical::QueryRegionConstraints<'_>`
[00:07:27]      = note: required because it appears within the type `infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>`
[00:07:27]      = note: required because it appears within the type `infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>`
[00:07:27]      = note: required because of the requirements on the impl of `std::marker::Send` for `&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>`
[00:07:27]      = note: required because it appears within the type `std::result::Result<&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>, traits::query::NoSolution>`
[00:07:27]      = note: required because it appears within the type `ty::query::plumbing::QueryValue<std::result::Result<&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>, traits::query::NoSolution>>`
[00:07:27]      = note: required because it appears within the type `(infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, ty::sty::ProjectionTy<'_>>>, ty::query::plumbing::QueryValue<std::result::Result<&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>, traits::query::NoSolution>>)`
[00:07:27]      = note: required because of the requirements on the impl of `std::marker::Send` for `hashbrown::raw::RawTable<(infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, ty::sty::ProjectionTy<'_>>>, ty::query::plumbing::QueryValue<std::result::Result<&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>, traits::query::NoSolution>>)>`
[00:07:27]      = note: required because it appears within the type `hashbrown::map::HashMap<infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, ty::sty::ProjectionTy<'_>>>, ty::query::plumbing::QueryValue<std::result::Result<&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>, traits::query::NoSolution>>, std::hash::BuildHasherDefault<rustc_data_structures::fx::FxHasher>>`
[00:07:27]      = note: required because it appears within the type `std::collections::HashMap<infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, ty::sty::ProjectionTy<'_>>>, ty::query::plumbing::QueryValue<std::result::Result<&infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, traits::query::normalize::NormalizationResult<'_>>>, traits::query::NoSolution>>, std::hash::BuildHasherDefault<rustc_data_structures::fx::FxHasher>>`
[00:07:27]      = note: required because it appears within the type `ty::query::plumbing::QueryCache<'_, ty::query::queries::normalize_projection_ty<'_>>`
[00:07:27]      = note: required because of the requirements on the impl of `std::marker::Sync` for `lock_api::mutex::Mutex<parking_lot::raw_mutex::RawMutex, ty::query::plumbing::QueryCache<'_, ty::query::queries::normalize_projection_ty<'_>>>`
[00:07:27]      = note: required because it appears within the type `rustc_data_structures::sync::Lock<ty::query::plumbing::QueryCache<'_, ty::query::queries::normalize_projection_ty<'_>>>`
[00:07:27]      = note: required because it appears within the type `ty::query::Queries<'_>`
[00:07:27]      = note: required because it appears within the type `ty::context::GlobalCtxt<'_>`
[00:07:27]      = note: required because it appears within the type `&ty::context::GlobalCtxt<'_>`
[00:07:27]      = note: required because it appears within the type `ty::context::TyCtxt<'_>`
[00:07:27]      = note: required because it appears within the type `ty::context::tls::ImplicitCtxt<'_, '_>`
[00:07:27]      = note: required by `rustc_data_structures::sync::assert_sync`
[00:07:27] 
[00:07:27] error[E0277]: `std::rc::Rc<std::vec::Vec<&ty::sty::RegionKind>>` cannot be sent between threads safely
[00:07:27]     --> src/librustc/ty/context.rs:2011:13
[00:07:27]      |
[00:07:27] 2011 |             sync::assert_sync::<ImplicitCtxt<'_, '_>>();
[00:07:27]      |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::rc::Rc<std::vec::Vec<&ty::sty::RegionKind>>` cannot be sent between threads safely
[00:07:27]      |
[00:07:27]      = help: within `infer::region_constraints::PickConstraint<'_>`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<std::vec::Vec<&ty::sty::RegionKind>>`
[00:07:27]      = note: required because it appears within the type `infer::region_constraints::PickConstraint<'_>`
[00:07:27]      = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<infer::region_constraints::PickConstraint<'_>>`
[00:07:27]      = note: required because it appears within the type `alloc::raw_vec::RawVec<infer::region_constraints::PickConstraint<'_>>`
[00:07:27]      = note: required because it appears within the type `std::vec::Vec<infer::region_constraints::PickConstraint<'_>>`
[00:07:27]      = note: required because it appears within the type `infer::canonical::QueryRegionConstraints<'_>`
[00:07:27]      = note: required because it appears within the type `infer::canonical::QueryResponse<'_, &ty::TyS<'_>>`
[00:07:27]      = note: required because it appears within the type `infer::canonical::Canonical<'_, infer::canonical::QueryResponse<'_, &ty::TyS<'_>>>`
[00:07:27]      = note: required because it appears within the type `traits::query::method_autoderef::MethodAutoderefBadTy<'_>`
[00:07:27]      = note: required because of the requirements on the impl of `std::marker::Send` for `std::sync::Arc<traits::query::method_autoderef::MethodAutoderefBadTy<'_>>`
[00:07:27]      = note: required because it appears within the type `std::option::Option<std::sync::Arc<traits::query::method_autoderef::MethodAutoderefBadTy<'_>>>`
[00:07:27]      = note: required because it appears within the type `traits::query::method_autoderef::MethodAutoderefStepsResult<'_>`
[00:07:27]      = note: required because it appears within the type `ty::query::plumbing::QueryValue<traits::query::method_autoderef::MethodAutoderefStepsResult<'_>>`
[00:07:27]      = note: required because it appears within the type `(infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, &ty::TyS<'_>>>, ty::query::plumbing::QueryValue<traits::query::method_autoderef::MethodAutoderefStepsResult<'_>>)`
[00:07:27]      = note: required because of the requirements on the impl of `std::marker::Send` for `hashbrown::raw::RawTable<(infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, &ty::TyS<'_>>>, ty::query::plumbing::QueryValue<traits::query::method_autoderef::MethodAutoderefStepsResult<'_>>)>`
[00:07:27]      = note: required because it appears within the type `hashbrown::map::HashMap<infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, &ty::TyS<'_>>>, ty::query::plumbing::QueryValue<traits::query::method_autoderef::MethodAutoderefStepsResult<'_>>, std::hash::BuildHasherDefault<rustc_data_structures::fx::FxHasher>>`
[00:07:27]      = note: required because it appears within the type `std::collections::HashMap<infer::canonical::Canonical<'_, ty::ParamEnvAnd<'_, &ty::TyS<'_>>>, ty::query::plumbing::QueryValue<traits::query::method_autoderef::MethodAutoderefStepsResult<'_>>, std::hash::BuildHasherDefault<rustc_data_structures::fx::FxHasher>>`
[00:07:27]      = note: required because it appears within the type `ty::query::plumbing::QueryCache<'_, ty::query::queries::method_autoderef_steps<'_>>`
[00:07:27]      = note: required because of the requirements on the impl of `std::marker::Sync` for `lock_api::mutex::Mutex<parking_lot::raw_mutex::RawMutex, ty::query::plumbing::QueryCache<'_, ty::query::queries::method_autoderef_steps<'_>>>`
[00:07:27]      = note: required because it appears within the type `rustc_data_structures::sync::Lock<ty::query::plumbing::QueryCache<'_, ty::query::queries::method_autoderef_steps<'_>>>`
[00:07:27]      = note: required because it appears within the type `ty::query::Queries<'_>`
[00:07:27]      = note: required because it appears within the type `ty::context::GlobalCtxt<'_>`
[00:07:27]      = note: required because it appears within the type `&ty::context::GlobalCtxt<'_>`
[00:07:27]      = note: required because it appears within the type `ty::context::TyCtxt<'_>`
[00:07:27]      = note: required because it appears within the type `ty::context::tls::ImplicitCtxt<'_, '_>`
[00:07:27]      = note: required by `rustc_data_structures::sync::assert_sync`
[00:07:29] error: aborting due to 6 previous errors
[00:07:29] 
[00:07:29] For more information about this error, try `rustc --explain E0277`.
[00:07:29] error: Could not compile `rustc`.
---
travis_time:end:01036a82:start=1560803547925319315,finish=1560803547930409918,duration=5090603
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:04b30965
$ 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:0364d39a
travis_time:start:0364d39a
$ 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:2d50d79f
$ 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)

@bors

This comment was marked as outdated.

Copy link
Contributor

commented Jun 18, 2019

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

@nikomatsakis nikomatsakis force-pushed the nikomatsakis:issue-56238-multiple-lifetimes-async-fn-region-solver branch from dc62abf to 94dbff3 Jun 18, 2019

@rust-highfive

This comment was marked as outdated.

Copy link
Collaborator

commented Jun 18, 2019

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:01baf860:start=1560831084735326890,finish=1560831087091499623,duration=2356172733
$ 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
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
$ export AWS_ACCESS_KEY_ID=AKIA46X5W6CZEJZ6XT55
---
[00:05:45]     Checking syntax_pos v0.0.0 (/checkout/src/libsyntax_pos)
[00:05:47]     Checking rustc_errors v0.0.0 (/checkout/src/librustc_errors)
[00:05:47]     Checking fmt_macros v0.0.0 (/checkout/src/libfmt_macros)
[00:06:39]     Checking syntax_ext v0.0.0 (/checkout/src/libsyntax_ext)
[00:06:48] error[E0277]: the trait bound `std::sync::Arc<std::vec::Vec<&ty::sty::RegionKind>>: ty::context::Lift<'_>` is not satisfied
[00:06:48]    --> src/librustc/macros.rs:268:36
[00:06:48]     |
[00:06:48] 257 | / macro_rules! BraceStructLiftImpl {
[00:06:48] 258 | |     (impl<$($p:tt),*> Lift<$tcx:tt> for $s:path {
[00:06:48] 259 | |         type Lifted = $lifted:ty;
[00:06:48] 260 | |         $($field:ident),* $(,)?
[00:06:48] ...   |
[00:06:48] 268 | |                 $(let $field = tcx.lift(&self.$field)?;)*
[00:06:48]     | |                                    ^^^^ the trait `ty::context::Lift<'_>` is not implemented for `std::sync::Arc<std::vec::Vec<&ty::sty::RegionKind>>`
[00:06:48] 272 | |     };
[00:06:48] 273 | | }
[00:06:48] 273 | | }
[00:06:48]     | |_- in this expansion of `BraceStructLiftImpl!`
[00:06:48]    ::: src/librustc/infer/region_constraints/mod.rs:178:1
[00:06:48]     |
[00:06:48]     |
[00:06:48] 178 | / BraceStructLiftImpl! {
[00:06:48] 179 | |     impl<'a, 'tcx> Lift<'tcx> for PickConstraint<'a> {
[00:06:48] 180 | |         type Lifted = PickConstraint<'tcx>;
[00:06:48] 181 | |         opaque_type_def_id, definition_span, hidden_ty, pick_region, option_regions
[00:06:48] 183 | | }
[00:06:48]     | |_- in this macro invocation
[00:06:48] 
[00:06:48] 
[00:06:48] error[E0277]: the trait bound `std::sync::Arc<std::vec::Vec<&ty::sty::RegionKind>>: ty::fold::TypeFoldable<'_>` is not satisfied
[00:06:48]    --> src/librustc/macros.rs:340:32
[00:06:48]     |
[00:06:48] 328 | / macro_rules! BraceStructTypeFoldableImpl {
[00:06:48] 329 | |     (impl<$($p:tt),*> TypeFoldable<$tcx:tt> for $s:path {
[00:06:48] 330 | |         $($field:ident),* $(,)?
[00:06:48] 331 | |     } $(where $($wc:tt)*)*) => {
[00:06:48] ...   |
[00:06:48] 340 | |                 $s { $($field: $crate::ty::fold::TypeFoldable::fold_with($field, folder),)* }
[00:06:48]     | |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `ty::fold::TypeFoldable<'_>` is not implemented for `std::sync::Arc<std::vec::Vec<&ty::sty::RegionKind>>`
[00:06:48] 351 | |     };
[00:06:48] 352 | | }
[00:06:48] 352 | | }
[00:06:48]     | |_- in this expansion of `BraceStructTypeFoldableImpl!`
[00:06:48]    ::: src/librustc/infer/region_constraints/mod.rs:172:1
[00:06:48]     |
[00:06:48]     |
[00:06:48] 172 | / BraceStructTypeFoldableImpl! {
[00:06:48] 173 | |     impl<'tcx> TypeFoldable<'tcx> for PickConstraint<'tcx> {
[00:06:48] 174 | |         opaque_type_def_id, definition_span, hidden_ty, pick_region, option_regions
[00:06:48] 176 | | }
[00:06:48]     | |_- in this macro invocation
[00:06:48]     |
[00:06:48] note: required by `ty::fold::TypeFoldable::fold_with`
[00:06:48] note: required by `ty::fold::TypeFoldable::fold_with`
[00:06:48]    --> src/librustc/ty/fold.rs:49:5
[00:06:48]     |
[00:06:48] 49  |     fn fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self {
[00:06:48] 
[00:06:48] 
[00:06:48] error[E0277]: the trait bound `std::sync::Arc<std::vec::Vec<&ty::sty::RegionKind>>: ty::fold::TypeFoldable<'_>` is not satisfied
[00:06:48]    --> src/librustc/macros.rs:348:28
[00:06:48]     |
[00:06:48] 328 | / macro_rules! BraceStructTypeFoldableImpl {
[00:06:48] 329 | |     (impl<$($p:tt),*> TypeFoldable<$tcx:tt> for $s:path {
[00:06:48] 330 | |         $($field:ident),* $(,)?
[00:06:48] 331 | |     } $(where $($wc:tt)*)*) => {
[00:06:48] ...   |
[00:06:48] 348 | |                 false $(|| $crate::ty::fold::TypeFoldable::visit_with($field, visitor))*
[00:06:48]     | |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `ty::fold::TypeFoldable<'_>` is not implemented for `std::sync::Arc<std::vec::Vec<&ty::sty::RegionKind>>`
[00:06:48] 351 | |     };
[00:06:48] 352 | | }
[00:06:48] 352 | | }
[00:06:48]     | |_- in this expansion of `BraceStructTypeFoldableImpl!`
[00:06:48]    ::: src/librustc/infer/region_constraints/mod.rs:172:1
[00:06:48]     |
[00:06:48]     |
[00:06:48] 172 | / BraceStructTypeFoldableImpl! {
[00:06:48] 173 | |     impl<'tcx> TypeFoldable<'tcx> for PickConstraint<'tcx> {
[00:06:48] 174 | |         opaque_type_def_id, definition_span, hidden_ty, pick_region, option_regions
[00:06:48] 176 | | }
[00:06:48]     | |_- in this macro invocation
[00:06:48]     |
[00:06:48] note: required by `ty::fold::TypeFoldable::visit_with`
[00:06:48] note: required by `ty::fold::TypeFoldable::visit_with`
[00:06:48]    --> src/librustc/ty/fold.rs:54:5
[00:06:48]     |
[00:06:48] 54  |     fn visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool {
[00:06:48] 
[00:07:07] error: aborting due to 3 previous errors
[00:07:07] 
[00:07:07] For more information about this error, try `rustc --explain E0277`.
---
travis_time:end:1a47bdfc:start=1560831528084356615,finish=1560831528090572817,duration=6216202
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:00ea10bd
$ 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:0410c3a8
travis_time:start:0410c3a8
$ 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:02ab2236
$ 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)

@rust-highfive

This comment was marked as outdated.

Copy link
Collaborator

commented Jun 18, 2019

The job x86_64-gnu-llvm-6.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:end:0ea8be7e:start=1560860209111692248,finish=1560860296966330249,duration=87854638001
$ 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
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
$ export AWS_ACCESS_KEY_ID=AKIA46X5W6CZEJZ6XT55
---
[00:08:00]    Compiling syntax_ext v0.0.0 (/checkout/src/libsyntax_ext)
[00:08:04] error[E0433]: failed to resolve: use of undeclared type or module `Arc`
[00:08:04]    --> src/librustc/ty/structural_impls.rs:391:31
[00:08:04]     |
[00:08:04] 391 |         tcx.lift(&**self).map(Arc::new)
[00:08:04]     |                               ^^^ use of undeclared type or module `Arc`
[00:08:05] error[E0412]: cannot find type `Arc` in this scope
[00:08:05]    --> src/librustc/ty/structural_impls.rs:388:42
[00:08:05]     |
[00:08:05]     |
[00:08:05] 388 | impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for Arc<T> {
[00:08:05] help: possible candidate is found in another module, you can import it into scope
[00:08:05]     |
[00:08:05] 6   | use std::sync::Arc;
[00:08:05]     |
[00:08:05]     |
[00:08:05] 
[00:08:05] error[E0412]: cannot find type `Arc` in this scope
[00:08:05]    --> src/librustc/ty/structural_impls.rs:389:19
[00:08:05]     |
[00:08:05] 389 |     type Lifted = Arc<T::Lifted>;
[00:08:05] help: possible candidate is found in another module, you can import it into scope
[00:08:05]     |
[00:08:05] 6   | use std::sync::Arc;
[00:08:05]     |
[00:08:05]     |
[00:08:05] 
[00:08:09] error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates
[00:08:09]    --> src/librustc/ty/structural_impls.rs:388:12
[00:08:09]     |
[00:08:09] 388 | impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for Arc<T> {
[00:08:09]     |            ^ unconstrained type parameter
[00:08:09] error: aborting due to 4 previous errors
[00:08:09] 
[00:08:09] Some errors have detailed explanations: E0207, E0412, E0433.
[00:08:09] For more information about an error, try `rustc --explain E0207`.
---
travis_time:end:05432bc8:start=1560860809730996033,finish=1560860809736102999,duration=5106966
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:0c427929
$ 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:04916f7d
travis_time:start:04916f7d
$ 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:164bd8a7
$ 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 nikomatsakis force-pushed the nikomatsakis:issue-56238-multiple-lifetimes-async-fn-region-solver branch from 4c596fd to dcd7302 Jun 18, 2019

@nikomatsakis

This comment has been minimized.

Copy link
Contributor Author

commented Jun 18, 2019

I started working on more documentation in rust-lang/rustc-guide#344 but I didn't get that far yet.

@eddyb

This comment has been minimized.

Copy link
Member

commented Jun 18, 2019

We could then infer the hidden type above to be &(a|b) u32.

Yeah, that's what I thought this was, before realizing it's internal to the body and not leaking into the signature. And I was going to ask "why put it in a constraint and not in the lifetimes themselves".

I don't really know what this means. But the reason it is expressed as a constraint is because it affects region variables -- those variables could be related to other variables, and so when we apply the pick constraint, we might affect other regions that do not directly appear in the hidden type.

I think one way to think of it is that we are dynamically growing the set of "outlives" constraints, but we can't tell (yet) which outlives constraint to apply -- we have to get part-way through solving before we can see that.

I guess it would make sense if the pick constraint needs to "stay around" in some sort of "partially solved" state - either way, it's probably safer to have it as a constraint even if a hackier solution might exist.

@rust-highfive

This comment was marked as outdated.

Copy link
Collaborator

commented Jun 18, 2019

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:2b88a504:start=1560870057883435257,finish=1560871204604813905,duration=1146721378648
$ 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
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
$ export AWS_ACCESS_KEY_ID=AKIA46X5W6CZEJZ6XT55
---
[00:13:49]     Checking syntax_pos v0.0.0 (/checkout/src/libsyntax_pos)
[00:13:50]     Checking rustc_errors v0.0.0 (/checkout/src/librustc_errors)
[00:13:50]     Checking fmt_macros v0.0.0 (/checkout/src/libfmt_macros)
[00:14:42]     Checking syntax_ext v0.0.0 (/checkout/src/libsyntax_ext)
[00:14:51] error[E0277]: the trait bound `std::sync::Arc<std::vec::Vec<&ty::sty::RegionKind>>: ty::fold::TypeFoldable<'_>` is not satisfied
[00:14:51]    --> src/librustc/macros.rs:340:32
[00:14:51]     |
[00:14:51] 328 | / macro_rules! BraceStructTypeFoldableImpl {
[00:14:51] 329 | |     (impl<$($p:tt),*> TypeFoldable<$tcx:tt> for $s:path {
[00:14:51] 330 | |         $($field:ident),* $(,)?
[00:14:51] 331 | |     } $(where $($wc:tt)*)*) => {
[00:14:51] ...   |
[00:14:51] 340 | |                 $s { $($field: $crate::ty::fold::TypeFoldable::fold_with($field, folder),)* }
[00:14:51]     | |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `ty::fold::TypeFoldable<'_>` is not implemented for `std::sync::Arc<std::vec::Vec<&ty::sty::RegionKind>>`
[00:14:51] 351 | |     };
[00:14:51] 352 | | }
[00:14:51] 352 | | }
[00:14:51]     | |_- in this expansion of `BraceStructTypeFoldableImpl!`
[00:14:51]    ::: src/librustc/infer/region_constraints/mod.rs:172:1
[00:14:51]     |
[00:14:51]     |
[00:14:51] 172 | / BraceStructTypeFoldableImpl! {
[00:14:51] 173 | |     impl<'tcx> TypeFoldable<'tcx> for MemberConstraint<'tcx> {
[00:14:51] 174 | |         opaque_type_def_id, definition_span, hidden_ty, member_region, choice_regions
[00:14:51] 176 | | }
[00:14:51]     | |_- in this macro invocation
[00:14:51]     |
[00:14:51] note: required by `ty::fold::TypeFoldable::fold_with`
[00:14:51] note: required by `ty::fold::TypeFoldable::fold_with`
[00:14:51]    --> src/librustc/ty/fold.rs:49:5
[00:14:51]     |
[00:14:51] 49  |     fn fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self {
[00:14:51] 
[00:14:51] 
[00:14:51] error[E0277]: the trait bound `std::sync::Arc<std::vec::Vec<&ty::sty::RegionKind>>: ty::fold::TypeFoldable<'_>` is not satisfied
[00:14:51]    --> src/librustc/macros.rs:348:28
[00:14:51]     |
[00:14:51] 328 | / macro_rules! BraceStructTypeFoldableImpl {
[00:14:51] 329 | |     (impl<$($p:tt),*> TypeFoldable<$tcx:tt> for $s:path {
[00:14:51] 330 | |         $($field:ident),* $(,)?
[00:14:51] 331 | |     } $(where $($wc:tt)*)*) => {
[00:14:51] ...   |
[00:14:51] 348 | |                 false $(|| $crate::ty::fold::TypeFoldable::visit_with($field, visitor))*
[00:14:51]     | |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `ty::fold::TypeFoldable<'_>` is not implemented for `std::sync::Arc<std::vec::Vec<&ty::sty::RegionKind>>`
[00:14:51] 351 | |     };
[00:14:51] 352 | | }
[00:14:51] 352 | | }
[00:14:51]     | |_- in this expansion of `BraceStructTypeFoldableImpl!`
[00:14:51]    ::: src/librustc/infer/region_constraints/mod.rs:172:1
[00:14:51]     |
[00:14:51]     |
[00:14:51] 172 | / BraceStructTypeFoldableImpl! {
[00:14:51] 173 | |     impl<'tcx> TypeFoldable<'tcx> for MemberConstraint<'tcx> {
[00:14:51] 174 | |         opaque_type_def_id, definition_span, hidden_ty, member_region, choice_regions
[00:14:51] 176 | | }
[00:14:51]     | |_- in this macro invocation
[00:14:51]     |
[00:14:51] note: required by `ty::fold::TypeFoldable::visit_with`
[00:14:51] note: required by `ty::fold::TypeFoldable::visit_with`
[00:14:51]    --> src/librustc/ty/fold.rs:54:5
[00:14:51]     |
[00:14:51] 54  |     fn visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool {
[00:14:51] 
[00:15:10] error: aborting due to 2 previous errors
[00:15:10] 
[00:15:10] For more information about this error, try `rustc --explain E0277`.
---
travis_time:end:331b7f38:start=1560872127783469791,finish=1560872127788407801,duration=4938010
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:281a7a06
$ 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:0ee76e7c
travis_time:start:0ee76e7c
$ 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:01f55d44
$ 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)

@bors

This comment was marked as outdated.

Copy link
Contributor

commented Jun 19, 2019

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

@nikomatsakis

This comment has been minimized.

Copy link
Contributor Author

commented Jul 2, 2019

Oh -- they are in the NLL mode! OK.

@Centril

This comment has been minimized.

Copy link
Member

commented Jul 2, 2019

@bors p=15

@nikomatsakis

This comment has been minimized.

Copy link
Contributor Author

commented Jul 2, 2019

@bors r=MatthewJasper

@bors

This comment has been minimized.

Copy link
Contributor

commented Jul 2, 2019

📌 Commit f7e00a5 has been approved by MatthewJasper

@bors

This comment has been minimized.

Copy link
Contributor

commented Jul 3, 2019

⌛️ Testing commit f7e00a5 with merge 55a3c57...

bors added a commit that referenced this pull request Jul 3, 2019

Auto merge of #61775 - nikomatsakis:issue-56238-multiple-lifetimes-as…
…ync-fn-region-solver, r=MatthewJasper

generalize impl trait to permit multiple lifetime bounds

Generalizes the region solver to support "pick constraints". These have the form:

```
pick R0 from [R1..Rn]
```

where `R1..Rn` are called the "option regions". The idea is that `R0` must be equal to *some* region in the set `R1..Rn`. These constraints are then used to handle cases like this:

```rust
fn foo<'a, 'b>(...) -> impl Trait<'a, 'b> { .. }
```

The problem here is that every region R in the hidden type must be equal to *either* `'a` *or* `'b` (or `'static`) -- in the past, the only kinds of constraints we had were outlives constraints, and since `'a` and `'b` are unrelated, there was no outlives constraint we could issue that would enforce that (`R: 'a` and `R: 'b` are both too strict, for example). But now we can issue a pick constraint: `pick R from ['a, 'b]`.

In general, solving pick constraints is tricky. We integrate them into the solver as follows. In general, during the propagation phase, we are monotonically growing a set of inference regions. To handle a case like `pick R from [O...]`, where `O...` represents the option regions, we do the following:

- Look for all the *lower bounds* of the region R -- that is, every region LB such that `R: LB` must hold.
- Look for all the *upper bounds* of the region R -- that is, every region UB such that `UB: R` must hold.
- Let the *viable options* be each option region O such that `UB: O` and `O: LB` for each UB, LB bound.
- Find the *minimal viable option* M, where `O: M` holds for every option region O.

If there is such a *minimal viable option*, then we make `R: M`. (This may in turn influence other bits of inference.) If there is no minimal viable option, either because all options were eliminated or because none of the remaining options are minimal, we do nothing. Ultimately, if the pick constraint is not satisfied, an error is reported.

For this logic, we currently require that the option regions O are always lifetime parameters. To determine the bounds, we walk the various outlives edges that were otherwise introduced.

r? @matthewjasper
cc @cramertj

Fixes #56238

TODO:

- [ ] Error messages include region variable info sometimes, how to fix?
- [ ] Tests for bare `existential type`  and other impl Trait usage
@Mark-Simulacrum

This comment has been minimized.

Copy link
Member

commented Jul 3, 2019

@bors retry giving priority to stable PR

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

commented Jul 3, 2019

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.
Cloning into 'rust-lang/rust'...
travis_time:end:2c51e080:start=1562117371941153675,finish=1562117387922004092,duration=15980850417
$ cd rust-lang/rust
$ git checkout -qf 55a3c57c5eeb948d44c2c67dbbf49c2b0cb534e2
fatal: reference is not a tree: 55a3c57c5eeb948d44c2c67dbbf49c2b0cb534e2
The command "git checkout -qf 55a3c57c5eeb948d44c2c67dbbf49c2b0cb534e2" failed and exited with 128 during .
Your build has been stopped.

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.

Copy link
Contributor

commented Jul 3, 2019

⌛️ Testing commit f7e00a5 with merge 8301de1...

bors added a commit that referenced this pull request Jul 3, 2019

Auto merge of #61775 - nikomatsakis:issue-56238-multiple-lifetimes-as…
…ync-fn-region-solver, r=MatthewJasper

generalize impl trait to permit multiple lifetime bounds

Generalizes the region solver to support "pick constraints". These have the form:

```
pick R0 from [R1..Rn]
```

where `R1..Rn` are called the "option regions". The idea is that `R0` must be equal to *some* region in the set `R1..Rn`. These constraints are then used to handle cases like this:

```rust
fn foo<'a, 'b>(...) -> impl Trait<'a, 'b> { .. }
```

The problem here is that every region R in the hidden type must be equal to *either* `'a` *or* `'b` (or `'static`) -- in the past, the only kinds of constraints we had were outlives constraints, and since `'a` and `'b` are unrelated, there was no outlives constraint we could issue that would enforce that (`R: 'a` and `R: 'b` are both too strict, for example). But now we can issue a pick constraint: `pick R from ['a, 'b]`.

In general, solving pick constraints is tricky. We integrate them into the solver as follows. In general, during the propagation phase, we are monotonically growing a set of inference regions. To handle a case like `pick R from [O...]`, where `O...` represents the option regions, we do the following:

- Look for all the *lower bounds* of the region R -- that is, every region LB such that `R: LB` must hold.
- Look for all the *upper bounds* of the region R -- that is, every region UB such that `UB: R` must hold.
- Let the *viable options* be each option region O such that `UB: O` and `O: LB` for each UB, LB bound.
- Find the *minimal viable option* M, where `O: M` holds for every option region O.

If there is such a *minimal viable option*, then we make `R: M`. (This may in turn influence other bits of inference.) If there is no minimal viable option, either because all options were eliminated or because none of the remaining options are minimal, we do nothing. Ultimately, if the pick constraint is not satisfied, an error is reported.

For this logic, we currently require that the option regions O are always lifetime parameters. To determine the bounds, we walk the various outlives edges that were otherwise introduced.

r? @matthewjasper
cc @cramertj

Fixes #56238

TODO:

- [ ] Error messages include region variable info sometimes, how to fix?
- [ ] Tests for bare `existential type`  and other impl Trait usage
@bors

This comment has been minimized.

Copy link
Contributor

commented Jul 3, 2019

☀️ Test successful - checks-azure, checks-travis, status-appveyor
Approved by: MatthewJasper
Pushing 8301de1 to master...

@bors bors added the merged-by-bors label Jul 3, 2019

@bors bors merged commit f7e00a5 into rust-lang:master Jul 3, 2019

4 checks passed

homu Test successful
Details
pr Build #20190702.44 succeeded
Details
pr (Linux mingw-check) Linux mingw-check succeeded
Details
pr (Linux x86_64-gnu-llvm-6.0) Linux x86_64-gnu-llvm-6.0 succeeded
Details

@withoutboats withoutboats referenced this pull request Jul 4, 2019

Open

[Stabilization] async/await MVP #62149

2 of 4 tasks complete

jebrosen added a commit to jebrosen/Rocket that referenced this pull request Jul 11, 2019

jebrosen added a commit to jebrosen/Rocket that referenced this pull request Jul 19, 2019

jebrosen added a commit to jebrosen/Rocket that referenced this pull request Jul 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.