Auto merge of #62961 - Centril:rollup-kydeswa, r=Centril
Rollup of 9 pull requests Successful merges: - #61727 (Add binary dependencies to dep-info files) - #62736 (Polonius: fix some cases of `killed` fact generation, and most of the `ui` test suite) - #62758 (ci: Install clang on Windows through tarballs) - #62784 (Add riscv32i-unknown-none-elf target) - #62814 (add support for hexagon-unknown-linux-musl) - #62827 (Don't link mcjit/interpreter LLVM components) - #62901 (cleanup: Remove `extern crate serialize as rustc_serialize`s) - #62903 (Support SDKROOT env var on iOS) - #62906 (Require a value for configure --debuginfo-level) Failed merges: - #62910 (cleanup: Remove lint annotations in specific crates that are already enforced by rustbuild) r? @ghost
This commit is contained in:
commit
185b9acb66
|
@ -26,12 +26,18 @@ steps:
|
|||
#
|
||||
# Original downloaded here came from
|
||||
# http://releases.llvm.org/7.0.0/LLVM-7.0.0-win64.exe
|
||||
- script: |
|
||||
powershell -Command "$ProgressPreference = 'SilentlyContinue'; iwr -outf %TEMP%\LLVM-7.0.0-win64.exe https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror/LLVM-7.0.0-win64.exe"
|
||||
set CLANG_DIR=%CD%\citools\clang-rust
|
||||
%TEMP%\LLVM-7.0.0-win64.exe /S /NCRC /D=%CLANG_DIR%
|
||||
set RUST_CONFIGURE_ARGS=%RUST_CONFIGURE_ARGS% --set llvm.clang-cl=%CLANG_DIR%\bin\clang-cl.exe
|
||||
echo ##vso[task.setvariable variable=RUST_CONFIGURE_ARGS]%RUST_CONFIGURE_ARGS%
|
||||
# That installer was run through `wine` on Linux and then the resulting
|
||||
# installation directory (found in `$HOME/.wine/drive_c/Program Files/LLVM`) was
|
||||
# packaged up into a tarball. We've had issues otherwise that the installer will
|
||||
# randomly hang, provide not a lot of useful information, pollute global state,
|
||||
# etc. In general the tarball is just more confined and easier to deal with when
|
||||
# working with various CI environments.
|
||||
- bash: |
|
||||
set -e
|
||||
mkdir -p citools
|
||||
cd citools
|
||||
curl -f https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror/LLVM-7.0.0-win64.tar.gz | tar xzf -
|
||||
echo "##vso[task.setvariable variable=RUST_CONFIGURE_ARGS]$RUST_CONFIGURE_ARGS --set llvm.clang-cl=`pwd`/clang-rust/bin/clang-cl.exe"
|
||||
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'), eq(variables['MINGW_URL'],''))
|
||||
displayName: Install clang (Windows)
|
||||
|
||||
|
|
|
@ -76,11 +76,11 @@ o("optimize-llvm", "llvm.optimize", "build optimized LLVM")
|
|||
o("llvm-assertions", "llvm.assertions", "build LLVM with assertions")
|
||||
o("debug-assertions", "rust.debug-assertions", "build with debugging assertions")
|
||||
o("llvm-release-debuginfo", "llvm.release-debuginfo", "build LLVM with debugger metadata")
|
||||
o("debuginfo-level", "rust.debuginfo-level", "debuginfo level for Rust code")
|
||||
o("debuginfo-level-rustc", "rust.debuginfo-level-rustc", "debuginfo level for the compiler")
|
||||
o("debuginfo-level-std", "rust.debuginfo-level-std", "debuginfo level for the standard library")
|
||||
o("debuginfo-level-tools", "rust.debuginfo-level-tools", "debuginfo level for the tools")
|
||||
o("debuginfo-level-tests", "rust.debuginfo-level-tests", "debuginfo level for the test suites run with compiletest")
|
||||
v("debuginfo-level", "rust.debuginfo-level", "debuginfo level for Rust code")
|
||||
v("debuginfo-level-rustc", "rust.debuginfo-level-rustc", "debuginfo level for the compiler")
|
||||
v("debuginfo-level-std", "rust.debuginfo-level-std", "debuginfo level for the standard library")
|
||||
v("debuginfo-level-tools", "rust.debuginfo-level-tools", "debuginfo level for the tools")
|
||||
v("debuginfo-level-tests", "rust.debuginfo-level-tests", "debuginfo level for the test suites run with compiletest")
|
||||
v("save-toolstates", "rust.save-toolstates", "save build and test status of external tools into this file")
|
||||
|
||||
v("prefix", "install.prefix", "set installation prefix")
|
||||
|
|
|
@ -112,6 +112,7 @@ ENV TARGETS=$TARGETS,thumbv7em-none-eabihf
|
|||
ENV TARGETS=$TARGETS,thumbv8m.base-none-eabi
|
||||
ENV TARGETS=$TARGETS,thumbv8m.main-none-eabi
|
||||
ENV TARGETS=$TARGETS,thumbv8m.main-none-eabihf
|
||||
ENV TARGETS=$TARGETS,riscv32i-unknown-none-elf
|
||||
ENV TARGETS=$TARGETS,riscv32imc-unknown-none-elf
|
||||
ENV TARGETS=$TARGETS,riscv32imac-unknown-none-elf
|
||||
ENV TARGETS=$TARGETS,riscv64imac-unknown-none-elf
|
||||
|
|
|
@ -50,7 +50,7 @@ if [ "$DEPLOY$DEPLOY_ALT" = "1" ]; then
|
|||
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --release-channel=$RUST_RELEASE_CHANNEL"
|
||||
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-llvm-static-stdcpp"
|
||||
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set rust.remap-debuginfo"
|
||||
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set rust.debuginfo-level-std=1"
|
||||
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --debuginfo-level-std=1"
|
||||
|
||||
if [ "$NO_LLVM_ASSERTIONS" = "1" ]; then
|
||||
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --disable-llvm-assertions"
|
||||
|
|
|
@ -120,6 +120,7 @@
|
|||
#![feature(cmpxchg16b_target_feature)]
|
||||
#![feature(rtm_target_feature)]
|
||||
#![feature(f16c_target_feature)]
|
||||
#![feature(hexagon_target_feature)]
|
||||
#![feature(const_slice_len)]
|
||||
#![feature(const_str_as_bytes)]
|
||||
#![feature(const_str_len)]
|
||||
|
|
|
@ -126,6 +126,9 @@ const UNWIND_DATA_REG: (i32, i32) = (6, 7); // R6, R7
|
|||
#[cfg(target_arch = "sparc64")]
|
||||
const UNWIND_DATA_REG: (i32, i32) = (24, 25); // I0, I1
|
||||
|
||||
#[cfg(target_arch = "hexagon")]
|
||||
const UNWIND_DATA_REG: (i32, i32) = (0, 1); // R0, R1
|
||||
|
||||
// The following code is based on GCC's C and C++ personality routines. For reference, see:
|
||||
// https://github.com/gcc-mirror/gcc/blob/master/libstdc++-v3/libsupc++/eh_personality.cc
|
||||
// https://github.com/gcc-mirror/gcc/blob/trunk/libgcc/unwind-c.c
|
||||
|
|
|
@ -27,7 +27,7 @@ rustc_target = { path = "../librustc_target" }
|
|||
rustc_macros = { path = "../librustc_macros" }
|
||||
rustc_data_structures = { path = "../librustc_data_structures" }
|
||||
errors = { path = "../librustc_errors", package = "rustc_errors" }
|
||||
serialize = { path = "../libserialize" }
|
||||
rustc_serialize = { path = "../libserialize", package = "serialize" }
|
||||
syntax = { path = "../libsyntax" }
|
||||
syntax_pos = { path = "../libsyntax_pos" }
|
||||
backtrace = "0.3.3"
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
use crate::ty::{self, TyCtxt};
|
||||
use crate::hir::map::definitions::FIRST_FREE_DEF_INDEX;
|
||||
use rustc_data_structures::indexed_vec::Idx;
|
||||
use serialize;
|
||||
use std::fmt;
|
||||
use std::u32;
|
||||
|
||||
|
@ -93,8 +92,8 @@ impl fmt::Display for CrateNum {
|
|||
}
|
||||
}
|
||||
|
||||
impl serialize::UseSpecializedEncodable for CrateNum {}
|
||||
impl serialize::UseSpecializedDecodable for CrateNum {}
|
||||
impl rustc_serialize::UseSpecializedEncodable for CrateNum {}
|
||||
impl rustc_serialize::UseSpecializedDecodable for CrateNum {}
|
||||
|
||||
newtype_index! {
|
||||
/// A DefIndex is an index into the hir-map for a crate, identifying a
|
||||
|
@ -134,8 +133,8 @@ impl DefIndex {
|
|||
}
|
||||
}
|
||||
|
||||
impl serialize::UseSpecializedEncodable for DefIndex {}
|
||||
impl serialize::UseSpecializedDecodable for DefIndex {}
|
||||
impl rustc_serialize::UseSpecializedEncodable for DefIndex {}
|
||||
impl rustc_serialize::UseSpecializedDecodable for DefIndex {}
|
||||
|
||||
/// A `DefId` identifies a particular *definition*, by combining a crate
|
||||
/// index and a def index.
|
||||
|
@ -186,8 +185,8 @@ impl DefId {
|
|||
}
|
||||
}
|
||||
|
||||
impl serialize::UseSpecializedEncodable for DefId {}
|
||||
impl serialize::UseSpecializedDecodable for DefId {}
|
||||
impl rustc_serialize::UseSpecializedEncodable for DefId {}
|
||||
impl rustc_serialize::UseSpecializedDecodable for DefId {}
|
||||
|
||||
/// A LocalDefId is equivalent to a DefId with `krate == LOCAL_CRATE`. Since
|
||||
/// we encode this information in the type, we can ensure at compile time that
|
||||
|
@ -220,5 +219,5 @@ impl fmt::Debug for LocalDefId {
|
|||
}
|
||||
}
|
||||
|
||||
impl serialize::UseSpecializedEncodable for LocalDefId {}
|
||||
impl serialize::UseSpecializedDecodable for LocalDefId {}
|
||||
impl rustc_serialize::UseSpecializedEncodable for LocalDefId {}
|
||||
impl rustc_serialize::UseSpecializedDecodable for LocalDefId {}
|
||||
|
|
|
@ -34,7 +34,7 @@ use rustc_data_structures::sync::{par_for_each_in, Send, Sync};
|
|||
use rustc_data_structures::thin_vec::ThinVec;
|
||||
use rustc_macros::HashStable;
|
||||
|
||||
use serialize::{self, Encoder, Encodable, Decoder, Decodable};
|
||||
use rustc_serialize::{self, Encoder, Encodable, Decoder, Decodable};
|
||||
use std::collections::{BTreeSet, BTreeMap};
|
||||
use std::fmt;
|
||||
use smallvec::SmallVec;
|
||||
|
@ -92,7 +92,7 @@ impl HirId {
|
|||
}
|
||||
}
|
||||
|
||||
impl serialize::UseSpecializedEncodable for HirId {
|
||||
impl rustc_serialize::UseSpecializedEncodable for HirId {
|
||||
fn default_encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
|
||||
let HirId {
|
||||
owner,
|
||||
|
@ -104,7 +104,7 @@ impl serialize::UseSpecializedEncodable for HirId {
|
|||
}
|
||||
}
|
||||
|
||||
impl serialize::UseSpecializedDecodable for HirId {
|
||||
impl rustc_serialize::UseSpecializedDecodable for HirId {
|
||||
fn default_decode<D: Decoder>(d: &mut D) -> Result<HirId, D::Error> {
|
||||
let owner = DefIndex::decode(d)?;
|
||||
let local_id = ItemLocalId::decode(d)?;
|
||||
|
|
|
@ -7,7 +7,7 @@ use std::iter::FromIterator;
|
|||
use std::ops::Deref;
|
||||
use std::{slice, vec};
|
||||
|
||||
use serialize::{Encodable, Decodable, Encoder, Decoder};
|
||||
use rustc_serialize::{Encodable, Decodable, Encoder, Decoder};
|
||||
|
||||
use rustc_data_structures::stable_hasher::{StableHasher, StableHasherResult,
|
||||
HashStable};
|
||||
|
|
|
@ -27,7 +27,7 @@ use crate::infer::region_constraints::MemberConstraint;
|
|||
use crate::mir::interpret::ConstValue;
|
||||
use rustc_data_structures::indexed_vec::IndexVec;
|
||||
use rustc_macros::HashStable;
|
||||
use serialize::UseSpecializedDecodable;
|
||||
use rustc_serialize::UseSpecializedDecodable;
|
||||
use smallvec::SmallVec;
|
||||
use std::ops::Index;
|
||||
use syntax::source_map::Span;
|
||||
|
|
|
@ -75,16 +75,8 @@ extern crate getopts;
|
|||
extern crate libc;
|
||||
#[macro_use] extern crate rustc_macros;
|
||||
#[macro_use] extern crate rustc_data_structures;
|
||||
|
||||
#[macro_use] extern crate log;
|
||||
#[macro_use] extern crate syntax;
|
||||
|
||||
// FIXME: This import is used by deriving `RustcDecodable` and `RustcEncodable`. Removing this
|
||||
// results in a bunch of "failed to resolve" errors. Hopefully, the compiler moves to serde or
|
||||
// something, and we can get rid of this.
|
||||
#[allow(rust_2018_idioms)]
|
||||
extern crate serialize as rustc_serialize;
|
||||
|
||||
#[macro_use] extern crate smallvec;
|
||||
|
||||
// Use the test crate here so we depend on getopts through it. This allow tools to link to both
|
||||
|
|
|
@ -23,7 +23,7 @@ use crate::lint::{LintArray, Level, Lint, LintId, LintPass, LintBuffer};
|
|||
use crate::lint::builtin::BuiltinLintDiagnostics;
|
||||
use crate::lint::levels::{LintLevelSets, LintLevelsBuilder};
|
||||
use crate::middle::privacy::AccessLevels;
|
||||
use crate::rustc_serialize::{Decoder, Decodable, Encoder, Encodable};
|
||||
use rustc_serialize::{Decoder, Decodable, Encoder, Encodable};
|
||||
use crate::session::{config, early_error, Session};
|
||||
use crate::ty::{self, print::Printer, subst::Kind, TyCtxt, Ty};
|
||||
use crate::ty::layout::{LayoutError, LayoutOf, TyLayout};
|
||||
|
|
|
@ -1,27 +1,25 @@
|
|||
use rustc_data_structures::indexed_vec::IndexVec;
|
||||
use rustc_data_structures::sync::{RwLock, MappedReadGuard, ReadGuard};
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher,
|
||||
StableHasherResult};
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher, StableHasherResult};
|
||||
use rustc_serialize::{Encodable, Encoder, Decodable, Decoder};
|
||||
use crate::ich::StableHashingContext;
|
||||
use crate::mir::{Body, BasicBlock};
|
||||
|
||||
use crate::rustc_serialize as serialize;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Cache {
|
||||
predecessors: RwLock<Option<IndexVec<BasicBlock, Vec<BasicBlock>>>>
|
||||
}
|
||||
|
||||
|
||||
impl serialize::Encodable for Cache {
|
||||
fn encode<S: serialize::Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
|
||||
serialize::Encodable::encode(&(), s)
|
||||
impl rustc_serialize::Encodable for Cache {
|
||||
fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
|
||||
Encodable::encode(&(), s)
|
||||
}
|
||||
}
|
||||
|
||||
impl serialize::Decodable for Cache {
|
||||
fn decode<D: serialize::Decoder>(d: &mut D) -> Result<Self, D::Error> {
|
||||
serialize::Decodable::decode(d).map(|_v: ()| Self::new())
|
||||
impl rustc_serialize::Decodable for Cache {
|
||||
fn decode<D: Decoder>(d: &mut D) -> Result<Self, D::Error> {
|
||||
Decodable::decode(d).map(|_v: ()| Self::new())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ impl<Tag> Allocation<Tag> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'tcx> ::serialize::UseSpecializedDecodable for &'tcx Allocation {}
|
||||
impl<'tcx> rustc_serialize::UseSpecializedDecodable for &'tcx Allocation {}
|
||||
|
||||
/// Byte accessors
|
||||
impl<'tcx, Tag: Copy, Extra: AllocationExtra<Tag>> Allocation<Tag, Extra> {
|
||||
|
|
|
@ -27,7 +27,7 @@ use crate::hir::def_id::DefId;
|
|||
use crate::ty::{self, TyCtxt, Instance, subst::UnpackedKind};
|
||||
use crate::ty::layout::{self, Size};
|
||||
use std::io;
|
||||
use crate::rustc_serialize::{Encoder, Decodable, Encodable};
|
||||
use rustc_serialize::{Encoder, Decodable, Encodable};
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_data_structures::sync::{Lock as Mutex, HashMapExt};
|
||||
use rustc_data_structures::tiny_list::TinyList;
|
||||
|
@ -51,8 +51,8 @@ pub struct GlobalId<'tcx> {
|
|||
#[derive(Copy, Clone, Eq, Hash, Ord, PartialEq, PartialOrd, Debug)]
|
||||
pub struct AllocId(pub u64);
|
||||
|
||||
impl crate::rustc_serialize::UseSpecializedEncodable for AllocId {}
|
||||
impl crate::rustc_serialize::UseSpecializedDecodable for AllocId {}
|
||||
impl rustc_serialize::UseSpecializedEncodable for AllocId {}
|
||||
impl rustc_serialize::UseSpecializedDecodable for AllocId {}
|
||||
|
||||
#[derive(RustcDecodable, RustcEncodable)]
|
||||
enum AllocDiscriminant {
|
||||
|
|
|
@ -9,7 +9,6 @@ use crate::hir::def_id::DefId;
|
|||
use crate::hir::{self, InlineAsm as HirInlineAsm};
|
||||
use crate::mir::interpret::{ConstValue, PanicMessage, Scalar};
|
||||
use crate::mir::visit::MirVisitable;
|
||||
use crate::rustc_serialize as serialize;
|
||||
use crate::ty::adjustment::PointerCast;
|
||||
use crate::ty::fold::{TypeFoldable, TypeFolder, TypeVisitor};
|
||||
use crate::ty::layout::VariantIdx;
|
||||
|
@ -28,6 +27,7 @@ use rustc_data_structures::indexed_vec::{Idx, IndexVec};
|
|||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_data_structures::sync::MappedReadGuard;
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_serialize::{Encodable, Decodable};
|
||||
use smallvec::SmallVec;
|
||||
use std::borrow::Cow;
|
||||
use std::fmt::{self, Debug, Display, Formatter, Write};
|
||||
|
@ -463,8 +463,8 @@ impl<T> ClearCrossCrate<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: serialize::Encodable> serialize::UseSpecializedEncodable for ClearCrossCrate<T> {}
|
||||
impl<T: serialize::Decodable> serialize::UseSpecializedDecodable for ClearCrossCrate<T> {}
|
||||
impl<T: Encodable> rustc_serialize::UseSpecializedEncodable for ClearCrossCrate<T> {}
|
||||
impl<T: Decodable> rustc_serialize::UseSpecializedDecodable for ClearCrossCrate<T> {}
|
||||
|
||||
/// Grouped information about the source code origin of a MIR entity.
|
||||
/// Intended to be inspected by diagnostics and debuginfo.
|
||||
|
|
|
@ -1468,6 +1468,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
|
|||
symbol_mangling_version: SymbolManglingVersion = (SymbolManglingVersion::Legacy,
|
||||
parse_symbol_mangling_version, [TRACKED],
|
||||
"which mangling version to use for symbol names"),
|
||||
binary_dep_depinfo: bool = (false, parse_bool, [TRACKED],
|
||||
"include artifacts (sysroot, crate dependencies) used during compilation in dep-info"),
|
||||
}
|
||||
|
||||
pub fn default_lib_output() -> CrateType {
|
||||
|
|
|
@ -545,6 +545,9 @@ impl Session {
|
|||
pub fn print_llvm_passes(&self) -> bool {
|
||||
self.opts.debugging_opts.print_llvm_passes
|
||||
}
|
||||
pub fn binary_dep_depinfo(&self) -> bool {
|
||||
self.opts.debugging_opts.binary_dep_depinfo
|
||||
}
|
||||
|
||||
/// Gets the features enabled for the current compilation session.
|
||||
/// DO NOT USE THIS METHOD if there is a TyCtxt available, as it circumvents
|
||||
|
|
|
@ -10,7 +10,7 @@ use crate::arena::ArenaAllocatable;
|
|||
use crate::hir::def_id::{DefId, CrateNum};
|
||||
use crate::infer::canonical::{CanonicalVarInfo, CanonicalVarInfos};
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use crate::rustc_serialize::{Decodable, Decoder, Encoder, Encodable, opaque};
|
||||
use rustc_serialize::{Decodable, Decoder, Encoder, Encodable, opaque};
|
||||
use std::hash::Hash;
|
||||
use std::intrinsics;
|
||||
use crate::ty::{self, Ty, TyCtxt};
|
||||
|
@ -333,7 +333,7 @@ macro_rules! implement_ty_decoder {
|
|||
use $crate::ty::codec::*;
|
||||
use $crate::ty::subst::SubstsRef;
|
||||
use $crate::hir::def_id::{CrateNum};
|
||||
use crate::rustc_serialize::{Decoder, SpecializedDecoder};
|
||||
use rustc_serialize::{Decoder, SpecializedDecoder};
|
||||
use std::borrow::Cow;
|
||||
|
||||
impl<$($typaram ),*> Decoder for $DecoderName<$($typaram),*> {
|
||||
|
|
|
@ -32,7 +32,7 @@ use crate::util::nodemap::{NodeSet, DefIdMap, FxHashMap};
|
|||
use arena::SyncDroplessArena;
|
||||
use crate::session::DataTypeKind;
|
||||
|
||||
use serialize::{self, Encodable, Encoder};
|
||||
use rustc_serialize::{self, Encodable, Encoder};
|
||||
use std::cell::RefCell;
|
||||
use std::cmp::{self, Ordering};
|
||||
use std::fmt;
|
||||
|
@ -588,8 +588,8 @@ impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for ty::TyS<'tcx> {
|
|||
|
||||
pub type Ty<'tcx> = &'tcx TyS<'tcx>;
|
||||
|
||||
impl<'tcx> serialize::UseSpecializedEncodable for Ty<'tcx> {}
|
||||
impl<'tcx> serialize::UseSpecializedDecodable for Ty<'tcx> {}
|
||||
impl<'tcx> rustc_serialize::UseSpecializedEncodable for Ty<'tcx> {}
|
||||
impl<'tcx> rustc_serialize::UseSpecializedDecodable for Ty<'tcx> {}
|
||||
|
||||
pub type CanonicalTy<'tcx> = Canonical<'tcx, Ty<'tcx>>;
|
||||
|
||||
|
@ -708,7 +708,7 @@ impl<'a, T> IntoIterator for &'a List<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'tcx> serialize::UseSpecializedDecodable for &'tcx List<Ty<'tcx>> {}
|
||||
impl<'tcx> rustc_serialize::UseSpecializedDecodable for &'tcx List<Ty<'tcx>> {}
|
||||
|
||||
impl<T> List<T> {
|
||||
#[inline(always)]
|
||||
|
@ -1009,8 +1009,8 @@ pub struct GenericPredicates<'tcx> {
|
|||
pub predicates: Vec<(Predicate<'tcx>, Span)>,
|
||||
}
|
||||
|
||||
impl<'tcx> serialize::UseSpecializedEncodable for GenericPredicates<'tcx> {}
|
||||
impl<'tcx> serialize::UseSpecializedDecodable for GenericPredicates<'tcx> {}
|
||||
impl<'tcx> rustc_serialize::UseSpecializedEncodable for GenericPredicates<'tcx> {}
|
||||
impl<'tcx> rustc_serialize::UseSpecializedDecodable for GenericPredicates<'tcx> {}
|
||||
|
||||
impl<'tcx> GenericPredicates<'tcx> {
|
||||
pub fn instantiate(
|
||||
|
@ -1985,13 +1985,13 @@ impl Hash for AdtDef {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'tcx> serialize::UseSpecializedEncodable for &'tcx AdtDef {
|
||||
impl<'tcx> rustc_serialize::UseSpecializedEncodable for &'tcx AdtDef {
|
||||
fn default_encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
|
||||
self.did.encode(s)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> serialize::UseSpecializedDecodable for &'tcx AdtDef {}
|
||||
impl<'tcx> rustc_serialize::UseSpecializedDecodable for &'tcx AdtDef {}
|
||||
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for AdtDef {
|
||||
|
|
|
@ -5,7 +5,7 @@ use crate::hir::map::definitions::DefPathHash;
|
|||
use crate::ich::{CachingSourceMapView, Fingerprint};
|
||||
use crate::mir::{self, interpret};
|
||||
use crate::mir::interpret::{AllocDecodingSession, AllocDecodingState};
|
||||
use crate::rustc_serialize::{Decodable, Decoder, Encodable, Encoder, opaque,
|
||||
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder, opaque,
|
||||
SpecializedDecoder, SpecializedEncoder,
|
||||
UseSpecializedDecodable, UseSpecializedEncodable};
|
||||
use crate::session::{CrateDisambiguator, Session};
|
||||
|
|
|
@ -26,7 +26,6 @@ use rustc_target::spec::abi;
|
|||
use syntax::ast::{self, Ident};
|
||||
use syntax::symbol::{kw, InternedString};
|
||||
|
||||
use serialize;
|
||||
use self::InferTy::*;
|
||||
use self::TyKind::*;
|
||||
|
||||
|
@ -640,7 +639,7 @@ impl<'tcx> Binder<ExistentialPredicate<'tcx>> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'tcx> serialize::UseSpecializedDecodable for &'tcx List<ExistentialPredicate<'tcx>> {}
|
||||
impl<'tcx> rustc_serialize::UseSpecializedDecodable for &'tcx List<ExistentialPredicate<'tcx>> {}
|
||||
|
||||
impl<'tcx> List<ExistentialPredicate<'tcx>> {
|
||||
/// Returns the "principal def id" of this set of existential predicates.
|
||||
|
@ -1324,7 +1323,7 @@ pub enum RegionKind {
|
|||
ReClosureBound(RegionVid),
|
||||
}
|
||||
|
||||
impl<'tcx> serialize::UseSpecializedDecodable for Region<'tcx> {}
|
||||
impl<'tcx> rustc_serialize::UseSpecializedDecodable for Region<'tcx> {}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Debug, PartialOrd, Ord)]
|
||||
pub struct EarlyBoundRegion {
|
||||
|
@ -2333,7 +2332,7 @@ impl<'tcx> Const<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'tcx> serialize::UseSpecializedDecodable for &'tcx Const<'tcx> {}
|
||||
impl<'tcx> rustc_serialize::UseSpecializedDecodable for &'tcx Const<'tcx> {}
|
||||
|
||||
/// An inference variable for a const, for use in const generics.
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd,
|
||||
|
|
|
@ -6,7 +6,7 @@ use crate::ty::{self, Lift, List, Ty, TyCtxt, InferConst, ParamConst};
|
|||
use crate::ty::fold::{TypeFoldable, TypeFolder, TypeVisitor};
|
||||
use crate::mir::interpret::ConstValue;
|
||||
|
||||
use serialize::{self, Encodable, Encoder, Decodable, Decoder};
|
||||
use rustc_serialize::{self, Encodable, Encoder, Decodable, Decoder};
|
||||
use syntax_pos::{Span, DUMMY_SP};
|
||||
use smallvec::SmallVec;
|
||||
use rustc_macros::HashStable;
|
||||
|
@ -399,7 +399,7 @@ impl<'tcx> TypeFoldable<'tcx> for SubstsRef<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'tcx> serialize::UseSpecializedDecodable for SubstsRef<'tcx> {}
|
||||
impl<'tcx> rustc_serialize::UseSpecializedDecodable for SubstsRef<'tcx> {}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Public trait `Subst`
|
||||
|
|
|
@ -174,7 +174,7 @@ const X86_WHITELIST: &[(&str, Option<Symbol>)] = &[
|
|||
|
||||
const HEXAGON_WHITELIST: &[(&str, Option<Symbol>)] = &[
|
||||
("hvx", Some(sym::hexagon_target_feature)),
|
||||
("hvx-double", Some(sym::hexagon_target_feature)),
|
||||
("hvx-length128b", Some(sym::hexagon_target_feature)),
|
||||
];
|
||||
|
||||
const POWERPC_WHITELIST: &[(&str, Option<Symbol>)] = &[
|
||||
|
|
|
@ -20,7 +20,7 @@ jobserver = "0.1.11"
|
|||
parking_lot = "0.7"
|
||||
tempfile = "3.0.5"
|
||||
|
||||
serialize = { path = "../libserialize" }
|
||||
rustc_serialize = { path = "../libserialize", package = "serialize" }
|
||||
syntax = { path = "../libsyntax" }
|
||||
syntax_pos = { path = "../libsyntax_pos" }
|
||||
rustc = { path = "../librustc" }
|
||||
|
|
|
@ -16,7 +16,7 @@ use rustc::session::config::{self, CrateType, OptLevel, DebugInfo,
|
|||
LinkerPluginLto, Lto};
|
||||
use rustc::ty::TyCtxt;
|
||||
use rustc_target::spec::{LinkerFlavor, LldFlavor};
|
||||
use serialize::{json, Encoder};
|
||||
use rustc_serialize::{json, Encoder};
|
||||
|
||||
/// For all the linkers we support, and information they might
|
||||
/// need out of the shared crate context before we get rid of it.
|
||||
|
|
|
@ -2,7 +2,7 @@ use std::fs;
|
|||
use std::path::Path;
|
||||
use std::str;
|
||||
|
||||
use serialize::leb128;
|
||||
use rustc_serialize::leb128;
|
||||
|
||||
// https://webassembly.github.io/spec/core/binary/modules.html#binary-importsec
|
||||
const WASM_CUSTOM_SECTION_ID: u8 = 0;
|
||||
|
|
|
@ -15,7 +15,7 @@ indexmap = "1"
|
|||
log = "0.4"
|
||||
jobserver_crate = { version = "0.1.13", package = "jobserver" }
|
||||
lazy_static = "1"
|
||||
serialize = { path = "../libserialize" }
|
||||
rustc_serialize = { path = "../libserialize", package = "serialize" }
|
||||
graphviz = { path = "../libgraphviz" }
|
||||
cfg-if = "0.1.2"
|
||||
crossbeam-utils = { version = "0.6.5", features = ["nightly"] }
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
use crate::stable_hasher;
|
||||
use std::mem;
|
||||
use serialize;
|
||||
use serialize::opaque::{EncodeResult, Encoder, Decoder};
|
||||
use rustc_serialize::opaque::{EncodeResult, Encoder, Decoder};
|
||||
|
||||
#[derive(Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Clone, Copy)]
|
||||
pub struct Fingerprint(u64, u64);
|
||||
|
@ -85,17 +84,17 @@ impl stable_hasher::StableHasherResult for Fingerprint {
|
|||
|
||||
impl_stable_hash_via_hash!(Fingerprint);
|
||||
|
||||
impl serialize::UseSpecializedEncodable for Fingerprint { }
|
||||
impl rustc_serialize::UseSpecializedEncodable for Fingerprint { }
|
||||
|
||||
impl serialize::UseSpecializedDecodable for Fingerprint { }
|
||||
impl rustc_serialize::UseSpecializedDecodable for Fingerprint { }
|
||||
|
||||
impl serialize::SpecializedEncoder<Fingerprint> for serialize::opaque::Encoder {
|
||||
impl rustc_serialize::SpecializedEncoder<Fingerprint> for Encoder {
|
||||
fn specialized_encode(&mut self, f: &Fingerprint) -> Result<(), Self::Error> {
|
||||
f.encode_opaque(self)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> serialize::SpecializedDecoder<Fingerprint> for serialize::opaque::Decoder<'a> {
|
||||
impl<'a> rustc_serialize::SpecializedDecoder<Fingerprint> for Decoder<'a> {
|
||||
fn specialized_decode(&mut self) -> Result<Fingerprint, Self::Error> {
|
||||
Fingerprint::decode_opaque(self)
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
use rustc_serialize::{Encodable, Decodable, Encoder, Decoder};
|
||||
|
||||
use std::fmt::Debug;
|
||||
use std::iter::{self, FromIterator};
|
||||
use std::slice;
|
||||
|
@ -8,8 +10,6 @@ use std::hash::Hash;
|
|||
use std::vec;
|
||||
use std::u32;
|
||||
|
||||
use rustc_serialize as serialize;
|
||||
|
||||
/// Represents some newtyped `usize` wrapper.
|
||||
///
|
||||
/// Purpose: avoid mixing indexes for different bitvector domains.
|
||||
|
@ -398,17 +398,9 @@ macro_rules! newtype_index {
|
|||
);
|
||||
|
||||
(@decodable $type:ident) => (
|
||||
impl $type {
|
||||
fn __decodable__impl__hack() {
|
||||
mod __more_hacks_because__self_doesnt_work_in_functions {
|
||||
extern crate serialize;
|
||||
use self::serialize::{Decodable, Decoder};
|
||||
impl Decodable for super::$type {
|
||||
fn decode<D: Decoder>(d: &mut D) -> Result<Self, D::Error> {
|
||||
d.read_u32().map(Self::from)
|
||||
}
|
||||
}
|
||||
}
|
||||
impl ::rustc_serialize::Decodable for $type {
|
||||
fn decode<D: ::rustc_serialize::Decoder>(d: &mut D) -> Result<Self, D::Error> {
|
||||
d.read_u32().map(Self::from)
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -521,15 +513,15 @@ pub struct IndexVec<I: Idx, T> {
|
|||
// not the phantom data.
|
||||
unsafe impl<I: Idx, T> Send for IndexVec<I, T> where T: Send {}
|
||||
|
||||
impl<I: Idx, T: serialize::Encodable> serialize::Encodable for IndexVec<I, T> {
|
||||
fn encode<S: serialize::Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
|
||||
serialize::Encodable::encode(&self.raw, s)
|
||||
impl<I: Idx, T: Encodable> Encodable for IndexVec<I, T> {
|
||||
fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
|
||||
Encodable::encode(&self.raw, s)
|
||||
}
|
||||
}
|
||||
|
||||
impl<I: Idx, T: serialize::Decodable> serialize::Decodable for IndexVec<I, T> {
|
||||
fn decode<D: serialize::Decoder>(d: &mut D) -> Result<Self, D::Error> {
|
||||
serialize::Decodable::decode(d).map(|v| {
|
||||
impl<I: Idx, T: Decodable> Decodable for IndexVec<I, T> {
|
||||
fn decode<D: Decoder>(d: &mut D) -> Result<Self, D::Error> {
|
||||
Decodable::decode(d).map(|v| {
|
||||
IndexVec { raw: v, _marker: PhantomData }
|
||||
})
|
||||
}
|
||||
|
|
|
@ -31,8 +31,6 @@
|
|||
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
#[allow(unused_extern_crates)]
|
||||
extern crate serialize as rustc_serialize; // used by deriving
|
||||
#[cfg(unix)]
|
||||
extern crate libc;
|
||||
#[macro_use]
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
use std::fmt;
|
||||
use std::hash::{Hash, Hasher};
|
||||
use serialize::{Encodable, Decodable, Encoder, Decoder};
|
||||
use rustc_serialize::{Encodable, Decodable, Encoder, Decoder};
|
||||
|
||||
use crate::stable_hasher;
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ rustc_traits = { path = "../librustc_traits" }
|
|||
rustc_codegen_utils = { path = "../librustc_codegen_utils" }
|
||||
rustc_typeck = { path = "../librustc_typeck" }
|
||||
rustc_interface = { path = "../librustc_interface" }
|
||||
serialize = { path = "../libserialize" }
|
||||
rustc_serialize = { path = "../libserialize", package = "serialize" }
|
||||
syntax = { path = "../libsyntax" }
|
||||
smallvec = { version = "0.6.7", features = ["union", "may_dangle"] }
|
||||
syntax_ext = { path = "../libsyntax_ext" }
|
||||
|
|
|
@ -46,7 +46,7 @@ use rustc_interface::interface;
|
|||
use rustc_interface::util::get_codegen_sysroot;
|
||||
use rustc_data_structures::sync::SeqCst;
|
||||
|
||||
use serialize::json::ToJson;
|
||||
use rustc_serialize::json::ToJson;
|
||||
|
||||
use std::borrow::Cow;
|
||||
use std::cmp::max;
|
||||
|
|
|
@ -11,7 +11,7 @@ doctest = false
|
|||
|
||||
[dependencies]
|
||||
log = "0.4"
|
||||
serialize = { path = "../libserialize" }
|
||||
rustc_serialize = { path = "../libserialize", package = "serialize" }
|
||||
syntax_pos = { path = "../libsyntax_pos" }
|
||||
rustc_data_structures = { path = "../librustc_data_structures" }
|
||||
unicode-width = "0.1.4"
|
||||
|
|
|
@ -12,9 +12,6 @@
|
|||
#![deny(rust_2018_idioms)]
|
||||
#![deny(unused_lifetimes)]
|
||||
|
||||
#[allow(unused_extern_crates)]
|
||||
extern crate serialize as rustc_serialize; // used by deriving
|
||||
|
||||
pub use emitter::ColorConfig;
|
||||
|
||||
use Level::*;
|
||||
|
|
|
@ -15,7 +15,7 @@ log = "0.4"
|
|||
rand = "0.6"
|
||||
rustc = { path = "../librustc" }
|
||||
rustc_data_structures = { path = "../librustc_data_structures" }
|
||||
serialize = { path = "../libserialize" }
|
||||
rustc_serialize = { path = "../libserialize", package = "serialize" }
|
||||
syntax = { path = "../libsyntax" }
|
||||
syntax_pos = { path = "../libsyntax_pos" }
|
||||
rustc_fs_util = { path = "../librustc_fs_util" }
|
||||
|
|
|
@ -12,9 +12,6 @@
|
|||
#![deny(unused_lifetimes)]
|
||||
|
||||
#[macro_use] extern crate rustc;
|
||||
#[allow(unused_extern_crates)]
|
||||
extern crate serialize as rustc_serialize; // used by deriving
|
||||
|
||||
#[macro_use] extern crate log;
|
||||
|
||||
mod assert_dep_graph;
|
||||
|
|
|
@ -16,7 +16,7 @@ smallvec = { version = "0.6.7", features = ["union", "may_dangle"] }
|
|||
syntax = { path = "../libsyntax" }
|
||||
syntax_ext = { path = "../libsyntax_ext" }
|
||||
syntax_pos = { path = "../libsyntax_pos" }
|
||||
serialize = { path = "../libserialize" }
|
||||
rustc_serialize = { path = "../libserialize", package = "serialize" }
|
||||
rustc = { path = "../librustc" }
|
||||
rustc_allocator = { path = "../librustc_allocator" }
|
||||
rustc_ast_borrowck = { path = "../librustc_ast_borrowck" }
|
||||
|
|
|
@ -9,6 +9,7 @@ use rustc::hir::lowering::lower_crate;
|
|||
use rustc::hir::def_id::{CrateNum, LOCAL_CRATE};
|
||||
use rustc::lint;
|
||||
use rustc::middle::{self, reachable, resolve_lifetime, stability};
|
||||
use rustc::middle::cstore::CrateStore;
|
||||
use rustc::middle::privacy::AccessLevels;
|
||||
use rustc::ty::{self, AllArenas, Resolutions, TyCtxt, GlobalCtxt};
|
||||
use rustc::ty::steal::Steal;
|
||||
|
@ -51,7 +52,7 @@ use syntax::feature_gate::AttributeType;
|
|||
use syntax_pos::{FileName, edition::Edition, hygiene};
|
||||
use syntax_ext;
|
||||
|
||||
use serialize::json;
|
||||
use rustc_serialize::json;
|
||||
use tempfile::Builder as TempFileBuilder;
|
||||
|
||||
use std::any::Any;
|
||||
|
@ -657,7 +658,8 @@ fn escape_dep_filename(filename: &FileName) -> String {
|
|||
filename.to_string().replace(" ", "\\ ")
|
||||
}
|
||||
|
||||
fn write_out_deps(sess: &Session, outputs: &OutputFilenames, out_filenames: &[PathBuf]) {
|
||||
fn write_out_deps(compiler: &Compiler, outputs: &OutputFilenames, out_filenames: &[PathBuf]) {
|
||||
let sess = &compiler.sess;
|
||||
// Write out dependency rules to the dep-info file if requested
|
||||
if !sess.opts.output_types.contains_key(&OutputType::DepInfo) {
|
||||
return;
|
||||
|
@ -667,13 +669,30 @@ fn write_out_deps(sess: &Session, outputs: &OutputFilenames, out_filenames: &[Pa
|
|||
let result = (|| -> io::Result<()> {
|
||||
// Build a list of files used to compile the output and
|
||||
// write Makefile-compatible dependency rules
|
||||
let files: Vec<String> = sess.source_map()
|
||||
let mut files: Vec<String> = sess.source_map()
|
||||
.files()
|
||||
.iter()
|
||||
.filter(|fmap| fmap.is_real_file())
|
||||
.filter(|fmap| !fmap.is_imported())
|
||||
.map(|fmap| escape_dep_filename(&fmap.name))
|
||||
.collect();
|
||||
|
||||
if sess.binary_dep_depinfo() {
|
||||
for cnum in compiler.cstore.crates_untracked() {
|
||||
let metadata = compiler.cstore.crate_data_as_rc_any(cnum);
|
||||
let metadata = metadata.downcast_ref::<cstore::CrateMetadata>().unwrap();
|
||||
if let Some((path, _)) = &metadata.source.dylib {
|
||||
files.push(escape_dep_filename(&FileName::Real(path.clone())));
|
||||
}
|
||||
if let Some((path, _)) = &metadata.source.rlib {
|
||||
files.push(escape_dep_filename(&FileName::Real(path.clone())));
|
||||
}
|
||||
if let Some((path, _)) = &metadata.source.rmeta {
|
||||
files.push(escape_dep_filename(&FileName::Real(path.clone())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let mut file = fs::File::create(&deps_filename)?;
|
||||
for path in out_filenames {
|
||||
writeln!(file, "{}: {}\n", path.display(), files.join(" "))?;
|
||||
|
@ -750,7 +769,7 @@ pub fn prepare_outputs(
|
|||
}
|
||||
}
|
||||
|
||||
write_out_deps(sess, &outputs, &output_paths);
|
||||
write_out_deps(compiler, &outputs, &output_paths);
|
||||
|
||||
let only_dep_info = sess.opts.output_types.contains_key(&OutputType::DepInfo)
|
||||
&& sess.opts.output_types.len() == 1;
|
||||
|
|
|
@ -15,7 +15,7 @@ use rustc::ty::steal::Steal;
|
|||
use rustc::dep_graph::DepGraph;
|
||||
use rustc_passes::hir_stats;
|
||||
use rustc_plugin::registry::Registry;
|
||||
use serialize::json;
|
||||
use rustc_serialize::json;
|
||||
use std::cell::{Ref, RefMut, RefCell};
|
||||
use std::ops::Deref;
|
||||
use std::rc::Rc;
|
||||
|
|
|
@ -71,7 +71,8 @@ fn main() {
|
|||
|
||||
let mut optional_components =
|
||||
vec!["x86", "arm", "aarch64", "amdgpu", "mips", "powerpc",
|
||||
"systemz", "jsbackend", "webassembly", "msp430", "sparc", "nvptx"];
|
||||
"systemz", "jsbackend", "webassembly", "msp430", "sparc", "nvptx",
|
||||
"hexagon"];
|
||||
|
||||
let mut version_cmd = Command::new(&llvm_config);
|
||||
version_cmd.arg("--version");
|
||||
|
@ -82,27 +83,19 @@ fn main() {
|
|||
if let (Some(major), Some(minor)) = (parts.next(), parts.next()) {
|
||||
(major, minor)
|
||||
} else {
|
||||
(3, 9)
|
||||
(6, 0)
|
||||
};
|
||||
|
||||
if major > 3 {
|
||||
optional_components.push("hexagon");
|
||||
}
|
||||
|
||||
if major > 6 {
|
||||
optional_components.push("riscv");
|
||||
}
|
||||
|
||||
// FIXME: surely we don't need all these components, right? Stuff like mcjit
|
||||
// or interpreter the compiler itself never uses.
|
||||
let required_components = &["ipo",
|
||||
"bitreader",
|
||||
"bitwriter",
|
||||
"linker",
|
||||
"asmparser",
|
||||
"mcjit",
|
||||
"lto",
|
||||
"interpreter",
|
||||
"instrumentation"];
|
||||
|
||||
let components = output(Command::new(&llvm_config).arg("--components"));
|
||||
|
|
|
@ -18,7 +18,7 @@ rustc = { path = "../librustc" }
|
|||
rustc_data_structures = { path = "../librustc_data_structures" }
|
||||
errors = { path = "../librustc_errors", package = "rustc_errors" }
|
||||
rustc_target = { path = "../librustc_target" }
|
||||
serialize = { path = "../libserialize" }
|
||||
rustc_serialize = { path = "../libserialize", package = "serialize" }
|
||||
stable_deref_trait = "1.0.0"
|
||||
syntax = { path = "../libsyntax" }
|
||||
syntax_ext = { path = "../libsyntax_ext" }
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
#![deny(unused_lifetimes)]
|
||||
|
||||
extern crate libc;
|
||||
#[allow(unused_extern_crates)]
|
||||
extern crate serialize as rustc_serialize; // used by deriving
|
||||
extern crate proc_macro;
|
||||
|
||||
#[macro_use]
|
||||
|
|
|
@ -13,7 +13,6 @@ use rustc::ty::{self, Ty, ReprOptions};
|
|||
use rustc_target::spec::{PanicStrategy, TargetTriple};
|
||||
use rustc_data_structures::svh::Svh;
|
||||
|
||||
use rustc_serialize as serialize;
|
||||
use syntax::{ast, attr};
|
||||
use syntax::edition::Edition;
|
||||
use syntax::symbol::Symbol;
|
||||
|
@ -85,8 +84,8 @@ impl<T> Clone for Lazy<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T> serialize::UseSpecializedEncodable for Lazy<T> {}
|
||||
impl<T> serialize::UseSpecializedDecodable for Lazy<T> {}
|
||||
impl<T> rustc_serialize::UseSpecializedEncodable for Lazy<T> {}
|
||||
impl<T> rustc_serialize::UseSpecializedDecodable for Lazy<T> {}
|
||||
|
||||
/// A sequence of type T referred to by its absolute position
|
||||
/// in the metadata and length, and which can be decoded lazily.
|
||||
|
@ -133,8 +132,8 @@ impl<T> Clone for LazySeq<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T> serialize::UseSpecializedEncodable for LazySeq<T> {}
|
||||
impl<T> serialize::UseSpecializedDecodable for LazySeq<T> {}
|
||||
impl<T> rustc_serialize::UseSpecializedEncodable for LazySeq<T> {}
|
||||
impl<T> rustc_serialize::UseSpecializedDecodable for LazySeq<T> {}
|
||||
|
||||
/// Encoding / decoding state for `Lazy` and `LazySeq`.
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
||||
|
|
|
@ -20,7 +20,7 @@ rustc = { path = "../librustc" }
|
|||
rustc_target = { path = "../librustc_target" }
|
||||
rustc_data_structures = { path = "../librustc_data_structures" }
|
||||
rustc_errors = { path = "../librustc_errors" }
|
||||
serialize = { path = "../libserialize" }
|
||||
rustc_serialize = { path = "../libserialize", package = "serialize" }
|
||||
syntax = { path = "../libsyntax" }
|
||||
syntax_pos = { path = "../libsyntax_pos" }
|
||||
byteorder = { version = "1.1", features = ["i128"] }
|
||||
|
|
|
@ -3,12 +3,15 @@ use crate::borrow_check::location::LocationTable;
|
|||
use crate::borrow_check::nll::ToRegionVid;
|
||||
use crate::borrow_check::nll::facts::AllFacts;
|
||||
use crate::borrow_check::nll::region_infer::values::LivenessValues;
|
||||
use crate::borrow_check::places_conflict;
|
||||
use rustc::infer::InferCtxt;
|
||||
use rustc::mir::visit::TyContext;
|
||||
use rustc::mir::visit::Visitor;
|
||||
use rustc::mir::{BasicBlock, BasicBlockData, Location, Body, Place, PlaceBase, Rvalue};
|
||||
use rustc::mir::{SourceInfo, Statement, Terminator};
|
||||
use rustc::mir::UserTypeProjection;
|
||||
use rustc::mir::{
|
||||
BasicBlock, BasicBlockData, Body, Local, Location, Place, PlaceBase, Projection,
|
||||
ProjectionElem, Rvalue, SourceInfo, Statement, StatementKind, Terminator, TerminatorKind,
|
||||
UserTypeProjection,
|
||||
};
|
||||
use rustc::ty::fold::TypeFoldable;
|
||||
use rustc::ty::{self, ClosureSubsts, GeneratorSubsts, RegionVid, Ty};
|
||||
use rustc::ty::subst::SubstsRef;
|
||||
|
@ -27,6 +30,7 @@ pub(super) fn generate_constraints<'cx, 'tcx>(
|
|||
liveness_constraints,
|
||||
location_table,
|
||||
all_facts,
|
||||
body,
|
||||
};
|
||||
|
||||
for (bb, data) in body.basic_blocks().iter_enumerated() {
|
||||
|
@ -41,6 +45,7 @@ struct ConstraintGeneration<'cg, 'cx, 'tcx> {
|
|||
location_table: &'cg LocationTable,
|
||||
liveness_constraints: &'cg mut LivenessValues<RegionVid>,
|
||||
borrow_set: &'cg BorrowSet<'tcx>,
|
||||
body: &'cg Body<'tcx>,
|
||||
}
|
||||
|
||||
impl<'cg, 'cx, 'tcx> Visitor<'tcx> for ConstraintGeneration<'cg, 'cx, 'tcx> {
|
||||
|
@ -114,6 +119,17 @@ impl<'cg, 'cx, 'tcx> Visitor<'tcx> for ConstraintGeneration<'cg, 'cx, 'tcx> {
|
|||
self.location_table
|
||||
.start_index(location.successor_within_block()),
|
||||
));
|
||||
|
||||
// If there are borrows on this now dead local, we need to record them as `killed`.
|
||||
if let StatementKind::StorageDead(ref local) = statement.kind {
|
||||
record_killed_borrows_for_local(
|
||||
all_facts,
|
||||
self.borrow_set,
|
||||
self.location_table,
|
||||
local,
|
||||
location,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
self.super_statement(statement, location);
|
||||
|
@ -127,20 +143,7 @@ impl<'cg, 'cx, 'tcx> Visitor<'tcx> for ConstraintGeneration<'cg, 'cx, 'tcx> {
|
|||
) {
|
||||
// When we see `X = ...`, then kill borrows of
|
||||
// `(*X).foo` and so forth.
|
||||
if let Some(all_facts) = self.all_facts {
|
||||
if let Place {
|
||||
base: PlaceBase::Local(temp),
|
||||
projection: None,
|
||||
} = place {
|
||||
if let Some(borrow_indices) = self.borrow_set.local_map.get(temp) {
|
||||
all_facts.killed.reserve(borrow_indices.len());
|
||||
for &borrow_index in borrow_indices {
|
||||
let location_index = self.location_table.mid_index(location);
|
||||
all_facts.killed.push((borrow_index, location_index));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self.record_killed_borrows_for_place(place, location);
|
||||
|
||||
self.super_assign(place, rvalue, location);
|
||||
}
|
||||
|
@ -167,6 +170,14 @@ impl<'cg, 'cx, 'tcx> Visitor<'tcx> for ConstraintGeneration<'cg, 'cx, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
// A `Call` terminator's return value can be a local which has borrows,
|
||||
// so we need to record those as `killed` as well.
|
||||
if let TerminatorKind::Call { ref destination, .. } = terminator.kind {
|
||||
if let Some((place, _)) = destination {
|
||||
self.record_killed_borrows_for_place(place, location);
|
||||
}
|
||||
}
|
||||
|
||||
self.super_terminator(terminator, location);
|
||||
}
|
||||
|
||||
|
@ -201,4 +212,96 @@ impl<'cx, 'cg, 'tcx> ConstraintGeneration<'cx, 'cg, 'tcx> {
|
|||
self.liveness_constraints.add_element(vid, location);
|
||||
});
|
||||
}
|
||||
|
||||
/// When recording facts for Polonius, records the borrows on the specified place
|
||||
/// as `killed`. For example, when assigning to a local, or on a call's return destination.
|
||||
fn record_killed_borrows_for_place(&mut self, place: &Place<'tcx>, location: Location) {
|
||||
if let Some(all_facts) = self.all_facts {
|
||||
// Depending on the `Place` we're killing:
|
||||
// - if it's a local, or a single deref of a local,
|
||||
// we kill all the borrows on the local.
|
||||
// - if it's a deeper projection, we have to filter which
|
||||
// of the borrows are killed: the ones whose `borrowed_place`
|
||||
// conflicts with the `place`.
|
||||
match place {
|
||||
Place {
|
||||
base: PlaceBase::Local(local),
|
||||
projection: None,
|
||||
} |
|
||||
Place {
|
||||
base: PlaceBase::Local(local),
|
||||
projection: Some(box Projection {
|
||||
base: None,
|
||||
elem: ProjectionElem::Deref,
|
||||
}),
|
||||
} => {
|
||||
debug!(
|
||||
"Recording `killed` facts for borrows of local={:?} at location={:?}",
|
||||
local, location
|
||||
);
|
||||
|
||||
record_killed_borrows_for_local(
|
||||
all_facts,
|
||||
self.borrow_set,
|
||||
self.location_table,
|
||||
local,
|
||||
location,
|
||||
);
|
||||
}
|
||||
|
||||
Place {
|
||||
base: PlaceBase::Static(_),
|
||||
..
|
||||
} => {
|
||||
// Ignore kills of static or static mut variables.
|
||||
}
|
||||
|
||||
Place {
|
||||
base: PlaceBase::Local(local),
|
||||
projection: Some(_),
|
||||
} => {
|
||||
// Kill conflicting borrows of the innermost local.
|
||||
debug!(
|
||||
"Recording `killed` facts for borrows of \
|
||||
innermost projected local={:?} at location={:?}",
|
||||
local, location
|
||||
);
|
||||
|
||||
if let Some(borrow_indices) = self.borrow_set.local_map.get(local) {
|
||||
for &borrow_index in borrow_indices {
|
||||
let places_conflict = places_conflict::places_conflict(
|
||||
self.infcx.tcx,
|
||||
self.body,
|
||||
&self.borrow_set.borrows[borrow_index].borrowed_place,
|
||||
place,
|
||||
places_conflict::PlaceConflictBias::NoOverlap,
|
||||
);
|
||||
|
||||
if places_conflict {
|
||||
let location_index = self.location_table.mid_index(location);
|
||||
all_facts.killed.push((borrow_index, location_index));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// When recording facts for Polonius, records the borrows on the specified local as `killed`.
|
||||
fn record_killed_borrows_for_local(
|
||||
all_facts: &mut AllFacts,
|
||||
borrow_set: &BorrowSet<'_>,
|
||||
location_table: &LocationTable,
|
||||
local: &Local,
|
||||
location: Location,
|
||||
) {
|
||||
if let Some(borrow_indices) = borrow_set.local_map.get(local) {
|
||||
all_facts.killed.reserve(borrow_indices.len());
|
||||
for &borrow_index in borrow_indices {
|
||||
let location_index = location_table.mid_index(location);
|
||||
all_facts.killed.push((borrow_index, location_index));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,13 +30,9 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
|
|||
#![deny(unused_lifetimes)]
|
||||
|
||||
#[macro_use] extern crate log;
|
||||
#[macro_use]
|
||||
extern crate rustc;
|
||||
#[macro_use] extern crate rustc;
|
||||
#[macro_use] extern crate rustc_data_structures;
|
||||
#[allow(unused_extern_crates)]
|
||||
extern crate serialize as rustc_serialize; // used by deriving
|
||||
#[macro_use]
|
||||
extern crate syntax;
|
||||
#[macro_use] extern crate syntax;
|
||||
|
||||
mod error_codes;
|
||||
|
||||
|
|
|
@ -12,5 +12,5 @@ path = "lib.rs"
|
|||
bitflags = "1.0"
|
||||
log = "0.4"
|
||||
rustc_data_structures = { path = "../librustc_data_structures" }
|
||||
serialize = { path = "../libserialize" }
|
||||
rustc_serialize = { path = "../libserialize", package = "serialize" }
|
||||
syntax_pos = { path = "../libsyntax_pos" }
|
||||
|
|
|
@ -18,8 +18,5 @@
|
|||
|
||||
#[macro_use] extern crate log;
|
||||
|
||||
#[allow(unused_extern_crates)]
|
||||
extern crate serialize as rustc_serialize; // used by deriving
|
||||
|
||||
pub mod abi;
|
||||
pub mod spec;
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
use std::env;
|
||||
use std::io;
|
||||
use std::path::Path;
|
||||
use std::process::Command;
|
||||
use crate::spec::{LinkArgs, LinkerFlavor, TargetOptions};
|
||||
|
||||
|
@ -27,6 +29,18 @@ impl Arch {
|
|||
}
|
||||
|
||||
pub fn get_sdk_root(sdk_name: &str) -> Result<String, String> {
|
||||
// Following what clang does
|
||||
// (https://github.com/llvm/llvm-project/blob/
|
||||
// 296a80102a9b72c3eda80558fb78a3ed8849b341/clang/lib/Driver/ToolChains/Darwin.cpp#L1661-L1678)
|
||||
// to allow the SDK path to be set. (For clang, xcrun sets
|
||||
// SDKROOT; for rustc, the user or build system can set it, or we
|
||||
// can fall back to checking for xcrun on PATH.)
|
||||
if let Some(sdkroot) = env::var("SDKROOT").ok() {
|
||||
let sdkroot_path = Path::new(&sdkroot);
|
||||
if sdkroot_path.is_absolute() && sdkroot_path != Path::new("/") && sdkroot_path.exists() {
|
||||
return Ok(sdkroot);
|
||||
}
|
||||
}
|
||||
let res = Command::new("xcrun")
|
||||
.arg("--show-sdk-path")
|
||||
.arg("-sdk")
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
use crate::spec::{LinkerFlavor, Target, TargetResult, LinkArgs};
|
||||
|
||||
pub fn target() -> TargetResult {
|
||||
let mut base = super::linux_musl_base::opts();
|
||||
base.cpu = "hexagonv60".to_string();
|
||||
base.max_atomic_width = Some(32);
|
||||
// FIXME: HVX length defaults are per-CPU
|
||||
base.features = "-small-data,+hvx-length128b".to_string();
|
||||
|
||||
base.crt_static_default = false;
|
||||
base.atomic_cas = true;
|
||||
base.has_rpath = true;
|
||||
base.linker_is_gnu = false;
|
||||
base.dynamic_linking = true;
|
||||
base.executables = true;
|
||||
|
||||
base.pre_link_args = LinkArgs::new();
|
||||
base.post_link_args = LinkArgs::new();
|
||||
|
||||
Ok(Target {
|
||||
llvm_target: "hexagon-unknown-linux-musl".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "32".to_string(),
|
||||
target_c_int_width: "32".to_string(),
|
||||
data_layout: concat!("e-m:e-p:32:32:32-a:0-n16:32-i64:64:64-i32:32",
|
||||
":32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-v32",
|
||||
":32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048",
|
||||
":2048:2048").to_string(),
|
||||
arch: "hexagon".to_string(),
|
||||
target_os: "linux".to_string(),
|
||||
target_env: "musl".to_string(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: base,
|
||||
})
|
||||
}
|
|
@ -34,7 +34,7 @@
|
|||
//! the target's settings, though `target-feature` and `link-args` will *add*
|
||||
//! to the list specified by the target, rather than replace.
|
||||
|
||||
use serialize::json::{Json, ToJson};
|
||||
use rustc_serialize::json::{Json, ToJson};
|
||||
use std::collections::BTreeMap;
|
||||
use std::default::Default;
|
||||
use std::{fmt, io};
|
||||
|
@ -306,7 +306,7 @@ macro_rules! supported_targets {
|
|||
|
||||
#[cfg(test)]
|
||||
mod test_json_encode_decode {
|
||||
use serialize::json::ToJson;
|
||||
use rustc_serialize::json::ToJson;
|
||||
use super::Target;
|
||||
$(use super::$module;)+
|
||||
|
||||
|
@ -368,6 +368,7 @@ supported_targets! {
|
|||
("i586-unknown-linux-musl", i586_unknown_linux_musl),
|
||||
("mips-unknown-linux-musl", mips_unknown_linux_musl),
|
||||
("mipsel-unknown-linux-musl", mipsel_unknown_linux_musl),
|
||||
("hexagon-unknown-linux-musl", hexagon_unknown_linux_musl),
|
||||
|
||||
("mips-unknown-linux-uclibc", mips_unknown_linux_uclibc),
|
||||
("mipsel-unknown-linux-uclibc", mipsel_unknown_linux_uclibc),
|
||||
|
@ -464,6 +465,7 @@ supported_targets! {
|
|||
("aarch64-unknown-hermit", aarch64_unknown_hermit),
|
||||
("x86_64-unknown-hermit", x86_64_unknown_hermit),
|
||||
|
||||
("riscv32i-unknown-none-elf", riscv32i_unknown_none_elf),
|
||||
("riscv32imc-unknown-none-elf", riscv32imc_unknown_none_elf),
|
||||
("riscv32imac-unknown-none-elf", riscv32imac_unknown_none_elf),
|
||||
("riscv64imac-unknown-none-elf", riscv64imac_unknown_none_elf),
|
||||
|
@ -1198,7 +1200,7 @@ impl Target {
|
|||
pub fn search(target_triple: &TargetTriple) -> Result<Target, String> {
|
||||
use std::env;
|
||||
use std::fs;
|
||||
use serialize::json;
|
||||
use rustc_serialize::json;
|
||||
|
||||
fn load_file(path: &Path) -> Result<Target, String> {
|
||||
let contents = fs::read(path).map_err(|e| e.to_string())?;
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
use crate::spec::{LinkerFlavor, LldFlavor, PanicStrategy,
|
||||
Target, TargetOptions, TargetResult};
|
||||
|
||||
pub fn target() -> TargetResult {
|
||||
Ok(Target {
|
||||
data_layout: "e-m:e-p:32:32-i64:64-n32-S128".to_string(),
|
||||
llvm_target: "riscv32".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "32".to_string(),
|
||||
target_c_int_width: "32".to_string(),
|
||||
target_os: "none".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
arch: "riscv32".to_string(),
|
||||
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
|
||||
|
||||
options: TargetOptions {
|
||||
linker: Some("rust-lld".to_string()),
|
||||
cpu: "generic-rv32".to_string(),
|
||||
max_atomic_width: None,
|
||||
atomic_cas: false,
|
||||
features: String::new(),
|
||||
executables: true,
|
||||
panic_strategy: PanicStrategy::Abort,
|
||||
relocation_model: "static".to_string(),
|
||||
emit_debug_gdb_scripts: false,
|
||||
abi_blacklist: super::riscv_base::abi_blacklist(),
|
||||
eliminate_frame_pointer: false,
|
||||
.. Default::default()
|
||||
},
|
||||
})
|
||||
}
|
|
@ -1,4 +1,3 @@
|
|||
#[allow(unused_extern_crates)]
|
||||
extern crate serialize as rustc_serialize;
|
||||
|
||||
use rustc_serialize::{Encodable, Decodable};
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#[allow(unused_extern_crates)]
|
||||
extern crate serialize as rustc_serialize;
|
||||
|
||||
use rustc_serialize::{Encodable, Decodable};
|
||||
|
|
|
@ -975,6 +975,11 @@ mod arch {
|
|||
pub const ARCH: &str = "wasm32";
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "hexagon")]
|
||||
mod arch {
|
||||
pub const ARCH: &'static str = "hexagon";
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
|
|
@ -147,6 +147,62 @@ mod arch {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "hexagon")]
|
||||
mod arch {
|
||||
use crate::os::raw::{c_long, c_int, c_longlong, culonglong};
|
||||
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = c_longlong;
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = c_long;
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type ino_t = c_ulonglong;
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type nlink_t = c_uint;
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type off_t = c_longlong;
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = c_long;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone)]
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||
pub struct stat {
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||
pub st_dev: ::dev_t,
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||
pub st_ino: ::c_ulonglong,
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||
pub st_mode: ::c_uint,
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||
pub st_nlink: ::c_uint,
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||
pub st_uid: ::c_uint,
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||
pub st_gid: ::c_uint,
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||
pub st_rdev: ::c_ulonglong,
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||
pub __pad1: ::c_ulong,
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||
pub st_size: ::c_longlong,
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||
pub st_blksize: ::blksize_t,
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||
pub __pad2: ::c_int,
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||
pub st_blocks: ::blkcnt_t,
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||
pub st_atime: ::time_t,
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||
pub st_atime_nsec: ::c_long,
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||
pub st_mtime: ::time_t,
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||
pub st_mtime_nsec: ::c_long,
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||
pub st_ctime: ::time_t,
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||
pub st_ctime_nsec: ::c_long,
|
||||
#[stable(feature = "raw_ext", since = "1.1.0")]
|
||||
pub __pad3: [::c_int;2],
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(target_arch = "mips64",
|
||||
target_arch = "s390x",
|
||||
target_arch = "sparc64"))]
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#[doc(include = "os/raw/char.md")]
|
||||
#[cfg(any(all(target_os = "linux", any(target_arch = "aarch64",
|
||||
target_arch = "arm",
|
||||
target_arch = "hexagon",
|
||||
target_arch = "powerpc",
|
||||
target_arch = "powerpc64",
|
||||
target_arch = "s390x")),
|
||||
|
@ -34,6 +35,7 @@
|
|||
#[doc(include = "os/raw/char.md")]
|
||||
#[cfg(not(any(all(target_os = "linux", any(target_arch = "aarch64",
|
||||
target_arch = "arm",
|
||||
target_arch = "hexagon",
|
||||
target_arch = "powerpc",
|
||||
target_arch = "powerpc64",
|
||||
target_arch = "s390x")),
|
||||
|
|
|
@ -12,7 +12,8 @@ use crate::ptr;
|
|||
target_arch = "powerpc",
|
||||
target_arch = "powerpc64",
|
||||
target_arch = "asmjs",
|
||||
target_arch = "wasm32")))]
|
||||
target_arch = "wasm32",
|
||||
target_arch = "hexagon")))]
|
||||
pub const MIN_ALIGN: usize = 8;
|
||||
#[cfg(all(any(target_arch = "x86_64",
|
||||
target_arch = "aarch64",
|
||||
|
|
|
@ -11,7 +11,7 @@ doctest = false
|
|||
|
||||
[dependencies]
|
||||
bitflags = "1.0"
|
||||
serialize = { path = "../libserialize" }
|
||||
rustc_serialize = { path = "../libserialize", package = "serialize" }
|
||||
log = "0.4"
|
||||
scoped-tls = "1.0"
|
||||
lazy_static = "1.0.0"
|
||||
|
|
|
@ -22,7 +22,7 @@ use syntax_pos::{Span, DUMMY_SP};
|
|||
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use serialize::{self, Decoder, Encoder};
|
||||
use rustc_serialize::{self, Decoder, Encoder};
|
||||
use std::fmt;
|
||||
|
||||
pub use rustc_target::abi::FloatTy;
|
||||
|
@ -266,13 +266,13 @@ impl fmt::Display for NodeId {
|
|||
}
|
||||
}
|
||||
|
||||
impl serialize::UseSpecializedEncodable for NodeId {
|
||||
impl rustc_serialize::UseSpecializedEncodable for NodeId {
|
||||
fn default_encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
|
||||
s.emit_u32(self.as_u32())
|
||||
}
|
||||
}
|
||||
|
||||
impl serialize::UseSpecializedDecodable for NodeId {
|
||||
impl rustc_serialize::UseSpecializedDecodable for NodeId {
|
||||
fn default_decode<D: Decoder>(d: &mut D) -> Result<NodeId, D::Error> {
|
||||
d.read_u32().map(NodeId::from_u32)
|
||||
}
|
||||
|
@ -2414,12 +2414,11 @@ impl ForeignItemKind {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use serialize;
|
||||
|
||||
// Are ASTs encodable?
|
||||
#[test]
|
||||
fn check_asts_encodable() {
|
||||
fn assert_encodable<T: serialize::Encodable>() {}
|
||||
fn assert_encodable<T: rustc_serialize::Encodable>() {}
|
||||
assert_encodable::<Crate>();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,9 +24,6 @@
|
|||
|
||||
#![recursion_limit="256"]
|
||||
|
||||
#[allow(unused_extern_crates)]
|
||||
extern crate serialize as rustc_serialize; // used by deriving
|
||||
|
||||
pub use errors;
|
||||
use rustc_data_structures::sync::Lock;
|
||||
use rustc_data_structures::bit_set::GrowableBitSet;
|
||||
|
|
|
@ -31,7 +31,7 @@ use std::iter::FromIterator;
|
|||
use std::ops::{Deref, DerefMut};
|
||||
use std::{slice, vec};
|
||||
|
||||
use serialize::{Encodable, Decodable, Encoder, Decoder};
|
||||
use rustc_serialize::{Encodable, Decodable, Encoder, Decoder};
|
||||
|
||||
use rustc_data_structures::stable_hasher::{StableHasher, StableHasherResult,
|
||||
HashStable};
|
||||
|
|
|
@ -23,7 +23,7 @@ use syntax_pos::{BytePos, ExpnId, Span, DUMMY_SP};
|
|||
#[cfg(target_arch = "x86_64")]
|
||||
use rustc_data_structures::static_assert_size;
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use serialize::{Decoder, Decodable, Encoder, Encodable};
|
||||
use rustc_serialize::{Decoder, Decodable, Encoder, Encodable};
|
||||
use smallvec::{SmallVec, smallvec};
|
||||
|
||||
use std::borrow::Cow;
|
||||
|
|
|
@ -10,7 +10,7 @@ path = "lib.rs"
|
|||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
serialize = { path = "../libserialize" }
|
||||
rustc_serialize = { path = "../libserialize", package = "serialize" }
|
||||
rustc_macros = { path = "../librustc_macros" }
|
||||
rustc_data_structures = { path = "../librustc_data_structures" }
|
||||
arena = { path = "../libarena" }
|
||||
|
|
|
@ -30,7 +30,7 @@ use crate::{Span, DUMMY_SP};
|
|||
use crate::edition::Edition;
|
||||
use crate::symbol::{kw, Symbol};
|
||||
|
||||
use serialize::{Encodable, Decodable, Encoder, Decoder};
|
||||
use rustc_serialize::{Encodable, Decodable, Encoder, Decoder};
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use std::fmt;
|
||||
|
|
|
@ -19,10 +19,7 @@
|
|||
#![feature(specialization)]
|
||||
#![feature(step_trait)]
|
||||
|
||||
use serialize::{Encodable, Decodable, Encoder, Decoder};
|
||||
|
||||
#[allow(unused_extern_crates)]
|
||||
extern crate serialize as rustc_serialize; // used by deriving
|
||||
use rustc_serialize::{Encodable, Decodable, Encoder, Decoder};
|
||||
|
||||
pub mod edition;
|
||||
use edition::Edition;
|
||||
|
@ -594,7 +591,7 @@ impl Default for Span {
|
|||
}
|
||||
}
|
||||
|
||||
impl serialize::UseSpecializedEncodable for Span {
|
||||
impl rustc_serialize::UseSpecializedEncodable for Span {
|
||||
fn default_encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
|
||||
let span = self.data();
|
||||
s.emit_struct("Span", 2, |s| {
|
||||
|
@ -609,7 +606,7 @@ impl serialize::UseSpecializedEncodable for Span {
|
|||
}
|
||||
}
|
||||
|
||||
impl serialize::UseSpecializedDecodable for Span {
|
||||
impl rustc_serialize::UseSpecializedDecodable for Span {
|
||||
fn default_decode<D: Decoder>(d: &mut D) -> Result<Span, D::Error> {
|
||||
d.read_struct("Span", 2, |d| {
|
||||
let lo = d.read_struct_field("lo", 0, Decodable::decode)?;
|
||||
|
|
|
@ -7,7 +7,7 @@ use rustc_data_structures::fx::FxHashMap;
|
|||
use rustc_data_structures::indexed_vec::Idx;
|
||||
use rustc_data_structures::newtype_index;
|
||||
use rustc_macros::symbols;
|
||||
use serialize::{Decodable, Decoder, Encodable, Encoder};
|
||||
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
|
||||
|
||||
use std::cmp::{PartialEq, Ordering, PartialOrd, Ord};
|
||||
use std::fmt;
|
||||
|
|
|
@ -56,6 +56,9 @@ pub const unwinder_private_data_size: usize = 2;
|
|||
#[cfg(target_os = "emscripten")]
|
||||
pub const unwinder_private_data_size: usize = 20;
|
||||
|
||||
#[cfg(all(target_arch = "hexagon", target_os = "linux"))]
|
||||
pub const unwinder_private_data_size: usize = 35;
|
||||
|
||||
#[repr(C)]
|
||||
pub struct _Unwind_Exception {
|
||||
pub exception_class: _Unwind_Exception_Class,
|
||||
|
|
|
@ -26,8 +26,6 @@
|
|||
using namespace llvm;
|
||||
using namespace llvm::legacy;
|
||||
|
||||
extern cl::opt<bool> EnableARMEHABI;
|
||||
|
||||
typedef struct LLVMOpaquePass *LLVMPassRef;
|
||||
typedef struct LLVMOpaqueTargetMachine *LLVMTargetMachineRef;
|
||||
|
||||
|
|
|
@ -1,15 +1,11 @@
|
|||
#include "llvm-c/BitReader.h"
|
||||
#include "llvm-c/Core.h"
|
||||
#include "llvm-c/ExecutionEngine.h"
|
||||
#include "llvm-c/Object.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/DenseSet.h"
|
||||
#include "llvm/ADT/Triple.h"
|
||||
#include "llvm/Analysis/Lint.h"
|
||||
#include "llvm/Analysis/Passes.h"
|
||||
#include "llvm/ExecutionEngine/ExecutionEngine.h"
|
||||
#include "llvm/ExecutionEngine/Interpreter.h"
|
||||
#include "llvm/ExecutionEngine/MCJIT.h"
|
||||
#include "llvm/IR/IRBuilder.h"
|
||||
#include "llvm/IR/InlineAsm.h"
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
error[E0597]: `books` does not live long enough
|
||||
--> $DIR/borrowck-escaping-closure-error-2.rs:11:17
|
||||
|
|
||||
LL | Box::new(|| books.push(4))
|
||||
| ------------^^^^^---------
|
||||
| | | |
|
||||
| | | borrowed value does not live long enough
|
||||
| | value captured here
|
||||
| borrow later used here
|
||||
LL |
|
||||
LL | }
|
||||
| - `books` dropped here while still borrowed
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0597`.
|
|
@ -1,5 +1,5 @@
|
|||
warning[E0507]: cannot move out of `foo` in pattern guard
|
||||
--> $DIR/borrowck-migrate-to-nll.rs:25:18
|
||||
--> $DIR/borrowck-migrate-to-nll.rs:26:18
|
||||
|
|
||||
LL | (|| { let bar = foo; bar.take() })();
|
||||
| ^^ ---
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
// just ignore it instead:
|
||||
|
||||
// ignore-compare-mode-nll
|
||||
// ignore-compare-mode-polonius
|
||||
|
||||
// revisions: zflag edition
|
||||
//[zflag]compile-flags: -Z borrowck=migrate
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
warning[E0507]: cannot move out of `foo` in pattern guard
|
||||
--> $DIR/borrowck-migrate-to-nll.rs:25:18
|
||||
--> $DIR/borrowck-migrate-to-nll.rs:26:18
|
||||
|
|
||||
LL | (|| { let bar = foo; bar.take() })();
|
||||
| ^^ ---
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: borrowed data cannot be stored outside of its closure
|
||||
--> $DIR/issue-45983.rs:19:27
|
||||
--> $DIR/issue-45983.rs:20:27
|
||||
|
|
||||
LL | let x = None;
|
||||
| - borrowed data cannot be stored into here...
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0521]: borrowed data escapes outside of closure
|
||||
--> $DIR/issue-45983.rs:19:18
|
||||
--> $DIR/issue-45983.rs:20:18
|
||||
|
|
||||
LL | let x = None;
|
||||
| - `x` is declared here, outside of the closure body
|
||||
|
@ -9,7 +9,7 @@ LL | give_any(|y| x = Some(y));
|
|||
| `y` is a reference that is only valid in the closure body
|
||||
|
||||
error[E0594]: cannot assign to `x`, as it is not declared as mutable
|
||||
--> $DIR/issue-45983.rs:19:18
|
||||
--> $DIR/issue-45983.rs:20:18
|
||||
|
|
||||
LL | let x = None;
|
||||
| - help: consider changing this to be mutable: `mut x`
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
// revisions, don't worry about the --compare-mode=nll on this test.
|
||||
|
||||
// ignore-compare-mode-nll
|
||||
// ignore-compare-mode-polonius
|
||||
|
||||
//[nll]compile-flags: -Z borrowck=mir
|
||||
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promote-ref-mut-in-let-issue-46557.rs:5:21
|
||||
|
|
||||
LL | let ref mut x = 1234543;
|
||||
| ^^^^^^^ creates a temporary which is freed while still in use
|
||||
LL | x
|
||||
| - borrow later used here
|
||||
LL | }
|
||||
| - temporary value is freed at the end of this statement
|
||||
|
|
||||
= note: consider using a `let` binding to create a longer lived value
|
||||
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promote-ref-mut-in-let-issue-46557.rs:10:25
|
||||
|
|
||||
LL | let (ref mut x, ) = (1234543, );
|
||||
| ^^^^^^^^^^^ creates a temporary which is freed while still in use
|
||||
LL | x
|
||||
| - borrow later used here
|
||||
LL | }
|
||||
| - temporary value is freed at the end of this statement
|
||||
|
|
||||
= note: consider using a `let` binding to create a longer lived value
|
||||
|
||||
error[E0515]: cannot return value referencing temporary value
|
||||
--> $DIR/promote-ref-mut-in-let-issue-46557.rs:15:5
|
||||
|
|
||||
LL | match 1234543 {
|
||||
| ^ ------- temporary value created here
|
||||
| _____|
|
||||
| |
|
||||
LL | | ref mut x => x
|
||||
LL | | }
|
||||
| |_____^ returns a value referencing data owned by the current function
|
||||
|
||||
error[E0515]: cannot return value referencing temporary value
|
||||
--> $DIR/promote-ref-mut-in-let-issue-46557.rs:21:5
|
||||
|
|
||||
LL | match (123443,) {
|
||||
| ^ --------- temporary value created here
|
||||
| _____|
|
||||
| |
|
||||
LL | | (ref mut x,) => x,
|
||||
LL | | }
|
||||
| |_____^ returns a value referencing data owned by the current function
|
||||
|
||||
error[E0515]: cannot return reference to temporary value
|
||||
--> $DIR/promote-ref-mut-in-let-issue-46557.rs:27:5
|
||||
|
|
||||
LL | &mut 1234543
|
||||
| ^^^^^-------
|
||||
| | |
|
||||
| | temporary value created here
|
||||
| returns a reference to data owned by the current function
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0515, E0716.
|
||||
For more information about an error, try `rustc --explain E0515`.
|
|
@ -1,5 +1,5 @@
|
|||
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/two-phase-reservation-sharing-interference-2.rs:18:5
|
||||
--> $DIR/two-phase-reservation-sharing-interference-2.rs:19:5
|
||||
|
|
||||
LL | let shared = &v;
|
||||
| -- immutable borrow occurs here
|
||||
|
@ -11,7 +11,7 @@ LL | v.extend(shared);
|
|||
| mutable borrow occurs here
|
||||
|
||||
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/two-phase-reservation-sharing-interference-2.rs:28:5
|
||||
--> $DIR/two-phase-reservation-sharing-interference-2.rs:29:5
|
||||
|
|
||||
LL | v.extend(&v);
|
||||
| ^^------^--^
|
||||
|
@ -21,7 +21,7 @@ LL | v.extend(&v);
|
|||
| mutable borrow occurs here
|
||||
|
||||
warning: cannot borrow `v` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/two-phase-reservation-sharing-interference-2.rs:39:5
|
||||
--> $DIR/two-phase-reservation-sharing-interference-2.rs:40:5
|
||||
|
|
||||
LL | let shared = &v;
|
||||
| -- immutable borrow occurs here
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/two-phase-reservation-sharing-interference-2.rs:18:5
|
||||
--> $DIR/two-phase-reservation-sharing-interference-2.rs:19:5
|
||||
|
|
||||
LL | let shared = &v;
|
||||
| -- immutable borrow occurs here
|
||||
|
@ -11,7 +11,7 @@ LL | v.extend(shared);
|
|||
| mutable borrow occurs here
|
||||
|
||||
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/two-phase-reservation-sharing-interference-2.rs:28:5
|
||||
--> $DIR/two-phase-reservation-sharing-interference-2.rs:29:5
|
||||
|
|
||||
LL | v.extend(&v);
|
||||
| ^^------^--^
|
||||
|
@ -21,7 +21,7 @@ LL | v.extend(&v);
|
|||
| mutable borrow occurs here
|
||||
|
||||
warning: cannot borrow `v` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/two-phase-reservation-sharing-interference-2.rs:39:5
|
||||
--> $DIR/two-phase-reservation-sharing-interference-2.rs:40:5
|
||||
|
|
||||
LL | let shared = &v;
|
||||
| -- immutable borrow occurs here
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/two-phase-reservation-sharing-interference-2.rs:18:5
|
||||
--> $DIR/two-phase-reservation-sharing-interference-2.rs:19:5
|
||||
|
|
||||
LL | let shared = &v;
|
||||
| -- immutable borrow occurs here
|
||||
|
@ -10,7 +10,7 @@ LL | v.extend(shared);
|
|||
| mutable borrow occurs here
|
||||
|
||||
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/two-phase-reservation-sharing-interference-2.rs:28:5
|
||||
--> $DIR/two-phase-reservation-sharing-interference-2.rs:29:5
|
||||
|
|
||||
LL | v.extend(&v);
|
||||
| ^^------^--^
|
||||
|
@ -20,7 +20,7 @@ LL | v.extend(&v);
|
|||
| mutable borrow occurs here
|
||||
|
||||
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/two-phase-reservation-sharing-interference-2.rs:39:5
|
||||
--> $DIR/two-phase-reservation-sharing-interference-2.rs:40:5
|
||||
|
|
||||
LL | let shared = &v;
|
||||
| -- immutable borrow occurs here
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/two-phase-reservation-sharing-interference-2.rs:18:5
|
||||
--> $DIR/two-phase-reservation-sharing-interference-2.rs:19:5
|
||||
|
|
||||
LL | let shared = &v;
|
||||
| -- immutable borrow occurs here
|
||||
|
@ -10,7 +10,7 @@ LL | v.extend(shared);
|
|||
| mutable borrow occurs here
|
||||
|
||||
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/two-phase-reservation-sharing-interference-2.rs:28:5
|
||||
--> $DIR/two-phase-reservation-sharing-interference-2.rs:29:5
|
||||
|
|
||||
LL | v.extend(&v);
|
||||
| ^^------^--^
|
||||
|
@ -20,7 +20,7 @@ LL | v.extend(&v);
|
|||
| mutable borrow occurs here
|
||||
|
||||
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/two-phase-reservation-sharing-interference-2.rs:39:5
|
||||
--> $DIR/two-phase-reservation-sharing-interference-2.rs:40:5
|
||||
|
|
||||
LL | let shared = &v;
|
||||
| -- immutable borrow occurs here
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
// everyone else.
|
||||
|
||||
//ignore-compare-mode-nll
|
||||
//ignore-compare-mode-polonius
|
||||
|
||||
//revisions: migrate2015 migrate2018 nll2015 nll2018
|
||||
|
||||
|
|
|
@ -0,0 +1,148 @@
|
|||
error[E0503]: cannot use `self.cx` because it was mutably borrowed
|
||||
--> $DIR/two-phase-surprise-no-conflict.rs:21:23
|
||||
|
|
||||
LL | let _mut_borrow = &mut *self;
|
||||
| ---------- borrow of `*self` occurs here
|
||||
LL | let _access = self.cx;
|
||||
| ^^^^^^^ use of borrowed `*self`
|
||||
LL |
|
||||
LL | _mut_borrow;
|
||||
| ----------- borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `*self` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/two-phase-surprise-no-conflict.rs:57:17
|
||||
|
|
||||
LL | self.hash_expr(&self.cx_mut.body(eid).value);
|
||||
| ^^^^^---------^^-----------^^^^^^^^^^^^^^^^^
|
||||
| | | |
|
||||
| | | immutable borrow occurs here
|
||||
| | immutable borrow later used by call
|
||||
| mutable borrow occurs here
|
||||
|
||||
error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
|
||||
--> $DIR/two-phase-surprise-no-conflict.rs:119:51
|
||||
|
|
||||
LL | reg.register_static(Box::new(TrivialPass::new(&mut reg.sess_mut)));
|
||||
| --- --------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
|
||||
| | |
|
||||
| | first borrow later used by call
|
||||
| first mutable borrow occurs here
|
||||
|
||||
error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
|
||||
--> $DIR/two-phase-surprise-no-conflict.rs:122:54
|
||||
|
|
||||
LL | reg.register_bound(Box::new(TrivialPass::new_mut(&mut reg.sess_mut)));
|
||||
| --- -------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
|
||||
| | |
|
||||
| | first borrow later used by call
|
||||
| first mutable borrow occurs here
|
||||
|
||||
error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
|
||||
--> $DIR/two-phase-surprise-no-conflict.rs:125:53
|
||||
|
|
||||
LL | reg.register_univ(Box::new(TrivialPass::new_mut(&mut reg.sess_mut)));
|
||||
| --- ------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
|
||||
| | |
|
||||
| | first borrow later used by call
|
||||
| first mutable borrow occurs here
|
||||
|
||||
error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
|
||||
--> $DIR/two-phase-surprise-no-conflict.rs:128:44
|
||||
|
|
||||
LL | reg.register_ref(&TrivialPass::new_mut(&mut reg.sess_mut));
|
||||
| --- ------------ ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
|
||||
| | |
|
||||
| | first borrow later used by call
|
||||
| first mutable borrow occurs here
|
||||
|
||||
error[E0502]: cannot borrow `*reg` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/two-phase-surprise-no-conflict.rs:138:5
|
||||
|
|
||||
LL | reg.register_bound(Box::new(CapturePass::new(®.sess_mut)));
|
||||
| ^^^^--------------^^^^^^^^^^^^^^^^^^^^^^^^^^^-------------^^^
|
||||
| | | |
|
||||
| | | immutable borrow occurs here
|
||||
| | immutable borrow later used by call
|
||||
| mutable borrow occurs here
|
||||
|
||||
error[E0502]: cannot borrow `*reg` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/two-phase-surprise-no-conflict.rs:141:5
|
||||
|
|
||||
LL | reg.register_univ(Box::new(CapturePass::new(®.sess_mut)));
|
||||
| ^^^^-------------^^^^^^^^^^^^^^^^^^^^^^^^^^^-------------^^^
|
||||
| | | |
|
||||
| | | immutable borrow occurs here
|
||||
| | immutable borrow later used by call
|
||||
| mutable borrow occurs here
|
||||
|
||||
error[E0502]: cannot borrow `*reg` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/two-phase-surprise-no-conflict.rs:144:5
|
||||
|
|
||||
LL | reg.register_ref(&CapturePass::new(®.sess_mut));
|
||||
| ^^^^------------^^^^^^^^^^^^^^^^^^^-------------^^
|
||||
| | | |
|
||||
| | | immutable borrow occurs here
|
||||
| | immutable borrow later used by call
|
||||
| mutable borrow occurs here
|
||||
|
||||
error[E0499]: cannot borrow `*reg` as mutable more than once at a time
|
||||
--> $DIR/two-phase-surprise-no-conflict.rs:154:5
|
||||
|
|
||||
LL | reg.register_bound(Box::new(CapturePass::new_mut(&mut reg.sess_mut)));
|
||||
| ^^^^--------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------------^^^
|
||||
| | | |
|
||||
| | | first mutable borrow occurs here
|
||||
| | first borrow later used by call
|
||||
| second mutable borrow occurs here
|
||||
|
||||
error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
|
||||
--> $DIR/two-phase-surprise-no-conflict.rs:154:54
|
||||
|
|
||||
LL | reg.register_bound(Box::new(CapturePass::new_mut(&mut reg.sess_mut)));
|
||||
| --- -------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
|
||||
| | |
|
||||
| | first borrow later used by call
|
||||
| first mutable borrow occurs here
|
||||
|
||||
error[E0499]: cannot borrow `*reg` as mutable more than once at a time
|
||||
--> $DIR/two-phase-surprise-no-conflict.rs:158:5
|
||||
|
|
||||
LL | reg.register_univ(Box::new(CapturePass::new_mut(&mut reg.sess_mut)));
|
||||
| ^^^^-------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------------^^^
|
||||
| | | |
|
||||
| | | first mutable borrow occurs here
|
||||
| | first borrow later used by call
|
||||
| second mutable borrow occurs here
|
||||
|
||||
error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
|
||||
--> $DIR/two-phase-surprise-no-conflict.rs:158:53
|
||||
|
|
||||
LL | reg.register_univ(Box::new(CapturePass::new_mut(&mut reg.sess_mut)));
|
||||
| --- ------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
|
||||
| | |
|
||||
| | first borrow later used by call
|
||||
| first mutable borrow occurs here
|
||||
|
||||
error[E0499]: cannot borrow `*reg` as mutable more than once at a time
|
||||
--> $DIR/two-phase-surprise-no-conflict.rs:162:5
|
||||
|
|
||||
LL | reg.register_ref(&CapturePass::new_mut(&mut reg.sess_mut));
|
||||
| ^^^^------------^^^^^^^^^^^^^^^^^^^^^^^-----------------^^
|
||||
| | | |
|
||||
| | | first mutable borrow occurs here
|
||||
| | first borrow later used by call
|
||||
| second mutable borrow occurs here
|
||||
|
||||
error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time
|
||||
--> $DIR/two-phase-surprise-no-conflict.rs:162:44
|
||||
|
|
||||
LL | reg.register_ref(&CapturePass::new_mut(&mut reg.sess_mut));
|
||||
| --- ------------ ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
|
||||
| | |
|
||||
| | first borrow later used by call
|
||||
| first mutable borrow occurs here
|
||||
|
||||
error: aborting due to 15 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0499, E0502, E0503.
|
||||
For more information about an error, try `rustc --explain E0499`.
|
|
@ -0,0 +1,29 @@
|
|||
error[E0597]: `y` does not live long enough
|
||||
--> $DIR/promote_const_let.rs:4:9
|
||||
|
|
||||
LL | let x: &'static u32 = {
|
||||
| - borrow later stored here
|
||||
LL | let y = 42;
|
||||
LL | &y
|
||||
| ^^ borrowed value does not live long enough
|
||||
LL | };
|
||||
| - `y` dropped here while still borrowed
|
||||
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/promote_const_let.rs:6:28
|
||||
|
|
||||
LL | let x: &'static u32 = &{
|
||||
| ____________------------____^
|
||||
| | |
|
||||
| | type annotation requires that borrow lasts for `'static`
|
||||
LL | | let y = 42;
|
||||
LL | | y
|
||||
LL | | };
|
||||
| |_____^ creates a temporary which is freed while still in use
|
||||
LL | }
|
||||
| - temporary value is freed at the end of this statement
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0597, E0716.
|
||||
For more information about an error, try `rustc --explain E0597`.
|
|
@ -0,0 +1,74 @@
|
|||
error[E0597]: `o2` does not live long enough
|
||||
--> $DIR/dropck_trait_cycle_checked.rs:111:13
|
||||
|
|
||||
LL | o1.set0(&o2);
|
||||
| ^^^ borrowed value does not live long enough
|
||||
...
|
||||
LL | }
|
||||
| -
|
||||
| |
|
||||
| `o2` dropped here while still borrowed
|
||||
| borrow might be used here, when `o2` is dropped and runs the destructor for type `std::boxed::Box<dyn Obj<'_>>`
|
||||
|
||||
error[E0597]: `o3` does not live long enough
|
||||
--> $DIR/dropck_trait_cycle_checked.rs:112:13
|
||||
|
|
||||
LL | o1.set1(&o3);
|
||||
| ^^^ borrowed value does not live long enough
|
||||
...
|
||||
LL | }
|
||||
| -
|
||||
| |
|
||||
| `o3` dropped here while still borrowed
|
||||
| borrow might be used here, when `o3` is dropped and runs the destructor for type `std::boxed::Box<dyn Obj<'_>>`
|
||||
|
||||
error[E0597]: `o2` does not live long enough
|
||||
--> $DIR/dropck_trait_cycle_checked.rs:113:13
|
||||
|
|
||||
LL | let (o1, o2, o3): (Box<dyn Obj>, Box<dyn Obj>, Box<dyn Obj>) = (O::new(), O::new(), O::new());
|
||||
| -------- cast requires that `o2` is borrowed for `'static`
|
||||
...
|
||||
LL | o2.set0(&o2);
|
||||
| ^^^ borrowed value does not live long enough
|
||||
...
|
||||
LL | }
|
||||
| - `o2` dropped here while still borrowed
|
||||
|
||||
error[E0597]: `o3` does not live long enough
|
||||
--> $DIR/dropck_trait_cycle_checked.rs:114:13
|
||||
|
|
||||
LL | let (o1, o2, o3): (Box<dyn Obj>, Box<dyn Obj>, Box<dyn Obj>) = (O::new(), O::new(), O::new());
|
||||
| -------- cast requires that `o3` is borrowed for `'static`
|
||||
...
|
||||
LL | o2.set1(&o3);
|
||||
| ^^^ borrowed value does not live long enough
|
||||
...
|
||||
LL | }
|
||||
| - `o3` dropped here while still borrowed
|
||||
|
||||
error[E0597]: `o1` does not live long enough
|
||||
--> $DIR/dropck_trait_cycle_checked.rs:115:13
|
||||
|
|
||||
LL | o3.set0(&o1);
|
||||
| ^^^ borrowed value does not live long enough
|
||||
LL | o3.set1(&o2);
|
||||
LL | }
|
||||
| -
|
||||
| |
|
||||
| `o1` dropped here while still borrowed
|
||||
| borrow might be used here, when `o1` is dropped and runs the destructor for type `std::boxed::Box<dyn Obj<'_>>`
|
||||
|
||||
error[E0597]: `o2` does not live long enough
|
||||
--> $DIR/dropck_trait_cycle_checked.rs:116:13
|
||||
|
|
||||
LL | let (o1, o2, o3): (Box<dyn Obj>, Box<dyn Obj>, Box<dyn Obj>) = (O::new(), O::new(), O::new());
|
||||
| -------- cast requires that `o2` is borrowed for `'static`
|
||||
...
|
||||
LL | o3.set1(&o2);
|
||||
| ^^^ borrowed value does not live long enough
|
||||
LL | }
|
||||
| - `o2` dropped here while still borrowed
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0597`.
|
|
@ -0,0 +1 @@
|
|||
{"artifact":"$TEST_BUILD_DIR/emit-artifact-notifications.polonius/libemit_artifact_notifications.rmeta","emit":"metadata"}
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
// Don't use compare-mode=nll, since that turns on NLL.
|
||||
// ignore-compare-mode-nll
|
||||
// ignore-compare-mode-polonius
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
warning[E0502]: cannot borrow `*x.1` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/feature-gate-nll.rs:14:13
|
||||
--> $DIR/feature-gate-nll.rs:15:13
|
||||
|
|
||||
LL | let m = &mut x;
|
||||
| ------ mutable borrow occurs here
|
||||
|
@ -14,7 +14,7 @@ LL | m;
|
|||
= note: for more information, try `rustc --explain E0729`
|
||||
|
||||
error: compilation successful
|
||||
--> $DIR/feature-gate-nll.rs:10:1
|
||||
--> $DIR/feature-gate-nll.rs:11:1
|
||||
|
|
||||
LL | / fn main() {
|
||||
LL | | let mut x = (33, &0);
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
error[E0597]: `b` does not live long enough
|
||||
--> $DIR/ref-escapes-but-not-over-yield.rs:11:13
|
||||
|
|
||||
LL | let mut b = move || {
|
||||
| _________________-
|
||||
LL | | yield();
|
||||
LL | | let b = 5;
|
||||
LL | | a = &b;
|
||||
| | ^^ borrowed value does not live long enough
|
||||
LL | |
|
||||
LL | | };
|
||||
| | -
|
||||
| | |
|
||||
| | `b` dropped here while still borrowed
|
||||
| |_____... and the borrow might be used here, when that temporary is dropped and runs the destructor for generator
|
||||
| a temporary with access to the borrow is created here ...
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0597`.
|
|
@ -1,11 +1,11 @@
|
|||
error: implementation of `Stream` is not general enough
|
||||
--> $DIR/issue-30786.rs:107:22
|
||||
--> $DIR/issue-30786.rs:108:22
|
||||
|
|
||||
LL | let map = source.map(|x: &_| x);
|
||||
| ^^^
|
||||
|
|
||||
= note: `Stream` would have to be implemented for the type `&'0 mut Map<Repeat, [closure@$DIR/issue-30786.rs:107:26: 107:35]>`, for any lifetime `'0`
|
||||
= note: but `Stream` is actually implemented for the type `&'1 mut Map<Repeat, [closure@$DIR/issue-30786.rs:107:26: 107:35]>`, for some specific lifetime `'1`
|
||||
= note: `Stream` would have to be implemented for the type `&'0 mut Map<Repeat, [closure@$DIR/issue-30786.rs:108:26: 108:35]>`, for any lifetime `'0`
|
||||
= note: but `Stream` is actually implemented for the type `&'1 mut Map<Repeat, [closure@$DIR/issue-30786.rs:108:26: 108:35]>`, for some specific lifetime `'1`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
error: higher-ranked subtype error
|
||||
--> $DIR/issue-30786.rs:111:18
|
||||
--> $DIR/issue-30786.rs:112:18
|
||||
|
|
||||
LL | let filter = map.filter(|x: &_| true);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: higher-ranked subtype error
|
||||
--> $DIR/issue-30786.rs:113:17
|
||||
--> $DIR/issue-30786.rs:114:17
|
||||
|
|
||||
LL | let count = filter.count(); // Assert that we still have a valid stream.
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
// revisions, don't worry about the --compare-mode=nll on this test.
|
||||
|
||||
// ignore-compare-mode-nll
|
||||
// ignore-compare-mode-polonius
|
||||
|
||||
//[nll]compile-flags: -Z borrowck=mir
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
warning[E0713]: borrow may still be in use when destructor runs
|
||||
--> $DIR/issue-45696-scribble-on-boxed-borrow.rs:51:5
|
||||
--> $DIR/issue-45696-scribble-on-boxed-borrow.rs:52:5
|
||||
|
|
||||
LL | fn scribbled<'a>(s: Scribble<'a>) -> &'a mut u32 {
|
||||
| -- lifetime `'a` defined here
|
||||
|
@ -14,7 +14,7 @@ LL | }
|
|||
= note: for more information, try `rustc --explain E0729`
|
||||
|
||||
warning[E0713]: borrow may still be in use when destructor runs
|
||||
--> $DIR/issue-45696-scribble-on-boxed-borrow.rs:62:5
|
||||
--> $DIR/issue-45696-scribble-on-boxed-borrow.rs:63:5
|
||||
|
|
||||
LL | fn boxed_scribbled<'a>(s: Box<Scribble<'a>>) -> &'a mut u32 {
|
||||
| -- lifetime `'a` defined here
|
||||
|
@ -29,7 +29,7 @@ LL | }
|
|||
= note: for more information, try `rustc --explain E0729`
|
||||
|
||||
warning[E0713]: borrow may still be in use when destructor runs
|
||||
--> $DIR/issue-45696-scribble-on-boxed-borrow.rs:73:5
|
||||
--> $DIR/issue-45696-scribble-on-boxed-borrow.rs:74:5
|
||||
|
|
||||
LL | fn boxed_boxed_scribbled<'a>(s: Box<Box<Scribble<'a>>>) -> &'a mut u32 {
|
||||
| -- lifetime `'a` defined here
|
||||
|
@ -44,7 +44,7 @@ LL | }
|
|||
= note: for more information, try `rustc --explain E0729`
|
||||
|
||||
error: compilation successful
|
||||
--> $DIR/issue-45696-scribble-on-boxed-borrow.rs:80:1
|
||||
--> $DIR/issue-45696-scribble-on-boxed-borrow.rs:81:1
|
||||
|
|
||||
LL | / fn main() {
|
||||
LL | | let mut x = 1;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0713]: borrow may still be in use when destructor runs
|
||||
--> $DIR/issue-45696-scribble-on-boxed-borrow.rs:51:5
|
||||
--> $DIR/issue-45696-scribble-on-boxed-borrow.rs:52:5
|
||||
|
|
||||
LL | fn scribbled<'a>(s: Scribble<'a>) -> &'a mut u32 {
|
||||
| -- lifetime `'a` defined here
|
||||
|
@ -10,7 +10,7 @@ LL | }
|
|||
| - here, drop of `s` needs exclusive access to `*s.0`, because the type `Scribble<'_>` implements the `Drop` trait
|
||||
|
||||
error[E0713]: borrow may still be in use when destructor runs
|
||||
--> $DIR/issue-45696-scribble-on-boxed-borrow.rs:62:5
|
||||
--> $DIR/issue-45696-scribble-on-boxed-borrow.rs:63:5
|
||||
|
|
||||
LL | fn boxed_scribbled<'a>(s: Box<Scribble<'a>>) -> &'a mut u32 {
|
||||
| -- lifetime `'a` defined here
|
||||
|
@ -21,7 +21,7 @@ LL | }
|
|||
| - here, drop of `s` needs exclusive access to `*s.0`, because the type `Scribble<'_>` implements the `Drop` trait
|
||||
|
||||
error[E0713]: borrow may still be in use when destructor runs
|
||||
--> $DIR/issue-45696-scribble-on-boxed-borrow.rs:73:5
|
||||
--> $DIR/issue-45696-scribble-on-boxed-borrow.rs:74:5
|
||||
|
|
||||
LL | fn boxed_boxed_scribbled<'a>(s: Box<Box<Scribble<'a>>>) -> &'a mut u32 {
|
||||
| -- lifetime `'a` defined here
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
// revisions: nll migrate
|
||||
// ignore-compare-mode-nll
|
||||
// ignore-compare-mode-polonius
|
||||
|
||||
// This test is going to pass in the migrate revision, because the AST-borrowck
|
||||
// accepted this code in the past (see notes below). So we use `#[rustc_error]`
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/get_default.rs:32:17
|
||||
|
|
||||
LL | match map.get() {
|
||||
| --- immutable borrow occurs here
|
||||
LL | Some(v) => {
|
||||
LL | map.set(String::new()); // Both AST and MIR error here
|
||||
| ^^^ mutable borrow occurs here
|
||||
LL |
|
||||
LL | return v;
|
||||
| - immutable borrow later used here
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0502`.
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue