Skip to content

Rollup of 12 pull requests #46410

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
f9bbcf9
Update compiler-builtins and use it the 128-bit lowering MIR test
scottmcm Nov 25, 2017
c80fee2
Remove the unneeded #![feature(lang_items)]s
scottmcm Nov 27, 2017
677381a
On type mismatch error highlight `&` when type matches
estebank Nov 28, 2017
658ea38
rustc_llvm: remove stale references
tamird Nov 26, 2017
9067d97
rustc_llvm: use cc::Build::define
tamird Nov 26, 2017
94d02b8
*: strip calls to cc::Build::compile
tamird Nov 26, 2017
dfa6c25
Fix hygiene bug.
jseyfried Nov 28, 2017
89dc8ae
incr.comp.: Remove an unnecessary HIR access which enables hashing sp…
michaelwoerister Nov 29, 2017
c60b0e4
incr.comp.: Remove on-export crate metadata hashing.
michaelwoerister Nov 29, 2017
7ebccbb
incr.comp.: Update test cases after metadata hashing removal.
michaelwoerister Nov 29, 2017
02808f1
Include lifetime on highlighted ref type mismatch
estebank Nov 29, 2017
c00ba79
Invert colors in important traits tooltip
GuillaumeGomez Nov 29, 2017
b444843
rustdoc: Fix issues with cross-crate inlined associated items
ollie27 Nov 29, 2017
326eb79
rustbuild: Fix a typo with the Cargo book
alexcrichton Nov 29, 2017
21228a8
Remove librustdoc dependency on env_logger
Aaron1011 Nov 29, 2017
5a00b7c
make coercions to `!` in unreachable code a hard error
arielb1 Nov 8, 2017
780f4ed
incr.comp.: Make traits::VTable encodable and decodable.
michaelwoerister Nov 30, 2017
224cb12
Rollup merge of #45880 - arielb1:never-coerce, r=nikomatsakis
Nov 30, 2017
80c0824
Rollup merge of #46280 - tamird:remove-old-refs, r=alexcrichton
Nov 30, 2017
c9029f2
Rollup merge of #46290 - scottmcm:i128-from-compiler-builtins, r=nagisa
Nov 30, 2017
69ebdd6
Rollup merge of #46343 - jseyfried:fix_hygiene_bug, r=nrc
Nov 30, 2017
34bd545
Rollup merge of #46349 - estebank:highlight-ref, r=arielb1
Nov 30, 2017
79d076a
Rollup merge of #46368 - michaelwoerister:incr-comp-type-debuginfo-sp…
Nov 30, 2017
b7e7b65
Rollup merge of #46370 - michaelwoerister:rm-metadata-hashing, r=eddyb
Nov 30, 2017
325af63
Rollup merge of #46384 - ollie27:rustdoc_inline_assoc, r=QuietMisdreavus
Nov 30, 2017
def8c34
Rollup merge of #46385 - alexcrichton:fix-cargo-book, r=Mark-Simulacrum
Nov 30, 2017
8521ffd
Rollup merge of #46386 - Aaron1011:fix_rustdoc_log, r=Mark-Simulacrum
Nov 30, 2017
b42e1c4
Rollup merge of #46392 - GuillaumeGomez:fix-tooltip, r=QuietMisdreavus
Nov 30, 2017
5b06023
Rollup merge of #46400 - michaelwoerister:vtable-encodable, r=eddyb
Nov 30, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ config.stamp
keywords.md
lexer.ml
src/etc/dl
src/librustc_llvm/llvmdeps.rs
tmp.*.rs
version.md
version.ml
Expand Down
1 change: 0 additions & 1 deletion src/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/bootstrap/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ impl Step for CargoBook {

let target = self.target;
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);
t!(fs::create_dir_all(&out));
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ impl Step for TestHelpers {
.warnings(false)
.debug(false)
.file(build.src.join("src/rt/rust_test_helpers.c"))
.compile("librust_test_helpers.a");
.compile("rust_test_helpers");
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/liballoc_jemalloc/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,6 @@ fn main() {
cc::Build::new()
.flag("-fvisibility=hidden")
.file("pthread_atfork_dummy.c")
.compile("libpthread_atfork_dummy.a");
.compile("pthread_atfork_dummy");
}
}
2 changes: 1 addition & 1 deletion src/libcompiler_builtins
2 changes: 1 addition & 1 deletion src/libproc_macro/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl FromStr for TokenStream {
// notify the expansion info that it is unhygienic
let mark = Mark::fresh(mark);
mark.set_expn_info(expn_info);
let span = call_site.with_ctxt(SyntaxContext::empty().apply_mark(mark));
let span = call_site.with_ctxt(call_site.ctxt().apply_mark(mark));
let stream = parse::parse_stream_from_source_str(name, src, sess, Some(span));
Ok(__internal::token_stream_wrap(stream))
})
Expand Down
2 changes: 1 addition & 1 deletion src/libprofiler_builtins/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ fn main() {
cfg.file(Path::new("../libcompiler_builtins/compiler-rt/lib/profile").join(src));
}

cfg.compile("libprofiler-rt.a");
cfg.compile("profiler-rt");
}
3 changes: 2 additions & 1 deletion src/librustc/hir/map/definitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,8 @@ impl Definitions {
self.node_to_def_index.insert(node_id, index);
}

if expansion.is_modern() {
let expansion = expansion.modern();
if expansion != Mark::root() {
self.expansions.insert(index, expansion);
}

Expand Down
20 changes: 9 additions & 11 deletions src/librustc/ich/impls_hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -884,13 +884,13 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Item {
fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'gcx>,
hasher: &mut StableHasher<W>) {
let (is_const, hash_spans) = match self.node {
let is_const = match self.node {
hir::ItemStatic(..) |
hir::ItemConst(..) => {
(true, hcx.hash_spans())
true
}
hir::ItemFn(_, _, constness, ..) => {
(constness == hir::Constness::Const, hcx.hash_spans())
constness == hir::Constness::Const
}
hir::ItemUse(..) |
hir::ItemExternCrate(..) |
Expand All @@ -904,7 +904,7 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Item {
hir::ItemEnum(..) |
hir::ItemStruct(..) |
hir::ItemUnion(..) => {
(false, false)
false
}
};

Expand All @@ -919,13 +919,11 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Item {
} = *self;

hcx.hash_hir_item_like(attrs, is_const, |hcx| {
hcx.while_hashing_spans(hash_spans, |hcx| {
name.hash_stable(hcx, hasher);
attrs.hash_stable(hcx, hasher);
node.hash_stable(hcx, hasher);
vis.hash_stable(hcx, hasher);
span.hash_stable(hcx, hasher);
});
name.hash_stable(hcx, hasher);
attrs.hash_stable(hcx, hasher);
node.hash_stable(hcx, hasher);
vis.hash_stable(hcx, hasher);
span.hash_stable(hcx, hasher);
});
}
}
Expand Down
6 changes: 0 additions & 6 deletions src/librustc/ich/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ mod impls_syntax;

pub const ATTR_DIRTY: &'static str = "rustc_dirty";
pub const ATTR_CLEAN: &'static str = "rustc_clean";
pub const ATTR_DIRTY_METADATA: &'static str = "rustc_metadata_dirty";
pub const ATTR_CLEAN_METADATA: &'static str = "rustc_metadata_clean";
pub const ATTR_IF_THIS_CHANGED: &'static str = "rustc_if_this_changed";
pub const ATTR_THEN_THIS_WOULD_NEED: &'static str = "rustc_then_this_would_need";
pub const ATTR_PARTITION_REUSED: &'static str = "rustc_partition_reused";
Expand All @@ -41,8 +39,6 @@ pub const DEP_GRAPH_ASSERT_ATTRS: &'static [&'static str] = &[
ATTR_THEN_THIS_WOULD_NEED,
ATTR_DIRTY,
ATTR_CLEAN,
ATTR_DIRTY_METADATA,
ATTR_CLEAN_METADATA,
ATTR_PARTITION_REUSED,
ATTR_PARTITION_TRANSLATED,
];
Expand All @@ -53,8 +49,6 @@ pub const IGNORED_ATTRIBUTES: &'static [&'static str] = &[
ATTR_THEN_THIS_WOULD_NEED,
ATTR_DIRTY,
ATTR_CLEAN,
ATTR_DIRTY_METADATA,
ATTR_CLEAN_METADATA,
ATTR_PARTITION_REUSED,
ATTR_PARTITION_TRANSLATED,
];
56 changes: 56 additions & 0 deletions src/librustc/infer/error_reporting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,39 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
fn cmp(&self, t1: Ty<'tcx>, t2: Ty<'tcx>)
-> (DiagnosticStyledString, DiagnosticStyledString)
{
fn equals<'tcx>(a: &Ty<'tcx>, b: &Ty<'tcx>) -> bool {
match (&a.sty, &b.sty) {
(a, b) if *a == *b => true,
(&ty::TyInt(_), &ty::TyInfer(ty::InferTy::IntVar(_))) |
(&ty::TyInfer(ty::InferTy::IntVar(_)), &ty::TyInt(_)) |
(&ty::TyInfer(ty::InferTy::IntVar(_)), &ty::TyInfer(ty::InferTy::IntVar(_))) |
(&ty::TyFloat(_), &ty::TyInfer(ty::InferTy::FloatVar(_))) |
(&ty::TyInfer(ty::InferTy::FloatVar(_)), &ty::TyFloat(_)) |
(&ty::TyInfer(ty::InferTy::FloatVar(_)),
&ty::TyInfer(ty::InferTy::FloatVar(_))) => true,
_ => false,
}
}

fn push_ty_ref<'tcx>(r: &ty::Region<'tcx>,
tnm: &ty::TypeAndMut<'tcx>,
s: &mut DiagnosticStyledString) {
let r = &format!("{}", r);
s.push_highlighted(format!("&{}{}{}",
r,
if r == "" {
""
} else {
" "
},
if tnm.mutbl == hir::MutMutable {
"mut "
} else {
""
}));
s.push_normal(format!("{}", tnm.ty));
}

match (&t1.sty, &t2.sty) {
(&ty::TyAdt(def1, sub1), &ty::TyAdt(def2, sub2)) => {
let mut values = (DiagnosticStyledString::new(), DiagnosticStyledString::new());
Expand Down Expand Up @@ -672,6 +705,29 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
DiagnosticStyledString::highlighted(format!("{}", t2)))
}
}

// When finding T != &T, hightlight only the borrow
(&ty::TyRef(r1, ref tnm1), _) if equals(&tnm1.ty, &t2) => {
let mut values = (DiagnosticStyledString::new(), DiagnosticStyledString::new());
push_ty_ref(&r1, tnm1, &mut values.0);
values.1.push_normal(format!("{}", t2));
values
}
(_, &ty::TyRef(r2, ref tnm2)) if equals(&t1, &tnm2.ty) => {
let mut values = (DiagnosticStyledString::new(), DiagnosticStyledString::new());
values.0.push_normal(format!("{}", t1));
push_ty_ref(&r2, tnm2, &mut values.1);
values
}

// When encountering &T != &mut T, highlight only the borrow
(&ty::TyRef(r1, ref tnm1), &ty::TyRef(r2, ref tnm2)) if equals(&tnm1.ty, &tnm2.ty) => {
let mut values = (DiagnosticStyledString::new(), DiagnosticStyledString::new());
push_ty_ref(&r1, tnm1, &mut values.0);
push_ty_ref(&r2, tnm2, &mut values.1);
values
}

_ => {
if t1 == t2 {
// The two types are the same, elide and don't highlight.
Expand Down
9 changes: 8 additions & 1 deletion src/librustc/lint/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,12 @@ declare_lint! {
"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
/// which are used by other parts of the compiler.
#[derive(Copy, Clone)]
Expand Down Expand Up @@ -263,7 +269,8 @@ impl LintPass for HardwiredLints {
LATE_BOUND_LIFETIME_ARGUMENTS,
DEPRECATED,
UNUSED_UNSAFE,
UNUSED_MUT
UNUSED_MUT,
COERCE_NEVER
)
}
}
Expand Down
30 changes: 2 additions & 28 deletions src/librustc/middle/cstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,32 +175,6 @@ impl EncodedMetadata {
}
}

/// The hash for some metadata that (when saving) will be exported
/// from this crate, or which (when importing) was exported by an
/// upstream crate.
#[derive(Debug, RustcEncodable, RustcDecodable, Copy, Clone)]
pub struct EncodedMetadataHash {
pub def_index: u32,
pub hash: ich::Fingerprint,
}

/// The hash for some metadata that (when saving) will be exported
/// from this crate, or which (when importing) was exported by an
/// upstream crate.
#[derive(Debug, RustcEncodable, RustcDecodable, Clone)]
pub struct EncodedMetadataHashes {
// Stable content hashes for things in crate metadata, indexed by DefIndex.
pub hashes: Vec<EncodedMetadataHash>,
}

impl EncodedMetadataHashes {
pub fn new() -> EncodedMetadataHashes {
EncodedMetadataHashes {
hashes: Vec::new(),
}
}
}

/// The backend's way to give the crate store access to the metadata in a library.
/// Note that it returns the raw metadata bytes stored in the library file, whether
/// it is compressed, uncompressed, some weird mix, etc.
Expand Down Expand Up @@ -286,7 +260,7 @@ pub trait CrateStore {
tcx: TyCtxt<'a, 'tcx, 'tcx>,
link_meta: &LinkMeta,
reachable: &NodeSet)
-> (EncodedMetadata, EncodedMetadataHashes);
-> EncodedMetadata;
fn metadata_encoding_version(&self) -> &[u8];
}

Expand Down Expand Up @@ -370,7 +344,7 @@ impl CrateStore for DummyCrateStore {
tcx: TyCtxt<'a, 'tcx, 'tcx>,
link_meta: &LinkMeta,
reachable: &NodeSet)
-> (EncodedMetadata, EncodedMetadataHashes) {
-> EncodedMetadata {
bug!("encode_metadata")
}
fn metadata_encoding_version(&self) -> &[u8] { bug!("metadata_encoding_version") }
Expand Down
2 changes: 0 additions & 2 deletions src/librustc/session/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1072,8 +1072,6 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
"attempt to recover from parse errors (experimental)"),
incremental: Option<String> = (None, parse_opt_string, [UNTRACKED],
"enable incremental compilation (experimental)"),
incremental_cc: bool = (false, parse_bool, [UNTRACKED],
"enable cross-crate incremental compilation (even more experimental)"),
incremental_queries: bool = (true, parse_bool, [UNTRACKED],
"enable incremental compilation support for queries (experimental)"),
incremental_info: bool = (false, parse_bool, [UNTRACKED],
Expand Down
16 changes: 8 additions & 8 deletions src/librustc/traits/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ pub type SelectionResult<'tcx, T> = Result<Option<T>, SelectionError<'tcx>>;
/// ### The type parameter `N`
///
/// See explanation on `VtableImplData`.
#[derive(Clone)]
#[derive(Clone, RustcEncodable, RustcDecodable)]
pub enum Vtable<'tcx, N> {
/// Vtable identifying a particular impl.
VtableImpl(VtableImplData<'tcx, N>),
Expand Down Expand Up @@ -327,14 +327,14 @@ pub enum Vtable<'tcx, N> {
/// is `Obligation`, as one might expect. During trans, however, this
/// is `()`, because trans only requires a shallow resolution of an
/// impl, and nested obligations are satisfied later.
#[derive(Clone, PartialEq, Eq)]
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable)]
pub struct VtableImplData<'tcx, N> {
pub impl_def_id: DefId,
pub substs: &'tcx Substs<'tcx>,
pub nested: Vec<N>
}

#[derive(Clone, PartialEq, Eq)]
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable)]
pub struct VtableGeneratorData<'tcx, N> {
pub closure_def_id: DefId,
pub substs: ty::ClosureSubsts<'tcx>,
Expand All @@ -343,7 +343,7 @@ pub struct VtableGeneratorData<'tcx, N> {
pub nested: Vec<N>
}

#[derive(Clone, PartialEq, Eq)]
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable)]
pub struct VtableClosureData<'tcx, N> {
pub closure_def_id: DefId,
pub substs: ty::ClosureSubsts<'tcx>,
Expand All @@ -352,20 +352,20 @@ pub struct VtableClosureData<'tcx, N> {
pub nested: Vec<N>
}

#[derive(Clone)]
#[derive(Clone, RustcEncodable, RustcDecodable)]
pub struct VtableAutoImplData<N> {
pub trait_def_id: DefId,
pub nested: Vec<N>
}

#[derive(Clone)]
#[derive(Clone, RustcEncodable, RustcDecodable)]
pub struct VtableBuiltinData<N> {
pub nested: Vec<N>
}

/// A vtable for some object-safe trait `Foo` automatically derived
/// for the object type `Foo`.
#[derive(PartialEq,Eq,Clone)]
#[derive(PartialEq, Eq, Clone, RustcEncodable, RustcDecodable)]
pub struct VtableObjectData<'tcx, N> {
/// `Foo` upcast to the obligation trait. This will be some supertrait of `Foo`.
pub upcast_trait_ref: ty::PolyTraitRef<'tcx>,
Expand All @@ -378,7 +378,7 @@ pub struct VtableObjectData<'tcx, N> {
pub nested: Vec<N>,
}

#[derive(Clone, PartialEq, Eq)]
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable)]
pub struct VtableFnPointerData<'tcx, N> {
pub fn_ty: Ty<'tcx>,
pub nested: Vec<N>
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use hir::map::DefPathHash;
use lint::{self, Lint};
use ich::{StableHashingContext, NodeIdHashingMode};
use middle::const_val::ConstVal;
use middle::cstore::{CrateStore, LinkMeta, EncodedMetadataHashes};
use middle::cstore::{CrateStore, LinkMeta};
use middle::cstore::EncodedMetadata;
use middle::free_region::FreeRegionMap;
use middle::lang_items;
Expand Down Expand Up @@ -1242,7 +1242,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {

impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
pub fn encode_metadata(self, link_meta: &LinkMeta, reachable: &NodeSet)
-> (EncodedMetadata, EncodedMetadataHashes)
-> EncodedMetadata
{
self.cstore.encode_metadata(self, link_meta, reachable)
}
Expand Down
4 changes: 1 addition & 3 deletions src/librustc/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2302,9 +2302,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
}

pub fn item_name(self, id: DefId) -> InternedString {
if let Some(id) = self.hir.as_local_node_id(id) {
self.hir.name(id).as_str()
} else if id.index == CRATE_DEF_INDEX {
if id.index == CRATE_DEF_INDEX {
self.original_crate_name(id.krate).as_str()
} else {
let def_key = self.def_key(id);
Expand Down
Loading