1
Fork 0

Auto merge of #53441 - toidiu:ak-fix53419, r=nikomatsakis

fix for late-bound regions

Fix for https://github.com/rust-lang/rust/issues/53419

r? @nikomatsakis
This commit is contained in:
bors 2018-08-27 17:42:45 +00:00
commit 70a21e89f1
51 changed files with 94 additions and 23 deletions

View file

@ -77,6 +77,7 @@
#![cfg_attr(not(test), feature(fn_traits))] #![cfg_attr(not(test), feature(fn_traits))]
#![cfg_attr(not(test), feature(generator_trait))] #![cfg_attr(not(test), feature(generator_trait))]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![cfg_attr(test, feature(test))] #![cfg_attr(test, feature(test))]
#![feature(allocator_api)] #![feature(allocator_api)]

View file

@ -17,6 +17,7 @@
#![feature(libc)] #![feature(libc)]
#![feature(linkage)] #![feature(linkage)]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![feature(staged_api)] #![feature(staged_api)]
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
#![cfg_attr(dummy_jemalloc, allow(dead_code, unused_extern_crates))] #![cfg_attr(dummy_jemalloc, allow(dead_code, unused_extern_crates))]

View file

@ -18,6 +18,7 @@
#![feature(allocator_api)] #![feature(allocator_api)]
#![feature(core_intrinsics)] #![feature(core_intrinsics)]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![feature(staged_api)] #![feature(staged_api)]
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
#![cfg_attr(any(unix, target_os = "cloudabi", target_os = "redox"), feature(libc))] #![cfg_attr(any(unix, target_os = "cloudabi", target_os = "redox"), feature(libc))]

View file

@ -27,6 +27,7 @@
#![feature(core_intrinsics)] #![feature(core_intrinsics)]
#![feature(dropck_eyepatch)] #![feature(dropck_eyepatch)]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![feature(raw_vec_internals)] #![feature(raw_vec_internals)]
#![cfg_attr(test, feature(test))] #![cfg_attr(test, feature(test))]

View file

@ -92,6 +92,7 @@
#![feature(link_llvm_intrinsics)] #![feature(link_llvm_intrinsics)]
#![feature(never_type)] #![feature(never_type)]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![feature(exhaustive_patterns)] #![feature(exhaustive_patterns)]
#![feature(macro_at_most_once_rep)] #![feature(macro_at_most_once_rep)]
#![feature(no_core)] #![feature(no_core)]

View file

@ -21,6 +21,7 @@
test(attr(deny(warnings))))] test(attr(deny(warnings))))]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
pub use self::Piece::*; pub use self::Piece::*;
pub use self::Position::*; pub use self::Position::*;

View file

@ -289,6 +289,7 @@
test(attr(allow(unused_variables), deny(warnings))))] test(attr(allow(unused_variables), deny(warnings))))]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![feature(str_escape)] #![feature(str_escape)]
use self::LabelText::*; use self::LabelText::*;

View file

@ -25,6 +25,7 @@
#![feature(core_intrinsics)] #![feature(core_intrinsics)]
#![feature(libc)] #![feature(libc)]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![feature(panic_runtime)] #![feature(panic_runtime)]
#![feature(staged_api)] #![feature(staged_api)]
#![feature(rustc_attrs)] #![feature(rustc_attrs)]

View file

@ -35,6 +35,7 @@
#![feature(lang_items)] #![feature(lang_items)]
#![feature(libc)] #![feature(libc)]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![feature(panic_unwind)] #![feature(panic_unwind)]
#![feature(raw)] #![feature(raw)]
#![feature(staged_api)] #![feature(staged_api)]

View file

@ -32,6 +32,7 @@
test(attr(allow(dead_code, deprecated, unused_variables, unused_mut))))] test(attr(allow(dead_code, deprecated, unused_variables, unused_mut))))]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![feature(rustc_private)] #![feature(rustc_private)]
#![feature(staged_api)] #![feature(staged_api)]
#![feature(lang_items)] #![feature(lang_items)]

View file

@ -16,4 +16,5 @@
issue = "0")] issue = "0")]
#![allow(unused_features)] #![allow(unused_features)]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![feature(staged_api)] #![feature(staged_api)]

View file

@ -51,6 +51,7 @@
#![feature(exhaustive_patterns)] #![feature(exhaustive_patterns)]
#![feature(extern_types)] #![feature(extern_types)]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![feature(non_exhaustive)] #![feature(non_exhaustive)]
#![feature(proc_macro_internals)] #![feature(proc_macro_internals)]
#![feature(quote)] #![feature(quote)]

View file

@ -9,6 +9,7 @@
// except according to those terms. // except according to those terms.
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![feature(rustc_private)] #![feature(rustc_private)]
#[macro_use] extern crate log; #[macro_use] extern crate log;

View file

@ -46,6 +46,7 @@
#![forbid(unsafe_code)] #![forbid(unsafe_code)]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![feature(try_from)] #![feature(try_from)]
// See librustc_cratesio_shim/Cargo.toml for a comment explaining this. // See librustc_cratesio_shim/Cargo.toml for a comment explaining this.
#[allow(unused_extern_crates)] #[allow(unused_extern_crates)]

View file

@ -11,6 +11,7 @@
#![sanitizer_runtime] #![sanitizer_runtime]
#![feature(alloc_system)] #![feature(alloc_system)]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![feature(sanitizer_runtime)] #![feature(sanitizer_runtime)]
#![feature(staged_api)] #![feature(staged_api)]
#![no_std] #![no_std]

View file

@ -15,6 +15,7 @@
#![allow(non_camel_case_types)] #![allow(non_camel_case_types)]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![feature(quote)] #![feature(quote)]
#![recursion_limit="256"] #![recursion_limit="256"]

View file

@ -27,6 +27,7 @@
#![allow(unused_attributes)] #![allow(unused_attributes)]
#![feature(libc)] #![feature(libc)]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![feature(quote)] #![feature(quote)]
#![feature(range_contains)] #![feature(range_contains)]
#![feature(rustc_diagnostic_macros)] #![feature(rustc_diagnostic_macros)]

View file

@ -20,6 +20,7 @@
#![feature(box_syntax)] #![feature(box_syntax)]
#![feature(custom_attribute)] #![feature(custom_attribute)]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![allow(unused_attributes)] #![allow(unused_attributes)]
#![feature(quote)] #![feature(quote)]
#![feature(rustc_diagnostic_macros)] #![feature(rustc_diagnostic_macros)]

View file

@ -12,6 +12,7 @@
#![allow(unused_extern_crates)] #![allow(unused_extern_crates)]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
extern crate bitflags; extern crate bitflags;
extern crate log; extern crate log;

View file

@ -27,6 +27,7 @@
#![feature(optin_builtin_traits)] #![feature(optin_builtin_traits)]
#![cfg_attr(stage0, feature(macro_vis_matcher))] #![cfg_attr(stage0, feature(macro_vis_matcher))]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![feature(allow_internal_unstable)] #![feature(allow_internal_unstable)]
#![feature(vec_resize_with)] #![feature(vec_resize_with)]

View file

@ -21,6 +21,7 @@
#![feature(box_syntax)] #![feature(box_syntax)]
#![cfg_attr(unix, feature(libc))] #![cfg_attr(unix, feature(libc))]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![feature(option_replace)] #![feature(option_replace)]
#![feature(quote)] #![feature(quote)]
#![feature(rustc_diagnostic_macros)] #![feature(rustc_diagnostic_macros)]

View file

@ -17,6 +17,7 @@
#![feature(range_contains)] #![feature(range_contains)]
#![cfg_attr(unix, feature(libc))] #![cfg_attr(unix, feature(libc))]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![feature(optin_builtin_traits)] #![feature(optin_builtin_traits)]
extern crate atty; extern crate atty;

View file

@ -15,6 +15,7 @@
html_root_url = "https://doc.rust-lang.org/nightly/")] html_root_url = "https://doc.rust-lang.org/nightly/")]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![feature(specialization)] #![feature(specialization)]
#![recursion_limit="256"] #![recursion_limit="256"]

View file

@ -28,6 +28,7 @@
#![feature(box_syntax)] #![feature(box_syntax)]
#![cfg_attr(stage0, feature(macro_vis_matcher))] #![cfg_attr(stage0, feature(macro_vis_matcher))]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![feature(quote)] #![feature(quote)]
#![feature(rustc_diagnostic_macros)] #![feature(rustc_diagnostic_macros)]
#![feature(macro_at_most_once_rep)] #![feature(macro_at_most_once_rep)]

View file

@ -9,6 +9,7 @@
// except according to those terms. // except according to those terms.
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![feature(static_nobundle)] #![feature(static_nobundle)]
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",

View file

@ -11,6 +11,7 @@
#![sanitizer_runtime] #![sanitizer_runtime]
#![feature(alloc_system)] #![feature(alloc_system)]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![feature(sanitizer_runtime)] #![feature(sanitizer_runtime)]
#![feature(staged_api)] #![feature(staged_api)]
#![no_std] #![no_std]

View file

@ -16,6 +16,7 @@
#![feature(libc)] #![feature(libc)]
#![feature(macro_at_most_once_rep)] #![feature(macro_at_most_once_rep)]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![feature(proc_macro_internals)] #![feature(proc_macro_internals)]
#![feature(proc_macro_quote)] #![feature(proc_macro_quote)]
#![feature(quote)] #![feature(quote)]

View file

@ -15,7 +15,7 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
*/ */
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![feature(infer_outlives_requirements)] #![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![feature(in_band_lifetimes)] #![feature(in_band_lifetimes)]
#![feature(slice_patterns)] #![feature(slice_patterns)]
#![feature(slice_sort_by_cached_key)] #![feature(slice_sort_by_cached_key)]

View file

@ -11,6 +11,7 @@
#![sanitizer_runtime] #![sanitizer_runtime]
#![feature(alloc_system)] #![feature(alloc_system)]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![feature(sanitizer_runtime)] #![feature(sanitizer_runtime)]
#![feature(staged_api)] #![feature(staged_api)]
#![no_std] #![no_std]

View file

@ -19,6 +19,7 @@
html_root_url = "https://doc.rust-lang.org/nightly/")] html_root_url = "https://doc.rust-lang.org/nightly/")]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![feature(rustc_diagnostic_macros)] #![feature(rustc_diagnostic_macros)]
#[macro_use] #[macro_use]

View file

@ -11,6 +11,7 @@
#![allow(bad_style)] #![allow(bad_style)]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
pub struct Intrinsic { pub struct Intrinsic {
pub inputs: &'static [&'static Type], pub inputs: &'static [&'static Type],

View file

@ -65,6 +65,7 @@
html_root_url = "https://doc.rust-lang.org/nightly/")] html_root_url = "https://doc.rust-lang.org/nightly/")]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![feature(rustc_diagnostic_macros)] #![feature(rustc_diagnostic_macros)]
#[macro_use] extern crate syntax; #[macro_use] extern crate syntax;

View file

@ -13,6 +13,7 @@
html_root_url = "https://doc.rust-lang.org/nightly/")] html_root_url = "https://doc.rust-lang.org/nightly/")]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![feature(rustc_diagnostic_macros)] #![feature(rustc_diagnostic_macros)]
#![recursion_limit="256"] #![recursion_limit="256"]

View file

@ -14,6 +14,7 @@
#![feature(crate_visibility_modifier)] #![feature(crate_visibility_modifier)]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![feature(rustc_diagnostic_macros)] #![feature(rustc_diagnostic_macros)]
#![feature(slice_sort_by_cached_key)] #![feature(slice_sort_by_cached_key)]

View file

@ -13,6 +13,7 @@
html_root_url = "https://doc.rust-lang.org/nightly/")] html_root_url = "https://doc.rust-lang.org/nightly/")]
#![feature(custom_attribute)] #![feature(custom_attribute)]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![allow(unused_attributes)] #![allow(unused_attributes)]
#![recursion_limit="256"] #![recursion_limit="256"]

View file

@ -24,6 +24,7 @@
#![feature(box_syntax)] #![feature(box_syntax)]
#![feature(const_fn)] #![feature(const_fn)]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![feature(slice_patterns)] #![feature(slice_patterns)]
#[macro_use] #[macro_use]

View file

@ -16,6 +16,7 @@
#![feature(extern_prelude)] #![feature(extern_prelude)]
#![feature(in_band_lifetimes)] #![feature(in_band_lifetimes)]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![recursion_limit="256"] #![recursion_limit="256"]

View file

@ -11,6 +11,7 @@
#![sanitizer_runtime] #![sanitizer_runtime]
#![feature(alloc_system)] #![feature(alloc_system)]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![feature(sanitizer_runtime)] #![feature(sanitizer_runtime)]
#![feature(staged_api)] #![feature(staged_api)]
#![no_std] #![no_std]

View file

@ -76,6 +76,7 @@ This API is completely unstable and subject to change.
#![feature(crate_visibility_modifier)] #![feature(crate_visibility_modifier)]
#![feature(exhaustive_patterns)] #![feature(exhaustive_patterns)]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![feature(quote)] #![feature(quote)]
#![feature(refcell_replace_swap)] #![feature(refcell_replace_swap)]
#![feature(rustc_diagnostic_macros)] #![feature(rustc_diagnostic_macros)]

View file

@ -65,8 +65,7 @@ impl<'cx, 'tcx> ItemLikeVisitor<'tcx> for InferVisitor<'cx, 'tcx> {
debug!("InferVisitor::visit_item(item={:?})", item_did); debug!("InferVisitor::visit_item(item={:?})", item_did);
let node_id = self let node_id = self.tcx
.tcx
.hir .hir
.as_local_node_id(item_did) .as_local_node_id(item_did)
.expect("expected local def-id"); .expect("expected local def-id");
@ -108,8 +107,7 @@ impl<'cx, 'tcx> ItemLikeVisitor<'tcx> for InferVisitor<'cx, 'tcx> {
// Therefore mark `predicates_added` as true and which will ensure // Therefore mark `predicates_added` as true and which will ensure
// we walk the crates again and re-calculate predicates for all // we walk the crates again and re-calculate predicates for all
// items. // items.
let item_predicates_len: usize = self let item_predicates_len: usize = self.global_inferred_outlives
.global_inferred_outlives
.get(&item_did) .get(&item_did)
.map(|p| p.len()) .map(|p| p.len())
.unwrap_or(0); .unwrap_or(0);
@ -191,7 +189,7 @@ fn insert_required_predicates_to_be_wf<'tcx>(
substs, substs,
required_predicates, required_predicates,
explicit_map, explicit_map,
false, IgnoreSelfTy(false),
); );
} }
@ -199,22 +197,29 @@ fn insert_required_predicates_to_be_wf<'tcx>(
// This corresponds to `dyn Trait<..>`. In this case, we should // This corresponds to `dyn Trait<..>`. In this case, we should
// use the explicit predicates as well. // use the explicit predicates as well.
// We are passing type `ty` as a placeholder value with the function
// `with_self_ty`, since there is no concrete type `Self` for a
// `dyn Trait` at this stage. Therefore when checking explicit
// predicates in `check_explicit_predicates` we need to ignore
// checking the explicit_map for Self type.
debug!("Dynamic"); debug!("Dynamic");
debug!("field_ty = {}", &field_ty); debug!("field_ty = {}", &field_ty);
debug!("ty in field = {}", &ty); debug!("ty in field = {}", &ty);
if let Some(ex_trait_ref) = obj.principal() { if let Some(ex_trait_ref) = obj.principal() {
// Here, we are passing the type `usize` as a
// placeholder value with the function
// `with_self_ty`, since there is no concrete type
// `Self` for a `dyn Trait` at this
// stage. Therefore when checking explicit
// predicates in `check_explicit_predicates` we
// need to ignore checking the explicit_map for
// Self type.
let substs = ex_trait_ref
.with_self_ty(tcx, tcx.types.usize)
.skip_binder()
.substs;
check_explicit_predicates( check_explicit_predicates(
tcx, tcx,
&ex_trait_ref.skip_binder().def_id, &ex_trait_ref.skip_binder().def_id,
ex_trait_ref.with_self_ty(tcx, ty).skip_binder().substs, substs,
required_predicates, required_predicates,
explicit_map, explicit_map,
true, IgnoreSelfTy(true),
); );
} }
} }
@ -229,7 +234,7 @@ fn insert_required_predicates_to_be_wf<'tcx>(
obj.substs, obj.substs,
required_predicates, required_predicates,
explicit_map, explicit_map,
false, IgnoreSelfTy(false),
); );
} }
@ -238,6 +243,8 @@ fn insert_required_predicates_to_be_wf<'tcx>(
} }
} }
pub struct IgnoreSelfTy(bool);
/// We also have to check the explicit predicates /// We also have to check the explicit predicates
/// declared on the type. /// declared on the type.
/// ///
@ -259,7 +266,7 @@ pub fn check_explicit_predicates<'tcx>(
substs: &[Kind<'tcx>], substs: &[Kind<'tcx>],
required_predicates: &mut RequiredPredicates<'tcx>, required_predicates: &mut RequiredPredicates<'tcx>,
explicit_map: &mut ExplicitPredicatesMap<'tcx>, explicit_map: &mut ExplicitPredicatesMap<'tcx>,
ignore_self_ty: bool, ignore_self_ty: IgnoreSelfTy,
) { ) {
debug!("def_id = {:?}", &def_id); debug!("def_id = {:?}", &def_id);
debug!("substs = {:?}", &substs); debug!("substs = {:?}", &substs);
@ -297,7 +304,7 @@ pub fn check_explicit_predicates<'tcx>(
// to apply the substs, and not filter this predicate, we might then falsely // to apply the substs, and not filter this predicate, we might then falsely
// conclude that e.g. `X: 'x` was a reasonable inferred requirement. // conclude that e.g. `X: 'x` was a reasonable inferred requirement.
if let UnpackedKind::Type(ty) = outlives_predicate.0.unpack() { if let UnpackedKind::Type(ty) = outlives_predicate.0.unpack() {
if ty.is_self() && ignore_self_ty { if ty.is_self() && ignore_self_ty.0 {
debug!("skipping self ty = {:?}", &ty); debug!("skipping self ty = {:?}", &ty);
continue; continue;
} }
@ -307,5 +314,4 @@ pub fn check_explicit_predicates<'tcx>(
debug!("predicate = {:?}", &predicate); debug!("predicate = {:?}", &predicate);
insert_outlives_predicate(tcx, predicate.0.into(), predicate.1, required_predicates); insert_outlives_predicate(tcx, predicate.0.into(), predicate.1, required_predicates);
} }
// }
} }

View file

@ -59,8 +59,7 @@ fn inferred_outlives_of<'a, 'tcx>(
ty::Predicate::TypeOutlives(p) => p.to_string(), ty::Predicate::TypeOutlives(p) => p.to_string(),
err => bug!("unexpected predicate {:?}", err), err => bug!("unexpected predicate {:?}", err),
}) }).collect();
.collect();
pred.sort(); pred.sort();
let span = tcx.def_span(item_def_id); let span = tcx.def_span(item_def_id);
@ -117,11 +116,9 @@ fn inferred_outlives_crate<'tcx>(
ty::Binder::bind(ty::OutlivesPredicate(region1, region2)), ty::Binder::bind(ty::OutlivesPredicate(region1, region2)),
), ),
}, },
) ).collect();
.collect();
(def_id, Lrc::new(vec)) (def_id, Lrc::new(vec))
}) }).collect();
.collect();
let empty_predicate = Lrc::new(Vec::new()); let empty_predicate = Lrc::new(Vec::new());

View file

@ -17,6 +17,7 @@
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(box_syntax)] #![feature(box_syntax)]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![feature(set_stdio)] #![feature(set_stdio)]
#![feature(slice_sort_by_cached_key)] #![feature(slice_sort_by_cached_key)]
#![feature(test)] #![feature(test)]

View file

@ -25,6 +25,7 @@ Core encoding and decoding interfaces.
#![feature(specialization)] #![feature(specialization)]
#![feature(never_type)] #![feature(never_type)]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![cfg_attr(test, feature(test))] #![cfg_attr(test, feature(test))]
pub use self::serialize::{Decoder, Encoder, Decodable, Encodable}; pub use self::serialize::{Decoder, Encoder, Decodable, Encodable};

View file

@ -273,6 +273,7 @@
#![feature(needs_panic_runtime)] #![feature(needs_panic_runtime)]
#![feature(never_type)] #![feature(never_type)]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![feature(exhaustive_patterns)] #![feature(exhaustive_patterns)]
#![feature(on_unimplemented)] #![feature(on_unimplemented)]
#![feature(optin_builtin_traits)] #![feature(optin_builtin_traits)]

View file

@ -22,6 +22,7 @@
#![feature(crate_visibility_modifier)] #![feature(crate_visibility_modifier)]
#![feature(macro_at_most_once_rep)] #![feature(macro_at_most_once_rep)]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
#![feature(rustc_diagnostic_macros)] #![feature(rustc_diagnostic_macros)]
#![feature(slice_sort_by_cached_key)] #![feature(slice_sort_by_cached_key)]

View file

@ -17,6 +17,7 @@
#![feature(proc_macro_internals)] #![feature(proc_macro_internals)]
#![feature(decl_macro)] #![feature(decl_macro)]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![feature(str_escape)] #![feature(str_escape)]
#![feature(rustc_diagnostic_macros)] #![feature(rustc_diagnostic_macros)]

View file

@ -22,6 +22,7 @@
#![feature(crate_visibility_modifier)] #![feature(crate_visibility_modifier)]
#![feature(custom_attribute)] #![feature(custom_attribute)]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![feature(non_exhaustive)] #![feature(non_exhaustive)]
#![feature(optin_builtin_traits)] #![feature(optin_builtin_traits)]
#![feature(specialization)] #![feature(specialization)]

View file

@ -51,6 +51,7 @@
// Handle rustfmt skips // Handle rustfmt skips
#![feature(custom_attribute)] #![feature(custom_attribute)]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![allow(unused_attributes)] #![allow(unused_attributes)]
use std::io::prelude::*; use std::io::prelude::*;

View file

@ -36,6 +36,7 @@
#![feature(fnbox)] #![feature(fnbox)]
#![cfg_attr(any(unix, target_os = "cloudabi"), feature(libc))] #![cfg_attr(any(unix, target_os = "cloudabi"), feature(libc))]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![feature(set_stdio)] #![feature(set_stdio)]
#![feature(panic_unwind)] #![feature(panic_unwind)]
#![feature(staged_api)] #![feature(staged_api)]

View file

@ -14,6 +14,7 @@
#![feature(cfg_target_vendor)] #![feature(cfg_target_vendor)]
#![feature(link_cfg)] #![feature(link_cfg)]
#![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(not(stage0), feature(infer_outlives_requirements))]
#![feature(staged_api)] #![feature(staged_api)]
#![feature(unwind_attributes)] #![feature(unwind_attributes)]
#![feature(static_nobundle)] #![feature(static_nobundle)]

View file

@ -0,0 +1,21 @@
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
//compile-pass
#![feature(infer_outlives_requirements)]
struct Foo {
bar: for<'r> Fn(usize, &'r FnMut())
}
fn main() {
}