From d5e819015f550bedb27bc287f96f3937bb831cd5 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Tue, 7 May 2019 13:32:07 +0200 Subject: [PATCH 1/5] Add a `cast` method to raw pointers. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is similar to `NonNull::cast`. Compared to the `as` operator (which has a wide range of meanings depending on the input and output types), a call to this method: * Can only go from a raw pointer to a raw pointer * Cannot change the pointer’s `const`ness … even when the pointed types are inferred based on context. --- src/libcore/ptr.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index a41be4269d504..6355bcdcab2fa 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -974,6 +974,13 @@ impl *const T { (self as *const u8) == null() } + /// Cast to a pointer to a different type + #[unstable(feature = "ptr_cast", issue = "60602")] + #[inline] + pub const fn cast(self) -> *const U { + self as _ + } + /// Returns `None` if the pointer is null, or else returns a reference to /// the value wrapped in `Some`. /// @@ -1593,6 +1600,13 @@ impl *mut T { (self as *mut u8) == null_mut() } + /// Cast to a pointer to a different type + #[unstable(feature = "ptr_cast", issue = "60602")] + #[inline] + pub const fn cast(self) -> *mut U { + self as _ + } + /// Returns `None` if the pointer is null, or else returns a reference to /// the value wrapped in `Some`. /// From cf0f2b041be6f580c18f7925551528bb1df564d8 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Wed, 8 May 2019 17:20:43 +0200 Subject: [PATCH 2/5] pin: make the to-module link more visible --- src/libcore/pin.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcore/pin.rs b/src/libcore/pin.rs index e74ed9b7889cb..4ced860948bee 100644 --- a/src/libcore/pin.rs +++ b/src/libcore/pin.rs @@ -274,7 +274,7 @@ use crate::ops::{Deref, DerefMut, Receiver, CoerceUnsized, DispatchFromDyn}; /// value in place, preventing the value referenced by that pointer from being moved /// unless it implements [`Unpin`]. /// -/// See the [`pin` module] documentation for further explanation on pinning. +/// *See the [`pin` module] documentation for an explanation of pinning.* /// /// [`Unpin`]: ../../std/marker/trait.Unpin.html /// [`pin` module]: ../../std/pin/index.html From ee6d31520071b38f9a2996d60a66d6e2cd965fe7 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Wed, 8 May 2019 22:07:12 +0300 Subject: [PATCH 3/5] cleanup: Remove `DefIndexAddressSpace` --- src/librustc/hir/def_id.rs | 67 ++------ src/librustc/hir/lowering.rs | 5 +- src/librustc/hir/map/collector.rs | 9 +- src/librustc/hir/map/def_collector.rs | 36 ++-- src/librustc/hir/map/definitions.rs | 159 ++++++------------ src/librustc/hir/map/mod.rs | 52 +++--- src/librustc/traits/specialize/mod.rs | 4 +- src/librustc_driver/pretty.rs | 3 +- src/librustc_metadata/decoder.rs | 6 +- src/librustc_metadata/index.rs | 34 ++-- src/librustc_metadata/index_builder.rs | 2 +- src/librustc_mir/util/graphviz.rs | 3 +- src/librustc_resolve/lib.rs | 2 +- src/librustc_resolve/macros.rs | 6 +- src/librustdoc/core.rs | 15 +- src/test/mir-opt/graphviz.rs | 2 +- .../mir-opt/inline-closure-borrows-arg.rs | 2 +- src/test/mir-opt/inline-closure.rs | 2 +- src/test/mir-opt/retag.rs | 2 +- .../escape-argument-callee.stderr | 6 +- .../escape-argument.stderr | 6 +- .../escape-upvar-nested.stderr | 6 +- .../escape-upvar-ref.stderr | 4 +- ...pagate-approximated-fail-no-postdom.stderr | 6 +- .../propagate-approximated-ref.stderr | 6 +- ...er-to-static-comparing-against-free.stderr | 12 +- ...oximated-shorter-to-static-no-bound.stderr | 6 +- ...mated-shorter-to-static-wrong-bound.stderr | 6 +- .../propagate-approximated-val.stderr | 6 +- .../propagate-despite-same-free-region.stderr | 6 +- ...ail-to-approximate-longer-no-bounds.stderr | 6 +- ...-to-approximate-longer-wrong-bounds.stderr | 6 +- .../propagate-from-trait-match.stderr | 4 +- .../return-wrong-bound-region.stderr | 6 +- .../projection-no-regions-closure.stderr | 16 +- .../projection-one-region-closure.stderr | 18 +- ...tion-one-region-trait-bound-closure.stderr | 20 +-- ...e-region-trait-bound-static-closure.stderr | 20 +-- ...tion-two-region-trait-bound-closure.stderr | 34 ++-- ...ram-closure-approximate-lower-bound.stderr | 14 +- ...m-closure-outlives-from-return-type.stderr | 4 +- ...-closure-outlives-from-where-clause.stderr | 20 +-- 42 files changed, 246 insertions(+), 403 deletions(-) diff --git a/src/librustc/hir/def_id.rs b/src/librustc/hir/def_id.rs index 8536f38e48c6d..b268a1a494d10 100644 --- a/src/librustc/hir/def_id.rs +++ b/src/librustc/hir/def_id.rs @@ -1,5 +1,5 @@ use crate::ty::{self, TyCtxt}; -use crate::hir::map::definitions::FIRST_FREE_HIGH_DEF_INDEX; +use crate::hir::map::definitions::FIRST_FREE_DEF_INDEX; use rustc_data_structures::indexed_vec::Idx; use serialize; use std::fmt; @@ -99,17 +99,6 @@ impl serialize::UseSpecializedDecodable for CrateNum {} /// A DefIndex is an index into the hir-map for a crate, identifying a /// particular definition. It should really be considered an interned /// shorthand for a particular DefPath. -/// -/// At the moment we are allocating the numerical values of DefIndexes from two -/// address spaces: DefIndexAddressSpace::Low and DefIndexAddressSpace::High. -/// This allows us to allocate the DefIndexes of all item-likes -/// (Items, TraitItems, and ImplItems) into one of these spaces and -/// consequently use a simple array for lookup tables keyed by DefIndex and -/// known to be densely populated. This is especially important for the HIR map. -/// -/// Since the DefIndex is mostly treated as an opaque ID, you probably -/// don't have to care about these address spaces. - #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Copy)] pub struct DefIndex(u32); @@ -119,33 +108,20 @@ pub const CRATE_DEF_INDEX: DefIndex = DefIndex(0); impl fmt::Debug for DefIndex { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, - "DefIndex({}:{})", - self.address_space().index(), - self.as_array_index()) + write!(f, "DefIndex({})", self.as_array_index()) } } impl DefIndex { - #[inline] - pub fn address_space(&self) -> DefIndexAddressSpace { - match self.0 & 1 { - 0 => DefIndexAddressSpace::Low, - 1 => DefIndexAddressSpace::High, - _ => unreachable!() - } - } - /// Converts this DefIndex into a zero-based array index. - /// This index is the offset within the given DefIndexAddressSpace. #[inline] pub fn as_array_index(&self) -> usize { - (self.0 >> 1) as usize + self.0 as usize } #[inline] - pub fn from_array_index(i: usize, address_space: DefIndexAddressSpace) -> DefIndex { - DefIndex::from_raw_u32(((i << 1) | (address_space as usize)) as u32) + pub fn from_array_index(i: usize) -> DefIndex { + DefIndex(i as u32) } // Proc macros from a proc-macro crate have a kind of virtual DefIndex. This @@ -153,33 +129,28 @@ impl DefIndex { // index of the macro in the CrateMetadata::proc_macros array) to the // corresponding DefIndex. pub fn from_proc_macro_index(proc_macro_index: usize) -> DefIndex { - // DefIndex for proc macros start from FIRST_FREE_HIGH_DEF_INDEX, - // because the first FIRST_FREE_HIGH_DEF_INDEX indexes are reserved + // DefIndex for proc macros start from FIRST_FREE_DEF_INDEX, + // because the first FIRST_FREE_DEF_INDEX indexes are reserved // for internal use. let def_index = DefIndex::from_array_index( - proc_macro_index.checked_add(FIRST_FREE_HIGH_DEF_INDEX) - .expect("integer overflow adding `proc_macro_index`"), - DefIndexAddressSpace::High); + proc_macro_index.checked_add(FIRST_FREE_DEF_INDEX) + .expect("integer overflow adding `proc_macro_index`")); assert!(def_index != CRATE_DEF_INDEX); def_index } // This function is the reverse of from_proc_macro_index() above. pub fn to_proc_macro_index(self: DefIndex) -> usize { - assert_eq!(self.address_space(), DefIndexAddressSpace::High); - - self.as_array_index().checked_sub(FIRST_FREE_HIGH_DEF_INDEX) + self.as_array_index().checked_sub(FIRST_FREE_DEF_INDEX) .unwrap_or_else(|| { bug!("using local index {:?} as proc-macro index", self) }) } - // Don't use this if you don't know about the DefIndex encoding. pub fn from_raw_u32(x: u32) -> DefIndex { DefIndex(x) } - // Don't use this if you don't know about the DefIndex encoding. pub fn as_raw_u32(&self) -> u32 { self.0 } @@ -188,19 +159,6 @@ impl DefIndex { impl serialize::UseSpecializedEncodable for DefIndex {} impl serialize::UseSpecializedDecodable for DefIndex {} -#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] -pub enum DefIndexAddressSpace { - Low = 0, - High = 1, -} - -impl DefIndexAddressSpace { - #[inline] - pub fn index(&self) -> usize { - *self as usize - } -} - /// A `DefId` identifies a particular *definition*, by combining a crate /// index and a def index. #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Copy)] @@ -211,10 +169,7 @@ pub struct DefId { impl fmt::Debug for DefId { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "DefId({}/{}:{}", - self.krate, - self.index.address_space().index(), - self.index.as_array_index())?; + write!(f, "DefId({}:{}", self.krate, self.index.as_array_index())?; ty::tls::with_opt(|opt_tcx| { if let Some(tcx) = opt_tcx { diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index 20e016b8b5b1e..848e9ca58e595 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -36,7 +36,7 @@ use crate::dep_graph::DepGraph; use crate::hir::{self, ParamName}; use crate::hir::HirVec; use crate::hir::map::{DefKey, DefPathData, Definitions}; -use crate::hir::def_id::{DefId, DefIndex, DefIndexAddressSpace, CRATE_DEF_INDEX}; +use crate::hir::def_id::{DefId, DefIndex, CRATE_DEF_INDEX}; use crate::hir::def::{Res, DefKind, PartialRes, PerNS}; use crate::hir::{GenericArg, ConstArg}; use crate::lint::builtin::{self, PARENTHESIZED_PARAMS_IN_TYPES_AND_MODULES, @@ -418,7 +418,6 @@ impl<'a> LoweringContext<'a> { owner, id, DefPathData::Misc, - DefIndexAddressSpace::High, Mark::root(), tree.prefix.span, ); @@ -962,7 +961,6 @@ impl<'a> LoweringContext<'a> { parent_index, node_id, DefPathData::LifetimeNs(str_name), - DefIndexAddressSpace::High, Mark::root(), span, ); @@ -1763,7 +1761,6 @@ impl<'a> LoweringContext<'a> { self.parent, def_node_id, DefPathData::LifetimeNs(name.ident().as_interned_str()), - DefIndexAddressSpace::High, Mark::root(), lifetime.span, ); diff --git a/src/librustc/hir/map/collector.rs b/src/librustc/hir/map/collector.rs index 136d683e76b48..a1cf338bf12ea 100644 --- a/src/librustc/hir/map/collector.rs +++ b/src/librustc/hir/map/collector.rs @@ -145,15 +145,10 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> { ); } - let (lo, hi) = definitions.def_index_counts_lo_hi(); - let mut collector = NodeCollector { krate, source_map: sess.source_map(), - map: [ - repeat(None).take(lo).collect(), - repeat(None).take(hi).collect(), - ], + map: vec![None; definitions.def_index_count()], parent_node: hir::CRATE_HIR_ID, current_signature_dep_index: root_mod_sig_dep_index, current_full_dep_index: root_mod_full_dep_index, @@ -231,7 +226,7 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> { fn insert_entry(&mut self, id: HirId, entry: Entry<'hir>) { debug!("hir_map: {:?} => {:?}", id, entry); - let local_map = &mut self.map[id.owner.address_space().index()][id.owner.as_array_index()]; + let local_map = &mut self.map[id.owner.as_array_index()]; let i = id.local_id.as_u32() as usize; if local_map.is_none() { *local_map = Some(IndexVec::with_capacity(i + 1)); diff --git a/src/librustc/hir/map/def_collector.rs b/src/librustc/hir/map/def_collector.rs index ddef64f27e810..6e7a8f5bc234f 100644 --- a/src/librustc/hir/map/def_collector.rs +++ b/src/librustc/hir/map/def_collector.rs @@ -1,5 +1,5 @@ use crate::hir::map::definitions::*; -use crate::hir::def_id::{CRATE_DEF_INDEX, DefIndex, DefIndexAddressSpace}; +use crate::hir::def_id::{CRATE_DEF_INDEX, DefIndex}; use crate::session::CrateDisambiguator; use syntax::ast::*; @@ -10,8 +10,6 @@ use syntax::symbol::Symbol; use syntax::parse::token::{self, Token}; use syntax_pos::Span; -use crate::hir::map::{ITEM_LIKE_SPACE, REGULAR_SPACE}; - /// Creates `DefId`s for nodes in the AST. pub struct DefCollector<'a> { definitions: &'a mut Definitions, @@ -47,13 +45,12 @@ impl<'a> DefCollector<'a> { fn create_def(&mut self, node_id: NodeId, data: DefPathData, - address_space: DefIndexAddressSpace, span: Span) -> DefIndex { let parent_def = self.parent_def.unwrap(); debug!("create_def(node_id={:?}, data={:?}, parent_def={:?})", node_id, data, parent_def); self.definitions - .create_def_with_parent(parent_def, node_id, data, address_space, self.expansion, span) + .create_def_with_parent(parent_def, node_id, data, self.expansion, span) } pub fn with_parent(&mut self, parent_def: DefIndex, f: F) { @@ -85,9 +82,9 @@ impl<'a> DefCollector<'a> { // For async functions, we need to create their inner defs inside of a // closure to match their desugared representation. let fn_def_data = DefPathData::ValueNs(name.as_interned_str()); - let fn_def = self.create_def(id, fn_def_data, ITEM_LIKE_SPACE, span); + let fn_def = self.create_def(id, fn_def_data, span); return self.with_parent(fn_def, |this| { - this.create_def(*return_impl_trait_id, DefPathData::ImplTrait, REGULAR_SPACE, span); + this.create_def(*return_impl_trait_id, DefPathData::ImplTrait, span); visit::walk_generics(this, generics); @@ -106,7 +103,7 @@ impl<'a> DefCollector<'a> { visit::walk_fn_ret_ty(this, &decl.output); let closure_def = this.create_def( - *closure_id, DefPathData::ClosureExpr, REGULAR_SPACE, span, + *closure_id, DefPathData::ClosureExpr, span, ); this.with_parent(closure_def, |this| { use visit::Visitor; @@ -173,14 +170,14 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> { return visit::walk_item(self, i); } }; - let def = self.create_def(i.id, def_data, ITEM_LIKE_SPACE, i.span); + let def = self.create_def(i.id, def_data, i.span); self.with_parent(def, |this| { match i.node { ItemKind::Struct(ref struct_def, _) | ItemKind::Union(ref struct_def, _) => { // If this is a unit or tuple-like struct, register the constructor. if let Some(ctor_hir_id) = struct_def.ctor_id() { - this.create_def(ctor_hir_id, DefPathData::Ctor, REGULAR_SPACE, i.span); + this.create_def(ctor_hir_id, DefPathData::Ctor, i.span); } } _ => {} @@ -190,7 +187,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> { } fn visit_use_tree(&mut self, use_tree: &'a UseTree, id: NodeId, _nested: bool) { - self.create_def(id, DefPathData::Misc, ITEM_LIKE_SPACE, use_tree.span); + self.create_def(id, DefPathData::Misc, use_tree.span); visit::walk_use_tree(self, use_tree, id); } @@ -201,7 +198,6 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> { let def = self.create_def(foreign_item.id, DefPathData::ValueNs(foreign_item.ident.as_interned_str()), - REGULAR_SPACE, foreign_item.span); self.with_parent(def, |this| { @@ -212,11 +208,10 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> { fn visit_variant(&mut self, v: &'a Variant, g: &'a Generics, item_id: NodeId) { let def = self.create_def(v.node.id, DefPathData::TypeNs(v.node.ident.as_interned_str()), - REGULAR_SPACE, v.span); self.with_parent(def, |this| { if let Some(ctor_hir_id) = v.node.data.ctor_id() { - this.create_def(ctor_hir_id, DefPathData::Ctor, REGULAR_SPACE, v.span); + this.create_def(ctor_hir_id, DefPathData::Ctor, v.span); } visit::walk_variant(this, v, g, item_id) }); @@ -229,7 +224,6 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> { .unwrap_or_else(|| Symbol::intern(&index.to_string())); let def = self.create_def(field.id, DefPathData::ValueNs(name.as_interned_str()), - REGULAR_SPACE, field.span); self.with_parent(def, |this| this.visit_struct_field(field)); } @@ -242,7 +236,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> { GenericParamKind::Type { .. } => DefPathData::TypeNs(name), GenericParamKind::Const { .. } => DefPathData::ValueNs(name), }; - self.create_def(param.id, def_path_data, REGULAR_SPACE, param.ident.span); + self.create_def(param.id, def_path_data, param.ident.span); visit::walk_generic_param(self, param); } @@ -257,7 +251,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> { TraitItemKind::Macro(..) => return self.visit_macro_invoc(ti.id), }; - let def = self.create_def(ti.id, def_data, ITEM_LIKE_SPACE, ti.span); + let def = self.create_def(ti.id, def_data, ti.span); self.with_parent(def, |this| visit::walk_trait_item(this, ti)); } @@ -286,7 +280,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> { ImplItemKind::Macro(..) => return self.visit_macro_invoc(ii.id), }; - let def = self.create_def(ii.id, def_data, ITEM_LIKE_SPACE, ii.span); + let def = self.create_def(ii.id, def_data, ii.span); self.with_parent(def, |this| visit::walk_impl_item(this, ii)); } @@ -300,7 +294,6 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> { fn visit_anon_const(&mut self, constant: &'a AnonConst) { let def = self.create_def(constant.id, DefPathData::AnonConst, - REGULAR_SPACE, constant.value.span); self.with_parent(def, |this| visit::walk_anon_const(this, constant)); } @@ -313,7 +306,6 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> { ExprKind::Closure(_, ref asyncness, ..) => { let closure_def = self.create_def(expr.id, DefPathData::ClosureExpr, - REGULAR_SPACE, expr.span); self.parent_def = Some(closure_def); @@ -322,7 +314,6 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> { if let IsAsync::Async { closure_id, .. } = asyncness { let async_def = self.create_def(*closure_id, DefPathData::ClosureExpr, - REGULAR_SPACE, expr.span); self.parent_def = Some(async_def); } @@ -330,7 +321,6 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> { ExprKind::Async(_, async_id, _) => { let async_def = self.create_def(async_id, DefPathData::ClosureExpr, - REGULAR_SPACE, expr.span); self.parent_def = Some(async_def); } @@ -345,7 +335,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> { match ty.node { TyKind::Mac(..) => return self.visit_macro_invoc(ty.id), TyKind::ImplTrait(node_id, _) => { - self.create_def(node_id, DefPathData::ImplTrait, REGULAR_SPACE, ty.span); + self.create_def(node_id, DefPathData::ImplTrait, ty.span); } _ => {} } diff --git a/src/librustc/hir/map/definitions.rs b/src/librustc/hir/map/definitions.rs index fc9d6d86500ba..dc6cddc89f912 100644 --- a/src/librustc/hir/map/definitions.rs +++ b/src/librustc/hir/map/definitions.rs @@ -5,8 +5,7 @@ //! expressions) that are mostly just leftovers. use crate::hir; -use crate::hir::def_id::{CrateNum, DefId, DefIndex, LOCAL_CRATE, DefIndexAddressSpace, - CRATE_DEF_INDEX}; +use crate::hir::def_id::{CrateNum, DefId, DefIndex, LOCAL_CRATE, CRATE_DEF_INDEX}; use crate::ich::Fingerprint; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::indexed_vec::{IndexVec}; @@ -26,59 +25,41 @@ use crate::util::nodemap::NodeMap; /// Internally the DefPathTable holds a tree of DefKeys, where each DefKey /// stores the DefIndex of its parent. /// There is one DefPathTable for each crate. -#[derive(Default)] +#[derive(Clone, Default)] pub struct DefPathTable { - index_to_key: [Vec; 2], - def_path_hashes: [Vec; 2], -} - -// Unfortunately we have to provide a manual impl of Clone because of the -// fixed-sized array field. -impl Clone for DefPathTable { - fn clone(&self) -> Self { - DefPathTable { - index_to_key: [self.index_to_key[0].clone(), - self.index_to_key[1].clone()], - def_path_hashes: [self.def_path_hashes[0].clone(), - self.def_path_hashes[1].clone()], - } - } + index_to_key: Vec, + def_path_hashes: Vec, } impl DefPathTable { fn allocate(&mut self, key: DefKey, - def_path_hash: DefPathHash, - address_space: DefIndexAddressSpace) + def_path_hash: DefPathHash) -> DefIndex { let index = { - let index_to_key = &mut self.index_to_key[address_space.index()]; - let index = DefIndex::from_array_index(index_to_key.len(), address_space); + let index = DefIndex::from_array_index(self.index_to_key.len()); debug!("DefPathTable::insert() - {:?} <-> {:?}", key, index); - index_to_key.push(key); + self.index_to_key.push(key); index }; - self.def_path_hashes[address_space.index()].push(def_path_hash); - debug_assert!(self.def_path_hashes[address_space.index()].len() == - self.index_to_key[address_space.index()].len()); + self.def_path_hashes.push(def_path_hash); + debug_assert!(self.def_path_hashes.len() == self.index_to_key.len()); index } - pub fn next_id(&self, address_space: DefIndexAddressSpace) -> DefIndex { - DefIndex::from_array_index(self.index_to_key[address_space.index()].len(), address_space) + pub fn next_id(&self) -> DefIndex { + DefIndex::from_array_index(self.index_to_key.len()) } #[inline(always)] pub fn def_key(&self, index: DefIndex) -> DefKey { - self.index_to_key[index.address_space().index()] - [index.as_array_index()].clone() + self.index_to_key[index.as_array_index()].clone() } #[inline(always)] pub fn def_path_hash(&self, index: DefIndex) -> DefPathHash { - let ret = self.def_path_hashes[index.address_space().index()] - [index.as_array_index()]; + let ret = self.def_path_hashes[index.as_array_index()]; debug!("def_path_hash({:?}) = {:?}", index, ret); return ret } @@ -86,24 +67,22 @@ impl DefPathTable { pub fn add_def_path_hashes_to(&self, cnum: CrateNum, out: &mut FxHashMap) { - for &address_space in &[DefIndexAddressSpace::Low, DefIndexAddressSpace::High] { - out.extend( - (&self.def_path_hashes[address_space.index()]) - .iter() - .enumerate() - .map(|(index, &hash)| { - let def_id = DefId { - krate: cnum, - index: DefIndex::from_array_index(index, address_space), - }; - (hash, def_id) - }) - ); - } + out.extend( + self.def_path_hashes + .iter() + .enumerate() + .map(|(index, &hash)| { + let def_id = DefId { + krate: cnum, + index: DefIndex::from_array_index(index), + }; + (hash, def_id) + }) + ); } pub fn size(&self) -> usize { - self.index_to_key.iter().map(|v| v.len()).sum() + self.index_to_key.len() } } @@ -111,12 +90,10 @@ impl DefPathTable { impl Encodable for DefPathTable { fn encode(&self, s: &mut S) -> Result<(), S::Error> { // Index to key - self.index_to_key[DefIndexAddressSpace::Low.index()].encode(s)?; - self.index_to_key[DefIndexAddressSpace::High.index()].encode(s)?; + self.index_to_key.encode(s)?; // DefPath hashes - self.def_path_hashes[DefIndexAddressSpace::Low.index()].encode(s)?; - self.def_path_hashes[DefIndexAddressSpace::High.index()].encode(s)?; + self.def_path_hashes.encode(s)?; Ok(()) } @@ -124,18 +101,9 @@ impl Encodable for DefPathTable { impl Decodable for DefPathTable { fn decode(d: &mut D) -> Result { - let index_to_key_lo: Vec = Decodable::decode(d)?; - let index_to_key_hi: Vec = Decodable::decode(d)?; - - let def_path_hashes_lo: Vec = Decodable::decode(d)?; - let def_path_hashes_hi: Vec = Decodable::decode(d)?; - - let index_to_key = [index_to_key_lo, index_to_key_hi]; - let def_path_hashes = [def_path_hashes_lo, def_path_hashes_hi]; - Ok(DefPathTable { - index_to_key, - def_path_hashes, + index_to_key: Decodable::decode(d)?, + def_path_hashes : Decodable::decode(d)?, }) } } @@ -147,7 +115,7 @@ impl Decodable for DefPathTable { pub struct Definitions { table: DefPathTable, node_to_def_index: NodeMap, - def_index_to_node: [Vec; 2], + def_index_to_node: Vec, pub(super) node_to_hir_id: IndexVec, /// If `Mark` is an ID of some macro expansion, /// then `DefId` is the normal module (`mod`) in which the expanded macro was defined. @@ -374,30 +342,13 @@ impl Borrow for DefPathHash { } impl Definitions { - /// Creates new empty definition map. - /// - /// The `DefIndex` returned from a new `Definitions` are as follows: - /// 1. At `DefIndexAddressSpace::Low`, - /// CRATE_ROOT has index 0:0, and then new indexes are allocated in - /// ascending order. - /// 2. At `DefIndexAddressSpace::High`, - /// the first `FIRST_FREE_HIGH_DEF_INDEX` indexes are reserved for - /// internal use, then `1:FIRST_FREE_HIGH_DEF_INDEX` are allocated in - /// ascending order. - // - // FIXME: there is probably a better place to put this comment. - pub fn new() -> Self { - Self::default() - } - pub fn def_path_table(&self) -> &DefPathTable { &self.table } /// Gets the number of definitions. - pub fn def_index_counts_lo_hi(&self) -> (usize, usize) { - (self.table.index_to_key[DefIndexAddressSpace::Low.index()].len(), - self.table.index_to_key[DefIndexAddressSpace::High.index()].len()) + pub fn def_index_count(&self) -> usize { + self.table.index_to_key.len() } pub fn def_key(&self, index: DefIndex) -> DefKey { @@ -436,17 +387,12 @@ impl Definitions { #[inline] pub fn as_local_node_id(&self, def_id: DefId) -> Option { if def_id.krate == LOCAL_CRATE { - let space_index = def_id.index.address_space().index(); - let array_index = def_id.index.as_array_index(); - let node_id = self.def_index_to_node[space_index][array_index]; + let node_id = self.def_index_to_node[def_id.index.as_array_index()]; if node_id != ast::DUMMY_NODE_ID { - Some(node_id) - } else { - None + return Some(node_id); } - } else { - None } + None } // FIXME(@ljedrz): replace the NodeId variant @@ -471,9 +417,7 @@ impl Definitions { #[inline] pub fn def_index_to_hir_id(&self, def_index: DefIndex) -> hir::HirId { - let space_index = def_index.address_space().index(); - let array_index = def_index.as_array_index(); - let node_id = self.def_index_to_node[space_index][array_index]; + let node_id = self.def_index_to_node[def_index.as_array_index()]; self.node_to_hir_id[node_id] } @@ -488,7 +432,11 @@ impl Definitions { } } - /// Adds a root definition (no parent). + /// Adds a root definition (no parent) and a few other reserved definitions. + /// + /// After the initial definitions are created the first `FIRST_FREE_DEF_INDEX` indexes + /// are taken, so the "user" indexes will be allocated starting with `FIRST_FREE_DEF_INDEX` + /// in ascending order. pub fn create_root_def(&mut self, crate_name: &str, crate_disambiguator: CrateDisambiguator) @@ -506,11 +454,10 @@ impl Definitions { let def_path_hash = key.compute_stable_hash(parent_hash); // Create the definition. - let address_space = super::ITEM_LIKE_SPACE; - let root_index = self.table.allocate(key, def_path_hash, address_space); + let root_index = self.table.allocate(key, def_path_hash); assert_eq!(root_index, CRATE_DEF_INDEX); - assert!(self.def_index_to_node[address_space.index()].is_empty()); - self.def_index_to_node[address_space.index()].push(ast::CRATE_NODE_ID); + assert!(self.def_index_to_node.is_empty()); + self.def_index_to_node.push(ast::CRATE_NODE_ID); self.node_to_def_index.insert(ast::CRATE_NODE_ID, root_index); // Allocate some other DefIndices that always must exist. @@ -524,7 +471,6 @@ impl Definitions { parent: DefIndex, node_id: ast::NodeId, data: DefPathData, - address_space: DefIndexAddressSpace, expansion: Mark, span: Span) -> DefIndex { @@ -561,10 +507,9 @@ impl Definitions { debug!("create_def_with_parent: after disambiguation, key = {:?}", key); // Create the definition. - let index = self.table.allocate(key, def_path_hash, address_space); - assert_eq!(index.as_array_index(), - self.def_index_to_node[address_space.index()].len()); - self.def_index_to_node[address_space.index()].push(node_id); + let index = self.table.allocate(key, def_path_hash); + assert_eq!(index.as_array_index(), self.def_index_to_node.len()); + self.def_index_to_node.push(node_id); // Some things for which we allocate DefIndices don't correspond to // anything in the AST, so they don't have a NodeId. For these cases @@ -673,8 +618,7 @@ macro_rules! define_global_metadata_kind { $($variant),* } - const GLOBAL_MD_ADDRESS_SPACE: DefIndexAddressSpace = DefIndexAddressSpace::High; - pub const FIRST_FREE_HIGH_DEF_INDEX: usize = count!($($variant)*); + pub const FIRST_FREE_DEF_INDEX: usize = 1 + count!($($variant)*); impl GlobalMetaDataKind { fn allocate_def_indices(definitions: &mut Definitions) { @@ -684,7 +628,6 @@ macro_rules! define_global_metadata_kind { CRATE_DEF_INDEX, ast::DUMMY_NODE_ID, DefPathData::GlobalMetaData(instance.name().as_interned_str()), - GLOBAL_MD_ADDRESS_SPACE, Mark::root(), DUMMY_SP ); @@ -705,12 +648,12 @@ macro_rules! define_global_metadata_kind { // These DefKeys are all right after the root, // so a linear search is fine. - let index = def_path_table.index_to_key[GLOBAL_MD_ADDRESS_SPACE.index()] + let index = def_path_table.index_to_key .iter() .position(|k| *k == def_key) .unwrap(); - DefIndex::from_array_index(index, GLOBAL_MD_ADDRESS_SPACE) + DefIndex::from_array_index(index) } fn name(&self) -> Symbol { diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index c2b513a39a8b7..9088d0c165670 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -5,7 +5,7 @@ pub use self::definitions::{Definitions, DefKey, DefPath, DefPathData, use crate::dep_graph::{DepGraph, DepNode, DepKind, DepNodeIndex}; -use crate::hir::def_id::{CRATE_DEF_INDEX, DefId, LocalDefId, DefIndexAddressSpace}; +use crate::hir::def_id::{CRATE_DEF_INDEX, DefId, LocalDefId}; use crate::middle::cstore::CrateStoreDyn; @@ -34,9 +34,6 @@ mod def_collector; pub mod definitions; mod hir_id_validator; -pub const ITEM_LIKE_SPACE: DefIndexAddressSpace = DefIndexAddressSpace::Low; -pub const REGULAR_SPACE: DefIndexAddressSpace = DefIndexAddressSpace::High; - /// Represents an entry and its parent `NodeId`. #[derive(Copy, Clone, Debug)] pub struct Entry<'hir> { @@ -163,11 +160,10 @@ impl Forest { } /// This type is effectively a `HashMap>`, -/// but is implemented by 3 layers of arrays. -/// - the outer layer is `[A; 2]` and correspond to the 2 address spaces `DefIndex`es can be in -/// - then we have `A = Vec>` mapping a `DefIndex`'s index to a inner value -/// - which is `B = IndexVec>` which finally gives you the `Entry`. -pub(super) type HirEntryMap<'hir> = [Vec>>>>; 2]; +/// but it is implemented as 2 layers of arrays. +/// - first we have `A = Vec>` mapping a `DefIndex`'s index to an inner value +/// - which is `B = IndexVec>` which gives you the `Entry`. +pub(super) type HirEntryMap<'hir> = Vec>>>>; /// Represents a mapping from `NodeId`s to AST elements and their parent `NodeId`s. #[derive(Clone)] @@ -193,7 +189,7 @@ pub struct Map<'hir> { impl<'hir> Map<'hir> { #[inline] fn lookup(&self, id: HirId) -> Option<&Entry<'hir>> { - let local_map = self.map[id.owner.address_space().index()].get(id.owner.as_array_index())?; + let local_map = self.map.get(id.owner.as_array_index())?; local_map.as_ref()?.get(id.local_id)?.as_ref() } @@ -1016,29 +1012,21 @@ impl<'hir> Map<'hir> { /// Returns an iterator that yields all the hir ids in the map. fn all_ids<'a>(&'a self) -> impl Iterator + 'a { - // This code is a bit awkward because the map is implemented as 3 levels of arrays, + // This code is a bit awkward because the map is implemented as 2 levels of arrays, // see the comment on `HirEntryMap`. - let map = &self.map; - - // Look at both the def index address spaces - let spaces = [DefIndexAddressSpace::Low, DefIndexAddressSpace::High].iter().cloned(); - spaces.flat_map(move |space| { - // Iterate over all the indices in the address space and return a reference to - // local maps and their index given that they exist. - let local_maps = map[space.index()].iter().enumerate().filter_map(|(i, local_map)| { - local_map.as_ref().map(|m| (i, m)) - }); - - local_maps.flat_map(move |(array_index, local_map)| { - // Iterate over each valid entry in the local map - local_map.iter_enumerated().filter_map(move |(i, entry)| entry.map(move |_| { - // Reconstruct the HirId based on the 3 indices we used to find it - HirId { - owner: DefIndex::from_array_index(array_index, space), - local_id: i, - } - })) - }) + // Iterate over all the indices and return a reference to + // local maps and their index given that they exist. + self.map.iter().enumerate().filter_map(|(i, local_map)| { + local_map.as_ref().map(|m| (i, m)) + }).flat_map(move |(array_index, local_map)| { + // Iterate over each valid entry in the local map + local_map.iter_enumerated().filter_map(move |(i, entry)| entry.map(move |_| { + // Reconstruct the HirId based on the 3 indices we used to find it + HirId { + owner: DefIndex::from_array_index(array_index), + local_id: i, + } + })) }) } diff --git a/src/librustc/traits/specialize/mod.rs b/src/librustc/traits/specialize/mod.rs index 384a5862cde0c..2496419640c2e 100644 --- a/src/librustc/traits/specialize/mod.rs +++ b/src/librustc/traits/specialize/mod.rs @@ -298,9 +298,7 @@ pub(super) fn specialization_graph_provider<'a, 'tcx>( // negated `CrateNum` (so remote definitions are visited first) and then // by a flattened version of the `DefIndex`. trait_impls.sort_unstable_by_key(|def_id| { - (-(def_id.krate.as_u32() as i64), - def_id.index.address_space().index(), - def_id.index.as_array_index()) + (-(def_id.krate.as_u32() as i64), def_id.index.as_array_index()) }); for impl_def_id in trait_impls { diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs index a339ec30a74f8..fc8bf0baa99f6 100644 --- a/src/librustc_driver/pretty.rs +++ b/src/librustc_driver/pretty.rs @@ -647,8 +647,7 @@ fn print_flowgraph<'a, 'tcx, W: Write>(variants: Vec, // alphanumeric. This does not appear in the rendered graph, so it does not // have to be user friendly. let name = format!( - "hir_id_{}_{}_{}", - hir_id.owner.address_space().index(), + "hir_id_{}_{}", hir_id.owner.as_array_index(), hir_id.local_id.index(), ); diff --git a/src/librustc_metadata/decoder.rs b/src/librustc_metadata/decoder.rs index 048acf56ea7a7..4b9db466da843 100644 --- a/src/librustc_metadata/decoder.rs +++ b/src/librustc_metadata/decoder.rs @@ -9,8 +9,7 @@ use rustc::hir; use rustc::middle::cstore::LinkagePreference; use rustc::middle::exported_symbols::{ExportedSymbol, SymbolExportLevel}; use rustc::hir::def::{self, Res, DefKind, CtorOf, CtorKind}; -use rustc::hir::def_id::{CrateNum, DefId, DefIndex, DefIndexAddressSpace, - CRATE_DEF_INDEX, LOCAL_CRATE, LocalDefId}; +use rustc::hir::def_id::{CrateNum, DefId, DefIndex, LocalDefId, CRATE_DEF_INDEX, LOCAL_CRATE}; use rustc::hir::map::definitions::DefPathTable; use rustc_data_structures::fingerprint::Fingerprint; use rustc::middle::lang_items; @@ -449,7 +448,7 @@ crate fn proc_macro_def_path_table(crate_root: &CrateRoot, proc_macros: &[(ast::Name, Lrc)]) -> DefPathTable { - let mut definitions = Definitions::new(); + let mut definitions = Definitions::default(); let name = crate_root.name.as_str(); let disambiguator = crate_root.disambiguator; @@ -460,7 +459,6 @@ crate fn proc_macro_def_path_table(crate_root: &CrateRoot, crate_root, ast::DUMMY_NODE_ID, DefPathData::MacroNs(name.as_interned_str()), - DefIndexAddressSpace::High, Mark::root(), DUMMY_SP); debug!("definition for {:?} is {:?}", name, def_index); diff --git a/src/librustc_metadata/index.rs b/src/librustc_metadata/index.rs index f9543a18c68a7..4c1e39cd0a9e1 100644 --- a/src/librustc_metadata/index.rs +++ b/src/librustc_metadata/index.rs @@ -1,6 +1,6 @@ use crate::schema::*; -use rustc::hir::def_id::{DefId, DefIndex, DefIndexAddressSpace}; +use rustc::hir::def_id::{DefId, DefIndex}; use rustc_serialize::opaque::Encoder; use std::u32; use log::debug; @@ -75,14 +75,13 @@ impl FixedSizeEncoding for u32 { /// appropriate spot by calling `record_position`. We should never /// visit the same index twice. pub struct Index { - positions: [Vec; 2] + positions: Vec, } impl Index { - pub fn new((max_index_lo, max_index_hi): (usize, usize)) -> Index { + pub fn new(max_index: usize) -> Index { Index { - positions: [vec![0xff; max_index_lo * 4], - vec![0xff; max_index_hi * 4]], + positions: vec![0xff; max_index * 4], } } @@ -94,10 +93,9 @@ impl Index { pub fn record_index(&mut self, item: DefIndex, entry: Lazy>) { assert!(entry.position < (u32::MAX as usize)); let position = entry.position as u32; - let space_index = item.address_space().index(); let array_index = item.as_array_index(); - let positions = &mut self.positions[space_index]; + let positions = &mut self.positions; assert!(u32::read_from_bytes_at(positions, array_index) == u32::MAX, "recorded position for item {:?} twice, first at {:?} and now at {:?}", item, @@ -111,13 +109,10 @@ impl Index { let pos = buf.position(); // First we write the length of the lower range ... - buf.emit_raw_bytes(&(self.positions[0].len() as u32 / 4).to_le_bytes()); - // ... then the values in the lower range ... - buf.emit_raw_bytes(&self.positions[0]); - // ... then the values in the higher range. - buf.emit_raw_bytes(&self.positions[1]); - LazySeq::with_position_and_length(pos as usize, - (self.positions[0].len() + self.positions[1].len()) / 4 + 1) + buf.emit_raw_bytes(&(self.positions.len() as u32 / 4).to_le_bytes()); + // ... then the values. + buf.emit_raw_bytes(&self.positions); + LazySeq::with_position_and_length(pos as usize, self.positions.len() / 4 + 1) } } @@ -131,16 +126,7 @@ impl<'tcx> LazySeq { def_index, self.len); - let i = def_index.as_array_index() + match def_index.address_space() { - DefIndexAddressSpace::Low => 0, - DefIndexAddressSpace::High => { - // This is a DefIndex in the higher range, so find out where - // that starts: - u32::read_from_bytes_at(bytes, 0) as usize - } - }; - - let position = u32::read_from_bytes_at(bytes, 1 + i); + let position = u32::read_from_bytes_at(bytes, 1 + def_index.as_array_index()); if position == u32::MAX { debug!("Index::lookup: position=u32::MAX"); None diff --git a/src/librustc_metadata/index_builder.rs b/src/librustc_metadata/index_builder.rs index b77feeee06f57..e780693a5a92d 100644 --- a/src/librustc_metadata/index_builder.rs +++ b/src/librustc_metadata/index_builder.rs @@ -80,7 +80,7 @@ impl<'a, 'b, 'tcx> DerefMut for IndexBuilder<'a, 'b, 'tcx> { impl<'a, 'b, 'tcx> IndexBuilder<'a, 'b, 'tcx> { pub fn new(ecx: &'a mut EncodeContext<'b, 'tcx>) -> Self { IndexBuilder { - items: Index::new(ecx.tcx.hir().definitions().def_index_counts_lo_hi()), + items: Index::new(ecx.tcx.hir().definitions().def_index_count()), ecx, } } diff --git a/src/librustc_mir/util/graphviz.rs b/src/librustc_mir/util/graphviz.rs index f87714b58c442..04b0e16cd9a81 100644 --- a/src/librustc_mir/util/graphviz.rs +++ b/src/librustc_mir/util/graphviz.rs @@ -25,9 +25,8 @@ pub fn write_mir_graphviz<'tcx, W>(tcx: TyCtxt<'_, '_, 'tcx>, // it does not have to be user friendly. pub fn graphviz_safe_def_name(def_id: DefId) -> String { format!( - "{}_{}_{}", + "{}_{}", def_id.krate.index(), - def_id.index.address_space().index(), def_id.index.as_array_index(), ) } diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index f8f6e5b1cd012..18da89b9099a5 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -1970,7 +1970,7 @@ impl<'a> Resolver<'a> { let mut module_map = FxHashMap::default(); module_map.insert(DefId::local(CRATE_DEF_INDEX), graph_root); - let mut definitions = Definitions::new(); + let mut definitions = Definitions::default(); DefCollector::new(&mut definitions, Mark::root()) .collect_root(crate_name, session.local_crate_disambiguator()); diff --git a/src/librustc_resolve/macros.rs b/src/librustc_resolve/macros.rs index f1706a4616b06..79a92d595c2ed 100644 --- a/src/librustc_resolve/macros.rs +++ b/src/librustc_resolve/macros.rs @@ -6,8 +6,7 @@ use crate::ModuleOrUniformRoot; use crate::Namespace::*; use crate::build_reduced_graph::{BuildReducedGraphVisitor, IsMacroExport}; use crate::resolve_imports::ImportResolver; -use rustc::hir::def_id::{DefId, CRATE_DEF_INDEX, DefIndex, - CrateNum, DefIndexAddressSpace}; +use rustc::hir::def_id::{CrateNum, DefId, DefIndex, CRATE_DEF_INDEX}; use rustc::hir::def::{self, DefKind, NonMacroAttrKind}; use rustc::hir::map::{self, DefCollector}; use rustc::{ty, lint}; @@ -173,8 +172,7 @@ impl<'a> base::Resolver for Resolver<'a> { fn add_builtin(&mut self, ident: ast::Ident, ext: Lrc) { let def_id = DefId { krate: CrateNum::BuiltinMacros, - index: DefIndex::from_array_index(self.macro_map.len(), - DefIndexAddressSpace::Low), + index: DefIndex::from_array_index(self.macro_map.len()), }; let kind = ext.kind(); self.macro_map.insert(def_id, ext); diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 5555ea302c96f..e91e3a029dacf 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -1,6 +1,6 @@ use rustc_lint; use rustc::session::{self, config}; -use rustc::hir::def_id::{DefId, DefIndex, DefIndexAddressSpace, CrateNum, LOCAL_CRATE}; +use rustc::hir::def_id::{DefId, DefIndex, CrateNum, LOCAL_CRATE}; use rustc::hir::HirId; use rustc::middle::cstore::CrateStore; use rustc::middle::privacy::AccessLevels; @@ -112,8 +112,8 @@ impl<'tcx> DocContext<'tcx> { // registered after the AST is constructed would require storing the defid mapping in a // RefCell, decreasing the performance for normal compilation for very little gain. // - // Instead, we construct 'fake' def ids, which start immediately after the last DefId in - // DefIndexAddressSpace::Low. In the Debug impl for clean::Item, we explicitly check for fake + // Instead, we construct 'fake' def ids, which start immediately after the last DefId. + // In the Debug impl for clean::Item, we explicitly check for fake // def ids, as we'll end up with a panic if we use the DefId Debug impl for fake DefIds pub fn next_def_id(&self, crate_num: CrateNum) -> DefId { let start_def_id = { @@ -122,11 +122,11 @@ impl<'tcx> DocContext<'tcx> { .hir() .definitions() .def_path_table() - .next_id(DefIndexAddressSpace::Low) + .next_id() } else { self.cstore .def_path_table(crate_num) - .next_id(DefIndexAddressSpace::Low) + .next_id() }; DefId { @@ -142,10 +142,7 @@ impl<'tcx> DocContext<'tcx> { crate_num, DefId { krate: crate_num, - index: DefIndex::from_array_index( - def_id.index.as_array_index() + 1, - def_id.index.address_space(), - ), + index: DefIndex::from_array_index(def_id.index.as_array_index() + 1), }, ); diff --git a/src/test/mir-opt/graphviz.rs b/src/test/mir-opt/graphviz.rs index 660576996e5d4..67a6d1d263bf5 100644 --- a/src/test/mir-opt/graphviz.rs +++ b/src/test/mir-opt/graphviz.rs @@ -7,7 +7,7 @@ fn main() {} // END RUST SOURCE // START rustc.main.mir_map.0.dot -// digraph Mir_0_0_3 { // The name here MUST be an ASCII identifier. +// digraph Mir_0_12 { // The name here MUST be an ASCII identifier. // graph [fontname="monospace"]; // node [fontname="monospace"]; // edge [fontname="monospace"]; diff --git a/src/test/mir-opt/inline-closure-borrows-arg.rs b/src/test/mir-opt/inline-closure-borrows-arg.rs index 84567e1b4b8f2..0e1db68f37255 100644 --- a/src/test/mir-opt/inline-closure-borrows-arg.rs +++ b/src/test/mir-opt/inline-closure-borrows-arg.rs @@ -20,7 +20,7 @@ fn foo(_t: T, q: &i32) -> i32 { // ... // bb0: { // ... -// _3 = [closure@HirId { owner: DefIndex(0:4), local_id: 31 }]; +// _3 = [closure@HirId { owner: DefIndex(13), local_id: 31 }]; // ... // _4 = &_3; // ... diff --git a/src/test/mir-opt/inline-closure.rs b/src/test/mir-opt/inline-closure.rs index 2be48927fd3b7..fa8557f3b38a7 100644 --- a/src/test/mir-opt/inline-closure.rs +++ b/src/test/mir-opt/inline-closure.rs @@ -16,7 +16,7 @@ fn foo(_t: T, q: i32) -> i32 { // ... // bb0: { // ... -// _3 = [closure@HirId { owner: DefIndex(0:4), local_id: 15 }]; +// _3 = [closure@HirId { owner: DefIndex(13), local_id: 15 }]; // ... // _4 = &_3; // ... diff --git a/src/test/mir-opt/retag.rs b/src/test/mir-opt/retag.rs index 6b7c863fcd43f..33ee0fe61b288 100644 --- a/src/test/mir-opt/retag.rs +++ b/src/test/mir-opt/retag.rs @@ -98,7 +98,7 @@ fn main() { // } // END rustc.main.EraseRegions.after.mir // START rustc.main-{{closure}}.EraseRegions.after.mir -// fn main::{{closure}}#0(_1: &[closure@HirId { owner: DefIndex(0:7), local_id: 72 }], _2: &i32) -> &i32 { +// fn main::{{closure}}#0(_1: &[closure@HirId { owner: DefIndex(20), local_id: 72 }], _2: &i32) -> &i32 { // ... // bb0: { // Retag([fn entry] _1); diff --git a/src/test/ui/nll/closure-requirements/escape-argument-callee.stderr b/src/test/ui/nll/closure-requirements/escape-argument-callee.stderr index 20041389b3c38..cc5ffca10475e 100644 --- a/src/test/ui/nll/closure-requirements/escape-argument-callee.stderr +++ b/src/test/ui/nll/closure-requirements/escape-argument-callee.stderr @@ -4,9 +4,9 @@ note: No external requirements LL | let mut closure = expect_sig(|p, y| *p = y); | ^^^^^^^^^^^^^ | - = note: defining type: DefId(0/1:9 ~ escape_argument_callee[317d]::test[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:13 ~ escape_argument_callee[317d]::test[0]::{{closure}}[0]) with closure substs [ i16, - for<'r, 's, 't0> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 'r)) mut &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 's)) i32, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 't0)) i32)), + for<'r, 's, 't0> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) mut &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) i32, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't0)) i32)), ] error: lifetime may not live long enough @@ -30,7 +30,7 @@ LL | | deref(p); LL | | } | |_^ | - = note: defining type: DefId(0/0:3 ~ escape_argument_callee[317d]::test[0]) with substs [] + = note: defining type: DefId(0:12 ~ escape_argument_callee[317d]::test[0]) with substs [] error: aborting due to previous error diff --git a/src/test/ui/nll/closure-requirements/escape-argument.stderr b/src/test/ui/nll/closure-requirements/escape-argument.stderr index b08ec9539318a..fdf95b8acebfc 100644 --- a/src/test/ui/nll/closure-requirements/escape-argument.stderr +++ b/src/test/ui/nll/closure-requirements/escape-argument.stderr @@ -4,9 +4,9 @@ note: No external requirements LL | let mut closure = expect_sig(|p, y| *p = y); | ^^^^^^^^^^^^^ | - = note: defining type: DefId(0/1:9 ~ escape_argument[317d]::test[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:13 ~ escape_argument[317d]::test[0]::{{closure}}[0]) with closure substs [ i16, - for<'r, 's> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 'r)) mut &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 's)) i32, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 's)) i32)), + for<'r, 's> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) mut &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) i32, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) i32)), ] note: No external requirements @@ -21,7 +21,7 @@ LL | | deref(p); LL | | } | |_^ | - = note: defining type: DefId(0/0:3 ~ escape_argument[317d]::test[0]) with substs [] + = note: defining type: DefId(0:12 ~ escape_argument[317d]::test[0]) with substs [] error[E0597]: `y` does not live long enough --> $DIR/escape-argument.rs:27:25 diff --git a/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr b/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr index 7178b22bb5f2d..135de0445a799 100644 --- a/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr +++ b/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr @@ -4,7 +4,7 @@ note: External requirements LL | let mut closure1 = || p = &y; | ^^^^^^^^^ | - = note: defining type: DefId(0/1:10 ~ escape_upvar_nested[317d]::test[0]::{{closure}}[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:14 ~ escape_upvar_nested[317d]::test[0]::{{closure}}[0]::{{closure}}[0]) with closure substs [ i16, extern "rust-call" fn(()), &'_#1r mut &'_#2r i32, @@ -23,7 +23,7 @@ LL | | closure1(); LL | | }; | |_________^ | - = note: defining type: DefId(0/1:9 ~ escape_upvar_nested[317d]::test[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:13 ~ escape_upvar_nested[317d]::test[0]::{{closure}}[0]) with closure substs [ i16, extern "rust-call" fn(()), &'_#1r mut &'_#2r i32, @@ -44,7 +44,7 @@ LL | | deref(p); LL | | } | |_^ | - = note: defining type: DefId(0/0:3 ~ escape_upvar_nested[317d]::test[0]) with substs [] + = note: defining type: DefId(0:12 ~ escape_upvar_nested[317d]::test[0]) with substs [] error[E0597]: `y` does not live long enough --> $DIR/escape-upvar-nested.rs:21:40 diff --git a/src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr b/src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr index d129f945f252a..8c37ab7b768c3 100644 --- a/src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr +++ b/src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr @@ -4,7 +4,7 @@ note: External requirements LL | let mut closure = || p = &y; | ^^^^^^^^^ | - = note: defining type: DefId(0/1:9 ~ escape_upvar_ref[317d]::test[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:13 ~ escape_upvar_ref[317d]::test[0]::{{closure}}[0]) with closure substs [ i16, extern "rust-call" fn(()), &'_#1r mut &'_#2r i32, @@ -25,7 +25,7 @@ LL | | deref(p); LL | | } | |_^ | - = note: defining type: DefId(0/0:3 ~ escape_upvar_ref[317d]::test[0]) with substs [] + = note: defining type: DefId(0:12 ~ escape_upvar_ref[317d]::test[0]) with substs [] error[E0597]: `y` does not live long enough --> $DIR/escape-upvar-ref.rs:23:35 diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr index 4db1f04077043..8916fdcfc88f1 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr @@ -8,9 +8,9 @@ LL | | demand_y(x, y, p) LL | | }, | |_________^ | - = note: defining type: DefId(0/1:20 ~ propagate_approximated_fail_no_postdom[317d]::supply[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:27 ~ propagate_approximated_fail_no_postdom[317d]::supply[0]::{{closure}}[0]) with closure substs [ i16, - for<'r, 's> extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 'r)) u32>, std::cell::Cell<&'_#2r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 'r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 's)) &'_#3r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 'r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 's)) u32>)), + for<'r, 's> extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) u32>, std::cell::Cell<&'_#2r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) &'_#3r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>)), ] = note: late-bound region is '_#4r = note: late-bound region is '_#5r @@ -39,7 +39,7 @@ LL | | ); LL | | } | |_^ | - = note: defining type: DefId(0/0:6 ~ propagate_approximated_fail_no_postdom[317d]::supply[0]) with substs [] + = note: defining type: DefId(0:23 ~ propagate_approximated_fail_no_postdom[317d]::supply[0]) with substs [] error: aborting due to previous error diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr index 7dedae715bea0..fa8384311ea57 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr @@ -9,9 +9,9 @@ LL | | LL | | }); | |_____^ | - = note: defining type: DefId(0/1:18 ~ propagate_approximated_ref[317d]::supply[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:25 ~ propagate_approximated_ref[317d]::supply[0]::{{closure}}[0]) with closure substs [ i16, - for<'r, 's, 't0, 't1, 't2, 't3> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 'r)) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 's)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 't0)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 't1)) &'_#2r u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 't2)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 's)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 't3)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 't1)) u32>)), + for<'r, 's, 't0, 't1, 't2, 't3> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't0)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't1)) &'_#2r u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't2)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't3)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't1)) u32>)), ] = note: late-bound region is '_#3r = note: late-bound region is '_#4r @@ -30,7 +30,7 @@ LL | | }); LL | | } | |_^ | - = note: defining type: DefId(0/0:6 ~ propagate_approximated_ref[317d]::supply[0]) with substs [] + = note: defining type: DefId(0:22 ~ propagate_approximated_ref[317d]::supply[0]) with substs [] error: lifetime may not live long enough --> $DIR/propagate-approximated-ref.rs:45:9 diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr index 6d1baf9f827db..cfaa75b8ef861 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr @@ -8,9 +8,9 @@ LL | | LL | | }) | |_____^ | - = note: defining type: DefId(0/1:12 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case1[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:18 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case1[0]::{{closure}}[0]) with closure substs [ i32, - for<'r> extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 'r)) u32>)), + for<'r> extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) u32>)), ] error[E0521]: borrowed data escapes outside of closure @@ -35,7 +35,7 @@ LL | | }) LL | | } | |_^ | - = note: defining type: DefId(0/0:5 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case1[0]) with substs [] + = note: defining type: DefId(0:17 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case1[0]) with substs [] note: External requirements --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:35:15 @@ -46,9 +46,9 @@ LL | | cell_x.set(cell_a.get()); // forces 'a: 'x, implies 'a = 'static LL | | }) | |_____^ | - = note: defining type: DefId(0/1:13 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case2[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:20 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case2[0]::{{closure}}[0]) with closure substs [ i32, - for<'r> extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 'r)) u32>)), + for<'r> extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) u32>)), ] = note: number of external vids: 2 = note: where '_#1r: '_#0r @@ -65,7 +65,7 @@ LL | | }) LL | | } | |_^ | - = note: defining type: DefId(0/0:6 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case2[0]) with substs [] + = note: defining type: DefId(0:19 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case2[0]) with substs [] error[E0597]: `a` does not live long enough --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:30:26 diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr index ea04a47a4804b..601b3577e0eec 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr @@ -10,9 +10,9 @@ LL | | demand_y(x, y, x.get()) LL | | }); | |_____^ | - = note: defining type: DefId(0/1:18 ~ propagate_approximated_shorter_to_static_no_bound[317d]::supply[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:25 ~ propagate_approximated_shorter_to_static_no_bound[317d]::supply[0]::{{closure}}[0]) with closure substs [ i16, - for<'r, 's, 't0, 't1, 't2> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 'r)) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 's)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 't0)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 's)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 't1)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 't2)) u32>)), + for<'r, 's, 't0, 't1, 't2> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't0)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't1)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't2)) u32>)), ] = note: late-bound region is '_#2r = note: late-bound region is '_#3r @@ -31,7 +31,7 @@ LL | | }); LL | | } | |_^ | - = note: defining type: DefId(0/0:6 ~ propagate_approximated_shorter_to_static_no_bound[317d]::supply[0]) with substs [] + = note: defining type: DefId(0:22 ~ propagate_approximated_shorter_to_static_no_bound[317d]::supply[0]) with substs [] error[E0521]: borrowed data escapes outside of function --> $DIR/propagate-approximated-shorter-to-static-no-bound.rs:32:5 diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr index 033357b09fb2e..5b5440e7a9641 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr @@ -10,9 +10,9 @@ LL | | demand_y(x, y, x.get()) LL | | }); | |_____^ | - = note: defining type: DefId(0/1:18 ~ propagate_approximated_shorter_to_static_wrong_bound[317d]::supply[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:25 ~ propagate_approximated_shorter_to_static_wrong_bound[317d]::supply[0]::{{closure}}[0]) with closure substs [ i16, - for<'r, 's, 't0, 't1, 't2, 't3> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 'r)) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 's)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 't0)) std::cell::Cell<&'_#2r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 't1)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 't2)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 's)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 't3)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 't1)) u32>)), + for<'r, 's, 't0, 't1, 't2, 't3> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't0)) std::cell::Cell<&'_#2r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't1)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't2)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't3)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't1)) u32>)), ] = note: late-bound region is '_#3r = note: late-bound region is '_#4r @@ -31,7 +31,7 @@ LL | | }); LL | | } | |_^ | - = note: defining type: DefId(0/0:6 ~ propagate_approximated_shorter_to_static_wrong_bound[317d]::supply[0]) with substs [] + = note: defining type: DefId(0:22 ~ propagate_approximated_shorter_to_static_wrong_bound[317d]::supply[0]) with substs [] error[E0521]: borrowed data escapes outside of function --> $DIR/propagate-approximated-shorter-to-static-wrong-bound.rs:35:5 diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr index 223c29f596922..a08cde2c9c635 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr @@ -9,9 +9,9 @@ LL | | LL | | }); | |_____^ | - = note: defining type: DefId(0/1:18 ~ propagate_approximated_val[317d]::test[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:25 ~ propagate_approximated_val[317d]::test[0]::{{closure}}[0]) with closure substs [ i16, - for<'r, 's> extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 'r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 's)) &'_#2r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 'r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 's)) u32>)), + for<'r, 's> extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) &'_#2r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>)), ] = note: late-bound region is '_#3r = note: late-bound region is '_#4r @@ -30,7 +30,7 @@ LL | | }); LL | | } | |_^ | - = note: defining type: DefId(0/0:6 ~ propagate_approximated_val[317d]::test[0]) with substs [] + = note: defining type: DefId(0:22 ~ propagate_approximated_val[317d]::test[0]) with substs [] error: lifetime may not live long enough --> $DIR/propagate-approximated-val.rs:38:9 diff --git a/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr b/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr index d618b4d06a1d8..60847bb2e9290 100644 --- a/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr @@ -8,9 +8,9 @@ LL | | demand_y(x, y, p) LL | | }, | |_________^ | - = note: defining type: DefId(0/1:16 ~ propagate_despite_same_free_region[317d]::supply[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:23 ~ propagate_despite_same_free_region[317d]::supply[0]::{{closure}}[0]) with closure substs [ i16, - for<'r, 's> extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 'r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 's)) &'_#2r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 'r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 's)) u32>)), + for<'r, 's> extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) &'_#2r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>)), ] = note: late-bound region is '_#3r = note: number of external vids: 4 @@ -28,5 +28,5 @@ LL | | ); LL | | } | |_^ | - = note: defining type: DefId(0/0:6 ~ propagate_despite_same_free_region[317d]::supply[0]) with substs [] + = note: defining type: DefId(0:21 ~ propagate_despite_same_free_region[317d]::supply[0]) with substs [] diff --git a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr index 07fb4d0d5e3ae..a660c763bff78 100644 --- a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr @@ -9,9 +9,9 @@ LL | | LL | | }); | |_____^ | - = note: defining type: DefId(0/1:18 ~ propagate_fail_to_approximate_longer_no_bounds[317d]::supply[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:25 ~ propagate_fail_to_approximate_longer_no_bounds[317d]::supply[0]::{{closure}}[0]) with closure substs [ i16, - for<'r, 's, 't0, 't1, 't2> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 'r)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 's)) &'_#1r u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 't0)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 't1)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 't2)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 's)) u32>)), + for<'r, 's, 't0, 't1, 't2> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) &'_#1r u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't0)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't1)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't2)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>)), ] = note: late-bound region is '_#2r = note: late-bound region is '_#3r @@ -39,7 +39,7 @@ LL | | }); LL | | } | |_^ | - = note: defining type: DefId(0/0:6 ~ propagate_fail_to_approximate_longer_no_bounds[317d]::supply[0]) with substs [] + = note: defining type: DefId(0:22 ~ propagate_fail_to_approximate_longer_no_bounds[317d]::supply[0]) with substs [] error: aborting due to previous error diff --git a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr index a0744c27db72c..9671b8ebff3a4 100644 --- a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr @@ -9,9 +9,9 @@ LL | | LL | | }); | |_____^ | - = note: defining type: DefId(0/1:18 ~ propagate_fail_to_approximate_longer_wrong_bounds[317d]::supply[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:25 ~ propagate_fail_to_approximate_longer_wrong_bounds[317d]::supply[0]::{{closure}}[0]) with closure substs [ i16, - for<'r, 's, 't0, 't1, 't2, 't3> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 'r)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 's)) &'_#1r u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 't0)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 't1)) &'_#2r u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 't2)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 's)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 't3)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 't1)) u32>)), + for<'r, 's, 't0, 't1, 't2, 't3> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) &'_#1r u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't0)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't1)) &'_#2r u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't2)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't3)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't1)) u32>)), ] = note: late-bound region is '_#3r = note: late-bound region is '_#4r @@ -39,7 +39,7 @@ LL | | }); LL | | } | |_^ | - = note: defining type: DefId(0/0:6 ~ propagate_fail_to_approximate_longer_wrong_bounds[317d]::supply[0]) with substs [] + = note: defining type: DefId(0:22 ~ propagate_fail_to_approximate_longer_wrong_bounds[317d]::supply[0]) with substs [] error: aborting due to previous error diff --git a/src/test/ui/nll/closure-requirements/propagate-from-trait-match.stderr b/src/test/ui/nll/closure-requirements/propagate-from-trait-match.stderr index 282246f81666b..457b5950b7ff0 100644 --- a/src/test/ui/nll/closure-requirements/propagate-from-trait-match.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-from-trait-match.stderr @@ -11,7 +11,7 @@ LL | | require(value); LL | | }); | |_____^ | - = note: defining type: DefId(0/1:16 ~ propagate_from_trait_match[317d]::supply[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:23 ~ propagate_from_trait_match[317d]::supply[0]::{{closure}}[0]) with closure substs [ '_#1r, T, i32, @@ -32,7 +32,7 @@ LL | | }); LL | | } | |_^ | - = note: defining type: DefId(0/0:6 ~ propagate_from_trait_match[317d]::supply[0]) with substs [ + = note: defining type: DefId(0:20 ~ propagate_from_trait_match[317d]::supply[0]) with substs [ '_#1r, T, ] diff --git a/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr b/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr index c5645413c77cd..8aff6d5b89279 100644 --- a/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr +++ b/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr @@ -4,9 +4,9 @@ note: No external requirements LL | expect_sig(|a, b| b); // ought to return `a` | ^^^^^^^^ | - = note: defining type: DefId(0/1:9 ~ return_wrong_bound_region[317d]::test[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:13 ~ return_wrong_bound_region[317d]::test[0]::{{closure}}[0]) with closure substs [ i16, - for<'r, 's> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 'r)) i32, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 's)) i32)) -> &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 'r)) i32, + for<'r, 's> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) i32, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) i32)) -> &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) i32, ] error: lifetime may not live long enough @@ -27,7 +27,7 @@ LL | | LL | | } | |_^ | - = note: defining type: DefId(0/0:3 ~ return_wrong_bound_region[317d]::test[0]) with substs [] + = note: defining type: DefId(0:12 ~ return_wrong_bound_region[317d]::test[0]) with substs [] error: aborting due to previous error diff --git a/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr b/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr index cda1f7d36311c..9fa54e83812f7 100644 --- a/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr @@ -4,7 +4,7 @@ note: External requirements LL | with_signature(x, |mut y| Box::new(y.next())) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0/1:15 ~ projection_no_regions_closure[317d]::no_region[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:22 ~ projection_no_regions_closure[317d]::no_region[0]::{{closure}}[0]) with closure substs [ '_#1r, T, i32, @@ -25,7 +25,7 @@ LL | | LL | | } | |_^ | - = note: defining type: DefId(0/0:6 ~ projection_no_regions_closure[317d]::no_region[0]) with substs [ + = note: defining type: DefId(0:19 ~ projection_no_regions_closure[317d]::no_region[0]) with substs [ '_#1r, T, ] @@ -44,7 +44,7 @@ note: External requirements LL | with_signature(x, |mut y| Box::new(y.next())) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0/1:18 ~ projection_no_regions_closure[317d]::correct_region[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:26 ~ projection_no_regions_closure[317d]::correct_region[0]::{{closure}}[0]) with closure substs [ '_#1r, T, i32, @@ -64,7 +64,7 @@ LL | | with_signature(x, |mut y| Box::new(y.next())) LL | | } | |_^ | - = note: defining type: DefId(0/0:7 ~ projection_no_regions_closure[317d]::correct_region[0]) with substs [ + = note: defining type: DefId(0:23 ~ projection_no_regions_closure[317d]::correct_region[0]) with substs [ '_#1r, T, ] @@ -75,7 +75,7 @@ note: External requirements LL | with_signature(x, |mut y| Box::new(y.next())) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0/1:22 ~ projection_no_regions_closure[317d]::wrong_region[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:31 ~ projection_no_regions_closure[317d]::wrong_region[0]::{{closure}}[0]) with closure substs [ '_#1r, '_#2r, T, @@ -97,7 +97,7 @@ LL | | LL | | } | |_^ | - = note: defining type: DefId(0/0:8 ~ projection_no_regions_closure[317d]::wrong_region[0]) with substs [ + = note: defining type: DefId(0:27 ~ projection_no_regions_closure[317d]::wrong_region[0]) with substs [ '_#1r, '_#2r, T, @@ -117,7 +117,7 @@ note: External requirements LL | with_signature(x, |mut y| Box::new(y.next())) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0/1:26 ~ projection_no_regions_closure[317d]::outlives_region[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:36 ~ projection_no_regions_closure[317d]::outlives_region[0]::{{closure}}[0]) with closure substs [ '_#1r, '_#2r, T, @@ -139,7 +139,7 @@ LL | | with_signature(x, |mut y| Box::new(y.next())) LL | | } | |_^ | - = note: defining type: DefId(0/0:9 ~ projection_no_regions_closure[317d]::outlives_region[0]) with substs [ + = note: defining type: DefId(0:32 ~ projection_no_regions_closure[317d]::outlives_region[0]) with substs [ '_#1r, '_#2r, T, diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr b/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr index 9d716006500b7..10b2bd1af4702 100644 --- a/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr @@ -4,7 +4,7 @@ note: External requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0/1:19 ~ projection_one_region_closure[317d]::no_relationships_late[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:28 ~ projection_one_region_closure[317d]::no_relationships_late[0]::{{closure}}[0]) with closure substs [ '_#1r, T, i32, @@ -27,7 +27,7 @@ LL | | LL | | } | |_^ | - = note: defining type: DefId(0/0:8 ~ projection_one_region_closure[317d]::no_relationships_late[0]) with substs [ + = note: defining type: DefId(0:24 ~ projection_one_region_closure[317d]::no_relationships_late[0]) with substs [ '_#1r, T, ] @@ -38,7 +38,7 @@ error[E0309]: the parameter type `T` may not live long enough LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = help: consider adding an explicit lifetime bound `T: ReFree(DefId(0/0:8 ~ projection_one_region_closure[317d]::no_relationships_late[0]), BrNamed(crate0:DefIndex(1:16), 'a))`... + = help: consider adding an explicit lifetime bound `T: ReFree(DefId(0:24 ~ projection_one_region_closure[317d]::no_relationships_late[0]), BrNamed(crate0:DefIndex(25), 'a))`... error: lifetime may not live long enough --> $DIR/projection-one-region-closure.rs:45:39 @@ -57,7 +57,7 @@ note: External requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0/1:23 ~ projection_one_region_closure[317d]::no_relationships_early[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:33 ~ projection_one_region_closure[317d]::no_relationships_early[0]::{{closure}}[0]) with closure substs [ '_#1r, '_#2r, T, @@ -80,7 +80,7 @@ LL | | LL | | } | |_^ | - = note: defining type: DefId(0/0:9 ~ projection_one_region_closure[317d]::no_relationships_early[0]) with substs [ + = note: defining type: DefId(0:29 ~ projection_one_region_closure[317d]::no_relationships_early[0]) with substs [ '_#1r, '_#2r, T, @@ -111,7 +111,7 @@ note: External requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0/1:27 ~ projection_one_region_closure[317d]::projection_outlives[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:38 ~ projection_one_region_closure[317d]::projection_outlives[0]::{{closure}}[0]) with closure substs [ '_#1r, '_#2r, T, @@ -133,7 +133,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t)); LL | | } | |_^ | - = note: defining type: DefId(0/0:10 ~ projection_one_region_closure[317d]::projection_outlives[0]) with substs [ + = note: defining type: DefId(0:34 ~ projection_one_region_closure[317d]::projection_outlives[0]) with substs [ '_#1r, '_#2r, T, @@ -145,7 +145,7 @@ note: External requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0/1:31 ~ projection_one_region_closure[317d]::elements_outlive[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:43 ~ projection_one_region_closure[317d]::elements_outlive[0]::{{closure}}[0]) with closure substs [ '_#1r, '_#2r, T, @@ -168,7 +168,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t)); LL | | } | |_^ | - = note: defining type: DefId(0/0:11 ~ projection_one_region_closure[317d]::elements_outlive[0]) with substs [ + = note: defining type: DefId(0:39 ~ projection_one_region_closure[317d]::elements_outlive[0]) with substs [ '_#1r, '_#2r, T, diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr index 0fa4060137a3f..b4b74bfc1284f 100644 --- a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr @@ -4,7 +4,7 @@ note: External requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0/1:19 ~ projection_one_region_trait_bound_closure[317d]::no_relationships_late[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:28 ~ projection_one_region_trait_bound_closure[317d]::no_relationships_late[0]::{{closure}}[0]) with closure substs [ '_#1r, T, i32, @@ -26,7 +26,7 @@ LL | | LL | | } | |_^ | - = note: defining type: DefId(0/0:8 ~ projection_one_region_trait_bound_closure[317d]::no_relationships_late[0]) with substs [ + = note: defining type: DefId(0:24 ~ projection_one_region_trait_bound_closure[317d]::no_relationships_late[0]) with substs [ '_#1r, T, ] @@ -48,7 +48,7 @@ note: External requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0/1:23 ~ projection_one_region_trait_bound_closure[317d]::no_relationships_early[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:33 ~ projection_one_region_trait_bound_closure[317d]::no_relationships_early[0]::{{closure}}[0]) with closure substs [ '_#1r, '_#2r, T, @@ -70,7 +70,7 @@ LL | | LL | | } | |_^ | - = note: defining type: DefId(0/0:9 ~ projection_one_region_trait_bound_closure[317d]::no_relationships_early[0]) with substs [ + = note: defining type: DefId(0:29 ~ projection_one_region_trait_bound_closure[317d]::no_relationships_early[0]) with substs [ '_#1r, '_#2r, T, @@ -93,7 +93,7 @@ note: External requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0/1:27 ~ projection_one_region_trait_bound_closure[317d]::projection_outlives[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:38 ~ projection_one_region_trait_bound_closure[317d]::projection_outlives[0]::{{closure}}[0]) with closure substs [ '_#1r, '_#2r, T, @@ -115,7 +115,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t)); LL | | } | |_^ | - = note: defining type: DefId(0/0:10 ~ projection_one_region_trait_bound_closure[317d]::projection_outlives[0]) with substs [ + = note: defining type: DefId(0:34 ~ projection_one_region_trait_bound_closure[317d]::projection_outlives[0]) with substs [ '_#1r, '_#2r, T, @@ -127,7 +127,7 @@ note: External requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0/1:31 ~ projection_one_region_trait_bound_closure[317d]::elements_outlive[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:43 ~ projection_one_region_trait_bound_closure[317d]::elements_outlive[0]::{{closure}}[0]) with closure substs [ '_#1r, '_#2r, T, @@ -149,7 +149,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t)); LL | | } | |_^ | - = note: defining type: DefId(0/0:11 ~ projection_one_region_trait_bound_closure[317d]::elements_outlive[0]) with substs [ + = note: defining type: DefId(0:39 ~ projection_one_region_trait_bound_closure[317d]::elements_outlive[0]) with substs [ '_#1r, '_#2r, T, @@ -161,7 +161,7 @@ note: External requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0/1:34 ~ projection_one_region_trait_bound_closure[317d]::one_region[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:47 ~ projection_one_region_trait_bound_closure[317d]::one_region[0]::{{closure}}[0]) with closure substs [ '_#1r, T, i32, @@ -182,7 +182,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t)); LL | | } | |_^ | - = note: defining type: DefId(0/0:12 ~ projection_one_region_trait_bound_closure[317d]::one_region[0]) with substs [ + = note: defining type: DefId(0:44 ~ projection_one_region_trait_bound_closure[317d]::one_region[0]) with substs [ '_#1r, T, ] diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr index f616a7feae3f0..a757a43499f4b 100644 --- a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr @@ -4,7 +4,7 @@ note: No external requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0/1:19 ~ projection_one_region_trait_bound_static_closure[317d]::no_relationships_late[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:28 ~ projection_one_region_trait_bound_static_closure[317d]::no_relationships_late[0]::{{closure}}[0]) with closure substs [ '_#1r, T, i32, @@ -23,7 +23,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t)); LL | | } | |_^ | - = note: defining type: DefId(0/0:8 ~ projection_one_region_trait_bound_static_closure[317d]::no_relationships_late[0]) with substs [ + = note: defining type: DefId(0:24 ~ projection_one_region_trait_bound_static_closure[317d]::no_relationships_late[0]) with substs [ '_#1r, T, ] @@ -34,7 +34,7 @@ note: No external requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0/1:23 ~ projection_one_region_trait_bound_static_closure[317d]::no_relationships_early[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:33 ~ projection_one_region_trait_bound_static_closure[317d]::no_relationships_early[0]::{{closure}}[0]) with closure substs [ '_#1r, '_#2r, T, @@ -54,7 +54,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t)); LL | | } | |_^ | - = note: defining type: DefId(0/0:9 ~ projection_one_region_trait_bound_static_closure[317d]::no_relationships_early[0]) with substs [ + = note: defining type: DefId(0:29 ~ projection_one_region_trait_bound_static_closure[317d]::no_relationships_early[0]) with substs [ '_#1r, '_#2r, T, @@ -66,7 +66,7 @@ note: No external requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0/1:27 ~ projection_one_region_trait_bound_static_closure[317d]::projection_outlives[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:38 ~ projection_one_region_trait_bound_static_closure[317d]::projection_outlives[0]::{{closure}}[0]) with closure substs [ '_#1r, '_#2r, T, @@ -86,7 +86,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t)); LL | | } | |_^ | - = note: defining type: DefId(0/0:10 ~ projection_one_region_trait_bound_static_closure[317d]::projection_outlives[0]) with substs [ + = note: defining type: DefId(0:34 ~ projection_one_region_trait_bound_static_closure[317d]::projection_outlives[0]) with substs [ '_#1r, '_#2r, T, @@ -98,7 +98,7 @@ note: No external requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0/1:31 ~ projection_one_region_trait_bound_static_closure[317d]::elements_outlive[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:43 ~ projection_one_region_trait_bound_static_closure[317d]::elements_outlive[0]::{{closure}}[0]) with closure substs [ '_#1r, '_#2r, T, @@ -118,7 +118,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t)); LL | | } | |_^ | - = note: defining type: DefId(0/0:11 ~ projection_one_region_trait_bound_static_closure[317d]::elements_outlive[0]) with substs [ + = note: defining type: DefId(0:39 ~ projection_one_region_trait_bound_static_closure[317d]::elements_outlive[0]) with substs [ '_#1r, '_#2r, T, @@ -130,7 +130,7 @@ note: No external requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0/1:34 ~ projection_one_region_trait_bound_static_closure[317d]::one_region[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:47 ~ projection_one_region_trait_bound_static_closure[317d]::one_region[0]::{{closure}}[0]) with closure substs [ '_#1r, T, i32, @@ -149,7 +149,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t)); LL | | } | |_^ | - = note: defining type: DefId(0/0:12 ~ projection_one_region_trait_bound_static_closure[317d]::one_region[0]) with substs [ + = note: defining type: DefId(0:44 ~ projection_one_region_trait_bound_static_closure[317d]::one_region[0]) with substs [ '_#1r, T, ] diff --git a/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr b/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr index b761b031444da..a48766cd7340b 100644 --- a/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr @@ -4,7 +4,7 @@ note: External requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0/1:22 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_late[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:31 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_late[0]::{{closure}}[0]) with closure substs [ '_#1r, '_#2r, T, @@ -27,7 +27,7 @@ LL | | LL | | } | |_^ | - = note: defining type: DefId(0/0:8 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_late[0]) with substs [ + = note: defining type: DefId(0:26 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_late[0]) with substs [ '_#1r, '_#2r, T, @@ -39,7 +39,7 @@ error[E0309]: the associated type `>::AssocType` may LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = help: consider adding an explicit lifetime bound `>::AssocType: ReFree(DefId(0/0:8 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_late[0]), BrNamed(crate0:DefIndex(1:18), 'a))`... + = help: consider adding an explicit lifetime bound `>::AssocType: ReFree(DefId(0:26 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_late[0]), BrNamed(crate0:DefIndex(27), 'a))`... note: External requirements --> $DIR/projection-two-region-trait-bound-closure.rs:48:29 @@ -47,7 +47,7 @@ note: External requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0/1:27 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_early[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:37 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_early[0]::{{closure}}[0]) with closure substs [ '_#1r, '_#2r, '_#3r, @@ -70,7 +70,7 @@ LL | | LL | | } | |_^ | - = note: defining type: DefId(0/0:9 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_early[0]) with substs [ + = note: defining type: DefId(0:32 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_early[0]) with substs [ '_#1r, '_#2r, '_#3r, @@ -91,7 +91,7 @@ note: External requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0/1:32 ~ projection_two_region_trait_bound_closure[317d]::projection_outlives[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:43 ~ projection_two_region_trait_bound_closure[317d]::projection_outlives[0]::{{closure}}[0]) with closure substs [ '_#1r, '_#2r, '_#3r, @@ -114,7 +114,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t)); LL | | } | |_^ | - = note: defining type: DefId(0/0:10 ~ projection_two_region_trait_bound_closure[317d]::projection_outlives[0]) with substs [ + = note: defining type: DefId(0:38 ~ projection_two_region_trait_bound_closure[317d]::projection_outlives[0]) with substs [ '_#1r, '_#2r, '_#3r, @@ -127,7 +127,7 @@ note: External requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0/1:37 ~ projection_two_region_trait_bound_closure[317d]::elements_outlive1[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:49 ~ projection_two_region_trait_bound_closure[317d]::elements_outlive1[0]::{{closure}}[0]) with closure substs [ '_#1r, '_#2r, '_#3r, @@ -150,7 +150,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t)); LL | | } | |_^ | - = note: defining type: DefId(0/0:11 ~ projection_two_region_trait_bound_closure[317d]::elements_outlive1[0]) with substs [ + = note: defining type: DefId(0:44 ~ projection_two_region_trait_bound_closure[317d]::elements_outlive1[0]) with substs [ '_#1r, '_#2r, '_#3r, @@ -163,7 +163,7 @@ note: External requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0/1:42 ~ projection_two_region_trait_bound_closure[317d]::elements_outlive2[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:55 ~ projection_two_region_trait_bound_closure[317d]::elements_outlive2[0]::{{closure}}[0]) with closure substs [ '_#1r, '_#2r, '_#3r, @@ -186,7 +186,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t)); LL | | } | |_^ | - = note: defining type: DefId(0/0:12 ~ projection_two_region_trait_bound_closure[317d]::elements_outlive2[0]) with substs [ + = note: defining type: DefId(0:50 ~ projection_two_region_trait_bound_closure[317d]::elements_outlive2[0]) with substs [ '_#1r, '_#2r, '_#3r, @@ -199,7 +199,7 @@ note: External requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0/1:46 ~ projection_two_region_trait_bound_closure[317d]::two_regions[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:60 ~ projection_two_region_trait_bound_closure[317d]::two_regions[0]::{{closure}}[0]) with closure substs [ '_#1r, T, i32, @@ -221,7 +221,7 @@ LL | | LL | | } | |_^ | - = note: defining type: DefId(0/0:13 ~ projection_two_region_trait_bound_closure[317d]::two_regions[0]) with substs [ + = note: defining type: DefId(0:56 ~ projection_two_region_trait_bound_closure[317d]::two_regions[0]) with substs [ '_#1r, T, ] @@ -243,7 +243,7 @@ note: External requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0/1:50 ~ projection_two_region_trait_bound_closure[317d]::two_regions_outlive[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:65 ~ projection_two_region_trait_bound_closure[317d]::two_regions_outlive[0]::{{closure}}[0]) with closure substs [ '_#1r, '_#2r, T, @@ -265,7 +265,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t)); LL | | } | |_^ | - = note: defining type: DefId(0/0:14 ~ projection_two_region_trait_bound_closure[317d]::two_regions_outlive[0]) with substs [ + = note: defining type: DefId(0:61 ~ projection_two_region_trait_bound_closure[317d]::two_regions_outlive[0]) with substs [ '_#1r, '_#2r, T, @@ -277,7 +277,7 @@ note: External requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0/1:53 ~ projection_two_region_trait_bound_closure[317d]::one_region[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:69 ~ projection_two_region_trait_bound_closure[317d]::one_region[0]::{{closure}}[0]) with closure substs [ '_#1r, T, i32, @@ -298,7 +298,7 @@ LL | | with_signature(cell, t, |cell, t| require(cell, t)); LL | | } | |_^ | - = note: defining type: DefId(0/0:15 ~ projection_two_region_trait_bound_closure[317d]::one_region[0]) with substs [ + = note: defining type: DefId(0:66 ~ projection_two_region_trait_bound_closure[317d]::one_region[0]) with substs [ '_#1r, T, ] diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr b/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr index 6f3071becfd0e..2ed94df1f3478 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr +++ b/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr @@ -4,10 +4,10 @@ note: External requirements LL | twice(cell, value, |a, b| invoke(a, b)); | ^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0/1:14 ~ ty_param_closure_approximate_lower_bound[317d]::generic[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:20 ~ ty_param_closure_approximate_lower_bound[317d]::generic[0]::{{closure}}[0]) with closure substs [ T, i16, - for<'r, 's> extern "rust-call" fn((std::option::Option>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 's)) T)), + for<'r, 's> extern "rust-call" fn((std::option::Option>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) T)), ] = note: number of external vids: 2 = note: where T: '_#1r @@ -21,7 +21,7 @@ LL | | twice(cell, value, |a, b| invoke(a, b)); LL | | } | |_^ | - = note: defining type: DefId(0/0:5 ~ ty_param_closure_approximate_lower_bound[317d]::generic[0]) with substs [ + = note: defining type: DefId(0:18 ~ ty_param_closure_approximate_lower_bound[317d]::generic[0]) with substs [ T, ] @@ -31,10 +31,10 @@ note: External requirements LL | twice(cell, value, |a, b| invoke(a, b)); | ^^^^^^^^^^^^^^^^^^^ | - = note: defining type: DefId(0/1:17 ~ ty_param_closure_approximate_lower_bound[317d]::generic_fail[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:24 ~ ty_param_closure_approximate_lower_bound[317d]::generic_fail[0]::{{closure}}[0]) with closure substs [ T, i16, - for<'r, 's> extern "rust-call" fn((std::option::Option>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 's)) T)), + for<'r, 's> extern "rust-call" fn((std::option::Option>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) T)), ] = note: late-bound region is '_#2r = note: number of external vids: 3 @@ -49,7 +49,7 @@ LL | | LL | | } | |_^ | - = note: defining type: DefId(0/0:6 ~ ty_param_closure_approximate_lower_bound[317d]::generic_fail[0]) with substs [ + = note: defining type: DefId(0:21 ~ ty_param_closure_approximate_lower_bound[317d]::generic_fail[0]) with substs [ T, ] @@ -59,7 +59,7 @@ error[E0309]: the parameter type `T` may not live long enough LL | twice(cell, value, |a, b| invoke(a, b)); | ^^^^^^^^^^^^^^^^^^^ | - = help: consider adding an explicit lifetime bound `T: ReFree(DefId(0/0:6 ~ ty_param_closure_approximate_lower_bound[317d]::generic_fail[0]), BrNamed(crate0:DefIndex(1:15), 'a))`... + = help: consider adding an explicit lifetime bound `T: ReFree(DefId(0:21 ~ ty_param_closure_approximate_lower_bound[317d]::generic_fail[0]), BrNamed(crate0:DefIndex(22), 'a))`... error: aborting due to previous error diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr index cdb715762031f..d689949969d7e 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr +++ b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr @@ -4,7 +4,7 @@ note: External requirements LL | with_signature(x, |y| y) | ^^^^^ | - = note: defining type: DefId(0/1:14 ~ ty_param_closure_outlives_from_return_type[317d]::no_region[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:20 ~ ty_param_closure_outlives_from_return_type[317d]::no_region[0]::{{closure}}[0]) with closure substs [ '_#1r, T, i32, @@ -25,7 +25,7 @@ LL | | LL | | } | |_^ | - = note: defining type: DefId(0/0:5 ~ ty_param_closure_outlives_from_return_type[317d]::no_region[0]) with substs [ + = note: defining type: DefId(0:17 ~ ty_param_closure_outlives_from_return_type[317d]::no_region[0]) with substs [ '_#1r, T, ] diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr index 68798a335f9df..11444c9f72bef 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr +++ b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr @@ -11,7 +11,7 @@ LL | | require(&x, &y) LL | | }) | |_____^ | - = note: defining type: DefId(0/1:16 ~ ty_param_closure_outlives_from_where_clause[317d]::no_region[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:23 ~ ty_param_closure_outlives_from_where_clause[317d]::no_region[0]::{{closure}}[0]) with closure substs [ T, i32, extern "rust-call" fn((std::cell::Cell<&'_#1r ()>, T)), @@ -32,7 +32,7 @@ LL | | }) LL | | } | |_^ | - = note: defining type: DefId(0/0:6 ~ ty_param_closure_outlives_from_where_clause[317d]::no_region[0]) with substs [ + = note: defining type: DefId(0:20 ~ ty_param_closure_outlives_from_where_clause[317d]::no_region[0]) with substs [ T, ] @@ -49,7 +49,7 @@ LL | | require(&x, &y) LL | | }) | |_____^ | - = help: consider adding an explicit lifetime bound `T: ReFree(DefId(0/0:6 ~ ty_param_closure_outlives_from_where_clause[317d]::no_region[0]), BrNamed(crate0:DefIndex(1:14), 'a))`... + = help: consider adding an explicit lifetime bound `T: ReFree(DefId(0:20 ~ ty_param_closure_outlives_from_where_clause[317d]::no_region[0]), BrNamed(crate0:DefIndex(21), 'a))`... note: External requirements --> $DIR/ty-param-closure-outlives-from-where-clause.rs:43:26 @@ -64,7 +64,7 @@ LL | | require(&x, &y) LL | | }) | |_____^ | - = note: defining type: DefId(0/1:19 ~ ty_param_closure_outlives_from_where_clause[317d]::correct_region[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:27 ~ ty_param_closure_outlives_from_where_clause[317d]::correct_region[0]::{{closure}}[0]) with closure substs [ '_#1r, T, i32, @@ -85,7 +85,7 @@ LL | | }) LL | | } | |_^ | - = note: defining type: DefId(0/0:7 ~ ty_param_closure_outlives_from_where_clause[317d]::correct_region[0]) with substs [ + = note: defining type: DefId(0:24 ~ ty_param_closure_outlives_from_where_clause[317d]::correct_region[0]) with substs [ '_#1r, T, ] @@ -101,7 +101,7 @@ LL | | require(&x, &y) LL | | }) | |_____^ | - = note: defining type: DefId(0/1:23 ~ ty_param_closure_outlives_from_where_clause[317d]::wrong_region[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:32 ~ ty_param_closure_outlives_from_where_clause[317d]::wrong_region[0]::{{closure}}[0]) with closure substs [ '_#1r, T, i32, @@ -123,7 +123,7 @@ LL | | }) LL | | } | |_^ | - = note: defining type: DefId(0/0:8 ~ ty_param_closure_outlives_from_where_clause[317d]::wrong_region[0]) with substs [ + = note: defining type: DefId(0:28 ~ ty_param_closure_outlives_from_where_clause[317d]::wrong_region[0]) with substs [ '_#1r, T, ] @@ -139,7 +139,7 @@ LL | | require(&x, &y) LL | | }) | |_____^ | - = help: consider adding an explicit lifetime bound `T: ReFree(DefId(0/0:8 ~ ty_param_closure_outlives_from_where_clause[317d]::wrong_region[0]), BrNamed(crate0:DefIndex(1:20), 'a))`... + = help: consider adding an explicit lifetime bound `T: ReFree(DefId(0:28 ~ ty_param_closure_outlives_from_where_clause[317d]::wrong_region[0]), BrNamed(crate0:DefIndex(29), 'a))`... note: External requirements --> $DIR/ty-param-closure-outlives-from-where-clause.rs:77:26 @@ -151,7 +151,7 @@ LL | | require(&x, &y) LL | | }) | |_____^ | - = note: defining type: DefId(0/1:27 ~ ty_param_closure_outlives_from_where_clause[317d]::outlives_region[0]::{{closure}}[0]) with closure substs [ + = note: defining type: DefId(0:37 ~ ty_param_closure_outlives_from_where_clause[317d]::outlives_region[0]::{{closure}}[0]) with closure substs [ '_#1r, '_#2r, T, @@ -173,7 +173,7 @@ LL | | }) LL | | } | |_^ | - = note: defining type: DefId(0/0:9 ~ ty_param_closure_outlives_from_where_clause[317d]::outlives_region[0]) with substs [ + = note: defining type: DefId(0:33 ~ ty_param_closure_outlives_from_where_clause[317d]::outlives_region[0]) with substs [ '_#1r, '_#2r, T, From b9c430129d5971df4410b6c829b100ce8191328e Mon Sep 17 00:00:00 2001 From: Peter Todd Date: Wed, 8 May 2019 22:38:58 -0400 Subject: [PATCH 4/5] Inline some Cursor calls for slices (Partially) brings back https://github.com/rust-lang/rust/pull/33921 --- src/libstd/io/cursor.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libstd/io/cursor.rs b/src/libstd/io/cursor.rs index 64f8659b8f8fe..f627fb0f562f0 100644 --- a/src/libstd/io/cursor.rs +++ b/src/libstd/io/cursor.rs @@ -265,6 +265,7 @@ impl BufRead for Cursor where T: AsRef<[u8]> { } // Non-resizing write implementation +#[inline] fn slice_write(pos_mut: &mut u64, slice: &mut [u8], buf: &[u8]) -> io::Result { let pos = cmp::min(*pos_mut, slice.len() as u64); let amt = (&mut slice[(pos as usize)..]).write(buf)?; @@ -272,6 +273,7 @@ fn slice_write(pos_mut: &mut u64, slice: &mut [u8], buf: &[u8]) -> io::Result { slice_write_vectored(&mut self.pos, self.inner, bufs) } + #[inline] fn flush(&mut self) -> io::Result<()> { Ok(()) } } @@ -354,6 +357,7 @@ impl Write for Cursor<&mut Vec> { vec_write_vectored(&mut self.pos, self.inner, bufs) } + #[inline] fn flush(&mut self) -> io::Result<()> { Ok(()) } } @@ -367,6 +371,7 @@ impl Write for Cursor> { vec_write_vectored(&mut self.pos, &mut self.inner, bufs) } + #[inline] fn flush(&mut self) -> io::Result<()> { Ok(()) } } @@ -382,6 +387,7 @@ impl Write for Cursor> { slice_write_vectored(&mut self.pos, &mut self.inner, bufs) } + #[inline] fn flush(&mut self) -> io::Result<()> { Ok(()) } } From 028e78d93aac664325d7ed49703032bc3ed3c185 Mon Sep 17 00:00:00 2001 From: Yuki OKUSHI Date: Thu, 9 May 2019 11:58:39 +0900 Subject: [PATCH 5/5] Stabilize and re-export core::array --- src/libcore/array.rs | 10 ++++++---- src/libstd/lib.rs | 3 ++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/libcore/array.rs b/src/libcore/array.rs index fb9c99f667df2..e4cadcbf75b90 100644 --- a/src/libcore/array.rs +++ b/src/libcore/array.rs @@ -4,10 +4,7 @@ //! //! *[See also the array primitive type](../../std/primitive.array.html).* -#![unstable(feature = "fixed_size_array", - reason = "traits and impls are better expressed through generic \ - integer constants", - issue = "27778")] +#![stable(feature = "core_array", since = "1.36.0")] use crate::borrow::{Borrow, BorrowMut}; use crate::cmp::Ordering; @@ -30,13 +27,17 @@ use crate::slice::{Iter, IterMut}; /// Note that the traits AsRef and AsMut provide similar methods for types that /// may not be fixed-size arrays. Implementors should prefer those traits /// instead. +#[unstable(feature = "fixed_size_array", issue = "27778")] pub unsafe trait FixedSizeArray { /// Converts the array to immutable slice + #[unstable(feature = "fixed_size_array", issue = "27778")] fn as_slice(&self) -> &[T]; /// Converts the array to mutable slice + #[unstable(feature = "fixed_size_array", issue = "27778")] fn as_mut_slice(&mut self) -> &mut [T]; } +#[unstable(feature = "fixed_size_array", issue = "27778")] unsafe impl> FixedSizeArray for A { #[inline] fn as_slice(&self) -> &[T] { @@ -53,6 +54,7 @@ unsafe impl> FixedSizeArray for A { #[derive(Debug, Copy, Clone)] pub struct TryFromSliceError(()); +#[stable(feature = "core_array", since = "1.36.0")] impl fmt::Display for TryFromSliceError { #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 215f1bbc971af..3976f2344e241 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -259,7 +259,6 @@ #![feature(exact_size_is_empty)] #![feature(exhaustive_patterns)] #![feature(external_doc)] -#![feature(fixed_size_array)] #![feature(fn_traits)] #![feature(fnbox)] #![feature(generator_trait)] @@ -435,6 +434,8 @@ pub use core::char; pub use core::u128; #[stable(feature = "core_hint", since = "1.27.0")] pub use core::hint; +#[stable(feature = "core_array", since = "1.36.0")] +pub use core::array; pub mod f32; pub mod f64;