Auto merge of #46430 - kennytm:rollup, r=kennytm
Rollup of 13 pull requests - Successful merges: #45880, #46280, #46373, #46376, #46385, #46386, #46387, #46392, #46400, #46401, #46405, #46412, #46421 - Failed merges:
This commit is contained in:
commit
70517540da
34 changed files with 220 additions and 50 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -95,7 +95,6 @@ config.stamp
|
||||||
keywords.md
|
keywords.md
|
||||||
lexer.ml
|
lexer.ml
|
||||||
src/etc/dl
|
src/etc/dl
|
||||||
src/librustc_llvm/llvmdeps.rs
|
|
||||||
tmp.*.rs
|
tmp.*.rs
|
||||||
version.md
|
version.md
|
||||||
version.ml
|
version.ml
|
||||||
|
|
1
src/Cargo.lock
generated
1
src/Cargo.lock
generated
|
@ -2014,7 +2014,6 @@ version = "0.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"build_helper 0.1.0",
|
"build_helper 0.1.0",
|
||||||
"cc 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cc 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"html-diff 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"html-diff 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"pulldown-cmark 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"pulldown-cmark 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
|
@ -159,7 +159,7 @@ impl Step for CargoBook {
|
||||||
|
|
||||||
let target = self.target;
|
let target = self.target;
|
||||||
let name = self.name;
|
let name = self.name;
|
||||||
let src = PathBuf::from("src/tools/cargo/src/doc/book");
|
let src = build.src.join("src/tools/cargo/src/doc/book");
|
||||||
|
|
||||||
let out = build.doc_out(target);
|
let out = build.doc_out(target);
|
||||||
t!(fs::create_dir_all(&out));
|
t!(fs::create_dir_all(&out));
|
||||||
|
|
|
@ -316,7 +316,7 @@ impl Step for TestHelpers {
|
||||||
.warnings(false)
|
.warnings(false)
|
||||||
.debug(false)
|
.debug(false)
|
||||||
.file(build.src.join("src/rt/rust_test_helpers.c"))
|
.file(build.src.join("src/rt/rust_test_helpers.c"))
|
||||||
.compile("librust_test_helpers.a");
|
.compile("rust_test_helpers");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -190,6 +190,9 @@ pub fn mtime(path: &Path) -> FileTime {
|
||||||
///
|
///
|
||||||
/// Uses last-modified time checks to verify this.
|
/// Uses last-modified time checks to verify this.
|
||||||
pub fn up_to_date(src: &Path, dst: &Path) -> bool {
|
pub fn up_to_date(src: &Path, dst: &Path) -> bool {
|
||||||
|
if !dst.exists() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
let threshold = mtime(dst);
|
let threshold = mtime(dst);
|
||||||
let meta = match fs::metadata(src) {
|
let meta = match fs::metadata(src) {
|
||||||
Ok(meta) => meta,
|
Ok(meta) => meta,
|
||||||
|
|
|
@ -140,6 +140,6 @@ fn main() {
|
||||||
cc::Build::new()
|
cc::Build::new()
|
||||||
.flag("-fvisibility=hidden")
|
.flag("-fvisibility=hidden")
|
||||||
.file("pthread_atfork_dummy.c")
|
.file("pthread_atfork_dummy.c")
|
||||||
.compile("libpthread_atfork_dummy.a");
|
.compile("pthread_atfork_dummy");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,5 +56,5 @@ fn main() {
|
||||||
cfg.file(Path::new("../libcompiler_builtins/compiler-rt/lib/profile").join(src));
|
cfg.file(Path::new("../libcompiler_builtins/compiler-rt/lib/profile").join(src));
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg.compile("libprofiler-rt.a");
|
cfg.compile("profiler-rt");
|
||||||
}
|
}
|
||||||
|
|
|
@ -222,6 +222,12 @@ declare_lint! {
|
||||||
"detect mut variables which don't need to be mutable"
|
"detect mut variables which don't need to be mutable"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
declare_lint! {
|
||||||
|
pub COERCE_NEVER,
|
||||||
|
Deny,
|
||||||
|
"detect coercion to !"
|
||||||
|
}
|
||||||
|
|
||||||
/// Does nothing as a lint pass, but registers some `Lint`s
|
/// Does nothing as a lint pass, but registers some `Lint`s
|
||||||
/// which are used by other parts of the compiler.
|
/// which are used by other parts of the compiler.
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
|
@ -263,7 +269,8 @@ impl LintPass for HardwiredLints {
|
||||||
LATE_BOUND_LIFETIME_ARGUMENTS,
|
LATE_BOUND_LIFETIME_ARGUMENTS,
|
||||||
DEPRECATED,
|
DEPRECATED,
|
||||||
UNUSED_UNSAFE,
|
UNUSED_UNSAFE,
|
||||||
UNUSED_MUT
|
UNUSED_MUT,
|
||||||
|
COERCE_NEVER
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -282,7 +282,7 @@ pub type SelectionResult<'tcx, T> = Result<Option<T>, SelectionError<'tcx>>;
|
||||||
/// ### The type parameter `N`
|
/// ### The type parameter `N`
|
||||||
///
|
///
|
||||||
/// See explanation on `VtableImplData`.
|
/// See explanation on `VtableImplData`.
|
||||||
#[derive(Clone)]
|
#[derive(Clone, RustcEncodable, RustcDecodable)]
|
||||||
pub enum Vtable<'tcx, N> {
|
pub enum Vtable<'tcx, N> {
|
||||||
/// Vtable identifying a particular impl.
|
/// Vtable identifying a particular impl.
|
||||||
VtableImpl(VtableImplData<'tcx, N>),
|
VtableImpl(VtableImplData<'tcx, N>),
|
||||||
|
@ -327,14 +327,14 @@ pub enum Vtable<'tcx, N> {
|
||||||
/// is `Obligation`, as one might expect. During trans, however, this
|
/// is `Obligation`, as one might expect. During trans, however, this
|
||||||
/// is `()`, because trans only requires a shallow resolution of an
|
/// is `()`, because trans only requires a shallow resolution of an
|
||||||
/// impl, and nested obligations are satisfied later.
|
/// impl, and nested obligations are satisfied later.
|
||||||
#[derive(Clone, PartialEq, Eq)]
|
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable)]
|
||||||
pub struct VtableImplData<'tcx, N> {
|
pub struct VtableImplData<'tcx, N> {
|
||||||
pub impl_def_id: DefId,
|
pub impl_def_id: DefId,
|
||||||
pub substs: &'tcx Substs<'tcx>,
|
pub substs: &'tcx Substs<'tcx>,
|
||||||
pub nested: Vec<N>
|
pub nested: Vec<N>
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Eq)]
|
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable)]
|
||||||
pub struct VtableGeneratorData<'tcx, N> {
|
pub struct VtableGeneratorData<'tcx, N> {
|
||||||
pub closure_def_id: DefId,
|
pub closure_def_id: DefId,
|
||||||
pub substs: ty::ClosureSubsts<'tcx>,
|
pub substs: ty::ClosureSubsts<'tcx>,
|
||||||
|
@ -343,7 +343,7 @@ pub struct VtableGeneratorData<'tcx, N> {
|
||||||
pub nested: Vec<N>
|
pub nested: Vec<N>
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Eq)]
|
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable)]
|
||||||
pub struct VtableClosureData<'tcx, N> {
|
pub struct VtableClosureData<'tcx, N> {
|
||||||
pub closure_def_id: DefId,
|
pub closure_def_id: DefId,
|
||||||
pub substs: ty::ClosureSubsts<'tcx>,
|
pub substs: ty::ClosureSubsts<'tcx>,
|
||||||
|
@ -352,20 +352,20 @@ pub struct VtableClosureData<'tcx, N> {
|
||||||
pub nested: Vec<N>
|
pub nested: Vec<N>
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone, RustcEncodable, RustcDecodable)]
|
||||||
pub struct VtableAutoImplData<N> {
|
pub struct VtableAutoImplData<N> {
|
||||||
pub trait_def_id: DefId,
|
pub trait_def_id: DefId,
|
||||||
pub nested: Vec<N>
|
pub nested: Vec<N>
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone, RustcEncodable, RustcDecodable)]
|
||||||
pub struct VtableBuiltinData<N> {
|
pub struct VtableBuiltinData<N> {
|
||||||
pub nested: Vec<N>
|
pub nested: Vec<N>
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A vtable for some object-safe trait `Foo` automatically derived
|
/// A vtable for some object-safe trait `Foo` automatically derived
|
||||||
/// for the object type `Foo`.
|
/// for the object type `Foo`.
|
||||||
#[derive(PartialEq,Eq,Clone)]
|
#[derive(PartialEq, Eq, Clone, RustcEncodable, RustcDecodable)]
|
||||||
pub struct VtableObjectData<'tcx, N> {
|
pub struct VtableObjectData<'tcx, N> {
|
||||||
/// `Foo` upcast to the obligation trait. This will be some supertrait of `Foo`.
|
/// `Foo` upcast to the obligation trait. This will be some supertrait of `Foo`.
|
||||||
pub upcast_trait_ref: ty::PolyTraitRef<'tcx>,
|
pub upcast_trait_ref: ty::PolyTraitRef<'tcx>,
|
||||||
|
@ -378,7 +378,7 @@ pub struct VtableObjectData<'tcx, N> {
|
||||||
pub nested: Vec<N>,
|
pub nested: Vec<N>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Eq)]
|
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable)]
|
||||||
pub struct VtableFnPointerData<'tcx, N> {
|
pub struct VtableFnPointerData<'tcx, N> {
|
||||||
pub fn_ty: Ty<'tcx>,
|
pub fn_ty: Ty<'tcx>,
|
||||||
pub nested: Vec<N>
|
pub nested: Vec<N>
|
||||||
|
|
|
@ -247,6 +247,10 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) {
|
||||||
id: LintId::of(SAFE_PACKED_BORROWS),
|
id: LintId::of(SAFE_PACKED_BORROWS),
|
||||||
reference: "issue #46043 <https://github.com/rust-lang/rust/issues/46043>",
|
reference: "issue #46043 <https://github.com/rust-lang/rust/issues/46043>",
|
||||||
},
|
},
|
||||||
|
FutureIncompatibleInfo {
|
||||||
|
id: LintId::of(COERCE_NEVER),
|
||||||
|
reference: "issue #46325 <https://github.com/rust-lang/rust/issues/46325>",
|
||||||
|
},
|
||||||
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
|
@ -154,13 +154,13 @@ fn main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
for component in &components {
|
for component in &components {
|
||||||
let mut flag = String::from("-DLLVM_COMPONENT_");
|
let mut flag = String::from("LLVM_COMPONENT_");
|
||||||
flag.push_str(&component.to_uppercase());
|
flag.push_str(&component.to_uppercase());
|
||||||
cfg.flag(&flag);
|
cfg.define(&flag, None);
|
||||||
}
|
}
|
||||||
|
|
||||||
if env::var_os("LLVM_RUSTLLVM").is_some() {
|
if env::var_os("LLVM_RUSTLLVM").is_some() {
|
||||||
cfg.flag("-DLLVM_RUSTLLVM");
|
cfg.define("LLVM_RUSTLLVM", None);
|
||||||
}
|
}
|
||||||
|
|
||||||
build_helper::rerun_if_changed_anything_in_dir(Path::new("../rustllvm"));
|
build_helper::rerun_if_changed_anything_in_dir(Path::new("../rustllvm"));
|
||||||
|
@ -169,7 +169,7 @@ fn main() {
|
||||||
.file("../rustllvm/ArchiveWrapper.cpp")
|
.file("../rustllvm/ArchiveWrapper.cpp")
|
||||||
.cpp(true)
|
.cpp(true)
|
||||||
.cpp_link_stdlib(None) // we handle this below
|
.cpp_link_stdlib(None) // we handle this below
|
||||||
.compile("librustllvm.a");
|
.compile("rustllvm");
|
||||||
|
|
||||||
let (llvm_kind, llvm_link_arg) = detect_llvm_link(major, minor, &llvm_config);
|
let (llvm_kind, llvm_link_arg) = detect_llvm_link(major, minor, &llvm_config);
|
||||||
|
|
||||||
|
|
|
@ -505,17 +505,13 @@ pub mod debuginfo {
|
||||||
|
|
||||||
pub enum ModuleBuffer {}
|
pub enum ModuleBuffer {}
|
||||||
|
|
||||||
// Link to our native llvm bindings (things that we need to use the C++ api
|
// This annotation is primarily needed for MSVC where attributes like
|
||||||
// for) and because llvm is written in C++ we need to link against libstdc++
|
// dllimport/dllexport are applied and need to be correct for everything to
|
||||||
//
|
// link successfully. The #[link] annotation here says "these symbols are
|
||||||
// You'll probably notice that there is an omission of all LLVM libraries
|
// included statically" which means that they're all exported with dllexport
|
||||||
// from this location. This is because the set of LLVM libraries that we
|
// and from the rustc_llvm dynamic library. Otherwise the rustc_trans dynamic
|
||||||
// link to is mostly defined by LLVM, and the `llvm-config` tool is used to
|
// library would not be able to access these symbols.
|
||||||
// figure out the exact set of libraries. To do this, the build system
|
#[link(name = "rustllvm", kind = "static")]
|
||||||
// generates an llvmdeps.rs file next to this one which will be
|
|
||||||
// automatically updated whenever LLVM is updated to include an up-to-date
|
|
||||||
// set of the libraries we need to link to LLVM for.
|
|
||||||
#[link(name = "rustllvm", kind = "static")] // not quite true but good enough
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
// Create and destroy contexts.
|
// Create and destroy contexts.
|
||||||
pub fn LLVMContextCreate() -> ContextRef;
|
pub fn LLVMContextCreate() -> ContextRef;
|
||||||
|
|
|
@ -66,6 +66,7 @@ use rustc::hir;
|
||||||
use rustc::hir::def_id::DefId;
|
use rustc::hir::def_id::DefId;
|
||||||
use rustc::infer::{Coercion, InferResult, InferOk};
|
use rustc::infer::{Coercion, InferResult, InferOk};
|
||||||
use rustc::infer::type_variable::TypeVariableOrigin;
|
use rustc::infer::type_variable::TypeVariableOrigin;
|
||||||
|
use rustc::lint;
|
||||||
use rustc::traits::{self, ObligationCause, ObligationCauseCode};
|
use rustc::traits::{self, ObligationCause, ObligationCauseCode};
|
||||||
use rustc::ty::adjustment::{Adjustment, Adjust, AutoBorrow};
|
use rustc::ty::adjustment::{Adjustment, Adjust, AutoBorrow};
|
||||||
use rustc::ty::{self, LvaluePreference, TypeAndMut,
|
use rustc::ty::{self, LvaluePreference, TypeAndMut,
|
||||||
|
@ -754,7 +755,15 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
||||||
// type, but only if the source expression diverges.
|
// type, but only if the source expression diverges.
|
||||||
if target.is_never() && expr_diverges.always() {
|
if target.is_never() && expr_diverges.always() {
|
||||||
debug!("permit coercion to `!` because expr diverges");
|
debug!("permit coercion to `!` because expr diverges");
|
||||||
return Ok(target);
|
if self.can_eq(self.param_env, source, target).is_err() {
|
||||||
|
self.tcx.lint_node(
|
||||||
|
lint::builtin::COERCE_NEVER,
|
||||||
|
expr.id,
|
||||||
|
expr.span,
|
||||||
|
&format!("cannot coerce `{}` to !", source)
|
||||||
|
);
|
||||||
|
return Ok(target);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let cause = self.cause(expr.span, ObligationCauseCode::ExprAssignable);
|
let cause = self.cause(expr.span, ObligationCauseCode::ExprAssignable);
|
||||||
|
|
|
@ -75,6 +75,25 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
|
||||||
tcx.hir.krate().visit_all_item_likes(&mut visitor);
|
tcx.hir.krate().visit_all_item_likes(&mut visitor);
|
||||||
|
|
||||||
for &(def_id, span) in tcx.maybe_unused_extern_crates(LOCAL_CRATE).iter() {
|
for &(def_id, span) in tcx.maybe_unused_extern_crates(LOCAL_CRATE).iter() {
|
||||||
|
// The `def_id` here actually was calculated during resolution (at least
|
||||||
|
// at the time of this writing) and is being shipped to us via a side
|
||||||
|
// channel of the tcx. There may have been extra expansion phases,
|
||||||
|
// however, which ended up removing the `def_id` *after* expansion such
|
||||||
|
// as the `ReplaceBodyWithLoop` pass (which is a bit of a hack, but hey)
|
||||||
|
//
|
||||||
|
// As a result we need to verify that `def_id` is indeed still valid for
|
||||||
|
// our AST and actually present in the HIR map. If it's not there then
|
||||||
|
// there's safely nothing to warn about, and otherwise we carry on with
|
||||||
|
// our execution.
|
||||||
|
//
|
||||||
|
// Note that if we carry through to the `extern_mod_stmt_cnum` query
|
||||||
|
// below it'll cause a panic because `def_id` is actually bogus at this
|
||||||
|
// point in time otherwise.
|
||||||
|
if let Some(id) = tcx.hir.as_local_node_id(def_id) {
|
||||||
|
if tcx.hir.find(id).is_none() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
let cnum = tcx.extern_mod_stmt_cnum(def_id).unwrap();
|
let cnum = tcx.extern_mod_stmt_cnum(def_id).unwrap();
|
||||||
if tcx.is_compiler_builtins(cnum) {
|
if tcx.is_compiler_builtins(cnum) {
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -11,7 +11,6 @@ path = "lib.rs"
|
||||||
doctest = false
|
doctest = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
env_logger = { version = "0.4", default-features = false }
|
|
||||||
log = "0.3"
|
log = "0.3"
|
||||||
pulldown-cmark = { version = "0.1.0", default-features = false }
|
pulldown-cmark = { version = "0.1.0", default-features = false }
|
||||||
html-diff = "0.0.5"
|
html-diff = "0.0.5"
|
||||||
|
|
|
@ -27,6 +27,6 @@ fn main() {
|
||||||
.warnings(false)
|
.warnings(false)
|
||||||
.include(src_dir)
|
.include(src_dir)
|
||||||
.warnings(false)
|
.warnings(false)
|
||||||
.compile("libhoedown.a");
|
.compile("hoedown");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1819,7 +1819,9 @@ fn full_path(cx: &Context, item: &clean::Item) -> String {
|
||||||
|
|
||||||
fn shorter<'a>(s: Option<&'a str>) -> String {
|
fn shorter<'a>(s: Option<&'a str>) -> String {
|
||||||
match s {
|
match s {
|
||||||
Some(s) => s.lines().take_while(|line|{
|
Some(s) => s.lines()
|
||||||
|
.skip_while(|s| s.chars().all(|c| c.is_whitespace()))
|
||||||
|
.take_while(|line|{
|
||||||
(*line).chars().any(|chr|{
|
(*line).chars().any(|chr|{
|
||||||
!chr.is_whitespace()
|
!chr.is_whitespace()
|
||||||
})
|
})
|
||||||
|
|
|
@ -920,6 +920,12 @@ span.since {
|
||||||
border-color: transparent black transparent transparent;
|
border-color: transparent black transparent transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.important-traits .tooltip .tooltiptext {
|
||||||
|
background-color: white;
|
||||||
|
color: black;
|
||||||
|
border: 1px solid #000;
|
||||||
|
}
|
||||||
|
|
||||||
pre.rust {
|
pre.rust {
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
|
@ -470,7 +470,6 @@ where R: 'static + Send, F: 'static + Send + FnOnce(Output) -> R {
|
||||||
default_passes = false;
|
default_passes = false;
|
||||||
|
|
||||||
passes = vec![
|
passes = vec![
|
||||||
String::from("strip-hidden"),
|
|
||||||
String::from("collapse-docs"),
|
String::from("collapse-docs"),
|
||||||
String::from("unindent-comments"),
|
String::from("unindent-comments"),
|
||||||
];
|
];
|
||||||
|
|
|
@ -184,6 +184,15 @@ impl<'a> fold::DocFolder for ImplStripper<'a> {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if let Some(generics) = imp.trait_.as_ref().and_then(|t| t.generics()) {
|
||||||
|
for typaram in generics {
|
||||||
|
if let Some(did) = typaram.def_id() {
|
||||||
|
if did.is_local() && !self.retained.contains(&did) {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
self.fold_item_recur(i)
|
self.fold_item_recur(i)
|
||||||
}
|
}
|
||||||
|
|
|
@ -223,7 +223,34 @@ pub fn current_exe() -> io::Result<PathBuf> {
|
||||||
|
|
||||||
#[cfg(target_os = "netbsd")]
|
#[cfg(target_os = "netbsd")]
|
||||||
pub fn current_exe() -> io::Result<PathBuf> {
|
pub fn current_exe() -> io::Result<PathBuf> {
|
||||||
::fs::read_link("/proc/curproc/exe")
|
fn sysctl() -> io::Result<PathBuf> {
|
||||||
|
unsafe {
|
||||||
|
let mib = [libc::CTL_KERN, libc::KERN_PROC_ARGS, -1, libc::KERN_PROC_PATHNAME];
|
||||||
|
let mut path_len: usize = 0;
|
||||||
|
cvt(libc::sysctl(mib.as_ptr(), mib.len() as ::libc::c_uint,
|
||||||
|
ptr::null_mut(), &mut path_len,
|
||||||
|
ptr::null(), 0))?;
|
||||||
|
if path_len <= 1 {
|
||||||
|
return Err(io::Error::new(io::ErrorKind::Other,
|
||||||
|
"KERN_PROC_PATHNAME sysctl returned zero-length string"))
|
||||||
|
}
|
||||||
|
let mut path: Vec<u8> = Vec::with_capacity(path_len);
|
||||||
|
cvt(libc::sysctl(mib.as_ptr(), mib.len() as ::libc::c_uint,
|
||||||
|
path.as_ptr() as *mut libc::c_void, &mut path_len,
|
||||||
|
ptr::null(), 0))?;
|
||||||
|
path.set_len(path_len - 1); // chop off NUL
|
||||||
|
Ok(PathBuf::from(OsString::from_vec(path)))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fn procfs() -> io::Result<PathBuf> {
|
||||||
|
let curproc_exe = path::Path::new("/proc/curproc/exe");
|
||||||
|
if curproc_exe.is_file() {
|
||||||
|
return ::fs::read_link(curproc_exe);
|
||||||
|
}
|
||||||
|
Err(io::Error::new(io::ErrorKind::Other,
|
||||||
|
"/proc/curproc/exe doesn't point to regular file."))
|
||||||
|
}
|
||||||
|
sysctl().or_else(|_| procfs())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(target_os = "bitrig", target_os = "openbsd"))]
|
#[cfg(any(target_os = "bitrig", target_os = "openbsd"))]
|
||||||
|
|
2
src/llvm
2
src/llvm
|
@ -1 +1 @@
|
||||||
Subproject commit 487c636342ea1abe64d6387eade963a91a152aa9
|
Subproject commit 6d08185a5cf488d0a853b065a8a3a6d7a29f084f
|
|
@ -12,8 +12,11 @@
|
||||||
|
|
||||||
fn foo(x: usize, y: !, z: usize) { }
|
fn foo(x: usize, y: !, z: usize) { }
|
||||||
|
|
||||||
|
#[deny(coerce_never)]
|
||||||
fn cast_a() {
|
fn cast_a() {
|
||||||
let y = {return; 22} as !;
|
let y = {return; 22} as !;
|
||||||
|
//~^ ERROR cannot coerce `i32` to !
|
||||||
|
//~| hard error
|
||||||
}
|
}
|
||||||
|
|
||||||
fn cast_b() {
|
fn cast_b() {
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![feature(never_type)]
|
#![feature(never_type)]
|
||||||
|
#![deny(coerce_never)]
|
||||||
|
|
||||||
fn foo(x: usize, y: !, z: usize) { }
|
fn foo(x: usize, y: !, z: usize) { }
|
||||||
|
|
||||||
|
@ -17,6 +18,8 @@ fn call_foo_a() {
|
||||||
// the coercion to `!`, but within same expression. Not clear that
|
// the coercion to `!`, but within same expression. Not clear that
|
||||||
// these are the rules we want.
|
// these are the rules we want.
|
||||||
foo(return, 22, 44);
|
foo(return, 22, 44);
|
||||||
|
//~^ ERROR cannot coerce `{integer}` to !
|
||||||
|
//~| hard error
|
||||||
}
|
}
|
||||||
|
|
||||||
fn call_foo_b() {
|
fn call_foo_b() {
|
||||||
|
@ -36,6 +39,8 @@ fn call_foo_d() {
|
||||||
let b = 22;
|
let b = 22;
|
||||||
let c = 44;
|
let c = 44;
|
||||||
foo(a, b, c); // ... and hence a reference to `a` is expected to diverge.
|
foo(a, b, c); // ... and hence a reference to `a` is expected to diverge.
|
||||||
|
//~^ ERROR cannot coerce `{integer}` to !
|
||||||
|
//~| hard error
|
||||||
}
|
}
|
||||||
|
|
||||||
fn call_foo_e() {
|
fn call_foo_e() {
|
||||||
|
@ -75,6 +80,8 @@ fn tuple_a() {
|
||||||
fn tuple_b() {
|
fn tuple_b() {
|
||||||
// Divergence happens before coercion: OK
|
// Divergence happens before coercion: OK
|
||||||
let x: (usize, !, usize) = (return, 44, 66);
|
let x: (usize, !, usize) = (return, 44, 66);
|
||||||
|
//~^ ERROR cannot coerce `{integer}` to !
|
||||||
|
//~| hard error
|
||||||
}
|
}
|
||||||
|
|
||||||
fn tuple_c() {
|
fn tuple_c() {
|
||||||
|
|
|
@ -8,9 +8,13 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn _converge() -> ! {
|
#[deny(coerce_never)]
|
||||||
42 //~ ERROR mismatched types
|
fn assert_sizeof() -> ! {
|
||||||
|
unsafe {
|
||||||
|
::std::mem::transmute::<f64, [u8; 8]>(panic!())
|
||||||
|
//~^ ERROR cannot coerce `[u8; 8]` to !
|
||||||
|
//~| hard error
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() { }
|
fn main() { }
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
#[allow(coerce_never)]
|
||||||
fn assert_sizeof() -> ! {
|
fn assert_sizeof() -> ! {
|
||||||
unsafe {
|
unsafe {
|
||||||
::std::mem::transmute::<f64, [u8; 8]>(panic!())
|
::std::mem::transmute::<f64, [u8; 8]>(panic!())
|
||||||
|
@ -15,4 +16,3 @@ fn assert_sizeof() -> ! {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() { }
|
fn main() { }
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
// Tests saturating float->int casts. See u128-as-f32.rs for the opposite direction.
|
// Tests saturating float->int casts. See u128-as-f32.rs for the opposite direction.
|
||||||
// compile-flags: -Z saturating-float-casts
|
// compile-flags: -Z saturating-float-casts
|
||||||
// ignore-wasm32-bare FIXME(#46298) needs upstream llvm fixes
|
|
||||||
|
|
||||||
#![feature(test, i128, i128_type, stmt_expr_attributes)]
|
#![feature(test, i128, i128_type, stmt_expr_attributes)]
|
||||||
#![deny(overflowing_literals)]
|
#![deny(overflowing_literals)]
|
||||||
|
|
15
src/test/rustdoc/issue-46271.rs
Normal file
15
src/test/rustdoc/issue-46271.rs
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||||
|
// file at the top-level directory of this distribution and at
|
||||||
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||||
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||||
|
// option. This file may not be copied, modified, or distributed
|
||||||
|
// except according to those terms.
|
||||||
|
|
||||||
|
// hopefully this doesn't cause an ICE
|
||||||
|
|
||||||
|
pub fn foo() {
|
||||||
|
extern crate std;
|
||||||
|
}
|
13
src/test/rustdoc/issue-46377.rs
Normal file
13
src/test/rustdoc/issue-46377.rs
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
||||||
|
// file at the top-level directory of this distribution and at
|
||||||
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||||
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||||
|
// option. This file may not be copied, modified, or distributed
|
||||||
|
// except according to those terms.
|
||||||
|
|
||||||
|
// @has 'issue_46377/index.html' '//*[@class="docblock-short"]' 'Check out this struct!'
|
||||||
|
/// # Check out this struct!
|
||||||
|
pub struct SomeStruct;
|
19
src/test/rustdoc/issue-46380-2.rs
Normal file
19
src/test/rustdoc/issue-46380-2.rs
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
||||||
|
// file at the top-level directory of this distribution and at
|
||||||
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||||
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||||
|
// option. This file may not be copied, modified, or distributed
|
||||||
|
// except according to those terms.
|
||||||
|
|
||||||
|
pub trait PublicTrait<T> {}
|
||||||
|
|
||||||
|
// @has issue_46380_2/struct.PublicStruct.html
|
||||||
|
pub struct PublicStruct;
|
||||||
|
|
||||||
|
// @!has - '//*[@class="impl"]' 'impl PublicTrait<PrivateStruct> for PublicStruct'
|
||||||
|
impl PublicTrait<PrivateStruct> for PublicStruct {}
|
||||||
|
|
||||||
|
struct PrivateStruct;
|
15
src/test/rustdoc/issue-46380.rs
Normal file
15
src/test/rustdoc/issue-46380.rs
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
||||||
|
// file at the top-level directory of this distribution and at
|
||||||
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||||
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||||
|
// option. This file may not be copied, modified, or distributed
|
||||||
|
// except according to those terms.
|
||||||
|
|
||||||
|
// compile-flags: --document-private-items
|
||||||
|
|
||||||
|
// @has issue_46380/struct.Hidden.html
|
||||||
|
#[doc(hidden)]
|
||||||
|
pub struct Hidden;
|
|
@ -12,11 +12,14 @@
|
||||||
#![allow(unused_assignments)]
|
#![allow(unused_assignments)]
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
#![deny(unreachable_code)]
|
#![deny(unreachable_code)]
|
||||||
|
#![deny(coerce_never)]
|
||||||
#![feature(never_type)]
|
#![feature(never_type)]
|
||||||
|
|
||||||
fn foo() {
|
fn foo() {
|
||||||
let x: ! = ! { return; 22 }; //~ ERROR unreachable
|
let x: ! = ! { return; 22 }; //~ ERROR unreachable
|
||||||
//~^ ERROR cannot apply unary operator `!` to type `!`
|
//~^ ERROR cannot coerce
|
||||||
|
//~| hard error
|
||||||
|
//~| ERROR cannot apply unary operator `!` to type `!`
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() { }
|
fn main() { }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
error: unreachable expression
|
error: unreachable expression
|
||||||
--> $DIR/expr_unary.rs:18:28
|
--> $DIR/expr_unary.rs:19:28
|
||||||
|
|
|
|
||||||
18 | let x: ! = ! { return; 22 }; //~ ERROR unreachable
|
19 | let x: ! = ! { return; 22 }; //~ ERROR unreachable
|
||||||
| ^^
|
| ^^
|
||||||
|
|
|
|
||||||
note: lint level defined here
|
note: lint level defined here
|
||||||
|
@ -10,11 +10,25 @@ note: lint level defined here
|
||||||
14 | #![deny(unreachable_code)]
|
14 | #![deny(unreachable_code)]
|
||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error[E0600]: cannot apply unary operator `!` to type `!`
|
error: cannot coerce `{integer}` to !
|
||||||
--> $DIR/expr_unary.rs:18:16
|
--> $DIR/expr_unary.rs:19:28
|
||||||
|
|
|
|
||||||
18 | let x: ! = ! { return; 22 }; //~ ERROR unreachable
|
19 | let x: ! = ! { return; 22 }; //~ ERROR unreachable
|
||||||
|
| ^^
|
||||||
|
|
|
||||||
|
note: lint level defined here
|
||||||
|
--> $DIR/expr_unary.rs:15:9
|
||||||
|
|
|
||||||
|
15 | #![deny(coerce_never)]
|
||||||
|
| ^^^^^^^^^^^^
|
||||||
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
|
= note: for more information, see issue #46325 <https://github.com/rust-lang/rust/issues/46325>
|
||||||
|
|
||||||
|
error[E0600]: cannot apply unary operator `!` to type `!`
|
||||||
|
--> $DIR/expr_unary.rs:19:16
|
||||||
|
|
|
||||||
|
19 | let x: ! = ! { return; 22 }; //~ ERROR unreachable
|
||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 6529d418db18ac28622fc2fe0bade0d690c6bd71
|
Subproject commit 5bb478a518bcf75537409e8b71f6b7cc4af362df
|
Loading…
Reference in a new issue