1
Fork 0

Auto merge of #66944 - Centril:rollup-ojsszx6, r=Centril

Rollup of 7 pull requests

Successful merges:

 - #66346 (Replace .unwrap() with ? in std::os::unix::net)
 - #66789 (rustc: move mir::SourceScopeLocalData to a field of SourceScopeData.)
 - #66850 (rustc: hide HirId's fmt::Debug output from -Z span_free_formats.)
 - #66905 (rustc_plugin: Remove some remaining plugin features)
 - #66907 (rustc: don't just show raw DefIndex's in BrNamed's fmt::Debug impl.)
 - #66918 (Add crc and crypto to target feature whitelist on arm)
 - #66926 (add reusable MachineStop variant to Miri engine error enum)

Failed merges:

r? @ghost
This commit is contained in:
bors 2019-12-02 03:09:36 +00:00
commit f5c81e0a98
73 changed files with 590 additions and 747 deletions

View file

@ -307,18 +307,6 @@ warning: path statement with no effect
| |
``` ```
## plugin-as-library
This lint detects when compiler plugins are used as ordinary library in
non-plugin crate. Some example code that triggers this lint:
```rust,ignore
#![feature(plugin)]
#![plugin(macro_crate_test)]
extern crate macro_crate_test;
```
## private-in-public ## private-in-public
This lint detects private items in public interfaces not caught by the old implementation. Some This lint detects private items in public interfaces not caught by the old implementation. Some

View file

@ -21,15 +21,10 @@ the crate attribute `#![plugin(...)]`. See the
`rustc_driver::plugin` documentation for more about the `rustc_driver::plugin` documentation for more about the
mechanics of defining and loading a plugin. mechanics of defining and loading a plugin.
If present, arguments passed as `#![plugin(foo(... args ...))]` are not
interpreted by rustc itself. They are provided to the plugin through the
`Registry`'s `args` method.
In the vast majority of cases, a plugin should *only* be used through In the vast majority of cases, a plugin should *only* be used through
`#![plugin]` and not through an `extern crate` item. Linking a plugin would `#![plugin]` and not through an `extern crate` item. Linking a plugin would
pull in all of libsyntax and librustc as dependencies of your crate. This is pull in all of libsyntax and librustc as dependencies of your crate. This is
generally unwanted unless you are building another plugin. The generally unwanted unless you are building another plugin.
`plugin_as_library` lint checks these guidelines.
The usual practice is to put compiler plugins in their own crate, separate from The usual practice is to put compiler plugins in their own crate, separate from
any `macro_rules!` macros or ordinary Rust code meant to be used by consumers any `macro_rules!` macros or ordinary Rust code meant to be used by consumers

View file

@ -47,8 +47,7 @@ use rustc_error_codes::*;
/// This is basically the subset of `Context` that we can /// This is basically the subset of `Context` that we can
/// build early in the compile pipeline. /// build early in the compile pipeline.
pub struct LintStore { pub struct LintStore {
/// Registered lints. The bool is true if the lint was /// Registered lints.
/// added by a plugin.
lints: Vec<&'static Lint>, lints: Vec<&'static Lint>,
/// Constructor functions for each variety of lint pass. /// Constructor functions for each variety of lint pass.

View file

@ -14,7 +14,7 @@ use rustc_target::spec::abi::Abi;
use syntax_pos::{Pos, Span}; use syntax_pos::{Pos, Span};
use syntax::symbol::Symbol; use syntax::symbol::Symbol;
use hir::GeneratorKind; use hir::GeneratorKind;
use std::{fmt, env}; use std::{fmt, env, any::Any};
use rustc_error_codes::*; use rustc_error_codes::*;
@ -44,14 +44,14 @@ CloneTypeFoldableImpls! {
pub type ConstEvalRawResult<'tcx> = Result<RawConst<'tcx>, ErrorHandled>; pub type ConstEvalRawResult<'tcx> = Result<RawConst<'tcx>, ErrorHandled>;
pub type ConstEvalResult<'tcx> = Result<&'tcx ty::Const<'tcx>, ErrorHandled>; pub type ConstEvalResult<'tcx> = Result<&'tcx ty::Const<'tcx>, ErrorHandled>;
#[derive(Clone, Debug)] #[derive(Debug)]
pub struct ConstEvalErr<'tcx> { pub struct ConstEvalErr<'tcx> {
pub span: Span, pub span: Span,
pub error: crate::mir::interpret::InterpError<'tcx>, pub error: crate::mir::interpret::InterpError<'tcx>,
pub stacktrace: Vec<FrameInfo<'tcx>>, pub stacktrace: Vec<FrameInfo<'tcx>>,
} }
#[derive(Clone, Debug)] #[derive(Debug)]
pub struct FrameInfo<'tcx> { pub struct FrameInfo<'tcx> {
/// This span is in the caller. /// This span is in the caller.
pub call_site: Span, pub call_site: Span,
@ -138,6 +138,7 @@ impl<'tcx> ConstEvalErr<'tcx> {
lint_root: Option<hir::HirId>, lint_root: Option<hir::HirId>,
) -> Result<DiagnosticBuilder<'tcx>, ErrorHandled> { ) -> Result<DiagnosticBuilder<'tcx>, ErrorHandled> {
let must_error = match self.error { let must_error = match self.error {
InterpError::MachineStop(_) => bug!("CTFE does not stop"),
err_inval!(Layout(LayoutError::Unknown(_))) | err_inval!(Layout(LayoutError::Unknown(_))) |
err_inval!(TooGeneric) => err_inval!(TooGeneric) =>
return Err(ErrorHandled::TooGeneric), return Err(ErrorHandled::TooGeneric),
@ -189,7 +190,7 @@ pub fn struct_error<'tcx>(tcx: TyCtxtAt<'tcx>, msg: &str) -> DiagnosticBuilder<'
/// Thsese should always be constructed by calling `.into()` on /// Thsese should always be constructed by calling `.into()` on
/// a `InterpError`. In `librustc_mir::interpret`, we have `throw_err_*` /// a `InterpError`. In `librustc_mir::interpret`, we have `throw_err_*`
/// macros for this. /// macros for this.
#[derive(Debug, Clone)] #[derive(Debug)]
pub struct InterpErrorInfo<'tcx> { pub struct InterpErrorInfo<'tcx> {
pub kind: InterpError<'tcx>, pub kind: InterpError<'tcx>,
backtrace: Option<Box<Backtrace>>, backtrace: Option<Box<Backtrace>>,
@ -331,7 +332,6 @@ impl<O: fmt::Debug> fmt::Debug for PanicInfo<O> {
/// Error information for when the program we executed turned out not to actually be a valid /// Error information for when the program we executed turned out not to actually be a valid
/// program. This cannot happen in stand-alone Miri, but it can happen during CTFE/ConstProp /// program. This cannot happen in stand-alone Miri, but it can happen during CTFE/ConstProp
/// where we work on generic code or execution does not have all information available. /// where we work on generic code or execution does not have all information available.
#[derive(Clone, HashStable)]
pub enum InvalidProgramInfo<'tcx> { pub enum InvalidProgramInfo<'tcx> {
/// Resolution can fail if we are in a too generic context. /// Resolution can fail if we are in a too generic context.
TooGeneric, TooGeneric,
@ -361,7 +361,6 @@ impl fmt::Debug for InvalidProgramInfo<'tcx> {
} }
/// Error information for when the program caused Undefined Behavior. /// Error information for when the program caused Undefined Behavior.
#[derive(Clone, HashStable)]
pub enum UndefinedBehaviorInfo { pub enum UndefinedBehaviorInfo {
/// Free-form case. Only for errors that are never caught! /// Free-form case. Only for errors that are never caught!
Ub(String), Ub(String),
@ -394,7 +393,6 @@ impl fmt::Debug for UndefinedBehaviorInfo {
/// ///
/// Currently, we also use this as fall-back error kind for errors that have not been /// Currently, we also use this as fall-back error kind for errors that have not been
/// categorized yet. /// categorized yet.
#[derive(Clone, HashStable)]
pub enum UnsupportedOpInfo<'tcx> { pub enum UnsupportedOpInfo<'tcx> {
/// Free-form case. Only for errors that are never caught! /// Free-form case. Only for errors that are never caught!
Unsupported(String), Unsupported(String),
@ -571,7 +569,6 @@ impl fmt::Debug for UnsupportedOpInfo<'tcx> {
/// Error information for when the program exhausted the resources granted to it /// Error information for when the program exhausted the resources granted to it
/// by the interpreter. /// by the interpreter.
#[derive(Clone, HashStable)]
pub enum ResourceExhaustionInfo { pub enum ResourceExhaustionInfo {
/// The stack grew too big. /// The stack grew too big.
StackFrameLimitReached, StackFrameLimitReached,
@ -592,7 +589,6 @@ impl fmt::Debug for ResourceExhaustionInfo {
} }
} }
#[derive(Clone, HashStable)]
pub enum InterpError<'tcx> { pub enum InterpError<'tcx> {
/// The program panicked. /// The program panicked.
Panic(PanicInfo<u64>), Panic(PanicInfo<u64>),
@ -601,14 +597,14 @@ pub enum InterpError<'tcx> {
/// The program did something the interpreter does not support (some of these *might* be UB /// The program did something the interpreter does not support (some of these *might* be UB
/// but the interpreter is not sure). /// but the interpreter is not sure).
Unsupported(UnsupportedOpInfo<'tcx>), Unsupported(UnsupportedOpInfo<'tcx>),
/// The program was invalid (ill-typed, not sufficiently monomorphized, ...). /// The program was invalid (ill-typed, bad MIR, not sufficiently monomorphized, ...).
InvalidProgram(InvalidProgramInfo<'tcx>), InvalidProgram(InvalidProgramInfo<'tcx>),
/// The program exhausted the interpreter's resources (stack/heap too big, /// The program exhausted the interpreter's resources (stack/heap too big,
/// execution takes too long, ..). /// execution takes too long, ...).
ResourceExhaustion(ResourceExhaustionInfo), ResourceExhaustion(ResourceExhaustionInfo),
/// Not actually an interpreter error -- used to signal that execution has exited /// Stop execution for a machine-controlled reason. This is never raised by
/// with the given status code. Used by Miri, but not by CTFE. /// the core engine itself.
Exit(i32), MachineStop(Box<dyn Any + Send>),
} }
pub type InterpResult<'tcx, T = ()> = Result<T, InterpErrorInfo<'tcx>>; pub type InterpResult<'tcx, T = ()> = Result<T, InterpErrorInfo<'tcx>>;
@ -634,8 +630,8 @@ impl fmt::Debug for InterpError<'_> {
write!(f, "{:?}", msg), write!(f, "{:?}", msg),
Panic(ref msg) => Panic(ref msg) =>
write!(f, "{:?}", msg), write!(f, "{:?}", msg),
Exit(code) => MachineStop(_) =>
write!(f, "exited with status code {}", code), write!(f, "machine caused execution to stop"),
} }
} }
} }

View file

@ -104,10 +104,6 @@ pub struct Body<'tcx> {
/// and used for debuginfo. Indexed by a `SourceScope`. /// and used for debuginfo. Indexed by a `SourceScope`.
pub source_scopes: IndexVec<SourceScope, SourceScopeData>, pub source_scopes: IndexVec<SourceScope, SourceScopeData>,
/// Crate-local information for each source scope, that can't (and
/// needn't) be tracked across crates.
pub source_scope_local_data: ClearCrossCrate<IndexVec<SourceScope, SourceScopeLocalData>>,
/// The yield type of the function, if it is a generator. /// The yield type of the function, if it is a generator.
pub yield_ty: Option<Ty<'tcx>>, pub yield_ty: Option<Ty<'tcx>>,
@ -167,7 +163,6 @@ impl<'tcx> Body<'tcx> {
pub fn new( pub fn new(
basic_blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>, basic_blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>,
source_scopes: IndexVec<SourceScope, SourceScopeData>, source_scopes: IndexVec<SourceScope, SourceScopeData>,
source_scope_local_data: ClearCrossCrate<IndexVec<SourceScope, SourceScopeLocalData>>,
local_decls: LocalDecls<'tcx>, local_decls: LocalDecls<'tcx>,
user_type_annotations: CanonicalUserTypeAnnotations<'tcx>, user_type_annotations: CanonicalUserTypeAnnotations<'tcx>,
arg_count: usize, arg_count: usize,
@ -188,7 +183,6 @@ impl<'tcx> Body<'tcx> {
phase: MirPhase::Build, phase: MirPhase::Build,
basic_blocks, basic_blocks,
source_scopes, source_scopes,
source_scope_local_data,
yield_ty: None, yield_ty: None,
generator_drop: None, generator_drop: None,
generator_layout: None, generator_layout: None,
@ -435,6 +429,13 @@ pub enum ClearCrossCrate<T> {
} }
impl<T> ClearCrossCrate<T> { impl<T> ClearCrossCrate<T> {
pub fn as_ref(&'a self) -> ClearCrossCrate<&'a T> {
match self {
ClearCrossCrate::Clear => ClearCrossCrate::Clear,
ClearCrossCrate::Set(v) => ClearCrossCrate::Set(v),
}
}
pub fn assert_crate_local(self) -> T { pub fn assert_crate_local(self) -> T {
match self { match self {
ClearCrossCrate::Clear => bug!("unwrapping cross-crate data"), ClearCrossCrate::Clear => bug!("unwrapping cross-crate data"),
@ -2027,6 +2028,10 @@ rustc_index::newtype_index! {
pub struct SourceScopeData { pub struct SourceScopeData {
pub span: Span, pub span: Span,
pub parent_scope: Option<SourceScope>, pub parent_scope: Option<SourceScope>,
/// Crate-local information for this source scope, that can't (and
/// needn't) be tracked across crates.
pub local_data: ClearCrossCrate<SourceScopeLocalData>,
} }
#[derive(Clone, Debug, RustcEncodable, RustcDecodable, HashStable)] #[derive(Clone, Debug, RustcEncodable, RustcDecodable, HashStable)]
@ -2308,10 +2313,14 @@ impl<'tcx> Debug for Rvalue<'tcx> {
} }
} }
AggregateKind::Closure(def_id, _) => ty::tls::with(|tcx| { AggregateKind::Closure(def_id, substs) => ty::tls::with(|tcx| {
if let Some(hir_id) = tcx.hir().as_local_hir_id(def_id) { if let Some(hir_id) = tcx.hir().as_local_hir_id(def_id) {
let name = if tcx.sess.opts.debugging_opts.span_free_formats { let name = if tcx.sess.opts.debugging_opts.span_free_formats {
format!("[closure@{:?}]", hir_id) let substs = tcx.lift(&substs).unwrap();
format!(
"[closure@{}]",
tcx.def_path_str_with_substs(def_id, substs),
)
} else { } else {
format!("[closure@{:?}]", tcx.hir().span(hir_id)) format!("[closure@{:?}]", tcx.hir().span(hir_id))
}; };

View file

@ -317,6 +317,7 @@ macro_rules! make_mir_visitor {
let SourceScopeData { let SourceScopeData {
span, span,
parent_scope, parent_scope,
local_data: _,
} = scope_data; } = scope_data;
self.visit_span(span); self.visit_span(span);

View file

@ -1364,8 +1364,6 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
"enable queries of the dependency graph for regression testing"), "enable queries of the dependency graph for regression testing"),
no_analysis: bool = (false, parse_bool, [UNTRACKED], no_analysis: bool = (false, parse_bool, [UNTRACKED],
"parse and expand the source, but run no analysis"), "parse and expand the source, but run no analysis"),
extra_plugins: Vec<String> = (Vec::new(), parse_list, [TRACKED],
"load extra plugins"),
unstable_options: bool = (false, parse_bool, [UNTRACKED], unstable_options: bool = (false, parse_bool, [UNTRACKED],
"adds unstable command line options to rustc interface"), "adds unstable command line options to rustc interface"),
force_overflow_checks: Option<bool> = (None, parse_opt_bool, [TRACKED], force_overflow_checks: Option<bool> = (None, parse_opt_bool, [TRACKED],

View file

@ -76,7 +76,6 @@ pub struct Session {
/// (sub)diagnostics that have been set once, but should not be set again, /// (sub)diagnostics that have been set once, but should not be set again,
/// in order to avoid redundantly verbose output (Issue #24690, #44953). /// in order to avoid redundantly verbose output (Issue #24690, #44953).
pub one_time_diagnostics: Lock<FxHashSet<(DiagnosticMessageId, Option<Span>, String)>>, pub one_time_diagnostics: Lock<FxHashSet<(DiagnosticMessageId, Option<Span>, String)>>,
pub plugin_llvm_passes: OneThread<RefCell<Vec<String>>>,
pub crate_types: Once<Vec<config::CrateType>>, pub crate_types: Once<Vec<config::CrateType>>,
/// The `crate_disambiguator` is constructed out of all the `-C metadata` /// The `crate_disambiguator` is constructed out of all the `-C metadata`
/// arguments passed to the compiler. Its value together with the crate-name /// arguments passed to the compiler. Its value together with the crate-name
@ -1149,7 +1148,6 @@ fn build_session_(
local_crate_source_file, local_crate_source_file,
working_dir, working_dir,
one_time_diagnostics: Default::default(), one_time_diagnostics: Default::default(),
plugin_llvm_passes: OneThread::new(RefCell::new(Vec::new())),
crate_types: Once::new(), crate_types: Once::new(),
crate_disambiguator: Once::new(), crate_disambiguator: Once::new(),
features: Once::new(), features: Once::new(),

View file

@ -682,7 +682,7 @@ pub trait PrettyPrinter<'tcx>:
// FIXME(eddyb) should use `def_span`. // FIXME(eddyb) should use `def_span`.
if let Some(hir_id) = self.tcx().hir().as_local_hir_id(did) { if let Some(hir_id) = self.tcx().hir().as_local_hir_id(did) {
if self.tcx().sess.opts.debugging_opts.span_free_formats { if self.tcx().sess.opts.debugging_opts.span_free_formats {
p!(write("@{:?}", hir_id)); p!(write("@"), print_def_path(did, substs));
} else { } else {
p!(write("@{:?}", self.tcx().hir().span(hir_id))); p!(write("@{:?}", self.tcx().hir().span(hir_id)));
} }

View file

@ -3,6 +3,7 @@
//! hand, though we've recently added some macros and proc-macros to help with the tedium. //! hand, though we've recently added some macros and proc-macros to help with the tedium.
use crate::hir::def::Namespace; use crate::hir::def::Namespace;
use crate::hir::def_id::CRATE_DEF_INDEX;
use crate::mir::ProjectionKind; use crate::mir::ProjectionKind;
use crate::mir::interpret; use crate::mir::interpret;
use crate::ty::{self, Lift, Ty, TyCtxt, InferConst}; use crate::ty::{self, Lift, Ty, TyCtxt, InferConst};
@ -95,8 +96,11 @@ impl fmt::Debug for ty::BoundRegion {
match *self { match *self {
ty::BrAnon(n) => write!(f, "BrAnon({:?})", n), ty::BrAnon(n) => write!(f, "BrAnon({:?})", n),
ty::BrNamed(did, name) => { ty::BrNamed(did, name) => {
write!(f, "BrNamed({:?}:{:?}, {})", if did.index == CRATE_DEF_INDEX {
did.krate, did.index, name) write!(f, "BrNamed({})", name)
} else {
write!(f, "BrNamed({:?}, {})", did, name)
}
} }
ty::BrEnv => write!(f, "BrEnv"), ty::BrEnv => write!(f, "BrEnv"),
} }

View file

@ -365,20 +365,6 @@ pub(crate) unsafe fn optimize(cgcx: &CodegenContext<LlvmCodegenBackend>,
add_sanitizer_passes(config, &mut extra_passes); add_sanitizer_passes(config, &mut extra_passes);
for pass_name in &cgcx.plugin_passes {
if let Some(pass) = find_pass(pass_name) {
extra_passes.push(pass);
} else {
diag_handler.err(&format!("a plugin asked for LLVM pass \
`{}` but LLVM does not \
recognize it", pass_name));
}
if pass_name == "name-anon-globals" {
have_name_anon_globals_pass = true;
}
}
// Some options cause LLVM bitcode to be emitted, which uses ThinLTOBuffers, so we need // Some options cause LLVM bitcode to be emitted, which uses ThinLTOBuffers, so we need
// to make sure we run LLVM's NameAnonGlobals pass when emitting bitcode; otherwise // to make sure we run LLVM's NameAnonGlobals pass when emitting bitcode; otherwise
// we'll get errors in LLVM. // we'll get errors in LLVM.

View file

@ -108,6 +108,8 @@ const ARM_WHITELIST: &[(&str, Option<Symbol>)] = &[
("rclass", Some(sym::arm_target_feature)), ("rclass", Some(sym::arm_target_feature)),
("dsp", Some(sym::arm_target_feature)), ("dsp", Some(sym::arm_target_feature)),
("neon", Some(sym::arm_target_feature)), ("neon", Some(sym::arm_target_feature)),
("crc", Some(sym::arm_target_feature)),
("crypto", Some(sym::arm_target_feature)),
("v5te", Some(sym::arm_target_feature)), ("v5te", Some(sym::arm_target_feature)),
("v6", Some(sym::arm_target_feature)), ("v6", Some(sym::arm_target_feature)),
("v6k", Some(sym::arm_target_feature)), ("v6k", Some(sym::arm_target_feature)),

View file

@ -231,8 +231,6 @@ pub struct CodegenContext<B: WriteBackendMethods> {
pub total_cgus: usize, pub total_cgus: usize,
// Handler to use for diagnostics produced during codegen. // Handler to use for diagnostics produced during codegen.
pub diag_emitter: SharedEmitter, pub diag_emitter: SharedEmitter,
// LLVM passes added by plugins.
pub plugin_passes: Vec<String>,
// LLVM optimizations for which we want to print remarks. // LLVM optimizations for which we want to print remarks.
pub remark: Passes, pub remark: Passes,
// Worker thread number // Worker thread number
@ -1028,7 +1026,6 @@ fn start_executing_work<B: ExtraBackendMethods>(
time_passes: sess.time_extended(), time_passes: sess.time_extended(),
prof: sess.prof.clone(), prof: sess.prof.clone(),
exported_symbols, exported_symbols,
plugin_passes: sess.plugin_llvm_passes.borrow().clone(),
remark: sess.opts.cg.remark.clone(), remark: sess.opts.cg.remark.clone(),
worker: 0, worker: 0,
incr_comp_session_dir: sess.incr_comp_session_dir_opt().map(|r| r.clone()), incr_comp_session_dir: sess.incr_comp_session_dir_opt().map(|r| r.clone()),

View file

@ -283,7 +283,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
) )
), ),
( (
sym::plugin, CrateLevel, template!(List: "name|name(args)"), sym::plugin, CrateLevel, template!(List: "name"),
Gated( Gated(
Stability::Deprecated( Stability::Deprecated(
"https://github.com/rust-lang/rust/pull/64675", "https://github.com/rust-lang/rust/pull/64675",

View file

@ -30,7 +30,6 @@ use rustc_mir as mir;
use rustc_parse::{parse_crate_from_file, parse_crate_from_source_str}; use rustc_parse::{parse_crate_from_file, parse_crate_from_source_str};
use rustc_passes::{self, ast_validation, hir_stats, layout_test}; use rustc_passes::{self, ast_validation, hir_stats, layout_test};
use rustc_plugin_impl as plugin; use rustc_plugin_impl as plugin;
use rustc_plugin_impl::registry::Registry;
use rustc_privacy; use rustc_privacy;
use rustc_resolve::{Resolver, ResolverArenas}; use rustc_resolve::{Resolver, ResolverArenas};
use rustc_traits; use rustc_traits;
@ -106,8 +105,7 @@ declare_box_region_type!(
(&mut Resolver<'_>) -> (Result<ast::Crate>, ResolverOutputs) (&mut Resolver<'_>) -> (Result<ast::Crate>, ResolverOutputs)
); );
/// Runs the "early phases" of the compiler: initial `cfg` processing, /// Runs the "early phases" of the compiler: initial `cfg` processing, loading compiler plugins,
/// loading compiler plugins (including those from `addl_plugins`),
/// syntax expansion, secondary `cfg` expansion, synthesis of a test /// syntax expansion, secondary `cfg` expansion, synthesis of a test
/// harness if one is to be provided, injection of a dependency on the /// harness if one is to be provided, injection of a dependency on the
/// standard library and prelude, and name resolution. /// standard library and prelude, and name resolution.
@ -209,33 +207,22 @@ pub fn register_plugins<'a>(
middle::recursion_limit::update_limits(sess, &krate); middle::recursion_limit::update_limits(sess, &krate);
}); });
let registrars = time(sess, "plugin loading", || {
plugin::load::load_plugins(
sess,
metadata_loader,
&krate,
Some(sess.opts.debugging_opts.extra_plugins.clone()),
)
});
let mut lint_store = rustc_lint::new_lint_store( let mut lint_store = rustc_lint::new_lint_store(
sess.opts.debugging_opts.no_interleave_lints, sess.opts.debugging_opts.no_interleave_lints,
sess.unstable_options(), sess.unstable_options(),
); );
register_lints(&sess, &mut lint_store);
(register_lints)(&sess, &mut lint_store); let registrars = time(sess, "plugin loading", || {
plugin::load::load_plugins(sess, metadata_loader, &krate)
let mut registry = Registry::new(sess, &mut lint_store, krate.span); });
time(sess, "plugin registration", || { time(sess, "plugin registration", || {
let mut registry = plugin::Registry { lint_store: &mut lint_store };
for registrar in registrars { for registrar in registrars {
registry.args_hidden = Some(registrar.args); registrar(&mut registry);
(registrar.fun)(&mut registry);
} }
}); });
*sess.plugin_llvm_passes.borrow_mut() = registry.llvm_passes;
Ok((krate, Lrc::new(lint_store))) Ok((krate, Lrc::new(lint_store)))
} }

View file

@ -650,10 +650,6 @@ fn test_debugging_options_tracking_hash() {
opts.debugging_opts.continue_parse_after_error = true; opts.debugging_opts.continue_parse_after_error = true;
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash()); assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
opts = reference.clone();
opts.debugging_opts.extra_plugins = vec![String::from("plugin1"), String::from("plugin2")];
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
opts = reference.clone(); opts = reference.clone();
opts.debugging_opts.force_overflow_checks = Some(true); opts.debugging_opts.force_overflow_checks = Some(true);
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash()); assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());

View file

@ -24,7 +24,7 @@
use std::fmt::Write; use std::fmt::Write;
use rustc::hir::def::{Res, DefKind}; use rustc::hir::def::{Res, DefKind};
use rustc::hir::def_id::{DefId, LOCAL_CRATE}; use rustc::hir::def_id::DefId;
use rustc::ty::{self, Ty, TyCtxt, layout::VariantIdx}; use rustc::ty::{self, Ty, TyCtxt, layout::VariantIdx};
use rustc::{lint, util}; use rustc::{lint, util};
use rustc::lint::FutureIncompatibleInfo; use rustc::lint::FutureIncompatibleInfo;
@ -800,45 +800,6 @@ impl EarlyLintPass for UnusedDocComment {
} }
} }
declare_lint! {
PLUGIN_AS_LIBRARY,
Warn,
"compiler plugin used as ordinary library in non-plugin crate"
}
declare_lint_pass!(PluginAsLibrary => [PLUGIN_AS_LIBRARY]);
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for PluginAsLibrary {
fn check_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::Item) {
if cx.tcx.plugin_registrar_fn(LOCAL_CRATE).is_some() {
// We're compiling a plugin; it's fine to link other plugins.
return;
}
match it.kind {
hir::ItemKind::ExternCrate(..) => (),
_ => return,
};
let def_id = cx.tcx.hir().local_def_id(it.hir_id);
let prfn = match cx.tcx.extern_mod_stmt_cnum(def_id) {
Some(cnum) => cx.tcx.plugin_registrar_fn(cnum),
None => {
// Probably means we aren't linking the crate for some reason.
//
// Not sure if / when this could happen.
return;
}
};
if prfn.is_some() {
cx.span_lint(PLUGIN_AS_LIBRARY,
it.span,
"compiler plugin used as an ordinary library");
}
}
}
declare_lint! { declare_lint! {
NO_MANGLE_CONST_ITEMS, NO_MANGLE_CONST_ITEMS,
Deny, Deny,
@ -1268,7 +1229,6 @@ declare_lint_pass!(
MISSING_DEBUG_IMPLEMENTATIONS, MISSING_DEBUG_IMPLEMENTATIONS,
ANONYMOUS_PARAMETERS, ANONYMOUS_PARAMETERS,
UNUSED_DOC_COMMENTS, UNUSED_DOC_COMMENTS,
PLUGIN_AS_LIBRARY,
NO_MANGLE_CONST_ITEMS, NO_MANGLE_CONST_ITEMS,
NO_MANGLE_GENERIC_ITEMS, NO_MANGLE_GENERIC_ITEMS,
MUTABLE_TRANSMUTES, MUTABLE_TRANSMUTES,

View file

@ -157,8 +157,6 @@ macro_rules! late_lint_mod_passes {
// Depends on types used in type definitions // Depends on types used in type definitions
MissingCopyImplementations: MissingCopyImplementations, MissingCopyImplementations: MissingCopyImplementations,
PluginAsLibrary: PluginAsLibrary,
// Depends on referenced function signatures in expressions // Depends on referenced function signatures in expressions
MutableTransmutes: MutableTransmutes, MutableTransmutes: MutableTransmutes,
@ -350,6 +348,7 @@ fn register_builtins(store: &mut lint::LintStore, no_interleave_lints: bool) {
"converted into hard error, see https://github.com/rust-lang/rust/issues/35896"); "converted into hard error, see https://github.com/rust-lang/rust/issues/35896");
store.register_removed("nested_impl_trait", store.register_removed("nested_impl_trait",
"converted into hard error, see https://github.com/rust-lang/rust/issues/59014"); "converted into hard error, see https://github.com/rust-lang/rust/issues/59014");
store.register_removed("plugin_as_library", "plugins have been deprecated and retired");
} }
fn register_internals(store: &mut lint::LintStore) { fn register_internals(store: &mut lint::LintStore) {

View file

@ -300,11 +300,10 @@ fn do_mir_borrowck<'a, 'tcx>(
let mut initial_diag = let mut initial_diag =
mbcx.report_conflicting_borrow(location, (&place, span), bk, &borrow); mbcx.report_conflicting_borrow(location, (&place, span), bk, &borrow);
let lint_root = if let ClearCrossCrate::Set(ref vsi) = mbcx.body.source_scope_local_data { let scope = mbcx.body.source_info(location).scope;
let scope = mbcx.body.source_info(location).scope; let lint_root = match &mbcx.body.source_scopes[scope].local_data {
vsi[scope].lint_root ClearCrossCrate::Set(data) => data.lint_root,
} else { _ => id,
id
}; };
// Span and message don't matter; we overwrite them below anyway // Span and message don't matter; we overwrite them below anyway
@ -338,38 +337,40 @@ fn do_mir_borrowck<'a, 'tcx>(
debug!("mbcx.used_mut: {:?}", mbcx.used_mut); debug!("mbcx.used_mut: {:?}", mbcx.used_mut);
let used_mut = mbcx.used_mut; let used_mut = mbcx.used_mut;
for local in mbcx.body.mut_vars_and_args_iter().filter(|local| !used_mut.contains(local)) { for local in mbcx.body.mut_vars_and_args_iter().filter(|local| !used_mut.contains(local)) {
if let ClearCrossCrate::Set(ref vsi) = mbcx.body.source_scope_local_data { let local_decl = &mbcx.body.local_decls[local];
let local_decl = &mbcx.body.local_decls[local]; let lint_root = match &mbcx.body.source_scopes[local_decl.source_info.scope].local_data {
ClearCrossCrate::Set(data) => data.lint_root,
_ => continue,
};
// Skip over locals that begin with an underscore or have no name // Skip over locals that begin with an underscore or have no name
match mbcx.local_names[local] { match mbcx.local_names[local] {
Some(name) => if name.as_str().starts_with("_") { Some(name) => if name.as_str().starts_with("_") {
continue;
},
None => continue,
}
let span = local_decl.source_info.span;
if span.desugaring_kind().is_some() {
// If the `mut` arises as part of a desugaring, we should ignore it.
continue; continue;
} },
None => continue,
let mut_span = tcx.sess.source_map().span_until_non_whitespace(span);
tcx.struct_span_lint_hir(
UNUSED_MUT,
vsi[local_decl.source_info.scope].lint_root,
span,
"variable does not need to be mutable",
)
.span_suggestion_short(
mut_span,
"remove this `mut`",
String::new(),
Applicability::MachineApplicable,
)
.emit();
} }
let span = local_decl.source_info.span;
if span.desugaring_kind().is_some() {
// If the `mut` arises as part of a desugaring, we should ignore it.
continue;
}
let mut_span = tcx.sess.source_map().span_until_non_whitespace(span);
tcx.struct_span_lint_hir(
UNUSED_MUT,
lint_root,
span,
"variable does not need to be mutable",
)
.span_suggestion_short(
mut_span,
"remove this `mut`",
String::new(),
Applicability::MachineApplicable,
)
.emit();
} }
// Buffer any move errors that we collected and de-duplicated. // Buffer any move errors that we collected and de-duplicated.

View file

@ -309,7 +309,6 @@ struct Builder<'a, 'tcx> {
/// The vector of all scopes that we have created thus far; /// The vector of all scopes that we have created thus far;
/// we track this for debuginfo later. /// we track this for debuginfo later.
source_scopes: IndexVec<SourceScope, SourceScopeData>, source_scopes: IndexVec<SourceScope, SourceScopeData>,
source_scope_local_data: IndexVec<SourceScope, SourceScopeLocalData>,
source_scope: SourceScope, source_scope: SourceScope,
/// The guard-context: each time we build the guard expression for /// The guard-context: each time we build the guard expression for
@ -704,7 +703,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
block_context: BlockContext::new(), block_context: BlockContext::new(),
source_scopes: IndexVec::new(), source_scopes: IndexVec::new(),
source_scope: OUTERMOST_SOURCE_SCOPE, source_scope: OUTERMOST_SOURCE_SCOPE,
source_scope_local_data: IndexVec::new(),
guard_context: vec![], guard_context: vec![],
push_unsafe_count: 0, push_unsafe_count: 0,
unpushed_unsafe: safety, unpushed_unsafe: safety,
@ -741,7 +739,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
Body::new( Body::new(
self.cfg.basic_blocks, self.cfg.basic_blocks,
self.source_scopes, self.source_scopes,
ClearCrossCrate::Set(self.source_scope_local_data),
self.local_decls, self.local_decls,
self.canonical_user_type_annotations, self.canonical_user_type_annotations,
self.arg_count, self.arg_count,
@ -942,7 +939,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
self.hir.root_lint_level self.hir.root_lint_level
); );
let parent_root = tcx.maybe_lint_level_root_bounded( let parent_root = tcx.maybe_lint_level_root_bounded(
self.source_scope_local_data[original_source_scope].lint_root, self.source_scopes[original_source_scope]
.local_data
.as_ref()
.assert_crate_local()
.lint_root,
self.hir.root_lint_level, self.hir.root_lint_level,
); );
if current_root != parent_root { if current_root != parent_root {

View file

@ -436,7 +436,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
// We estimate the true lint roots here to avoid creating a lot of source scopes. // We estimate the true lint roots here to avoid creating a lot of source scopes.
let parent_root = tcx.maybe_lint_level_root_bounded( let parent_root = tcx.maybe_lint_level_root_bounded(
self.source_scope_local_data[source_scope].lint_root, self.source_scopes[source_scope]
.local_data
.as_ref()
.assert_crate_local()
.lint_root,
self.hir.root_lint_level, self.hir.root_lint_level,
); );
let current_root = tcx.maybe_lint_level_root_bounded( let current_root = tcx.maybe_lint_level_root_bounded(
@ -654,23 +658,22 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
let parent = self.source_scope; let parent = self.source_scope;
debug!("new_source_scope({:?}, {:?}, {:?}) - parent({:?})={:?}", debug!("new_source_scope({:?}, {:?}, {:?}) - parent({:?})={:?}",
span, lint_level, safety, span, lint_level, safety,
parent, self.source_scope_local_data.get(parent)); parent, self.source_scopes.get(parent));
let scope = self.source_scopes.push(SourceScopeData {
span,
parent_scope: Some(parent),
});
let scope_local_data = SourceScopeLocalData { let scope_local_data = SourceScopeLocalData {
lint_root: if let LintLevel::Explicit(lint_root) = lint_level { lint_root: if let LintLevel::Explicit(lint_root) = lint_level {
lint_root lint_root
} else { } else {
self.source_scope_local_data[parent].lint_root self.source_scopes[parent].local_data.as_ref().assert_crate_local().lint_root
}, },
safety: safety.unwrap_or_else(|| { safety: safety.unwrap_or_else(|| {
self.source_scope_local_data[parent].safety self.source_scopes[parent].local_data.as_ref().assert_crate_local().safety
}) })
}; };
self.source_scope_local_data.push(scope_local_data); self.source_scopes.push(SourceScopeData {
scope span,
parent_scope: Some(parent),
local_data: ClearCrossCrate::Set(scope_local_data),
})
} }
/// Given a span and the current source scope, make a SourceInfo. /// Given a span and the current source scope, make a SourceInfo.

View file

@ -849,8 +849,8 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
} else { } else {
block.terminator().source_info block.terminator().source_info
}; };
match body.source_scope_local_data { match &body.source_scopes[source_info.scope].local_data {
mir::ClearCrossCrate::Set(ref ivs) => Some(ivs[source_info.scope].lint_root), mir::ClearCrossCrate::Set(data) => Some(data.lint_root),
mir::ClearCrossCrate::Clear => None, mir::ClearCrossCrate::Clear => None,
} }
}); });

View file

@ -198,9 +198,6 @@ fn build_drop_shim<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, ty: Option<Ty<'tcx>>)
let mut body = new_body( let mut body = new_body(
blocks, blocks,
IndexVec::from_elem_n(
SourceScopeData { span, parent_scope: None }, 1
),
local_decls_for_sig(&sig, span), local_decls_for_sig(&sig, span),
sig.inputs().len(), sig.inputs().len(),
span); span);
@ -244,15 +241,16 @@ fn build_drop_shim<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, ty: Option<Ty<'tcx>>)
fn new_body<'tcx>( fn new_body<'tcx>(
basic_blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>, basic_blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>,
source_scopes: IndexVec<SourceScope, SourceScopeData>,
local_decls: IndexVec<Local, LocalDecl<'tcx>>, local_decls: IndexVec<Local, LocalDecl<'tcx>>,
arg_count: usize, arg_count: usize,
span: Span, span: Span,
) -> Body<'tcx> { ) -> Body<'tcx> {
Body::new( Body::new(
basic_blocks, basic_blocks,
source_scopes, IndexVec::from_elem_n(
ClearCrossCrate::Clear, SourceScopeData { span, parent_scope: None, local_data: ClearCrossCrate::Clear },
1,
),
local_decls, local_decls,
IndexVec::new(), IndexVec::new(),
arg_count, arg_count,
@ -380,9 +378,6 @@ impl CloneShimBuilder<'tcx> {
fn into_mir(self) -> Body<'tcx> { fn into_mir(self) -> Body<'tcx> {
new_body( new_body(
self.blocks, self.blocks,
IndexVec::from_elem_n(
SourceScopeData { span: self.span, parent_scope: None }, 1
),
self.local_decls, self.local_decls,
self.sig.inputs().len(), self.sig.inputs().len(),
self.span, self.span,
@ -836,9 +831,6 @@ fn build_call_shim<'tcx>(
let mut body = new_body( let mut body = new_body(
blocks, blocks,
IndexVec::from_elem_n(
SourceScopeData { span, parent_scope: None }, 1
),
local_decls, local_decls,
sig.inputs().len(), sig.inputs().len(),
span, span,
@ -919,9 +911,6 @@ pub fn build_adt_ctor(tcx: TyCtxt<'_>, ctor_id: DefId) -> &Body<'_> {
let body = new_body( let body = new_body(
IndexVec::from_elem_n(start_block, 1), IndexVec::from_elem_n(start_block, 1),
IndexVec::from_elem_n(
SourceScopeData { span, parent_scope: None }, 1
),
local_decls, local_decls,
sig.inputs().len(), sig.inputs().len(),
span, span,

View file

@ -1,6 +1,4 @@
use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::fx::FxHashSet;
use rustc_index::vec::IndexVec;
use rustc_data_structures::sync::Lrc;
use rustc::ty::query::Providers; use rustc::ty::query::Providers;
use rustc::ty::{self, TyCtxt}; use rustc::ty::{self, TyCtxt};
@ -24,7 +22,6 @@ pub struct UnsafetyChecker<'a, 'tcx> {
body: &'a Body<'tcx>, body: &'a Body<'tcx>,
const_context: bool, const_context: bool,
min_const_fn: bool, min_const_fn: bool,
source_scope_local_data: &'a IndexVec<SourceScope, SourceScopeLocalData>,
violations: Vec<UnsafetyViolation>, violations: Vec<UnsafetyViolation>,
source_info: SourceInfo, source_info: SourceInfo,
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
@ -39,7 +36,6 @@ impl<'a, 'tcx> UnsafetyChecker<'a, 'tcx> {
const_context: bool, const_context: bool,
min_const_fn: bool, min_const_fn: bool,
body: &'a Body<'tcx>, body: &'a Body<'tcx>,
source_scope_local_data: &'a IndexVec<SourceScope, SourceScopeLocalData>,
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
param_env: ty::ParamEnv<'tcx>, param_env: ty::ParamEnv<'tcx>,
) -> Self { ) -> Self {
@ -51,7 +47,6 @@ impl<'a, 'tcx> UnsafetyChecker<'a, 'tcx> {
body, body,
const_context, const_context,
min_const_fn, min_const_fn,
source_scope_local_data,
violations: vec![], violations: vec![],
source_info: SourceInfo { source_info: SourceInfo {
span: body.span, span: body.span,
@ -219,8 +214,11 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> {
if context.is_borrow() { if context.is_borrow() {
if util::is_disaligned(self.tcx, self.body, self.param_env, place) { if util::is_disaligned(self.tcx, self.body, self.param_env, place) {
let source_info = self.source_info; let source_info = self.source_info;
let lint_root = let lint_root = self.body.source_scopes[source_info.scope]
self.source_scope_local_data[source_info.scope].lint_root; .local_data
.as_ref()
.assert_crate_local()
.lint_root;
self.register_violations(&[UnsafetyViolation { self.register_violations(&[UnsafetyViolation {
source_info, source_info,
description: Symbol::intern("borrow of packed field"), description: Symbol::intern("borrow of packed field"),
@ -346,7 +344,11 @@ impl<'a, 'tcx> UnsafetyChecker<'a, 'tcx> {
fn register_violations(&mut self, fn register_violations(&mut self,
violations: &[UnsafetyViolation], violations: &[UnsafetyViolation],
unsafe_blocks: &[(hir::HirId, bool)]) { unsafe_blocks: &[(hir::HirId, bool)]) {
let safety = self.source_scope_local_data[self.source_info.scope].safety; let safety = self.body.source_scopes[self.source_info.scope]
.local_data
.as_ref()
.assert_crate_local()
.safety;
let within_unsafe = match safety { let within_unsafe = match safety {
// `unsafe` blocks are required in safe code // `unsafe` blocks are required in safe code
Safety::Safe => { Safety::Safe => {
@ -516,17 +518,6 @@ fn unsafety_check_result(tcx: TyCtxt<'_>, def_id: DefId) -> UnsafetyCheckResult
// `mir_built` force this. // `mir_built` force this.
let body = &tcx.mir_built(def_id).borrow(); let body = &tcx.mir_built(def_id).borrow();
let source_scope_local_data = match body.source_scope_local_data {
ClearCrossCrate::Set(ref data) => data,
ClearCrossCrate::Clear => {
debug!("unsafety_violations: {:?} - remote, skipping", def_id);
return UnsafetyCheckResult {
violations: Lrc::new([]),
unsafe_blocks: Lrc::new([])
}
}
};
let param_env = tcx.param_env(def_id); let param_env = tcx.param_env(def_id);
let id = tcx.hir().as_local_hir_id(def_id).unwrap(); let id = tcx.hir().as_local_hir_id(def_id).unwrap();
@ -536,9 +527,7 @@ fn unsafety_check_result(tcx: TyCtxt<'_>, def_id: DefId) -> UnsafetyCheckResult
hir::BodyOwnerKind::Const | hir::BodyOwnerKind::Const |
hir::BodyOwnerKind::Static(_) => (true, false), hir::BodyOwnerKind::Static(_) => (true, false),
}; };
let mut checker = UnsafetyChecker::new( let mut checker = UnsafetyChecker::new(const_context, min_const_fn, body, tcx, param_env);
const_context, min_const_fn,
body, source_scope_local_data, tcx, param_env);
checker.visit_body(body); checker.visit_body(body);
check_unused_unsafe(tcx, def_id, &checker.used_unsafe, &mut checker.inherited_blocks); check_unused_unsafe(tcx, def_id, &checker.used_unsafe, &mut checker.inherited_blocks);

View file

@ -9,7 +9,7 @@ use rustc::hir::def_id::DefId;
use rustc::mir::{ use rustc::mir::{
AggregateKind, Constant, Location, Place, PlaceBase, Body, Operand, Rvalue, Local, UnOp, AggregateKind, Constant, Location, Place, PlaceBase, Body, Operand, Rvalue, Local, UnOp,
StatementKind, Statement, LocalKind, TerminatorKind, Terminator, ClearCrossCrate, SourceInfo, StatementKind, Statement, LocalKind, TerminatorKind, Terminator, ClearCrossCrate, SourceInfo,
BinOp, SourceScope, SourceScopeLocalData, LocalDecl, BasicBlock, RETURN_PLACE, BinOp, SourceScope, SourceScopeData, LocalDecl, BasicBlock, RETURN_PLACE,
}; };
use rustc::mir::visit::{ use rustc::mir::visit::{
Visitor, PlaceContext, MutatingUseContext, MutVisitor, NonMutatingUseContext, Visitor, PlaceContext, MutatingUseContext, MutVisitor, NonMutatingUseContext,
@ -74,17 +74,10 @@ impl<'tcx> MirPass<'tcx> for ConstProp {
trace!("ConstProp starting for {:?}", source.def_id()); trace!("ConstProp starting for {:?}", source.def_id());
// Steal some data we need from `body`.
let source_scope_local_data = std::mem::replace(
&mut body.source_scope_local_data,
ClearCrossCrate::Clear
);
let dummy_body = let dummy_body =
&Body::new( &Body::new(
body.basic_blocks().clone(), body.basic_blocks().clone(),
Default::default(), body.source_scopes.clone(),
ClearCrossCrate::Clear,
body.local_decls.clone(), body.local_decls.clone(),
Default::default(), Default::default(),
body.arg_count, body.arg_count,
@ -101,19 +94,11 @@ impl<'tcx> MirPass<'tcx> for ConstProp {
let mut optimization_finder = ConstPropagator::new( let mut optimization_finder = ConstPropagator::new(
body, body,
dummy_body, dummy_body,
source_scope_local_data,
tcx, tcx,
source source
); );
optimization_finder.visit_body(body); optimization_finder.visit_body(body);
// put back the data we stole from `mir`
let source_scope_local_data = optimization_finder.release_stolen_data();
std::mem::replace(
&mut body.source_scope_local_data,
source_scope_local_data
);
trace!("ConstProp done for {:?}", source.def_id()); trace!("ConstProp done for {:?}", source.def_id());
} }
} }
@ -267,7 +252,9 @@ struct ConstPropagator<'mir, 'tcx> {
source: MirSource<'tcx>, source: MirSource<'tcx>,
can_const_prop: IndexVec<Local, bool>, can_const_prop: IndexVec<Local, bool>,
param_env: ParamEnv<'tcx>, param_env: ParamEnv<'tcx>,
source_scope_local_data: ClearCrossCrate<IndexVec<SourceScope, SourceScopeLocalData>>, // FIXME(eddyb) avoid cloning these two fields more than once,
// by accessing them through `ecx` instead.
source_scopes: IndexVec<SourceScope, SourceScopeData>,
local_decls: IndexVec<Local, LocalDecl<'tcx>>, local_decls: IndexVec<Local, LocalDecl<'tcx>>,
ret: Option<OpTy<'tcx, ()>>, ret: Option<OpTy<'tcx, ()>>,
} }
@ -299,7 +286,6 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
fn new( fn new(
body: &Body<'tcx>, body: &Body<'tcx>,
dummy_body: &'mir Body<'tcx>, dummy_body: &'mir Body<'tcx>,
source_scope_local_data: ClearCrossCrate<IndexVec<SourceScope, SourceScopeLocalData>>,
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
source: MirSource<'tcx>, source: MirSource<'tcx>,
) -> ConstPropagator<'mir, 'tcx> { ) -> ConstPropagator<'mir, 'tcx> {
@ -337,17 +323,15 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
source, source,
param_env, param_env,
can_const_prop, can_const_prop,
source_scope_local_data, // FIXME(eddyb) avoid cloning these two fields more than once,
// by accessing them through `ecx` instead.
source_scopes: body.source_scopes.clone(),
//FIXME(wesleywiser) we can't steal this because `Visitor::super_visit_body()` needs it //FIXME(wesleywiser) we can't steal this because `Visitor::super_visit_body()` needs it
local_decls: body.local_decls.clone(), local_decls: body.local_decls.clone(),
ret: ret.map(Into::into), ret: ret.map(Into::into),
} }
} }
fn release_stolen_data(self) -> ClearCrossCrate<IndexVec<SourceScope, SourceScopeLocalData>> {
self.source_scope_local_data
}
fn get_const(&self, local: Local) -> Option<Const<'tcx>> { fn get_const(&self, local: Local) -> Option<Const<'tcx>> {
if local == RETURN_PLACE { if local == RETURN_PLACE {
// Try to read the return place as an immediate so that if it is representable as a // Try to read the return place as an immediate so that if it is representable as a
@ -377,14 +361,11 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
F: FnOnce(&mut Self) -> InterpResult<'tcx, T>, F: FnOnce(&mut Self) -> InterpResult<'tcx, T>,
{ {
self.ecx.tcx.span = source_info.span; self.ecx.tcx.span = source_info.span;
let lint_root = match self.source_scope_local_data { // FIXME(eddyb) move this to the `Panic(_)` error case, so that
ClearCrossCrate::Set(ref ivs) => { // `f(self)` is always called, and that the only difference when the
//FIXME(#51314): remove this check // scope's `local_data` is missing, is that the lint isn't emitted.
if source_info.scope.index() >= ivs.len() { let lint_root = match &self.source_scopes[source_info.scope].local_data {
return None; ClearCrossCrate::Set(data) => data.lint_root,
}
ivs[source_info.scope].lint_root
},
ClearCrossCrate::Clear => return None, ClearCrossCrate::Clear => return None,
}; };
let r = match f(self) { let r = match f(self) {
@ -396,7 +377,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
InterpError::* InterpError::*
}; };
match error.kind { match error.kind {
Exit(_) => bug!("the CTFE program cannot exit"), MachineStop(_) => bug!("ConstProp does not stop"),
// Some error shouldn't come up because creating them causes // Some error shouldn't come up because creating them causes
// an allocation, which we should avoid. When that happens, // an allocation, which we should avoid. When that happens,
@ -525,8 +506,8 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
let right_size = r.layout.size; let right_size = r.layout.size;
let r_bits = r.to_scalar().and_then(|r| r.to_bits(right_size)); let r_bits = r.to_scalar().and_then(|r| r.to_bits(right_size));
if r_bits.ok().map_or(false, |b| b >= left_bits as u128) { if r_bits.ok().map_or(false, |b| b >= left_bits as u128) {
let source_scope_local_data = match self.source_scope_local_data { let lint_root = match &self.source_scopes[source_info.scope].local_data {
ClearCrossCrate::Set(ref data) => data, ClearCrossCrate::Set(data) => data.lint_root,
ClearCrossCrate::Clear => return None, ClearCrossCrate::Clear => return None,
}; };
let dir = if *op == BinOp::Shr { let dir = if *op == BinOp::Shr {
@ -534,10 +515,9 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
} else { } else {
"left" "left"
}; };
let hir_id = source_scope_local_data[source_info.scope].lint_root;
self.tcx.lint_hir( self.tcx.lint_hir(
::rustc::lint::builtin::EXCEEDING_BITSHIFTS, ::rustc::lint::builtin::EXCEEDING_BITSHIFTS,
hir_id, lint_root,
span, span,
&format!("attempt to shift {} with overflow", dir)); &format!("attempt to shift {} with overflow", dir));
return None; return None;

View file

@ -391,9 +391,14 @@ impl Inliner<'tcx> {
for mut scope in callee_body.source_scopes.iter().cloned() { for mut scope in callee_body.source_scopes.iter().cloned() {
if scope.parent_scope.is_none() { if scope.parent_scope.is_none() {
scope.parent_scope = Some(callsite.location.scope); scope.parent_scope = Some(callsite.location.scope);
// FIXME(eddyb) is this really needed?
// (also note that it's always overwritten below)
scope.span = callee_body.span; scope.span = callee_body.span;
} }
// FIXME(eddyb) this doesn't seem right at all.
// The inlined source scopes should probably be annotated as
// such, but also contain all of the original information.
scope.span = callsite.location.span; scope.span = callsite.location.span;
let idx = caller_body.source_scopes.push(scope); let idx = caller_body.source_scopes.push(scope);

View file

@ -1081,7 +1081,6 @@ pub fn promote_candidates<'tcx>(
// FIXME: maybe try to filter this to avoid blowing up // FIXME: maybe try to filter this to avoid blowing up
// memory usage? // memory usage?
body.source_scopes.clone(), body.source_scopes.clone(),
body.source_scope_local_data.clone(),
initial_locals, initial_locals,
IndexVec::new(), IndexVec::new(),
0, 0,

View file

@ -10,10 +10,16 @@
#![feature(nll)] #![feature(nll)]
#![recursion_limit="256"] use rustc::lint::LintStore;
pub use registry::Registry;
pub mod registry;
pub mod load;
pub mod build; pub mod build;
pub mod load;
/// Structure used to register plugins.
///
/// A plugin registrar function takes an `&mut Registry` and should call
/// methods to register its plugins.
pub struct Registry<'a> {
/// The `LintStore` allows plugins to register new lints.
pub lint_store: &'a mut LintStore,
}

View file

@ -3,33 +3,21 @@
use rustc::middle::cstore::MetadataLoader; use rustc::middle::cstore::MetadataLoader;
use rustc::session::Session; use rustc::session::Session;
use rustc_metadata::locator; use rustc_metadata::locator;
use crate::registry::Registry; use crate::Registry;
use std::borrow::ToOwned; use std::borrow::ToOwned;
use std::env; use std::env;
use std::mem; use std::mem;
use std::path::PathBuf; use std::path::PathBuf;
use syntax::ast; use syntax::ast::{Crate, Ident};
use syntax::struct_span_err; use syntax::struct_span_err;
use syntax::symbol::{Symbol, kw, sym}; use syntax::symbol::sym;
use syntax_pos::{Span, DUMMY_SP}; use syntax_pos::Span;
use rustc_error_codes::*; use rustc_error_codes::*;
/// Pointer to a registrar function. /// Pointer to a registrar function.
pub type PluginRegistrarFun = type PluginRegistrarFn = fn(&mut Registry<'_>);
fn(&mut Registry<'_>);
pub struct PluginRegistrar {
pub fun: PluginRegistrarFun,
pub args: Vec<ast::NestedMetaItem>,
}
struct PluginLoader<'a> {
sess: &'a Session,
metadata_loader: &'a dyn MetadataLoader,
plugins: Vec<PluginRegistrar>,
}
fn call_malformed_plugin_attribute(sess: &Session, span: Span) { fn call_malformed_plugin_attribute(sess: &Session, span: Span) {
struct_span_err!(sess, span, E0498, "malformed `plugin` attribute") struct_span_err!(sess, span, E0498, "malformed `plugin` attribute")
@ -40,98 +28,76 @@ fn call_malformed_plugin_attribute(sess: &Session, span: Span) {
/// Read plugin metadata and dynamically load registrar functions. /// Read plugin metadata and dynamically load registrar functions.
pub fn load_plugins(sess: &Session, pub fn load_plugins(sess: &Session,
metadata_loader: &dyn MetadataLoader, metadata_loader: &dyn MetadataLoader,
krate: &ast::Crate, krate: &Crate) -> Vec<PluginRegistrarFn> {
addl_plugins: Option<Vec<String>>) -> Vec<PluginRegistrar> { let mut plugins = Vec::new();
let mut loader = PluginLoader { sess, metadata_loader, plugins: Vec::new() };
// do not report any error now. since crate attributes are for attr in &krate.attrs {
// not touched by expansion, every use of plugin without if !attr.check_name(sym::plugin) {
// the feature enabled will result in an error later... continue;
if sess.features_untracked().plugin { }
for attr in &krate.attrs {
if !attr.check_name(sym::plugin) { for plugin in attr.meta_item_list().unwrap_or_default() {
continue; match plugin.ident() {
Some(ident) if plugin.is_word() =>
load_plugin(&mut plugins, sess, metadata_loader, ident),
_ => call_malformed_plugin_attribute(sess, plugin.span()),
} }
}
}
let plugins = match attr.meta_item_list() { plugins
Some(xs) => xs, }
None => continue,
fn load_plugin(plugins: &mut Vec<PluginRegistrarFn>,
sess: &Session,
metadata_loader: &dyn MetadataLoader,
ident: Ident) {
let registrar = locator::find_plugin_registrar(sess, metadata_loader, ident.span, ident.name);
if let Some((lib, disambiguator)) = registrar {
let symbol = sess.generate_plugin_registrar_symbol(disambiguator);
let fun = dylink_registrar(sess, ident.span, lib, symbol);
plugins.push(fun);
}
}
// Dynamically link a registrar function into the compiler process.
fn dylink_registrar(sess: &Session,
span: Span,
path: PathBuf,
symbol: String) -> PluginRegistrarFn {
use rustc_metadata::dynamic_lib::DynamicLibrary;
// Make sure the path contains a / or the linker will search for it.
let path = env::current_dir().unwrap().join(&path);
let lib = match DynamicLibrary::open(Some(&path)) {
Ok(lib) => lib,
// this is fatal: there are almost certainly macros we need
// inside this crate, so continue would spew "macro undefined"
// errors
Err(err) => {
sess.span_fatal(span, &err)
}
};
unsafe {
let registrar =
match lib.symbol(&symbol) {
Ok(registrar) => {
mem::transmute::<*mut u8, PluginRegistrarFn>(registrar)
}
// again fatal if we can't register macros
Err(err) => {
sess.span_fatal(span, &err)
}
}; };
for plugin in plugins { // Intentionally leak the dynamic library. We can't ever unload it
// plugins must have a name and can't be key = value // since the library can make things that will live arbitrarily long
let name = plugin.name_or_empty(); // (e.g., an @-box cycle or a thread).
if name != kw::Invalid && !plugin.is_value_str() { mem::forget(lib);
let args = plugin.meta_item_list().map(ToOwned::to_owned);
loader.load_plugin(plugin.span(), name, args.unwrap_or_default());
} else {
call_malformed_plugin_attribute(sess, attr.span);
}
}
}
}
if let Some(plugins) = addl_plugins { registrar
for plugin in plugins {
loader.load_plugin(DUMMY_SP, Symbol::intern(&plugin), vec![]);
}
}
loader.plugins
}
impl<'a> PluginLoader<'a> {
fn load_plugin(&mut self, span: Span, name: Symbol, args: Vec<ast::NestedMetaItem>) {
let registrar = locator::find_plugin_registrar(self.sess, self.metadata_loader, span, name);
if let Some((lib, disambiguator)) = registrar {
let symbol = self.sess.generate_plugin_registrar_symbol(disambiguator);
let fun = self.dylink_registrar(span, lib, symbol);
self.plugins.push(PluginRegistrar {
fun,
args,
});
}
}
// Dynamically link a registrar function into the compiler process.
fn dylink_registrar(&mut self,
span: Span,
path: PathBuf,
symbol: String) -> PluginRegistrarFun {
use rustc_metadata::dynamic_lib::DynamicLibrary;
// Make sure the path contains a / or the linker will search for it.
let path = env::current_dir().unwrap().join(&path);
let lib = match DynamicLibrary::open(Some(&path)) {
Ok(lib) => lib,
// this is fatal: there are almost certainly macros we need
// inside this crate, so continue would spew "macro undefined"
// errors
Err(err) => {
self.sess.span_fatal(span, &err)
}
};
unsafe {
let registrar =
match lib.symbol(&symbol) {
Ok(registrar) => {
mem::transmute::<*mut u8,PluginRegistrarFun>(registrar)
}
// again fatal if we can't register macros
Err(err) => {
self.sess.span_fatal(span, &err)
}
};
// Intentionally leak the dynamic library. We can't ever unload it
// since the library can make things that will live arbitrarily long
// (e.g., an @-box cycle or a thread).
mem::forget(lib);
registrar
}
} }
} }

View file

@ -1,70 +0,0 @@
//! Used by plugin crates to tell `rustc` about the plugins they provide.
use rustc::lint::LintStore;
use rustc::session::Session;
use syntax::ast;
use syntax_pos::Span;
use std::borrow::ToOwned;
/// Structure used to register plugins.
///
/// A plugin registrar function takes an `&mut Registry` and should call
/// methods to register its plugins.
///
/// This struct has public fields and other methods for use by `rustc`
/// itself. They are not documented here, and plugin authors should
/// not use them.
pub struct Registry<'a> {
/// Compiler session. Useful if you want to emit diagnostic messages
/// from the plugin registrar.
pub sess: &'a Session,
/// The `LintStore` allows plugins to register new lints.
pub lint_store: &'a mut LintStore,
#[doc(hidden)]
pub args_hidden: Option<Vec<ast::NestedMetaItem>>,
#[doc(hidden)]
pub krate_span: Span,
#[doc(hidden)]
pub llvm_passes: Vec<String>,
}
impl<'a> Registry<'a> {
#[doc(hidden)]
pub fn new(sess: &'a Session, lint_store: &'a mut LintStore, krate_span: Span) -> Registry<'a> {
Registry {
sess,
lint_store,
args_hidden: None,
krate_span,
llvm_passes: vec![],
}
}
/// Gets the plugin's arguments, if any.
///
/// These are specified inside the `plugin` crate attribute as
///
/// ```no_run
/// #![plugin(my_plugin_name(... args ...))]
/// ```
///
/// Returns empty slice in case the plugin was loaded
/// with `--extra-plugins`
pub fn args(&self) -> &[ast::NestedMetaItem] {
self.args_hidden.as_ref().map(|v| &v[..]).unwrap_or(&[])
}
/// Register an LLVM pass.
///
/// Registration with LLVM itself is handled through static C++ objects with
/// constructors. This method simply adds a name to the list of passes to
/// execute.
pub fn register_llvm_pass(&mut self, name: &str) {
self.llvm_passes.push(name.to_owned());
}
}

View file

@ -15,11 +15,13 @@
//! use std::fs::File; //! use std::fs::File;
//! use std::os::unix::prelude::*; //! use std::os::unix::prelude::*;
//! //!
//! fn main() { //! fn main() -> std::io::Result<()> {
//! let f = File::create("foo.txt").unwrap(); //! let f = File::create("foo.txt")?;
//! let fd = f.as_raw_fd(); //! let fd = f.as_raw_fd();
//! //!
//! // use fd with native unix bindings //! // use fd with native unix bindings
//!
//! Ok(())
//! } //! }
//! ``` //! ```

View file

@ -142,9 +142,12 @@ impl SocketAddr {
/// ```no_run /// ```no_run
/// use std::os::unix::net::UnixListener; /// use std::os::unix::net::UnixListener;
/// ///
/// let socket = UnixListener::bind("/tmp/sock").unwrap(); /// fn main() -> std::io::Result<()> {
/// let addr = socket.local_addr().expect("Couldn't get local address"); /// let socket = UnixListener::bind("/tmp/sock")?;
/// assert_eq!(addr.is_unnamed(), false); /// let addr = socket.local_addr().expect("Couldn't get local address");
/// assert_eq!(addr.is_unnamed(), false);
/// Ok(())
/// }
/// ``` /// ```
/// ///
/// An unnamed address: /// An unnamed address:
@ -152,9 +155,12 @@ impl SocketAddr {
/// ``` /// ```
/// use std::os::unix::net::UnixDatagram; /// use std::os::unix::net::UnixDatagram;
/// ///
/// let socket = UnixDatagram::unbound().unwrap(); /// fn main() -> std::io::Result<()> {
/// let addr = socket.local_addr().expect("Couldn't get local address"); /// let socket = UnixDatagram::unbound()?;
/// assert_eq!(addr.is_unnamed(), true); /// let addr = socket.local_addr().expect("Couldn't get local address");
/// assert_eq!(addr.is_unnamed(), true);
/// Ok(())
/// }
/// ``` /// ```
#[stable(feature = "unix_socket", since = "1.10.0")] #[stable(feature = "unix_socket", since = "1.10.0")]
pub fn is_unnamed(&self) -> bool { pub fn is_unnamed(&self) -> bool {
@ -175,9 +181,12 @@ impl SocketAddr {
/// use std::os::unix::net::UnixListener; /// use std::os::unix::net::UnixListener;
/// use std::path::Path; /// use std::path::Path;
/// ///
/// let socket = UnixListener::bind("/tmp/sock").unwrap(); /// fn main() -> std::io::Result<()> {
/// let addr = socket.local_addr().expect("Couldn't get local address"); /// let socket = UnixListener::bind("/tmp/sock")?;
/// assert_eq!(addr.as_pathname(), Some(Path::new("/tmp/sock"))); /// let addr = socket.local_addr().expect("Couldn't get local address");
/// assert_eq!(addr.as_pathname(), Some(Path::new("/tmp/sock")));
/// Ok(())
/// }
/// ``` /// ```
/// ///
/// Without a pathname: /// Without a pathname:
@ -185,9 +194,12 @@ impl SocketAddr {
/// ``` /// ```
/// use std::os::unix::net::UnixDatagram; /// use std::os::unix::net::UnixDatagram;
/// ///
/// let socket = UnixDatagram::unbound().unwrap(); /// fn main() -> std::io::Result<()> {
/// let addr = socket.local_addr().expect("Couldn't get local address"); /// let socket = UnixDatagram::unbound()?;
/// assert_eq!(addr.as_pathname(), None); /// let addr = socket.local_addr().expect("Couldn't get local address");
/// assert_eq!(addr.as_pathname(), None);
/// Ok(())
/// }
/// ``` /// ```
#[stable(feature = "unix_socket", since = "1.10.0")] #[stable(feature = "unix_socket", since = "1.10.0")]
pub fn as_pathname(&self) -> Option<&Path> { pub fn as_pathname(&self) -> Option<&Path> {
@ -247,11 +259,14 @@ impl<'a> fmt::Display for AsciiEscaped<'a> {
/// use std::os::unix::net::UnixStream; /// use std::os::unix::net::UnixStream;
/// use std::io::prelude::*; /// use std::io::prelude::*;
/// ///
/// let mut stream = UnixStream::connect("/path/to/my/socket").unwrap(); /// fn main() -> std::io::Result<()> {
/// stream.write_all(b"hello world").unwrap(); /// let mut stream = UnixStream::connect("/path/to/my/socket")?;
/// let mut response = String::new(); /// stream.write_all(b"hello world")?;
/// stream.read_to_string(&mut response).unwrap(); /// let mut response = String::new();
/// println!("{}", response); /// stream.read_to_string(&mut response)?;
/// println!("{}", response);
/// Ok(())
/// }
/// ``` /// ```
#[stable(feature = "unix_socket", since = "1.10.0")] #[stable(feature = "unix_socket", since = "1.10.0")]
pub struct UnixStream(Socket); pub struct UnixStream(Socket);
@ -336,8 +351,11 @@ impl UnixStream {
/// ```no_run /// ```no_run
/// use std::os::unix::net::UnixStream; /// use std::os::unix::net::UnixStream;
/// ///
/// let socket = UnixStream::connect("/tmp/sock").unwrap(); /// fn main() -> std::io::Result<()> {
/// let sock_copy = socket.try_clone().expect("Couldn't clone socket"); /// let socket = UnixStream::connect("/tmp/sock")?;
/// let sock_copy = socket.try_clone().expect("Couldn't clone socket");
/// Ok(())
/// }
/// ``` /// ```
#[stable(feature = "unix_socket", since = "1.10.0")] #[stable(feature = "unix_socket", since = "1.10.0")]
pub fn try_clone(&self) -> io::Result<UnixStream> { pub fn try_clone(&self) -> io::Result<UnixStream> {
@ -351,8 +369,11 @@ impl UnixStream {
/// ```no_run /// ```no_run
/// use std::os::unix::net::UnixStream; /// use std::os::unix::net::UnixStream;
/// ///
/// let socket = UnixStream::connect("/tmp/sock").unwrap(); /// fn main() -> std::io::Result<()> {
/// let addr = socket.local_addr().expect("Couldn't get local address"); /// let socket = UnixStream::connect("/tmp/sock")?;
/// let addr = socket.local_addr().expect("Couldn't get local address");
/// Ok(())
/// }
/// ``` /// ```
#[stable(feature = "unix_socket", since = "1.10.0")] #[stable(feature = "unix_socket", since = "1.10.0")]
pub fn local_addr(&self) -> io::Result<SocketAddr> { pub fn local_addr(&self) -> io::Result<SocketAddr> {
@ -366,8 +387,11 @@ impl UnixStream {
/// ```no_run /// ```no_run
/// use std::os::unix::net::UnixStream; /// use std::os::unix::net::UnixStream;
/// ///
/// let socket = UnixStream::connect("/tmp/sock").unwrap(); /// fn main() -> std::io::Result<()> {
/// let addr = socket.peer_addr().expect("Couldn't get peer address"); /// let socket = UnixStream::connect("/tmp/sock")?;
/// let addr = socket.peer_addr().expect("Couldn't get peer address");
/// Ok(())
/// }
/// ``` /// ```
#[stable(feature = "unix_socket", since = "1.10.0")] #[stable(feature = "unix_socket", since = "1.10.0")]
pub fn peer_addr(&self) -> io::Result<SocketAddr> { pub fn peer_addr(&self) -> io::Result<SocketAddr> {
@ -391,8 +415,11 @@ impl UnixStream {
/// use std::os::unix::net::UnixStream; /// use std::os::unix::net::UnixStream;
/// use std::time::Duration; /// use std::time::Duration;
/// ///
/// let socket = UnixStream::connect("/tmp/sock").unwrap(); /// fn main() -> std::io::Result<()> {
/// socket.set_read_timeout(Some(Duration::new(1, 0))).expect("Couldn't set read timeout"); /// let socket = UnixStream::connect("/tmp/sock")?;
/// socket.set_read_timeout(Some(Duration::new(1, 0))).expect("Couldn't set read timeout");
/// Ok(())
/// }
/// ``` /// ```
/// ///
/// An [`Err`] is returned if the zero [`Duration`] is passed to this /// An [`Err`] is returned if the zero [`Duration`] is passed to this
@ -403,10 +430,13 @@ impl UnixStream {
/// use std::os::unix::net::UnixStream; /// use std::os::unix::net::UnixStream;
/// use std::time::Duration; /// use std::time::Duration;
/// ///
/// let socket = UnixStream::connect("/tmp/sock").unwrap(); /// fn main() -> std::io::Result<()> {
/// let result = socket.set_read_timeout(Some(Duration::new(0, 0))); /// let socket = UnixStream::connect("/tmp/sock")?;
/// let err = result.unwrap_err(); /// let result = socket.set_read_timeout(Some(Duration::new(0, 0)));
/// assert_eq!(err.kind(), io::ErrorKind::InvalidInput) /// let err = result.unwrap_err();
/// assert_eq!(err.kind(), io::ErrorKind::InvalidInput);
/// Ok(())
/// }
/// ``` /// ```
#[stable(feature = "unix_socket", since = "1.10.0")] #[stable(feature = "unix_socket", since = "1.10.0")]
pub fn set_read_timeout(&self, timeout: Option<Duration>) -> io::Result<()> { pub fn set_read_timeout(&self, timeout: Option<Duration>) -> io::Result<()> {
@ -430,8 +460,12 @@ impl UnixStream {
/// use std::os::unix::net::UnixStream; /// use std::os::unix::net::UnixStream;
/// use std::time::Duration; /// use std::time::Duration;
/// ///
/// let socket = UnixStream::connect("/tmp/sock").unwrap(); /// fn main() -> std::io::Result<()> {
/// socket.set_write_timeout(Some(Duration::new(1, 0))).expect("Couldn't set write timeout"); /// let socket = UnixStream::connect("/tmp/sock")?;
/// socket.set_write_timeout(Some(Duration::new(1, 0)))
/// .expect("Couldn't set write timeout");
/// Ok(())
/// }
/// ``` /// ```
/// ///
/// An [`Err`] is returned if the zero [`Duration`] is passed to this /// An [`Err`] is returned if the zero [`Duration`] is passed to this
@ -442,10 +476,13 @@ impl UnixStream {
/// use std::net::UdpSocket; /// use std::net::UdpSocket;
/// use std::time::Duration; /// use std::time::Duration;
/// ///
/// let socket = UdpSocket::bind("127.0.0.1:34254").unwrap(); /// fn main() -> std::io::Result<()> {
/// let result = socket.set_write_timeout(Some(Duration::new(0, 0))); /// let socket = UdpSocket::bind("127.0.0.1:34254")?;
/// let err = result.unwrap_err(); /// let result = socket.set_write_timeout(Some(Duration::new(0, 0)));
/// assert_eq!(err.kind(), io::ErrorKind::InvalidInput) /// let err = result.unwrap_err();
/// assert_eq!(err.kind(), io::ErrorKind::InvalidInput);
/// Ok(())
/// }
/// ``` /// ```
#[stable(feature = "unix_socket", since = "1.10.0")] #[stable(feature = "unix_socket", since = "1.10.0")]
pub fn set_write_timeout(&self, timeout: Option<Duration>) -> io::Result<()> { pub fn set_write_timeout(&self, timeout: Option<Duration>) -> io::Result<()> {
@ -460,9 +497,12 @@ impl UnixStream {
/// use std::os::unix::net::UnixStream; /// use std::os::unix::net::UnixStream;
/// use std::time::Duration; /// use std::time::Duration;
/// ///
/// let socket = UnixStream::connect("/tmp/sock").unwrap(); /// fn main() -> std::io::Result<()> {
/// socket.set_read_timeout(Some(Duration::new(1, 0))).expect("Couldn't set read timeout"); /// let socket = UnixStream::connect("/tmp/sock")?;
/// assert_eq!(socket.read_timeout().unwrap(), Some(Duration::new(1, 0))); /// socket.set_read_timeout(Some(Duration::new(1, 0))).expect("Couldn't set read timeout");
/// assert_eq!(socket.read_timeout()?, Some(Duration::new(1, 0)));
/// Ok(())
/// }
/// ``` /// ```
#[stable(feature = "unix_socket", since = "1.10.0")] #[stable(feature = "unix_socket", since = "1.10.0")]
pub fn read_timeout(&self) -> io::Result<Option<Duration>> { pub fn read_timeout(&self) -> io::Result<Option<Duration>> {
@ -477,9 +517,13 @@ impl UnixStream {
/// use std::os::unix::net::UnixStream; /// use std::os::unix::net::UnixStream;
/// use std::time::Duration; /// use std::time::Duration;
/// ///
/// let socket = UnixStream::connect("/tmp/sock").unwrap(); /// fn main() -> std::io::Result<()> {
/// socket.set_write_timeout(Some(Duration::new(1, 0))).expect("Couldn't set write timeout"); /// let socket = UnixStream::connect("/tmp/sock")?;
/// assert_eq!(socket.write_timeout().unwrap(), Some(Duration::new(1, 0))); /// socket.set_write_timeout(Some(Duration::new(1, 0)))
/// .expect("Couldn't set write timeout");
/// assert_eq!(socket.write_timeout()?, Some(Duration::new(1, 0)));
/// Ok(())
/// }
/// ``` /// ```
#[stable(feature = "unix_socket", since = "1.10.0")] #[stable(feature = "unix_socket", since = "1.10.0")]
pub fn write_timeout(&self) -> io::Result<Option<Duration>> { pub fn write_timeout(&self) -> io::Result<Option<Duration>> {
@ -493,8 +537,11 @@ impl UnixStream {
/// ```no_run /// ```no_run
/// use std::os::unix::net::UnixStream; /// use std::os::unix::net::UnixStream;
/// ///
/// let socket = UnixStream::connect("/tmp/sock").unwrap(); /// fn main() -> std::io::Result<()> {
/// socket.set_nonblocking(true).expect("Couldn't set nonblocking"); /// let socket = UnixStream::connect("/tmp/sock")?;
/// socket.set_nonblocking(true).expect("Couldn't set nonblocking");
/// Ok(())
/// }
/// ``` /// ```
#[stable(feature = "unix_socket", since = "1.10.0")] #[stable(feature = "unix_socket", since = "1.10.0")]
pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()> { pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()> {
@ -508,9 +555,12 @@ impl UnixStream {
/// ```no_run /// ```no_run
/// use std::os::unix::net::UnixStream; /// use std::os::unix::net::UnixStream;
/// ///
/// let socket = UnixStream::connect("/tmp/sock").unwrap(); /// fn main() -> std::io::Result<()> {
/// if let Ok(Some(err)) = socket.take_error() { /// let socket = UnixStream::connect("/tmp/sock")?;
/// println!("Got error: {:?}", err); /// if let Ok(Some(err)) = socket.take_error() {
/// println!("Got error: {:?}", err);
/// }
/// Ok(())
/// } /// }
/// ``` /// ```
/// ///
@ -535,8 +585,11 @@ impl UnixStream {
/// use std::os::unix::net::UnixStream; /// use std::os::unix::net::UnixStream;
/// use std::net::Shutdown; /// use std::net::Shutdown;
/// ///
/// let socket = UnixStream::connect("/tmp/sock").unwrap(); /// fn main() -> std::io::Result<()> {
/// socket.shutdown(Shutdown::Both).expect("shutdown function failed"); /// let socket = UnixStream::connect("/tmp/sock")?;
/// socket.shutdown(Shutdown::Both).expect("shutdown function failed");
/// Ok(())
/// }
/// ``` /// ```
#[stable(feature = "unix_socket", since = "1.10.0")] #[stable(feature = "unix_socket", since = "1.10.0")]
pub fn shutdown(&self, how: Shutdown) -> io::Result<()> { pub fn shutdown(&self, how: Shutdown) -> io::Result<()> {
@ -697,20 +750,23 @@ impl IntoRawFd for net::UdpSocket {
/// // ... /// // ...
/// } /// }
/// ///
/// let listener = UnixListener::bind("/path/to/the/socket").unwrap(); /// fn main() -> std::io::Result<()> {
/// let listener = UnixListener::bind("/path/to/the/socket")?;
/// ///
/// // accept connections and process them, spawning a new thread for each one /// // accept connections and process them, spawning a new thread for each one
/// for stream in listener.incoming() { /// for stream in listener.incoming() {
/// match stream { /// match stream {
/// Ok(stream) => { /// Ok(stream) => {
/// /* connection succeeded */ /// /* connection succeeded */
/// thread::spawn(|| handle_client(stream)); /// thread::spawn(|| handle_client(stream));
/// } /// }
/// Err(err) => { /// Err(err) => {
/// /* connection failed */ /// /* connection failed */
/// break; /// break;
/// }
/// } /// }
/// } /// }
/// Ok(())
/// } /// }
/// ``` /// ```
#[stable(feature = "unix_socket", since = "1.10.0")] #[stable(feature = "unix_socket", since = "1.10.0")]
@ -773,11 +829,14 @@ impl UnixListener {
/// ```no_run /// ```no_run
/// use std::os::unix::net::UnixListener; /// use std::os::unix::net::UnixListener;
/// ///
/// let listener = UnixListener::bind("/path/to/the/socket").unwrap(); /// fn main() -> std::io::Result<()> {
/// let listener = UnixListener::bind("/path/to/the/socket")?;
/// ///
/// match listener.accept() { /// match listener.accept() {
/// Ok((socket, addr)) => println!("Got a client: {:?}", addr), /// Ok((socket, addr)) => println!("Got a client: {:?}", addr),
/// Err(e) => println!("accept function failed: {:?}", e), /// Err(e) => println!("accept function failed: {:?}", e),
/// }
/// Ok(())
/// } /// }
/// ``` /// ```
#[stable(feature = "unix_socket", since = "1.10.0")] #[stable(feature = "unix_socket", since = "1.10.0")]
@ -800,9 +859,11 @@ impl UnixListener {
/// ```no_run /// ```no_run
/// use std::os::unix::net::UnixListener; /// use std::os::unix::net::UnixListener;
/// ///
/// let listener = UnixListener::bind("/path/to/the/socket").unwrap(); /// fn main() -> std::io::Result<()> {
/// /// let listener = UnixListener::bind("/path/to/the/socket")?;
/// let listener_copy = listener.try_clone().expect("try_clone failed"); /// let listener_copy = listener.try_clone().expect("try_clone failed");
/// Ok(())
/// }
/// ``` /// ```
#[stable(feature = "unix_socket", since = "1.10.0")] #[stable(feature = "unix_socket", since = "1.10.0")]
pub fn try_clone(&self) -> io::Result<UnixListener> { pub fn try_clone(&self) -> io::Result<UnixListener> {
@ -816,9 +877,11 @@ impl UnixListener {
/// ```no_run /// ```no_run
/// use std::os::unix::net::UnixListener; /// use std::os::unix::net::UnixListener;
/// ///
/// let listener = UnixListener::bind("/path/to/the/socket").unwrap(); /// fn main() -> std::io::Result<()> {
/// /// let listener = UnixListener::bind("/path/to/the/socket")?;
/// let addr = listener.local_addr().expect("Couldn't get local address"); /// let addr = listener.local_addr().expect("Couldn't get local address");
/// Ok(())
/// }
/// ``` /// ```
#[stable(feature = "unix_socket", since = "1.10.0")] #[stable(feature = "unix_socket", since = "1.10.0")]
pub fn local_addr(&self) -> io::Result<SocketAddr> { pub fn local_addr(&self) -> io::Result<SocketAddr> {
@ -832,9 +895,11 @@ impl UnixListener {
/// ```no_run /// ```no_run
/// use std::os::unix::net::UnixListener; /// use std::os::unix::net::UnixListener;
/// ///
/// let listener = UnixListener::bind("/path/to/the/socket").unwrap(); /// fn main() -> std::io::Result<()> {
/// /// let listener = UnixListener::bind("/path/to/the/socket")?;
/// listener.set_nonblocking(true).expect("Couldn't set non blocking"); /// listener.set_nonblocking(true).expect("Couldn't set non blocking");
/// Ok(())
/// }
/// ``` /// ```
#[stable(feature = "unix_socket", since = "1.10.0")] #[stable(feature = "unix_socket", since = "1.10.0")]
pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()> { pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()> {
@ -848,10 +913,13 @@ impl UnixListener {
/// ```no_run /// ```no_run
/// use std::os::unix::net::UnixListener; /// use std::os::unix::net::UnixListener;
/// ///
/// let listener = UnixListener::bind("/tmp/sock").unwrap(); /// fn main() -> std::io::Result<()> {
/// let listener = UnixListener::bind("/tmp/sock")?;
/// ///
/// if let Ok(Some(err)) = listener.take_error() { /// if let Ok(Some(err)) = listener.take_error() {
/// println!("Got error: {:?}", err); /// println!("Got error: {:?}", err);
/// }
/// Ok(())
/// } /// }
/// ``` /// ```
/// ///
@ -880,17 +948,20 @@ impl UnixListener {
/// // ... /// // ...
/// } /// }
/// ///
/// let listener = UnixListener::bind("/path/to/the/socket").unwrap(); /// fn main() -> std::io::Result<()> {
/// let listener = UnixListener::bind("/path/to/the/socket")?;
/// ///
/// for stream in listener.incoming() { /// for stream in listener.incoming() {
/// match stream { /// match stream {
/// Ok(stream) => { /// Ok(stream) => {
/// thread::spawn(|| handle_client(stream)); /// thread::spawn(|| handle_client(stream));
/// } /// }
/// Err(err) => { /// Err(err) => {
/// break; /// break;
/// }
/// } /// }
/// } /// }
/// Ok(())
/// } /// }
/// ``` /// ```
#[stable(feature = "unix_socket", since = "1.10.0")] #[stable(feature = "unix_socket", since = "1.10.0")]
@ -947,17 +1018,20 @@ impl<'a> IntoIterator for &'a UnixListener {
/// // ... /// // ...
/// } /// }
/// ///
/// let listener = UnixListener::bind("/path/to/the/socket").unwrap(); /// fn main() -> std::io::Result<()> {
/// let listener = UnixListener::bind("/path/to/the/socket")?;
/// ///
/// for stream in listener.incoming() { /// for stream in listener.incoming() {
/// match stream { /// match stream {
/// Ok(stream) => { /// Ok(stream) => {
/// thread::spawn(|| handle_client(stream)); /// thread::spawn(|| handle_client(stream));
/// } /// }
/// Err(err) => { /// Err(err) => {
/// break; /// break;
/// }
/// } /// }
/// } /// }
/// Ok(())
/// } /// }
/// ``` /// ```
#[derive(Debug)] #[derive(Debug)]
@ -986,11 +1060,14 @@ impl<'a> Iterator for Incoming<'a> {
/// ```no_run /// ```no_run
/// use std::os::unix::net::UnixDatagram; /// use std::os::unix::net::UnixDatagram;
/// ///
/// let socket = UnixDatagram::bind("/path/to/my/socket").unwrap(); /// fn main() -> std::io::Result<()> {
/// socket.send_to(b"hello world", "/path/to/other/socket").unwrap(); /// let socket = UnixDatagram::bind("/path/to/my/socket")?;
/// let mut buf = [0; 100]; /// socket.send_to(b"hello world", "/path/to/other/socket")?;
/// let (count, address) = socket.recv_from(&mut buf).unwrap(); /// let mut buf = [0; 100];
/// println!("socket {:?} sent {:?}", address, &buf[..count]); /// let (count, address) = socket.recv_from(&mut buf)?;
/// println!("socket {:?} sent {:?}", address, &buf[..count]);
/// Ok(())
/// }
/// ``` /// ```
#[stable(feature = "unix_socket", since = "1.10.0")] #[stable(feature = "unix_socket", since = "1.10.0")]
pub struct UnixDatagram(Socket); pub struct UnixDatagram(Socket);
@ -1099,14 +1176,17 @@ impl UnixDatagram {
/// ```no_run /// ```no_run
/// use std::os::unix::net::UnixDatagram; /// use std::os::unix::net::UnixDatagram;
/// ///
/// let sock = UnixDatagram::unbound().unwrap(); /// fn main() -> std::io::Result<()> {
/// match sock.connect("/path/to/the/socket") { /// let sock = UnixDatagram::unbound()?;
/// Ok(sock) => sock, /// match sock.connect("/path/to/the/socket") {
/// Err(e) => { /// Ok(sock) => sock,
/// println!("Couldn't connect: {:?}", e); /// Err(e) => {
/// return /// println!("Couldn't connect: {:?}", e);
/// } /// return Err(e)
/// }; /// }
/// };
/// Ok(())
/// }
/// ``` /// ```
#[stable(feature = "unix_socket", since = "1.10.0")] #[stable(feature = "unix_socket", since = "1.10.0")]
pub fn connect<P: AsRef<Path>>(&self, path: P) -> io::Result<()> { pub fn connect<P: AsRef<Path>>(&self, path: P) -> io::Result<()> {
@ -1133,9 +1213,11 @@ impl UnixDatagram {
/// ```no_run /// ```no_run
/// use std::os::unix::net::UnixDatagram; /// use std::os::unix::net::UnixDatagram;
/// ///
/// let sock = UnixDatagram::bind("/path/to/the/socket").unwrap(); /// fn main() -> std::io::Result<()> {
/// /// let sock = UnixDatagram::bind("/path/to/the/socket")?;
/// let sock_copy = sock.try_clone().expect("try_clone failed"); /// let sock_copy = sock.try_clone().expect("try_clone failed");
/// Ok(())
/// }
/// ``` /// ```
#[stable(feature = "unix_socket", since = "1.10.0")] #[stable(feature = "unix_socket", since = "1.10.0")]
pub fn try_clone(&self) -> io::Result<UnixDatagram> { pub fn try_clone(&self) -> io::Result<UnixDatagram> {
@ -1149,9 +1231,11 @@ impl UnixDatagram {
/// ```no_run /// ```no_run
/// use std::os::unix::net::UnixDatagram; /// use std::os::unix::net::UnixDatagram;
/// ///
/// let sock = UnixDatagram::bind("/path/to/the/socket").unwrap(); /// fn main() -> std::io::Result<()> {
/// /// let sock = UnixDatagram::bind("/path/to/the/socket")?;
/// let addr = sock.local_addr().expect("Couldn't get local address"); /// let addr = sock.local_addr().expect("Couldn't get local address");
/// Ok(())
/// }
/// ``` /// ```
#[stable(feature = "unix_socket", since = "1.10.0")] #[stable(feature = "unix_socket", since = "1.10.0")]
pub fn local_addr(&self) -> io::Result<SocketAddr> { pub fn local_addr(&self) -> io::Result<SocketAddr> {
@ -1169,10 +1253,13 @@ impl UnixDatagram {
/// ```no_run /// ```no_run
/// use std::os::unix::net::UnixDatagram; /// use std::os::unix::net::UnixDatagram;
/// ///
/// let sock = UnixDatagram::unbound().unwrap(); /// fn main() -> std::io::Result<()> {
/// sock.connect("/path/to/the/socket").unwrap(); /// let sock = UnixDatagram::unbound()?;
/// sock.connect("/path/to/the/socket")?;
/// ///
/// let addr = sock.peer_addr().expect("Couldn't get peer address"); /// let addr = sock.peer_addr().expect("Couldn't get peer address");
/// Ok(())
/// }
/// ``` /// ```
#[stable(feature = "unix_socket", since = "1.10.0")] #[stable(feature = "unix_socket", since = "1.10.0")]
pub fn peer_addr(&self) -> io::Result<SocketAddr> { pub fn peer_addr(&self) -> io::Result<SocketAddr> {
@ -1189,11 +1276,12 @@ impl UnixDatagram {
/// ```no_run /// ```no_run
/// use std::os::unix::net::UnixDatagram; /// use std::os::unix::net::UnixDatagram;
/// ///
/// let sock = UnixDatagram::unbound().unwrap(); /// fn main() -> std::io::Result<()> {
/// let mut buf = vec![0; 10]; /// let sock = UnixDatagram::unbound()?;
/// match sock.recv_from(buf.as_mut_slice()) { /// let mut buf = vec![0; 10];
/// Ok((size, sender)) => println!("received {} bytes from {:?}", size, sender), /// let (size, sender) = sock.recv_from(buf.as_mut_slice())?;
/// Err(e) => println!("recv_from function failed: {:?}", e), /// println!("received {} bytes from {:?}", size, sender);
/// Ok(())
/// } /// }
/// ``` /// ```
#[stable(feature = "unix_socket", since = "1.10.0")] #[stable(feature = "unix_socket", since = "1.10.0")]
@ -1229,9 +1317,12 @@ impl UnixDatagram {
/// ```no_run /// ```no_run
/// use std::os::unix::net::UnixDatagram; /// use std::os::unix::net::UnixDatagram;
/// ///
/// let sock = UnixDatagram::bind("/path/to/the/socket").unwrap(); /// fn main() -> std::io::Result<()> {
/// let mut buf = vec![0; 10]; /// let sock = UnixDatagram::bind("/path/to/the/socket")?;
/// sock.recv(buf.as_mut_slice()).expect("recv function failed"); /// let mut buf = vec![0; 10];
/// sock.recv(buf.as_mut_slice()).expect("recv function failed");
/// Ok(())
/// }
/// ``` /// ```
#[stable(feature = "unix_socket", since = "1.10.0")] #[stable(feature = "unix_socket", since = "1.10.0")]
pub fn recv(&self, buf: &mut [u8]) -> io::Result<usize> { pub fn recv(&self, buf: &mut [u8]) -> io::Result<usize> {
@ -1247,8 +1338,11 @@ impl UnixDatagram {
/// ```no_run /// ```no_run
/// use std::os::unix::net::UnixDatagram; /// use std::os::unix::net::UnixDatagram;
/// ///
/// let sock = UnixDatagram::unbound().unwrap(); /// fn main() -> std::io::Result<()> {
/// sock.send_to(b"omelette au fromage", "/some/sock").expect("send_to function failed"); /// let sock = UnixDatagram::unbound()?;
/// sock.send_to(b"omelette au fromage", "/some/sock").expect("send_to function failed");
/// Ok(())
/// }
/// ``` /// ```
#[stable(feature = "unix_socket", since = "1.10.0")] #[stable(feature = "unix_socket", since = "1.10.0")]
pub fn send_to<P: AsRef<Path>>(&self, buf: &[u8], path: P) -> io::Result<usize> { pub fn send_to<P: AsRef<Path>>(&self, buf: &[u8], path: P) -> io::Result<usize> {
@ -1280,9 +1374,12 @@ impl UnixDatagram {
/// ```no_run /// ```no_run
/// use std::os::unix::net::UnixDatagram; /// use std::os::unix::net::UnixDatagram;
/// ///
/// let sock = UnixDatagram::unbound().unwrap(); /// fn main() -> std::io::Result<()> {
/// sock.connect("/some/sock").expect("Couldn't connect"); /// let sock = UnixDatagram::unbound()?;
/// sock.send(b"omelette au fromage").expect("send_to function failed"); /// sock.connect("/some/sock").expect("Couldn't connect");
/// sock.send(b"omelette au fromage").expect("send_to function failed");
/// Ok(())
/// }
/// ``` /// ```
#[stable(feature = "unix_socket", since = "1.10.0")] #[stable(feature = "unix_socket", since = "1.10.0")]
pub fn send(&self, buf: &[u8]) -> io::Result<usize> { pub fn send(&self, buf: &[u8]) -> io::Result<usize> {
@ -1307,8 +1404,12 @@ impl UnixDatagram {
/// use std::os::unix::net::UnixDatagram; /// use std::os::unix::net::UnixDatagram;
/// use std::time::Duration; /// use std::time::Duration;
/// ///
/// let sock = UnixDatagram::unbound().unwrap(); /// fn main() -> std::io::Result<()> {
/// sock.set_read_timeout(Some(Duration::new(1, 0))).expect("set_read_timeout function failed"); /// let sock = UnixDatagram::unbound()?;
/// sock.set_read_timeout(Some(Duration::new(1, 0)))
/// .expect("set_read_timeout function failed");
/// Ok(())
/// }
/// ``` /// ```
/// ///
/// An [`Err`] is returned if the zero [`Duration`] is passed to this /// An [`Err`] is returned if the zero [`Duration`] is passed to this
@ -1319,10 +1420,13 @@ impl UnixDatagram {
/// use std::os::unix::net::UnixDatagram; /// use std::os::unix::net::UnixDatagram;
/// use std::time::Duration; /// use std::time::Duration;
/// ///
/// let socket = UnixDatagram::unbound().unwrap(); /// fn main() -> std::io::Result<()> {
/// let result = socket.set_read_timeout(Some(Duration::new(0, 0))); /// let socket = UnixDatagram::unbound()?;
/// let err = result.unwrap_err(); /// let result = socket.set_read_timeout(Some(Duration::new(0, 0)));
/// assert_eq!(err.kind(), io::ErrorKind::InvalidInput) /// let err = result.unwrap_err();
/// assert_eq!(err.kind(), io::ErrorKind::InvalidInput);
/// Ok(())
/// }
/// ``` /// ```
#[stable(feature = "unix_socket", since = "1.10.0")] #[stable(feature = "unix_socket", since = "1.10.0")]
pub fn set_read_timeout(&self, timeout: Option<Duration>) -> io::Result<()> { pub fn set_read_timeout(&self, timeout: Option<Duration>) -> io::Result<()> {
@ -1346,9 +1450,12 @@ impl UnixDatagram {
/// use std::os::unix::net::UnixDatagram; /// use std::os::unix::net::UnixDatagram;
/// use std::time::Duration; /// use std::time::Duration;
/// ///
/// let sock = UnixDatagram::unbound().unwrap(); /// fn main() -> std::io::Result<()> {
/// sock.set_write_timeout(Some(Duration::new(1, 0))) /// let sock = UnixDatagram::unbound()?;
/// .expect("set_write_timeout function failed"); /// sock.set_write_timeout(Some(Duration::new(1, 0)))
/// .expect("set_write_timeout function failed");
/// Ok(())
/// }
/// ``` /// ```
/// ///
/// An [`Err`] is returned if the zero [`Duration`] is passed to this /// An [`Err`] is returned if the zero [`Duration`] is passed to this
@ -1359,10 +1466,13 @@ impl UnixDatagram {
/// use std::os::unix::net::UnixDatagram; /// use std::os::unix::net::UnixDatagram;
/// use std::time::Duration; /// use std::time::Duration;
/// ///
/// let socket = UnixDatagram::unbound().unwrap(); /// fn main() -> std::io::Result<()> {
/// let result = socket.set_write_timeout(Some(Duration::new(0, 0))); /// let socket = UnixDatagram::unbound()?;
/// let err = result.unwrap_err(); /// let result = socket.set_write_timeout(Some(Duration::new(0, 0)));
/// assert_eq!(err.kind(), io::ErrorKind::InvalidInput) /// let err = result.unwrap_err();
/// assert_eq!(err.kind(), io::ErrorKind::InvalidInput);
/// Ok(())
/// }
/// ``` /// ```
#[stable(feature = "unix_socket", since = "1.10.0")] #[stable(feature = "unix_socket", since = "1.10.0")]
pub fn set_write_timeout(&self, timeout: Option<Duration>) -> io::Result<()> { pub fn set_write_timeout(&self, timeout: Option<Duration>) -> io::Result<()> {
@ -1377,9 +1487,13 @@ impl UnixDatagram {
/// use std::os::unix::net::UnixDatagram; /// use std::os::unix::net::UnixDatagram;
/// use std::time::Duration; /// use std::time::Duration;
/// ///
/// let sock = UnixDatagram::unbound().unwrap(); /// fn main() -> std::io::Result<()> {
/// sock.set_read_timeout(Some(Duration::new(1, 0))).expect("set_read_timeout function failed"); /// let sock = UnixDatagram::unbound()?;
/// assert_eq!(sock.read_timeout().unwrap(), Some(Duration::new(1, 0))); /// sock.set_read_timeout(Some(Duration::new(1, 0)))
/// .expect("set_read_timeout function failed");
/// assert_eq!(sock.read_timeout()?, Some(Duration::new(1, 0)));
/// Ok(())
/// }
/// ``` /// ```
#[stable(feature = "unix_socket", since = "1.10.0")] #[stable(feature = "unix_socket", since = "1.10.0")]
pub fn read_timeout(&self) -> io::Result<Option<Duration>> { pub fn read_timeout(&self) -> io::Result<Option<Duration>> {
@ -1394,10 +1508,13 @@ impl UnixDatagram {
/// use std::os::unix::net::UnixDatagram; /// use std::os::unix::net::UnixDatagram;
/// use std::time::Duration; /// use std::time::Duration;
/// ///
/// let sock = UnixDatagram::unbound().unwrap(); /// fn main() -> std::io::Result<()> {
/// sock.set_write_timeout(Some(Duration::new(1, 0))) /// let sock = UnixDatagram::unbound()?;
/// .expect("set_write_timeout function failed"); /// sock.set_write_timeout(Some(Duration::new(1, 0)))
/// assert_eq!(sock.write_timeout().unwrap(), Some(Duration::new(1, 0))); /// .expect("set_write_timeout function failed");
/// assert_eq!(sock.write_timeout()?, Some(Duration::new(1, 0)));
/// Ok(())
/// }
/// ``` /// ```
#[stable(feature = "unix_socket", since = "1.10.0")] #[stable(feature = "unix_socket", since = "1.10.0")]
pub fn write_timeout(&self) -> io::Result<Option<Duration>> { pub fn write_timeout(&self) -> io::Result<Option<Duration>> {
@ -1411,8 +1528,11 @@ impl UnixDatagram {
/// ``` /// ```
/// use std::os::unix::net::UnixDatagram; /// use std::os::unix::net::UnixDatagram;
/// ///
/// let sock = UnixDatagram::unbound().unwrap(); /// fn main() -> std::io::Result<()> {
/// sock.set_nonblocking(true).expect("set_nonblocking function failed"); /// let sock = UnixDatagram::unbound()?;
/// sock.set_nonblocking(true).expect("set_nonblocking function failed");
/// Ok(())
/// }
/// ``` /// ```
#[stable(feature = "unix_socket", since = "1.10.0")] #[stable(feature = "unix_socket", since = "1.10.0")]
pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()> { pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()> {
@ -1426,9 +1546,12 @@ impl UnixDatagram {
/// ```no_run /// ```no_run
/// use std::os::unix::net::UnixDatagram; /// use std::os::unix::net::UnixDatagram;
/// ///
/// let sock = UnixDatagram::unbound().unwrap(); /// fn main() -> std::io::Result<()> {
/// if let Ok(Some(err)) = sock.take_error() { /// let sock = UnixDatagram::unbound()?;
/// println!("Got error: {:?}", err); /// if let Ok(Some(err)) = sock.take_error() {
/// println!("Got error: {:?}", err);
/// }
/// Ok(())
/// } /// }
/// ``` /// ```
#[stable(feature = "unix_socket", since = "1.10.0")] #[stable(feature = "unix_socket", since = "1.10.0")]
@ -1448,8 +1571,11 @@ impl UnixDatagram {
/// use std::os::unix::net::UnixDatagram; /// use std::os::unix::net::UnixDatagram;
/// use std::net::Shutdown; /// use std::net::Shutdown;
/// ///
/// let sock = UnixDatagram::unbound().unwrap(); /// fn main() -> std::io::Result<()> {
/// sock.shutdown(Shutdown::Both).expect("shutdown function failed"); /// let sock = UnixDatagram::unbound()?;
/// sock.shutdown(Shutdown::Both).expect("shutdown function failed");
/// Ok(())
/// }
/// ``` /// ```
#[stable(feature = "unix_socket", since = "1.10.0")] #[stable(feature = "unix_socket", since = "1.10.0")]
pub fn shutdown(&self, how: Shutdown) -> io::Result<()> { pub fn shutdown(&self, how: Shutdown) -> io::Result<()> {

View file

@ -21,8 +21,8 @@ fn foo<T: Copy>(_t: T, q: &i32) -> i32 {
// debug _t => _1; // debug _t => _1;
// debug q => _2; // debug q => _2;
// let mut _0: i32; // let mut _0: i32;
// let _3: [closure@HirId { owner: DefIndex(4), local_id: 31 }]; // let _3: [closure@foo<T>::{{closure}}#0];
// let mut _4: &[closure@HirId { owner: DefIndex(4), local_id: 31 }]; // let mut _4: &[closure@foo<T>::{{closure}}#0];
// let mut _5: (&i32, &i32); // let mut _5: (&i32, &i32);
// let mut _6: &i32; // let mut _6: &i32;
// let mut _7: &i32; // let mut _7: &i32;
@ -40,7 +40,7 @@ fn foo<T: Copy>(_t: T, q: &i32) -> i32 {
// } // }
// bb0: { // bb0: {
// ... // ...
// _3 = [closure@HirId { owner: DefIndex(4), local_id: 31 }]; // _3 = [closure@foo::<T>::{{closure}}#0];
// ... // ...
// _4 = &_3; // _4 = &_3;
// ... // ...

View file

@ -17,10 +17,10 @@ fn foo<T: Copy>(t: T, q: i32) -> (i32, T) {
// debug t => _1; // debug t => _1;
// debug q => _2; // debug q => _2;
// let mut _0: (i32, T); // let mut _0: (i32, T);
// let _3: [closure@HirId { owner: DefIndex(4), local_id: 15 } q:&i32, t:&T]; // let _3: [closure@foo<T>::{{closure}}#0 q:&i32, t:&T];
// let mut _4: &i32; // let mut _4: &i32;
// let mut _5: &T; // let mut _5: &T;
// let mut _6: &[closure@HirId { owner: DefIndex(4), local_id: 15 } q:&i32, t:&T]; // let mut _6: &[closure@foo<T>::{{closure}}#0 q:&i32, t:&T];
// let mut _7: (i32,); // let mut _7: (i32,);
// let mut _8: i32; // let mut _8: i32;
// let mut _11: i32; // let mut _11: i32;
@ -39,7 +39,7 @@ fn foo<T: Copy>(t: T, q: i32) -> (i32, T) {
// _4 = &_2; // _4 = &_2;
// ... // ...
// _5 = &_1; // _5 = &_1;
// _3 = [closure@HirId { owner: DefIndex(4), local_id: 15 }] { q: move _4, t: move _5 }; // _3 = [closure@foo::<T>::{{closure}}#0] { q: move _4, t: move _5 };
// ... // ...
// _6 = &_3; // _6 = &_3;
// ... // ...

View file

@ -17,8 +17,8 @@ fn foo<T: Copy>(_t: T, q: i32) -> i32 {
// debug _t => _1; // debug _t => _1;
// debug q => _2; // debug q => _2;
// let mut _0: i32; // let mut _0: i32;
// let _3: [closure@HirId { owner: DefIndex(4), local_id: 15 }]; // let _3: [closure@foo<T>::{{closure}}#0];
// let mut _4: &[closure@HirId { owner: DefIndex(4), local_id: 15 }]; // let mut _4: &[closure@foo<T>::{{closure}}#0];
// let mut _5: (i32, i32); // let mut _5: (i32, i32);
// let mut _6: i32; // let mut _6: i32;
// let mut _7: i32; // let mut _7: i32;
@ -33,7 +33,7 @@ fn foo<T: Copy>(_t: T, q: i32) -> i32 {
// } // }
// bb0: { // bb0: {
// ... // ...
// _3 = [closure@HirId { owner: DefIndex(4), local_id: 15 }]; // _3 = [closure@foo::<T>::{{closure}}#0];
// ... // ...
// _4 = &_3; // _4 = &_3;
// ... // ...

View file

@ -100,7 +100,7 @@ fn main() {
// } // }
// END rustc.main.EraseRegions.after.mir // END rustc.main.EraseRegions.after.mir
// START rustc.main-{{closure}}.EraseRegions.after.mir // START rustc.main-{{closure}}.EraseRegions.after.mir
// fn main::{{closure}}#0(_1: &[closure@HirId { owner: DefIndex(13), local_id: 72 }], _2: &i32) -> &i32 { // fn main::{{closure}}#0(_1: &[closure@main::{{closure}}#0], _2: &i32) -> &i32 {
// ... // ...
// bb0: { // bb0: {
// Retag([fn entry] _1); // Retag([fn entry] _1);

View file

@ -1,19 +0,0 @@
// force-host
#![feature(plugin_registrar)]
#![feature(rustc_private)]
extern crate rustc;
extern crate rustc_driver;
use rustc_driver::plugin::Registry;
#[plugin_registrar]
pub fn plugin_registrar(reg: &mut Registry) {
// This pass is built in to LLVM.
//
// Normally, we would name a pass that was registered through
// C++ static object constructors in the same .so file as the
// plugin registrar.
reg.register_llvm_pass("gvn");
}

View file

@ -1,6 +1,7 @@
// Test that `#![plugin(...)]` attribute is gated by `plugin` feature gate // aux-build:empty-plugin.rs
// ignore-stage1
#![plugin(foo)] #![plugin(empty_plugin)]
//~^ ERROR compiler plugins are deprecated //~^ ERROR compiler plugins are deprecated
//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated //~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated

View file

@ -1,17 +1,17 @@
error[E0658]: compiler plugins are deprecated error[E0658]: compiler plugins are deprecated
--> $DIR/feature-gate-plugin.rs:3:1 --> $DIR/feature-gate-plugin.rs:4:1
| |
LL | #![plugin(foo)] LL | #![plugin(empty_plugin)]
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^
| |
= note: for more information, see https://github.com/rust-lang/rust/issues/29597 = note: for more information, see https://github.com/rust-lang/rust/issues/29597
= help: add `#![feature(plugin)]` to the crate attributes to enable = help: add `#![feature(plugin)]` to the crate attributes to enable
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
--> $DIR/feature-gate-plugin.rs:3:1 --> $DIR/feature-gate-plugin.rs:4:1
| |
LL | #![plugin(foo)] LL | #![plugin(empty_plugin)]
| ^^^^^^^^^^^^^^^ help: may be removed in a future compiler version | ^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
| |
= note: `#[warn(deprecated)]` on by default = note: `#[warn(deprecated)]` on by default

View file

@ -1,9 +1,9 @@
// run-pass // check-pass
// aux-build:lint-plugin-test.rs // aux-build:lint-plugin-test.rs
// ignore-stage1 // ignore-stage1
// compile-flags: -Z extra-plugins=lint_plugin_test // compile-flags: -Z crate-attr=plugin(lint_plugin_test)
#![allow(dead_code)] #![feature(plugin)]
fn lintme() { } //~ WARNING item is named 'lintme' fn lintme() { } //~ WARNING item is named 'lintme'

View file

@ -1,3 +1,11 @@
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
--> <crate attribute>:1:1
|
LL | plugin(lint_plugin_test)
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
|
= note: `#[warn(deprecated)]` on by default
warning: item is named 'lintme' warning: item is named 'lintme'
--> $DIR/lint-plugin-cmdline-load.rs:8:1 --> $DIR/lint-plugin-cmdline-load.rs:8:1
| |

View file

@ -1,8 +0,0 @@
// run-pass
// aux-build:llvm-pass-plugin.rs
// ignore-stage1
#![feature(plugin)]
#![plugin(llvm_pass_plugin)] //~ WARNING compiler plugins are deprecated
pub fn main() { }

View file

@ -1,8 +0,0 @@
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
--> $DIR/llvm-pass-plugin.rs:6:1
|
LL | #![plugin(llvm_pass_plugin)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
|
= note: `#[warn(deprecated)]` on by default

View file

@ -1,9 +1,4 @@
// run-pass // check-pass
#![allow(plugin_as_library)]
#![allow(dead_code)]
#![allow(unused_variables)]
#![allow(unused_imports)]
// aux-build:macro-crate-test.rs // aux-build:macro-crate-test.rs
// ignore-stage1 // ignore-stage1

View file

@ -1,8 +0,0 @@
// check-pass
// aux-build:empty-plugin.rs
// ignore-stage1
#![feature(plugin)]
#![plugin(empty_plugin)] //~ WARNING compiler plugins are deprecated
fn main() {}

View file

@ -1,8 +0,0 @@
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
--> $DIR/plugin-args-1.rs:6:1
|
LL | #![plugin(empty_plugin)]
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
|
= note: `#[warn(deprecated)]` on by default

View file

@ -1,8 +0,0 @@
// check-pass
// aux-build:empty-plugin.rs
// ignore-stage1
#![feature(plugin)]
#![plugin(empty_plugin())] //~ WARNING compiler plugins are deprecated
fn main() {}

View file

@ -1,8 +0,0 @@
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
--> $DIR/plugin-args-2.rs:6:1
|
LL | #![plugin(empty_plugin())]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
|
= note: `#[warn(deprecated)]` on by default

View file

@ -1,8 +0,0 @@
// check-pass
// aux-build:empty-plugin.rs
// ignore-stage1
#![feature(plugin)]
#![plugin(empty_plugin(hello(there), how(are="you")))] //~ WARNING compiler plugins are deprecated
fn main() {}

View file

@ -1,8 +0,0 @@
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
--> $DIR/plugin-args-3.rs:6:1
|
LL | #![plugin(empty_plugin(hello(there), how(are="you")))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
|
= note: `#[warn(deprecated)]` on by default

View file

@ -0,0 +1,9 @@
// aux-build:empty-plugin.rs
// ignore-stage1
#![feature(plugin)]
#![plugin(empty_plugin(args))]
//~^ ERROR malformed `plugin` attribute
//~| WARNING compiler plugins are deprecated
fn main() {}

View file

@ -0,0 +1,16 @@
error[E0498]: malformed `plugin` attribute
--> $DIR/plugin-args.rs:5:11
|
LL | #![plugin(empty_plugin(args))]
| ^^^^^^^^^^^^^^^^^^ malformed attribute
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
--> $DIR/plugin-args.rs:5:1
|
LL | #![plugin(empty_plugin(args))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
|
= note: `#[warn(deprecated)]` on by default
error: aborting due to previous error

View file

@ -1,11 +1,10 @@
// check-pass
// aux-build:empty-plugin.rs // aux-build:empty-plugin.rs
// ignore-cross-compile // ignore-cross-compile
// //
// empty_plugin will not compile on a cross-compiled target because // empty_plugin will not compile on a cross-compiled target because
// libsyntax is not compiled for it. // libsyntax is not compiled for it.
#![deny(plugin_as_library)] extern crate empty_plugin; // OK, plugin crates are still crates
extern crate empty_plugin; //~ ERROR compiler plugin used as an ordinary library fn main() {}
fn main() { }

View file

@ -1,14 +0,0 @@
error: compiler plugin used as an ordinary library
--> $DIR/plugin-as-extern-crate.rs:9:1
|
LL | extern crate empty_plugin;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: lint level defined here
--> $DIR/plugin-as-extern-crate.rs:7:9
|
LL | #![deny(plugin_as_library)]
| ^^^^^^^^^^^^^^^^^
error: aborting due to previous error

View file

@ -2,7 +2,7 @@ error: malformed `plugin` attribute input
--> $DIR/malformed-plugin-1.rs:2:1 --> $DIR/malformed-plugin-1.rs:2:1
| |
LL | #![plugin] LL | #![plugin]
| ^^^^^^^^^^ help: must be of the form: `#[plugin(name|name(args))]` | ^^^^^^^^^^ help: must be of the form: `#[plugin(name)]`
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
--> $DIR/malformed-plugin-1.rs:2:1 --> $DIR/malformed-plugin-1.rs:2:1

View file

@ -2,7 +2,7 @@ error: malformed `plugin` attribute input
--> $DIR/malformed-plugin-2.rs:2:1 --> $DIR/malformed-plugin-2.rs:2:1
| |
LL | #![plugin="bleh"] LL | #![plugin="bleh"]
| ^^^^^^^^^^^^^^^^^ help: must be of the form: `#[plugin(name|name(args))]` | ^^^^^^^^^^^^^^^^^ help: must be of the form: `#[plugin(name)]`
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
--> $DIR/malformed-plugin-2.rs:2:1 --> $DIR/malformed-plugin-2.rs:2:1

View file

@ -1,8 +1,8 @@
error[E0498]: malformed `plugin` attribute error[E0498]: malformed `plugin` attribute
--> $DIR/malformed-plugin-3.rs:2:1 --> $DIR/malformed-plugin-3.rs:2:11
| |
LL | #![plugin(foo="bleh")] LL | #![plugin(foo="bleh")]
| ^^^^^^^^^^^^^^^^^^^^^^ malformed attribute | ^^^^^^^^^^ malformed attribute
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
--> $DIR/malformed-plugin-3.rs:2:1 --> $DIR/malformed-plugin-3.rs:2:1

View file

@ -6,7 +6,7 @@ LL | let mut closure = expect_sig(|p, y| *p = y);
| |
= note: defining type: DefId(0:4 ~ escape_argument_callee[317d]::test[0]::{{closure}}[0]) with closure substs [ = note: defining type: DefId(0:4 ~ escape_argument_callee[317d]::test[0]::{{closure}}[0]) with closure substs [
i16, 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)), for<'r, 's, 't0> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed('r)) mut &ReLateBound(DebruijnIndex(0), BrNamed('s)) i32, &ReLateBound(DebruijnIndex(0), BrNamed('t0)) i32)),
] ]
error: lifetime may not live long enough error: lifetime may not live long enough

View file

@ -6,7 +6,7 @@ LL | let mut closure = expect_sig(|p, y| *p = y);
| |
= note: defining type: DefId(0:4 ~ escape_argument[317d]::test[0]::{{closure}}[0]) with closure substs [ = note: defining type: DefId(0:4 ~ escape_argument[317d]::test[0]::{{closure}}[0]) with closure substs [
i16, 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)), for<'r, 's> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed('r)) mut &ReLateBound(DebruijnIndex(0), BrNamed('s)) i32, &ReLateBound(DebruijnIndex(0), BrNamed('s)) i32)),
] ]
note: No external requirements note: No external requirements

View file

@ -10,7 +10,7 @@ LL | | },
| |
= note: defining type: DefId(0:18 ~ propagate_approximated_fail_no_postdom[317d]::supply[0]::{{closure}}[0]) with closure substs [ = note: defining type: DefId(0:18 ~ propagate_approximated_fail_no_postdom[317d]::supply[0]::{{closure}}[0]) with closure substs [
i16, 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>)), for<'r, 's> extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed('r)) u32>, std::cell::Cell<&'_#2r &ReLateBound(DebruijnIndex(0), BrNamed('r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('s)) &'_#3r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('s)) u32>)),
] ]
= note: late-bound region is '_#4r = note: late-bound region is '_#4r
= note: late-bound region is '_#5r = note: late-bound region is '_#5r

View file

@ -11,7 +11,7 @@ LL | | });
| |
= note: defining type: DefId(0:16 ~ propagate_approximated_ref[317d]::supply[0]::{{closure}}[0]) with closure substs [ = note: defining type: DefId(0:16 ~ propagate_approximated_ref[317d]::supply[0]::{{closure}}[0]) with closure substs [
i16, 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>)), for<'r, 's, 't0, 't1, 't2, 't3> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed('r)) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed('s)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed('t0)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('t1)) &'_#2r u32>, &ReLateBound(DebruijnIndex(0), BrNamed('t2)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('s)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed('t3)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('t1)) u32>)),
] ]
= note: late-bound region is '_#3r = note: late-bound region is '_#3r
= note: late-bound region is '_#4r = note: late-bound region is '_#4r

View file

@ -10,7 +10,7 @@ LL | | })
| |
= note: defining type: DefId(0:9 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case1[0]::{{closure}}[0]) with closure substs [ = note: defining type: DefId(0:9 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case1[0]::{{closure}}[0]) with closure substs [
i32, i32,
for<'r> extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) u32>)), for<'r> extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('r)) u32>)),
] ]
error[E0521]: borrowed data escapes outside of closure error[E0521]: borrowed data escapes outside of closure
@ -48,7 +48,7 @@ LL | | })
| |
= note: defining type: DefId(0:11 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case2[0]::{{closure}}[0]) with closure substs [ = note: defining type: DefId(0:11 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case2[0]::{{closure}}[0]) with closure substs [
i32, i32,
for<'r> extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0), 'r)) u32>)), for<'r> extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('r)) u32>)),
] ]
= note: number of external vids: 2 = note: number of external vids: 2
= note: where '_#1r: '_#0r = note: where '_#1r: '_#0r

View file

@ -12,7 +12,7 @@ LL | | });
| |
= note: defining type: DefId(0:16 ~ propagate_approximated_shorter_to_static_no_bound[317d]::supply[0]::{{closure}}[0]) with closure substs [ = note: defining type: DefId(0:16 ~ propagate_approximated_shorter_to_static_no_bound[317d]::supply[0]::{{closure}}[0]) with closure substs [
i16, 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>)), for<'r, 's, 't0, 't1, 't2> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed('r)) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed('s)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed('t0)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('s)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed('t1)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('t2)) u32>)),
] ]
= note: late-bound region is '_#2r = note: late-bound region is '_#2r
= note: late-bound region is '_#3r = note: late-bound region is '_#3r

View file

@ -12,7 +12,7 @@ LL | | });
| |
= note: defining type: DefId(0:16 ~ propagate_approximated_shorter_to_static_wrong_bound[317d]::supply[0]::{{closure}}[0]) with closure substs [ = note: defining type: DefId(0:16 ~ propagate_approximated_shorter_to_static_wrong_bound[317d]::supply[0]::{{closure}}[0]) with closure substs [
i16, 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>)), for<'r, 's, 't0, 't1, 't2, 't3> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed('r)) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed('s)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed('t0)) std::cell::Cell<&'_#2r &ReLateBound(DebruijnIndex(0), BrNamed('t1)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed('t2)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('s)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed('t3)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('t1)) u32>)),
] ]
= note: late-bound region is '_#3r = note: late-bound region is '_#3r
= note: late-bound region is '_#4r = note: late-bound region is '_#4r

View file

@ -11,7 +11,7 @@ LL | | });
| |
= note: defining type: DefId(0:16 ~ propagate_approximated_val[317d]::test[0]::{{closure}}[0]) with closure substs [ = note: defining type: DefId(0:16 ~ propagate_approximated_val[317d]::test[0]::{{closure}}[0]) with closure substs [
i16, 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>)), for<'r, 's> extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed('r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('s)) &'_#2r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('s)) u32>)),
] ]
= note: late-bound region is '_#3r = note: late-bound region is '_#3r
= note: late-bound region is '_#4r = note: late-bound region is '_#4r

View file

@ -10,7 +10,7 @@ LL | | },
| |
= note: defining type: DefId(0:14 ~ propagate_despite_same_free_region[317d]::supply[0]::{{closure}}[0]) with closure substs [ = note: defining type: DefId(0:14 ~ propagate_despite_same_free_region[317d]::supply[0]::{{closure}}[0]) with closure substs [
i16, 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>)), for<'r, 's> extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed('r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('s)) &'_#2r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('s)) u32>)),
] ]
= note: late-bound region is '_#3r = note: late-bound region is '_#3r
= note: number of external vids: 4 = note: number of external vids: 4

View file

@ -11,7 +11,7 @@ LL | | });
| |
= note: defining type: DefId(0:16 ~ propagate_fail_to_approximate_longer_no_bounds[317d]::supply[0]::{{closure}}[0]) with closure substs [ = note: defining type: DefId(0:16 ~ propagate_fail_to_approximate_longer_no_bounds[317d]::supply[0]::{{closure}}[0]) with closure substs [
i16, 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>)), for<'r, 's, 't0, 't1, 't2> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed('r)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('s)) &'_#1r u32>, &ReLateBound(DebruijnIndex(0), BrNamed('t0)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('t1)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed('t2)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('s)) u32>)),
] ]
= note: late-bound region is '_#2r = note: late-bound region is '_#2r
= note: late-bound region is '_#3r = note: late-bound region is '_#3r

View file

@ -11,7 +11,7 @@ LL | | });
| |
= note: defining type: DefId(0:16 ~ propagate_fail_to_approximate_longer_wrong_bounds[317d]::supply[0]::{{closure}}[0]) with closure substs [ = note: defining type: DefId(0:16 ~ propagate_fail_to_approximate_longer_wrong_bounds[317d]::supply[0]::{{closure}}[0]) with closure substs [
i16, 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>)), for<'r, 's, 't0, 't1, 't2, 't3> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed('r)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('s)) &'_#1r u32>, &ReLateBound(DebruijnIndex(0), BrNamed('t0)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('t1)) &'_#2r u32>, &ReLateBound(DebruijnIndex(0), BrNamed('t2)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('s)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed('t3)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('t1)) u32>)),
] ]
= note: late-bound region is '_#3r = note: late-bound region is '_#3r
= note: late-bound region is '_#4r = note: late-bound region is '_#4r

View file

@ -6,7 +6,7 @@ LL | expect_sig(|a, b| b); // ought to return `a`
| |
= note: defining type: DefId(0:4 ~ return_wrong_bound_region[317d]::test[0]::{{closure}}[0]) with closure substs [ = note: defining type: DefId(0:4 ~ return_wrong_bound_region[317d]::test[0]::{{closure}}[0]) with closure substs [
i16, 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, for<'r, 's> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed('r)) i32, &ReLateBound(DebruijnIndex(0), BrNamed('s)) i32)) -> &ReLateBound(DebruijnIndex(0), BrNamed('r)) i32,
] ]
error: lifetime may not live long enough error: lifetime may not live long enough

View file

@ -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)); LL | with_signature(cell, t, |cell, t| require(cell, t));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
= help: consider adding an explicit lifetime bound `T: ReFree(DefId(0:15 ~ projection_one_region_closure[317d]::no_relationships_late[0]), BrNamed(crate0:DefIndex(16), 'a))`... = help: consider adding an explicit lifetime bound `T: ReFree(DefId(0:15 ~ projection_one_region_closure[317d]::no_relationships_late[0]), BrNamed(DefId(0:16 ~ projection_one_region_closure[317d]::no_relationships_late[0]::'a[0]), 'a))`...
error: lifetime may not live long enough error: lifetime may not live long enough
--> $DIR/projection-one-region-closure.rs:45:39 --> $DIR/projection-one-region-closure.rs:45:39

View file

@ -39,7 +39,7 @@ error[E0309]: the associated type `<T as Anything<'_#5r, '_#6r>>::AssocType` may
LL | with_signature(cell, t, |cell, t| require(cell, t)); 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:17 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_late[0]), BrNamed(crate0:DefIndex(18), 'a))`... = help: consider adding an explicit lifetime bound `<T as Anything<'_#5r, '_#6r>>::AssocType: ReFree(DefId(0:17 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_late[0]), BrNamed(DefId(0:18 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_late[0]::'a[0]), 'a))`...
note: External requirements note: External requirements
--> $DIR/projection-two-region-trait-bound-closure.rs:48:29 --> $DIR/projection-two-region-trait-bound-closure.rs:48:29

View file

@ -7,7 +7,7 @@ LL | twice(cell, value, |a, b| invoke(a, b));
= note: defining type: DefId(0:11 ~ ty_param_closure_approximate_lower_bound[317d]::generic[0]::{{closure}}[0]) with closure substs [ = note: defining type: DefId(0:11 ~ ty_param_closure_approximate_lower_bound[317d]::generic[0]::{{closure}}[0]) with closure substs [
T, T,
i16, 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)), for<'r, 's> extern "rust-call" fn((std::option::Option<std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed('r)) ()>>, &ReLateBound(DebruijnIndex(0), BrNamed('s)) T)),
] ]
= note: number of external vids: 2 = note: number of external vids: 2
= note: where T: '_#1r = note: where T: '_#1r
@ -34,7 +34,7 @@ LL | twice(cell, value, |a, b| invoke(a, b));
= note: defining type: DefId(0:15 ~ ty_param_closure_approximate_lower_bound[317d]::generic_fail[0]::{{closure}}[0]) with closure substs [ = note: defining type: DefId(0:15 ~ ty_param_closure_approximate_lower_bound[317d]::generic_fail[0]::{{closure}}[0]) with closure substs [
T, T,
i16, 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)), for<'r, 's> extern "rust-call" fn((std::option::Option<std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed('r)) ()>>, &ReLateBound(DebruijnIndex(0), BrNamed('s)) T)),
] ]
= note: late-bound region is '_#2r = note: late-bound region is '_#2r
= note: number of external vids: 3 = note: number of external vids: 3
@ -59,7 +59,7 @@ error[E0309]: the parameter type `T` may not live long enough
LL | twice(cell, value, |a, b| invoke(a, b)); LL | twice(cell, value, |a, b| invoke(a, b));
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^
| |
= help: consider adding an explicit lifetime bound `T: ReFree(DefId(0:12 ~ ty_param_closure_approximate_lower_bound[317d]::generic_fail[0]), BrNamed(crate0:DefIndex(13), 'a))`... = help: consider adding an explicit lifetime bound `T: ReFree(DefId(0:12 ~ ty_param_closure_approximate_lower_bound[317d]::generic_fail[0]), BrNamed(DefId(0:13 ~ ty_param_closure_approximate_lower_bound[317d]::generic_fail[0]::'a[0]), 'a))`...
error: aborting due to previous error error: aborting due to previous error

View file

@ -49,7 +49,7 @@ LL | | require(&x, &y)
LL | | }) LL | | })
| |_____^ | |_____^
| |
= help: consider adding an explicit lifetime bound `T: ReFree(DefId(0:11 ~ ty_param_closure_outlives_from_where_clause[317d]::no_region[0]), BrNamed(crate0:DefIndex(12), 'a))`... = help: consider adding an explicit lifetime bound `T: ReFree(DefId(0:11 ~ ty_param_closure_outlives_from_where_clause[317d]::no_region[0]), BrNamed(DefId(0:12 ~ ty_param_closure_outlives_from_where_clause[317d]::no_region[0]::'a[0]), 'a))`...
note: External requirements note: External requirements
--> $DIR/ty-param-closure-outlives-from-where-clause.rs:43:26 --> $DIR/ty-param-closure-outlives-from-where-clause.rs:43:26
@ -139,7 +139,7 @@ LL | | require(&x, &y)
LL | | }) LL | | })
| |_____^ | |_____^
| |
= help: consider adding an explicit lifetime bound `T: ReFree(DefId(0:19 ~ ty_param_closure_outlives_from_where_clause[317d]::wrong_region[0]), BrNamed(crate0:DefIndex(20), 'a))`... = help: consider adding an explicit lifetime bound `T: ReFree(DefId(0:19 ~ ty_param_closure_outlives_from_where_clause[317d]::wrong_region[0]), BrNamed(DefId(0:20 ~ ty_param_closure_outlives_from_where_clause[317d]::wrong_region[0]::'a[0]), 'a))`...
note: External requirements note: External requirements
--> $DIR/ty-param-closure-outlives-from-where-clause.rs:77:26 --> $DIR/ty-param-closure-outlives-from-where-clause.rs:77:26