Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix imports of built-in macros (mostly) #61877

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/librustc/hir/def_id.rs
Original file line number Diff line number Diff line change
@@ -13,10 +13,8 @@ newtype_index! {

#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum CrateNum {
/// Virtual crate for builtin macros
// FIXME(jseyfried): this is also used for custom derives until proc-macro crates get
// `CrateNum`s.
BuiltinMacros,
/// Virtual crate for legacy proc macros registered with `#![plugin]`.
LegacyProcMacros,
/// A special CrateNum that we use for the tcx.rcache when decoding from
/// the incr. comp. cache.
ReservedForIncrCompCache,
@@ -27,7 +25,7 @@ impl ::std::fmt::Debug for CrateNum {
fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
CrateNum::Index(id) => write!(fmt, "crate{}", id.private),
CrateNum::BuiltinMacros => write!(fmt, "builtin macros crate"),
CrateNum::LegacyProcMacros => write!(fmt, "legacy proc macros crate"),
CrateNum::ReservedForIncrCompCache => write!(fmt, "crate for decoding incr comp cache"),
}
}
@@ -87,7 +85,7 @@ impl fmt::Display for CrateNum {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
CrateNum::Index(id) => fmt::Display::fmt(&id.private, f),
CrateNum::BuiltinMacros => write!(f, "builtin macros crate"),
CrateNum::LegacyProcMacros => write!(f, "legacy proc macros crate"),
CrateNum::ReservedForIncrCompCache => write!(f, "crate for decoding incr comp cache"),
}
}
6 changes: 5 additions & 1 deletion src/librustc/hir/map/definitions.rs
Original file line number Diff line number Diff line change
@@ -394,7 +394,11 @@ impl Definitions {
#[inline]
pub fn def_index_to_hir_id(&self, def_index: DefIndex) -> hir::HirId {
let node_id = self.def_index_to_node[def_index.index()];
self.node_to_hir_id[node_id]
if unlikely!(node_id == ast::DUMMY_NODE_ID) {
hir::DUMMY_HIR_ID
} else {
self.node_to_hir_id[node_id]
}
}

#[inline]
4 changes: 4 additions & 0 deletions src/librustc_metadata/cstore_impl.rs
Original file line number Diff line number Diff line change
@@ -381,6 +381,10 @@ pub fn provide<'tcx>(providers: &mut Providers<'tcx>) {
}

impl cstore::CStore {
pub fn is_proc_macro_untracked(&self, def_id: DefId) -> bool {
self.get_crate_data(def_id.krate).is_proc_macro(def_id.index)
}

pub fn export_macros_untracked(&self, cnum: CrateNum) {
let data = self.get_crate_data(cnum);
let mut dep_kind = data.dep_kind.lock();
7 changes: 5 additions & 2 deletions src/librustc_metadata/decoder.rs
Original file line number Diff line number Diff line change
@@ -470,7 +470,7 @@ crate fn proc_macro_def_path_table(crate_root: &CrateRoot<'_>,
}

impl<'a, 'tcx> CrateMetadata {
fn is_proc_macro(&self, id: DefIndex) -> bool {
crate fn is_proc_macro(&self, id: DefIndex) -> bool {
self.proc_macros.is_some() && id != CRATE_DEF_INDEX
}

@@ -665,7 +665,10 @@ impl<'a, 'tcx> CrateMetadata {
pub fn get_deprecation(&self, id: DefIndex) -> Option<attr::Deprecation> {
match self.is_proc_macro(id) {
true => None,
false => self.entry(id).deprecation.map(|depr| depr.decode(self)),
// Deprecation may be queried for built-in macro imports
// for which the entry doesn't exist.
false => self.maybe_entry(id).and_then(|e| e.decode(self).deprecation)
.map(|depr| depr.decode(self)),
}
}

26 changes: 25 additions & 1 deletion src/librustc_resolve/build_reduced_graph.rs
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@ use crate::{resolve_error, resolve_struct_error, ResolutionError};
use rustc::bug;
use rustc::hir::def::{self, *};
use rustc::hir::def_id::{CrateNum, CRATE_DEF_INDEX, LOCAL_CRATE, DefId};
use rustc::hir::map::definitions::FIRST_FREE_DEF_INDEX;
use rustc::ty;
use rustc::middle::cstore::CrateStore;
use rustc_metadata::cstore::LoadedMacro;
@@ -757,11 +758,25 @@ impl<'a> Resolver<'a> {
module
}

crate fn is_builtin_macro(&self, def_id: DefId) -> bool {
// Built-in macros are supposed to occupy a continuous range of `DefIndex`es immediately
// following `GlobalMetaData` entries. This is ensured by calling
// `syntax_ext::register_builtins` immediately after initializing `Definitions`.
// This range is identical in both the local crate and other crates in cstore.
// Proc-macro "views" of other crates in cstore don't have this range, thus the last
// condition.
let index_match = def_id.index.index() < FIRST_FREE_DEF_INDEX + self.num_builtin_macros;
let crate_match = def_id.is_local() ||
def_id.krate != CrateNum::LegacyProcMacros &&
!self.cstore.is_proc_macro_untracked(def_id);
index_match && crate_match
}

pub fn macro_def_scope(&mut self, expansion: Mark) -> Module<'a> {
let def_id = self.macro_defs[&expansion];
if let Some(id) = self.definitions.as_local_node_id(def_id) {
self.local_macro_def_scopes[&id]
} else if def_id.krate == CrateNum::BuiltinMacros {
} else if self.is_builtin_macro(def_id) || def_id.krate == CrateNum::LegacyProcMacros {
self.injected_crate.unwrap_or(self.graph_root)
} else {
let module_def_id = ty::DefIdTree::parent(&*self, def_id).unwrap();
@@ -777,6 +792,15 @@ impl<'a> Resolver<'a> {
}),
_ => panic!("expected `DefKind::Macro` or `Res::NonMacroAttr`"),
};

// Built-in macro from another crate is the same as its local equivalent,
// which always can be found in the `macro_map`.
let def_id = if self.is_builtin_macro(def_id) {
DefId::local(def_id.index)
} else {
def_id
};

if let Some(ext) = self.macro_map.get(&def_id) {
return ext.clone();
}
3 changes: 3 additions & 0 deletions src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
@@ -1670,6 +1670,8 @@ pub struct Resolver<'a> {
crate_loader: &'a mut CrateLoader<'a>,
macro_names: FxHashSet<Ident>,
builtin_macros: FxHashMap<Name, &'a NameBinding<'a>>,
/// Number of built-in macros excluding user extensions from `#![plugin]`.
num_builtin_macros: usize,
macro_use_prelude: FxHashMap<Name, &'a NameBinding<'a>>,
pub all_macros: FxHashMap<Name, Res>,
macro_map: FxHashMap<DefId, Lrc<SyntaxExtension>>,
@@ -2016,6 +2018,7 @@ impl<'a> Resolver<'a> {
crate_loader,
macro_names: FxHashSet::default(),
builtin_macros: FxHashMap::default(),
num_builtin_macros: 0,
macro_use_prelude: FxHashMap::default(),
all_macros: FxHashMap::default(),
macro_map: FxHashMap::default(),
21 changes: 16 additions & 5 deletions src/librustc_resolve/macros.rs
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ use crate::build_reduced_graph::{BuildReducedGraphVisitor, IsMacroExport};
use crate::resolve_imports::ImportResolver;
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::hir::map::{self, DefCollector, DefPathData};
use rustc::{ty, lint};
use rustc::{bug, span_bug};
use syntax::ast::{self, Ident};
@@ -169,10 +169,21 @@ impl<'a> base::Resolver for Resolver<'a> {
invocation.output_legacy_scope.set(Some(visitor.current_legacy_scope));
}

fn add_builtin(&mut self, ident: ast::Ident, ext: Lrc<SyntaxExtension>) {
let def_id = DefId {
krate: CrateNum::BuiltinMacros,
index: DefIndex::from(self.macro_map.len()),
fn add_builtin(&mut self, ident: ast::Ident, ext: Lrc<SyntaxExtension>, is_user_ext: bool) {
let def_id = if is_user_ext {
DefId {
krate: CrateNum::LegacyProcMacros,
index: DefIndex::from(self.macro_map.len()),
}
} else {
self.num_builtin_macros += 1;
DefId::local(self.definitions.create_def_with_parent(
CRATE_DEF_INDEX,
ast::DUMMY_NODE_ID,
DefPathData::MacroNs(ident.as_interned_str()),
Mark::root(),
DUMMY_SP,
))
};
let kind = ext.kind();
self.macro_map.insert(def_id, ext);
19 changes: 15 additions & 4 deletions src/librustc_resolve/resolve_imports.rs
Original file line number Diff line number Diff line change
@@ -29,6 +29,7 @@ use rustc::{bug, span_bug};
use syntax::ast::{self, Ident, Name, NodeId, CRATE_NODE_ID};
use syntax::ext::base::Determinacy::{self, Determined, Undetermined};
use syntax::ext::hygiene::Mark;
use syntax::feature_gate::{emit_feature_err, GateIssue};
use syntax::symbol::{kw, sym};
use syntax::util::lev_distance::find_best_match_for_name;
use syntax::{struct_span_err, unwrap_or};
@@ -1226,12 +1227,22 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
self.per_ns(|this, ns| if let Some(binding) = source_bindings[ns].get().ok() {
let mut res = binding.res();
if let Res::Def(DefKind::Macro(_), def_id) = res {
// `DefId`s from the "built-in macro crate" should not leak from resolve because
// `DefId`s from the "legacy proc macro crate" should not leak from resolve because
// later stages are not ready to deal with them and produce lots of ICEs. Replace
// them with `Res::Err` until some saner scheme is implemented for built-in macros.
if def_id.krate == CrateNum::BuiltinMacros {
// them with `Res::Err` until legacy proc macros are removed.
if def_id.krate == CrateNum::LegacyProcMacros {
this.session.span_err(directive.span, "cannot import a built-in macro");
res = Res::Err;
} else if this.is_builtin_macro(def_id) {
if !this.session.features_untracked().builtin_macro_imports {
emit_feature_err(
&this.session.parse_sess,
sym::builtin_macro_imports,
directive.span,
GateIssue::Language,
"imports of built-in macros are unstable",
);
}
}
}
this.import_res_map.entry(directive.id).or_default()[ns] = Some(res);
@@ -1398,7 +1409,7 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
let res = binding.res();
if res != Res::Err {
if let Some(def_id) = res.opt_def_id() {
if !def_id.is_local() && def_id.krate != CrateNum::BuiltinMacros {
if !def_id.is_local() && def_id.krate != CrateNum::LegacyProcMacros {
self.cstore.export_macros_untracked(def_id.krate);
}
}
27 changes: 1 addition & 26 deletions src/libsyntax/ext/base.rs
Original file line number Diff line number Diff line change
@@ -674,7 +674,7 @@ pub trait Resolver {
fn resolve_dollar_crates(&mut self, fragment: &AstFragment);
fn visit_ast_fragment_with_placeholders(&mut self, mark: Mark, fragment: &AstFragment,
derives: &[Mark]);
fn add_builtin(&mut self, ident: ast::Ident, ext: Lrc<SyntaxExtension>);
fn add_builtin(&mut self, ident: ast::Ident, ext: Lrc<SyntaxExtension>, is_user_ext: bool);

fn resolve_imports(&mut self);

@@ -699,31 +699,6 @@ impl Determinacy {
}
}

pub struct DummyResolver;

impl Resolver for DummyResolver {
fn next_node_id(&mut self) -> ast::NodeId { ast::DUMMY_NODE_ID }

fn get_module_scope(&mut self, _id: ast::NodeId) -> Mark { Mark::root() }

fn resolve_dollar_crates(&mut self, _fragment: &AstFragment) {}
fn visit_ast_fragment_with_placeholders(&mut self, _invoc: Mark, _fragment: &AstFragment,
_derives: &[Mark]) {}
fn add_builtin(&mut self, _ident: ast::Ident, _ext: Lrc<SyntaxExtension>) {}

fn resolve_imports(&mut self) {}
fn resolve_macro_invocation(&mut self, _invoc: &Invocation, _invoc_id: Mark, _force: bool)
-> Result<Option<Lrc<SyntaxExtension>>, Determinacy> {
Err(Determinacy::Determined)
}
fn resolve_macro_path(&mut self, _path: &ast::Path, _kind: MacroKind, _invoc_id: Mark,
_derives_in_scope: Vec<ast::Path>, _force: bool)
-> Result<Lrc<SyntaxExtension>, Determinacy> {
Err(Determinacy::Determined)
}
fn check_unused_macros(&self) {}
}

#[derive(Clone)]
pub struct ModuleData {
pub mod_path: Vec<ast::Ident>,
3 changes: 3 additions & 0 deletions src/libsyntax/feature_gate.rs
Original file line number Diff line number Diff line change
@@ -570,6 +570,9 @@ declare_features! (
// #[repr(transparent)] on unions.
(active, transparent_unions, "1.37.0", Some(60405), None),

// `use builtin_macro`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// `use builtin_macro`.
// Allows `use builtin_macro;`.

(active, builtin_macro_imports, "1.37.0", Some(61875), None),

// -------------------------------------------------------------------------
// feature-group-end: actual feature gates
// -------------------------------------------------------------------------
3 changes: 2 additions & 1 deletion src/libsyntax_ext/deriving/mod.rs
Original file line number Diff line number Diff line change
@@ -71,7 +71,8 @@ macro_rules! derive_traits {
$(
resolver.add_builtin(
ast::Ident::with_empty_ctxt(Symbol::intern($name)),
Lrc::new(SyntaxExtension::LegacyDerive(Box::new(BuiltinDerive($func))))
Lrc::new(SyntaxExtension::LegacyDerive(Box::new(BuiltinDerive($func)))),
false,
);
)*
}
7 changes: 5 additions & 2 deletions src/libsyntax_ext/lib.rs
Original file line number Diff line number Diff line change
@@ -53,8 +53,11 @@ pub fn register_builtins(resolver: &mut dyn syntax::ext::base::Resolver,
edition: Edition) {
deriving::register_builtin_derives(resolver);

let mut register_user = |name, ext, is_user_ext| {
resolver.add_builtin(ast::Ident::with_empty_ctxt(name), Lrc::new(ext), is_user_ext);
};
let mut register = |name, ext| {
resolver.add_builtin(ast::Ident::with_empty_ctxt(name), Lrc::new(ext));
register_user(name, ext, false);
};
macro_rules! register {
($( $name:ident: $f:expr, )*) => { $(
@@ -126,6 +129,6 @@ pub fn register_builtins(resolver: &mut dyn syntax::ext::base::Resolver,
});

for (name, ext) in user_exts {
register(name, ext);
register_user(name, ext, true);
}
}
1 change: 1 addition & 0 deletions src/libsyntax_pos/symbol.rs
Original file line number Diff line number Diff line change
@@ -162,6 +162,7 @@ symbols! {
box_patterns,
box_syntax,
braced_empty_structs,
builtin_macro_imports,
C,
cdylib,
cfg,
2 changes: 1 addition & 1 deletion src/test/mir-opt/graphviz.rs
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ fn main() {}

// END RUST SOURCE
// START rustc.main.mir_map.0.dot
// digraph Mir_0_12 { // The name here MUST be an ASCII identifier.
// digraph Mir_0_52 { // The name here MUST be an ASCII identifier.
// graph [fontname="monospace"];
// node [fontname="monospace"];
// edge [fontname="monospace"];
2 changes: 1 addition & 1 deletion src/test/mir-opt/inline-closure-borrows-arg.rs
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ fn foo<T: Copy>(_t: T, q: &i32) -> i32 {
// ...
// bb0: {
// ...
// _3 = [closure@HirId { owner: DefIndex(13), local_id: 31 }];
// _3 = [closure@HirId { owner: DefIndex(53), local_id: 31 }];
// ...
// _4 = &_3;
// ...
2 changes: 1 addition & 1 deletion src/test/mir-opt/inline-closure.rs
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ fn foo<T: Copy>(_t: T, q: i32) -> i32 {
// ...
// bb0: {
// ...
// _3 = [closure@HirId { owner: DefIndex(13), local_id: 15 }];
// _3 = [closure@HirId { owner: DefIndex(53), local_id: 15 }];
// ...
// _4 = &_3;
// ...
2 changes: 1 addition & 1 deletion src/test/mir-opt/retag.rs
Original file line number Diff line number Diff line change
@@ -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(20), local_id: 72 }], _2: &i32) -> &i32 {
// fn main::{{closure}}#0(_1: &[closure@HirId { owner: DefIndex(60), local_id: 72 }], _2: &i32) -> &i32 {
// ...
// bb0: {
// Retag([fn entry] _1);
16 changes: 11 additions & 5 deletions src/test/ui-fulldeps/auxiliary/attr-plugin-test.rs
Original file line number Diff line number Diff line change
@@ -3,19 +3,25 @@
#![feature(plugin_registrar)]
#![feature(rustc_private)]

extern crate syntax;

extern crate rustc;
extern crate rustc_plugin;
extern crate syntax_pos;
extern crate syntax;

use syntax::symbol::Symbol;
use syntax::feature_gate::AttributeType;
use rustc_plugin::Registry;
use syntax_pos::Span;
use syntax::ext::base::{ExtCtxt, MacResult, MacEager};
use syntax::feature_gate::AttributeType;
use syntax::symbol::Symbol;
use syntax::tokenstream::TokenTree;

fn empty(_: &mut ExtCtxt, _: Span, _: &[TokenTree]) -> Box<dyn MacResult + 'static> {
MacEager::items(Default::default())
}

#[plugin_registrar]
pub fn plugin_registrar(reg: &mut Registry) {
reg.register_attribute(Symbol::intern("foo"), AttributeType::Normal);
reg.register_attribute(Symbol::intern("bar"), AttributeType::CrateLevel);
reg.register_attribute(Symbol::intern("baz"), AttributeType::Whitelisted);
reg.register_macro("empty", empty);
}
10 changes: 10 additions & 0 deletions src/test/ui-fulldeps/plugin-import.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// edition:2018
// ignore-stage1
// aux-build:attr-plugin-test.rs

#![feature(plugin)]
#![plugin(attr_plugin_test)]

use empty as full; //~ ERROR cannot import a built-in macro

fn main() {}
8 changes: 8 additions & 0 deletions src/test/ui-fulldeps/plugin-import.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: cannot import a built-in macro
--> $DIR/plugin-import.rs:8:5
|
LL | use empty as full;
| ^^^^^^^^^^^^^

error: aborting due to previous error

Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ note: No external requirements
LL | let mut closure = expect_sig(|p, y| *p = y);
| ^^^^^^^^^^^^^
|
= note: defining type: DefId(0:13 ~ escape_argument_callee[317d]::test[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:53 ~ 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), 'r)) mut &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) i32, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 't0)) i32)),
]
@@ -30,7 +30,7 @@ LL | | deref(p);
LL | | }
| |_^
|
= note: defining type: DefId(0:12 ~ escape_argument_callee[317d]::test[0]) with substs []
= note: defining type: DefId(0:52 ~ escape_argument_callee[317d]::test[0]) with substs []

error: aborting due to previous error

4 changes: 2 additions & 2 deletions src/test/ui/nll/closure-requirements/escape-argument.stderr
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ note: No external requirements
LL | let mut closure = expect_sig(|p, y| *p = y);
| ^^^^^^^^^^^^^
|
= note: defining type: DefId(0:13 ~ escape_argument[317d]::test[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:53 ~ 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), 'r)) mut &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) i32, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) i32)),
]
@@ -21,7 +21,7 @@ LL | | deref(p);
LL | | }
| |_^
|
= note: defining type: DefId(0:12 ~ escape_argument[317d]::test[0]) with substs []
= note: defining type: DefId(0:52 ~ escape_argument[317d]::test[0]) with substs []

error[E0597]: `y` does not live long enough
--> $DIR/escape-argument.rs:27:25
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ note: External requirements
LL | let mut closure1 = || p = &y;
| ^^^^^^^^^
|
= note: defining type: DefId(0:14 ~ escape_upvar_nested[317d]::test[0]::{{closure}}[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:54 ~ escape_upvar_nested[317d]::test[0]::{{closure}}[0]::{{closure}}[0]) with closure substs [
i16,
extern "rust-call" fn(()),
&'_#1r i32,
@@ -23,7 +23,7 @@ LL | | closure1();
LL | | };
| |_________^
|
= note: defining type: DefId(0:13 ~ escape_upvar_nested[317d]::test[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:53 ~ escape_upvar_nested[317d]::test[0]::{{closure}}[0]) with closure substs [
i16,
extern "rust-call" fn(()),
&'_#1r i32,
@@ -44,7 +44,7 @@ LL | | deref(p);
LL | | }
| |_^
|
= note: defining type: DefId(0:12 ~ escape_upvar_nested[317d]::test[0]) with substs []
= note: defining type: DefId(0:52 ~ escape_upvar_nested[317d]::test[0]) with substs []

error[E0597]: `y` does not live long enough
--> $DIR/escape-upvar-nested.rs:21:40
4 changes: 2 additions & 2 deletions src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ note: External requirements
LL | let mut closure = || p = &y;
| ^^^^^^^^^
|
= note: defining type: DefId(0:13 ~ escape_upvar_ref[317d]::test[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:53 ~ escape_upvar_ref[317d]::test[0]::{{closure}}[0]) with closure substs [
i16,
extern "rust-call" fn(()),
&'_#1r i32,
@@ -25,7 +25,7 @@ LL | | deref(p);
LL | | }
| |_^
|
= note: defining type: DefId(0:12 ~ escape_upvar_ref[317d]::test[0]) with substs []
= note: defining type: DefId(0:52 ~ escape_upvar_ref[317d]::test[0]) with substs []

error[E0597]: `y` does not live long enough
--> $DIR/escape-upvar-ref.rs:23:35
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ LL | | demand_y(x, y, p)
LL | | },
| |_________^
|
= note: defining type: DefId(0:27 ~ propagate_approximated_fail_no_postdom[317d]::supply[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:67 ~ 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), '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>)),
]
@@ -39,7 +39,7 @@ LL | | );
LL | | }
| |_^
|
= note: defining type: DefId(0:23 ~ propagate_approximated_fail_no_postdom[317d]::supply[0]) with substs []
= note: defining type: DefId(0:63 ~ propagate_approximated_fail_no_postdom[317d]::supply[0]) with substs []

error: aborting due to previous error

Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ LL | |
LL | | });
| |_____^
|
= note: defining type: DefId(0:25 ~ propagate_approximated_ref[317d]::supply[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:65 ~ 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), '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>)),
]
@@ -30,7 +30,7 @@ LL | | });
LL | | }
| |_^
|
= note: defining type: DefId(0:22 ~ propagate_approximated_ref[317d]::supply[0]) with substs []
= note: defining type: DefId(0:62 ~ propagate_approximated_ref[317d]::supply[0]) with substs []

error: lifetime may not live long enough
--> $DIR/propagate-approximated-ref.rs:45:9
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ LL | |
LL | | })
| |_____^
|
= note: defining type: DefId(0:18 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case1[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:58 ~ 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), 'r)) u32>)),
]
@@ -35,7 +35,7 @@ LL | | })
LL | | }
| |_^
|
= note: defining type: DefId(0:17 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case1[0]) with substs []
= note: defining type: DefId(0:57 ~ 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,7 +46,7 @@ LL | | cell_x.set(cell_a.get()); // forces 'a: 'x, implies 'a = 'static
LL | | })
| |_____^
|
= note: defining type: DefId(0:20 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case2[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:60 ~ 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), 'r)) u32>)),
]
@@ -65,7 +65,7 @@ LL | | })
LL | | }
| |_^
|
= note: defining type: DefId(0:19 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case2[0]) with substs []
= note: defining type: DefId(0:59 ~ 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
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ LL | | demand_y(x, y, x.get())
LL | | });
| |_____^
|
= note: defining type: DefId(0:25 ~ propagate_approximated_shorter_to_static_no_bound[317d]::supply[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:65 ~ 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), '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>)),
]
@@ -31,7 +31,7 @@ LL | | });
LL | | }
| |_^
|
= note: defining type: DefId(0:22 ~ propagate_approximated_shorter_to_static_no_bound[317d]::supply[0]) with substs []
= note: defining type: DefId(0:62 ~ 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
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ LL | | demand_y(x, y, x.get())
LL | | });
| |_____^
|
= note: defining type: DefId(0:25 ~ propagate_approximated_shorter_to_static_wrong_bound[317d]::supply[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:65 ~ 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), '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>)),
]
@@ -31,7 +31,7 @@ LL | | });
LL | | }
| |_^
|
= note: defining type: DefId(0:22 ~ propagate_approximated_shorter_to_static_wrong_bound[317d]::supply[0]) with substs []
= note: defining type: DefId(0:62 ~ 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
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ LL | |
LL | | });
| |_____^
|
= note: defining type: DefId(0:25 ~ propagate_approximated_val[317d]::test[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:65 ~ 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), '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>)),
]
@@ -30,7 +30,7 @@ LL | | });
LL | | }
| |_^
|
= note: defining type: DefId(0:22 ~ propagate_approximated_val[317d]::test[0]) with substs []
= note: defining type: DefId(0:62 ~ propagate_approximated_val[317d]::test[0]) with substs []

error: lifetime may not live long enough
--> $DIR/propagate-approximated-val.rs:38:9
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ LL | | demand_y(x, y, p)
LL | | },
| |_________^
|
= note: defining type: DefId(0:23 ~ propagate_despite_same_free_region[317d]::supply[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:63 ~ 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), '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>)),
]
@@ -28,5 +28,5 @@ LL | | );
LL | | }
| |_^
|
= note: defining type: DefId(0:21 ~ propagate_despite_same_free_region[317d]::supply[0]) with substs []
= note: defining type: DefId(0:61 ~ propagate_despite_same_free_region[317d]::supply[0]) with substs []

Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ LL | |
LL | | });
| |_____^
|
= note: defining type: DefId(0:25 ~ propagate_fail_to_approximate_longer_no_bounds[317d]::supply[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:65 ~ 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), '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>)),
]
@@ -39,7 +39,7 @@ LL | | });
LL | | }
| |_^
|
= note: defining type: DefId(0:22 ~ propagate_fail_to_approximate_longer_no_bounds[317d]::supply[0]) with substs []
= note: defining type: DefId(0:62 ~ propagate_fail_to_approximate_longer_no_bounds[317d]::supply[0]) with substs []

error: aborting due to previous error

Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ LL | |
LL | | });
| |_____^
|
= note: defining type: DefId(0:25 ~ propagate_fail_to_approximate_longer_wrong_bounds[317d]::supply[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:65 ~ 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), '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>)),
]
@@ -39,7 +39,7 @@ LL | | });
LL | | }
| |_^
|
= note: defining type: DefId(0:22 ~ propagate_fail_to_approximate_longer_wrong_bounds[317d]::supply[0]) with substs []
= note: defining type: DefId(0:62 ~ propagate_fail_to_approximate_longer_wrong_bounds[317d]::supply[0]) with substs []

error: aborting due to previous error

Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ LL | | require(value);
LL | | });
| |_____^
|
= note: defining type: DefId(0:23 ~ propagate_from_trait_match[317d]::supply[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:63 ~ 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:20 ~ propagate_from_trait_match[317d]::supply[0]) with substs [
= note: defining type: DefId(0:60 ~ propagate_from_trait_match[317d]::supply[0]) with substs [
'_#1r,
T,
]
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ note: No external requirements
LL | expect_sig(|a, b| b); // ought to return `a`
| ^^^^^^^^
|
= note: defining type: DefId(0:13 ~ return_wrong_bound_region[317d]::test[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:53 ~ 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), 'r)) i32, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) i32)) -> &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) i32,
]
@@ -27,7 +27,7 @@ LL | |
LL | | }
| |_^
|
= note: defining type: DefId(0:12 ~ return_wrong_bound_region[317d]::test[0]) with substs []
= note: defining type: DefId(0:52 ~ return_wrong_bound_region[317d]::test[0]) with substs []

error: aborting due to previous error

16 changes: 8 additions & 8 deletions src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ note: External requirements
LL | with_signature(x, |mut y| Box::new(y.next()))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0:22 ~ projection_no_regions_closure[317d]::no_region[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:62 ~ 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:19 ~ projection_no_regions_closure[317d]::no_region[0]) with substs [
= note: defining type: DefId(0:59 ~ 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:26 ~ projection_no_regions_closure[317d]::correct_region[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:66 ~ 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:23 ~ projection_no_regions_closure[317d]::correct_region[0]) with substs [
= note: defining type: DefId(0:63 ~ 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:31 ~ projection_no_regions_closure[317d]::wrong_region[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:71 ~ 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:27 ~ projection_no_regions_closure[317d]::wrong_region[0]) with substs [
= note: defining type: DefId(0:67 ~ 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:36 ~ projection_no_regions_closure[317d]::outlives_region[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:76 ~ 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:32 ~ projection_no_regions_closure[317d]::outlives_region[0]) with substs [
= note: defining type: DefId(0:72 ~ projection_no_regions_closure[317d]::outlives_region[0]) with substs [
'_#1r,
'_#2r,
T,
18 changes: 9 additions & 9 deletions src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ note: External requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0:28 ~ projection_one_region_closure[317d]::no_relationships_late[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:68 ~ 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:24 ~ projection_one_region_closure[317d]::no_relationships_late[0]) with substs [
= note: defining type: DefId(0:64 ~ 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:24 ~ projection_one_region_closure[317d]::no_relationships_late[0]), BrNamed(crate0:DefIndex(25), 'a))`...
= help: consider adding an explicit lifetime bound `T: ReFree(DefId(0:64 ~ projection_one_region_closure[317d]::no_relationships_late[0]), BrNamed(crate0:DefIndex(65), '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:33 ~ projection_one_region_closure[317d]::no_relationships_early[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:73 ~ 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:29 ~ projection_one_region_closure[317d]::no_relationships_early[0]) with substs [
= note: defining type: DefId(0:69 ~ 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:38 ~ projection_one_region_closure[317d]::projection_outlives[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:78 ~ 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:34 ~ projection_one_region_closure[317d]::projection_outlives[0]) with substs [
= note: defining type: DefId(0:74 ~ 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:43 ~ projection_one_region_closure[317d]::elements_outlive[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:83 ~ 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:39 ~ projection_one_region_closure[317d]::elements_outlive[0]) with substs [
= note: defining type: DefId(0:79 ~ projection_one_region_closure[317d]::elements_outlive[0]) with substs [
'_#1r,
'_#2r,
T,
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ note: External requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0:28 ~ projection_one_region_trait_bound_closure[317d]::no_relationships_late[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:68 ~ 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:24 ~ projection_one_region_trait_bound_closure[317d]::no_relationships_late[0]) with substs [
= note: defining type: DefId(0:64 ~ 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:33 ~ projection_one_region_trait_bound_closure[317d]::no_relationships_early[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:73 ~ 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:29 ~ projection_one_region_trait_bound_closure[317d]::no_relationships_early[0]) with substs [
= note: defining type: DefId(0:69 ~ 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:38 ~ projection_one_region_trait_bound_closure[317d]::projection_outlives[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:78 ~ 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:34 ~ projection_one_region_trait_bound_closure[317d]::projection_outlives[0]) with substs [
= note: defining type: DefId(0:74 ~ 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:43 ~ projection_one_region_trait_bound_closure[317d]::elements_outlive[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:83 ~ 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:39 ~ projection_one_region_trait_bound_closure[317d]::elements_outlive[0]) with substs [
= note: defining type: DefId(0:79 ~ 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:47 ~ projection_one_region_trait_bound_closure[317d]::one_region[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:87 ~ 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:44 ~ projection_one_region_trait_bound_closure[317d]::one_region[0]) with substs [
= note: defining type: DefId(0:84 ~ projection_one_region_trait_bound_closure[317d]::one_region[0]) with substs [
'_#1r,
T,
]
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ note: No external requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0:28 ~ projection_one_region_trait_bound_static_closure[317d]::no_relationships_late[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:68 ~ 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:24 ~ projection_one_region_trait_bound_static_closure[317d]::no_relationships_late[0]) with substs [
= note: defining type: DefId(0:64 ~ 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:33 ~ projection_one_region_trait_bound_static_closure[317d]::no_relationships_early[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:73 ~ 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:29 ~ projection_one_region_trait_bound_static_closure[317d]::no_relationships_early[0]) with substs [
= note: defining type: DefId(0:69 ~ 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:38 ~ projection_one_region_trait_bound_static_closure[317d]::projection_outlives[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:78 ~ 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:34 ~ projection_one_region_trait_bound_static_closure[317d]::projection_outlives[0]) with substs [
= note: defining type: DefId(0:74 ~ 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:43 ~ projection_one_region_trait_bound_static_closure[317d]::elements_outlive[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:83 ~ 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:39 ~ projection_one_region_trait_bound_static_closure[317d]::elements_outlive[0]) with substs [
= note: defining type: DefId(0:79 ~ 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:47 ~ projection_one_region_trait_bound_static_closure[317d]::one_region[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:87 ~ 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:44 ~ projection_one_region_trait_bound_static_closure[317d]::one_region[0]) with substs [
= note: defining type: DefId(0:84 ~ projection_one_region_trait_bound_static_closure[317d]::one_region[0]) with substs [
'_#1r,
T,
]
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ note: External requirements
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0:31 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_late[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:71 ~ 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:26 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_late[0]) with substs [
= note: defining type: DefId(0:66 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_late[0]) with substs [
'_#1r,
'_#2r,
T,
@@ -39,15 +39,15 @@ error[E0309]: the associated type `<T as Anything<'_#5r, '_#6r>>::AssocType` may
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider adding an explicit lifetime bound `<T as Anything<'_#5r, '_#6r>>::AssocType: ReFree(DefId(0:26 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_late[0]), BrNamed(crate0:DefIndex(27), 'a))`...
= help: consider adding an explicit lifetime bound `<T as Anything<'_#5r, '_#6r>>::AssocType: ReFree(DefId(0:66 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_late[0]), BrNamed(crate0:DefIndex(67), 'a))`...

note: External requirements
--> $DIR/projection-two-region-trait-bound-closure.rs:48:29
|
LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0:37 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_early[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:77 ~ 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:32 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_early[0]) with substs [
= note: defining type: DefId(0:72 ~ 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:43 ~ projection_two_region_trait_bound_closure[317d]::projection_outlives[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:83 ~ 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:38 ~ projection_two_region_trait_bound_closure[317d]::projection_outlives[0]) with substs [
= note: defining type: DefId(0:78 ~ 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:49 ~ projection_two_region_trait_bound_closure[317d]::elements_outlive1[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:89 ~ 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:44 ~ projection_two_region_trait_bound_closure[317d]::elements_outlive1[0]) with substs [
= note: defining type: DefId(0:84 ~ 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:55 ~ projection_two_region_trait_bound_closure[317d]::elements_outlive2[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:95 ~ 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:50 ~ projection_two_region_trait_bound_closure[317d]::elements_outlive2[0]) with substs [
= note: defining type: DefId(0:90 ~ 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:60 ~ projection_two_region_trait_bound_closure[317d]::two_regions[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:100 ~ 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:56 ~ projection_two_region_trait_bound_closure[317d]::two_regions[0]) with substs [
= note: defining type: DefId(0:96 ~ 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:65 ~ projection_two_region_trait_bound_closure[317d]::two_regions_outlive[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:105 ~ 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:61 ~ projection_two_region_trait_bound_closure[317d]::two_regions_outlive[0]) with substs [
= note: defining type: DefId(0:101 ~ 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:69 ~ projection_two_region_trait_bound_closure[317d]::one_region[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:109 ~ 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:66 ~ projection_two_region_trait_bound_closure[317d]::one_region[0]) with substs [
= note: defining type: DefId(0:106 ~ projection_two_region_trait_bound_closure[317d]::one_region[0]) with substs [
'_#1r,
T,
]
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ note: External requirements
LL | twice(cell, value, |a, b| invoke(a, b));
| ^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0:20 ~ ty_param_closure_approximate_lower_bound[317d]::generic[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:60 ~ 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<std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) ()>>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) T)),
@@ -21,7 +21,7 @@ LL | | twice(cell, value, |a, b| invoke(a, b));
LL | | }
| |_^
|
= note: defining type: DefId(0:18 ~ ty_param_closure_approximate_lower_bound[317d]::generic[0]) with substs [
= note: defining type: DefId(0:58 ~ ty_param_closure_approximate_lower_bound[317d]::generic[0]) with substs [
T,
]

@@ -31,7 +31,7 @@ note: External requirements
LL | twice(cell, value, |a, b| invoke(a, b));
| ^^^^^^^^^^^^^^^^^^^
|
= note: defining type: DefId(0:24 ~ ty_param_closure_approximate_lower_bound[317d]::generic_fail[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:64 ~ 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<std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) ()>>, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 's)) T)),
@@ -49,7 +49,7 @@ LL | |
LL | | }
| |_^
|
= note: defining type: DefId(0:21 ~ ty_param_closure_approximate_lower_bound[317d]::generic_fail[0]) with substs [
= note: defining type: DefId(0:61 ~ 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:21 ~ ty_param_closure_approximate_lower_bound[317d]::generic_fail[0]), BrNamed(crate0:DefIndex(22), 'a))`...
= help: consider adding an explicit lifetime bound `T: ReFree(DefId(0:61 ~ ty_param_closure_approximate_lower_bound[317d]::generic_fail[0]), BrNamed(crate0:DefIndex(62), 'a))`...

error: aborting due to previous error

Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ note: External requirements
LL | with_signature(x, |y| y)
| ^^^^^
|
= note: defining type: DefId(0:20 ~ ty_param_closure_outlives_from_return_type[317d]::no_region[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:60 ~ 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:17 ~ ty_param_closure_outlives_from_return_type[317d]::no_region[0]) with substs [
= note: defining type: DefId(0:57 ~ ty_param_closure_outlives_from_return_type[317d]::no_region[0]) with substs [
'_#1r,
T,
]
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ LL | | require(&x, &y)
LL | | })
| |_____^
|
= note: defining type: DefId(0:23 ~ ty_param_closure_outlives_from_where_clause[317d]::no_region[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:63 ~ 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:20 ~ ty_param_closure_outlives_from_where_clause[317d]::no_region[0]) with substs [
= note: defining type: DefId(0:60 ~ 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:20 ~ ty_param_closure_outlives_from_where_clause[317d]::no_region[0]), BrNamed(crate0:DefIndex(21), 'a))`...
= help: consider adding an explicit lifetime bound `T: ReFree(DefId(0:60 ~ ty_param_closure_outlives_from_where_clause[317d]::no_region[0]), BrNamed(crate0:DefIndex(61), '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:27 ~ ty_param_closure_outlives_from_where_clause[317d]::correct_region[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:67 ~ 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:24 ~ ty_param_closure_outlives_from_where_clause[317d]::correct_region[0]) with substs [
= note: defining type: DefId(0:64 ~ 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:32 ~ ty_param_closure_outlives_from_where_clause[317d]::wrong_region[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:72 ~ 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:28 ~ ty_param_closure_outlives_from_where_clause[317d]::wrong_region[0]) with substs [
= note: defining type: DefId(0:68 ~ 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:28 ~ ty_param_closure_outlives_from_where_clause[317d]::wrong_region[0]), BrNamed(crate0:DefIndex(29), 'a))`...
= help: consider adding an explicit lifetime bound `T: ReFree(DefId(0:68 ~ ty_param_closure_outlives_from_where_clause[317d]::wrong_region[0]), BrNamed(crate0:DefIndex(69), '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:37 ~ ty_param_closure_outlives_from_where_clause[317d]::outlives_region[0]::{{closure}}[0]) with closure substs [
= note: defining type: DefId(0:77 ~ 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:33 ~ ty_param_closure_outlives_from_where_clause[317d]::outlives_region[0]) with substs [
= note: defining type: DefId(0:73 ~ ty_param_closure_outlives_from_where_clause[317d]::outlives_region[0]) with substs [
'_#1r,
'_#2r,
T,
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// edition:2018

#![feature(builtin_macro_imports)]

// Tests that arbitrary crates (other than `core`, `std` and `meta`)
// aren't allowed without `--extern`, even if they're in the sysroot.
use alloc; //~ ERROR unresolved import `alloc`
use test; //~ ERROR cannot import a built-in macro
use test; // OK, imports the built-in attribute macro `test`
use proc_macro; // OK, imports the built-in `proc_macro` attribute, but not the `proc_macro` crate.

fn main() {}
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
error: cannot import a built-in macro
--> $DIR/not-whitelisted.rs:6:5
|
LL | use test;
| ^^^^

error[E0432]: unresolved import `alloc`
--> $DIR/not-whitelisted.rs:5:5
--> $DIR/not-whitelisted.rs:7:5
|
LL | use alloc;
| ^^^^^ no `alloc` external crate

error: aborting due to 2 previous errors
error: aborting due to previous error

For more information about this error, try `rustc --explain E0432`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// edition:2018

#![feature(builtin_macro_imports)]

pub use concat as my_concat;
19 changes: 19 additions & 0 deletions src/test/ui/rust-2018/uniform-paths/import-builtin-macros-bug.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// edition:2018
// aux-build:export-builtin-macros.rs

#![feature(builtin_macro_imports)]

extern crate export_builtin_macros;

mod local {
pub use concat as my_concat;
}

use export_builtin_macros::*;
use local::*;

fn main() {
// `concat`s imported from different crates should ideally have the same `DefId`
// and not conflict with each other, but that's not the case right now.
my_concat!("x"); //~ ERROR `my_concat` is ambiguous
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
error[E0659]: `my_concat` is ambiguous (glob import vs glob import in the same module)
--> $DIR/import-builtin-macros-bug.rs:18:5
|
LL | my_concat!("x");
| ^^^^^^^^^ ambiguous name
|
note: `my_concat` could refer to the macro imported here
--> $DIR/import-builtin-macros-bug.rs:12:5
|
LL | use export_builtin_macros::*;
| ^^^^^^^^^^^^^^^^^^^^^^^^
= help: consider adding an explicit import of `my_concat` to disambiguate
note: `my_concat` could also refer to the macro imported here
--> $DIR/import-builtin-macros-bug.rs:13:5
|
LL | use local::*;
| ^^^^^^^^
= help: consider adding an explicit import of `my_concat` to disambiguate

error: aborting due to previous error

For more information about this error, try `rustc --explain E0659`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// FIXME: Individual imports of built-in macros are not stability checked right now,
// so the whole feature is gated instead.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand what this comment means. Can you illustrate the difference?

Copy link
Contributor Author

@petrochenkov petrochenkov Jun 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use concat_idents as unstable; below should produce a "concat_idents is unstable" error, but it doesn't.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see; I read .stderr sloppily... thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahaha, concat_idents and friends are actually stable themselves, they just report feature errors as a part of their expansion.
I'll fix this, but #61898 is a pre-requisite.


// edition:2018
// gate-test-builtin_macro_imports

use concat as stable; //~ ERROR imports of built-in macros are unstable
use concat_idents as unstable; //~ ERROR imports of built-in macros are unstable

fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
error[E0658]: imports of built-in macros are unstable
--> $DIR/import-builtin-macros-stability.rs:7:5
|
LL | use concat as stable;
| ^^^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/61875
= help: add #![feature(builtin_macro_imports)] to the crate attributes to enable

error[E0658]: imports of built-in macros are unstable
--> $DIR/import-builtin-macros-stability.rs:8:5
|
LL | use concat_idents as unstable;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/61875
= help: add #![feature(builtin_macro_imports)] to the crate attributes to enable

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0658`.
20 changes: 20 additions & 0 deletions src/test/ui/rust-2018/uniform-paths/import-builtin-macros.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// compile-pass
// edition:2018
// aux-build:export-builtin-macros.rs

#![feature(builtin_macro_imports)]

extern crate export_builtin_macros;

mod local {
pub use concat as my_concat;
}

mod xcrate {
pub use export_builtin_macros::my_concat;
}

fn main() {
assert_eq!(local::my_concat!("a", "b"), "ab");
assert_eq!(xcrate::my_concat!("a", "b"), "ab");
}
7 changes: 1 addition & 6 deletions src/test/ui/rust-2018/uniform-paths/prelude-fail.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
// edition:2018

// Built-in macro
use env as env_imported; //~ ERROR cannot import a built-in macro

// Tool attribute
use rustfmt::skip as imported_rustfmt_skip; //~ ERROR unresolved import `rustfmt`

fn main() {
env_imported!("PATH");
}
fn main() {}
10 changes: 2 additions & 8 deletions src/test/ui/rust-2018/uniform-paths/prelude-fail.stderr
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
error: cannot import a built-in macro
--> $DIR/prelude-fail.rs:4:5
|
LL | use env as env_imported;
| ^^^^^^^^^^^^^^^^^^^

error[E0432]: unresolved import `rustfmt`
--> $DIR/prelude-fail.rs:7:5
--> $DIR/prelude-fail.rs:4:5
|
LL | use rustfmt::skip as imported_rustfmt_skip;
| ^^^^^^^ `rustfmt` is a tool module, not a module

error: aborting due to 2 previous errors
error: aborting due to previous error

For more information about this error, try `rustc --explain E0432`.
6 changes: 6 additions & 0 deletions src/test/ui/rust-2018/uniform-paths/prelude.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// compile-pass
// edition:2018

#![feature(builtin_macro_imports)]

// Macro imported with `#[macro_use] extern crate`
use vec as imported_vec;

@@ -10,9 +12,13 @@ use Vec as ImportedVec;
// Built-in type
use u8 as imported_u8;

// Built-in macro
use env as env_imported;

type A = imported_u8;

fn main() {
imported_vec![0];
ImportedVec::<u8>::new();
env_imported!("PATH");
}