Auto merge of #52336 - ishitatsuyuki:dyn-rollup, r=Mark-Simulacrum
Rollup of bare_trait_objects PRs All deny attributes were moved into bootstrap so they can be disabled with a line of config. Warnings for external tools are allowed and it's up to the tool's maintainer to keep it warnings free. r? @Mark-Simulacrum cc @ljedrz @kennytm
This commit is contained in:
commit
4f1e235744
@ -296,8 +296,10 @@ fn main() {
|
||||
cmd.arg("--color=always");
|
||||
}
|
||||
|
||||
if env::var_os("RUSTC_DENY_WARNINGS").is_some() {
|
||||
if env::var_os("RUSTC_DENY_WARNINGS").is_some() && env::var_os("RUSTC_EXTERNAL_TOOL").is_none()
|
||||
{
|
||||
cmd.arg("-Dwarnings");
|
||||
cmd.arg("-Dbare_trait_objects");
|
||||
}
|
||||
|
||||
if verbose > 1 {
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
use compile::{run_cargo, std_cargo, test_cargo, rustc_cargo, rustc_cargo_env, add_to_sysroot};
|
||||
use builder::{RunConfig, Builder, ShouldRun, Step};
|
||||
use tool::{self, prepare_tool_cargo};
|
||||
use tool::{self, prepare_tool_cargo, SourceType};
|
||||
use {Compiler, Mode};
|
||||
use cache::{INTERNER, Interned};
|
||||
use std::path::PathBuf;
|
||||
@ -222,7 +222,8 @@ impl Step for Rustdoc {
|
||||
Mode::ToolRustc,
|
||||
target,
|
||||
"check",
|
||||
"src/tools/rustdoc");
|
||||
"src/tools/rustdoc",
|
||||
SourceType::InTree);
|
||||
|
||||
let _folder = builder.fold_output(|| format!("stage{}-rustdoc", compiler.stage));
|
||||
println!("Checking rustdoc artifacts ({} -> {})", &compiler.host, target);
|
||||
|
@ -28,7 +28,7 @@ use build_helper::up_to_date;
|
||||
|
||||
use util::symlink_dir;
|
||||
use builder::{Builder, Compiler, RunConfig, ShouldRun, Step};
|
||||
use tool::{self, prepare_tool_cargo, Tool};
|
||||
use tool::{self, prepare_tool_cargo, Tool, SourceType};
|
||||
use compile;
|
||||
use cache::{INTERNER, Interned};
|
||||
use config::Config;
|
||||
@ -814,6 +814,7 @@ impl Step for Rustdoc {
|
||||
target,
|
||||
"doc",
|
||||
"src/tools/rustdoc",
|
||||
SourceType::InTree,
|
||||
);
|
||||
|
||||
cargo.env("RUSTDOCFLAGS", "--document-private-items");
|
||||
|
@ -30,7 +30,7 @@ use compile;
|
||||
use dist;
|
||||
use flags::Subcommand;
|
||||
use native;
|
||||
use tool::{self, Tool};
|
||||
use tool::{self, Tool, SourceType};
|
||||
use toolstate::ToolState;
|
||||
use util::{self, dylib_path, dylib_path_var};
|
||||
use Crate as CargoCrate;
|
||||
@ -222,17 +222,18 @@ impl Step for Cargo {
|
||||
compiler,
|
||||
target: self.host,
|
||||
});
|
||||
let mut cargo = builder.cargo(compiler, Mode::ToolRustc, self.host, "test");
|
||||
cargo
|
||||
.arg("--manifest-path")
|
||||
.arg(builder.src.join("src/tools/cargo/Cargo.toml"));
|
||||
let mut cargo = tool::prepare_tool_cargo(builder,
|
||||
compiler,
|
||||
Mode::ToolRustc,
|
||||
self.host,
|
||||
"test",
|
||||
"src/tools/cargo",
|
||||
SourceType::Submodule);
|
||||
|
||||
if !builder.fail_fast {
|
||||
cargo.arg("--no-fail-fast");
|
||||
}
|
||||
|
||||
// Don't build tests dynamically, just a pain to work with
|
||||
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
|
||||
|
||||
// Don't run cross-compile tests, we may not have cross-compiled libstd libs
|
||||
// available.
|
||||
cargo.env("CFG_DISABLE_CROSS_TESTS", "1");
|
||||
@ -286,10 +287,8 @@ impl Step for Rls {
|
||||
Mode::ToolRustc,
|
||||
host,
|
||||
"test",
|
||||
"src/tools/rls");
|
||||
|
||||
// Don't build tests dynamically, just a pain to work with
|
||||
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
|
||||
"src/tools/rls",
|
||||
SourceType::Submodule);
|
||||
|
||||
builder.add_rustc_lib_path(compiler, &mut cargo);
|
||||
|
||||
@ -341,10 +340,9 @@ impl Step for Rustfmt {
|
||||
Mode::ToolRustc,
|
||||
host,
|
||||
"test",
|
||||
"src/tools/rustfmt");
|
||||
"src/tools/rustfmt",
|
||||
SourceType::Submodule);
|
||||
|
||||
// Don't build tests dynamically, just a pain to work with
|
||||
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
|
||||
let dir = testdir(builder, compiler.host);
|
||||
t!(fs::create_dir_all(&dir));
|
||||
cargo.env("RUSTFMT_TEST_DIR", dir);
|
||||
@ -392,13 +390,14 @@ impl Step for Miri {
|
||||
extra_features: Vec::new(),
|
||||
});
|
||||
if let Some(miri) = miri {
|
||||
let mut cargo = builder.cargo(compiler, Mode::ToolRustc, host, "test");
|
||||
cargo
|
||||
.arg("--manifest-path")
|
||||
.arg(builder.src.join("src/tools/miri/Cargo.toml"));
|
||||
let mut cargo = tool::prepare_tool_cargo(builder,
|
||||
compiler,
|
||||
Mode::ToolRustc,
|
||||
host,
|
||||
"test",
|
||||
"src/tools/miri",
|
||||
SourceType::Submodule);
|
||||
|
||||
// Don't build tests dynamically, just a pain to work with
|
||||
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
|
||||
// miri tests need to know about the stage sysroot
|
||||
cargo.env("MIRI_SYSROOT", builder.sysroot(compiler));
|
||||
cargo.env("RUSTC_TEST_SUITE", builder.rustc(compiler));
|
||||
@ -450,13 +449,14 @@ impl Step for Clippy {
|
||||
extra_features: Vec::new(),
|
||||
});
|
||||
if let Some(clippy) = clippy {
|
||||
let mut cargo = builder.cargo(compiler, Mode::ToolRustc, host, "test");
|
||||
cargo
|
||||
.arg("--manifest-path")
|
||||
.arg(builder.src.join("src/tools/clippy/Cargo.toml"));
|
||||
let mut cargo = tool::prepare_tool_cargo(builder,
|
||||
compiler,
|
||||
Mode::ToolRustc,
|
||||
host,
|
||||
"test",
|
||||
"src/tools/clippy",
|
||||
SourceType::Submodule);
|
||||
|
||||
// Don't build tests dynamically, just a pain to work with
|
||||
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
|
||||
// clippy tests need to know about the stage sysroot
|
||||
cargo.env("SYSROOT", builder.sysroot(compiler));
|
||||
cargo.env("RUSTC_TEST_SUITE", builder.rustc(compiler));
|
||||
@ -1739,7 +1739,8 @@ impl Step for CrateRustdoc {
|
||||
Mode::ToolRustc,
|
||||
target,
|
||||
test_kind.subcommand(),
|
||||
"src/tools/rustdoc");
|
||||
"src/tools/rustdoc",
|
||||
SourceType::InTree);
|
||||
if test_kind.subcommand() == "test" && !builder.fail_fast {
|
||||
cargo.arg("--no-fail-fast");
|
||||
}
|
||||
|
@ -75,6 +75,12 @@ impl Step for CleanTools {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
|
||||
pub enum SourceType {
|
||||
InTree,
|
||||
Submodule,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
|
||||
struct ToolBuild {
|
||||
compiler: Compiler,
|
||||
@ -82,7 +88,8 @@ struct ToolBuild {
|
||||
tool: &'static str,
|
||||
path: &'static str,
|
||||
mode: Mode,
|
||||
is_ext_tool: bool,
|
||||
is_optional_tool: bool,
|
||||
source_type: SourceType,
|
||||
extra_features: Vec<String>,
|
||||
}
|
||||
|
||||
@ -102,7 +109,7 @@ impl Step for ToolBuild {
|
||||
let target = self.target;
|
||||
let tool = self.tool;
|
||||
let path = self.path;
|
||||
let is_ext_tool = self.is_ext_tool;
|
||||
let is_optional_tool = self.is_optional_tool;
|
||||
|
||||
match self.mode {
|
||||
Mode::ToolRustc => {
|
||||
@ -115,7 +122,15 @@ impl Step for ToolBuild {
|
||||
_ => panic!("unexpected Mode for tool build")
|
||||
}
|
||||
|
||||
let mut cargo = prepare_tool_cargo(builder, compiler, self.mode, target, "build", path);
|
||||
let mut cargo = prepare_tool_cargo(
|
||||
builder,
|
||||
compiler,
|
||||
self.mode,
|
||||
target,
|
||||
"build",
|
||||
path,
|
||||
self.source_type,
|
||||
);
|
||||
cargo.arg("--features").arg(self.extra_features.join(" "));
|
||||
|
||||
let _folder = builder.fold_output(|| format!("stage{}-{}", compiler.stage, tool));
|
||||
@ -216,7 +231,7 @@ impl Step for ToolBuild {
|
||||
});
|
||||
|
||||
if !is_expected {
|
||||
if !is_ext_tool {
|
||||
if !is_optional_tool {
|
||||
exit(1);
|
||||
} else {
|
||||
return None;
|
||||
@ -238,6 +253,7 @@ pub fn prepare_tool_cargo(
|
||||
target: Interned<String>,
|
||||
command: &'static str,
|
||||
path: &'static str,
|
||||
source_type: SourceType,
|
||||
) -> Command {
|
||||
let mut cargo = builder.cargo(compiler, mode, target, command);
|
||||
let dir = builder.src.join(path);
|
||||
@ -247,6 +263,10 @@ pub fn prepare_tool_cargo(
|
||||
// stages and such and it's just easier if they're not dynamically linked.
|
||||
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
|
||||
|
||||
if source_type == SourceType::Submodule {
|
||||
cargo.env("RUSTC_EXTERNAL_TOOL", "1");
|
||||
}
|
||||
|
||||
if let Some(dir) = builder.openssl_install_dir(target) {
|
||||
cargo.env("OPENSSL_STATIC", "1");
|
||||
cargo.env("OPENSSL_DIR", dir);
|
||||
@ -274,7 +294,8 @@ pub fn prepare_tool_cargo(
|
||||
}
|
||||
|
||||
macro_rules! tool {
|
||||
($($name:ident, $path:expr, $tool_name:expr, $mode:expr $(,llvm_tools = $llvm:expr)*;)+) => {
|
||||
($($name:ident, $path:expr, $tool_name:expr, $mode:expr
|
||||
$(,llvm_tools = $llvm:expr)* $(,is_external_tool = $external:expr)*;)+) => {
|
||||
#[derive(Copy, PartialEq, Eq, Clone)]
|
||||
pub enum Tool {
|
||||
$(
|
||||
@ -351,7 +372,12 @@ macro_rules! tool {
|
||||
tool: $tool_name,
|
||||
mode: $mode,
|
||||
path: $path,
|
||||
is_ext_tool: false,
|
||||
is_optional_tool: false,
|
||||
source_type: if false $(|| $external)* {
|
||||
SourceType::Submodule
|
||||
} else {
|
||||
SourceType::InTree
|
||||
},
|
||||
extra_features: Vec::new(),
|
||||
}).expect("expected to build -- essential tool")
|
||||
}
|
||||
@ -370,7 +396,8 @@ tool!(
|
||||
Compiletest, "src/tools/compiletest", "compiletest", Mode::ToolBootstrap, llvm_tools = true;
|
||||
BuildManifest, "src/tools/build-manifest", "build-manifest", Mode::ToolBootstrap;
|
||||
RemoteTestClient, "src/tools/remote-test-client", "remote-test-client", Mode::ToolBootstrap;
|
||||
RustInstaller, "src/tools/rust-installer", "fabricate", Mode::ToolBootstrap;
|
||||
RustInstaller, "src/tools/rust-installer", "fabricate", Mode::ToolBootstrap,
|
||||
is_external_tool = true;
|
||||
RustdocTheme, "src/tools/rustdoc-themes", "rustdoc-themes", Mode::ToolBootstrap;
|
||||
);
|
||||
|
||||
@ -401,7 +428,8 @@ impl Step for RemoteTestServer {
|
||||
tool: "remote-test-server",
|
||||
mode: Mode::ToolStd,
|
||||
path: "src/tools/remote-test-server",
|
||||
is_ext_tool: false,
|
||||
is_optional_tool: false,
|
||||
source_type: SourceType::InTree,
|
||||
extra_features: Vec::new(),
|
||||
}).expect("expected to build -- essential tool")
|
||||
}
|
||||
@ -449,12 +477,15 @@ impl Step for Rustdoc {
|
||||
target: builder.config.build,
|
||||
});
|
||||
|
||||
let mut cargo = prepare_tool_cargo(builder,
|
||||
build_compiler,
|
||||
Mode::ToolRustc,
|
||||
target,
|
||||
"build",
|
||||
"src/tools/rustdoc");
|
||||
let mut cargo = prepare_tool_cargo(
|
||||
builder,
|
||||
build_compiler,
|
||||
Mode::ToolRustc,
|
||||
target,
|
||||
"build",
|
||||
"src/tools/rustdoc",
|
||||
SourceType::InTree,
|
||||
);
|
||||
|
||||
// Most tools don't get debuginfo, but rustdoc should.
|
||||
cargo.env("RUSTC_DEBUGINFO", builder.config.rust_debuginfo.to_string())
|
||||
@ -525,7 +556,8 @@ impl Step for Cargo {
|
||||
tool: "cargo",
|
||||
mode: Mode::ToolRustc,
|
||||
path: "src/tools/cargo",
|
||||
is_ext_tool: false,
|
||||
is_optional_tool: false,
|
||||
source_type: SourceType::Submodule,
|
||||
extra_features: Vec::new(),
|
||||
}).expect("expected to build -- essential tool")
|
||||
}
|
||||
@ -574,7 +606,8 @@ macro_rules! tool_extended {
|
||||
mode: Mode::ToolRustc,
|
||||
path: $path,
|
||||
extra_features: $sel.extra_features,
|
||||
is_ext_tool: true,
|
||||
is_optional_tool: true,
|
||||
source_type: SourceType::Submodule,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -8,8 +8,6 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![deny(bare_trait_objects)]
|
||||
|
||||
use std::fs::File;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::{Command, Stdio};
|
||||
|
@ -72,7 +72,6 @@
|
||||
test(no_crate_inject, attr(allow(unused_variables), deny(warnings))))]
|
||||
#![no_std]
|
||||
#![needs_allocator]
|
||||
#![deny(bare_trait_objects)]
|
||||
#![deny(missing_debug_implementations)]
|
||||
|
||||
#![cfg_attr(test, allow(deprecated))] // rand
|
||||
|
@ -18,7 +18,7 @@ fn uninhabited() {
|
||||
a = a.clone();
|
||||
assert!(a.upgrade().is_none());
|
||||
|
||||
let mut a: Weak<Any> = a; // Unsizing
|
||||
let mut a: Weak<dyn Any> = a; // Unsizing
|
||||
a = a.clone();
|
||||
assert!(a.upgrade().is_none());
|
||||
}
|
||||
@ -39,7 +39,7 @@ fn slice() {
|
||||
#[test]
|
||||
fn trait_object() {
|
||||
let a: Arc<u32> = Arc::new(4);
|
||||
let a: Arc<Any> = a; // Unsizing
|
||||
let a: Arc<dyn Any> = a; // Unsizing
|
||||
|
||||
// Exercise is_dangling() with a DST
|
||||
let mut a = Arc::downgrade(&a);
|
||||
@ -49,7 +49,7 @@ fn trait_object() {
|
||||
let mut b = Weak::<u32>::new();
|
||||
b = b.clone();
|
||||
assert!(b.upgrade().is_none());
|
||||
let mut b: Weak<Any> = b; // Unsizing
|
||||
let mut b: Weak<dyn Any> = b; // Unsizing
|
||||
b = b.clone();
|
||||
assert!(b.upgrade().is_none());
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ fn test_hash() {
|
||||
}
|
||||
|
||||
fn check<F>(a: &[i32], b: &[i32], expected: &[i32], f: F)
|
||||
where F: FnOnce(&BTreeSet<i32>, &BTreeSet<i32>, &mut FnMut(&i32) -> bool) -> bool
|
||||
where F: FnOnce(&BTreeSet<i32>, &BTreeSet<i32>, &mut dyn FnMut(&i32) -> bool) -> bool
|
||||
{
|
||||
let mut set_a = BTreeSet::new();
|
||||
let mut set_b = BTreeSet::new();
|
||||
|
@ -63,7 +63,7 @@ fn test_boxed_hasher() {
|
||||
5u32.hash(&mut hasher_1);
|
||||
assert_eq!(ordinary_hash, hasher_1.finish());
|
||||
|
||||
let mut hasher_2 = Box::new(DefaultHasher::new()) as Box<Hasher>;
|
||||
let mut hasher_2 = Box::new(DefaultHasher::new()) as Box<dyn Hasher>;
|
||||
5u32.hash(&mut hasher_2);
|
||||
assert_eq!(ordinary_hash, hasher_2.finish());
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ fn uninhabited() {
|
||||
a = a.clone();
|
||||
assert!(a.upgrade().is_none());
|
||||
|
||||
let mut a: Weak<Any> = a; // Unsizing
|
||||
let mut a: Weak<dyn Any> = a; // Unsizing
|
||||
a = a.clone();
|
||||
assert!(a.upgrade().is_none());
|
||||
}
|
||||
@ -39,7 +39,7 @@ fn slice() {
|
||||
#[test]
|
||||
fn trait_object() {
|
||||
let a: Rc<u32> = Rc::new(4);
|
||||
let a: Rc<Any> = a; // Unsizing
|
||||
let a: Rc<dyn Any> = a; // Unsizing
|
||||
|
||||
// Exercise is_dangling() with a DST
|
||||
let mut a = Rc::downgrade(&a);
|
||||
@ -49,7 +49,7 @@ fn trait_object() {
|
||||
let mut b = Weak::<u32>::new();
|
||||
b = b.clone();
|
||||
assert!(b.upgrade().is_none());
|
||||
let mut b: Weak<Any> = b; // Unsizing
|
||||
let mut b: Weak<dyn Any> = b; // Unsizing
|
||||
b = b.clone();
|
||||
assert!(b.upgrade().is_none());
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
#![no_std]
|
||||
#![allow(unused_attributes)]
|
||||
#![deny(bare_trait_objects)]
|
||||
#![unstable(feature = "alloc_jemalloc",
|
||||
reason = "implementation detail of std, does not provide any public API",
|
||||
issue = "0")]
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
#![no_std]
|
||||
#![allow(unused_attributes)]
|
||||
#![deny(bare_trait_objects)]
|
||||
#![unstable(feature = "alloc_system",
|
||||
reason = "this library is unlikely to be stabilized in its current \
|
||||
form or name",
|
||||
|
@ -30,7 +30,6 @@
|
||||
#![cfg_attr(test, feature(test))]
|
||||
|
||||
#![allow(deprecated)]
|
||||
#![deny(bare_trait_objects)]
|
||||
|
||||
extern crate alloc;
|
||||
extern crate rustc_data_structures;
|
||||
|
@ -120,7 +120,7 @@ impl<T: 'static + ?Sized > Any for T {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl fmt::Debug for Any {
|
||||
impl fmt::Debug for dyn Any {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
f.pad("Any")
|
||||
}
|
||||
@ -130,20 +130,20 @@ impl fmt::Debug for Any {
|
||||
// hence used with `unwrap`. May eventually no longer be needed if
|
||||
// dispatch works with upcasting.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl fmt::Debug for Any + Send {
|
||||
impl fmt::Debug for dyn Any + Send {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
f.pad("Any")
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "any_send_sync_methods", since = "1.28.0")]
|
||||
impl fmt::Debug for Any + Send + Sync {
|
||||
impl fmt::Debug for dyn Any + Send + Sync {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
f.pad("Any")
|
||||
}
|
||||
}
|
||||
|
||||
impl Any {
|
||||
impl dyn Any {
|
||||
/// Returns `true` if the boxed type is the same as `T`.
|
||||
///
|
||||
/// # Examples
|
||||
@ -203,7 +203,7 @@ impl Any {
|
||||
pub fn downcast_ref<T: Any>(&self) -> Option<&T> {
|
||||
if self.is::<T>() {
|
||||
unsafe {
|
||||
Some(&*(self as *const Any as *const T))
|
||||
Some(&*(self as *const dyn Any as *const T))
|
||||
}
|
||||
} else {
|
||||
None
|
||||
@ -240,7 +240,7 @@ impl Any {
|
||||
pub fn downcast_mut<T: Any>(&mut self) -> Option<&mut T> {
|
||||
if self.is::<T>() {
|
||||
unsafe {
|
||||
Some(&mut *(self as *mut Any as *mut T))
|
||||
Some(&mut *(self as *mut dyn Any as *mut T))
|
||||
}
|
||||
} else {
|
||||
None
|
||||
@ -248,7 +248,7 @@ impl Any {
|
||||
}
|
||||
}
|
||||
|
||||
impl Any+Send {
|
||||
impl dyn Any+Send {
|
||||
/// Forwards to the method defined on the type `Any`.
|
||||
///
|
||||
/// # Examples
|
||||
@ -332,7 +332,7 @@ impl Any+Send {
|
||||
}
|
||||
}
|
||||
|
||||
impl Any+Send+Sync {
|
||||
impl dyn Any+Send+Sync {
|
||||
/// Forwards to the method defined on the type `Any`.
|
||||
///
|
||||
/// # Examples
|
||||
|
@ -1532,7 +1532,7 @@ impl<T: CoerceUnsized<U>, U> CoerceUnsized<UnsafeCell<U>> for UnsafeCell<T> {}
|
||||
|
||||
#[allow(unused)]
|
||||
fn assert_coerce_unsized(a: UnsafeCell<&i32>, b: Cell<&i32>, c: RefCell<&i32>) {
|
||||
let _: UnsafeCell<&Send> = a;
|
||||
let _: Cell<&Send> = b;
|
||||
let _: RefCell<&Send> = c;
|
||||
let _: UnsafeCell<&dyn Send> = a;
|
||||
let _: Cell<&dyn Send> = b;
|
||||
let _: RefCell<&dyn Send> = c;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
use fmt;
|
||||
|
||||
struct PadAdapter<'a> {
|
||||
buf: &'a mut (fmt::Write + 'a),
|
||||
buf: &'a mut (dyn fmt::Write + 'a),
|
||||
on_newline: bool,
|
||||
}
|
||||
|
||||
@ -107,7 +107,7 @@ pub fn debug_struct_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>,
|
||||
impl<'a, 'b: 'a> DebugStruct<'a, 'b> {
|
||||
/// Adds a new field to the generated struct output.
|
||||
#[stable(feature = "debug_builders", since = "1.2.0")]
|
||||
pub fn field(&mut self, name: &str, value: &fmt::Debug) -> &mut DebugStruct<'a, 'b> {
|
||||
pub fn field(&mut self, name: &str, value: &dyn fmt::Debug) -> &mut DebugStruct<'a, 'b> {
|
||||
self.result = self.result.and_then(|_| {
|
||||
let prefix = if self.has_fields {
|
||||
","
|
||||
@ -204,7 +204,7 @@ pub fn debug_tuple_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>, name: &str) -> D
|
||||
impl<'a, 'b: 'a> DebugTuple<'a, 'b> {
|
||||
/// Adds a new field to the generated tuple struct output.
|
||||
#[stable(feature = "debug_builders", since = "1.2.0")]
|
||||
pub fn field(&mut self, value: &fmt::Debug) -> &mut DebugTuple<'a, 'b> {
|
||||
pub fn field(&mut self, value: &dyn fmt::Debug) -> &mut DebugTuple<'a, 'b> {
|
||||
self.result = self.result.and_then(|_| {
|
||||
let (prefix, space) = if self.fields > 0 {
|
||||
(",", " ")
|
||||
@ -258,7 +258,7 @@ struct DebugInner<'a, 'b: 'a> {
|
||||
}
|
||||
|
||||
impl<'a, 'b: 'a> DebugInner<'a, 'b> {
|
||||
fn entry(&mut self, entry: &fmt::Debug) {
|
||||
fn entry(&mut self, entry: &dyn fmt::Debug) {
|
||||
self.result = self.result.and_then(|_| {
|
||||
if self.is_pretty() {
|
||||
let mut slot = None;
|
||||
@ -340,7 +340,7 @@ pub fn debug_set_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>) -> DebugSet<'a, 'b
|
||||
impl<'a, 'b: 'a> DebugSet<'a, 'b> {
|
||||
/// Adds a new entry to the set output.
|
||||
#[stable(feature = "debug_builders", since = "1.2.0")]
|
||||
pub fn entry(&mut self, entry: &fmt::Debug) -> &mut DebugSet<'a, 'b> {
|
||||
pub fn entry(&mut self, entry: &dyn fmt::Debug) -> &mut DebugSet<'a, 'b> {
|
||||
self.inner.entry(entry);
|
||||
self
|
||||
}
|
||||
@ -411,7 +411,7 @@ pub fn debug_list_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>) -> DebugList<'a,
|
||||
impl<'a, 'b: 'a> DebugList<'a, 'b> {
|
||||
/// Adds a new entry to the list output.
|
||||
#[stable(feature = "debug_builders", since = "1.2.0")]
|
||||
pub fn entry(&mut self, entry: &fmt::Debug) -> &mut DebugList<'a, 'b> {
|
||||
pub fn entry(&mut self, entry: &dyn fmt::Debug) -> &mut DebugList<'a, 'b> {
|
||||
self.inner.entry(entry);
|
||||
self
|
||||
}
|
||||
@ -482,7 +482,7 @@ pub fn debug_map_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>) -> DebugMap<'a, 'b
|
||||
impl<'a, 'b: 'a> DebugMap<'a, 'b> {
|
||||
/// Adds a new entry to the map output.
|
||||
#[stable(feature = "debug_builders", since = "1.2.0")]
|
||||
pub fn entry(&mut self, key: &fmt::Debug, value: &fmt::Debug) -> &mut DebugMap<'a, 'b> {
|
||||
pub fn entry(&mut self, key: &dyn fmt::Debug, value: &dyn fmt::Debug) -> &mut DebugMap<'a, 'b> {
|
||||
self.result = self.result.and_then(|_| {
|
||||
if self.is_pretty() {
|
||||
let mut slot = None;
|
||||
|
@ -255,7 +255,7 @@ pub struct Formatter<'a> {
|
||||
width: Option<usize>,
|
||||
precision: Option<usize>,
|
||||
|
||||
buf: &'a mut (Write+'a),
|
||||
buf: &'a mut (dyn Write+'a),
|
||||
curarg: slice::Iter<'a, ArgumentV1<'a>>,
|
||||
args: &'a [ArgumentV1<'a>],
|
||||
}
|
||||
@ -272,7 +272,7 @@ struct Void {
|
||||
///
|
||||
/// It was added after #45197 showed that one could share a `!Sync`
|
||||
/// object across threads by passing it into `format_args!`.
|
||||
_oibit_remover: PhantomData<*mut Fn()>,
|
||||
_oibit_remover: PhantomData<*mut dyn Fn()>,
|
||||
}
|
||||
|
||||
/// This struct represents the generic "argument" which is taken by the Xprintf
|
||||
@ -1020,7 +1020,7 @@ pub trait UpperExp {
|
||||
///
|
||||
/// [`write!`]: ../../std/macro.write.html
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn write(output: &mut Write, args: Arguments) -> Result {
|
||||
pub fn write(output: &mut dyn Write, args: Arguments) -> Result {
|
||||
let mut formatter = Formatter {
|
||||
flags: 0,
|
||||
width: None,
|
||||
@ -1062,7 +1062,7 @@ pub fn write(output: &mut Write, args: Arguments) -> Result {
|
||||
|
||||
impl<'a> Formatter<'a> {
|
||||
fn wrap_buf<'b, 'c, F>(&'b mut self, wrap: F) -> Formatter<'c>
|
||||
where 'b: 'c, F: FnOnce(&'b mut (Write+'b)) -> &'c mut (Write+'c)
|
||||
where 'b: 'c, F: FnOnce(&'b mut (dyn Write+'b)) -> &'c mut (dyn Write+'c)
|
||||
{
|
||||
Formatter {
|
||||
// We want to change this
|
||||
@ -1342,7 +1342,7 @@ impl<'a> Formatter<'a> {
|
||||
}
|
||||
|
||||
fn write_formatted_parts(&mut self, formatted: &flt2dec::Formatted) -> Result {
|
||||
fn write_bytes(buf: &mut Write, s: &[u8]) -> Result {
|
||||
fn write_bytes(buf: &mut dyn Write, s: &[u8]) -> Result {
|
||||
buf.write_str(unsafe { str::from_utf8_unchecked(s) })
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ use super::{Inspect, Map, Peekable, Scan, Skip, SkipWhile, StepBy, Take, TakeWhi
|
||||
use super::{Zip, Sum, Product};
|
||||
use super::{ChainState, FromIterator, ZipImpl};
|
||||
|
||||
fn _assert_is_object_safe(_: &Iterator<Item=()>) {}
|
||||
fn _assert_is_object_safe(_: &dyn Iterator<Item=()>) {}
|
||||
|
||||
/// An interface for dealing with iterators.
|
||||
///
|
||||
|
@ -43,7 +43,7 @@ use fmt;
|
||||
#[stable(feature = "panic_hooks", since = "1.10.0")]
|
||||
#[derive(Debug)]
|
||||
pub struct PanicInfo<'a> {
|
||||
payload: &'a (Any + Send),
|
||||
payload: &'a (dyn Any + Send),
|
||||
message: Option<&'a fmt::Arguments<'a>>,
|
||||
location: Location<'a>,
|
||||
}
|
||||
@ -64,7 +64,7 @@ impl<'a> PanicInfo<'a> {
|
||||
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
pub fn set_payload(&mut self, info: &'a (Any + Send)) {
|
||||
pub fn set_payload(&mut self, info: &'a (dyn Any + Send)) {
|
||||
self.payload = info;
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@ impl<'a> PanicInfo<'a> {
|
||||
/// panic!("Normal panic");
|
||||
/// ```
|
||||
#[stable(feature = "panic_hooks", since = "1.10.0")]
|
||||
pub fn payload(&self) -> &(Any + Send) {
|
||||
pub fn payload(&self) -> &(dyn Any + Send) {
|
||||
self.payload
|
||||
}
|
||||
|
||||
@ -270,6 +270,6 @@ impl<'a> fmt::Display for Location<'a> {
|
||||
#[unstable(feature = "std_internals", issue = "0")]
|
||||
#[doc(hidden)]
|
||||
pub unsafe trait BoxMeUp {
|
||||
fn box_me_up(&mut self) -> *mut (Any + Send);
|
||||
fn get(&mut self) -> &(Any + Send);
|
||||
fn box_me_up(&mut self) -> *mut (dyn Any + Send);
|
||||
fn get(&mut self) -> &(dyn Any + Send);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ use super::{Executor, Waker, LocalWaker};
|
||||
/// when performing a single `poll` step on a task.
|
||||
pub struct Context<'a> {
|
||||
local_waker: &'a LocalWaker,
|
||||
executor: &'a mut Executor,
|
||||
executor: &'a mut dyn Executor,
|
||||
}
|
||||
|
||||
impl<'a> fmt::Debug for Context<'a> {
|
||||
@ -34,7 +34,7 @@ impl<'a> fmt::Debug for Context<'a> {
|
||||
impl<'a> Context<'a> {
|
||||
/// Create a new task `Context` with the provided `local_waker`, `waker`, and `executor`.
|
||||
#[inline]
|
||||
pub fn new(local_waker: &'a LocalWaker, executor: &'a mut Executor) -> Context<'a> {
|
||||
pub fn new(local_waker: &'a LocalWaker, executor: &'a mut dyn Executor) -> Context<'a> {
|
||||
Context {
|
||||
local_waker,
|
||||
executor,
|
||||
@ -58,7 +58,7 @@ impl<'a> Context<'a> {
|
||||
/// This method is useful primarily if you want to explicitly handle
|
||||
/// spawn failures.
|
||||
#[inline]
|
||||
pub fn executor(&mut self) -> &mut Executor {
|
||||
pub fn executor(&mut self) -> &mut dyn Executor {
|
||||
self.executor
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ use ptr::NonNull;
|
||||
/// trait, allowing notifications to get routed through it.
|
||||
#[repr(transparent)]
|
||||
pub struct Waker {
|
||||
inner: NonNull<UnsafeWake>,
|
||||
inner: NonNull<dyn UnsafeWake>,
|
||||
}
|
||||
|
||||
impl Unpin for Waker {}
|
||||
@ -41,7 +41,7 @@ impl Waker {
|
||||
/// use the `Waker::from` function instead which works with the safe
|
||||
/// `Arc` type and the safe `Wake` trait.
|
||||
#[inline]
|
||||
pub unsafe fn new(inner: NonNull<UnsafeWake>) -> Self {
|
||||
pub unsafe fn new(inner: NonNull<dyn UnsafeWake>) -> Self {
|
||||
Waker { inner: inner }
|
||||
}
|
||||
|
||||
@ -98,7 +98,7 @@ impl Drop for Waker {
|
||||
/// behavior.
|
||||
#[repr(transparent)]
|
||||
pub struct LocalWaker {
|
||||
inner: NonNull<UnsafeWake>,
|
||||
inner: NonNull<dyn UnsafeWake>,
|
||||
}
|
||||
|
||||
impl Unpin for LocalWaker {}
|
||||
@ -119,7 +119,7 @@ impl LocalWaker {
|
||||
/// For this function to be used safely, it must be sound to call `inner.wake_local()`
|
||||
/// on the current thread.
|
||||
#[inline]
|
||||
pub unsafe fn new(inner: NonNull<UnsafeWake>) -> Self {
|
||||
pub unsafe fn new(inner: NonNull<dyn UnsafeWake>) -> Self {
|
||||
LocalWaker { inner: inner }
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ static TEST: &'static str = "Test";
|
||||
|
||||
#[test]
|
||||
fn any_referenced() {
|
||||
let (a, b, c) = (&5 as &Any, &TEST as &Any, &Test as &Any);
|
||||
let (a, b, c) = (&5 as &dyn Any, &TEST as &dyn Any, &Test as &dyn Any);
|
||||
|
||||
assert!(a.is::<i32>());
|
||||
assert!(!b.is::<i32>());
|
||||
@ -34,7 +34,11 @@ fn any_referenced() {
|
||||
|
||||
#[test]
|
||||
fn any_owning() {
|
||||
let (a, b, c) = (box 5_usize as Box<Any>, box TEST as Box<Any>, box Test as Box<Any>);
|
||||
let (a, b, c) = (
|
||||
box 5_usize as Box<dyn Any>,
|
||||
box TEST as Box<dyn Any>,
|
||||
box Test as Box<dyn Any>,
|
||||
);
|
||||
|
||||
assert!(a.is::<usize>());
|
||||
assert!(!b.is::<usize>());
|
||||
@ -51,7 +55,7 @@ fn any_owning() {
|
||||
|
||||
#[test]
|
||||
fn any_downcast_ref() {
|
||||
let a = &5_usize as &Any;
|
||||
let a = &5_usize as &dyn Any;
|
||||
|
||||
match a.downcast_ref::<usize>() {
|
||||
Some(&5) => {}
|
||||
@ -69,9 +73,9 @@ fn any_downcast_mut() {
|
||||
let mut a = 5_usize;
|
||||
let mut b: Box<_> = box 7_usize;
|
||||
|
||||
let a_r = &mut a as &mut Any;
|
||||
let a_r = &mut a as &mut dyn Any;
|
||||
let tmp: &mut usize = &mut *b;
|
||||
let b_r = tmp as &mut Any;
|
||||
let b_r = tmp as &mut dyn Any;
|
||||
|
||||
match a_r.downcast_mut::<usize>() {
|
||||
Some(x) => {
|
||||
@ -113,7 +117,7 @@ fn any_downcast_mut() {
|
||||
#[test]
|
||||
fn any_fixed_vec() {
|
||||
let test = [0_usize; 8];
|
||||
let test = &test as &Any;
|
||||
let test = &test as &dyn Any;
|
||||
assert!(test.is::<[usize; 8]>());
|
||||
assert!(!test.is::<[usize; 10]>());
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ fn test_custom_state() {
|
||||
fn test_indirect_hasher() {
|
||||
let mut hasher = MyHasher { hash: 0 };
|
||||
{
|
||||
let mut indirect_hasher: &mut Hasher = &mut hasher;
|
||||
let mut indirect_hasher: &mut dyn Hasher = &mut hasher;
|
||||
5u32.hash(&mut indirect_hasher);
|
||||
}
|
||||
assert_eq!(hasher.hash, 5);
|
||||
|
@ -22,7 +22,7 @@ fn test_typeid_sized_types() {
|
||||
#[test]
|
||||
fn test_typeid_unsized_types() {
|
||||
trait Z {}
|
||||
struct X(str); struct Y(Z + 'static);
|
||||
struct X(str); struct Y(dyn Z + 'static);
|
||||
|
||||
assert_eq!(TypeId::of::<X>(), TypeId::of::<X>());
|
||||
assert_eq!(TypeId::of::<Y>(), TypeId::of::<Y>());
|
||||
|
@ -109,11 +109,11 @@ fn test_transmute() {
|
||||
trait Foo { fn dummy(&self) { } }
|
||||
impl Foo for isize {}
|
||||
|
||||
let a = box 100isize as Box<Foo>;
|
||||
let a = box 100isize as Box<dyn Foo>;
|
||||
unsafe {
|
||||
let x: ::core::raw::TraitObject = transmute(a);
|
||||
assert!(*(x.data as *const isize) == 100);
|
||||
let _x: Box<Foo> = transmute(x);
|
||||
let _x: Box<dyn Foo> = transmute(x);
|
||||
}
|
||||
|
||||
unsafe {
|
||||
|
@ -240,7 +240,7 @@ fn test_collect() {
|
||||
assert!(v == None);
|
||||
|
||||
// test that it does not take more elements than it needs
|
||||
let mut functions: [Box<Fn() -> Option<()>>; 3] =
|
||||
let mut functions: [Box<dyn Fn() -> Option<()>>; 3] =
|
||||
[box || Some(()), box || None, box || panic!()];
|
||||
|
||||
let v: Option<Vec<()>> = functions.iter_mut().map(|f| (*f)()).collect();
|
||||
|
@ -84,16 +84,16 @@ fn test_is_null() {
|
||||
assert!(nms.is_null());
|
||||
|
||||
// Pointers to unsized types -- trait objects
|
||||
let ci: *const ToString = &3;
|
||||
let ci: *const dyn ToString = &3;
|
||||
assert!(!ci.is_null());
|
||||
|
||||
let mi: *mut ToString = &mut 3;
|
||||
let mi: *mut dyn ToString = &mut 3;
|
||||
assert!(!mi.is_null());
|
||||
|
||||
let nci: *const ToString = null::<isize>();
|
||||
let nci: *const dyn ToString = null::<isize>();
|
||||
assert!(nci.is_null());
|
||||
|
||||
let nmi: *mut ToString = null_mut::<isize>();
|
||||
let nmi: *mut dyn ToString = null_mut::<isize>();
|
||||
assert!(nmi.is_null());
|
||||
}
|
||||
|
||||
@ -140,16 +140,16 @@ fn test_as_ref() {
|
||||
assert_eq!(nms.as_ref(), None);
|
||||
|
||||
// Pointers to unsized types -- trait objects
|
||||
let ci: *const ToString = &3;
|
||||
let ci: *const dyn ToString = &3;
|
||||
assert!(ci.as_ref().is_some());
|
||||
|
||||
let mi: *mut ToString = &mut 3;
|
||||
let mi: *mut dyn ToString = &mut 3;
|
||||
assert!(mi.as_ref().is_some());
|
||||
|
||||
let nci: *const ToString = null::<isize>();
|
||||
let nci: *const dyn ToString = null::<isize>();
|
||||
assert!(nci.as_ref().is_none());
|
||||
|
||||
let nmi: *mut ToString = null_mut::<isize>();
|
||||
let nmi: *mut dyn ToString = null_mut::<isize>();
|
||||
assert!(nmi.as_ref().is_none());
|
||||
}
|
||||
}
|
||||
@ -182,10 +182,10 @@ fn test_as_mut() {
|
||||
assert_eq!(nms.as_mut(), None);
|
||||
|
||||
// Pointers to unsized types -- trait objects
|
||||
let mi: *mut ToString = &mut 3;
|
||||
let mi: *mut dyn ToString = &mut 3;
|
||||
assert!(mi.as_mut().is_some());
|
||||
|
||||
let nmi: *mut ToString = null_mut::<isize>();
|
||||
let nmi: *mut dyn ToString = null_mut::<isize>();
|
||||
assert!(nmi.as_mut().is_none());
|
||||
}
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ fn test_collect() {
|
||||
assert!(v == Err(2));
|
||||
|
||||
// test that it does not take more elements than it needs
|
||||
let mut functions: [Box<Fn() -> Result<(), isize>>; 3] =
|
||||
let mut functions: [Box<dyn Fn() -> Result<(), isize>>; 3] =
|
||||
[box || Ok(()), box || Err(1), box || panic!()];
|
||||
|
||||
let v: Result<Vec<()>, isize> = functions.iter_mut().map(|f| (*f)()).collect();
|
||||
|
@ -14,8 +14,6 @@
|
||||
//! Parsing does not happen at runtime: structures of `std::fmt::rt` are
|
||||
//! generated instead.
|
||||
|
||||
#![deny(bare_trait_objects)]
|
||||
|
||||
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
||||
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
|
||||
html_root_url = "https://doc.rust-lang.org/nightly/",
|
||||
|
@ -283,8 +283,6 @@
|
||||
//!
|
||||
//! * [DOT language](http://www.graphviz.org/doc/info/lang.html)
|
||||
|
||||
#![deny(bare_trait_objects)]
|
||||
|
||||
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
||||
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
|
||||
html_root_url = "https://doc.rust-lang.org/nightly/",
|
||||
|
@ -21,7 +21,6 @@
|
||||
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/")]
|
||||
#![panic_runtime]
|
||||
#![allow(unused_features)]
|
||||
#![deny(bare_trait_objects)]
|
||||
|
||||
#![feature(core_intrinsics)]
|
||||
#![feature(libc)]
|
||||
|
@ -22,7 +22,6 @@
|
||||
//! More documentation about each implementation can be found in the respective
|
||||
//! module.
|
||||
|
||||
#![deny(bare_trait_objects)]
|
||||
#![no_std]
|
||||
#![unstable(feature = "panic_unwind", issue = "32837")]
|
||||
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
||||
|
@ -22,7 +22,6 @@
|
||||
//! See [the book](../book/first-edition/procedural-macros.html) for more.
|
||||
|
||||
#![stable(feature = "proc_macro_lib", since = "1.15.0")]
|
||||
#![deny(bare_trait_objects)]
|
||||
#![deny(missing_docs)]
|
||||
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
||||
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
|
||||
|
@ -15,5 +15,4 @@
|
||||
reason = "internal implementation detail of rustc right now",
|
||||
issue = "0")]
|
||||
#![allow(unused_features)]
|
||||
#![deny(bare_trait_objects)]
|
||||
#![feature(staged_api)]
|
||||
|
@ -36,8 +36,6 @@
|
||||
//!
|
||||
//! This API is completely unstable and subject to change.
|
||||
|
||||
#![deny(bare_trait_objects)]
|
||||
|
||||
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
||||
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
|
||||
html_root_url = "https://doc.rust-lang.org/nightly/")]
|
||||
|
@ -8,7 +8,6 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![deny(bare_trait_objects)]
|
||||
#![feature(rustc_private)]
|
||||
|
||||
#[macro_use] extern crate log;
|
||||
|
@ -40,8 +40,6 @@
|
||||
//!
|
||||
//! This API is completely unstable and subject to change.
|
||||
|
||||
#![deny(bare_trait_objects)]
|
||||
|
||||
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
||||
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
|
||||
html_root_url = "https://doc.rust-lang.org/nightly/")]
|
||||
|
@ -8,8 +8,6 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![deny(bare_trait_objects)]
|
||||
|
||||
#![sanitizer_runtime]
|
||||
#![feature(alloc_system)]
|
||||
#![feature(sanitizer_runtime)]
|
||||
|
@ -13,7 +13,6 @@
|
||||
html_root_url = "https://doc.rust-lang.org/nightly/")]
|
||||
|
||||
#![allow(non_camel_case_types)]
|
||||
#![deny(bare_trait_objects)]
|
||||
|
||||
#![feature(from_ref)]
|
||||
#![feature(quote)]
|
||||
|
@ -23,7 +23,6 @@
|
||||
#![feature(custom_attribute)]
|
||||
#![feature(fs_read_write)]
|
||||
#![allow(unused_attributes)]
|
||||
#![deny(bare_trait_objects)]
|
||||
#![feature(libc)]
|
||||
#![feature(quote)]
|
||||
#![feature(range_contains)]
|
||||
|
@ -20,7 +20,6 @@
|
||||
#![feature(box_syntax)]
|
||||
#![feature(custom_attribute)]
|
||||
#![allow(unused_attributes)]
|
||||
#![deny(bare_trait_objects)]
|
||||
#![feature(quote)]
|
||||
#![feature(rustc_diagnostic_macros)]
|
||||
|
||||
|
@ -16,8 +16,6 @@
|
||||
//!
|
||||
//! This API is completely unstable and subject to change.
|
||||
|
||||
#![deny(bare_trait_objects)]
|
||||
|
||||
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
||||
html_favicon_url = "https://www.rust-lang.org/favicon.ico",
|
||||
html_root_url = "https://doc.rust-lang.org/nightly/")]
|
||||
|
@ -14,8 +14,6 @@
|
||||
//!
|
||||
//! This API is completely unstable and subject to change.
|
||||
|
||||
#![deny(bare_trait_objects)]
|
||||
|
||||
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
||||
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
|
||||
html_root_url = "https://doc.rust-lang.org/nightly/")]
|
||||
|
@ -8,8 +8,6 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![deny(bare_trait_objects)]
|
||||
|
||||
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
||||
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
|
||||
html_root_url = "https://doc.rust-lang.org/nightly/")]
|
||||
|
@ -10,8 +10,6 @@
|
||||
|
||||
//! Support for serializing the dep-graph and reloading it.
|
||||
|
||||
#![deny(bare_trait_objects)]
|
||||
|
||||
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
||||
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
|
||||
html_root_url = "https://doc.rust-lang.org/nightly/")]
|
||||
|
@ -19,8 +19,6 @@
|
||||
//!
|
||||
//! This API is completely unstable and subject to change.
|
||||
|
||||
#![deny(bare_trait_objects)]
|
||||
|
||||
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
||||
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
|
||||
html_root_url = "https://doc.rust-lang.org/nightly/")]
|
||||
|
@ -12,7 +12,6 @@
|
||||
#![allow(non_camel_case_types)]
|
||||
#![allow(non_snake_case)]
|
||||
#![allow(dead_code)]
|
||||
#![deny(bare_trait_objects)]
|
||||
|
||||
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
||||
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
|
||||
|
@ -8,8 +8,6 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![deny(bare_trait_objects)]
|
||||
|
||||
#![sanitizer_runtime]
|
||||
#![feature(alloc_system)]
|
||||
#![feature(sanitizer_runtime)]
|
||||
|
@ -8,8 +8,6 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![deny(bare_trait_objects)]
|
||||
|
||||
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
||||
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
|
||||
html_root_url = "https://doc.rust-lang.org/nightly/")]
|
||||
|
@ -14,8 +14,6 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
|
||||
|
||||
*/
|
||||
|
||||
#![deny(bare_trait_objects)]
|
||||
|
||||
#![feature(slice_patterns)]
|
||||
#![feature(slice_sort_by_cached_key)]
|
||||
#![feature(from_ref)]
|
||||
|
@ -8,8 +8,6 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![deny(bare_trait_objects)]
|
||||
|
||||
#![sanitizer_runtime]
|
||||
#![feature(alloc_system)]
|
||||
#![feature(sanitizer_runtime)]
|
||||
|
@ -14,8 +14,6 @@
|
||||
//!
|
||||
//! This API is completely unstable and subject to change.
|
||||
|
||||
#![deny(bare_trait_objects)]
|
||||
|
||||
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
||||
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
|
||||
html_root_url = "https://doc.rust-lang.org/nightly/")]
|
||||
|
@ -9,7 +9,6 @@
|
||||
// except according to those terms.
|
||||
|
||||
#![allow(bad_style)]
|
||||
#![deny(bare_trait_objects)]
|
||||
|
||||
pub struct Intrinsic {
|
||||
pub inputs: &'static [&'static Type],
|
||||
|
@ -60,8 +60,6 @@
|
||||
//! See the [`plugin` feature](../unstable-book/language-features/plugin.html) of
|
||||
//! the Unstable Book for more examples.
|
||||
|
||||
#![deny(bare_trait_objects)]
|
||||
|
||||
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
||||
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
|
||||
html_root_url = "https://doc.rust-lang.org/nightly/")]
|
||||
|
@ -8,8 +8,6 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![deny(bare_trait_objects)]
|
||||
|
||||
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
||||
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
|
||||
html_root_url = "https://doc.rust-lang.org/nightly/")]
|
||||
|
@ -8,8 +8,6 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![deny(bare_trait_objects)]
|
||||
|
||||
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
||||
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
|
||||
html_root_url = "https://doc.rust-lang.org/nightly/")]
|
||||
|
@ -13,7 +13,6 @@
|
||||
html_root_url = "https://doc.rust-lang.org/nightly/")]
|
||||
#![feature(custom_attribute)]
|
||||
#![allow(unused_attributes)]
|
||||
#![deny(bare_trait_objects)]
|
||||
|
||||
#![recursion_limit="256"]
|
||||
|
||||
|
@ -21,8 +21,6 @@
|
||||
//! one that doesn't; the one that doesn't might get decent parallel
|
||||
//! build speedups.
|
||||
|
||||
#![deny(bare_trait_objects)]
|
||||
|
||||
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
||||
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
|
||||
html_root_url = "https://doc.rust-lang.org/nightly/")]
|
||||
|
@ -11,8 +11,6 @@
|
||||
//! New recursive solver modeled on Chalk's recursive solver. Most of
|
||||
//! the guts are broken up into modules; see the comments in those modules.
|
||||
|
||||
#![deny(bare_trait_objects)]
|
||||
|
||||
#![feature(crate_in_paths)]
|
||||
#![feature(crate_visibility_modifier)]
|
||||
#![feature(extern_prelude)]
|
||||
|
@ -8,8 +8,6 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![deny(bare_trait_objects)]
|
||||
|
||||
#![sanitizer_runtime]
|
||||
#![feature(alloc_system)]
|
||||
#![feature(sanitizer_runtime)]
|
||||
|
@ -70,7 +70,6 @@ This API is completely unstable and subject to change.
|
||||
html_root_url = "https://doc.rust-lang.org/nightly/")]
|
||||
|
||||
#![allow(non_camel_case_types)]
|
||||
#![deny(bare_trait_objects)]
|
||||
|
||||
#![feature(box_patterns)]
|
||||
#![feature(box_syntax)]
|
||||
|
@ -375,7 +375,7 @@ impl fmt::Debug for Item {
|
||||
|
||||
let fake = MAX_DEF_ID.with(|m| m.borrow().get(&self.def_id.krate)
|
||||
.map(|id| self.def_id >= *id).unwrap_or(false));
|
||||
let def_id: &fmt::Debug = if fake { &"**FAKE**" } else { &self.def_id };
|
||||
let def_id: &dyn fmt::Debug = if fake { &"**FAKE**" } else { &self.def_id };
|
||||
|
||||
fmt.debug_struct("Item")
|
||||
.field("source", &self.source)
|
||||
|
@ -55,7 +55,7 @@ pub struct DocContext<'a, 'tcx: 'a, 'rcx: 'a> {
|
||||
/// The stack of module NodeIds up till this point
|
||||
pub mod_ids: RefCell<Vec<NodeId>>,
|
||||
pub crate_name: Option<String>,
|
||||
pub cstore: Rc<CrateStore>,
|
||||
pub cstore: Rc<dyn CrateStore>,
|
||||
pub populated_all_crate_impls: Cell<bool>,
|
||||
// Note that external items for which `doc(hidden)` applies to are shown as
|
||||
// non-reachable while local items aren't. This is because we're reusing
|
||||
|
@ -395,7 +395,7 @@ impl Class {
|
||||
|
||||
fn write_header(class: Option<&str>,
|
||||
id: Option<&str>,
|
||||
out: &mut Write)
|
||||
out: &mut dyn Write)
|
||||
-> io::Result<()> {
|
||||
write!(out, "<pre ")?;
|
||||
if let Some(id) = id {
|
||||
@ -404,6 +404,6 @@ fn write_header(class: Option<&str>,
|
||||
write!(out, "class=\"rust {}\">\n", class.unwrap_or(""))
|
||||
}
|
||||
|
||||
fn write_footer(out: &mut Write) -> io::Result<()> {
|
||||
fn write_footer(out: &mut dyn Write) -> io::Result<()> {
|
||||
write!(out, "</pre>\n")
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ pub struct Page<'a> {
|
||||
}
|
||||
|
||||
pub fn render<T: fmt::Display, S: fmt::Display>(
|
||||
dst: &mut io::Write, layout: &Layout, page: &Page, sidebar: &S, t: &T,
|
||||
dst: &mut dyn io::Write, layout: &Layout, page: &Page, sidebar: &S, t: &T,
|
||||
css_file_extension: bool, themes: &[PathBuf])
|
||||
-> io::Result<()>
|
||||
{
|
||||
@ -194,7 +194,7 @@ pub fn render<T: fmt::Display, S: fmt::Display>(
|
||||
)
|
||||
}
|
||||
|
||||
pub fn redirect(dst: &mut io::Write, url: &str) -> io::Result<()> {
|
||||
pub fn redirect(dst: &mut dyn io::Write, url: &str) -> io::Result<()> {
|
||||
// <script> triggers a redirect before refresh, so this is fine.
|
||||
write!(dst,
|
||||
r##"<!DOCTYPE html>
|
||||
|
@ -1822,7 +1822,7 @@ impl Context {
|
||||
}
|
||||
|
||||
fn render_item(&self,
|
||||
writer: &mut io::Write,
|
||||
writer: &mut dyn io::Write,
|
||||
it: &clean::Item,
|
||||
pushname: bool)
|
||||
-> io::Result<()> {
|
||||
|
@ -249,7 +249,7 @@ fn run_test(test: &str, cratename: &str, filename: &FileName, line: usize,
|
||||
}
|
||||
fn flush(&mut self) -> io::Result<()> { Ok(()) }
|
||||
}
|
||||
struct Bomb(Arc<Mutex<Vec<u8>>>, Box<Write+Send>);
|
||||
struct Bomb(Arc<Mutex<Vec<u8>>>, Box<dyn Write+Send>);
|
||||
impl Drop for Bomb {
|
||||
fn drop(&mut self) {
|
||||
let _ = self.1.write_all(&self.0.lock().unwrap());
|
||||
|
@ -14,8 +14,6 @@
|
||||
Core encoding and decoding interfaces.
|
||||
*/
|
||||
|
||||
#![deny(bare_trait_objects)]
|
||||
|
||||
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
||||
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
|
||||
html_root_url = "https://doc.rust-lang.org/nightly/",
|
||||
|
@ -138,7 +138,7 @@ pub trait Error: Debug + Display {
|
||||
/// }
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn cause(&self) -> Option<&Error> { None }
|
||||
fn cause(&self) -> Option<&dyn Error> { None }
|
||||
|
||||
/// Get the `TypeId` of `self`
|
||||
#[doc(hidden)]
|
||||
@ -151,22 +151,22 @@ pub trait Error: Debug + Display {
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, E: Error + 'a> From<E> for Box<Error + 'a> {
|
||||
fn from(err: E) -> Box<Error + 'a> {
|
||||
impl<'a, E: Error + 'a> From<E> for Box<dyn Error + 'a> {
|
||||
fn from(err: E) -> Box<dyn Error + 'a> {
|
||||
Box::new(err)
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, E: Error + Send + Sync + 'a> From<E> for Box<Error + Send + Sync + 'a> {
|
||||
fn from(err: E) -> Box<Error + Send + Sync + 'a> {
|
||||
impl<'a, E: Error + Send + Sync + 'a> From<E> for Box<dyn Error + Send + Sync + 'a> {
|
||||
fn from(err: E) -> Box<dyn Error + Send + Sync + 'a> {
|
||||
Box::new(err)
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl From<String> for Box<Error + Send + Sync> {
|
||||
fn from(err: String) -> Box<Error + Send + Sync> {
|
||||
impl From<String> for Box<dyn Error + Send + Sync> {
|
||||
fn from(err: String) -> Box<dyn Error + Send + Sync> {
|
||||
#[derive(Debug)]
|
||||
struct StringError(String);
|
||||
|
||||
@ -185,38 +185,38 @@ impl From<String> for Box<Error + Send + Sync> {
|
||||
}
|
||||
|
||||
#[stable(feature = "string_box_error", since = "1.6.0")]
|
||||
impl From<String> for Box<Error> {
|
||||
fn from(str_err: String) -> Box<Error> {
|
||||
let err1: Box<Error + Send + Sync> = From::from(str_err);
|
||||
let err2: Box<Error> = err1;
|
||||
impl From<String> for Box<dyn Error> {
|
||||
fn from(str_err: String) -> Box<dyn Error> {
|
||||
let err1: Box<dyn Error + Send + Sync> = From::from(str_err);
|
||||
let err2: Box<dyn Error> = err1;
|
||||
err2
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, 'b> From<&'b str> for Box<Error + Send + Sync + 'a> {
|
||||
fn from(err: &'b str) -> Box<Error + Send + Sync + 'a> {
|
||||
impl<'a, 'b> From<&'b str> for Box<dyn Error + Send + Sync + 'a> {
|
||||
fn from(err: &'b str) -> Box<dyn Error + Send + Sync + 'a> {
|
||||
From::from(String::from(err))
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "string_box_error", since = "1.6.0")]
|
||||
impl<'a> From<&'a str> for Box<Error> {
|
||||
fn from(err: &'a str) -> Box<Error> {
|
||||
impl<'a> From<&'a str> for Box<dyn Error> {
|
||||
fn from(err: &'a str) -> Box<dyn Error> {
|
||||
From::from(String::from(err))
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "cow_box_error", since = "1.22.0")]
|
||||
impl<'a, 'b> From<Cow<'b, str>> for Box<Error + Send + Sync + 'a> {
|
||||
fn from(err: Cow<'b, str>) -> Box<Error + Send + Sync + 'a> {
|
||||
impl<'a, 'b> From<Cow<'b, str>> for Box<dyn Error + Send + Sync + 'a> {
|
||||
fn from(err: Cow<'b, str>) -> Box<dyn Error + Send + Sync + 'a> {
|
||||
From::from(String::from(err))
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "cow_box_error", since = "1.22.0")]
|
||||
impl<'a> From<Cow<'a, str>> for Box<Error> {
|
||||
fn from(err: Cow<'a, str>) -> Box<Error> {
|
||||
impl<'a> From<Cow<'a, str>> for Box<dyn Error> {
|
||||
fn from(err: Cow<'a, str>) -> Box<dyn Error> {
|
||||
From::from(String::from(err))
|
||||
}
|
||||
}
|
||||
@ -327,7 +327,7 @@ impl<T: Error> Error for Box<T> {
|
||||
Error::description(&**self)
|
||||
}
|
||||
|
||||
fn cause(&self) -> Option<&Error> {
|
||||
fn cause(&self) -> Option<&dyn Error> {
|
||||
Error::cause(&**self)
|
||||
}
|
||||
}
|
||||
@ -368,7 +368,7 @@ impl Error for char::ParseCharError {
|
||||
}
|
||||
|
||||
// copied from any.rs
|
||||
impl Error + 'static {
|
||||
impl dyn Error + 'static {
|
||||
/// Returns true if the boxed type is the same as `T`
|
||||
#[stable(feature = "error_downcast", since = "1.3.0")]
|
||||
#[inline]
|
||||
@ -390,7 +390,7 @@ impl Error + 'static {
|
||||
pub fn downcast_ref<T: Error + 'static>(&self) -> Option<&T> {
|
||||
if self.is::<T>() {
|
||||
unsafe {
|
||||
Some(&*(self as *const Error as *const T))
|
||||
Some(&*(self as *const dyn Error as *const T))
|
||||
}
|
||||
} else {
|
||||
None
|
||||
@ -404,7 +404,7 @@ impl Error + 'static {
|
||||
pub fn downcast_mut<T: Error + 'static>(&mut self) -> Option<&mut T> {
|
||||
if self.is::<T>() {
|
||||
unsafe {
|
||||
Some(&mut *(self as *mut Error as *mut T))
|
||||
Some(&mut *(self as *mut dyn Error as *mut T))
|
||||
}
|
||||
} else {
|
||||
None
|
||||
@ -412,60 +412,60 @@ impl Error + 'static {
|
||||
}
|
||||
}
|
||||
|
||||
impl Error + 'static + Send {
|
||||
impl dyn Error + 'static + Send {
|
||||
/// Forwards to the method defined on the type `Any`.
|
||||
#[stable(feature = "error_downcast", since = "1.3.0")]
|
||||
#[inline]
|
||||
pub fn is<T: Error + 'static>(&self) -> bool {
|
||||
<Error + 'static>::is::<T>(self)
|
||||
<dyn Error + 'static>::is::<T>(self)
|
||||
}
|
||||
|
||||
/// Forwards to the method defined on the type `Any`.
|
||||
#[stable(feature = "error_downcast", since = "1.3.0")]
|
||||
#[inline]
|
||||
pub fn downcast_ref<T: Error + 'static>(&self) -> Option<&T> {
|
||||
<Error + 'static>::downcast_ref::<T>(self)
|
||||
<dyn Error + 'static>::downcast_ref::<T>(self)
|
||||
}
|
||||
|
||||
/// Forwards to the method defined on the type `Any`.
|
||||
#[stable(feature = "error_downcast", since = "1.3.0")]
|
||||
#[inline]
|
||||
pub fn downcast_mut<T: Error + 'static>(&mut self) -> Option<&mut T> {
|
||||
<Error + 'static>::downcast_mut::<T>(self)
|
||||
<dyn Error + 'static>::downcast_mut::<T>(self)
|
||||
}
|
||||
}
|
||||
|
||||
impl Error + 'static + Send + Sync {
|
||||
impl dyn Error + 'static + Send + Sync {
|
||||
/// Forwards to the method defined on the type `Any`.
|
||||
#[stable(feature = "error_downcast", since = "1.3.0")]
|
||||
#[inline]
|
||||
pub fn is<T: Error + 'static>(&self) -> bool {
|
||||
<Error + 'static>::is::<T>(self)
|
||||
<dyn Error + 'static>::is::<T>(self)
|
||||
}
|
||||
|
||||
/// Forwards to the method defined on the type `Any`.
|
||||
#[stable(feature = "error_downcast", since = "1.3.0")]
|
||||
#[inline]
|
||||
pub fn downcast_ref<T: Error + 'static>(&self) -> Option<&T> {
|
||||
<Error + 'static>::downcast_ref::<T>(self)
|
||||
<dyn Error + 'static>::downcast_ref::<T>(self)
|
||||
}
|
||||
|
||||
/// Forwards to the method defined on the type `Any`.
|
||||
#[stable(feature = "error_downcast", since = "1.3.0")]
|
||||
#[inline]
|
||||
pub fn downcast_mut<T: Error + 'static>(&mut self) -> Option<&mut T> {
|
||||
<Error + 'static>::downcast_mut::<T>(self)
|
||||
<dyn Error + 'static>::downcast_mut::<T>(self)
|
||||
}
|
||||
}
|
||||
|
||||
impl Error {
|
||||
impl dyn Error {
|
||||
#[inline]
|
||||
#[stable(feature = "error_downcast", since = "1.3.0")]
|
||||
/// Attempt to downcast the box to a concrete type.
|
||||
pub fn downcast<T: Error + 'static>(self: Box<Self>) -> Result<Box<T>, Box<Error>> {
|
||||
pub fn downcast<T: Error + 'static>(self: Box<Self>) -> Result<Box<T>, Box<dyn Error>> {
|
||||
if self.is::<T>() {
|
||||
unsafe {
|
||||
let raw: *mut Error = Box::into_raw(self);
|
||||
let raw: *mut dyn Error = Box::into_raw(self);
|
||||
Ok(Box::from_raw(raw as *mut T))
|
||||
}
|
||||
} else {
|
||||
@ -474,30 +474,30 @@ impl Error {
|
||||
}
|
||||
}
|
||||
|
||||
impl Error + Send {
|
||||
impl dyn Error + Send {
|
||||
#[inline]
|
||||
#[stable(feature = "error_downcast", since = "1.3.0")]
|
||||
/// Attempt to downcast the box to a concrete type.
|
||||
pub fn downcast<T: Error + 'static>(self: Box<Self>)
|
||||
-> Result<Box<T>, Box<Error + Send>> {
|
||||
let err: Box<Error> = self;
|
||||
<Error>::downcast(err).map_err(|s| unsafe {
|
||||
-> Result<Box<T>, Box<dyn Error + Send>> {
|
||||
let err: Box<dyn Error> = self;
|
||||
<dyn Error>::downcast(err).map_err(|s| unsafe {
|
||||
// reapply the Send marker
|
||||
transmute::<Box<Error>, Box<Error + Send>>(s)
|
||||
transmute::<Box<dyn Error>, Box<dyn Error + Send>>(s)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl Error + Send + Sync {
|
||||
impl dyn Error + Send + Sync {
|
||||
#[inline]
|
||||
#[stable(feature = "error_downcast", since = "1.3.0")]
|
||||
/// Attempt to downcast the box to a concrete type.
|
||||
pub fn downcast<T: Error + 'static>(self: Box<Self>)
|
||||
-> Result<Box<T>, Box<Self>> {
|
||||
let err: Box<Error> = self;
|
||||
<Error>::downcast(err).map_err(|s| unsafe {
|
||||
let err: Box<dyn Error> = self;
|
||||
<dyn Error>::downcast(err).map_err(|s| unsafe {
|
||||
// reapply the Send+Sync marker
|
||||
transmute::<Box<Error>, Box<Error + Send + Sync>>(s)
|
||||
transmute::<Box<dyn Error>, Box<dyn Error + Send + Sync>>(s)
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -533,13 +533,13 @@ mod tests {
|
||||
#[test]
|
||||
fn downcasting() {
|
||||
let mut a = A;
|
||||
let a = &mut a as &mut (Error + 'static);
|
||||
let a = &mut a as &mut (dyn Error + 'static);
|
||||
assert_eq!(a.downcast_ref::<A>(), Some(&A));
|
||||
assert_eq!(a.downcast_ref::<B>(), None);
|
||||
assert_eq!(a.downcast_mut::<A>(), Some(&mut A));
|
||||
assert_eq!(a.downcast_mut::<B>(), None);
|
||||
|
||||
let a: Box<Error> = Box::new(A);
|
||||
let a: Box<dyn Error> = Box::new(A);
|
||||
match a.downcast::<B>() {
|
||||
Ok(..) => panic!("expected error"),
|
||||
Err(e) => assert_eq!(*e.downcast::<A>().unwrap(), A),
|
||||
|
@ -891,7 +891,7 @@ impl Error for IntoStringError {
|
||||
"C string contained non-utf8 bytes"
|
||||
}
|
||||
|
||||
fn cause(&self) -> Option<&Error> {
|
||||
fn cause(&self) -> Option<&dyn Error> {
|
||||
Some(&self.error)
|
||||
}
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ enum Repr {
|
||||
#[derive(Debug)]
|
||||
struct Custom {
|
||||
kind: ErrorKind,
|
||||
error: Box<error::Error+Send+Sync>,
|
||||
error: Box<dyn error::Error+Send+Sync>,
|
||||
}
|
||||
|
||||
/// A list specifying general categories of I/O error.
|
||||
@ -250,12 +250,12 @@ impl Error {
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn new<E>(kind: ErrorKind, error: E) -> Error
|
||||
where E: Into<Box<error::Error+Send+Sync>>
|
||||
where E: Into<Box<dyn error::Error+Send+Sync>>
|
||||
{
|
||||
Self::_new(kind, error.into())
|
||||
}
|
||||
|
||||
fn _new(kind: ErrorKind, error: Box<error::Error+Send+Sync>) -> Error {
|
||||
fn _new(kind: ErrorKind, error: Box<dyn error::Error+Send+Sync>) -> Error {
|
||||
Error {
|
||||
repr: Repr::Custom(Box::new(Custom {
|
||||
kind,
|
||||
@ -373,7 +373,7 @@ impl Error {
|
||||
/// }
|
||||
/// ```
|
||||
#[stable(feature = "io_error_inner", since = "1.3.0")]
|
||||
pub fn get_ref(&self) -> Option<&(error::Error+Send+Sync+'static)> {
|
||||
pub fn get_ref(&self) -> Option<&(dyn error::Error+Send+Sync+'static)> {
|
||||
match self.repr {
|
||||
Repr::Os(..) => None,
|
||||
Repr::Simple(..) => None,
|
||||
@ -444,7 +444,7 @@ impl Error {
|
||||
/// }
|
||||
/// ```
|
||||
#[stable(feature = "io_error_inner", since = "1.3.0")]
|
||||
pub fn get_mut(&mut self) -> Option<&mut (error::Error+Send+Sync+'static)> {
|
||||
pub fn get_mut(&mut self) -> Option<&mut (dyn error::Error+Send+Sync+'static)> {
|
||||
match self.repr {
|
||||
Repr::Os(..) => None,
|
||||
Repr::Simple(..) => None,
|
||||
@ -478,7 +478,7 @@ impl Error {
|
||||
/// }
|
||||
/// ```
|
||||
#[stable(feature = "io_error_inner", since = "1.3.0")]
|
||||
pub fn into_inner(self) -> Option<Box<error::Error+Send+Sync>> {
|
||||
pub fn into_inner(self) -> Option<Box<dyn error::Error+Send+Sync>> {
|
||||
match self.repr {
|
||||
Repr::Os(..) => None,
|
||||
Repr::Simple(..) => None,
|
||||
@ -551,7 +551,7 @@ impl error::Error for Error {
|
||||
}
|
||||
}
|
||||
|
||||
fn cause(&self) -> Option<&error::Error> {
|
||||
fn cause(&self) -> Option<&dyn error::Error> {
|
||||
match self.repr {
|
||||
Repr::Os(..) => None,
|
||||
Repr::Simple(..) => None,
|
||||
|
@ -1972,7 +1972,7 @@ impl<T: BufRead> BufRead for Take<T> {
|
||||
}
|
||||
}
|
||||
|
||||
fn read_one_byte(reader: &mut Read) -> Option<Result<u8>> {
|
||||
fn read_one_byte(reader: &mut dyn Read) -> Option<Result<u8>> {
|
||||
let mut buf = [0];
|
||||
loop {
|
||||
return match reader.read(&mut buf) {
|
||||
@ -2081,7 +2081,7 @@ impl std_error::Error for CharsError {
|
||||
CharsError::Other(ref e) => std_error::Error::description(e),
|
||||
}
|
||||
}
|
||||
fn cause(&self) -> Option<&std_error::Error> {
|
||||
fn cause(&self) -> Option<&dyn std_error::Error> {
|
||||
match *self {
|
||||
CharsError::NotUtf8 => None,
|
||||
CharsError::Other(ref e) => e.cause(),
|
||||
|
@ -21,7 +21,7 @@ use thread::LocalKey;
|
||||
|
||||
/// Stdout used by print! and println! macros
|
||||
thread_local! {
|
||||
static LOCAL_STDOUT: RefCell<Option<Box<Write + Send>>> = {
|
||||
static LOCAL_STDOUT: RefCell<Option<Box<dyn Write + Send>>> = {
|
||||
RefCell::new(None)
|
||||
}
|
||||
}
|
||||
@ -624,7 +624,7 @@ impl<'a> fmt::Debug for StderrLock<'a> {
|
||||
with a more general mechanism",
|
||||
issue = "0")]
|
||||
#[doc(hidden)]
|
||||
pub fn set_panic(sink: Option<Box<Write + Send>>) -> Option<Box<Write + Send>> {
|
||||
pub fn set_panic(sink: Option<Box<dyn Write + Send>>) -> Option<Box<dyn Write + Send>> {
|
||||
use panicking::LOCAL_STDERR;
|
||||
use mem;
|
||||
LOCAL_STDERR.with(move |slot| {
|
||||
@ -648,7 +648,7 @@ pub fn set_panic(sink: Option<Box<Write + Send>>) -> Option<Box<Write + Send>> {
|
||||
with a more general mechanism",
|
||||
issue = "0")]
|
||||
#[doc(hidden)]
|
||||
pub fn set_print(sink: Option<Box<Write + Send>>) -> Option<Box<Write + Send>> {
|
||||
pub fn set_print(sink: Option<Box<dyn Write + Send>>) -> Option<Box<dyn Write + Send>> {
|
||||
use mem;
|
||||
LOCAL_STDOUT.with(move |slot| {
|
||||
mem::replace(&mut *slot.borrow_mut(), sink)
|
||||
@ -670,7 +670,7 @@ pub fn set_print(sink: Option<Box<Write + Send>>) -> Option<Box<Write + Send>> {
|
||||
/// However, if the actual I/O causes an error, this function does panic.
|
||||
fn print_to<T>(
|
||||
args: fmt::Arguments,
|
||||
local_s: &'static LocalKey<RefCell<Option<Box<Write+Send>>>>,
|
||||
local_s: &'static LocalKey<RefCell<Option<Box<dyn Write+Send>>>>,
|
||||
global_s: fn() -> T,
|
||||
label: &str,
|
||||
)
|
||||
|
@ -223,7 +223,7 @@ mod tests {
|
||||
assert_eq!(copy(&mut r, &mut w).unwrap(), 4);
|
||||
|
||||
let mut r = repeat(0).take(1 << 17);
|
||||
assert_eq!(copy(&mut r as &mut Read, &mut w as &mut Write).unwrap(), 1 << 17);
|
||||
assert_eq!(copy(&mut r as &mut dyn Read, &mut w as &mut dyn Write).unwrap(), 1 << 17);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -58,7 +58,7 @@ impl<'a> Parser<'a> {
|
||||
}
|
||||
|
||||
// Return result of first successful parser
|
||||
fn read_or<T>(&mut self, parsers: &mut [Box<FnMut(&mut Parser) -> Option<T> + 'static>])
|
||||
fn read_or<T>(&mut self, parsers: &mut [Box<dyn FnMut(&mut Parser) -> Option<T> + 'static>])
|
||||
-> Option<T> {
|
||||
for pf in parsers {
|
||||
if let Some(r) = self.read_atomically(|p: &mut Parser| pf(p)) {
|
||||
|
@ -927,7 +927,7 @@ mod tests {
|
||||
use time::{Instant, Duration};
|
||||
use thread;
|
||||
|
||||
fn each_ip(f: &mut FnMut(SocketAddr)) {
|
||||
fn each_ip(f: &mut dyn FnMut(SocketAddr)) {
|
||||
f(next_test_ip4());
|
||||
f(next_test_ip6());
|
||||
}
|
||||
|
@ -826,7 +826,7 @@ mod tests {
|
||||
use time::{Instant, Duration};
|
||||
use thread;
|
||||
|
||||
fn each_ip(f: &mut FnMut(SocketAddr, SocketAddr)) {
|
||||
fn each_ip(f: &mut dyn FnMut(SocketAddr, SocketAddr)) {
|
||||
f(next_test_ip4(), next_test_ip4());
|
||||
f(next_test_ip6(), next_test_ip6());
|
||||
}
|
||||
|
@ -421,6 +421,6 @@ pub fn catch_unwind<F: FnOnce() -> R + UnwindSafe, R>(f: F) -> Result<R> {
|
||||
/// }
|
||||
/// ```
|
||||
#[stable(feature = "resume_unwind", since = "1.9.0")]
|
||||
pub fn resume_unwind(payload: Box<Any + Send>) -> ! {
|
||||
pub fn resume_unwind(payload: Box<dyn Any + Send>) -> ! {
|
||||
panicking::update_count_then_panic(payload)
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ use sys_common::util;
|
||||
use thread;
|
||||
|
||||
thread_local! {
|
||||
pub static LOCAL_STDERR: RefCell<Option<Box<Write + Send>>> = {
|
||||
pub static LOCAL_STDERR: RefCell<Option<Box<dyn Write + Send>>> = {
|
||||
RefCell::new(None)
|
||||
}
|
||||
}
|
||||
@ -64,7 +64,7 @@ extern {
|
||||
#[derive(Copy, Clone)]
|
||||
enum Hook {
|
||||
Default,
|
||||
Custom(*mut (Fn(&PanicInfo) + 'static + Sync + Send)),
|
||||
Custom(*mut (dyn Fn(&PanicInfo) + 'static + Sync + Send)),
|
||||
}
|
||||
|
||||
static HOOK_LOCK: RWLock = RWLock::new();
|
||||
@ -104,7 +104,7 @@ static mut HOOK: Hook = Hook::Default;
|
||||
/// panic!("Normal panic");
|
||||
/// ```
|
||||
#[stable(feature = "panic_hooks", since = "1.10.0")]
|
||||
pub fn set_hook(hook: Box<Fn(&PanicInfo) + 'static + Sync + Send>) {
|
||||
pub fn set_hook(hook: Box<dyn Fn(&PanicInfo) + 'static + Sync + Send>) {
|
||||
if thread::panicking() {
|
||||
panic!("cannot modify the panic hook from a panicking thread");
|
||||
}
|
||||
@ -149,7 +149,7 @@ pub fn set_hook(hook: Box<Fn(&PanicInfo) + 'static + Sync + Send>) {
|
||||
/// panic!("Normal panic");
|
||||
/// ```
|
||||
#[stable(feature = "panic_hooks", since = "1.10.0")]
|
||||
pub fn take_hook() -> Box<Fn(&PanicInfo) + 'static + Sync + Send> {
|
||||
pub fn take_hook() -> Box<dyn Fn(&PanicInfo) + 'static + Sync + Send> {
|
||||
if thread::panicking() {
|
||||
panic!("cannot modify the panic hook from a panicking thread");
|
||||
}
|
||||
@ -197,7 +197,7 @@ fn default_hook(info: &PanicInfo) {
|
||||
let thread = thread_info::current_thread();
|
||||
let name = thread.as_ref().and_then(|t| t.name()).unwrap_or("<unnamed>");
|
||||
|
||||
let write = |err: &mut ::io::Write| {
|
||||
let write = |err: &mut dyn (::io::Write)| {
|
||||
let _ = writeln!(err, "thread '{}' panicked at '{}', {}",
|
||||
name, msg, location);
|
||||
|
||||
@ -248,7 +248,7 @@ pub fn update_panic_count(amt: isize) -> usize {
|
||||
pub use realstd::rt::update_panic_count;
|
||||
|
||||
/// Invoke a closure, capturing the cause of an unwinding panic if one occurs.
|
||||
pub unsafe fn try<R, F: FnOnce() -> R>(f: F) -> Result<R, Box<Any + Send>> {
|
||||
pub unsafe fn try<R, F: FnOnce() -> R>(f: F) -> Result<R, Box<dyn Any + Send>> {
|
||||
#[allow(unions_with_drop_fields)]
|
||||
union Data<F, R> {
|
||||
f: F,
|
||||
@ -369,12 +369,12 @@ fn continue_panic_fmt(info: &PanicInfo) -> ! {
|
||||
}
|
||||
|
||||
unsafe impl<'a> BoxMeUp for PanicPayload<'a> {
|
||||
fn box_me_up(&mut self) -> *mut (Any + Send) {
|
||||
fn box_me_up(&mut self) -> *mut (dyn Any + Send) {
|
||||
let contents = mem::replace(self.fill(), String::new());
|
||||
Box::into_raw(Box::new(contents))
|
||||
}
|
||||
|
||||
fn get(&mut self) -> &(Any + Send) {
|
||||
fn get(&mut self) -> &(dyn Any + Send) {
|
||||
self.fill()
|
||||
}
|
||||
}
|
||||
@ -419,15 +419,15 @@ pub fn begin_panic<M: Any + Send>(msg: M, file_line_col: &(&'static str, u32, u3
|
||||
}
|
||||
|
||||
unsafe impl<A: Send + 'static> BoxMeUp for PanicPayload<A> {
|
||||
fn box_me_up(&mut self) -> *mut (Any + Send) {
|
||||
fn box_me_up(&mut self) -> *mut (dyn Any + Send) {
|
||||
let data = match self.inner.take() {
|
||||
Some(a) => Box::new(a) as Box<Any + Send>,
|
||||
Some(a) => Box::new(a) as Box<dyn Any + Send>,
|
||||
None => Box::new(()),
|
||||
};
|
||||
Box::into_raw(data)
|
||||
}
|
||||
|
||||
fn get(&mut self) -> &(Any + Send) {
|
||||
fn get(&mut self) -> &(dyn Any + Send) {
|
||||
match self.inner {
|
||||
Some(ref a) => a,
|
||||
None => &(),
|
||||
@ -441,7 +441,7 @@ pub fn begin_panic<M: Any + Send>(msg: M, file_line_col: &(&'static str, u32, u3
|
||||
/// Executes the primary logic for a panic, including checking for recursive
|
||||
/// panics, panic hooks, and finally dispatching to the panic runtime to either
|
||||
/// abort or unwind.
|
||||
fn rust_panic_with_hook(payload: &mut BoxMeUp,
|
||||
fn rust_panic_with_hook(payload: &mut dyn BoxMeUp,
|
||||
message: Option<&fmt::Arguments>,
|
||||
file_line_col: &(&str, u32, u32)) -> ! {
|
||||
let (file, line, col) = *file_line_col;
|
||||
@ -496,17 +496,17 @@ fn rust_panic_with_hook(payload: &mut BoxMeUp,
|
||||
}
|
||||
|
||||
/// Shim around rust_panic. Called by resume_unwind.
|
||||
pub fn update_count_then_panic(msg: Box<Any + Send>) -> ! {
|
||||
pub fn update_count_then_panic(msg: Box<dyn Any + Send>) -> ! {
|
||||
update_panic_count(1);
|
||||
|
||||
struct RewrapBox(Box<Any + Send>);
|
||||
struct RewrapBox(Box<dyn Any + Send>);
|
||||
|
||||
unsafe impl BoxMeUp for RewrapBox {
|
||||
fn box_me_up(&mut self) -> *mut (Any + Send) {
|
||||
fn box_me_up(&mut self) -> *mut (dyn Any + Send) {
|
||||
Box::into_raw(mem::replace(&mut self.0, Box::new(())))
|
||||
}
|
||||
|
||||
fn get(&mut self) -> &(Any + Send) {
|
||||
fn get(&mut self) -> &(dyn Any + Send) {
|
||||
&*self.0
|
||||
}
|
||||
}
|
||||
@ -517,9 +517,9 @@ pub fn update_count_then_panic(msg: Box<Any + Send>) -> ! {
|
||||
/// A private no-mangle function on which to slap yer breakpoints.
|
||||
#[no_mangle]
|
||||
#[allow(private_no_mangle_fns)] // yes we get it, but we like breakpoints
|
||||
pub fn rust_panic(mut msg: &mut BoxMeUp) -> ! {
|
||||
pub fn rust_panic(mut msg: &mut dyn BoxMeUp) -> ! {
|
||||
let code = unsafe {
|
||||
let obj = &mut msg as *mut &mut BoxMeUp;
|
||||
let obj = &mut msg as *mut &mut dyn BoxMeUp;
|
||||
__rust_start_panic(obj as usize)
|
||||
};
|
||||
rtabort!("failed to initiate panic, error {}", code)
|
||||
|
@ -813,13 +813,13 @@ impl fmt::Debug for Output {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
|
||||
let stdout_utf8 = str::from_utf8(&self.stdout);
|
||||
let stdout_debug: &fmt::Debug = match stdout_utf8 {
|
||||
let stdout_debug: &dyn fmt::Debug = match stdout_utf8 {
|
||||
Ok(ref str) => str,
|
||||
Err(_) => &self.stdout
|
||||
};
|
||||
|
||||
let stderr_utf8 = str::from_utf8(&self.stderr);
|
||||
let stderr_debug: &fmt::Debug = match stderr_utf8 {
|
||||
let stderr_debug: &dyn fmt::Debug = match stderr_utf8 {
|
||||
Ok(ref str) => str,
|
||||
Err(_) => &self.stderr
|
||||
};
|
||||
|
@ -29,7 +29,7 @@ pub use panicking::{begin_panic, begin_panic_fmt, update_panic_count};
|
||||
// To reduce the generated code of the new `lang_start`, this function is doing
|
||||
// the real work.
|
||||
#[cfg(not(test))]
|
||||
fn lang_start_internal(main: &(Fn() -> i32 + Sync + ::panic::RefUnwindSafe),
|
||||
fn lang_start_internal(main: &(dyn Fn() -> i32 + Sync + ::panic::RefUnwindSafe),
|
||||
argc: isize, argv: *const *const u8) -> isize {
|
||||
use panic;
|
||||
use sys;
|
||||
|
@ -1638,7 +1638,7 @@ impl<T: Send> error::Error for SendError<T> {
|
||||
"sending on a closed channel"
|
||||
}
|
||||
|
||||
fn cause(&self) -> Option<&error::Error> {
|
||||
fn cause(&self) -> Option<&dyn error::Error> {
|
||||
None
|
||||
}
|
||||
}
|
||||
@ -1681,7 +1681,7 @@ impl<T: Send> error::Error for TrySendError<T> {
|
||||
}
|
||||
}
|
||||
|
||||
fn cause(&self) -> Option<&error::Error> {
|
||||
fn cause(&self) -> Option<&dyn error::Error> {
|
||||
None
|
||||
}
|
||||
}
|
||||
@ -1709,7 +1709,7 @@ impl error::Error for RecvError {
|
||||
"receiving on a closed channel"
|
||||
}
|
||||
|
||||
fn cause(&self) -> Option<&error::Error> {
|
||||
fn cause(&self) -> Option<&dyn error::Error> {
|
||||
None
|
||||
}
|
||||
}
|
||||
@ -1742,7 +1742,7 @@ impl error::Error for TryRecvError {
|
||||
}
|
||||
}
|
||||
|
||||
fn cause(&self) -> Option<&error::Error> {
|
||||
fn cause(&self) -> Option<&dyn error::Error> {
|
||||
None
|
||||
}
|
||||
}
|
||||
@ -1783,7 +1783,7 @@ impl error::Error for RecvTimeoutError {
|
||||
}
|
||||
}
|
||||
|
||||
fn cause(&self) -> Option<&error::Error> {
|
||||
fn cause(&self) -> Option<&dyn error::Error> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ pub struct Handle<'rx, T:Send+'rx> {
|
||||
next: *mut Handle<'static, ()>,
|
||||
prev: *mut Handle<'static, ()>,
|
||||
added: bool,
|
||||
packet: &'rx (Packet+'rx),
|
||||
packet: &'rx (dyn Packet+'rx),
|
||||
|
||||
// due to our fun transmutes, we be sure to place this at the end. (nothing
|
||||
// previous relies on T)
|
||||
|
@ -309,7 +309,7 @@ impl Once {
|
||||
#[cold]
|
||||
fn call_inner(&self,
|
||||
ignore_poisoning: bool,
|
||||
init: &mut FnMut(bool)) {
|
||||
init: &mut dyn FnMut(bool)) {
|
||||
let mut state = self.state.load(Ordering::SeqCst);
|
||||
|
||||
'outer: loop {
|
||||
|
@ -32,7 +32,7 @@ unsafe impl Send for Thread {}
|
||||
unsafe impl Sync for Thread {}
|
||||
|
||||
impl Thread {
|
||||
pub unsafe fn new<'a>(stack: usize, p: Box<FnBox() + 'a>) -> io::Result<Thread> {
|
||||
pub unsafe fn new<'a>(stack: usize, p: Box<dyn FnBox() + 'a>) -> io::Result<Thread> {
|
||||
let p = box p;
|
||||
let mut native: libc::pthread_t = mem::zeroed();
|
||||
let mut attr: libc::pthread_attr_t = mem::zeroed();
|
||||
|
@ -51,7 +51,7 @@ pub struct Command {
|
||||
uid: Option<u32>,
|
||||
gid: Option<u32>,
|
||||
saw_nul: bool,
|
||||
closures: Vec<Box<FnMut() -> io::Result<()> + Send + Sync>>,
|
||||
closures: Vec<Box<dyn FnMut() -> io::Result<()> + Send + Sync>>,
|
||||
stdin: Option<Stdio>,
|
||||
stdout: Option<Stdio>,
|
||||
stderr: Option<Stdio>,
|
||||
@ -122,7 +122,7 @@ impl Command {
|
||||
}
|
||||
|
||||
pub fn before_exec(&mut self,
|
||||
f: Box<FnMut() -> io::Result<()> + Send + Sync>) {
|
||||
f: Box<dyn FnMut() -> io::Result<()> + Send + Sync>) {
|
||||
self.closures.push(f);
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ unsafe impl Send for Thread {}
|
||||
unsafe impl Sync for Thread {}
|
||||
|
||||
impl Thread {
|
||||
pub unsafe fn new<'a>(_stack: usize, p: Box<FnBox() + 'a>) -> io::Result<Thread> {
|
||||
pub unsafe fn new<'a>(_stack: usize, p: Box<dyn FnBox() + 'a>) -> io::Result<Thread> {
|
||||
let p = box p;
|
||||
|
||||
let id = cvt(syscall::clone(syscall::CLONE_VM | syscall::CLONE_FS | syscall::CLONE_FILES))?;
|
||||
|
@ -52,7 +52,7 @@ pub struct Command {
|
||||
uid: Option<uid_t>,
|
||||
gid: Option<gid_t>,
|
||||
saw_nul: bool,
|
||||
closures: Vec<Box<FnMut() -> io::Result<()> + Send + Sync>>,
|
||||
closures: Vec<Box<dyn FnMut() -> io::Result<()> + Send + Sync>>,
|
||||
stdin: Option<Stdio>,
|
||||
stdout: Option<Stdio>,
|
||||
stderr: Option<Stdio>,
|
||||
@ -155,12 +155,12 @@ impl Command {
|
||||
self.gid
|
||||
}
|
||||
|
||||
pub fn get_closures(&mut self) -> &mut Vec<Box<FnMut() -> io::Result<()> + Send + Sync>> {
|
||||
pub fn get_closures(&mut self) -> &mut Vec<Box<dyn FnMut() -> io::Result<()> + Send + Sync>> {
|
||||
&mut self.closures
|
||||
}
|
||||
|
||||
pub fn before_exec(&mut self,
|
||||
f: Box<FnMut() -> io::Result<()> + Send + Sync>) {
|
||||
f: Box<dyn FnMut() -> io::Result<()> + Send + Sync>) {
|
||||
self.closures.push(f);
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ unsafe fn pthread_attr_setstacksize(_attr: *mut libc::pthread_attr_t,
|
||||
}
|
||||
|
||||
impl Thread {
|
||||
pub unsafe fn new<'a>(stack: usize, p: Box<FnBox() + 'a>)
|
||||
pub unsafe fn new<'a>(stack: usize, p: Box<dyn FnBox() + 'a>)
|
||||
-> io::Result<Thread> {
|
||||
let p = box p;
|
||||
let mut native: libc::pthread_t = mem::zeroed();
|
||||
|
@ -19,7 +19,7 @@ pub struct Thread(Void);
|
||||
pub const DEFAULT_MIN_STACK_SIZE: usize = 4096;
|
||||
|
||||
impl Thread {
|
||||
pub unsafe fn new<'a>(_stack: usize, _p: Box<FnBox() + 'a>)
|
||||
pub unsafe fn new<'a>(_stack: usize, _p: Box<dyn FnBox() + 'a>)
|
||||
-> io::Result<Thread>
|
||||
{
|
||||
unsupported()
|
||||
|
@ -28,7 +28,7 @@ pub struct Thread {
|
||||
}
|
||||
|
||||
impl Thread {
|
||||
pub unsafe fn new<'a>(stack: usize, p: Box<FnBox() + 'a>)
|
||||
pub unsafe fn new<'a>(stack: usize, p: Box<dyn FnBox() + 'a>)
|
||||
-> io::Result<Thread> {
|
||||
let p = box p;
|
||||
|
||||
|
@ -17,7 +17,7 @@ use ptr;
|
||||
use mem;
|
||||
use sys_common::mutex::Mutex;
|
||||
|
||||
type Queue = Vec<Box<FnBox()>>;
|
||||
type Queue = Vec<Box<dyn FnBox()>>;
|
||||
|
||||
// NB these are specifically not types from `std::sync` as they currently rely
|
||||
// on poisoning and this module needs to operate at a lower level than requiring
|
||||
@ -68,7 +68,7 @@ pub fn cleanup() {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn push(f: Box<FnBox()>) -> bool {
|
||||
pub fn push(f: Box<dyn FnBox()>) -> bool {
|
||||
unsafe {
|
||||
let _guard = LOCK.lock();
|
||||
if init() {
|
||||
|
@ -49,7 +49,7 @@ pub struct Frame {
|
||||
const MAX_NB_FRAMES: usize = 100;
|
||||
|
||||
/// Prints the current backtrace.
|
||||
pub fn print(w: &mut Write, format: PrintFormat) -> io::Result<()> {
|
||||
pub fn print(w: &mut dyn Write, format: PrintFormat) -> io::Result<()> {
|
||||
static LOCK: Mutex = Mutex::new();
|
||||
|
||||
// Use a lock to prevent mixed output in multithreading context.
|
||||
@ -62,7 +62,7 @@ pub fn print(w: &mut Write, format: PrintFormat) -> io::Result<()> {
|
||||
}
|
||||
}
|
||||
|
||||
fn _print(w: &mut Write, format: PrintFormat) -> io::Result<()> {
|
||||
fn _print(w: &mut dyn Write, format: PrintFormat) -> io::Result<()> {
|
||||
let mut frames = [Frame {
|
||||
exact_position: ptr::null(),
|
||||
symbol_addr: ptr::null(),
|
||||
@ -176,7 +176,7 @@ pub fn log_enabled() -> Option<PrintFormat> {
|
||||
///
|
||||
/// These output functions should now be used everywhere to ensure consistency.
|
||||
/// You may want to also use `output_fileline`.
|
||||
fn output(w: &mut Write, idx: usize, frame: Frame,
|
||||
fn output(w: &mut dyn Write, idx: usize, frame: Frame,
|
||||
s: Option<&str>, format: PrintFormat) -> io::Result<()> {
|
||||
// Remove the `17: 0x0 - <unknown>` line.
|
||||
if format == PrintFormat::Short && frame.exact_position == ptr::null() {
|
||||
@ -201,7 +201,7 @@ fn output(w: &mut Write, idx: usize, frame: Frame,
|
||||
///
|
||||
/// See also `output`.
|
||||
#[allow(dead_code)]
|
||||
fn output_fileline(w: &mut Write,
|
||||
fn output_fileline(w: &mut dyn Write,
|
||||
file: &[u8],
|
||||
line: u32,
|
||||
format: PrintFormat) -> io::Result<()> {
|
||||
@ -253,7 +253,7 @@ fn output_fileline(w: &mut Write,
|
||||
// Note that this demangler isn't quite as fancy as it could be. We have lots
|
||||
// of other information in our symbols like hashes, version, type information,
|
||||
// etc. Additionally, this doesn't handle glue symbols at all.
|
||||
pub fn demangle(writer: &mut Write, mut s: &str, format: PrintFormat) -> io::Result<()> {
|
||||
pub fn demangle(writer: &mut dyn Write, mut s: &str, format: PrintFormat) -> io::Result<()> {
|
||||
// During ThinLTO LLVM may import and rename internal symbols, so strip out
|
||||
// those endings first as they're one of the last manglings applied to
|
||||
// symbol names.
|
||||
|
@ -251,7 +251,7 @@ impl<T> Error for TryLockError<T> {
|
||||
}
|
||||
}
|
||||
|
||||
fn cause(&self) -> Option<&Error> {
|
||||
fn cause(&self) -> Option<&dyn Error> {
|
||||
match *self {
|
||||
TryLockError::Poisoned(ref p) => Some(p),
|
||||
_ => None
|
||||
|
@ -21,7 +21,7 @@ pub unsafe fn start_thread(main: *mut u8) {
|
||||
let _handler = stack_overflow::Handler::new();
|
||||
|
||||
// Finally, let's run some code.
|
||||
Box::from_raw(main as *mut Box<FnBox()>)()
|
||||
Box::from_raw(main as *mut Box<dyn FnBox()>)()
|
||||
}
|
||||
|
||||
pub fn min_stack() -> usize {
|
||||
|
@ -1175,7 +1175,7 @@ impl fmt::Debug for Thread {
|
||||
///
|
||||
/// [`Result`]: ../../std/result/enum.Result.html
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub type Result<T> = ::result::Result<T, Box<Any + Send + 'static>>;
|
||||
pub type Result<T> = ::result::Result<T, Box<dyn Any + Send + 'static>>;
|
||||
|
||||
// This packet is used to communicate the return value between the child thread
|
||||
// and the parent thread. Memory is shared through the `Arc` within and there's
|
||||
@ -1438,7 +1438,7 @@ mod tests {
|
||||
rx.recv().unwrap();
|
||||
}
|
||||
|
||||
fn avoid_copying_the_body<F>(spawnfn: F) where F: FnOnce(Box<Fn() + Send>) {
|
||||
fn avoid_copying_the_body<F>(spawnfn: F) where F: FnOnce(Box<dyn Fn() + Send>) {
|
||||
let (tx, rx) = channel();
|
||||
|
||||
let x: Box<_> = box 1;
|
||||
@ -1485,7 +1485,7 @@ mod tests {
|
||||
// (well, it would if the constant were 8000+ - I lowered it to be more
|
||||
// valgrind-friendly. try this at home, instead..!)
|
||||
const GENERATIONS: u32 = 16;
|
||||
fn child_no(x: u32) -> Box<Fn() + Send> {
|
||||
fn child_no(x: u32) -> Box<dyn Fn() + Send> {
|
||||
return Box::new(move|| {
|
||||
if x < GENERATIONS {
|
||||
thread::spawn(move|| child_no(x+1)());
|
||||
@ -1531,10 +1531,10 @@ mod tests {
|
||||
#[test]
|
||||
fn test_try_panic_message_any() {
|
||||
match thread::spawn(move|| {
|
||||
panic!(box 413u16 as Box<Any + Send>);
|
||||
panic!(box 413u16 as Box<dyn Any + Send>);
|
||||
}).join() {
|
||||
Err(e) => {
|
||||
type T = Box<Any + Send>;
|
||||
type T = Box<dyn Any + Send>;
|
||||
assert!(e.is::<T>());
|
||||
let any = e.downcast::<T>().unwrap();
|
||||
assert!(any.is::<u16>());
|
||||
|
@ -14,8 +14,6 @@
|
||||
//!
|
||||
//! This API is completely unstable and subject to change.
|
||||
|
||||
#![deny(bare_trait_objects)]
|
||||
|
||||
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
||||
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
|
||||
html_root_url = "https://doc.rust-lang.org/nightly/",
|
||||
|
@ -10,8 +10,6 @@
|
||||
|
||||
//! Syntax extensions in the Rust compiler.
|
||||
|
||||
#![deny(bare_trait_objects)]
|
||||
|
||||
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
||||
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
|
||||
html_root_url = "https://doc.rust-lang.org/nightly/")]
|
||||
|
@ -14,8 +14,6 @@
|
||||
//!
|
||||
//! This API is completely unstable and subject to change.
|
||||
|
||||
#![deny(bare_trait_objects)]
|
||||
|
||||
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
||||
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
|
||||
html_root_url = "https://doc.rust-lang.org/nightly/")]
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user