提交 254f8796 编写于 作者: B bors

Auto merge of #52352 - kennytm:rollup, r=kennytm

Rollup of 17 pull requests

Successful merges:

 - #51962 (Provide llvm-strip in llvm-tools component)
 - #52003 (Implement `Option::replace` in the core library)
 - #52156 (Update std::ascii::ASCIIExt deprecation notes)
 - #52280 (llvm-tools-preview: fix build-manifest)
 - #52290 (Deny bare trait objects in src/librustc_save_analysis)
 - #52293 (Deny bare trait objects in librustc_typeck)
 - #52299 (Deny bare trait objects in src/libserialize)
 - #52300 (Deny bare trait objects in librustc_target and libtest)
 - #52302 (Deny bare trait objects in the rest of rust)
 - #52310 (Backport 1.27.1 release notes to master)
 - #52315 (Resolve FIXME(#27942))
 - #52316 (task: remove wrong comments about non-existent LocalWake trait)
 - #52322 (Update llvm-rebuild-trigger in light of LLVM 7 upgrade)
 - #52330 (Don't silently ignore invalid data in target spec)
 - #52333 (CI: Enable core dump on Linux, and print their stack trace on segfault. )
 - #52346 (Fix typo in improper_ctypes suggestion)
 - #52350 (Bump bootstrap compiler to 1.28.0-beta.10)

Failed merges:

r? @ghost
......@@ -3,6 +3,10 @@ sudo: required
dist: trusty
services:
- docker
addons:
apt:
packages:
- gdb
git:
depth: 2
......@@ -249,6 +253,8 @@ before_script:
export RUN_SCRIPT="$RUN_SCRIPT && src/ci/run.sh";
else
export RUN_SCRIPT="$RUN_SCRIPT && src/ci/docker/run.sh $IMAGE";
# Enable core dump on Linux.
sudo sh -c 'echo "/checkout/obj/cores/core.%p.%E" > /proc/sys/kernel/core_pattern';
fi
# Log time information from this machine and an external machine for insight into possible
......@@ -274,6 +280,8 @@ after_failure:
# Random attempt at debugging currently. Just poking around in here to see if
# anything shows up.
# Dump backtrace for macOS
- ls -lat $HOME/Library/Logs/DiagnosticReports/
- find $HOME/Library/Logs/DiagnosticReports
-type f
......@@ -284,8 +292,24 @@ after_failure:
-exec head -750 {} \;
-exec echo travis_fold":"end:crashlog \; || true
# Dump backtrace for Linux
- ln -s . checkout &&
for CORE in obj/cores/core.*; do
EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|');
if [ -f "$EXE" ]; then
printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE";
gdb -q -c "$CORE" "$EXE"
-iex 'set auto-load off'
-iex 'dir src/'
-iex 'set sysroot .'
-ex bt
-ex q;
echo travis_fold":"end:crashlog;
fi;
done || true
# see #50887
- head -30 ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
- cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
# attempt to debug anything killed by the oom killer on linux, just to see if
# it happened
......
......@@ -140,6 +140,29 @@ Compatibility Notes
[`{Any + Send + Sync}::downcast_ref`]: https://doc.rust-lang.org/std/any/trait.Any.html#method.downcast_ref-2
[`{Any + Send + Sync}::is`]: https://doc.rust-lang.org/std/any/trait.Any.html#method.is-2
Version 1.27.1 (2018-07-10)
===========================
Security Notes
--------------
- rustdoc would execute plugins in the /tmp/rustdoc/plugins directory
when running, which enabled executing code as some other user on a
given machine. This release fixes that vulnerability; you can read
more about this on the [blog][rustdoc-sec]. The associated CVE is [CVE-2018-1000622].
Thank you to Red Hat for responsibily disclosing this vulnerability to us.
Compatibility Notes
-------------------
- The borrow checker was fixed to avoid an additional potential unsoundness when using
match ergonomics: [#51415][51415], [#49534][49534].
[51415]: https://github.com/rust-lang/rust/issues/51415
[49534]: https://github.com/rust-lang/rust/issues/49534
[rustdoc-sec]: https://blog.rust-lang.org/2018/07/06/security-advisory-for-rustdoc.html
[CVE-2018-1000622]: https://cve.mitre.org/cgi-bin/cvename.cgi?name=%20CVE-2018-1000622
Version 1.27.0 (2018-06-21)
==========================
......
......@@ -206,7 +206,8 @@ pub unsafe fn setup(_build: &mut ::Build) {
"llvm-objcopy", // used to transform ELFs into binary format which flashing tools consume
"llvm-objdump", // used to disassemble programs
"llvm-profdata", // used to inspect and merge files generated by profiles
"llvm-size", // prints the size of the linker sections of a program
"llvm-size", // used to prints the size of the linker sections of a program
"llvm-strip", // used to discard symbols from binary files to reduce their size
];
/// A structure representing a Rust compiler.
......
......@@ -8,6 +8,8 @@
// 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};
......
......@@ -99,6 +99,7 @@ objdir=$root_dir/obj
mkdir -p $HOME/.cargo
mkdir -p $objdir/tmp
mkdir $objdir/cores
args=
if [ "$SCCACHE_BUCKET" != "" ]; then
......
......@@ -24,6 +24,11 @@ if [ "$NO_CHANGE_USER" = "" ]; then
fi
fi
# only enable core dump on Linux
if [ -f /proc/sys/kernel/core_pattern ]; then
ulimit -c unlimited
fi
ci_dir=`cd $(dirname $0) && pwd`
source "$ci_dir/shared.sh"
......
......@@ -10,6 +10,7 @@
#![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,6 +10,7 @@
#![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,6 +30,7 @@
#![cfg_attr(test, feature(test))]
#![allow(deprecated)]
#![deny(bare_trait_objects)]
extern crate alloc;
extern crate rustc_data_structures;
......
......@@ -845,6 +845,33 @@ pub fn get_or_insert_with<F: FnOnce() -> T>(&mut self, f: F) -> &mut T {
pub fn take(&mut self) -> Option<T> {
mem::replace(self, None)
}
/// Replaces the actual value in the option by the value given in parameter,
/// returning the old value if present,
/// leaving a [`Some`] in its place without deinitializing either one.
///
/// [`Some`]: #variant.Some
///
/// # Examples
///
/// ```
/// #![feature(option_replace)]
///
/// let mut x = Some(2);
/// let old = x.replace(5);
/// assert_eq!(x, Some(5));
/// assert_eq!(old, Some(2));
///
/// let mut x = None;
/// let old = x.replace(3);
/// assert_eq!(x, Some(3));
/// assert_eq!(old, None);
/// ```
#[inline]
#[unstable(feature = "option_replace", issue = "51998")]
pub fn replace(&mut self, value: T) -> Option<T> {
mem::replace(self, Some(value))
}
}
impl<'a, T: Clone> Option<&'a T> {
......
......@@ -113,8 +113,8 @@ impl LocalWaker {
/// but you otherwise shouldn't call it directly.
///
/// If you're working with the standard library then it's recommended to
/// use the `LocalWaker::from` function instead which works with the safe
/// `Rc` type and the safe `LocalWake` trait.
/// use the `local_waker_from_nonlocal` or `local_waker` to convert a `Waker`
/// into a `LocalWaker`.
///
/// For this function to be used safely, it must be sound to call `inner.wake_local()`
/// on the current thread.
......@@ -197,9 +197,7 @@ fn drop(&mut self) {
/// customization.
///
/// When using `std`, a default implementation of the `UnsafeWake` trait is provided for
/// `Arc<T>` where `T: Wake` and `Rc<T>` where `T: LocalWake`.
///
/// Although the methods on `UnsafeWake` take pointers rather than references,
/// `Arc<T>` where `T: Wake`.
pub unsafe trait UnsafeWake: Send + Sync {
/// Creates a clone of this `UnsafeWake` and stores it behind a `Waker`.
///
......
......@@ -44,6 +44,7 @@
#![feature(reverse_bits)]
#![feature(iterator_find_map)]
#![feature(slice_internals)]
#![feature(option_replace)]
extern crate core;
extern crate test;
......
......@@ -297,3 +297,18 @@ fn try_option_err() -> Result<u8, NoneError> {
}
assert_eq!(try_option_err(), Err(NoneError));
}
#[test]
fn test_replace() {
let mut x = Some(2);
let old = x.replace(5);
assert_eq!(x, Some(5));
assert_eq!(old, Some(2));
let mut x = None;
let old = x.replace(3);
assert_eq!(x, Some(3));
assert_eq!(old, None);
}
......@@ -14,6 +14,8 @@
//! 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,6 +283,8 @@
//!
//! * [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,6 +21,7 @@
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,6 +22,7 @@
//! 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,4 +15,5 @@
reason = "internal implementation detail of rustc right now",
issue = "0")]
#![allow(unused_features)]
#![deny(bare_trait_objects)]
#![feature(staged_api)]
......@@ -193,32 +193,12 @@ fn msg_span_from_early_bound_and_free_regions(
let scope = region.free_region_binding_scope(self);
let node = self.hir.as_local_node_id(scope).unwrap_or(DUMMY_NODE_ID);
let unknown;
let tag = match self.hir.find(node) {
Some(hir_map::NodeBlock(_)) | Some(hir_map::NodeExpr(_)) => "body",
Some(hir_map::NodeItem(it)) => Self::item_scope_tag(&it),
Some(hir_map::NodeTraitItem(it)) => Self::trait_item_scope_tag(&it),
Some(hir_map::NodeImplItem(it)) => Self::impl_item_scope_tag(&it),
// this really should not happen, but it does:
// FIXME(#27942)
Some(_) => {
unknown = format!(
"unexpected node ({}) for scope {:?}. \
Please report a bug.",
self.hir.node_to_string(node),
scope
);
&unknown
}
None => {
unknown = format!(
"unknown node for scope {:?}. \
Please report a bug.",
scope
);
&unknown
}
_ => unreachable!()
};
let (prefix, span) = match *region {
ty::ReEarlyBound(ref br) => {
......
......@@ -40,6 +40,8 @@
//!
//! 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,6 +8,8 @@
// 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,6 +13,7 @@
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![allow(non_camel_case_types)]
#![deny(bare_trait_objects)]
#![feature(from_ref)]
#![feature(quote)]
......
......@@ -10,6 +10,8 @@
//! 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,6 +19,8 @@
//!
//! 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/")]
......
......@@ -673,7 +673,7 @@ fn check_type_for_ffi(&self,
return FfiUnsafe {
ty: ty,
reason: "this function pointer has Rust-specific calling convention",
help: Some("consider using an `fn \"extern\"(...) -> ...` \
help: Some("consider using an `extern fn(...) -> ...` \
function pointer instead"),
}
}
......
......@@ -12,6 +12,7 @@
#![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,6 +8,8 @@
// 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,6 +14,8 @@
*/
#![deny(bare_trait_objects)]
#![feature(slice_patterns)]
#![feature(slice_sort_by_cached_key)]
#![feature(from_ref)]
......
......@@ -8,6 +8,8 @@
// 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,6 +14,8 @@
//!
//! 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,6 +9,7 @@
// except according to those terms.
#![allow(bad_style)]
#![deny(bare_trait_objects)]
pub struct Intrinsic {
pub inputs: &'static [&'static Type],
......
......@@ -60,6 +60,8 @@
//! 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,6 +8,8 @@
// 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/")]
......
......@@ -46,7 +46,7 @@ fn dump(&mut self, result: &Analysis) {
}
pub struct CallbackOutput<'b> {
callback: &'b mut FnMut(&Analysis),
callback: &'b mut dyn FnMut(&Analysis),
}
impl<'b> DumpOutput for CallbackOutput<'b> {
......@@ -67,7 +67,7 @@ pub fn new(writer: &'b mut W, config: Config) -> JsonDumper<WriteOutput<'b, W>>
impl<'b> JsonDumper<CallbackOutput<'b>> {
pub fn with_callback(
callback: &'b mut FnMut(&Analysis),
callback: &'b mut dyn FnMut(&Analysis),
config: Config,
) -> JsonDumper<CallbackOutput<'b>> {
JsonDumper {
......
......@@ -13,6 +13,7 @@
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![feature(custom_attribute)]
#![allow(unused_attributes)]
#![deny(bare_trait_objects)]
#![recursion_limit="256"]
......@@ -1088,7 +1089,7 @@ fn save<'l, 'tcx>(
/// Call a callback with the results of save-analysis.
pub struct CallbackHandler<'b> {
pub callback: &'b mut FnMut(&rls_data::Analysis),
pub callback: &'b mut dyn FnMut(&rls_data::Analysis),
}
impl<'b> SaveHandler for CallbackHandler<'b> {
......
......@@ -21,6 +21,8 @@
//! 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/")]
......
......@@ -229,7 +229,7 @@ fn load_specific(target: &str) -> TargetResult {
}
}
pub fn get_targets() -> Box<Iterator<Item=String>> {
pub fn get_targets() -> Box<dyn Iterator<Item=String>> {
Box::new(TARGETS.iter().filter_map(|t| -> Option<String> {
load_specific(t)
.and(Ok(t.to_string()))
......@@ -861,23 +861,27 @@ pub fn from_json(obj: Json) -> TargetResult {
} );
($key_name:ident, link_args) => ( {
let name = (stringify!($key_name)).replace("_", "-");
if let Some(obj) = obj.find(&name[..]).and_then(|o| o.as_object()) {
if let Some(val) = obj.find(&name[..]) {
let obj = val.as_object().ok_or_else(|| format!("{}: expected a \
JSON object with fields per linker-flavor.", name))?;
let mut args = LinkArgs::new();
for (k, v) in obj {
let k = LinkerFlavor::from_str(&k).ok_or_else(|| {
let flavor = LinkerFlavor::from_str(&k).ok_or_else(|| {
format!("{}: '{}' is not a valid value for linker-flavor. \
Use 'em', 'gcc', 'ld' or 'msvc'", name, k)
})?;
let v = v.as_array().map(|a| {
a
.iter()
.filter_map(|o| o.as_string())
.map(|s| s.to_owned())
.collect::<Vec<_>>()
}).unwrap_or(vec![]);
args.insert(k, v);
let v = v.as_array().ok_or_else(||
format!("{}.{}: expected a JSON array", name, k)
)?.iter().enumerate()
.map(|(i,s)| {
let s = s.as_string().ok_or_else(||
format!("{}.{}[{}]: expected a JSON string", name, k, i))?;
Ok(s.to_owned())
})
.collect::<Result<Vec<_>, String>>()?;
args.insert(flavor, v);
}
base.options.$key_name = args;
}
......
......@@ -11,6 +11,8 @@
//! 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,6 +8,8 @@
// 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)]
......
......@@ -98,7 +98,7 @@ struct ParamRange {
/// This type must not appear anywhere in other converted types.
const TRAIT_OBJECT_DUMMY_SELF: ty::TypeVariants<'static> = ty::TyInfer(ty::FreshTy(0));
impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
pub fn ast_region_to_region(&self,
lifetime: &hir::Lifetime,
def: Option<&ty::GenericParamDef>)
......
......@@ -604,7 +604,7 @@ fn check_supplied_sig_against_expectation(
/// If there is no expected signature, then we will convert the
/// types that the user gave into a signature.
fn supplied_sig_of_closure(&self, decl: &hir::FnDecl) -> ty::PolyFnSig<'tcx> {
let astconv: &AstConv = self;
let astconv: &dyn AstConv = self;
// First, convert the types that the user supplied (if any).
let supplied_arguments = decl.inputs.iter().map(|a| astconv.ast_ty_to_ty(a));
......@@ -630,7 +630,7 @@ fn supplied_sig_of_closure(&self, decl: &hir::FnDecl) -> ty::PolyFnSig<'tcx> {
/// so should yield an error, but returns back a signature where
/// all parameters are of type `TyErr`.
fn error_sig_of_closure(&self, decl: &hir::FnDecl) -> ty::PolyFnSig<'tcx> {
let astconv: &AstConv = self;
let astconv: &dyn AstConv = self;
let supplied_arguments = decl.inputs.iter().map(|a| {
// Convert the types that the user supplied (if any), but ignore them.
......
......@@ -1071,7 +1071,7 @@ pub fn coerce<'a>(&mut self,
pub fn coerce_forced_unit<'a>(&mut self,
fcx: &FnCtxt<'a, 'gcx, 'tcx>,
cause: &ObligationCause<'tcx>,
augment_error: &mut FnMut(&mut DiagnosticBuilder),
augment_error: &mut dyn FnMut(&mut DiagnosticBuilder),
label_unit_as_expected: bool)
{
self.coerce_inner(fcx,
......@@ -1090,7 +1090,7 @@ fn coerce_inner<'a>(&mut self,
cause: &ObligationCause<'tcx>,
expression: Option<&'gcx hir::Expr>,
mut expression_ty: Ty<'tcx>,
augment_error: Option<&mut FnMut(&mut DiagnosticBuilder)>,
augment_error: Option<&mut dyn FnMut(&mut DiagnosticBuilder)>,
label_expression_as_expected: bool)
{
// Incorporate whatever type inference information we have
......
......@@ -526,7 +526,7 @@ fn visit_fru_field_types(&mut self) {
}
}
fn resolve<T>(&self, x: &T, span: &Locatable) -> T::Lifted
fn resolve<T>(&self, x: &T, span: &dyn Locatable) -> T::Lifted
where
T: TypeFoldable<'tcx> + ty::Lift<'gcx>,
{
......@@ -580,14 +580,14 @@ fn to_span(&self, tcx: &TyCtxt) -> Span {
struct Resolver<'cx, 'gcx: 'cx + 'tcx, 'tcx: 'cx> {
tcx: TyCtxt<'cx, 'gcx, 'tcx>,
infcx: &'cx InferCtxt<'cx, 'gcx, 'tcx>,
span: &'cx Locatable,
span: &'cx dyn Locatable,
body: &'gcx hir::Body,
}
impl<'cx, 'gcx, 'tcx> Resolver<'cx, 'gcx, 'tcx> {
fn new(
fcx: &'cx FnCtxt<'cx, 'gcx, 'tcx>,
span: &'cx Locatable,
span: &'cx dyn Locatable,
body: &'gcx hir::Body,
) -> Resolver<'cx, 'gcx, 'tcx> {
Resolver {
......
......@@ -212,7 +212,7 @@ pub fn coerce_unsized_info<'a, 'gcx>(gcx: TyCtxt<'a, 'gcx, 'gcx>,
let cause = ObligationCause::misc(span, impl_node_id);
let check_mutbl = |mt_a: ty::TypeAndMut<'gcx>,
mt_b: ty::TypeAndMut<'gcx>,
mk_ptr: &Fn(Ty<'gcx>) -> Ty<'gcx>| {
mk_ptr: &dyn Fn(Ty<'gcx>) -> Ty<'gcx>| {
if (mt_a.mutbl, mt_b.mutbl) == (hir::MutImmutable, hir::MutMutable) {
infcx.report_mismatched_types(&cause,
mk_ptr(mt_b.ty),
......
......@@ -1244,7 +1244,7 @@ fn impl_polarity<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
}
// Is it marked with ?Sized
fn is_unsized<'gcx: 'tcx, 'tcx>(astconv: &AstConv<'gcx, 'tcx>,
fn is_unsized<'gcx: 'tcx, 'tcx>(astconv: &dyn AstConv<'gcx, 'tcx>,
ast_bounds: &[hir::GenericBound],
span: Span) -> bool
{
......@@ -1598,7 +1598,7 @@ pub enum SizedByDefault { Yes, No, }
/// Translate the AST's notion of ty param bounds (which are an enum consisting of a newtyped Ty or
/// a region) to ty's notion of ty param bounds, which can either be user-defined traits, or the
/// built-in trait (formerly known as kind): Send.
pub fn compute_bounds<'gcx: 'tcx, 'tcx>(astconv: &AstConv<'gcx, 'tcx>,
pub fn compute_bounds<'gcx: 'tcx, 'tcx>(astconv: &dyn AstConv<'gcx, 'tcx>,
param_ty: Ty<'tcx>,
ast_bounds: &[hir::GenericBound],
sized_by_default: SizedByDefault,
......@@ -1646,7 +1646,7 @@ pub fn compute_bounds<'gcx: 'tcx, 'tcx>(astconv: &AstConv<'gcx, 'tcx>,
/// because this can be anywhere from 0 predicates (`T:?Sized` adds no
/// predicates) to 1 (`T:Foo`) to many (`T:Bar<X=i32>` adds `T:Bar`
/// and `<T as Bar>::X == i32`).
fn predicates_from_bound<'tcx>(astconv: &AstConv<'tcx, 'tcx>,
fn predicates_from_bound<'tcx>(astconv: &dyn AstConv<'tcx, 'tcx>,
param_ty: Ty<'tcx>,
bound: &hir::GenericBound)
-> Vec<ty::Predicate<'tcx>>
......
......@@ -2338,7 +2338,7 @@ fn main() {
```compile_fail,E0225
fn main() {
let _: Box<std::io::Read + std::io::Write>;
let _: Box<dyn std::io::Read + std::io::Write>;
}
```
......@@ -2348,7 +2348,7 @@ fn main() {
```
fn main() {
let _: Box<std::io::Read + Send + Sync>;
let _: Box<dyn std::io::Read + Send + Sync>;
}
```
"##,
......
......@@ -70,6 +70,7 @@
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![allow(non_camel_case_types)]
#![deny(bare_trait_objects)]
#![feature(box_patterns)]
#![feature(box_syntax)]
......
......@@ -371,7 +371,7 @@ fn from(err: fmt::Error) -> EncoderError { EncoderError::FmtError(err) }
pub type EncodeResult = Result<(), EncoderError>;
pub type DecodeResult<T> = Result<T, DecoderError>;
fn escape_str(wr: &mut fmt::Write, v: &str) -> EncodeResult {
fn escape_str(wr: &mut dyn fmt::Write, v: &str) -> EncodeResult {
wr.write_str("\"")?;
let mut start = 0;
......@@ -433,11 +433,11 @@ fn escape_str(wr: &mut fmt::Write, v: &str) -> EncodeResult {
Ok(())
}
fn escape_char(writer: &mut fmt::Write, v: char) -> EncodeResult {
fn escape_char(writer: &mut dyn fmt::Write, v: char) -> EncodeResult {
escape_str(writer, v.encode_utf8(&mut [0; 4]))
}
fn spaces(wr: &mut fmt::Write, mut n: usize) -> EncodeResult {
fn spaces(wr: &mut dyn fmt::Write, mut n: usize) -> EncodeResult {
const BUF: &'static str = " ";
while n >= BUF.len() {
......@@ -461,14 +461,14 @@ fn fmt_number_or_null(v: f64) -> string::String {
/// A structure for implementing serialization to JSON.
pub struct Encoder<'a> {
writer: &'a mut (fmt::Write+'a),
writer: &'a mut (dyn fmt::Write+'a),
is_emitting_map_key: bool,
}
impl<'a> Encoder<'a> {
/// Creates a new JSON encoder whose output will be written to the writer
/// specified.
pub fn new(writer: &'a mut fmt::Write) -> Encoder<'a> {
pub fn new(writer: &'a mut dyn fmt::Write) -> Encoder<'a> {
Encoder { writer: writer, is_emitting_map_key: false, }
}
}
......@@ -707,7 +707,7 @@ fn emit_map_elt_val<F>(&mut self, _idx: usize, f: F) -> EncodeResult where
/// Another encoder for JSON, but prints out human-readable JSON instead of
/// compact data
pub struct PrettyEncoder<'a> {
writer: &'a mut (fmt::Write+'a),
writer: &'a mut (dyn fmt::Write+'a),
curr_indent: usize,
indent: usize,
is_emitting_map_key: bool,
......@@ -715,7 +715,7 @@ pub struct PrettyEncoder<'a> {
impl<'a> PrettyEncoder<'a> {
/// Creates a new encoder whose output will be written to the specified writer
pub fn new(writer: &'a mut fmt::Write) -> PrettyEncoder<'a> {
pub fn new(writer: &'a mut dyn fmt::Write) -> PrettyEncoder<'a> {
PrettyEncoder {
writer,
curr_indent: 0,
......@@ -2053,7 +2053,7 @@ fn build_object(&mut self) -> Result<Json, BuilderError> {
}
/// Decodes a json value from an `&mut io::Read`
pub fn from_reader(rdr: &mut Read) -> Result<Json, BuilderError> {
pub fn from_reader(rdr: &mut dyn Read) -> Result<Json, BuilderError> {
let mut contents = Vec::new();
match rdr.read_to_end(&mut contents) {
Ok(c) => c,
......
......@@ -14,6 +14,8 @@
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/",
......
......@@ -163,7 +163,9 @@ pub trait AsciiExt {
/// # Note
///
/// This method will be deprecated in favor of the identically-named
/// inherent methods on `u8`, `char`, `[u8]` and `str`.
/// inherent methods on `u8` and `char`.
/// For `[u8]` use `.iter().all(u8::is_ascii_alphabetic)`.
/// For `str` use `.bytes().all(u8::is_ascii_alphabetic)`.
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[rustc_deprecated(since = "1.26.0", reason = "use inherent methods instead")]
fn is_ascii_alphabetic(&self) -> bool { unimplemented!(); }
......@@ -176,7 +178,9 @@ pub trait AsciiExt {
/// # Note
///
/// This method will be deprecated in favor of the identically-named
/// inherent methods on `u8`, `char`, `[u8]` and `str`.
/// inherent methods on `u8` and `char`.
/// For `[u8]` use `.iter().all(u8::is_ascii_uppercase)`.
/// For `str` use `.bytes().all(u8::is_ascii_uppercase)`.
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[rustc_deprecated(since = "1.26.0", reason = "use inherent methods instead")]
fn is_ascii_uppercase(&self) -> bool { unimplemented!(); }
......@@ -189,7 +193,9 @@ pub trait AsciiExt {
/// # Note
///
/// This method will be deprecated in favor of the identically-named
/// inherent methods on `u8`, `char`, `[u8]` and `str`.
/// inherent methods on `u8` and `char`.
/// For `[u8]` use `.iter().all(u8::is_ascii_lowercase)`.
/// For `str` use `.bytes().all(u8::is_ascii_lowercase)`.
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[rustc_deprecated(since = "1.26.0", reason = "use inherent methods instead")]
fn is_ascii_lowercase(&self) -> bool { unimplemented!(); }
......@@ -203,7 +209,9 @@ pub trait AsciiExt {
/// # Note
///
/// This method will be deprecated in favor of the identically-named
/// inherent methods on `u8`, `char`, `[u8]` and `str`.
/// inherent methods on `u8` and `char`.
/// For `[u8]` use `.iter().all(u8::is_ascii_alphanumeric)`.
/// For `str` use `.bytes().all(u8::is_ascii_alphanumeric)`.
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[rustc_deprecated(since = "1.26.0", reason = "use inherent methods instead")]
fn is_ascii_alphanumeric(&self) -> bool { unimplemented!(); }
......@@ -216,7 +224,9 @@ pub trait AsciiExt {
/// # Note
///
/// This method will be deprecated in favor of the identically-named
/// inherent methods on `u8`, `char`, `[u8]` and `str`.
/// inherent methods on `u8` and `char`.
/// For `[u8]` use `.iter().all(u8::is_ascii_digit)`.
/// For `str` use `.bytes().all(u8::is_ascii_digit)`.
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[rustc_deprecated(since = "1.26.0", reason = "use inherent methods instead")]
fn is_ascii_digit(&self) -> bool { unimplemented!(); }
......@@ -230,7 +240,9 @@ pub trait AsciiExt {
/// # Note
///
/// This method will be deprecated in favor of the identically-named
/// inherent methods on `u8`, `char`, `[u8]` and `str`.
/// inherent methods on `u8` and `char`.
/// For `[u8]` use `.iter().all(u8::is_ascii_hexdigit)`.
/// For `str` use `.bytes().all(u8::is_ascii_hexdigit)`.
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[rustc_deprecated(since = "1.26.0", reason = "use inherent methods instead")]
fn is_ascii_hexdigit(&self) -> bool { unimplemented!(); }
......@@ -248,7 +260,9 @@ pub trait AsciiExt {
/// # Note
///
/// This method will be deprecated in favor of the identically-named
/// inherent methods on `u8`, `char`, `[u8]` and `str`.
/// inherent methods on `u8` and `char`.
/// For `[u8]` use `.iter().all(u8::is_ascii_punctuation)`.
/// For `str` use `.bytes().all(u8::is_ascii_punctuation)`.
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[rustc_deprecated(since = "1.26.0", reason = "use inherent methods instead")]
fn is_ascii_punctuation(&self) -> bool { unimplemented!(); }
......@@ -261,7 +275,9 @@ pub trait AsciiExt {
/// # Note
///
/// This method will be deprecated in favor of the identically-named
/// inherent methods on `u8`, `char`, `[u8]` and `str`.
/// inherent methods on `u8` and `char`.
/// For `[u8]` use `.iter().all(u8::is_ascii_graphic)`.
/// For `str` use `.bytes().all(u8::is_ascii_graphic)`.
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[rustc_deprecated(since = "1.26.0", reason = "use inherent methods instead")]
fn is_ascii_graphic(&self) -> bool { unimplemented!(); }
......@@ -291,7 +307,9 @@ pub trait AsciiExt {
/// # Note
///
/// This method will be deprecated in favor of the identically-named
/// inherent methods on `u8`, `char`, `[u8]` and `str`.
/// inherent methods on `u8` and `char`.
/// For `[u8]` use `.iter().all(u8::is_ascii_whitespace)`.
/// For `str` use `.bytes().all(u8::is_ascii_whitespace)`.
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[rustc_deprecated(since = "1.26.0", reason = "use inherent methods instead")]
fn is_ascii_whitespace(&self) -> bool { unimplemented!(); }
......@@ -304,7 +322,9 @@ pub trait AsciiExt {
/// # Note
///
/// This method will be deprecated in favor of the identically-named
/// inherent methods on `u8`, `char`, `[u8]` and `str`.
/// inherent methods on `u8` and `char`.
/// For `[u8]` use `.iter().all(u8::is_ascii_control)`.
/// For `str` use `.bytes().all(u8::is_ascii_control)`.
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[rustc_deprecated(since = "1.26.0", reason = "use inherent methods instead")]
fn is_ascii_control(&self) -> bool { unimplemented!(); }
......
......@@ -14,6 +14,8 @@
//!
//! 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/")]
......
......@@ -26,6 +26,9 @@
// NB: this is also specified in this crate's Cargo.toml, but libsyntax contains logic specific to
// this crate, which relies on this attribute (rather than the value of `--crate-name` passed by
// cargo) to detect this crate.
#![deny(bare_trait_objects)]
#![crate_name = "test"]
#![unstable(feature = "test", issue = "27812")]
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
......@@ -165,8 +168,8 @@ pub trait TDynBenchFn: Send {
pub enum TestFn {
StaticTestFn(fn()),
StaticBenchFn(fn(&mut Bencher)),
DynTestFn(Box<FnBox() + Send>),
DynBenchFn(Box<TDynBenchFn + 'static>),
DynTestFn(Box<dyn FnBox() + Send>),
DynBenchFn(Box<dyn TDynBenchFn + 'static>),
}
impl TestFn {
......@@ -840,7 +843,7 @@ pub fn run_tests_console(opts: &TestOpts, tests: Vec<TestDescAndFn>) -> io::Resu
fn callback(
event: &TestEvent,
st: &mut ConsoleTestState,
out: &mut OutputFormatter,
out: &mut dyn OutputFormatter,
) -> io::Result<()> {
match (*event).clone() {
TeFiltered(ref filtered_tests) => {
......@@ -897,7 +900,7 @@ fn callback(
let is_multithreaded = opts.test_threads.unwrap_or_else(get_concurrency) > 1;
let mut out: Box<OutputFormatter> = match opts.format {
let mut out: Box<dyn OutputFormatter> = match opts.format {
OutputFormat::Pretty => Box::new(PrettyFormatter::new(
output,
use_color(opts),
......@@ -1386,7 +1389,7 @@ fn run_test_inner(
desc: TestDesc,
monitor_ch: Sender<MonitorMsg>,
nocapture: bool,
testfn: Box<FnBox() + Send>,
testfn: Box<dyn FnBox() + Send>,
) {
// Buffer for capturing standard I/O
let data = Arc::new(Mutex::new(Vec::new()));
......@@ -1459,7 +1462,7 @@ fn __rust_begin_short_backtrace<F: FnOnce()>(f: F) {
f()
}
fn calc_result(desc: &TestDesc, task_result: Result<(), Box<Any + Send>>) -> TestResult {
fn calc_result(desc: &TestDesc, task_result: Result<(), Box<dyn Any + Send>>) -> TestResult {
match (&desc.should_panic, task_result) {
(&ShouldPanic::No, Ok(())) | (&ShouldPanic::Yes, Err(_)) => TrOk,
(&ShouldPanic::YesWithMessage(msg), Err(ref err)) => {
......
......@@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![deny(bare_trait_objects)]
#![no_std]
#![unstable(feature = "panic_unwind", issue = "32837")]
......
# If this file is modified, then llvm will be (optionally) cleaned and then rebuilt.
# The actual contents of this file do not matter, but to trigger a change on the
# build bots then the contents should be changed so git updates the mtime.
2018-05-18
\ No newline at end of file
2018-07-12
\ No newline at end of file
......@@ -12,7 +12,7 @@
# source tarball for a stable release you'll likely see `1.x.0` for rustc and
# `0.x.0` for Cargo where they were released on `date`.
date: 2018-06-30
date: 2018-07-13
rustc: beta
cargo: beta
......
{
"pre-link-args": ["-m64"],
"pre-link-args": {"gcc": ["-m64"]},
"data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128",
"linker-flavor": "gcc",
"llvm-target": "x86_64-unknown-linux-gnu",
......
......@@ -126,7 +126,7 @@ error: `extern` block uses type `fn()` which is not FFI-safe: this function poin
LL | pub fn fn_type(p: RustFn); //~ ERROR function pointer has Rust-specific
| ^^^^^^
|
= help: consider using an `fn "extern"(...) -> ...` function pointer instead
= help: consider using an `extern fn(...) -> ...` function pointer instead
error: `extern` block uses type `fn()` which is not FFI-safe: this function pointer has Rust-specific calling convention
--> $DIR/lint-ctypes.rs:70:24
......@@ -134,7 +134,7 @@ error: `extern` block uses type `fn()` which is not FFI-safe: this function poin
LL | pub fn fn_type2(p: fn()); //~ ERROR function pointer has Rust-specific
| ^^^^
|
= help: consider using an `fn "extern"(...) -> ...` function pointer instead
= help: consider using an `extern fn(...) -> ...` function pointer instead
error: `extern` block uses type `std::boxed::Box<u32>` which is not FFI-safe: this struct has unspecified layout
--> $DIR/lint-ctypes.rs:71:28
......
......@@ -492,7 +492,7 @@ fn filename(&self, component: &str, target: &str) -> String {
format!("clippy-{}-{}.tar.gz", self.clippy_release, target)
} else if component == "rustfmt" || component == "rustfmt-preview" {
format!("rustfmt-{}-{}.tar.gz", self.rustfmt_release, target)
} else if component == "llvm_tools" {
} else if component == "llvm-tools" || component == "llvm-tools-preview" {
format!("llvm-tools-{}-{}.tar.gz", self.llvm_tools_release, target)
} else {
format!("{}-{}-{}.tar.gz", component, self.rust_release, target)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册