Skip to content

Rollup of 6 pull requests #40752

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

Merged
merged 24 commits into from
Mar 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
88d5645
dist-x86-linux: ugrade gcc to 4.8.5
TimNN Mar 1, 2017
a212002
Remove unused adt-def insertion by constructor DefIndex
cramertj Mar 21, 2017
873248d
Remove unused adt_def access by constructor in typeck/collect
cramertj Mar 21, 2017
a906d99
Correctly get source for metadata crate type;
abonander Mar 15, 2017
8a6ef50
Regression test for rust-lang/rust#40535
abonander Mar 16, 2017
9218f97
Teach rustc --emit=mir
shepmaster Feb 16, 2017
4ddedf7
Add warning about volatility of MIR output
shepmaster Mar 4, 2017
439bf13
Support more kinds of Regions in TypeIdHasher.
michaelwoerister Mar 20, 2017
bb24305
Add some missing method impls to MIR region eraser.
michaelwoerister Mar 20, 2017
8c00e63
Move Fingerprint to rustc::ich::Fingerprint.
michaelwoerister Mar 20, 2017
1445ed2
Move DefPathHashes to rustc::ich
michaelwoerister Mar 20, 2017
9af97e7
Move CachingCodemapView to rustc::ich.
michaelwoerister Mar 20, 2017
03b8091
Move some constants to rustc::ich.
michaelwoerister Mar 20, 2017
45deab4
Address review comments.
michaelwoerister Mar 21, 2017
9e0589a
Add resize() method to IndexVec.
michaelwoerister Mar 14, 2017
559127b
Implement indexed_vec::Idx for ast::NodeId
michaelwoerister Mar 14, 2017
bc259ee
Introduce HirId, a replacement for NodeId after lowering to HIR.
michaelwoerister Mar 14, 2017
090767b
Allocate numerical values of DefIndexes from two seperate ranges.
michaelwoerister Mar 16, 2017
916c0b8
Rollup merge of #39891 - shepmaster:emit-mir, r=nikomatsakis
frewsxcv Mar 23, 2017
cc98dfc
Rollup merge of #40518 - michaelwoerister:hir-id, r=eddyb
frewsxcv Mar 23, 2017
b5dad3a
Rollup merge of #40542 - abonander:issue_40535, r=jseyfried
frewsxcv Mar 23, 2017
a419ce9
Rollup merge of #40617 - TimNN:dist-update-gcc, r=alexcrichton
frewsxcv Mar 23, 2017
39e4a27
Rollup merge of #40678 - michaelwoerister:dmi-prep, r=nikomatsakis
frewsxcv Mar 23, 2017
9307418
Rollup merge of #40696 - cramertj:remove-unused-adt-def-code, r=petro…
frewsxcv Mar 23, 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: 1 addition & 0 deletions src/ci/docker/dist-x86-linux/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ RUN yum upgrade -y && yum install -y \
curl \
bzip2 \
gcc \
gcc-c++ \
make \
glibc-devel \
perl \
Expand Down
12 changes: 7 additions & 5 deletions src/ci/docker/dist-x86-linux/build-gcc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ set -ex

source shared.sh

curl https://ftp.gnu.org/gnu/gcc/gcc-4.7.4/gcc-4.7.4.tar.bz2 | tar xjf -
cd gcc-4.7.4
GCC=4.8.5

curl https://ftp.gnu.org/gnu/gcc/gcc-$GCC/gcc-$GCC.tar.bz2 | tar xjf -
cd gcc-$GCC
./contrib/download_prerequisites
mkdir ../gcc-build
cd ../gcc-build
hide_output ../gcc-4.7.4/configure \
hide_output ../gcc-$GCC/configure \
--prefix=/rustroot \
--enable-languages=c,c++
hide_output make -j10
Expand All @@ -27,5 +29,5 @@ ln -nsf gcc /rustroot/bin/cc

cd ..
rm -rf gcc-build
rm -rf gcc-4.7.4
yum erase -y gcc binutils
rm -rf gcc-$GCC
yum erase -y gcc gcc-c++ binutils
53 changes: 53 additions & 0 deletions src/librustc/hir/def_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,33 +78,86 @@ impl serialize::UseSpecializedDecodable for CrateNum {
/// A DefIndex is an index into the hir-map for a crate, identifying a
/// particular definition. It should really be considered an interned
/// shorthand for a particular DefPath.
///
/// At the moment we are allocating the numerical values of DefIndexes into two
/// ranges: the "low" range (starting at zero) and the "high" range (starting at
/// DEF_INDEX_HI_START). This allows us to allocate the DefIndexes of all
/// item-likes (Items, TraitItems, and ImplItems) into one of these ranges and
/// consequently use a simple array for lookup tables keyed by DefIndex and
/// known to be densely populated. This is especially important for the HIR map.
///
/// Since the DefIndex is mostly treated as an opaque ID, you probably
/// don't have to care about these ranges.
#[derive(Clone, Debug, Eq, Ord, PartialOrd, PartialEq, RustcEncodable,
RustcDecodable, Hash, Copy)]
pub struct DefIndex(u32);

impl DefIndex {
#[inline]
pub fn new(x: usize) -> DefIndex {
assert!(x < (u32::MAX as usize));
DefIndex(x as u32)
}

#[inline]
pub fn from_u32(x: u32) -> DefIndex {
DefIndex(x)
}

#[inline]
pub fn as_usize(&self) -> usize {
self.0 as usize
}

#[inline]
pub fn as_u32(&self) -> u32 {
self.0
}

#[inline]
pub fn address_space(&self) -> DefIndexAddressSpace {
if self.0 < DEF_INDEX_HI_START.0 {
DefIndexAddressSpace::Low
} else {
DefIndexAddressSpace::High
}
}

/// Converts this DefIndex into a zero-based array index.
/// This index is the offset within the given "range" of the DefIndex,
/// that is, if the DefIndex is part of the "high" range, the resulting
/// index will be (DefIndex - DEF_INDEX_HI_START).
#[inline]
pub fn as_array_index(&self) -> usize {
(self.0 & !DEF_INDEX_HI_START.0) as usize
}
}

/// The start of the "high" range of DefIndexes.
const DEF_INDEX_HI_START: DefIndex = DefIndex(1 << 31);

/// The crate root is always assigned index 0 by the AST Map code,
/// thanks to `NodeCollector::new`.
pub const CRATE_DEF_INDEX: DefIndex = DefIndex(0);

#[derive(Copy, Clone, Eq, PartialEq, Hash)]
pub enum DefIndexAddressSpace {
Low = 0,
High = 1,
}

impl DefIndexAddressSpace {
#[inline]
pub fn index(&self) -> usize {
*self as usize
}

#[inline]
pub fn start(&self) -> usize {
self.index() * DEF_INDEX_HI_START.as_usize()
}
}

/// A DefId identifies a particular *definition*, by combining a crate
/// index and a def index.
#[derive(Clone, Eq, Ord, PartialOrd, PartialEq, RustcEncodable, RustcDecodable, Hash, Copy)]
Expand Down
Loading