From 3860eabbb64d2b53b1a05bd4dba96ac7751441f3 Mon Sep 17 00:00:00 2001 From: toidiu Date: Thu, 16 Aug 2018 20:12:28 -0400 Subject: [PATCH 1/5] fix for late-bound regions --- .../outlives/implicit_infer.rs | 30 +++++++++++++------ src/librustc_typeck/outlives/mod.rs | 9 ++---- src/test/ui/issue-53419.rs | 21 +++++++++++++ 3 files changed, 45 insertions(+), 15 deletions(-) create mode 100644 src/test/ui/issue-53419.rs diff --git a/src/librustc_typeck/outlives/implicit_infer.rs b/src/librustc_typeck/outlives/implicit_infer.rs index ec36fa0fbc145..8ab9686f6f834 100644 --- a/src/librustc_typeck/outlives/implicit_infer.rs +++ b/src/librustc_typeck/outlives/implicit_infer.rs @@ -12,7 +12,7 @@ use rustc::hir; use rustc::hir::def_id::DefId; use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::ty::subst::{Kind, Subst, UnpackedKind}; -use rustc::ty::{self, Ty, TyCtxt}; +use rustc::ty::{self, Ty, TyCtxt, TypeFoldable}; use rustc::util::nodemap::FxHashMap; use super::explicit::ExplicitPredicatesMap; @@ -208,14 +208,26 @@ fn insert_required_predicates_to_be_wf<'tcx>( debug!("field_ty = {}", &field_ty); debug!("ty in field = {}", &ty); if let Some(ex_trait_ref) = obj.principal() { - check_explicit_predicates( - tcx, - &ex_trait_ref.skip_binder().def_id, - ex_trait_ref.with_self_ty(tcx, ty).skip_binder().substs, - required_predicates, - explicit_map, - true, - ); + // The method `has_escaping_regions` checks if + // there are any late-bound regions, which is + // the lifetime `'r`. It is safe to ignore + // these since `'r` is not in scope for `Foo`. + // + // ``` + // struct Foo { + // bar: for<'r> Fn(usize, &'r FnMut()) + // } + // ``` + if !ty.has_escaping_regions() { + check_explicit_predicates( + tcx, + &ex_trait_ref.skip_binder().def_id, + ex_trait_ref.with_self_ty(tcx, ty).skip_binder().substs, + required_predicates, + explicit_map, + true, + ); + } } } diff --git a/src/librustc_typeck/outlives/mod.rs b/src/librustc_typeck/outlives/mod.rs index 74ef62e0c63c6..1b6d51d2b0280 100644 --- a/src/librustc_typeck/outlives/mod.rs +++ b/src/librustc_typeck/outlives/mod.rs @@ -59,8 +59,7 @@ fn inferred_outlives_of<'a, 'tcx>( ty::Predicate::TypeOutlives(p) => p.to_string(), err => bug!("unexpected predicate {:?}", err), - }) - .collect(); + }).collect(); pred.sort(); let span = tcx.def_span(item_def_id); @@ -117,11 +116,9 @@ fn inferred_outlives_crate<'tcx>( ty::Binder::bind(ty::OutlivesPredicate(region1, region2)), ), }, - ) - .collect(); + ).collect(); (def_id, Lrc::new(vec)) - }) - .collect(); + }).collect(); let empty_predicate = Lrc::new(Vec::new()); diff --git a/src/test/ui/issue-53419.rs b/src/test/ui/issue-53419.rs new file mode 100644 index 0000000000000..e4ade1b6323b7 --- /dev/null +++ b/src/test/ui/issue-53419.rs @@ -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 or the MIT license +// , 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() { +} + From cb3324851c3f8279c7569375bb2efeb880bf67bb Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Thu, 23 Aug 2018 14:07:28 -0400 Subject: [PATCH 2/5] use `usize` for self instead of `ty` --- .../outlives/implicit_infer.rs | 55 ++++++++----------- 1 file changed, 24 insertions(+), 31 deletions(-) diff --git a/src/librustc_typeck/outlives/implicit_infer.rs b/src/librustc_typeck/outlives/implicit_infer.rs index 8ab9686f6f834..3ecb5e6d296e3 100644 --- a/src/librustc_typeck/outlives/implicit_infer.rs +++ b/src/librustc_typeck/outlives/implicit_infer.rs @@ -12,7 +12,7 @@ use rustc::hir; use rustc::hir::def_id::DefId; use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::ty::subst::{Kind, Subst, UnpackedKind}; -use rustc::ty::{self, Ty, TyCtxt, TypeFoldable}; +use rustc::ty::{self, Ty, TyCtxt}; use rustc::util::nodemap::FxHashMap; use super::explicit::ExplicitPredicatesMap; @@ -191,7 +191,7 @@ fn insert_required_predicates_to_be_wf<'tcx>( substs, required_predicates, explicit_map, - false, + IgnoreSelfTy(false), ); } @@ -199,35 +199,27 @@ fn insert_required_predicates_to_be_wf<'tcx>( // This corresponds to `dyn Trait<..>`. In this case, we should // 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!("field_ty = {}", &field_ty); debug!("ty in field = {}", &ty); if let Some(ex_trait_ref) = obj.principal() { - // The method `has_escaping_regions` checks if - // there are any late-bound regions, which is - // the lifetime `'r`. It is safe to ignore - // these since `'r` is not in scope for `Foo`. - // - // ``` - // struct Foo { - // bar: for<'r> Fn(usize, &'r FnMut()) - // } - // ``` - if !ty.has_escaping_regions() { - check_explicit_predicates( - tcx, - &ex_trait_ref.skip_binder().def_id, - ex_trait_ref.with_self_ty(tcx, ty).skip_binder().substs, - required_predicates, - explicit_map, - true, - ); - } + // 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( + tcx, + &ex_trait_ref.skip_binder().def_id, + substs, + required_predicates, + explicit_map, + IgnoreSelfTy(true), + ); } } @@ -241,7 +233,7 @@ fn insert_required_predicates_to_be_wf<'tcx>( obj.substs, required_predicates, explicit_map, - false, + IgnoreSelfTy(false), ); } @@ -250,6 +242,8 @@ fn insert_required_predicates_to_be_wf<'tcx>( } } +pub struct IgnoreSelfTy(bool); + /// We also have to check the explicit predicates /// declared on the type. /// @@ -271,7 +265,7 @@ pub fn check_explicit_predicates<'tcx>( substs: &[Kind<'tcx>], required_predicates: &mut RequiredPredicates<'tcx>, explicit_map: &mut ExplicitPredicatesMap<'tcx>, - ignore_self_ty: bool, + ignore_self_ty: IgnoreSelfTy, ) { debug!("def_id = {:?}", &def_id); debug!("substs = {:?}", &substs); @@ -309,7 +303,7 @@ pub fn check_explicit_predicates<'tcx>( // to apply the substs, and not filter this predicate, we might then falsely // conclude that e.g. `X: 'x` was a reasonable inferred requirement. 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); continue; } @@ -319,5 +313,4 @@ pub fn check_explicit_predicates<'tcx>( debug!("predicate = {:?}", &predicate); insert_outlives_predicate(tcx, predicate.0.into(), predicate.1, required_predicates); } - // } } From 46bb36da80923544a90fb4cb1d2fb32fce904732 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Thu, 23 Aug 2018 17:05:38 -0400 Subject: [PATCH 3/5] implicit_infer: apply rustfmt --- src/librustc_typeck/outlives/implicit_infer.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/librustc_typeck/outlives/implicit_infer.rs b/src/librustc_typeck/outlives/implicit_infer.rs index 3ecb5e6d296e3..46934d7bca711 100644 --- a/src/librustc_typeck/outlives/implicit_infer.rs +++ b/src/librustc_typeck/outlives/implicit_infer.rs @@ -65,8 +65,7 @@ impl<'cx, 'tcx> ItemLikeVisitor<'tcx> for InferVisitor<'cx, 'tcx> { debug!("InferVisitor::visit_item(item={:?})", item_did); - let node_id = self - .tcx + let node_id = self.tcx .hir .as_local_node_id(item_did) .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 // we walk the crates again and re-calculate predicates for all // items. - let item_predicates_len: usize = self - .global_inferred_outlives + let item_predicates_len: usize = self.global_inferred_outlives .get(&item_did) .map(|p| p.len()) .unwrap_or(0); @@ -211,7 +209,10 @@ fn insert_required_predicates_to_be_wf<'tcx>( // 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; + let substs = ex_trait_ref + .with_self_ty(tcx, tcx.types.usize) + .skip_binder() + .substs; check_explicit_predicates( tcx, &ex_trait_ref.skip_binder().def_id, From 73fb1622b303c67f9e87da87f39ccacea322b5f9 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Fri, 24 Aug 2018 17:10:50 -0400 Subject: [PATCH 4/5] check that adding infer-outlives requirement to all crates works --- src/liballoc/lib.rs | 1 + src/liballoc_jemalloc/lib.rs | 1 + src/liballoc_system/lib.rs | 1 + src/libarena/lib.rs | 1 + src/libcore/lib.rs | 1 + src/libfmt_macros/lib.rs | 1 + src/libgraphviz/lib.rs | 1 + src/libpanic_abort/lib.rs | 1 + src/libpanic_unwind/lib.rs | 1 + src/libproc_macro/lib.rs | 1 + src/libprofiler_builtins/lib.rs | 1 + src/librustc/lib.rs | 1 + src/librustc_allocator/lib.rs | 1 + src/librustc_apfloat/lib.rs | 1 + src/librustc_asan/lib.rs | 1 + src/librustc_borrowck/lib.rs | 1 + src/librustc_codegen_llvm/lib.rs | 1 + src/librustc_codegen_utils/lib.rs | 1 + src/librustc_cratesio_shim/src/lib.rs | 1 + src/librustc_data_structures/lib.rs | 1 + src/librustc_driver/lib.rs | 1 + src/librustc_errors/lib.rs | 1 + src/librustc_incremental/lib.rs | 1 + src/librustc_lint/lib.rs | 1 + src/librustc_llvm/lib.rs | 1 + src/librustc_lsan/lib.rs | 1 + src/librustc_metadata/lib.rs | 1 + src/librustc_mir/lib.rs | 1 + src/librustc_msan/lib.rs | 1 + src/librustc_passes/lib.rs | 1 + src/librustc_platform_intrinsics/lib.rs | 1 + src/librustc_plugin/lib.rs | 1 + src/librustc_privacy/lib.rs | 1 + src/librustc_resolve/lib.rs | 1 + src/librustc_save_analysis/lib.rs | 1 + src/librustc_target/lib.rs | 1 + src/librustc_traits/lib.rs | 1 + src/librustc_tsan/lib.rs | 1 + src/librustc_typeck/lib.rs | 1 + src/librustdoc/lib.rs | 1 + src/libserialize/lib.rs | 1 + src/libstd/lib.rs | 1 + src/libsyntax/lib.rs | 1 + src/libsyntax_ext/lib.rs | 1 + src/libsyntax_pos/lib.rs | 1 + src/libterm/lib.rs | 1 + src/libtest/lib.rs | 1 + src/libunwind/lib.rs | 1 + 48 files changed, 48 insertions(+) diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index bcdfd8c9aa5d5..18d8cd773eba9 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -77,6 +77,7 @@ #![cfg_attr(not(test), feature(fn_traits))] #![cfg_attr(not(test), feature(generator_trait))] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![cfg_attr(test, feature(test))] #![feature(allocator_api)] diff --git a/src/liballoc_jemalloc/lib.rs b/src/liballoc_jemalloc/lib.rs index 480a24b9bd1f2..cfc8ef8e9e356 100644 --- a/src/liballoc_jemalloc/lib.rs +++ b/src/liballoc_jemalloc/lib.rs @@ -17,6 +17,7 @@ #![feature(libc)] #![feature(linkage)] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![feature(staged_api)] #![feature(rustc_attrs)] #![cfg_attr(dummy_jemalloc, allow(dead_code, unused_extern_crates))] diff --git a/src/liballoc_system/lib.rs b/src/liballoc_system/lib.rs index 753b6a5e29248..ffab9e8e4af3c 100644 --- a/src/liballoc_system/lib.rs +++ b/src/liballoc_system/lib.rs @@ -18,6 +18,7 @@ #![feature(allocator_api)] #![feature(core_intrinsics)] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![feature(staged_api)] #![feature(rustc_attrs)] #![cfg_attr(any(unix, target_os = "cloudabi", target_os = "redox"), feature(libc))] diff --git a/src/libarena/lib.rs b/src/libarena/lib.rs index 6ad703180c224..5cb8975e9ce97 100644 --- a/src/libarena/lib.rs +++ b/src/libarena/lib.rs @@ -27,6 +27,7 @@ #![feature(core_intrinsics)] #![feature(dropck_eyepatch)] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![feature(raw_vec_internals)] #![cfg_attr(test, feature(test))] diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index e85bf1dfcad23..05a1bcb426892 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -93,6 +93,7 @@ #![feature(link_llvm_intrinsics)] #![feature(never_type)] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![feature(exhaustive_patterns)] #![feature(macro_at_most_once_rep)] #![feature(no_core)] diff --git a/src/libfmt_macros/lib.rs b/src/libfmt_macros/lib.rs index 1bac6d22d3744..3720100700c9c 100644 --- a/src/libfmt_macros/lib.rs +++ b/src/libfmt_macros/lib.rs @@ -21,6 +21,7 @@ test(attr(deny(warnings))))] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] pub use self::Piece::*; pub use self::Position::*; diff --git a/src/libgraphviz/lib.rs b/src/libgraphviz/lib.rs index 9fa48adebdf07..5a0c983b521a5 100644 --- a/src/libgraphviz/lib.rs +++ b/src/libgraphviz/lib.rs @@ -289,6 +289,7 @@ test(attr(allow(unused_variables), deny(warnings))))] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![feature(str_escape)] use self::LabelText::*; diff --git a/src/libpanic_abort/lib.rs b/src/libpanic_abort/lib.rs index da568fae70e14..9d88ebc55d602 100644 --- a/src/libpanic_abort/lib.rs +++ b/src/libpanic_abort/lib.rs @@ -25,6 +25,7 @@ #![feature(core_intrinsics)] #![feature(libc)] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![feature(panic_runtime)] #![feature(staged_api)] #![feature(rustc_attrs)] diff --git a/src/libpanic_unwind/lib.rs b/src/libpanic_unwind/lib.rs index 9c3fc76c307a6..3368790b3f76f 100644 --- a/src/libpanic_unwind/lib.rs +++ b/src/libpanic_unwind/lib.rs @@ -35,6 +35,7 @@ #![feature(lang_items)] #![feature(libc)] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![feature(panic_unwind)] #![feature(raw)] #![feature(staged_api)] diff --git a/src/libproc_macro/lib.rs b/src/libproc_macro/lib.rs index 656819880b135..8c667d2f87111 100644 --- a/src/libproc_macro/lib.rs +++ b/src/libproc_macro/lib.rs @@ -32,6 +32,7 @@ test(attr(allow(dead_code, deprecated, unused_variables, unused_mut))))] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![feature(rustc_private)] #![feature(staged_api)] #![feature(lang_items)] diff --git a/src/libprofiler_builtins/lib.rs b/src/libprofiler_builtins/lib.rs index a85593253b100..00dd87022c268 100644 --- a/src/libprofiler_builtins/lib.rs +++ b/src/libprofiler_builtins/lib.rs @@ -16,4 +16,5 @@ issue = "0")] #![allow(unused_features)] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![feature(staged_api)] diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index d43ebf8d415a7..d4caf9883132c 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -52,6 +52,7 @@ #![feature(exhaustive_patterns)] #![feature(extern_types)] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![feature(non_exhaustive)] #![feature(proc_macro_internals)] #![feature(quote)] diff --git a/src/librustc_allocator/lib.rs b/src/librustc_allocator/lib.rs index 2a3404ee83034..44fbcade6bc06 100644 --- a/src/librustc_allocator/lib.rs +++ b/src/librustc_allocator/lib.rs @@ -9,6 +9,7 @@ // except according to those terms. #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![feature(rustc_private)] #[macro_use] extern crate log; diff --git a/src/librustc_apfloat/lib.rs b/src/librustc_apfloat/lib.rs index d6e821d427d05..c3c32ba7d5b6c 100644 --- a/src/librustc_apfloat/lib.rs +++ b/src/librustc_apfloat/lib.rs @@ -46,6 +46,7 @@ #![forbid(unsafe_code)] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![feature(try_from)] // See librustc_cratesio_shim/Cargo.toml for a comment explaining this. #[allow(unused_extern_crates)] diff --git a/src/librustc_asan/lib.rs b/src/librustc_asan/lib.rs index b3ba86ad8a4b3..ed8fd305977e5 100644 --- a/src/librustc_asan/lib.rs +++ b/src/librustc_asan/lib.rs @@ -11,6 +11,7 @@ #![sanitizer_runtime] #![feature(alloc_system)] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![feature(sanitizer_runtime)] #![feature(staged_api)] #![no_std] diff --git a/src/librustc_borrowck/lib.rs b/src/librustc_borrowck/lib.rs index 16da8c8a3b8bf..edd837e9401a7 100644 --- a/src/librustc_borrowck/lib.rs +++ b/src/librustc_borrowck/lib.rs @@ -15,6 +15,7 @@ #![allow(non_camel_case_types)] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![feature(quote)] #![recursion_limit="256"] diff --git a/src/librustc_codegen_llvm/lib.rs b/src/librustc_codegen_llvm/lib.rs index 03a2e0a82cf10..31eeb5633fba9 100644 --- a/src/librustc_codegen_llvm/lib.rs +++ b/src/librustc_codegen_llvm/lib.rs @@ -27,6 +27,7 @@ #![allow(unused_attributes)] #![feature(libc)] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![feature(quote)] #![feature(range_contains)] #![feature(rustc_diagnostic_macros)] diff --git a/src/librustc_codegen_utils/lib.rs b/src/librustc_codegen_utils/lib.rs index 635819e94e867..45db22ec6dabc 100644 --- a/src/librustc_codegen_utils/lib.rs +++ b/src/librustc_codegen_utils/lib.rs @@ -20,6 +20,7 @@ #![feature(box_syntax)] #![feature(custom_attribute)] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![allow(unused_attributes)] #![feature(quote)] #![feature(rustc_diagnostic_macros)] diff --git a/src/librustc_cratesio_shim/src/lib.rs b/src/librustc_cratesio_shim/src/lib.rs index 39087c5f74616..481f2f54c5e44 100644 --- a/src/librustc_cratesio_shim/src/lib.rs +++ b/src/librustc_cratesio_shim/src/lib.rs @@ -12,6 +12,7 @@ #![allow(unused_extern_crates)] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] extern crate bitflags; extern crate log; diff --git a/src/librustc_data_structures/lib.rs b/src/librustc_data_structures/lib.rs index 1eef7870c01b4..533b7f5e0af05 100644 --- a/src/librustc_data_structures/lib.rs +++ b/src/librustc_data_structures/lib.rs @@ -27,6 +27,7 @@ #![feature(optin_builtin_traits)] #![cfg_attr(stage0, feature(macro_vis_matcher))] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![feature(allow_internal_unstable)] #![feature(vec_resize_with)] diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index f88c619bf7791..164bf01b0d77b 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -21,6 +21,7 @@ #![feature(box_syntax)] #![cfg_attr(unix, feature(libc))] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![feature(option_replace)] #![feature(quote)] #![feature(rustc_diagnostic_macros)] diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs index 3582c2359c8b9..d31db4b2d00ac 100644 --- a/src/librustc_errors/lib.rs +++ b/src/librustc_errors/lib.rs @@ -17,6 +17,7 @@ #![feature(range_contains)] #![cfg_attr(unix, feature(libc))] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![feature(optin_builtin_traits)] extern crate atty; diff --git a/src/librustc_incremental/lib.rs b/src/librustc_incremental/lib.rs index ad8714fa4d52d..e100b49c7f244 100644 --- a/src/librustc_incremental/lib.rs +++ b/src/librustc_incremental/lib.rs @@ -15,6 +15,7 @@ html_root_url = "https://doc.rust-lang.org/nightly/")] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![feature(specialization)] #![recursion_limit="256"] diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs index 15eb4730c1d20..d135f09a62b49 100644 --- a/src/librustc_lint/lib.rs +++ b/src/librustc_lint/lib.rs @@ -28,6 +28,7 @@ #![feature(box_syntax)] #![cfg_attr(stage0, feature(macro_vis_matcher))] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![feature(quote)] #![feature(rustc_diagnostic_macros)] #![feature(macro_at_most_once_rep)] diff --git a/src/librustc_llvm/lib.rs b/src/librustc_llvm/lib.rs index 387660473a887..13605e993a59c 100644 --- a/src/librustc_llvm/lib.rs +++ b/src/librustc_llvm/lib.rs @@ -9,6 +9,7 @@ // except according to those terms. #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![feature(static_nobundle)] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", diff --git a/src/librustc_lsan/lib.rs b/src/librustc_lsan/lib.rs index b3ba86ad8a4b3..ed8fd305977e5 100644 --- a/src/librustc_lsan/lib.rs +++ b/src/librustc_lsan/lib.rs @@ -11,6 +11,7 @@ #![sanitizer_runtime] #![feature(alloc_system)] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![feature(sanitizer_runtime)] #![feature(staged_api)] #![no_std] diff --git a/src/librustc_metadata/lib.rs b/src/librustc_metadata/lib.rs index a3591b2415a89..19c59a8ccbca7 100644 --- a/src/librustc_metadata/lib.rs +++ b/src/librustc_metadata/lib.rs @@ -16,6 +16,7 @@ #![feature(libc)] #![feature(macro_at_most_once_rep)] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![feature(proc_macro_internals)] #![feature(proc_macro_quote)] #![feature(quote)] diff --git a/src/librustc_mir/lib.rs b/src/librustc_mir/lib.rs index 617efed31d913..a8fa69fb47109 100644 --- a/src/librustc_mir/lib.rs +++ b/src/librustc_mir/lib.rs @@ -15,6 +15,7 @@ Rust MIR: a lowered representation of Rust. Also: an experiment! */ #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![feature(infer_outlives_requirements)] #![feature(in_band_lifetimes)] #![feature(slice_patterns)] diff --git a/src/librustc_msan/lib.rs b/src/librustc_msan/lib.rs index b3ba86ad8a4b3..ed8fd305977e5 100644 --- a/src/librustc_msan/lib.rs +++ b/src/librustc_msan/lib.rs @@ -11,6 +11,7 @@ #![sanitizer_runtime] #![feature(alloc_system)] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![feature(sanitizer_runtime)] #![feature(staged_api)] #![no_std] diff --git a/src/librustc_passes/lib.rs b/src/librustc_passes/lib.rs index d62cb00923f70..94ea229cbd91b 100644 --- a/src/librustc_passes/lib.rs +++ b/src/librustc_passes/lib.rs @@ -19,6 +19,7 @@ html_root_url = "https://doc.rust-lang.org/nightly/")] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![feature(rustc_diagnostic_macros)] #[macro_use] diff --git a/src/librustc_platform_intrinsics/lib.rs b/src/librustc_platform_intrinsics/lib.rs index d41f4cd61f763..62405150cd29a 100644 --- a/src/librustc_platform_intrinsics/lib.rs +++ b/src/librustc_platform_intrinsics/lib.rs @@ -11,6 +11,7 @@ #![allow(bad_style)] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] pub struct Intrinsic { pub inputs: &'static [&'static Type], diff --git a/src/librustc_plugin/lib.rs b/src/librustc_plugin/lib.rs index 67f53a67313f7..5b56266638552 100644 --- a/src/librustc_plugin/lib.rs +++ b/src/librustc_plugin/lib.rs @@ -65,6 +65,7 @@ html_root_url = "https://doc.rust-lang.org/nightly/")] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![feature(rustc_diagnostic_macros)] #[macro_use] extern crate syntax; diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index dd536d673cf4d..d7ad91ec2033d 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -13,6 +13,7 @@ html_root_url = "https://doc.rust-lang.org/nightly/")] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![feature(rustc_diagnostic_macros)] #![recursion_limit="256"] diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 3241459f64fd8..d7287812118aa 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -14,6 +14,7 @@ #![feature(crate_visibility_modifier)] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![feature(rustc_diagnostic_macros)] #![feature(slice_sort_by_cached_key)] diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs index 9facd39ebea21..df20fd106d805 100644 --- a/src/librustc_save_analysis/lib.rs +++ b/src/librustc_save_analysis/lib.rs @@ -13,6 +13,7 @@ html_root_url = "https://doc.rust-lang.org/nightly/")] #![feature(custom_attribute)] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![allow(unused_attributes)] #![recursion_limit="256"] diff --git a/src/librustc_target/lib.rs b/src/librustc_target/lib.rs index 5f5cc4c5ff7c8..1e70a806cce89 100644 --- a/src/librustc_target/lib.rs +++ b/src/librustc_target/lib.rs @@ -24,6 +24,7 @@ #![feature(box_syntax)] #![feature(const_fn)] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![feature(slice_patterns)] #[macro_use] diff --git a/src/librustc_traits/lib.rs b/src/librustc_traits/lib.rs index 700efbd6ba942..d61c34d1c0078 100644 --- a/src/librustc_traits/lib.rs +++ b/src/librustc_traits/lib.rs @@ -17,6 +17,7 @@ #![feature(iterator_find_map)] #![feature(in_band_lifetimes)] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![recursion_limit="256"] diff --git a/src/librustc_tsan/lib.rs b/src/librustc_tsan/lib.rs index b3ba86ad8a4b3..ed8fd305977e5 100644 --- a/src/librustc_tsan/lib.rs +++ b/src/librustc_tsan/lib.rs @@ -11,6 +11,7 @@ #![sanitizer_runtime] #![feature(alloc_system)] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![feature(sanitizer_runtime)] #![feature(staged_api)] #![no_std] diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index eddbac3f5417b..019d2de1cc7fc 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -77,6 +77,7 @@ This API is completely unstable and subject to change. #![feature(exhaustive_patterns)] #![feature(iterator_find_map)] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![feature(quote)] #![feature(refcell_replace_swap)] #![feature(rustc_diagnostic_macros)] diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index a8ae6a94d5c4d..0611073daa6c4 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -18,6 +18,7 @@ #![feature(box_syntax)] #![feature(iterator_find_map)] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![feature(set_stdio)] #![feature(slice_sort_by_cached_key)] #![feature(test)] diff --git a/src/libserialize/lib.rs b/src/libserialize/lib.rs index 1f6ee3d867b17..e87c2793ee867 100644 --- a/src/libserialize/lib.rs +++ b/src/libserialize/lib.rs @@ -25,6 +25,7 @@ Core encoding and decoding interfaces. #![feature(specialization)] #![feature(never_type)] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![cfg_attr(test, feature(test))] pub use self::serialize::{Decoder, Encoder, Decodable, Encodable}; diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index ade297219d221..d187ea74325df 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -274,6 +274,7 @@ #![feature(needs_panic_runtime)] #![feature(never_type)] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![feature(exhaustive_patterns)] #![feature(on_unimplemented)] #![feature(optin_builtin_traits)] diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 2aaab6aaa16d9..c8ec273a03f28 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -22,6 +22,7 @@ #![feature(crate_visibility_modifier)] #![feature(macro_at_most_once_rep)] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![feature(rustc_attrs)] #![feature(rustc_diagnostic_macros)] #![feature(slice_sort_by_cached_key)] diff --git a/src/libsyntax_ext/lib.rs b/src/libsyntax_ext/lib.rs index 790a42007fb1d..84436b4e4eacf 100644 --- a/src/libsyntax_ext/lib.rs +++ b/src/libsyntax_ext/lib.rs @@ -17,6 +17,7 @@ #![feature(proc_macro_internals)] #![feature(decl_macro)] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![feature(str_escape)] #![feature(rustc_diagnostic_macros)] diff --git a/src/libsyntax_pos/lib.rs b/src/libsyntax_pos/lib.rs index bd70344b01812..a493ea4f565ea 100644 --- a/src/libsyntax_pos/lib.rs +++ b/src/libsyntax_pos/lib.rs @@ -22,6 +22,7 @@ #![feature(crate_visibility_modifier)] #![feature(custom_attribute)] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![feature(non_exhaustive)] #![feature(optin_builtin_traits)] #![feature(specialization)] diff --git a/src/libterm/lib.rs b/src/libterm/lib.rs index a49fd67639dbe..df90be6393743 100644 --- a/src/libterm/lib.rs +++ b/src/libterm/lib.rs @@ -51,6 +51,7 @@ // Handle rustfmt skips #![feature(custom_attribute)] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![allow(unused_attributes)] use std::io::prelude::*; diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index 060ea1ea9b132..29d7cfd2a3a21 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -36,6 +36,7 @@ #![feature(fnbox)] #![cfg_attr(any(unix, target_os = "cloudabi"), feature(libc))] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![feature(set_stdio)] #![feature(panic_unwind)] #![feature(staged_api)] diff --git a/src/libunwind/lib.rs b/src/libunwind/lib.rs index 424a7e3d009ec..3b94dc238d91c 100644 --- a/src/libunwind/lib.rs +++ b/src/libunwind/lib.rs @@ -14,6 +14,7 @@ #![feature(cfg_target_vendor)] #![feature(link_cfg)] #![cfg_attr(not(stage0), feature(nll))] +#![cfg_attr(not(stage0), feature(infer_outlives_requirements))] #![feature(staged_api)] #![feature(unwind_attributes)] #![feature(static_nobundle)] From c63b633971a1cb0201b6747ddea2b7c7f82a57b7 Mon Sep 17 00:00:00 2001 From: toidiu Date: Fri, 24 Aug 2018 21:38:53 -0400 Subject: [PATCH 5/5] remove dupe attribute --- src/librustc_mir/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/librustc_mir/lib.rs b/src/librustc_mir/lib.rs index a8fa69fb47109..da29c900b8f2d 100644 --- a/src/librustc_mir/lib.rs +++ b/src/librustc_mir/lib.rs @@ -16,7 +16,6 @@ Rust MIR: a lowered representation of Rust. Also: an experiment! #![cfg_attr(not(stage0), feature(nll))] #![cfg_attr(not(stage0), feature(infer_outlives_requirements))] -#![feature(infer_outlives_requirements)] #![feature(in_band_lifetimes)] #![feature(slice_patterns)] #![feature(slice_sort_by_cached_key)]