From 108293d4e93e3a9dfe6181f72459cbe32553e25f Mon Sep 17 00:00:00 2001 From: Aaron Power Date: Sun, 1 Jan 2017 20:13:59 +0000 Subject: [PATCH 01/70] Added Default impl to PathBuf --- src/libstd/path.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/libstd/path.rs b/src/libstd/path.rs index d13baea40a9..b0030504ddc 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -1254,6 +1254,13 @@ impl Borrow for PathBuf { } } +#[stable(feature = "default_for_pathbuf", since = "1.16.0")] +impl Default for PathBuf { + fn default() -> Self { + PathBuf::new() + } +} + #[stable(feature = "cow_from_path", since = "1.6.0")] impl<'a> From<&'a Path> for Cow<'a, Path> { #[inline] From ba60af3bbdde527c7944e67218bff4c6b283ad3b Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Mon, 21 Nov 2016 20:19:52 -0500 Subject: [PATCH 02/70] Document RFC 1623: static lifetime elision. --- src/doc/reference.md | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/src/doc/reference.md b/src/doc/reference.md index 9898c31282c..713e6f1ab99 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -1271,7 +1271,8 @@ guaranteed to refer to the same memory address. Constant values must not have destructors, and otherwise permit most forms of data. Constants may refer to the address of other constants, in which case the -address will have the `static` lifetime. The compiler is, however, still at +address will have the `static` lifetime. (See below on [static lifetime +elision](#static-lifetime-elision).) The compiler is, however, still at liberty to translate the constant many times, so the address referred to may not be stable. @@ -1279,7 +1280,7 @@ Constants must be explicitly typed. The type may be `bool`, `char`, a number, or a type derived from those primitive types. The derived types are references with the `static` lifetime, fixed-size arrays, tuples, enum variants, and structs. -``` +```rust const BIT1: u32 = 1 << 0; const BIT2: u32 = 1 << 1; @@ -1331,7 +1332,7 @@ running in the same process. Mutable statics are still very useful, however. They can be used with C libraries and can also be bound from C libraries (in an `extern` block). -``` +```rust # fn atomic_add(_: &mut u32, _: u32) -> u32 { 2 } static mut LEVELS: u32 = 0; @@ -1355,6 +1356,31 @@ unsafe fn bump_levels_unsafe2() -> u32 { Mutable statics have the same restrictions as normal statics, except that the type of the value is not required to ascribe to `Sync`. +#### `'static` lifetime elision + +Both constant and static declarations of reference types have *implicit* +`'static` lifetimes unless an explicit lifetime is specified. As such, the +constant declarations involving `'static` above may be written without the +lifetimes. Returning to our previous example: + +```rust +const BIT1: u32 = 1 << 0; +const BIT2: u32 = 1 << 1; + +const BITS: [u32; 2] = [BIT1, BIT2]; +const STRING: &str = "bitstring"; + +struct BitsNStrings<'a> { + mybits: [u32; 2], + mystring: &'a str, +} + +const BITS_N_STRINGS: BitsNStrings = BitsNStrings { + mybits: BITS, + mystring: STRING, +}; +``` + ### Traits A _trait_ describes an abstract interface that types can @@ -2458,9 +2484,6 @@ The currently implemented features of the reference compiler are: into a Rust program. This capability, especially the signature for the annotated function, is subject to change. -* `static_in_const` - Enables lifetime elision with a `'static` default for - `const` and `static` item declarations. - * `thread_local` - The usage of the `#[thread_local]` attribute is experimental and should be seen as unstable. This attribute is used to declare a `static` as being unique per-thread leveraging From 61fbdbba41163b6fd327b166338a8feb89133444 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 11 Jan 2017 23:12:49 +0100 Subject: [PATCH 03/70] Add Debug implementations for libcollection structs --- src/libcollections/binary_heap.rs | 60 +++++++++++++++ src/libcollections/btree/map.rs | 120 ++++++++++++++++++++++++++++++ src/libcollections/btree/set.rs | 108 +++++++++++++++++++++++++++ src/libcollections/enum_set.rs | 16 ++++ src/libcollections/lib.rs | 1 + src/libcollections/linked_list.rs | 80 ++++++++++++++++++++ src/libcollections/str.rs | 8 ++ src/libcollections/string.rs | 7 ++ src/libcollections/vec.rs | 32 ++++++++ src/libcollections/vec_deque.rs | 64 ++++++++++++++++ 10 files changed, 496 insertions(+) diff --git a/src/libcollections/binary_heap.rs b/src/libcollections/binary_heap.rs index b7c2a708baf..fca3b7b07dd 100644 --- a/src/libcollections/binary_heap.rs +++ b/src/libcollections/binary_heap.rs @@ -228,6 +228,20 @@ pub struct PeekMut<'a, T: 'a + Ord> { sift: bool, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: Ord> fmt::Debug for PeekMut<'a, T> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("PeekMut { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: Ord + fmt::Debug> fmt::Debug for PeekMut<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad(&format!("PeekMut({:?})", self.heap.data[0])) + } +} + #[stable(feature = "binary_heap_peek_mut", since = "1.12.0")] impl<'a, T: Ord> Drop for PeekMut<'a, T> { fn drop(&mut self) { @@ -968,6 +982,22 @@ pub struct Iter<'a, T: 'a> { iter: slice::Iter<'a, T>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a> fmt::Debug for Iter<'a, T> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("BinaryHeap::Iter { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("BinaryHeap::Iter") + .field(&self.iter.as_slice()) + .finish() + } +} + // FIXME(#19839) Remove in favor of `#[derive(Clone)]` #[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> Clone for Iter<'a, T> { @@ -1016,6 +1046,22 @@ pub struct IntoIter { iter: vec::IntoIter, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl fmt::Debug for IntoIter { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("BinaryHeap::IntoIter { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl fmt::Debug for IntoIter { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("BinaryHeap::IntoIter") + .field(&self.iter.as_slice()) + .finish() + } +} + #[stable(feature = "rust1", since = "1.0.0")] impl Iterator for IntoIter { type Item = T; @@ -1055,6 +1101,20 @@ pub struct Drain<'a, T: 'a> { iter: vec::Drain<'a, T>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a> fmt::Debug for Drain<'a, T> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("BinaryHeap::Drain { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a + fmt::Debug> fmt::Debug for Drain<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad(&format!("BinaryHeap::Drain({:?})", self.iter)) + } +} + #[stable(feature = "drain", since = "1.6.0")] impl<'a, T: 'a> Iterator for Drain<'a, T> { type Item = T; diff --git a/src/libcollections/btree/map.rs b/src/libcollections/btree/map.rs index 4755f8a4c55..0d8b9d4677b 100644 --- a/src/libcollections/btree/map.rs +++ b/src/libcollections/btree/map.rs @@ -270,6 +270,20 @@ pub struct Iter<'a, K: 'a, V: 'a> { length: usize, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, K: 'a, V: 'a> fmt::Debug for Iter<'a, K, V> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("BTreeMap::Iter { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Iter<'a, K, V> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_list().entries(self.clone()).finish() + } +} + /// A mutable iterator over a BTreeMap's entries. #[stable(feature = "rust1", since = "1.0.0")] pub struct IterMut<'a, K: 'a, V: 'a> { @@ -277,6 +291,20 @@ pub struct IterMut<'a, K: 'a, V: 'a> { length: usize, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, K: 'a, V: 'a> fmt::Debug for IterMut<'a, K, V> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("BTreeMap::IterMut { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for IterMut<'a, K, V> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad(&format!("BTreeMap::IterMut({:?})", self.range)) + } +} + /// An owning iterator over a BTreeMap's entries. #[stable(feature = "rust1", since = "1.0.0")] pub struct IntoIter { @@ -285,30 +313,104 @@ pub struct IntoIter { length: usize, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl fmt::Debug for IntoIter { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("BTreeMap::IntoIter { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl fmt::Debug for IntoIter { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let range = Range { + front: self.front.reborrow(), + back: self.back.reborrow(), + }; + f.debug_list().entries(range).finish() + } +} + /// An iterator over a BTreeMap's keys. #[stable(feature = "rust1", since = "1.0.0")] pub struct Keys<'a, K: 'a, V: 'a> { inner: Iter<'a, K, V>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, K: 'a, V: 'a> fmt::Debug for Keys<'a, K, V> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("BTreeMap::Keys { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Keys<'a, K, V> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_list().entries(self.inner.clone()).finish() + } +} + /// An iterator over a BTreeMap's values. #[stable(feature = "rust1", since = "1.0.0")] pub struct Values<'a, K: 'a, V: 'a> { inner: Iter<'a, K, V>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, K: 'a, V: 'a> fmt::Debug for Values<'a, K, V> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("BTreeMap::Values { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Values<'a, K, V> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_list().entries(self.inner.clone()).finish() + } +} + /// A mutable iterator over a BTreeMap's values. #[stable(feature = "map_values_mut", since = "1.10.0")] pub struct ValuesMut<'a, K: 'a, V: 'a> { inner: IterMut<'a, K, V>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, K: 'a, V: 'a> fmt::Debug for ValuesMut<'a, K, V> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("BTreeMap::ValuesMut { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for ValuesMut<'a, K, V> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad(&format!("BTreeMap::ValuesMut({:?})", self.inner)) + } +} + /// An iterator over a sub-range of BTreeMap's entries. pub struct Range<'a, K: 'a, V: 'a> { front: Handle, K, V, marker::Leaf>, marker::Edge>, back: Handle, K, V, marker::Leaf>, marker::Edge>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, K: 'a, V: 'a> fmt::Debug for Range<'a, K, V> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("BTreeMap::Range { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Range<'a, K, V> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_list().entries(self.clone()).finish() + } +} + /// A mutable iterator over a sub-range of BTreeMap's entries. pub struct RangeMut<'a, K: 'a, V: 'a> { front: Handle, K, V, marker::Leaf>, marker::Edge>, @@ -318,6 +420,24 @@ pub struct RangeMut<'a, K: 'a, V: 'a> { _marker: PhantomData<&'a mut (K, V)>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, K: 'a, V: 'a> fmt::Debug for RangeMut<'a, K, V> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("BTreeMap::RangeMut { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for RangeMut<'a, K, V> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let range = Range { + front: self.front.reborrow(), + back: self.back.reborrow(), + }; + f.debug_list().entries(range).finish() + } +} + /// A view into a single entry in a map, which may either be vacant or occupied. /// This enum is constructed from the [`entry`] method on [`BTreeMap`]. /// diff --git a/src/libcollections/btree/set.rs b/src/libcollections/btree/set.rs index f006ba95371..d9effde7204 100644 --- a/src/libcollections/btree/set.rs +++ b/src/libcollections/btree/set.rs @@ -85,6 +85,22 @@ pub struct Iter<'a, T: 'a> { iter: Keys<'a, T, ()>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a> fmt::Debug for Iter<'a, T> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("BTreeSet::Iter { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("BTreeSet::Iter") + .field(&self.iter.clone()) + .finish() + } +} + /// An owning iterator over a `BTreeSet`'s items. /// /// This structure is created by the `into_iter` method on [`BTreeSet`] @@ -96,6 +112,20 @@ pub struct IntoIter { iter: ::btree_map::IntoIter, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl fmt::Debug for IntoIter { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("BTreeSet::IntoIter { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl fmt::Debug for IntoIter { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad(&format!("BTreeSet::IntoIter({:?})", self.iter)) + } +} + /// An iterator over a sub-range of `BTreeSet`'s items. /// /// This structure is created by the [`range`] method on [`BTreeSet`]. @@ -106,6 +136,20 @@ pub struct Range<'a, T: 'a> { iter: ::btree_map::Range<'a, T, ()>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a> fmt::Debug for Range<'a, T> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("BTreeSet::Range { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a + fmt::Debug> fmt::Debug for Range<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad(&format!("BTreeSet::Range({:?})", self.iter)) + } +} + /// A lazy iterator producing elements in the set difference (in-order). /// /// This structure is created by the [`difference`] method on [`BTreeSet`]. @@ -118,6 +162,22 @@ pub struct Difference<'a, T: 'a> { b: Peekable>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a> fmt::Debug for Difference<'a, T> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("BTreeSet::Difference { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a + fmt::Debug> fmt::Debug for Difference<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("BTreeSet::Difference") + .field(&self.clone()) + .finish() + } +} + /// A lazy iterator producing elements in the set symmetric difference (in-order). /// /// This structure is created by the [`symmetric_difference`] method on @@ -131,6 +191,22 @@ pub struct SymmetricDifference<'a, T: 'a> { b: Peekable>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a> fmt::Debug for SymmetricDifference<'a, T> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("BTreeSet::SymmetricDifference { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a + fmt::Debug> fmt::Debug for SymmetricDifference<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("BTreeSet::SymmetricDifference") + .field(&self.clone()) + .finish() + } +} + /// A lazy iterator producing elements in the set intersection (in-order). /// /// This structure is created by the [`intersection`] method on [`BTreeSet`]. @@ -143,6 +219,22 @@ pub struct Intersection<'a, T: 'a> { b: Peekable>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a> fmt::Debug for Intersection<'a, T> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("BTreeSet::Intersection { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a + fmt::Debug> fmt::Debug for Intersection<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("BTreeSet::Intersection") + .field(&self.clone()) + .finish() + } +} + /// A lazy iterator producing elements in the set union (in-order). /// /// This structure is created by the [`union`] method on [`BTreeSet`]. @@ -155,6 +247,22 @@ pub struct Union<'a, T: 'a> { b: Peekable>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a> fmt::Debug for Union<'a, T> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("BTreeSet::Union { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a + fmt::Debug> fmt::Debug for Union<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("BTreeSet::Union") + .field(&self.clone()) + .finish() + } +} + impl BTreeSet { /// Makes a new `BTreeSet` with a reasonable choice of B. /// diff --git a/src/libcollections/enum_set.rs b/src/libcollections/enum_set.rs index 87bc5e59ef7..3e739fa4f95 100644 --- a/src/libcollections/enum_set.rs +++ b/src/libcollections/enum_set.rs @@ -220,6 +220,22 @@ pub struct Iter { marker: marker::PhantomData, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl fmt::Debug for Iter { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("EnumSet::Iter { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl fmt::Debug for Iter { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("EnumSet::Iter") + .field(&self.clone()) + .finish() + } +} + // FIXME(#19839) Remove in favor of `#[derive(Clone)]` impl Clone for Iter { fn clone(&self) -> Iter { diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs index 561d8860dc8..92d0d4d3c54 100644 --- a/src/libcollections/lib.rs +++ b/src/libcollections/lib.rs @@ -28,6 +28,7 @@ #![cfg_attr(test, allow(deprecated))] // rand #![deny(warnings)] +#![deny(missing_debug_implementations)] #![feature(alloc)] #![feature(allow_internal_unstable)] diff --git a/src/libcollections/linked_list.rs b/src/libcollections/linked_list.rs index 7f913d4afe4..112749d5b05 100644 --- a/src/libcollections/linked_list.rs +++ b/src/libcollections/linked_list.rs @@ -65,6 +65,22 @@ pub struct Iter<'a, T: 'a> { marker: PhantomData<&'a Node>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a> fmt::Debug for Iter<'a, T> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("LinkedList::Iter { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("LinkedList::Iter") + .field(&self.clone()) + .finish() + } +} + // FIXME #19839: deriving is too aggressive on the bounds (T doesn't need to be Clone). #[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> Clone for Iter<'a, T> { @@ -82,6 +98,22 @@ pub struct IterMut<'a, T: 'a> { len: usize, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a> fmt::Debug for IterMut<'a, T> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("LinkedList::IterMut { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a + fmt::Debug> fmt::Debug for IterMut<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("LinkedList::IterMut") + .field(self.clone()) + .finish() + } +} + /// An iterator over the elements of a `LinkedList`. #[derive(Clone)] #[stable(feature = "rust1", since = "1.0.0")] @@ -89,6 +121,22 @@ pub struct IntoIter { list: LinkedList, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl fmt::Debug for IntoIter { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("LinkedList::IntoIter { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl fmt::Debug for IntoIter { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("LinkedList::IntoIter") + .field(self.clone()) + .finish() + } +} + impl Node { fn new(element: T) -> Self { Node { @@ -1077,6 +1125,22 @@ pub struct FrontPlace<'a, T: 'a> { node: IntermediateBox>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a> fmt::Debug for FrontPlace<'a, T> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("LinkedList::FrontPlace { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a + fmt::Debug> fmt::Debug for FrontPlace<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("LinkedList::FrontPlace") + .field(self.clone()) + .finish() + } +} + #[unstable(feature = "collection_placement", reason = "placement protocol is subject to change", issue = "30172")] @@ -1121,6 +1185,22 @@ pub struct BackPlace<'a, T: 'a> { node: IntermediateBox>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a> fmt::Debug for BackPlace<'a, T> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("LinkedList::BackPlace { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a + fmt::Debug> fmt::Debug for BackPlace<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("LinkedList::BackPlace") + .field(self.clone()) + .finish() + } +} + #[unstable(feature = "collection_placement", reason = "placement protocol is subject to change", issue = "30172")] diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index 70cedce9a90..8dbddbb41d7 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -19,6 +19,7 @@ // It's cleaner to just turn off the unused_imports warning than to fix them. #![allow(unused_imports)] +use core::fmt; use core::str as core_str; use core::str::pattern::Pattern; use core::str::pattern::{Searcher, ReverseSearcher, DoubleEndedSearcher}; @@ -122,6 +123,13 @@ pub struct EncodeUtf16<'a> { encoder: Utf16Encoder>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a> fmt::Debug for EncodeUtf16<'a> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("EncodeUtf16 { .. }") + } +} + #[stable(feature = "encode_utf16", since = "1.8.0")] impl<'a> Iterator for EncodeUtf16<'a> { type Item = u16; diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index 5210c25b4e5..1a9849f2352 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -1979,6 +1979,13 @@ pub struct Drain<'a> { iter: Chars<'a>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a> fmt::Debug for Drain<'a> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("String::Drain { .. }") + } +} + #[stable(feature = "drain", since = "1.6.0")] unsafe impl<'a> Sync for Drain<'a> {} #[stable(feature = "drain", since = "1.6.0")] diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index 4b05f8062e8..4f6212a1709 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -2092,6 +2092,22 @@ pub struct Drain<'a, T: 'a> { vec: Shared>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a> fmt::Debug for Drain<'a, T> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("Vec::Drain { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a + fmt::Debug> fmt::Debug for Drain<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("Vec::Drain") + .field(&self.iter.as_slice()) + .finish() + } +} + #[stable(feature = "drain", since = "1.6.0")] unsafe impl<'a, T: Sync> Sync for Drain<'a, T> {} #[stable(feature = "drain", since = "1.6.0")] @@ -2162,6 +2178,22 @@ pub struct PlaceBack<'a, T: 'a> { vec: &'a mut Vec, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a> fmt::Debug for PlaceBack<'a, T> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("Vec::PlaceBack { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a + fmt::Debug> fmt::Debug for PlaceBack<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("Vec::PlaceBack") + .field(&self.vec.as_slice()) + .finish() + } +} + #[unstable(feature = "collection_placement", reason = "placement protocol is subject to change", issue = "30172")] diff --git a/src/libcollections/vec_deque.rs b/src/libcollections/vec_deque.rs index fea2d111f47..dfbfb240f46 100644 --- a/src/libcollections/vec_deque.rs +++ b/src/libcollections/vec_deque.rs @@ -1866,6 +1866,22 @@ pub struct Iter<'a, T: 'a> { head: usize, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a> fmt::Debug for Iter<'a, T> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("VecDeque::Iter { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("VecDeque::Iter") + .field(&self.clone()) + .finish() + } +} + // FIXME(#19839) Remove in favor of `#[derive(Clone)]` #[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> Clone for Iter<'a, T> { @@ -1938,6 +1954,22 @@ pub struct IterMut<'a, T: 'a> { head: usize, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a> fmt::Debug for IterMut<'a, T> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("VecDeque::IterMut { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a + fmt::Debug> fmt::Debug for IterMut<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("VecDeque::IterMut") + .field(&self.clone()) + .finish() + } +} + #[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> Iterator for IterMut<'a, T> { type Item = &'a mut T; @@ -2004,6 +2036,22 @@ pub struct IntoIter { inner: VecDeque, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl fmt::Debug for IntoIter { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("VecDeque::IntoIter { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl fmt::Debug for IntoIter { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("VecDeque::IntoIter") + .field(&self.clone()) + .finish() + } +} + #[stable(feature = "rust1", since = "1.0.0")] impl Iterator for IntoIter { type Item = T; @@ -2047,6 +2095,22 @@ pub struct Drain<'a, T: 'a> { deque: Shared>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a> fmt::Debug for Drain<'a, T> { + default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.pad("VecDeque::Drain { .. }") + } +} + +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: 'a + fmt::Debug> fmt::Debug for Drain<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("VecDeque::Drain") + .field(&self.clone()) + .finish() + } +} + #[stable(feature = "drain", since = "1.6.0")] unsafe impl<'a, T: Sync> Sync for Drain<'a, T> {} #[stable(feature = "drain", since = "1.6.0")] From ba841f056e888549ef0bec0f79262ae65444d0fd Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 20 Jan 2017 13:05:02 +0100 Subject: [PATCH 04/70] Remove Debug implementations specialization --- src/libcollections/binary_heap.rs | 36 ++++---------------- src/libcollections/btree/map.rs | 56 ------------------------------- src/libcollections/btree/set.rs | 49 --------------------------- src/libcollections/enum_set.rs | 7 ---- src/libcollections/linked_list.rs | 35 ------------------- src/libcollections/vec.rs | 14 -------- src/libcollections/vec_deque.rs | 28 ---------------- 7 files changed, 6 insertions(+), 219 deletions(-) diff --git a/src/libcollections/binary_heap.rs b/src/libcollections/binary_heap.rs index fca3b7b07dd..93b864a007f 100644 --- a/src/libcollections/binary_heap.rs +++ b/src/libcollections/binary_heap.rs @@ -228,17 +228,12 @@ pub struct PeekMut<'a, T: 'a + Ord> { sift: bool, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: Ord> fmt::Debug for PeekMut<'a, T> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("PeekMut { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, T: Ord + fmt::Debug> fmt::Debug for PeekMut<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad(&format!("PeekMut({:?})", self.heap.data[0])) + f.debug_tuple("PeekMut") + .field(&self.heap.data[0]) + .finish() } } @@ -982,13 +977,6 @@ pub struct Iter<'a, T: 'a> { iter: slice::Iter<'a, T>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: 'a> fmt::Debug for Iter<'a, T> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("BinaryHeap::Iter { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -1046,13 +1034,6 @@ pub struct IntoIter { iter: vec::IntoIter, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl fmt::Debug for IntoIter { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("BinaryHeap::IntoIter { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl fmt::Debug for IntoIter { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -1101,17 +1082,12 @@ pub struct Drain<'a, T: 'a> { iter: vec::Drain<'a, T>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: 'a> fmt::Debug for Drain<'a, T> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("BinaryHeap::Drain { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for Drain<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad(&format!("BinaryHeap::Drain({:?})", self.iter)) + f.debug_tuple("BinaryHeap::Drain") + .field(&self.iter) + .finish() } } diff --git a/src/libcollections/btree/map.rs b/src/libcollections/btree/map.rs index 0d8b9d4677b..eb6a8ea26a3 100644 --- a/src/libcollections/btree/map.rs +++ b/src/libcollections/btree/map.rs @@ -270,13 +270,6 @@ pub struct Iter<'a, K: 'a, V: 'a> { length: usize, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, K: 'a, V: 'a> fmt::Debug for Iter<'a, K, V> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("BTreeMap::Iter { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Iter<'a, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -291,13 +284,6 @@ pub struct IterMut<'a, K: 'a, V: 'a> { length: usize, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, K: 'a, V: 'a> fmt::Debug for IterMut<'a, K, V> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("BTreeMap::IterMut { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for IterMut<'a, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -313,13 +299,6 @@ pub struct IntoIter { length: usize, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl fmt::Debug for IntoIter { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("BTreeMap::IntoIter { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl fmt::Debug for IntoIter { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -337,13 +316,6 @@ pub struct Keys<'a, K: 'a, V: 'a> { inner: Iter<'a, K, V>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, K: 'a, V: 'a> fmt::Debug for Keys<'a, K, V> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("BTreeMap::Keys { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Keys<'a, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -357,13 +329,6 @@ pub struct Values<'a, K: 'a, V: 'a> { inner: Iter<'a, K, V>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, K: 'a, V: 'a> fmt::Debug for Values<'a, K, V> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("BTreeMap::Values { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Values<'a, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -377,13 +342,6 @@ pub struct ValuesMut<'a, K: 'a, V: 'a> { inner: IterMut<'a, K, V>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, K: 'a, V: 'a> fmt::Debug for ValuesMut<'a, K, V> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("BTreeMap::ValuesMut { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for ValuesMut<'a, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -397,13 +355,6 @@ pub struct Range<'a, K: 'a, V: 'a> { back: Handle, K, V, marker::Leaf>, marker::Edge>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, K: 'a, V: 'a> fmt::Debug for Range<'a, K, V> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("BTreeMap::Range { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Range<'a, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -420,13 +371,6 @@ pub struct RangeMut<'a, K: 'a, V: 'a> { _marker: PhantomData<&'a mut (K, V)>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, K: 'a, V: 'a> fmt::Debug for RangeMut<'a, K, V> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("BTreeMap::RangeMut { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for RangeMut<'a, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { diff --git a/src/libcollections/btree/set.rs b/src/libcollections/btree/set.rs index d9effde7204..f90d0df768b 100644 --- a/src/libcollections/btree/set.rs +++ b/src/libcollections/btree/set.rs @@ -85,13 +85,6 @@ pub struct Iter<'a, T: 'a> { iter: Keys<'a, T, ()>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: 'a> fmt::Debug for Iter<'a, T> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("BTreeSet::Iter { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -112,13 +105,6 @@ pub struct IntoIter { iter: ::btree_map::IntoIter, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl fmt::Debug for IntoIter { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("BTreeSet::IntoIter { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl fmt::Debug for IntoIter { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -136,13 +122,6 @@ pub struct Range<'a, T: 'a> { iter: ::btree_map::Range<'a, T, ()>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: 'a> fmt::Debug for Range<'a, T> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("BTreeSet::Range { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for Range<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -162,13 +141,6 @@ pub struct Difference<'a, T: 'a> { b: Peekable>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: 'a> fmt::Debug for Difference<'a, T> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("BTreeSet::Difference { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for Difference<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -191,13 +163,6 @@ pub struct SymmetricDifference<'a, T: 'a> { b: Peekable>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: 'a> fmt::Debug for SymmetricDifference<'a, T> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("BTreeSet::SymmetricDifference { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for SymmetricDifference<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -219,13 +184,6 @@ pub struct Intersection<'a, T: 'a> { b: Peekable>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: 'a> fmt::Debug for Intersection<'a, T> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("BTreeSet::Intersection { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for Intersection<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -247,13 +205,6 @@ pub struct Union<'a, T: 'a> { b: Peekable>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: 'a> fmt::Debug for Union<'a, T> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("BTreeSet::Union { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for Union<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { diff --git a/src/libcollections/enum_set.rs b/src/libcollections/enum_set.rs index 3e739fa4f95..e4498c17617 100644 --- a/src/libcollections/enum_set.rs +++ b/src/libcollections/enum_set.rs @@ -220,13 +220,6 @@ pub struct Iter { marker: marker::PhantomData, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl fmt::Debug for Iter { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("EnumSet::Iter { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl fmt::Debug for Iter { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { diff --git a/src/libcollections/linked_list.rs b/src/libcollections/linked_list.rs index 112749d5b05..21be9ac1aab 100644 --- a/src/libcollections/linked_list.rs +++ b/src/libcollections/linked_list.rs @@ -65,13 +65,6 @@ pub struct Iter<'a, T: 'a> { marker: PhantomData<&'a Node>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: 'a> fmt::Debug for Iter<'a, T> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("LinkedList::Iter { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -98,13 +91,6 @@ pub struct IterMut<'a, T: 'a> { len: usize, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: 'a> fmt::Debug for IterMut<'a, T> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("LinkedList::IterMut { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for IterMut<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -121,13 +107,6 @@ pub struct IntoIter { list: LinkedList, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl fmt::Debug for IntoIter { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("LinkedList::IntoIter { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl fmt::Debug for IntoIter { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -1125,13 +1104,6 @@ pub struct FrontPlace<'a, T: 'a> { node: IntermediateBox>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: 'a> fmt::Debug for FrontPlace<'a, T> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("LinkedList::FrontPlace { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for FrontPlace<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -1185,13 +1157,6 @@ pub struct BackPlace<'a, T: 'a> { node: IntermediateBox>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: 'a> fmt::Debug for BackPlace<'a, T> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("LinkedList::BackPlace { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for BackPlace<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index 4f6212a1709..2b6343782b1 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -2092,13 +2092,6 @@ pub struct Drain<'a, T: 'a> { vec: Shared>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: 'a> fmt::Debug for Drain<'a, T> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("Vec::Drain { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for Drain<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -2178,13 +2171,6 @@ pub struct PlaceBack<'a, T: 'a> { vec: &'a mut Vec, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: 'a> fmt::Debug for PlaceBack<'a, T> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("Vec::PlaceBack { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for PlaceBack<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { diff --git a/src/libcollections/vec_deque.rs b/src/libcollections/vec_deque.rs index dfbfb240f46..11aacb0ff43 100644 --- a/src/libcollections/vec_deque.rs +++ b/src/libcollections/vec_deque.rs @@ -1866,13 +1866,6 @@ pub struct Iter<'a, T: 'a> { head: usize, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: 'a> fmt::Debug for Iter<'a, T> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("VecDeque::Iter { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -1954,13 +1947,6 @@ pub struct IterMut<'a, T: 'a> { head: usize, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: 'a> fmt::Debug for IterMut<'a, T> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("VecDeque::IterMut { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for IterMut<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -2036,13 +2022,6 @@ pub struct IntoIter { inner: VecDeque, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl fmt::Debug for IntoIter { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("VecDeque::IntoIter { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl fmt::Debug for IntoIter { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -2095,13 +2074,6 @@ pub struct Drain<'a, T: 'a> { deque: Shared>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: 'a> fmt::Debug for Drain<'a, T> { - default fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("VecDeque::Drain { .. }") - } -} - #[stable(feature = "collection_debug", since = "1.15.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for Drain<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { From 668af801cfe80e6cae350b2587f99bbe869ec96e Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 20 Jan 2017 21:51:01 +0100 Subject: [PATCH 05/70] Add debug implementation for BinaryHeapPlace --- src/libcollections/binary_heap.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/libcollections/binary_heap.rs b/src/libcollections/binary_heap.rs index 93b864a007f..b9d90c358fe 100644 --- a/src/libcollections/binary_heap.rs +++ b/src/libcollections/binary_heap.rs @@ -1236,6 +1236,15 @@ where T: Clone + Ord { place: vec::PlaceBack<'a, T>, } +#[stable(feature = "collection_debug", since = "1.15.0")] +impl<'a, T: Clone + Ord + fmt::Debug> fmt::Debug for BinaryHeapPlace<'a, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("BinaryHeapPlace") + .field(&self) + .finish() + } +} + #[unstable(feature = "collection_placement", reason = "placement protocol is subject to change", issue = "30172")] From e8cb83a8237d79f4c8523f4b8df5e73688cfb8bb Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Sat, 28 Jan 2017 09:42:32 -0500 Subject: [PATCH 06/70] Add feature flag to reference docs for RFC 1623. --- src/doc/reference.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/doc/reference.md b/src/doc/reference.md index 713e6f1ab99..c6fc2ea4059 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -1356,7 +1356,7 @@ unsafe fn bump_levels_unsafe2() -> u32 { Mutable statics have the same restrictions as normal statics, except that the type of the value is not required to ascribe to `Sync`. -#### `'static` lifetime elision +#### `'static` lifetime elision [unstable] Both constant and static declarations of reference types have *implicit* `'static` lifetimes unless an explicit lifetime is specified. As such, the @@ -1364,6 +1364,7 @@ constant declarations involving `'static` above may be written without the lifetimes. Returning to our previous example: ```rust +#[feature(static_in_const)] const BIT1: u32 = 1 << 0; const BIT2: u32 = 1 << 1; From 3f0ca5578051f67046abb04d053118439b162f87 Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Sat, 28 Jan 2017 12:45:54 -0500 Subject: [PATCH 07/70] Change placement of `[Unstable]` marker in RFC 1623 docs. --- src/doc/reference.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/doc/reference.md b/src/doc/reference.md index c6fc2ea4059..dd3ccb82211 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -1356,12 +1356,12 @@ unsafe fn bump_levels_unsafe2() -> u32 { Mutable statics have the same restrictions as normal statics, except that the type of the value is not required to ascribe to `Sync`. -#### `'static` lifetime elision [unstable] +#### `'static` lifetime elision -Both constant and static declarations of reference types have *implicit* -`'static` lifetimes unless an explicit lifetime is specified. As such, the -constant declarations involving `'static` above may be written without the -lifetimes. Returning to our previous example: +[Unstable] Both constant and static declarations of reference types have +*implicit* `'static` lifetimes unless an explicit lifetime is specified. As +such, the constant declarations involving `'static` above may be written +without the lifetimes. Returning to our previous example: ```rust #[feature(static_in_const)] From 87dcbcada247560d9ce5df28dd76034182e5b492 Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Sat, 28 Jan 2017 12:53:17 -0800 Subject: [PATCH 08/70] add From<[u8; n]> impls for IpAddr --- src/libstd/net/ip.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/libstd/net/ip.rs b/src/libstd/net/ip.rs index 7803cf728f2..cfd06dfcdd5 100644 --- a/src/libstd/net/ip.rs +++ b/src/libstd/net/ip.rs @@ -656,6 +656,13 @@ impl From<[u8; 4]> for Ipv4Addr { } } +#[stable(feature = "ip_from_slice", since = "1.17.0")] +impl From<[u8; 4]> for IpAddr { + fn from(octets: [u8; 4]) -> IpAddr { + IpAddr::V4(Ipv4Addr::from(octets)) + } +} + impl Ipv6Addr { /// Creates a new IPv6 address from eight 16-bit segments. /// @@ -1166,6 +1173,21 @@ impl From<[u16; 8]> for Ipv6Addr { } } + +#[stable(feature = "ip_from_slice", since = "1.17.0")] +impl From<[u8; 16]> for IpAddr { + fn from(octets: [u8; 16]) -> IpAddr { + IpAddr::V6(Ipv6Addr::from(octets)) + } +} + +#[stable(feature = "ip_from_slice", since = "1.17.0")] +impl From<[u16; 8]> for IpAddr { + fn from(octets: [u16; 8]) -> IpAddr { + IpAddr::V6(Ipv6Addr::from(octets)) + } +} + // Tests for this module #[cfg(all(test, not(target_os = "emscripten")))] mod tests { From 1747ce25ad122e1b330eeb1eaf4e2d67f10b355d Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sat, 28 Jan 2017 13:38:06 -0800 Subject: [PATCH 09/70] Add support for test suites emulated in QEMU This commit adds support to the build system to execute test suites that cannot run natively but can instead run inside of a QEMU emulator. A proof-of-concept builder was added for the `arm-unknown-linux-gnueabihf` target to show off how this might work. In general the architecture is to have a server running inside of the emulator which a local client connects to. The protocol between the server/client supports compiling tests on the host and running them on the target inside the emulator. Closes #33114 --- .travis.yml | 1 + configure | 1 + src/Cargo.lock | 8 + src/Cargo.toml | 2 + src/bootstrap/check.rs | 117 +- src/bootstrap/compile.rs | 8 +- src/bootstrap/config.rs | 9 + src/bootstrap/lib.rs | 11 + src/bootstrap/step.rs | 55 +- src/ci/docker/armhf-gnu/Dockerfile | 90 + src/ci/docker/armhf-gnu/addentropy.c | 43 + src/ci/docker/armhf-gnu/rcS | 28 + src/ci/docker/armhf-gnu/vexpress_config | 2910 +++++++++++++++++ src/ci/run.sh | 12 +- src/libstd/sys/unix/process/process_common.rs | 6 +- src/test/run-pass/fds-are-cloexec.rs | 2 +- src/tools/compiletest/src/common.rs | 3 + src/tools/compiletest/src/main.rs | 10 + src/tools/compiletest/src/runtest.rs | 40 +- src/tools/qemu-test-client/Cargo.toml | 6 + src/tools/qemu-test-client/src/main.rs | 221 ++ src/tools/qemu-test-server/Cargo.toml | 6 + src/tools/qemu-test-server/src/main.rs | 232 ++ 23 files changed, 3772 insertions(+), 49 deletions(-) create mode 100644 src/ci/docker/armhf-gnu/Dockerfile create mode 100644 src/ci/docker/armhf-gnu/addentropy.c create mode 100644 src/ci/docker/armhf-gnu/rcS create mode 100644 src/ci/docker/armhf-gnu/vexpress_config create mode 100644 src/tools/qemu-test-client/Cargo.toml create mode 100644 src/tools/qemu-test-client/src/main.rs create mode 100644 src/tools/qemu-test-server/Cargo.toml create mode 100644 src/tools/qemu-test-server/src/main.rs diff --git a/.travis.yml b/.travis.yml index 8a7dc96b34b..85a8814752d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,7 @@ matrix: include: # Linux builders, all docker images - env: IMAGE=android DEPLOY=1 + - env: IMAGE=armhf-gnu - env: IMAGE=cross DEPLOY=1 - env: IMAGE=linux-tested-targets DEPLOY=1 - env: IMAGE=dist-arm-linux DEPLOY=1 diff --git a/configure b/configure index 505767cede5..49b5275d3ff 100755 --- a/configure +++ b/configure @@ -684,6 +684,7 @@ valopt musl-root-arm "" "arm-unknown-linux-musleabi install directory" valopt musl-root-armhf "" "arm-unknown-linux-musleabihf install directory" valopt musl-root-armv7 "" "armv7-unknown-linux-musleabihf install directory" valopt extra-filename "" "Additional data that is hashed and passed to the -C extra-filename flag" +valopt qemu-armhf-rootfs "" "rootfs in qemu testing, you probably don't want to use this" if [ -e ${CFG_SRC_DIR}.git ] then diff --git a/src/Cargo.lock b/src/Cargo.lock index 93bbf0f227b..ccb2827e21a 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -221,6 +221,14 @@ dependencies = [ "syntax_pos 0.0.0", ] +[[package]] +name = "qemu-test-client" +version = "0.1.0" + +[[package]] +name = "qemu-test-server" +version = "0.1.0" + [[package]] name = "rand" version = "0.0.0" diff --git a/src/Cargo.toml b/src/Cargo.toml index 0db26ea5ae0..d8dedd11f35 100644 --- a/src/Cargo.toml +++ b/src/Cargo.toml @@ -11,6 +11,8 @@ members = [ "tools/rustbook", "tools/tidy", "tools/build-manifest", + "tools/qemu-test-client", + "tools/qemu-test-server", ] # Curiously, compiletest will segfault if compiled with opt-level=3 on 64-bit diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs index 4aca843558f..6df925f924d 100644 --- a/src/bootstrap/check.rs +++ b/src/bootstrap/check.rs @@ -26,7 +26,7 @@ use build_helper::output; use {Build, Compiler, Mode}; use dist; -use util::{self, dylib_path, dylib_path_var}; +use util::{self, dylib_path, dylib_path_var, exe}; const ADB_TEST_DIR: &'static str = "/data/tmp"; @@ -221,6 +221,12 @@ pub fn compiletest(build: &Build, .arg("--llvm-cxxflags").arg(""); } + if build.qemu_rootfs(target).is_some() { + cmd.arg("--qemu-test-client") + .arg(build.tool(&Compiler::new(0, &build.config.build), + "qemu-test-client")); + } + // Running a C compiler on MSVC requires a few env vars to be set, to be // sure to set them here. // @@ -403,9 +409,9 @@ pub fn krate(build: &Build, dylib_path.insert(0, build.sysroot_libdir(&compiler, target)); cargo.env(dylib_path_var(), env::join_paths(&dylib_path).unwrap()); - if target.contains("android") { - cargo.arg("--no-run"); - } else if target.contains("emscripten") { + if target.contains("android") || + target.contains("emscripten") || + build.qemu_rootfs(target).is_some() { cargo.arg("--no-run"); } @@ -423,6 +429,9 @@ pub fn krate(build: &Build, } else if target.contains("emscripten") { build.run(&mut cargo); krate_emscripten(build, &compiler, target, mode); + } else if build.qemu_rootfs(target).is_some() { + build.run(&mut cargo); + krate_qemu(build, &compiler, target, mode); } else { cargo.args(&build.flags.cmd.test_args()); build.run(&mut cargo); @@ -480,23 +489,46 @@ fn krate_emscripten(build: &Build, compiler: &Compiler, target: &str, mode: Mode) { - let mut tests = Vec::new(); - let out_dir = build.cargo_out(compiler, mode, target); - find_tests(&out_dir, target, &mut tests); - find_tests(&out_dir.join("deps"), target, &mut tests); + let mut tests = Vec::new(); + let out_dir = build.cargo_out(compiler, mode, target); + find_tests(&out_dir, target, &mut tests); + find_tests(&out_dir.join("deps"), target, &mut tests); - for test in tests { - let test_file_name = test.to_string_lossy().into_owned(); - println!("running {}", test_file_name); - let nodejs = build.config.nodejs.as_ref().expect("nodejs not configured"); - let mut cmd = Command::new(nodejs); - cmd.arg(&test_file_name); - if build.config.quiet_tests { - cmd.arg("--quiet"); - } - build.run(&mut cmd); - } - } + for test in tests { + let test_file_name = test.to_string_lossy().into_owned(); + println!("running {}", test_file_name); + let nodejs = build.config.nodejs.as_ref().expect("nodejs not configured"); + let mut cmd = Command::new(nodejs); + cmd.arg(&test_file_name); + if build.config.quiet_tests { + cmd.arg("--quiet"); + } + build.run(&mut cmd); + } +} + +fn krate_qemu(build: &Build, + compiler: &Compiler, + target: &str, + mode: Mode) { + let mut tests = Vec::new(); + let out_dir = build.cargo_out(compiler, mode, target); + find_tests(&out_dir, target, &mut tests); + find_tests(&out_dir.join("deps"), target, &mut tests); + + let tool = build.tool(&Compiler::new(0, &build.config.build), + "qemu-test-client"); + for test in tests { + let mut cmd = Command::new(&tool); + cmd.arg("run") + .arg(&test); + if build.config.quiet_tests { + cmd.arg("--quiet"); + } + cmd.args(&build.flags.cmd.test_args()); + build.run(&mut cmd); + } +} fn find_tests(dir: &Path, @@ -516,13 +548,15 @@ fn find_tests(dir: &Path, } } -pub fn android_copy_libs(build: &Build, - compiler: &Compiler, - target: &str) { - if !target.contains("android") { - return +pub fn emulator_copy_libs(build: &Build, compiler: &Compiler, target: &str) { + if target.contains("android") { + android_copy_libs(build, compiler, target) + } else if let Some(s) = build.qemu_rootfs(target) { + qemu_copy_libs(build, compiler, target, s) } +} +fn android_copy_libs(build: &Build, compiler: &Compiler, target: &str) { println!("Android copy libs to emulator ({})", target); build.run(Command::new("adb").arg("wait-for-device")); build.run(Command::new("adb").arg("remount")); @@ -548,6 +582,39 @@ pub fn android_copy_libs(build: &Build, } } +fn qemu_copy_libs(build: &Build, + compiler: &Compiler, + target: &str, + rootfs: &Path) { + println!("QEMU copy libs to emulator ({})", target); + assert!(target.starts_with("arm"), "only works with arm for now"); + t!(fs::create_dir_all(build.out.join("tmp"))); + + // Copy our freshly compiled test server over to the rootfs + let server = build.cargo_out(compiler, Mode::Tool, target) + .join(exe("qemu-test-server", target)); + t!(fs::copy(&server, rootfs.join("testd"))); + + // Spawn the emulator and wait for it to come online + let tool = build.tool(&Compiler::new(0, &build.config.build), + "qemu-test-client"); + build.run(Command::new(&tool) + .arg("spawn-emulator") + .arg(rootfs) + .arg(build.out.join("tmp"))); + + // Push all our dylibs to the emulator + for f in t!(build.sysroot_libdir(compiler, target).read_dir()) { + let f = t!(f); + let name = f.file_name().into_string().unwrap(); + if util::is_dylib(&name) { + build.run(Command::new(&tool) + .arg("push") + .arg(f.path())); + } + } +} + /// Run "distcheck", a 'make check' from a tarball pub fn distcheck(build: &Build) { if build.config.build != "x86_64-unknown-linux-gnu" { diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 7c35151a6d2..398ca1b2f22 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -382,10 +382,10 @@ fn add_to_sysroot(out_dir: &Path, sysroot_dst: &Path) { /// /// This will build the specified tool with the specified `host` compiler in /// `stage` into the normal cargo output directory. -pub fn tool(build: &Build, stage: u32, host: &str, tool: &str) { - println!("Building stage{} tool {} ({})", stage, tool, host); +pub fn tool(build: &Build, stage: u32, target: &str, tool: &str) { + println!("Building stage{} tool {} ({})", stage, tool, target); - let compiler = Compiler::new(stage, host); + let compiler = Compiler::new(stage, &build.config.build); // FIXME: need to clear out previous tool and ideally deps, may require // isolating output directories or require a pseudo shim step to @@ -396,7 +396,7 @@ pub fn tool(build: &Build, stage: u32, host: &str, tool: &str) { // let out_dir = build.cargo_out(stage, &host, Mode::Librustc, target); // build.clear_if_dirty(&out_dir, &libstd_stamp(build, stage, &host, target)); - let mut cargo = build.cargo(&compiler, Mode::Tool, host, "build"); + let mut cargo = build.cargo(&compiler, Mode::Tool, target, "build"); cargo.arg("--manifest-path") .arg(build.src.join(format!("src/tools/{}/Cargo.toml", tool))); diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index e035f8157ff..351ac446b49 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -114,6 +114,7 @@ pub struct Target { pub cxx: Option, pub ndk: Option, pub musl_root: Option, + pub qemu_rootfs: Option, } /// Structure of the `config.toml` file that configuration is read from. @@ -222,6 +223,7 @@ struct TomlTarget { cxx: Option, android_ndk: Option, musl_root: Option, + qemu_rootfs: Option, } impl Config { @@ -360,6 +362,7 @@ impl Config { target.cxx = cfg.cxx.clone().map(PathBuf::from); target.cc = cfg.cc.clone().map(PathBuf::from); target.musl_root = cfg.musl_root.clone().map(PathBuf::from); + target.qemu_rootfs = cfg.qemu_rootfs.clone().map(PathBuf::from); config.target_config.insert(triple.clone(), target); } @@ -562,6 +565,12 @@ impl Config { .map(|s| s.to_string()) .collect(); } + "CFG_QEMU_ARMHF_ROOTFS" if value.len() > 0 => { + let target = "arm-unknown-linux-gnueabihf".to_string(); + let target = self.target_config.entry(target) + .or_insert(Target::default()); + target.qemu_rootfs = Some(parse_configure_path(value)); + } _ => {} } } diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index db2fe2db813..6347e08ca58 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -886,6 +886,17 @@ impl Build { .map(|p| &**p) } + /// Returns the root of the "rootfs" image that this target will be using, + /// if one was configured. + /// + /// If `Some` is returned then that means that tests for this target are + /// emulated with QEMU and binaries will need to be shipped to the emulator. + fn qemu_rootfs(&self, target: &str) -> Option<&Path> { + self.config.target_config.get(target) + .and_then(|t| t.qemu_rootfs.as_ref()) + .map(|p| &**p) + } + /// Path to the python interpreter to use fn python(&self) -> &Path { self.config.python.as_ref().unwrap() diff --git a/src/bootstrap/step.rs b/src/bootstrap/step.rs index 3932a7cf8c5..ee5b61062fe 100644 --- a/src/bootstrap/step.rs +++ b/src/bootstrap/step.rs @@ -295,7 +295,7 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules { .dep(|s| s.name("libtest")) .dep(|s| s.name("tool-compiletest").target(s.host).stage(0)) .dep(|s| s.name("test-helpers")) - .dep(|s| s.name("android-copy-libs")) + .dep(|s| s.name("emulator-copy-libs")) .default(mode != "pretty") // pretty tests don't run everywhere .run(move |s| { check::compiletest(build, &s.compiler(), s.target, mode, dir) @@ -333,7 +333,7 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules { .dep(|s| s.name("tool-compiletest").target(s.host).stage(0)) .dep(|s| s.name("test-helpers")) .dep(|s| s.name("debugger-scripts")) - .dep(|s| s.name("android-copy-libs")) + .dep(|s| s.name("emulator-copy-libs")) .run(move |s| check::compiletest(build, &s.compiler(), s.target, "debuginfo-gdb", "debuginfo")); let mut rule = rules.test("check-debuginfo", "src/test/debuginfo"); @@ -387,14 +387,14 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules { for (krate, path, _default) in krates("std_shim") { rules.test(&krate.test_step, path) .dep(|s| s.name("libtest")) - .dep(|s| s.name("android-copy-libs")) + .dep(|s| s.name("emulator-copy-libs")) .run(move |s| check::krate(build, &s.compiler(), s.target, Mode::Libstd, TestKind::Test, Some(&krate.name))); } rules.test("check-std-all", "path/to/nowhere") .dep(|s| s.name("libtest")) - .dep(|s| s.name("android-copy-libs")) + .dep(|s| s.name("emulator-copy-libs")) .default(true) .run(move |s| check::krate(build, &s.compiler(), s.target, Mode::Libstd, TestKind::Test, None)); @@ -403,14 +403,14 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules { for (krate, path, _default) in krates("std_shim") { rules.bench(&krate.bench_step, path) .dep(|s| s.name("libtest")) - .dep(|s| s.name("android-copy-libs")) + .dep(|s| s.name("emulator-copy-libs")) .run(move |s| check::krate(build, &s.compiler(), s.target, Mode::Libstd, TestKind::Bench, Some(&krate.name))); } rules.bench("bench-std-all", "path/to/nowhere") .dep(|s| s.name("libtest")) - .dep(|s| s.name("android-copy-libs")) + .dep(|s| s.name("emulator-copy-libs")) .default(true) .run(move |s| check::krate(build, &s.compiler(), s.target, Mode::Libstd, TestKind::Bench, None)); @@ -418,21 +418,21 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules { for (krate, path, _default) in krates("test_shim") { rules.test(&krate.test_step, path) .dep(|s| s.name("libtest")) - .dep(|s| s.name("android-copy-libs")) + .dep(|s| s.name("emulator-copy-libs")) .run(move |s| check::krate(build, &s.compiler(), s.target, Mode::Libtest, TestKind::Test, Some(&krate.name))); } rules.test("check-test-all", "path/to/nowhere") .dep(|s| s.name("libtest")) - .dep(|s| s.name("android-copy-libs")) + .dep(|s| s.name("emulator-copy-libs")) .default(true) .run(move |s| check::krate(build, &s.compiler(), s.target, Mode::Libtest, TestKind::Test, None)); for (krate, path, _default) in krates("rustc-main") { rules.test(&krate.test_step, path) .dep(|s| s.name("librustc")) - .dep(|s| s.name("android-copy-libs")) + .dep(|s| s.name("emulator-copy-libs")) .host(true) .run(move |s| check::krate(build, &s.compiler(), s.target, Mode::Librustc, TestKind::Test, @@ -440,7 +440,7 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules { } rules.test("check-rustc-all", "path/to/nowhere") .dep(|s| s.name("librustc")) - .dep(|s| s.name("android-copy-libs")) + .dep(|s| s.name("emulator-copy-libs")) .default(true) .host(true) .run(move |s| check::krate(build, &s.compiler(), s.target, @@ -481,9 +481,34 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules { rules.build("test-helpers", "src/rt/rust_test_helpers.c") .run(move |s| native::test_helpers(build, s.target)); - rules.test("android-copy-libs", "path/to/nowhere") + + // Some test suites are run inside emulators, and most of our test binaries + // are linked dynamically which means we need to ship the standard library + // and such to the emulator ahead of time. This step represents this and is + // a dependency of all test suites. + // + // Most of the time this step is a noop (the `check::emulator_copy_libs` + // only does work if necessary). For some steps such as shipping data to + // QEMU we have to build our own tools so we've got conditional dependencies + // on those programs as well. Note that the QEMU client is built for the + // build target (us) and the server is built for the target. + rules.test("emulator-copy-libs", "path/to/nowhere") .dep(|s| s.name("libtest")) - .run(move |s| check::android_copy_libs(build, &s.compiler(), s.target)); + .dep(move |s| { + if build.qemu_rootfs(s.target).is_some() { + s.name("tool-qemu-test-client").target(s.host).stage(0) + } else { + Step::noop() + } + }) + .dep(move |s| { + if build.qemu_rootfs(s.target).is_some() { + s.name("tool-qemu-test-server") + } else { + Step::noop() + } + }) + .run(move |s| check::emulator_copy_libs(build, &s.compiler(), s.target)); rules.test("check-bootstrap", "src/bootstrap") .default(true) @@ -516,6 +541,12 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules { rules.build("tool-build-manifest", "src/tools/build-manifest") .dep(|s| s.name("libstd")) .run(move |s| compile::tool(build, s.stage, s.target, "build-manifest")); + rules.build("tool-qemu-test-server", "src/tools/qemu-test-server") + .dep(|s| s.name("libstd")) + .run(move |s| compile::tool(build, s.stage, s.target, "qemu-test-server")); + rules.build("tool-qemu-test-client", "src/tools/qemu-test-client") + .dep(|s| s.name("libstd")) + .run(move |s| compile::tool(build, s.stage, s.target, "qemu-test-client")); // ======================================================================== // Documentation targets diff --git a/src/ci/docker/armhf-gnu/Dockerfile b/src/ci/docker/armhf-gnu/Dockerfile new file mode 100644 index 00000000000..e64f65438cb --- /dev/null +++ b/src/ci/docker/armhf-gnu/Dockerfile @@ -0,0 +1,90 @@ +FROM ubuntu:16.04 + +RUN apt-get update -y && apt-get install -y --no-install-recommends \ + bc \ + bzip2 \ + ca-certificates \ + cmake \ + cpio \ + curl \ + file \ + g++ \ + gcc-arm-linux-gnueabihf \ + git \ + libc6-dev \ + libc6-dev-armhf-cross \ + make \ + python2.7 \ + qemu-system-arm \ + xz-utils + +ENV ARCH=arm \ + CROSS_COMPILE=arm-linux-gnueabihf- + +WORKDIR /build + +# Compile the kernel that we're going to run and be emulating with. This is +# basically just done to be compatible with the QEMU target that we're going +# to be using when running tests. If any other kernel works or if any +# other QEMU target works with some other stock kernel, we can use that too! +# +# The `vexpress_config` config file was a previously generated config file for +# the kernel. This file was generated by running `make vexpress_defconfig` +# followed by `make menuconfig` and then enabling the IPv6 protocol page. +COPY vexpress_config /build/.config +RUN curl https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.4.42.tar.xz | \ + tar xJf - && \ + cd /build/linux-4.4.42 && \ + cp /build/.config . && \ + make -j$(nproc) all && \ + cp arch/arm/boot/zImage /tmp && \ + cd /build && \ + rm -rf linux-4.4.42 + +# Compile an instance of busybox as this provides a lightweight system and init +# binary which we will boot into. Only trick here is configuring busybox to +# build static binaries. +RUN curl https://www.busybox.net/downloads/busybox-1.21.1.tar.bz2 | tar xjf - && \ + cd busybox-1.21.1 && \ + make defconfig && \ + sed -i 's/.*CONFIG_STATIC.*/CONFIG_STATIC=y/' .config && \ + make -j$(nproc) && \ + make install && \ + mv _install /tmp/rootfs && \ + cd /build && \ + rm -rf busybox-1.12.1 + +# Download the ubuntu rootfs, which we'll use as a chroot for all our tests. +WORKDIR /tmp +RUN mkdir rootfs/ubuntu +RUN curl http://cdimage.ubuntu.com/ubuntu-base/releases/16.04/release/ubuntu-base-16.04-core-armhf.tar.gz | \ + tar xzf - -C rootfs/ubuntu && \ + cd rootfs && mkdir proc sys dev etc etc/init.d + +# Copy over our init script, which starts up our test server and also a few +# other misc tasks. +COPY rcS rootfs/etc/init.d/rcS +RUN chmod +x rootfs/etc/init.d/rcS + +# Helper to quickly fill the entropy pool in the kernel. +COPY addentropy.c /tmp/ +RUN arm-linux-gnueabihf-gcc addentropy.c -o rootfs/addentropy -static + +# TODO: What is this?! +RUN curl -O http://ftp.nl.debian.org/debian/dists/jessie/main/installer-armhf/current/images/device-tree/vexpress-v2p-ca15-tc1.dtb + +ENV SCCACHE_DIGEST=7237e38e029342fa27b7ac25412cb9d52554008b12389727320bd533fd7f05b6a96d55485f305caf95e5c8f5f97c3313e10012ccad3e752aba2518f3522ba783 +RUN curl -L https://api.pub.build.mozilla.org/tooltool/sha512/$SCCACHE_DIGEST | \ + tar xJf - -C /usr/local/bin --strip-components=1 + +RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \ + dpkg -i dumb-init_*.deb && \ + rm dumb-init_*.deb +ENTRYPOINT ["/usr/bin/dumb-init", "--"] + +ENV RUST_CONFIGURE_ARGS \ + --target=arm-unknown-linux-gnueabihf \ + --qemu-armhf-rootfs=/tmp/rootfs +ENV SCRIPT python2.7 ../x.py test --target arm-unknown-linux-gnueabihf + +ENV NO_CHANGE_USER=1 diff --git a/src/ci/docker/armhf-gnu/addentropy.c b/src/ci/docker/armhf-gnu/addentropy.c new file mode 100644 index 00000000000..8975739e3c0 --- /dev/null +++ b/src/ci/docker/armhf-gnu/addentropy.c @@ -0,0 +1,43 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#include +#include +#include +#include +#include +#include +#include + +#define N 2048 + +struct entropy { + int ent_count; + int size; + unsigned char data[N]; +}; + +int main() { + struct entropy buf; + ssize_t n; + + int random_fd = open("/dev/random", O_RDWR); + assert(random_fd >= 0); + + while ((n = read(0, &buf.data, N)) > 0) { + buf.ent_count = n * 8; + buf.size = n; + if (ioctl(random_fd, RNDADDENTROPY, &buf) != 0) { + perror("failed to add entropy"); + } + } + + return 0; +} diff --git a/src/ci/docker/armhf-gnu/rcS b/src/ci/docker/armhf-gnu/rcS new file mode 100644 index 00000000000..3c29bedc13c --- /dev/null +++ b/src/ci/docker/armhf-gnu/rcS @@ -0,0 +1,28 @@ +#!/bin/sh +mount -t proc none /proc +mount -t sysfs none /sys +/sbin/mdev -s + +# fill up our entropy pool, if we don't do this then anything with a hash map +# will likely block forever as the kernel is pretty unlikely to have enough +# entropy. +/addentropy < /addentropy +cat /dev/urandom | head -n 2048 | /addentropy + +# Set up IP that qemu expects. This confgures eth0 with the public IP that QEMU +# will communicate to as well as the loopback 127.0.0.1 address. +ifconfig eth0 10.0.2.15 +ifconfig lo up + +# Configure DNS resolution of 'localhost' to work +echo 'hosts: files dns' >> /ubuntu/etc/nsswitch.conf +echo '127.0.0.1 localhost' >> /ubuntu/etc/hosts + +# prepare the chroot +mount -t proc proc /ubuntu/proc/ +mount --rbind /sys /ubuntu/sys/ +mount --rbind /dev /ubuntu/dev/ + +# Execute our `testd` inside the ubuntu chroot +cp /testd /ubuntu/testd +chroot /ubuntu /testd & diff --git a/src/ci/docker/armhf-gnu/vexpress_config b/src/ci/docker/armhf-gnu/vexpress_config new file mode 100644 index 00000000000..35835cff35d --- /dev/null +++ b/src/ci/docker/armhf-gnu/vexpress_config @@ -0,0 +1,2910 @@ +# +# Automatically generated file; DO NOT EDIT. +# Linux/arm 4.4.42 Kernel Configuration +# +CONFIG_ARM=y +CONFIG_ARM_HAS_SG_CHAIN=y +CONFIG_MIGHT_HAVE_PCI=y +CONFIG_SYS_SUPPORTS_APM_EMULATION=y +CONFIG_HAVE_PROC_CPU=y +CONFIG_NO_IOPORT_MAP=y +CONFIG_STACKTRACE_SUPPORT=y +CONFIG_LOCKDEP_SUPPORT=y +CONFIG_TRACE_IRQFLAGS_SUPPORT=y +CONFIG_RWSEM_XCHGADD_ALGORITHM=y +CONFIG_FIX_EARLYCON_MEM=y +CONFIG_GENERIC_HWEIGHT=y +CONFIG_GENERIC_CALIBRATE_DELAY=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_ARCH_SUPPORTS_UPROBES=y +CONFIG_VECTORS_BASE=0xffff0000 +CONFIG_ARM_PATCH_PHYS_VIRT=y +CONFIG_GENERIC_BUG=y +CONFIG_PGTABLE_LEVELS=2 +CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" +CONFIG_IRQ_WORK=y +CONFIG_BUILDTIME_EXTABLE_SORT=y + +# +# General setup +# +CONFIG_INIT_ENV_ARG_LIMIT=32 +CONFIG_CROSS_COMPILE="" +# CONFIG_COMPILE_TEST is not set +CONFIG_LOCALVERSION="" +# CONFIG_LOCALVERSION_AUTO is not set +CONFIG_HAVE_KERNEL_GZIP=y +CONFIG_HAVE_KERNEL_LZMA=y +CONFIG_HAVE_KERNEL_XZ=y +CONFIG_HAVE_KERNEL_LZO=y +CONFIG_HAVE_KERNEL_LZ4=y +CONFIG_KERNEL_GZIP=y +# CONFIG_KERNEL_LZMA is not set +# CONFIG_KERNEL_XZ is not set +# CONFIG_KERNEL_LZO is not set +# CONFIG_KERNEL_LZ4 is not set +CONFIG_DEFAULT_HOSTNAME="(none)" +CONFIG_SWAP=y +CONFIG_SYSVIPC=y +CONFIG_SYSVIPC_SYSCTL=y +# CONFIG_POSIX_MQUEUE is not set +CONFIG_CROSS_MEMORY_ATTACH=y +# CONFIG_FHANDLE is not set +CONFIG_USELIB=y +# CONFIG_AUDIT is not set +CONFIG_HAVE_ARCH_AUDITSYSCALL=y + +# +# IRQ subsystem +# +CONFIG_GENERIC_IRQ_PROBE=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_IRQ_SHOW_LEVEL=y +CONFIG_HARDIRQS_SW_RESEND=y +CONFIG_IRQ_DOMAIN=y +CONFIG_IRQ_DOMAIN_HIERARCHY=y +CONFIG_HANDLE_DOMAIN_IRQ=y +# CONFIG_IRQ_DOMAIN_DEBUG is not set +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_SPARSE_IRQ=y +CONFIG_GENERIC_TIME_VSYSCALL=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_ARCH_HAS_TICK_BROADCAST=y +CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y + +# +# Timers subsystem +# +CONFIG_HZ_PERIODIC=y +# CONFIG_NO_HZ_IDLE is not set +# CONFIG_NO_HZ_FULL is not set +# CONFIG_NO_HZ is not set +# CONFIG_HIGH_RES_TIMERS is not set + +# +# CPU/Task time and stats accounting +# +CONFIG_TICK_CPU_ACCOUNTING=y +# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set +# CONFIG_IRQ_TIME_ACCOUNTING is not set +# CONFIG_BSD_PROCESS_ACCT is not set +# CONFIG_TASKSTATS is not set + +# +# RCU Subsystem +# +CONFIG_TREE_RCU=y +# CONFIG_RCU_EXPERT is not set +CONFIG_SRCU=y +# CONFIG_TASKS_RCU is not set +CONFIG_RCU_STALL_COMMON=y +# CONFIG_TREE_RCU_TRACE is not set +# CONFIG_RCU_EXPEDITE_BOOT is not set +CONFIG_BUILD_BIN2C=y +CONFIG_IKCONFIG=y +CONFIG_IKCONFIG_PROC=y +CONFIG_LOG_BUF_SHIFT=14 +CONFIG_LOG_CPU_MAX_BUF_SHIFT=12 +CONFIG_GENERIC_SCHED_CLOCK=y +CONFIG_CGROUPS=y +# CONFIG_CGROUP_DEBUG is not set +# CONFIG_CGROUP_FREEZER is not set +# CONFIG_CGROUP_PIDS is not set +# CONFIG_CGROUP_DEVICE is not set +CONFIG_CPUSETS=y +CONFIG_PROC_PID_CPUSET=y +# CONFIG_CGROUP_CPUACCT is not set +# CONFIG_MEMCG is not set +# CONFIG_CGROUP_PERF is not set +# CONFIG_CGROUP_SCHED is not set +# CONFIG_BLK_CGROUP is not set +# CONFIG_CHECKPOINT_RESTORE is not set +CONFIG_NAMESPACES=y +# CONFIG_UTS_NS is not set +# CONFIG_IPC_NS is not set +# CONFIG_USER_NS is not set +# CONFIG_PID_NS is not set +# CONFIG_NET_NS is not set +# CONFIG_SCHED_AUTOGROUP is not set +# CONFIG_SYSFS_DEPRECATED is not set +# CONFIG_RELAY is not set +CONFIG_BLK_DEV_INITRD=y +CONFIG_INITRAMFS_SOURCE="" +CONFIG_RD_GZIP=y +CONFIG_RD_BZIP2=y +CONFIG_RD_LZMA=y +CONFIG_RD_XZ=y +CONFIG_RD_LZO=y +CONFIG_RD_LZ4=y +# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set +CONFIG_SYSCTL=y +CONFIG_ANON_INODES=y +CONFIG_HAVE_UID16=y +CONFIG_BPF=y +# CONFIG_EXPERT is not set +CONFIG_UID16=y +CONFIG_MULTIUSER=y +# CONFIG_SGETMASK_SYSCALL is not set +CONFIG_SYSFS_SYSCALL=y +# CONFIG_SYSCTL_SYSCALL is not set +CONFIG_KALLSYMS=y +# CONFIG_KALLSYMS_ALL is not set +CONFIG_PRINTK=y +CONFIG_BUG=y +CONFIG_ELF_CORE=y +CONFIG_BASE_FULL=y +CONFIG_FUTEX=y +CONFIG_EPOLL=y +CONFIG_SIGNALFD=y +CONFIG_TIMERFD=y +CONFIG_EVENTFD=y +# CONFIG_BPF_SYSCALL is not set +CONFIG_SHMEM=y +CONFIG_AIO=y +CONFIG_ADVISE_SYSCALLS=y +# CONFIG_USERFAULTFD is not set +CONFIG_MEMBARRIER=y +# CONFIG_EMBEDDED is not set +CONFIG_HAVE_PERF_EVENTS=y +CONFIG_PERF_USE_VMALLOC=y + +# +# Kernel Performance Events And Counters +# +CONFIG_PERF_EVENTS=y +# CONFIG_DEBUG_PERF_USE_VMALLOC is not set +CONFIG_VM_EVENT_COUNTERS=y +CONFIG_SLUB_DEBUG=y +CONFIG_COMPAT_BRK=y +# CONFIG_SLAB is not set +CONFIG_SLUB=y +CONFIG_SLUB_CPU_PARTIAL=y +# CONFIG_SYSTEM_DATA_VERIFICATION is not set +CONFIG_PROFILING=y +CONFIG_OPROFILE=y +CONFIG_HAVE_OPROFILE=y +# CONFIG_KPROBES is not set +# CONFIG_JUMP_LABEL is not set +# CONFIG_UPROBES is not set +# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set +CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y +CONFIG_ARCH_USE_BUILTIN_BSWAP=y +CONFIG_HAVE_KPROBES=y +CONFIG_HAVE_KRETPROBES=y +CONFIG_HAVE_OPTPROBES=y +CONFIG_HAVE_ARCH_TRACEHOOK=y +CONFIG_HAVE_DMA_ATTRS=y +CONFIG_HAVE_DMA_CONTIGUOUS=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_GENERIC_IDLE_POLL_SETUP=y +CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y +CONFIG_HAVE_CLK=y +CONFIG_HAVE_DMA_API_DEBUG=y +CONFIG_HAVE_HW_BREAKPOINT=y +CONFIG_HAVE_PERF_REGS=y +CONFIG_HAVE_PERF_USER_STACK_DUMP=y +CONFIG_HAVE_ARCH_JUMP_LABEL=y +CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y +CONFIG_HAVE_ARCH_SECCOMP_FILTER=y +CONFIG_HAVE_CC_STACKPROTECTOR=y +# CONFIG_CC_STACKPROTECTOR is not set +CONFIG_CC_STACKPROTECTOR_NONE=y +# CONFIG_CC_STACKPROTECTOR_REGULAR is not set +# CONFIG_CC_STACKPROTECTOR_STRONG is not set +CONFIG_HAVE_CONTEXT_TRACKING=y +CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y +CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y +CONFIG_HAVE_MOD_ARCH_SPECIFIC=y +CONFIG_MODULES_USE_ELF_REL=y +CONFIG_ARCH_HAS_ELF_RANDOMIZE=y +CONFIG_CLONE_BACKWARDS=y +CONFIG_OLD_SIGSUSPEND3=y +CONFIG_OLD_SIGACTION=y + +# +# GCOV-based kernel profiling +# +# CONFIG_GCOV_KERNEL is not set +CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y +CONFIG_HAVE_GENERIC_DMA_COHERENT=y +CONFIG_SLABINFO=y +CONFIG_RT_MUTEXES=y +CONFIG_BASE_SMALL=0 +CONFIG_MODULES=y +# CONFIG_MODULE_FORCE_LOAD is not set +CONFIG_MODULE_UNLOAD=y +# CONFIG_MODULE_FORCE_UNLOAD is not set +# CONFIG_MODVERSIONS is not set +# CONFIG_MODULE_SRCVERSION_ALL is not set +# CONFIG_MODULE_SIG is not set +# CONFIG_MODULE_COMPRESS is not set +CONFIG_MODULES_TREE_LOOKUP=y +CONFIG_BLOCK=y +# CONFIG_LBDAF is not set +# CONFIG_BLK_DEV_BSG is not set +# CONFIG_BLK_DEV_BSGLIB is not set +# CONFIG_BLK_DEV_INTEGRITY is not set +# CONFIG_BLK_CMDLINE_PARSER is not set + +# +# Partition Types +# +# CONFIG_PARTITION_ADVANCED is not set +CONFIG_MSDOS_PARTITION=y +CONFIG_EFI_PARTITION=y + +# +# IO Schedulers +# +CONFIG_IOSCHED_NOOP=y +# CONFIG_IOSCHED_DEADLINE is not set +# CONFIG_IOSCHED_CFQ is not set +CONFIG_DEFAULT_NOOP=y +CONFIG_DEFAULT_IOSCHED="noop" +CONFIG_INLINE_SPIN_UNLOCK_IRQ=y +CONFIG_INLINE_READ_UNLOCK=y +CONFIG_INLINE_READ_UNLOCK_IRQ=y +CONFIG_INLINE_WRITE_UNLOCK=y +CONFIG_INLINE_WRITE_UNLOCK_IRQ=y +CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y +CONFIG_MUTEX_SPIN_ON_OWNER=y +CONFIG_RWSEM_SPIN_ON_OWNER=y +CONFIG_LOCK_SPIN_ON_OWNER=y +CONFIG_FREEZER=y + +# +# System Type +# +CONFIG_MMU=y +CONFIG_ARCH_MULTIPLATFORM=y +# CONFIG_ARCH_REALVIEW is not set +# CONFIG_ARCH_VERSATILE is not set +# CONFIG_ARCH_CLPS711X is not set +# CONFIG_ARCH_GEMINI is not set +# CONFIG_ARCH_EBSA110 is not set +# CONFIG_ARCH_EP93XX is not set +# CONFIG_ARCH_FOOTBRIDGE is not set +# CONFIG_ARCH_NETX is not set +# CONFIG_ARCH_IOP13XX is not set +# CONFIG_ARCH_IOP32X is not set +# CONFIG_ARCH_IOP33X is not set +# CONFIG_ARCH_IXP4XX is not set +# CONFIG_ARCH_DOVE is not set +# CONFIG_ARCH_MV78XX0 is not set +# CONFIG_ARCH_ORION5X is not set +# CONFIG_ARCH_MMP is not set +# CONFIG_ARCH_KS8695 is not set +# CONFIG_ARCH_W90X900 is not set +# CONFIG_ARCH_LPC32XX is not set +# CONFIG_ARCH_PXA is not set +# CONFIG_ARCH_RPC is not set +# CONFIG_ARCH_SA1100 is not set +# CONFIG_ARCH_S3C24XX is not set +# CONFIG_ARCH_S3C64XX is not set +# CONFIG_ARCH_DAVINCI is not set +# CONFIG_ARCH_OMAP1 is not set + +# +# Multiple platform selection +# + +# +# CPU Core family selection +# +# CONFIG_ARCH_MULTI_V6 is not set +CONFIG_ARCH_MULTI_V7=y +CONFIG_ARCH_MULTI_V6_V7=y +# CONFIG_ARCH_MULTI_CPU_AUTO is not set +# CONFIG_ARCH_VIRT is not set +# CONFIG_ARCH_MVEBU is not set +# CONFIG_ARCH_ALPINE is not set +# CONFIG_ARCH_AT91 is not set +# CONFIG_ARCH_BCM is not set +# CONFIG_ARCH_BERLIN is not set +# CONFIG_ARCH_DIGICOLOR is not set +# CONFIG_ARCH_HIGHBANK is not set +# CONFIG_ARCH_HISI is not set +# CONFIG_ARCH_KEYSTONE is not set +# CONFIG_ARCH_MESON is not set +# CONFIG_ARCH_MXC is not set +# CONFIG_ARCH_MEDIATEK is not set + +# +# TI OMAP/AM/DM/DRA Family +# +# CONFIG_ARCH_OMAP3 is not set +# CONFIG_ARCH_OMAP4 is not set +# CONFIG_SOC_OMAP5 is not set +# CONFIG_SOC_AM33XX is not set +# CONFIG_SOC_AM43XX is not set +# CONFIG_SOC_DRA7XX is not set +# CONFIG_ARCH_QCOM is not set +# CONFIG_ARCH_ROCKCHIP is not set +# CONFIG_ARCH_SOCFPGA is not set +# CONFIG_PLAT_SPEAR is not set +# CONFIG_ARCH_STI is not set +# CONFIG_ARCH_S5PV210 is not set +# CONFIG_ARCH_EXYNOS is not set +# CONFIG_ARCH_SHMOBILE_MULTI is not set +# CONFIG_ARCH_SUNXI is not set +# CONFIG_ARCH_SIRF is not set +# CONFIG_ARCH_TEGRA is not set +# CONFIG_ARCH_UNIPHIER is not set +# CONFIG_ARCH_U8500 is not set +CONFIG_ARCH_VEXPRESS=y +CONFIG_ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA=y +CONFIG_ARCH_VEXPRESS_DCSCB=y +CONFIG_ARCH_VEXPRESS_SPC=y +CONFIG_ARCH_VEXPRESS_TC2_PM=y +# CONFIG_ARCH_WM8850 is not set +# CONFIG_ARCH_ZX is not set +# CONFIG_ARCH_ZYNQ is not set +CONFIG_PLAT_VERSATILE=y + +# +# Processor Type +# +CONFIG_CPU_V7=y +CONFIG_CPU_32v6K=y +CONFIG_CPU_32v7=y +CONFIG_CPU_ABRT_EV7=y +CONFIG_CPU_PABRT_V7=y +CONFIG_CPU_CACHE_V7=y +CONFIG_CPU_CACHE_VIPT=y +CONFIG_CPU_COPY_V6=y +CONFIG_CPU_TLB_V7=y +CONFIG_CPU_HAS_ASID=y +CONFIG_CPU_CP15=y +CONFIG_CPU_CP15_MMU=y + +# +# Processor Features +# +# CONFIG_ARM_LPAE is not set +# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set +CONFIG_ARM_THUMB=y +# CONFIG_ARM_THUMBEE is not set +CONFIG_ARM_VIRT_EXT=y +CONFIG_SWP_EMULATE=y +# CONFIG_CPU_BIG_ENDIAN is not set +# CONFIG_CPU_ICACHE_DISABLE is not set +# CONFIG_CPU_BPREDICT_DISABLE is not set +CONFIG_KUSER_HELPERS=y +CONFIG_VDSO=y +CONFIG_OUTER_CACHE=y +CONFIG_OUTER_CACHE_SYNC=y +CONFIG_MIGHT_HAVE_CACHE_L2X0=y +CONFIG_CACHE_L2X0=y +# CONFIG_PL310_ERRATA_588369 is not set +# CONFIG_PL310_ERRATA_727915 is not set +CONFIG_PL310_ERRATA_753970=y +# CONFIG_PL310_ERRATA_769419 is not set +CONFIG_ARM_L1_CACHE_SHIFT_6=y +CONFIG_ARM_L1_CACHE_SHIFT=6 +CONFIG_ARM_DMA_MEM_BUFFERABLE=y +CONFIG_ARM_HEAVY_MB=y +CONFIG_ARCH_SUPPORTS_BIG_ENDIAN=y +# CONFIG_ARM_KERNMEM_PERMS is not set +CONFIG_MULTI_IRQ_HANDLER=y +# CONFIG_ARM_ERRATA_430973 is not set +CONFIG_ARM_ERRATA_643719=y +CONFIG_ARM_ERRATA_720789=y +# CONFIG_ARM_ERRATA_754322 is not set +# CONFIG_ARM_ERRATA_754327 is not set +# CONFIG_ARM_ERRATA_764369 is not set +# CONFIG_ARM_ERRATA_775420 is not set +# CONFIG_ARM_ERRATA_798181 is not set +# CONFIG_ARM_ERRATA_773022 is not set +CONFIG_ICST=y + +# +# Bus support +# +# CONFIG_PCI is not set +# CONFIG_PCI_DOMAINS_GENERIC is not set +# CONFIG_PCI_SYSCALL is not set +# CONFIG_PCCARD is not set + +# +# Kernel Features +# +CONFIG_HAVE_SMP=y +CONFIG_SMP=y +CONFIG_SMP_ON_UP=y +CONFIG_ARM_CPU_TOPOLOGY=y +# CONFIG_SCHED_MC is not set +# CONFIG_SCHED_SMT is not set +CONFIG_HAVE_ARM_SCU=y +CONFIG_HAVE_ARM_ARCH_TIMER=y +CONFIG_HAVE_ARM_TWD=y +CONFIG_MCPM=y +# CONFIG_BIG_LITTLE is not set +# CONFIG_VMSPLIT_3G is not set +# CONFIG_VMSPLIT_3G_OPT is not set +CONFIG_VMSPLIT_2G=y +# CONFIG_VMSPLIT_1G is not set +CONFIG_PAGE_OFFSET=0x80000000 +CONFIG_NR_CPUS=8 +CONFIG_HOTPLUG_CPU=y +CONFIG_ARM_PSCI=y +CONFIG_ARCH_NR_GPIO=0 +CONFIG_PREEMPT_NONE=y +# CONFIG_PREEMPT_VOLUNTARY is not set +# CONFIG_PREEMPT is not set +CONFIG_HZ_FIXED=0 +CONFIG_HZ_100=y +# CONFIG_HZ_200 is not set +# CONFIG_HZ_250 is not set +# CONFIG_HZ_300 is not set +# CONFIG_HZ_500 is not set +# CONFIG_HZ_1000 is not set +CONFIG_HZ=100 +# CONFIG_SCHED_HRTICK is not set +# CONFIG_THUMB2_KERNEL is not set +CONFIG_AEABI=y +# CONFIG_OABI_COMPAT is not set +# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set +# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set +CONFIG_HAVE_ARCH_PFN_VALID=y +# CONFIG_HIGHMEM is not set +CONFIG_CPU_SW_DOMAIN_PAN=y +CONFIG_HW_PERF_EVENTS=y +CONFIG_ARCH_WANT_GENERAL_HUGETLB=y +# CONFIG_ARM_MODULE_PLTS is not set +CONFIG_FLATMEM=y +CONFIG_FLAT_NODE_MEM_MAP=y +CONFIG_HAVE_MEMBLOCK=y +CONFIG_NO_BOOTMEM=y +CONFIG_MEMORY_ISOLATION=y +# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set +CONFIG_SPLIT_PTLOCK_CPUS=4 +CONFIG_MEMORY_BALLOON=y +CONFIG_BALLOON_COMPACTION=y +CONFIG_COMPACTION=y +CONFIG_MIGRATION=y +# CONFIG_PHYS_ADDR_T_64BIT is not set +CONFIG_ZONE_DMA_FLAG=0 +# CONFIG_KSM is not set +CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 +# CONFIG_CLEANCACHE is not set +# CONFIG_FRONTSWAP is not set +CONFIG_CMA=y +# CONFIG_CMA_DEBUG is not set +# CONFIG_CMA_DEBUGFS is not set +CONFIG_CMA_AREAS=7 +# CONFIG_ZPOOL is not set +# CONFIG_ZBUD is not set +# CONFIG_ZSMALLOC is not set +# CONFIG_IDLE_PAGE_TRACKING is not set +CONFIG_FORCE_MAX_ZONEORDER=11 +CONFIG_ALIGNMENT_TRAP=y +# CONFIG_UACCESS_WITH_MEMCPY is not set +# CONFIG_SECCOMP is not set +CONFIG_SWIOTLB=y +CONFIG_IOMMU_HELPER=y +# CONFIG_XEN is not set + +# +# Boot options +# +CONFIG_USE_OF=y +CONFIG_ATAGS=y +# CONFIG_DEPRECATED_PARAM_STRUCT is not set +CONFIG_ZBOOT_ROM_TEXT=0x0 +CONFIG_ZBOOT_ROM_BSS=0x0 +# CONFIG_ARM_APPENDED_DTB is not set +CONFIG_CMDLINE="console=ttyAMA0" +CONFIG_CMDLINE_FROM_BOOTLOADER=y +# CONFIG_CMDLINE_EXTEND is not set +# CONFIG_CMDLINE_FORCE is not set +# CONFIG_KEXEC is not set +# CONFIG_CRASH_DUMP is not set +CONFIG_AUTO_ZRELADDR=y + +# +# CPU Power Management +# + +# +# CPU Frequency scaling +# +# CONFIG_CPU_FREQ is not set + +# +# CPU Idle +# +CONFIG_CPU_IDLE=y +CONFIG_CPU_IDLE_GOV_LADDER=y +CONFIG_CPU_IDLE_GOV_MENU=y + +# +# ARM CPU Idle Drivers +# +# CONFIG_ARM_CPUIDLE is not set +# CONFIG_ARM_BIG_LITTLE_CPUIDLE is not set +# CONFIG_ARM_HIGHBANK_CPUIDLE is not set +# CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is not set + +# +# Floating point emulation +# + +# +# At least one emulation must be selected +# +CONFIG_VFP=y +CONFIG_VFPv3=y +CONFIG_NEON=y +# CONFIG_KERNEL_MODE_NEON is not set + +# +# Userspace binary formats +# +CONFIG_BINFMT_ELF=y +# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set +CONFIG_BINFMT_SCRIPT=y +# CONFIG_HAVE_AOUT is not set +# CONFIG_BINFMT_MISC is not set +CONFIG_COREDUMP=y + +# +# Power management options +# +CONFIG_SUSPEND=y +CONFIG_SUSPEND_FREEZER=y +# CONFIG_HIBERNATION is not set +CONFIG_PM_SLEEP=y +CONFIG_PM_SLEEP_SMP=y +# CONFIG_PM_AUTOSLEEP is not set +# CONFIG_PM_WAKELOCKS is not set +CONFIG_PM=y +# CONFIG_PM_DEBUG is not set +# CONFIG_APM_EMULATION is not set +CONFIG_PM_OPP=y +CONFIG_PM_CLK=y +# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set +CONFIG_CPU_PM=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARM_CPU_SUSPEND=y +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_NET=y + +# +# Networking options +# +CONFIG_PACKET=y +# CONFIG_PACKET_DIAG is not set +CONFIG_UNIX=y +# CONFIG_UNIX_DIAG is not set +CONFIG_XFRM=y +# CONFIG_XFRM_USER is not set +# CONFIG_XFRM_SUB_POLICY is not set +# CONFIG_XFRM_MIGRATE is not set +# CONFIG_XFRM_STATISTICS is not set +# CONFIG_NET_KEY is not set +CONFIG_INET=y +# CONFIG_IP_MULTICAST is not set +# CONFIG_IP_ADVANCED_ROUTER is not set +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +CONFIG_IP_PNP_BOOTP=y +# CONFIG_IP_PNP_RARP is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPGRE_DEMUX is not set +CONFIG_NET_IP_TUNNEL=m +# CONFIG_SYN_COOKIES is not set +# CONFIG_NET_IPVTI is not set +# CONFIG_NET_UDP_TUNNEL is not set +# CONFIG_NET_FOU is not set +# CONFIG_NET_FOU_IP_TUNNELS is not set +# CONFIG_INET_AH is not set +# CONFIG_INET_ESP is not set +# CONFIG_INET_IPCOMP is not set +# CONFIG_INET_XFRM_TUNNEL is not set +CONFIG_INET_TUNNEL=m +CONFIG_INET_XFRM_MODE_TRANSPORT=y +CONFIG_INET_XFRM_MODE_TUNNEL=y +CONFIG_INET_XFRM_MODE_BEET=y +# CONFIG_INET_LRO is not set +CONFIG_INET_DIAG=y +CONFIG_INET_TCP_DIAG=y +# CONFIG_INET_UDP_DIAG is not set +# CONFIG_TCP_CONG_ADVANCED is not set +CONFIG_TCP_CONG_CUBIC=y +CONFIG_DEFAULT_TCP_CONG="cubic" +# CONFIG_TCP_MD5SIG is not set +CONFIG_IPV6=y +# CONFIG_IPV6_ROUTER_PREF is not set +# CONFIG_IPV6_OPTIMISTIC_DAD is not set +# CONFIG_INET6_AH is not set +# CONFIG_INET6_ESP is not set +# CONFIG_INET6_IPCOMP is not set +# CONFIG_IPV6_MIP6 is not set +# CONFIG_IPV6_ILA is not set +# CONFIG_INET6_XFRM_TUNNEL is not set +# CONFIG_INET6_TUNNEL is not set +CONFIG_INET6_XFRM_MODE_TRANSPORT=m +CONFIG_INET6_XFRM_MODE_TUNNEL=m +CONFIG_INET6_XFRM_MODE_BEET=m +# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set +# CONFIG_IPV6_VTI is not set +CONFIG_IPV6_SIT=m +# CONFIG_IPV6_SIT_6RD is not set +CONFIG_IPV6_NDISC_NODETYPE=y +# CONFIG_IPV6_TUNNEL is not set +# CONFIG_IPV6_GRE is not set +# CONFIG_IPV6_MULTIPLE_TABLES is not set +# CONFIG_IPV6_MROUTE is not set +# CONFIG_NETWORK_SECMARK is not set +# CONFIG_NET_PTP_CLASSIFY is not set +# CONFIG_NETWORK_PHY_TIMESTAMPING is not set +# CONFIG_NETFILTER is not set +# CONFIG_IP_DCCP is not set +# CONFIG_IP_SCTP is not set +# CONFIG_RDS is not set +# CONFIG_TIPC is not set +# CONFIG_ATM is not set +# CONFIG_L2TP is not set +# CONFIG_BRIDGE is not set +CONFIG_HAVE_NET_DSA=y +# CONFIG_VLAN_8021Q is not set +# CONFIG_DECNET is not set +# CONFIG_LLC2 is not set +# CONFIG_IPX is not set +# CONFIG_ATALK is not set +# CONFIG_X25 is not set +# CONFIG_LAPB is not set +# CONFIG_PHONET is not set +# CONFIG_6LOWPAN is not set +# CONFIG_IEEE802154 is not set +# CONFIG_NET_SCHED is not set +# CONFIG_DCB is not set +# CONFIG_BATMAN_ADV is not set +# CONFIG_OPENVSWITCH is not set +# CONFIG_VSOCKETS is not set +# CONFIG_NETLINK_MMAP is not set +# CONFIG_NETLINK_DIAG is not set +# CONFIG_MPLS is not set +# CONFIG_HSR is not set +# CONFIG_NET_SWITCHDEV is not set +# CONFIG_NET_L3_MASTER_DEV is not set +CONFIG_RPS=y +CONFIG_RFS_ACCEL=y +CONFIG_XPS=y +# CONFIG_CGROUP_NET_PRIO is not set +# CONFIG_CGROUP_NET_CLASSID is not set +CONFIG_NET_RX_BUSY_POLL=y +CONFIG_BQL=y +# CONFIG_BPF_JIT is not set +CONFIG_NET_FLOW_LIMIT=y + +# +# Network testing +# +# CONFIG_NET_PKTGEN is not set +# CONFIG_HAMRADIO is not set +# CONFIG_CAN is not set +# CONFIG_IRDA is not set +# CONFIG_BT is not set +# CONFIG_AF_RXRPC is not set +# CONFIG_WIRELESS is not set +# CONFIG_WIMAX is not set +# CONFIG_RFKILL is not set +# CONFIG_RFKILL_REGULATOR is not set +CONFIG_NET_9P=y +CONFIG_NET_9P_VIRTIO=y +# CONFIG_NET_9P_DEBUG is not set +# CONFIG_CAIF is not set +# CONFIG_CEPH_LIB is not set +# CONFIG_NFC is not set +# CONFIG_LWTUNNEL is not set +CONFIG_HAVE_BPF_JIT=y + +# +# Device Drivers +# +CONFIG_ARM_AMBA=y +# CONFIG_TEGRA_AHB is not set + +# +# Generic Driver Options +# +CONFIG_UEVENT_HELPER=y +CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" +CONFIG_DEVTMPFS=y +# CONFIG_DEVTMPFS_MOUNT is not set +CONFIG_STANDALONE=y +CONFIG_PREVENT_FIRMWARE_BUILD=y +CONFIG_FW_LOADER=y +CONFIG_FIRMWARE_IN_KERNEL=y +CONFIG_EXTRA_FIRMWARE="" +# CONFIG_FW_LOADER_USER_HELPER_FALLBACK is not set +CONFIG_ALLOW_DEV_COREDUMP=y +# CONFIG_DEBUG_DRIVER is not set +# CONFIG_DEBUG_DEVRES is not set +# CONFIG_SYS_HYPERVISOR is not set +# CONFIG_GENERIC_CPU_DEVICES is not set +CONFIG_REGMAP=y +CONFIG_REGMAP_MMIO=y +# CONFIG_DMA_SHARED_BUFFER is not set +# CONFIG_DMA_CMA is not set + +# +# Bus devices +# +CONFIG_ARM_CCI=y +CONFIG_ARM_CCI400_COMMON=y +# CONFIG_ARM_CCI400_PMU is not set +CONFIG_ARM_CCI400_PORT_CTRL=y +# CONFIG_ARM_CCI500_PMU is not set +# CONFIG_ARM_CCN is not set +# CONFIG_BRCMSTB_GISB_ARB is not set +CONFIG_VEXPRESS_CONFIG=y +# CONFIG_CONNECTOR is not set +CONFIG_MTD=y +# CONFIG_MTD_TESTS is not set +# CONFIG_MTD_REDBOOT_PARTS is not set +CONFIG_MTD_CMDLINE_PARTS=y +# CONFIG_MTD_AFS_PARTS is not set +CONFIG_MTD_OF_PARTS=y +# CONFIG_MTD_AR7_PARTS is not set + +# +# User Modules And Translation Layers +# +CONFIG_MTD_BLKDEVS=y +CONFIG_MTD_BLOCK=y +# CONFIG_FTL is not set +# CONFIG_NFTL is not set +# CONFIG_INFTL is not set +# CONFIG_RFD_FTL is not set +# CONFIG_SSFDC is not set +# CONFIG_SM_FTL is not set +# CONFIG_MTD_OOPS is not set +# CONFIG_MTD_SWAP is not set +# CONFIG_MTD_PARTITIONED_MASTER is not set + +# +# RAM/ROM/Flash chip drivers +# +CONFIG_MTD_CFI=y +# CONFIG_MTD_JEDECPROBE is not set +CONFIG_MTD_GEN_PROBE=y +# CONFIG_MTD_CFI_ADV_OPTIONS is not set +CONFIG_MTD_MAP_BANK_WIDTH_1=y +CONFIG_MTD_MAP_BANK_WIDTH_2=y +CONFIG_MTD_MAP_BANK_WIDTH_4=y +# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set +# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set +# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set +CONFIG_MTD_CFI_I1=y +CONFIG_MTD_CFI_I2=y +# CONFIG_MTD_CFI_I4 is not set +# CONFIG_MTD_CFI_I8 is not set +CONFIG_MTD_CFI_INTELEXT=y +CONFIG_MTD_CFI_AMDSTD=y +# CONFIG_MTD_CFI_STAA is not set +CONFIG_MTD_CFI_UTIL=y +CONFIG_MTD_RAM=y +# CONFIG_MTD_ROM is not set +# CONFIG_MTD_ABSENT is not set + +# +# Mapping drivers for chip access +# +# CONFIG_MTD_COMPLEX_MAPPINGS is not set +CONFIG_MTD_PHYSMAP=y +# CONFIG_MTD_PHYSMAP_COMPAT is not set +CONFIG_MTD_PHYSMAP_OF=y +CONFIG_MTD_PLATRAM=y + +# +# Self-contained MTD device drivers +# +# CONFIG_MTD_SLRAM is not set +# CONFIG_MTD_PHRAM is not set +# CONFIG_MTD_MTDRAM is not set +# CONFIG_MTD_BLOCK2MTD is not set + +# +# Disk-On-Chip Device Drivers +# +# CONFIG_MTD_DOCG3 is not set +# CONFIG_MTD_NAND is not set +# CONFIG_MTD_ONENAND is not set + +# +# LPDDR & LPDDR2 PCM memory drivers +# +# CONFIG_MTD_LPDDR is not set +# CONFIG_MTD_LPDDR2_NVM is not set +# CONFIG_MTD_SPI_NOR is not set +CONFIG_MTD_UBI=y +CONFIG_MTD_UBI_WL_THRESHOLD=4096 +CONFIG_MTD_UBI_BEB_LIMIT=20 +# CONFIG_MTD_UBI_FASTMAP is not set +# CONFIG_MTD_UBI_GLUEBI is not set +# CONFIG_MTD_UBI_BLOCK is not set +CONFIG_DTC=y +CONFIG_OF=y +# CONFIG_OF_UNITTEST is not set +CONFIG_OF_FLATTREE=y +CONFIG_OF_EARLY_FLATTREE=y +CONFIG_OF_ADDRESS=y +CONFIG_OF_IRQ=y +CONFIG_OF_NET=y +CONFIG_OF_MDIO=y +CONFIG_OF_MTD=y +CONFIG_OF_RESERVED_MEM=y +# CONFIG_OF_OVERLAY is not set +CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y +# CONFIG_PARPORT is not set +CONFIG_BLK_DEV=y +# CONFIG_BLK_DEV_NULL_BLK is not set +# CONFIG_BLK_DEV_COW_COMMON is not set +# CONFIG_BLK_DEV_LOOP is not set +# CONFIG_BLK_DEV_DRBD is not set +# CONFIG_BLK_DEV_NBD is not set +# CONFIG_BLK_DEV_RAM is not set +# CONFIG_CDROM_PKTCDVD is not set +# CONFIG_ATA_OVER_ETH is not set +# CONFIG_MG_DISK is not set +CONFIG_VIRTIO_BLK=y +# CONFIG_BLK_DEV_RBD is not set + +# +# Misc devices +# +# CONFIG_SENSORS_LIS3LV02D is not set +# CONFIG_AD525X_DPOT is not set +# CONFIG_DUMMY_IRQ is not set +# CONFIG_ICS932S401 is not set +# CONFIG_ENCLOSURE_SERVICES is not set +# CONFIG_APDS9802ALS is not set +# CONFIG_ISL29003 is not set +# CONFIG_ISL29020 is not set +# CONFIG_SENSORS_TSL2550 is not set +# CONFIG_SENSORS_BH1780 is not set +# CONFIG_SENSORS_BH1770 is not set +# CONFIG_SENSORS_APDS990X is not set +# CONFIG_HMC6352 is not set +# CONFIG_DS1682 is not set +# CONFIG_ARM_CHARLCD is not set +# CONFIG_BMP085_I2C is not set +# CONFIG_USB_SWITCH_FSA9480 is not set +# CONFIG_SRAM is not set +CONFIG_VEXPRESS_SYSCFG=y +# CONFIG_C2PORT is not set + +# +# EEPROM support +# +# CONFIG_EEPROM_AT24 is not set +# CONFIG_EEPROM_LEGACY is not set +# CONFIG_EEPROM_MAX6875 is not set +# CONFIG_EEPROM_93CX6 is not set + +# +# Texas Instruments shared transport line discipline +# +# CONFIG_TI_ST is not set +# CONFIG_SENSORS_LIS3_I2C is not set + +# +# Altera FPGA firmware download module +# +# CONFIG_ALTERA_STAPL is not set + +# +# Intel MIC Bus Driver +# + +# +# SCIF Bus Driver +# + +# +# Intel MIC Host Driver +# + +# +# Intel MIC Card Driver +# + +# +# SCIF Driver +# + +# +# Intel MIC Coprocessor State Management (COSM) Drivers +# +# CONFIG_ECHO is not set +# CONFIG_CXL_BASE is not set +# CONFIG_CXL_KERNEL_API is not set +# CONFIG_CXL_EEH is not set + +# +# SCSI device support +# +CONFIG_SCSI_MOD=y +# CONFIG_RAID_ATTRS is not set +CONFIG_SCSI=y +CONFIG_SCSI_DMA=y +# CONFIG_SCSI_NETLINK is not set +# CONFIG_SCSI_MQ_DEFAULT is not set +# CONFIG_SCSI_PROC_FS is not set + +# +# SCSI support type (disk, tape, CD-ROM) +# +CONFIG_BLK_DEV_SD=y +# CONFIG_CHR_DEV_ST is not set +# CONFIG_CHR_DEV_OSST is not set +# CONFIG_BLK_DEV_SR is not set +# CONFIG_CHR_DEV_SG is not set +# CONFIG_CHR_DEV_SCH is not set +# CONFIG_SCSI_CONSTANTS is not set +# CONFIG_SCSI_LOGGING is not set +# CONFIG_SCSI_SCAN_ASYNC is not set + +# +# SCSI Transports +# +# CONFIG_SCSI_SPI_ATTRS is not set +# CONFIG_SCSI_FC_ATTRS is not set +# CONFIG_SCSI_ISCSI_ATTRS is not set +# CONFIG_SCSI_SAS_ATTRS is not set +# CONFIG_SCSI_SAS_LIBSAS is not set +# CONFIG_SCSI_SRP_ATTRS is not set +CONFIG_SCSI_LOWLEVEL=y +# CONFIG_ISCSI_TCP is not set +# CONFIG_ISCSI_BOOT_SYSFS is not set +# CONFIG_SCSI_UFSHCD is not set +# CONFIG_SCSI_DEBUG is not set +CONFIG_SCSI_VIRTIO=y +# CONFIG_SCSI_DH is not set +# CONFIG_SCSI_OSD_INITIATOR is not set +CONFIG_HAVE_PATA_PLATFORM=y +CONFIG_ATA=y +# CONFIG_ATA_NONSTANDARD is not set +CONFIG_ATA_VERBOSE_ERROR=y +# CONFIG_SATA_PMP is not set + +# +# Controllers with non-SFF native interface +# +# CONFIG_SATA_AHCI_PLATFORM is not set +# CONFIG_AHCI_CEVA is not set +# CONFIG_AHCI_QORIQ is not set +CONFIG_ATA_SFF=y + +# +# SFF controllers with custom DMA interface +# +CONFIG_ATA_BMDMA=y + +# +# SATA SFF controllers with BMDMA +# + +# +# PATA SFF controllers with BMDMA +# + +# +# PIO-only SFF controllers +# +# CONFIG_PATA_PLATFORM is not set + +# +# Generic fallback / legacy drivers +# +# CONFIG_MD is not set +# CONFIG_TARGET_CORE is not set +CONFIG_NETDEVICES=y +CONFIG_MII=y +CONFIG_NET_CORE=y +# CONFIG_BONDING is not set +# CONFIG_DUMMY is not set +# CONFIG_EQUALIZER is not set +# CONFIG_NET_TEAM is not set +# CONFIG_MACVLAN is not set +# CONFIG_IPVLAN is not set +# CONFIG_VXLAN is not set +# CONFIG_NETCONSOLE is not set +# CONFIG_NETPOLL is not set +# CONFIG_NET_POLL_CONTROLLER is not set +# CONFIG_TUN is not set +# CONFIG_TUN_VNET_CROSS_LE is not set +# CONFIG_VETH is not set +CONFIG_VIRTIO_NET=y +# CONFIG_NLMON is not set + +# +# CAIF transport drivers +# + +# +# Distributed Switch Architecture drivers +# +# CONFIG_NET_DSA_MV88E6XXX is not set +# CONFIG_NET_DSA_MV88E6XXX_NEED_PPU is not set +CONFIG_ETHERNET=y +# CONFIG_ALTERA_TSE is not set +CONFIG_NET_VENDOR_ARC=y +# CONFIG_ARC_EMAC is not set +# CONFIG_EMAC_ROCKCHIP is not set +# CONFIG_NET_VENDOR_AURORA is not set +CONFIG_NET_CADENCE=y +# CONFIG_MACB is not set +CONFIG_NET_VENDOR_BROADCOM=y +# CONFIG_B44 is not set +# CONFIG_BCMGENET is not set +# CONFIG_SYSTEMPORT is not set +CONFIG_NET_VENDOR_CIRRUS=y +# CONFIG_CS89x0 is not set +# CONFIG_DM9000 is not set +# CONFIG_DNET is not set +CONFIG_NET_VENDOR_EZCHIP=y +# CONFIG_EZCHIP_NPS_MANAGEMENT_ENET is not set +CONFIG_NET_VENDOR_FARADAY=y +# CONFIG_FTMAC100 is not set +# CONFIG_FTGMAC100 is not set +CONFIG_NET_VENDOR_HISILICON=y +# CONFIG_HIX5HD2_GMAC is not set +# CONFIG_HIP04_ETH is not set +# CONFIG_HNS is not set +# CONFIG_HNS_DSAF is not set +# CONFIG_HNS_ENET is not set +CONFIG_NET_VENDOR_INTEL=y +CONFIG_NET_VENDOR_I825XX=y +CONFIG_NET_VENDOR_MARVELL=y +# CONFIG_MVMDIO is not set +CONFIG_NET_VENDOR_MICREL=y +# CONFIG_KS8851_MLL is not set +CONFIG_NET_VENDOR_NATSEMI=y +CONFIG_NET_VENDOR_8390=y +# CONFIG_AX88796 is not set +# CONFIG_ETHOC is not set +CONFIG_NET_VENDOR_QUALCOMM=y +CONFIG_NET_VENDOR_RENESAS=y +CONFIG_NET_VENDOR_ROCKER=y +CONFIG_NET_VENDOR_SAMSUNG=y +# CONFIG_SXGBE_ETH is not set +CONFIG_NET_VENDOR_SEEQ=y +CONFIG_NET_VENDOR_SMSC=y +CONFIG_SMC91X=y +# CONFIG_SMC911X is not set +CONFIG_SMSC911X=y +# CONFIG_SMSC911X_ARCH_HOOKS is not set +CONFIG_NET_VENDOR_STMICRO=y +# CONFIG_STMMAC_ETH is not set +CONFIG_NET_VENDOR_SYNOPSYS=y +# CONFIG_SYNOPSYS_DWC_ETH_QOS is not set +CONFIG_NET_VENDOR_VIA=y +# CONFIG_VIA_RHINE is not set +# CONFIG_VIA_VELOCITY is not set +CONFIG_NET_VENDOR_WIZNET=y +# CONFIG_WIZNET_W5100 is not set +# CONFIG_WIZNET_W5300 is not set +CONFIG_PHYLIB=y + +# +# MII PHY device drivers +# +# CONFIG_AQUANTIA_PHY is not set +# CONFIG_AT803X_PHY is not set +# CONFIG_AMD_PHY is not set +# CONFIG_MARVELL_PHY is not set +# CONFIG_DAVICOM_PHY is not set +# CONFIG_QSEMI_PHY is not set +# CONFIG_LXT_PHY is not set +# CONFIG_CICADA_PHY is not set +# CONFIG_VITESSE_PHY is not set +# CONFIG_TERANETICS_PHY is not set +# CONFIG_SMSC_PHY is not set +# CONFIG_BROADCOM_PHY is not set +# CONFIG_BCM7XXX_PHY is not set +# CONFIG_BCM87XX_PHY is not set +# CONFIG_ICPLUS_PHY is not set +# CONFIG_REALTEK_PHY is not set +# CONFIG_NATIONAL_PHY is not set +# CONFIG_STE10XP is not set +# CONFIG_LSI_ET1011C_PHY is not set +# CONFIG_MICREL_PHY is not set +# CONFIG_DP83848_PHY is not set +# CONFIG_DP83867_PHY is not set +# CONFIG_MICROCHIP_PHY is not set +# CONFIG_FIXED_PHY is not set +# CONFIG_MDIO_BITBANG is not set +# CONFIG_MDIO_BUS_MUX_GPIO is not set +# CONFIG_MDIO_BUS_MUX_MMIOREG is not set +# CONFIG_MDIO_BCM_UNIMAC is not set +# CONFIG_PPP is not set +# CONFIG_SLIP is not set +CONFIG_USB_NET_DRIVERS=y +# CONFIG_USB_CATC is not set +# CONFIG_USB_KAWETH is not set +# CONFIG_USB_PEGASUS is not set +# CONFIG_USB_RTL8150 is not set +# CONFIG_USB_RTL8152 is not set +# CONFIG_USB_LAN78XX is not set +# CONFIG_USB_USBNET is not set +# CONFIG_USB_IPHETH is not set +# CONFIG_WLAN is not set + +# +# Enable WiMAX (Networking options) to see the WiMAX drivers +# +# CONFIG_WAN is not set +# CONFIG_ISDN is not set +# CONFIG_NVM is not set + +# +# Input device support +# +CONFIG_INPUT=y +CONFIG_INPUT_LEDS=y +# CONFIG_INPUT_FF_MEMLESS is not set +# CONFIG_INPUT_POLLDEV is not set +# CONFIG_INPUT_SPARSEKMAP is not set +# CONFIG_INPUT_MATRIXKMAP is not set + +# +# Userland interfaces +# +CONFIG_INPUT_MOUSEDEV=y +CONFIG_INPUT_MOUSEDEV_PSAUX=y +CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 +CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 +# CONFIG_INPUT_JOYDEV is not set +CONFIG_INPUT_EVDEV=y +# CONFIG_INPUT_EVBUG is not set + +# +# Input Device Drivers +# +CONFIG_INPUT_KEYBOARD=y +# CONFIG_KEYBOARD_ADP5588 is not set +# CONFIG_KEYBOARD_ADP5589 is not set +CONFIG_KEYBOARD_ATKBD=y +# CONFIG_KEYBOARD_QT1070 is not set +# CONFIG_KEYBOARD_QT2160 is not set +# CONFIG_KEYBOARD_LKKBD is not set +# CONFIG_KEYBOARD_GPIO is not set +# CONFIG_KEYBOARD_GPIO_POLLED is not set +# CONFIG_KEYBOARD_TCA6416 is not set +# CONFIG_KEYBOARD_TCA8418 is not set +# CONFIG_KEYBOARD_MATRIX is not set +# CONFIG_KEYBOARD_LM8323 is not set +# CONFIG_KEYBOARD_LM8333 is not set +# CONFIG_KEYBOARD_MAX7359 is not set +# CONFIG_KEYBOARD_MCS is not set +# CONFIG_KEYBOARD_MPR121 is not set +# CONFIG_KEYBOARD_NEWTON is not set +# CONFIG_KEYBOARD_OPENCORES is not set +# CONFIG_KEYBOARD_SAMSUNG is not set +# CONFIG_KEYBOARD_STOWAWAY is not set +# CONFIG_KEYBOARD_SUNKBD is not set +# CONFIG_KEYBOARD_OMAP4 is not set +# CONFIG_KEYBOARD_XTKBD is not set +# CONFIG_KEYBOARD_CAP11XX is not set +# CONFIG_KEYBOARD_BCM is not set +CONFIG_INPUT_MOUSE=y +CONFIG_MOUSE_PS2=y +CONFIG_MOUSE_PS2_ALPS=y +CONFIG_MOUSE_PS2_LOGIPS2PP=y +CONFIG_MOUSE_PS2_SYNAPTICS=y +CONFIG_MOUSE_PS2_CYPRESS=y +CONFIG_MOUSE_PS2_TRACKPOINT=y +# CONFIG_MOUSE_PS2_ELANTECH is not set +# CONFIG_MOUSE_PS2_SENTELIC is not set +# CONFIG_MOUSE_PS2_TOUCHKIT is not set +CONFIG_MOUSE_PS2_FOCALTECH=y +# CONFIG_MOUSE_SERIAL is not set +# CONFIG_MOUSE_APPLETOUCH is not set +# CONFIG_MOUSE_BCM5974 is not set +# CONFIG_MOUSE_CYAPA is not set +# CONFIG_MOUSE_ELAN_I2C is not set +# CONFIG_MOUSE_VSXXXAA is not set +# CONFIG_MOUSE_GPIO is not set +# CONFIG_MOUSE_SYNAPTICS_I2C is not set +# CONFIG_MOUSE_SYNAPTICS_USB is not set +# CONFIG_INPUT_JOYSTICK is not set +# CONFIG_INPUT_TABLET is not set +# CONFIG_INPUT_TOUCHSCREEN is not set +# CONFIG_INPUT_MISC is not set + +# +# Hardware I/O ports +# +CONFIG_SERIO=y +# CONFIG_SERIO_SERPORT is not set +CONFIG_SERIO_AMBAKMI=y +CONFIG_SERIO_LIBPS2=y +# CONFIG_SERIO_RAW is not set +# CONFIG_SERIO_ALTERA_PS2 is not set +# CONFIG_SERIO_PS2MULT is not set +# CONFIG_SERIO_ARC_PS2 is not set +# CONFIG_SERIO_APBPS2 is not set +# CONFIG_USERIO is not set +# CONFIG_GAMEPORT is not set + +# +# Character devices +# +CONFIG_TTY=y +CONFIG_VT=y +CONFIG_CONSOLE_TRANSLATIONS=y +CONFIG_VT_CONSOLE=y +CONFIG_VT_CONSOLE_SLEEP=y +CONFIG_HW_CONSOLE=y +CONFIG_VT_HW_CONSOLE_BINDING=y +CONFIG_UNIX98_PTYS=y +# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set +CONFIG_LEGACY_PTYS=y +CONFIG_LEGACY_PTY_COUNT=16 +# CONFIG_SERIAL_NONSTANDARD is not set +# CONFIG_N_GSM is not set +# CONFIG_TRACE_SINK is not set +CONFIG_DEVMEM=y +CONFIG_DEVKMEM=y + +# +# Serial drivers +# +CONFIG_SERIAL_EARLYCON=y +# CONFIG_SERIAL_8250 is not set + +# +# Non-8250 serial port support +# +# CONFIG_SERIAL_AMBA_PL010 is not set +CONFIG_SERIAL_AMBA_PL011=y +CONFIG_SERIAL_AMBA_PL011_CONSOLE=y +# CONFIG_SERIAL_EARLYCON_ARM_SEMIHOST is not set +# CONFIG_SERIAL_UARTLITE is not set +CONFIG_SERIAL_CORE=y +CONFIG_SERIAL_CORE_CONSOLE=y +# CONFIG_SERIAL_SCCNXP is not set +# CONFIG_SERIAL_SC16IS7XX is not set +# CONFIG_SERIAL_BCM63XX is not set +# CONFIG_SERIAL_ALTERA_JTAGUART is not set +# CONFIG_SERIAL_ALTERA_UART is not set +# CONFIG_SERIAL_XILINX_PS_UART is not set +# CONFIG_SERIAL_ARC is not set +# CONFIG_SERIAL_FSL_LPUART is not set +# CONFIG_SERIAL_CONEXANT_DIGICOLOR is not set +# CONFIG_SERIAL_ST_ASC is not set +# CONFIG_SERIAL_STM32 is not set +CONFIG_HVC_DRIVER=y +# CONFIG_HVC_DCC is not set +CONFIG_VIRTIO_CONSOLE=y +# CONFIG_IPMI_HANDLER is not set +CONFIG_HW_RANDOM=y +# CONFIG_HW_RANDOM_TIMERIOMEM is not set +CONFIG_HW_RANDOM_VIRTIO=y +# CONFIG_R3964 is not set +# CONFIG_RAW_DRIVER is not set +# CONFIG_TCG_TPM is not set +# CONFIG_XILLYBUS is not set + +# +# I2C support +# +CONFIG_I2C=y +CONFIG_I2C_BOARDINFO=y +CONFIG_I2C_COMPAT=y +# CONFIG_I2C_CHARDEV is not set +# CONFIG_I2C_MUX is not set +CONFIG_I2C_HELPER_AUTO=y +CONFIG_I2C_ALGOBIT=y + +# +# I2C Hardware Bus support +# + +# +# I2C system bus drivers (mostly embedded / system-on-chip) +# +# CONFIG_I2C_CBUS_GPIO is not set +# CONFIG_I2C_DESIGNWARE_PLATFORM is not set +# CONFIG_I2C_EMEV2 is not set +# CONFIG_I2C_GPIO is not set +# CONFIG_I2C_NOMADIK is not set +# CONFIG_I2C_OCORES is not set +# CONFIG_I2C_PCA_PLATFORM is not set +# CONFIG_I2C_PXA_PCI is not set +# CONFIG_I2C_RK3X is not set +# CONFIG_I2C_SIMTEC is not set +CONFIG_I2C_VERSATILE=y +# CONFIG_I2C_XILINX is not set + +# +# External I2C/SMBus adapter drivers +# +# CONFIG_I2C_DIOLAN_U2C is not set +# CONFIG_I2C_PARPORT_LIGHT is not set +# CONFIG_I2C_ROBOTFUZZ_OSIF is not set +# CONFIG_I2C_TAOS_EVM is not set +# CONFIG_I2C_TINY_USB is not set + +# +# Other I2C/SMBus bus drivers +# +# CONFIG_I2C_STUB is not set +# CONFIG_I2C_SLAVE is not set +# CONFIG_I2C_DEBUG_CORE is not set +# CONFIG_I2C_DEBUG_ALGO is not set +# CONFIG_I2C_DEBUG_BUS is not set +# CONFIG_SPI is not set +# CONFIG_SPMI is not set +# CONFIG_HSI is not set + +# +# PPS support +# +# CONFIG_PPS is not set + +# +# PPS generators support +# + +# +# PTP clock support +# +# CONFIG_PTP_1588_CLOCK is not set + +# +# Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks. +# +CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y +CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y +CONFIG_ARCH_REQUIRE_GPIOLIB=y +CONFIG_GPIOLIB=y +CONFIG_GPIO_DEVRES=y +CONFIG_OF_GPIO=y +# CONFIG_DEBUG_GPIO is not set +# CONFIG_GPIO_SYSFS is not set +CONFIG_GPIO_GENERIC=y + +# +# Memory mapped GPIO drivers +# +# CONFIG_GPIO_74XX_MMIO is not set +# CONFIG_GPIO_ALTERA is not set +# CONFIG_GPIO_DWAPB is not set +# CONFIG_GPIO_EM is not set +CONFIG_GPIO_GENERIC_PLATFORM=y +# CONFIG_GPIO_GRGPIO is not set +# CONFIG_GPIO_PL061 is not set +# CONFIG_GPIO_SYSCON is not set +# CONFIG_GPIO_XILINX is not set +# CONFIG_GPIO_ZEVIO is not set +# CONFIG_GPIO_ZX is not set + +# +# I2C GPIO expanders +# +# CONFIG_GPIO_ADP5588 is not set +# CONFIG_GPIO_ADNP is not set +# CONFIG_GPIO_MAX7300 is not set +# CONFIG_GPIO_MAX732X is not set +# CONFIG_GPIO_PCA953X is not set +# CONFIG_GPIO_PCF857X is not set +# CONFIG_GPIO_SX150X is not set + +# +# MFD GPIO expanders +# + +# +# SPI or I2C GPIO expanders +# +# CONFIG_GPIO_MCP23S08 is not set + +# +# USB GPIO expanders +# +# CONFIG_W1 is not set +CONFIG_POWER_SUPPLY=y +# CONFIG_POWER_SUPPLY_DEBUG is not set +# CONFIG_PDA_POWER is not set +# CONFIG_TEST_POWER is not set +# CONFIG_BATTERY_DS2780 is not set +# CONFIG_BATTERY_DS2781 is not set +# CONFIG_BATTERY_DS2782 is not set +# CONFIG_BATTERY_SBS is not set +# CONFIG_BATTERY_BQ27XXX is not set +# CONFIG_BATTERY_MAX17040 is not set +# CONFIG_BATTERY_MAX17042 is not set +# CONFIG_CHARGER_MAX8903 is not set +# CONFIG_CHARGER_LP8727 is not set +# CONFIG_CHARGER_GPIO is not set +# CONFIG_CHARGER_MANAGER is not set +# CONFIG_CHARGER_BQ2415X is not set +# CONFIG_CHARGER_BQ24190 is not set +# CONFIG_CHARGER_BQ24735 is not set +# CONFIG_CHARGER_BQ25890 is not set +# CONFIG_CHARGER_SMB347 is not set +# CONFIG_BATTERY_GAUGE_LTC2941 is not set +# CONFIG_CHARGER_RT9455 is not set +CONFIG_POWER_RESET=y +# CONFIG_POWER_RESET_BRCMSTB is not set +# CONFIG_POWER_RESET_GPIO is not set +# CONFIG_POWER_RESET_GPIO_RESTART is not set +# CONFIG_POWER_RESET_LTC2952 is not set +# CONFIG_POWER_RESET_RESTART is not set +# CONFIG_POWER_RESET_VERSATILE is not set +CONFIG_POWER_RESET_VEXPRESS=y +# CONFIG_POWER_RESET_SYSCON is not set +# CONFIG_POWER_RESET_SYSCON_POWEROFF is not set +# CONFIG_POWER_AVS is not set +CONFIG_HWMON=y +# CONFIG_HWMON_VID is not set +# CONFIG_HWMON_DEBUG_CHIP is not set + +# +# Native drivers +# +# CONFIG_SENSORS_AD7414 is not set +# CONFIG_SENSORS_AD7418 is not set +# CONFIG_SENSORS_ADM1021 is not set +# CONFIG_SENSORS_ADM1025 is not set +# CONFIG_SENSORS_ADM1026 is not set +# CONFIG_SENSORS_ADM1029 is not set +# CONFIG_SENSORS_ADM1031 is not set +# CONFIG_SENSORS_ADM9240 is not set +# CONFIG_SENSORS_ADT7410 is not set +# CONFIG_SENSORS_ADT7411 is not set +# CONFIG_SENSORS_ADT7462 is not set +# CONFIG_SENSORS_ADT7470 is not set +# CONFIG_SENSORS_ADT7475 is not set +# CONFIG_SENSORS_ASC7621 is not set +# CONFIG_SENSORS_ATXP1 is not set +# CONFIG_SENSORS_DS620 is not set +# CONFIG_SENSORS_DS1621 is not set +# CONFIG_SENSORS_F71805F is not set +# CONFIG_SENSORS_F71882FG is not set +# CONFIG_SENSORS_F75375S is not set +# CONFIG_SENSORS_GL518SM is not set +# CONFIG_SENSORS_GL520SM is not set +# CONFIG_SENSORS_G760A is not set +# CONFIG_SENSORS_G762 is not set +# CONFIG_SENSORS_GPIO_FAN is not set +# CONFIG_SENSORS_HIH6130 is not set +# CONFIG_SENSORS_IT87 is not set +# CONFIG_SENSORS_JC42 is not set +# CONFIG_SENSORS_POWR1220 is not set +# CONFIG_SENSORS_LINEAGE is not set +# CONFIG_SENSORS_LTC2945 is not set +# CONFIG_SENSORS_LTC4151 is not set +# CONFIG_SENSORS_LTC4215 is not set +# CONFIG_SENSORS_LTC4222 is not set +# CONFIG_SENSORS_LTC4245 is not set +# CONFIG_SENSORS_LTC4260 is not set +# CONFIG_SENSORS_LTC4261 is not set +# CONFIG_SENSORS_MAX16065 is not set +# CONFIG_SENSORS_MAX1619 is not set +# CONFIG_SENSORS_MAX1668 is not set +# CONFIG_SENSORS_MAX197 is not set +# CONFIG_SENSORS_MAX6639 is not set +# CONFIG_SENSORS_MAX6642 is not set +# CONFIG_SENSORS_MAX6650 is not set +# CONFIG_SENSORS_MAX6697 is not set +# CONFIG_SENSORS_MAX31790 is not set +# CONFIG_SENSORS_HTU21 is not set +# CONFIG_SENSORS_MCP3021 is not set +# CONFIG_SENSORS_LM63 is not set +# CONFIG_SENSORS_LM73 is not set +# CONFIG_SENSORS_LM75 is not set +# CONFIG_SENSORS_LM77 is not set +# CONFIG_SENSORS_LM78 is not set +# CONFIG_SENSORS_LM80 is not set +# CONFIG_SENSORS_LM83 is not set +# CONFIG_SENSORS_LM85 is not set +# CONFIG_SENSORS_LM87 is not set +# CONFIG_SENSORS_LM90 is not set +# CONFIG_SENSORS_LM92 is not set +# CONFIG_SENSORS_LM93 is not set +# CONFIG_SENSORS_LM95234 is not set +# CONFIG_SENSORS_LM95241 is not set +# CONFIG_SENSORS_LM95245 is not set +# CONFIG_SENSORS_PC87360 is not set +# CONFIG_SENSORS_PC87427 is not set +# CONFIG_SENSORS_NTC_THERMISTOR is not set +# CONFIG_SENSORS_NCT6683 is not set +# CONFIG_SENSORS_NCT6775 is not set +# CONFIG_SENSORS_NCT7802 is not set +# CONFIG_SENSORS_NCT7904 is not set +# CONFIG_SENSORS_PCF8591 is not set +# CONFIG_PMBUS is not set +# CONFIG_SENSORS_SHT15 is not set +# CONFIG_SENSORS_SHT21 is not set +# CONFIG_SENSORS_SHTC1 is not set +# CONFIG_SENSORS_DME1737 is not set +# CONFIG_SENSORS_EMC1403 is not set +# CONFIG_SENSORS_EMC2103 is not set +# CONFIG_SENSORS_EMC6W201 is not set +# CONFIG_SENSORS_SMSC47M1 is not set +# CONFIG_SENSORS_SMSC47M192 is not set +# CONFIG_SENSORS_SMSC47B397 is not set +# CONFIG_SENSORS_SCH56XX_COMMON is not set +# CONFIG_SENSORS_SMM665 is not set +# CONFIG_SENSORS_ADC128D818 is not set +# CONFIG_SENSORS_ADS1015 is not set +# CONFIG_SENSORS_ADS7828 is not set +# CONFIG_SENSORS_AMC6821 is not set +# CONFIG_SENSORS_INA209 is not set +# CONFIG_SENSORS_INA2XX is not set +# CONFIG_SENSORS_TC74 is not set +# CONFIG_SENSORS_THMC50 is not set +# CONFIG_SENSORS_TMP102 is not set +# CONFIG_SENSORS_TMP103 is not set +# CONFIG_SENSORS_TMP401 is not set +# CONFIG_SENSORS_TMP421 is not set +CONFIG_SENSORS_VEXPRESS=y +# CONFIG_SENSORS_VT1211 is not set +# CONFIG_SENSORS_W83781D is not set +# CONFIG_SENSORS_W83791D is not set +# CONFIG_SENSORS_W83792D is not set +# CONFIG_SENSORS_W83793 is not set +# CONFIG_SENSORS_W83795 is not set +# CONFIG_SENSORS_W83L785TS is not set +# CONFIG_SENSORS_W83L786NG is not set +# CONFIG_SENSORS_W83627HF is not set +# CONFIG_SENSORS_W83627EHF is not set +# CONFIG_THERMAL is not set +# CONFIG_WATCHDOG is not set +CONFIG_SSB_POSSIBLE=y + +# +# Sonics Silicon Backplane +# +# CONFIG_SSB is not set +CONFIG_BCMA_POSSIBLE=y + +# +# Broadcom specific AMBA +# +# CONFIG_BCMA is not set + +# +# Multifunction device drivers +# +CONFIG_MFD_CORE=y +# CONFIG_MFD_AS3711 is not set +# CONFIG_MFD_AS3722 is not set +# CONFIG_PMIC_ADP5520 is not set +# CONFIG_MFD_AAT2870_CORE is not set +# CONFIG_MFD_ATMEL_FLEXCOM is not set +# CONFIG_MFD_ATMEL_HLCDC is not set +# CONFIG_MFD_BCM590XX is not set +# CONFIG_MFD_AXP20X is not set +# CONFIG_MFD_CROS_EC is not set +# CONFIG_MFD_ASIC3 is not set +# CONFIG_PMIC_DA903X is not set +# CONFIG_MFD_DA9052_I2C is not set +# CONFIG_MFD_DA9055 is not set +# CONFIG_MFD_DA9062 is not set +# CONFIG_MFD_DA9063 is not set +# CONFIG_MFD_DA9150 is not set +# CONFIG_MFD_DLN2 is not set +# CONFIG_MFD_MC13XXX_I2C is not set +# CONFIG_MFD_HI6421_PMIC is not set +# CONFIG_HTC_EGPIO is not set +# CONFIG_HTC_PASIC3 is not set +# CONFIG_HTC_I2CPLD is not set +# CONFIG_INTEL_SOC_PMIC is not set +# CONFIG_MFD_KEMPLD is not set +# CONFIG_MFD_88PM800 is not set +# CONFIG_MFD_88PM805 is not set +# CONFIG_MFD_88PM860X is not set +# CONFIG_MFD_MAX14577 is not set +# CONFIG_MFD_MAX77686 is not set +# CONFIG_MFD_MAX77693 is not set +# CONFIG_MFD_MAX77843 is not set +# CONFIG_MFD_MAX8907 is not set +# CONFIG_MFD_MAX8925 is not set +# CONFIG_MFD_MAX8997 is not set +# CONFIG_MFD_MAX8998 is not set +# CONFIG_MFD_MT6397 is not set +# CONFIG_MFD_MENF21BMC is not set +# CONFIG_MFD_VIPERBOARD is not set +# CONFIG_MFD_RETU is not set +# CONFIG_MFD_PCF50633 is not set +# CONFIG_UCB1400_CORE is not set +# CONFIG_MFD_PM8921_CORE is not set +# CONFIG_MFD_RT5033 is not set +# CONFIG_MFD_RTSX_USB is not set +# CONFIG_MFD_RC5T583 is not set +# CONFIG_MFD_RK808 is not set +# CONFIG_MFD_RN5T618 is not set +# CONFIG_MFD_SEC_CORE is not set +# CONFIG_MFD_SI476X_CORE is not set +# CONFIG_MFD_SM501 is not set +# CONFIG_MFD_SKY81452 is not set +# CONFIG_MFD_SMSC is not set +# CONFIG_ABX500_CORE is not set +# CONFIG_MFD_STMPE is not set +CONFIG_MFD_SYSCON=y +# CONFIG_MFD_TI_AM335X_TSCADC is not set +# CONFIG_MFD_LP3943 is not set +# CONFIG_MFD_LP8788 is not set +# CONFIG_MFD_PALMAS is not set +# CONFIG_TPS6105X is not set +# CONFIG_TPS65010 is not set +# CONFIG_TPS6507X is not set +# CONFIG_MFD_TPS65090 is not set +# CONFIG_MFD_TPS65217 is not set +# CONFIG_MFD_TPS65218 is not set +# CONFIG_MFD_TPS6586X is not set +# CONFIG_MFD_TPS65910 is not set +# CONFIG_MFD_TPS65912 is not set +# CONFIG_MFD_TPS65912_I2C is not set +# CONFIG_MFD_TPS80031 is not set +# CONFIG_TWL4030_CORE is not set +# CONFIG_TWL6040_CORE is not set +# CONFIG_MFD_WL1273_CORE is not set +# CONFIG_MFD_LM3533 is not set +# CONFIG_MFD_TC3589X is not set +# CONFIG_MFD_TMIO is not set +# CONFIG_MFD_T7L66XB is not set +# CONFIG_MFD_TC6387XB is not set +# CONFIG_MFD_TC6393XB is not set +# CONFIG_MFD_ARIZONA_I2C is not set +# CONFIG_MFD_WM8400 is not set +# CONFIG_MFD_WM831X_I2C is not set +# CONFIG_MFD_WM8350_I2C is not set +# CONFIG_MFD_WM8994 is not set +CONFIG_MFD_VEXPRESS_SYSREG=y +CONFIG_REGULATOR=y +# CONFIG_REGULATOR_DEBUG is not set +CONFIG_REGULATOR_FIXED_VOLTAGE=y +# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set +# CONFIG_REGULATOR_USERSPACE_CONSUMER is not set +# CONFIG_REGULATOR_ACT8865 is not set +# CONFIG_REGULATOR_AD5398 is not set +# CONFIG_REGULATOR_ANATOP is not set +# CONFIG_REGULATOR_DA9210 is not set +# CONFIG_REGULATOR_DA9211 is not set +# CONFIG_REGULATOR_FAN53555 is not set +# CONFIG_REGULATOR_GPIO is not set +# CONFIG_REGULATOR_ISL9305 is not set +# CONFIG_REGULATOR_ISL6271A is not set +# CONFIG_REGULATOR_LP3971 is not set +# CONFIG_REGULATOR_LP3972 is not set +# CONFIG_REGULATOR_LP872X is not set +# CONFIG_REGULATOR_LP8755 is not set +# CONFIG_REGULATOR_LTC3589 is not set +# CONFIG_REGULATOR_MAX1586 is not set +# CONFIG_REGULATOR_MAX8649 is not set +# CONFIG_REGULATOR_MAX8660 is not set +# CONFIG_REGULATOR_MAX8952 is not set +# CONFIG_REGULATOR_MAX8973 is not set +# CONFIG_REGULATOR_MT6311 is not set +# CONFIG_REGULATOR_PFUZE100 is not set +# CONFIG_REGULATOR_TPS51632 is not set +# CONFIG_REGULATOR_TPS62360 is not set +# CONFIG_REGULATOR_TPS65023 is not set +# CONFIG_REGULATOR_TPS6507X is not set +CONFIG_REGULATOR_VEXPRESS=y +# CONFIG_MEDIA_SUPPORT is not set + +# +# Graphics support +# +# CONFIG_DRM is not set + +# +# Frame buffer Devices +# +CONFIG_FB=y +# CONFIG_FIRMWARE_EDID is not set +CONFIG_FB_CMDLINE=y +# CONFIG_FB_DDC is not set +# CONFIG_FB_BOOT_VESA_SUPPORT is not set +CONFIG_FB_CFB_FILLRECT=y +CONFIG_FB_CFB_COPYAREA=y +CONFIG_FB_CFB_IMAGEBLIT=y +# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set +# CONFIG_FB_SYS_FILLRECT is not set +# CONFIG_FB_SYS_COPYAREA is not set +# CONFIG_FB_SYS_IMAGEBLIT is not set +# CONFIG_FB_FOREIGN_ENDIAN is not set +# CONFIG_FB_SYS_FOPS is not set +# CONFIG_FB_SVGALIB is not set +# CONFIG_FB_MACMODES is not set +# CONFIG_FB_BACKLIGHT is not set +CONFIG_FB_MODE_HELPERS=y +# CONFIG_FB_TILEBLITTING is not set + +# +# Frame buffer hardware drivers +# +CONFIG_FB_ARMCLCD=y +CONFIG_PLAT_VERSATILE_CLCD=y +# CONFIG_FB_OPENCORES is not set +# CONFIG_FB_S1D13XXX is not set +# CONFIG_FB_SMSCUFX is not set +# CONFIG_FB_UDL is not set +# CONFIG_FB_IBM_GXT4500 is not set +# CONFIG_FB_VIRTUAL is not set +# CONFIG_FB_METRONOME is not set +# CONFIG_FB_BROADSHEET is not set +# CONFIG_FB_AUO_K190X is not set +# CONFIG_FB_SIMPLE is not set +# CONFIG_FB_SSD1307 is not set +# CONFIG_BACKLIGHT_LCD_SUPPORT is not set +# CONFIG_VGASTATE is not set +CONFIG_VIDEOMODE_HELPERS=y + +# +# Console display driver support +# +CONFIG_DUMMY_CONSOLE=y +CONFIG_FRAMEBUFFER_CONSOLE=y +# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set +# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set +CONFIG_LOGO=y +# CONFIG_LOGO_LINUX_MONO is not set +# CONFIG_LOGO_LINUX_VGA16 is not set +CONFIG_LOGO_LINUX_CLUT224=y +CONFIG_SOUND=y +CONFIG_SOUND_OSS_CORE=y +CONFIG_SOUND_OSS_CORE_PRECLAIM=y +CONFIG_SND=y +CONFIG_SND_TIMER=y +CONFIG_SND_PCM=y +# CONFIG_SND_SEQUENCER is not set +CONFIG_SND_OSSEMUL=y +CONFIG_SND_MIXER_OSS=y +CONFIG_SND_PCM_OSS=y +CONFIG_SND_PCM_OSS_PLUGINS=y +CONFIG_SND_PCM_TIMER=y +# CONFIG_SND_DYNAMIC_MINORS is not set +CONFIG_SND_SUPPORT_OLD_API=y +CONFIG_SND_PROC_FS=y +CONFIG_SND_VERBOSE_PROCFS=y +# CONFIG_SND_VERBOSE_PRINTK is not set +# CONFIG_SND_DEBUG is not set +CONFIG_SND_VMASTER=y +# CONFIG_SND_RAWMIDI_SEQ is not set +# CONFIG_SND_OPL3_LIB_SEQ is not set +# CONFIG_SND_OPL4_LIB_SEQ is not set +# CONFIG_SND_SBAWE_SEQ is not set +# CONFIG_SND_EMU10K1_SEQ is not set +CONFIG_SND_AC97_CODEC=y +# CONFIG_SND_DRIVERS is not set + +# +# HD-Audio +# +CONFIG_SND_HDA_PREALLOC_SIZE=64 +CONFIG_SND_ARM=y +CONFIG_SND_ARMAACI=y +CONFIG_SND_USB=y +# CONFIG_SND_USB_AUDIO is not set +# CONFIG_SND_USB_UA101 is not set +# CONFIG_SND_USB_CAIAQ is not set +# CONFIG_SND_USB_6FIRE is not set +# CONFIG_SND_USB_HIFACE is not set +# CONFIG_SND_BCD2000 is not set +# CONFIG_SND_USB_POD is not set +# CONFIG_SND_USB_PODHD is not set +# CONFIG_SND_USB_TONEPORT is not set +# CONFIG_SND_USB_VARIAX is not set +# CONFIG_SND_SOC is not set +# CONFIG_SOUND_PRIME is not set +CONFIG_AC97_BUS=y + +# +# HID support +# +CONFIG_HID=y +# CONFIG_HID_BATTERY_STRENGTH is not set +# CONFIG_HIDRAW is not set +# CONFIG_UHID is not set +CONFIG_HID_GENERIC=y + +# +# Special HID drivers +# +CONFIG_HID_A4TECH=y +# CONFIG_HID_ACRUX is not set +CONFIG_HID_APPLE=y +# CONFIG_HID_APPLEIR is not set +# CONFIG_HID_AUREAL is not set +CONFIG_HID_BELKIN=y +# CONFIG_HID_BETOP_FF is not set +CONFIG_HID_CHERRY=y +CONFIG_HID_CHICONY=y +# CONFIG_HID_CORSAIR is not set +# CONFIG_HID_PRODIKEYS is not set +# CONFIG_HID_CP2112 is not set +CONFIG_HID_CYPRESS=y +CONFIG_HID_DRAGONRISE=y +# CONFIG_DRAGONRISE_FF is not set +# CONFIG_HID_EMS_FF is not set +# CONFIG_HID_ELECOM is not set +# CONFIG_HID_ELO is not set +CONFIG_HID_EZKEY=y +# CONFIG_HID_GEMBIRD is not set +# CONFIG_HID_GFRM is not set +# CONFIG_HID_HOLTEK is not set +# CONFIG_HID_GT683R is not set +# CONFIG_HID_KEYTOUCH is not set +# CONFIG_HID_KYE is not set +# CONFIG_HID_UCLOGIC is not set +# CONFIG_HID_WALTOP is not set +CONFIG_HID_GYRATION=y +# CONFIG_HID_ICADE is not set +CONFIG_HID_TWINHAN=y +CONFIG_HID_KENSINGTON=y +# CONFIG_HID_LCPOWER is not set +# CONFIG_HID_LENOVO is not set +CONFIG_HID_LOGITECH=y +# CONFIG_HID_LOGITECH_HIDPP is not set +# CONFIG_LOGITECH_FF is not set +# CONFIG_LOGIRUMBLEPAD2_FF is not set +# CONFIG_LOGIG940_FF is not set +# CONFIG_LOGIWHEELS_FF is not set +# CONFIG_HID_MAGICMOUSE is not set +CONFIG_HID_MICROSOFT=y +CONFIG_HID_MONTEREY=y +# CONFIG_HID_MULTITOUCH is not set +CONFIG_HID_NTRIG=y +# CONFIG_HID_ORTEK is not set +CONFIG_HID_PANTHERLORD=y +# CONFIG_PANTHERLORD_FF is not set +# CONFIG_HID_PENMOUNT is not set +CONFIG_HID_PETALYNX=y +# CONFIG_HID_PICOLCD is not set +# CONFIG_HID_PLANTRONICS is not set +# CONFIG_HID_PRIMAX is not set +# CONFIG_HID_ROCCAT is not set +# CONFIG_HID_SAITEK is not set +CONFIG_HID_SAMSUNG=y +CONFIG_HID_SONY=y +# CONFIG_SONY_FF is not set +# CONFIG_HID_SPEEDLINK is not set +# CONFIG_HID_STEELSERIES is not set +CONFIG_HID_SUNPLUS=y +# CONFIG_HID_RMI is not set +CONFIG_HID_GREENASIA=y +# CONFIG_GREENASIA_FF is not set +CONFIG_HID_SMARTJOYPLUS=y +# CONFIG_SMARTJOYPLUS_FF is not set +# CONFIG_HID_TIVO is not set +CONFIG_HID_TOPSEED=y +# CONFIG_HID_THINGM is not set +CONFIG_HID_THRUSTMASTER=y +# CONFIG_THRUSTMASTER_FF is not set +# CONFIG_HID_WACOM is not set +# CONFIG_HID_WIIMOTE is not set +# CONFIG_HID_XINMO is not set +CONFIG_HID_ZEROPLUS=y +# CONFIG_ZEROPLUS_FF is not set +# CONFIG_HID_ZYDACRON is not set +# CONFIG_HID_SENSOR_HUB is not set + +# +# USB HID support +# +CONFIG_USB_HID=y +# CONFIG_HID_PID is not set +# CONFIG_USB_HIDDEV is not set + +# +# I2C HID support +# +# CONFIG_I2C_HID is not set +CONFIG_USB_OHCI_LITTLE_ENDIAN=y +CONFIG_USB_SUPPORT=y +CONFIG_USB_COMMON=y +CONFIG_USB_ARCH_HAS_HCD=y +CONFIG_USB=y +CONFIG_USB_ANNOUNCE_NEW_DEVICES=y + +# +# Miscellaneous USB options +# +CONFIG_USB_DEFAULT_PERSIST=y +# CONFIG_USB_DYNAMIC_MINORS is not set +# CONFIG_USB_OTG is not set +# CONFIG_USB_OTG_WHITELIST is not set +# CONFIG_USB_ULPI_BUS is not set +CONFIG_USB_MON=y +# CONFIG_USB_WUSB_CBAF is not set + +# +# USB Host Controller Drivers +# +# CONFIG_USB_C67X00_HCD is not set +# CONFIG_USB_XHCI_HCD is not set +# CONFIG_USB_EHCI_HCD is not set +# CONFIG_USB_OXU210HP_HCD is not set +# CONFIG_USB_ISP116X_HCD is not set +# CONFIG_USB_ISP1362_HCD is not set +# CONFIG_USB_FOTG210_HCD is not set +# CONFIG_USB_OHCI_HCD is not set +# CONFIG_USB_SL811_HCD is not set +# CONFIG_USB_R8A66597_HCD is not set +# CONFIG_USB_HCD_TEST_MODE is not set + +# +# USB Device Class drivers +# +# CONFIG_USB_ACM is not set +# CONFIG_USB_PRINTER is not set +# CONFIG_USB_WDM is not set +# CONFIG_USB_TMC is not set + +# +# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may +# + +# +# also be needed; see USB_STORAGE Help for more info +# +CONFIG_USB_STORAGE=y +# CONFIG_USB_STORAGE_DEBUG is not set +# CONFIG_USB_STORAGE_REALTEK is not set +# CONFIG_USB_STORAGE_DATAFAB is not set +# CONFIG_USB_STORAGE_FREECOM is not set +# CONFIG_USB_STORAGE_ISD200 is not set +# CONFIG_USB_STORAGE_USBAT is not set +# CONFIG_USB_STORAGE_SDDR09 is not set +# CONFIG_USB_STORAGE_SDDR55 is not set +# CONFIG_USB_STORAGE_JUMPSHOT is not set +# CONFIG_USB_STORAGE_ALAUDA is not set +# CONFIG_USB_STORAGE_ONETOUCH is not set +# CONFIG_USB_STORAGE_KARMA is not set +# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set +# CONFIG_USB_STORAGE_ENE_UB6250 is not set +# CONFIG_USB_UAS is not set + +# +# USB Imaging devices +# +# CONFIG_USB_MDC800 is not set +# CONFIG_USB_MICROTEK is not set +# CONFIG_USBIP_CORE is not set +# CONFIG_USB_MUSB_HDRC is not set +# CONFIG_USB_DWC3 is not set +# CONFIG_USB_DWC2 is not set +CONFIG_USB_ISP1760=y +CONFIG_USB_ISP1760_HCD=y +CONFIG_USB_ISP1760_HOST_ROLE=y + +# +# USB port drivers +# +# CONFIG_USB_SERIAL is not set + +# +# USB Miscellaneous drivers +# +# CONFIG_USB_EMI62 is not set +# CONFIG_USB_EMI26 is not set +# CONFIG_USB_ADUTUX is not set +# CONFIG_USB_SEVSEG is not set +# CONFIG_USB_RIO500 is not set +# CONFIG_USB_LEGOTOWER is not set +# CONFIG_USB_LCD is not set +# CONFIG_USB_LED is not set +# CONFIG_USB_CYPRESS_CY7C63 is not set +# CONFIG_USB_CYTHERM is not set +# CONFIG_USB_IDMOUSE is not set +# CONFIG_USB_FTDI_ELAN is not set +# CONFIG_USB_APPLEDISPLAY is not set +# CONFIG_USB_LD is not set +# CONFIG_USB_TRANCEVIBRATOR is not set +# CONFIG_USB_IOWARRIOR is not set +# CONFIG_USB_TEST is not set +# CONFIG_USB_EHSET_TEST_FIXTURE is not set +# CONFIG_USB_ISIGHTFW is not set +# CONFIG_USB_YUREX is not set +# CONFIG_USB_EZUSB_FX2 is not set +# CONFIG_USB_HSIC_USB3503 is not set +# CONFIG_USB_LINK_LAYER_TEST is not set +# CONFIG_USB_CHAOSKEY is not set + +# +# USB Physical Layer drivers +# +# CONFIG_USB_PHY is not set +# CONFIG_NOP_USB_XCEIV is not set +# CONFIG_AM335X_PHY_USB is not set +# CONFIG_USB_GPIO_VBUS is not set +# CONFIG_USB_ISP1301 is not set +# CONFIG_USB_ULPI is not set +# CONFIG_USB_GADGET is not set +# CONFIG_USB_LED_TRIG is not set +# CONFIG_UWB is not set +CONFIG_MMC=y +# CONFIG_MMC_DEBUG is not set + +# +# MMC/SD/SDIO Card Drivers +# +CONFIG_MMC_BLOCK=y +CONFIG_MMC_BLOCK_MINORS=8 +CONFIG_MMC_BLOCK_BOUNCE=y +# CONFIG_SDIO_UART is not set +# CONFIG_MMC_TEST is not set + +# +# MMC/SD/SDIO Host Controller Drivers +# +CONFIG_MMC_ARMMMCI=y +# CONFIG_MMC_SDHCI is not set +# CONFIG_MMC_DW is not set +# CONFIG_MMC_VUB300 is not set +# CONFIG_MMC_USHC is not set +# CONFIG_MMC_USDHI6ROL0 is not set +# CONFIG_MMC_MTK is not set +# CONFIG_MEMSTICK is not set +CONFIG_NEW_LEDS=y +CONFIG_LEDS_CLASS=y +# CONFIG_LEDS_CLASS_FLASH is not set + +# +# LED drivers +# +# CONFIG_LEDS_BCM6328 is not set +# CONFIG_LEDS_BCM6358 is not set +# CONFIG_LEDS_LM3530 is not set +# CONFIG_LEDS_LM3642 is not set +# CONFIG_LEDS_PCA9532 is not set +CONFIG_LEDS_GPIO=y +# CONFIG_LEDS_LP3944 is not set +# CONFIG_LEDS_LP5521 is not set +# CONFIG_LEDS_LP5523 is not set +# CONFIG_LEDS_LP5562 is not set +# CONFIG_LEDS_LP8501 is not set +# CONFIG_LEDS_LP8860 is not set +# CONFIG_LEDS_PCA955X is not set +# CONFIG_LEDS_PCA963X is not set +# CONFIG_LEDS_REGULATOR is not set +# CONFIG_LEDS_BD2802 is not set +# CONFIG_LEDS_LT3593 is not set +# CONFIG_LEDS_TCA6507 is not set +# CONFIG_LEDS_TLC591XX is not set +# CONFIG_LEDS_LM355x is not set + +# +# LED driver for blink(1) USB RGB LED is under Special HID drivers (HID_THINGM) +# +# CONFIG_LEDS_BLINKM is not set +# CONFIG_LEDS_SYSCON is not set + +# +# LED Triggers +# +CONFIG_LEDS_TRIGGERS=y +# CONFIG_LEDS_TRIGGER_TIMER is not set +# CONFIG_LEDS_TRIGGER_ONESHOT is not set +CONFIG_LEDS_TRIGGER_HEARTBEAT=y +# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set +CONFIG_LEDS_TRIGGER_CPU=y +# CONFIG_LEDS_TRIGGER_GPIO is not set +# CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set + +# +# iptables trigger is under Netfilter config (LED target) +# +# CONFIG_LEDS_TRIGGER_TRANSIENT is not set +# CONFIG_LEDS_TRIGGER_CAMERA is not set +# CONFIG_ACCESSIBILITY is not set +CONFIG_EDAC_ATOMIC_SCRUB=y +CONFIG_EDAC_SUPPORT=y +# CONFIG_EDAC is not set +CONFIG_RTC_LIB=y +CONFIG_RTC_CLASS=y +CONFIG_RTC_HCTOSYS=y +CONFIG_RTC_HCTOSYS_DEVICE="rtc0" +CONFIG_RTC_SYSTOHC=y +CONFIG_RTC_SYSTOHC_DEVICE="rtc0" +# CONFIG_RTC_DEBUG is not set + +# +# RTC interfaces +# +CONFIG_RTC_INTF_SYSFS=y +CONFIG_RTC_INTF_PROC=y +CONFIG_RTC_INTF_DEV=y +# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set +# CONFIG_RTC_DRV_TEST is not set + +# +# I2C RTC drivers +# +# CONFIG_RTC_DRV_ABB5ZES3 is not set +# CONFIG_RTC_DRV_ABX80X is not set +# CONFIG_RTC_DRV_DS1307 is not set +# CONFIG_RTC_DRV_DS1374 is not set +# CONFIG_RTC_DRV_DS1672 is not set +# CONFIG_RTC_DRV_DS3232 is not set +# CONFIG_RTC_DRV_HYM8563 is not set +# CONFIG_RTC_DRV_MAX6900 is not set +# CONFIG_RTC_DRV_RS5C372 is not set +# CONFIG_RTC_DRV_ISL1208 is not set +# CONFIG_RTC_DRV_ISL12022 is not set +# CONFIG_RTC_DRV_ISL12057 is not set +# CONFIG_RTC_DRV_X1205 is not set +# CONFIG_RTC_DRV_PCF2127 is not set +# CONFIG_RTC_DRV_PCF8523 is not set +# CONFIG_RTC_DRV_PCF8563 is not set +# CONFIG_RTC_DRV_PCF85063 is not set +# CONFIG_RTC_DRV_PCF8583 is not set +# CONFIG_RTC_DRV_M41T80 is not set +# CONFIG_RTC_DRV_BQ32K is not set +# CONFIG_RTC_DRV_S35390A is not set +# CONFIG_RTC_DRV_FM3130 is not set +# CONFIG_RTC_DRV_RX8581 is not set +# CONFIG_RTC_DRV_RX8025 is not set +# CONFIG_RTC_DRV_EM3027 is not set +# CONFIG_RTC_DRV_RV3029C2 is not set +# CONFIG_RTC_DRV_RV8803 is not set + +# +# SPI RTC drivers +# + +# +# Platform RTC drivers +# +# CONFIG_RTC_DRV_CMOS is not set +# CONFIG_RTC_DRV_DS1286 is not set +# CONFIG_RTC_DRV_DS1511 is not set +# CONFIG_RTC_DRV_DS1553 is not set +# CONFIG_RTC_DRV_DS1685_FAMILY is not set +# CONFIG_RTC_DRV_DS1742 is not set +# CONFIG_RTC_DRV_DS2404 is not set +# CONFIG_RTC_DRV_STK17TA8 is not set +# CONFIG_RTC_DRV_M48T86 is not set +# CONFIG_RTC_DRV_M48T35 is not set +# CONFIG_RTC_DRV_M48T59 is not set +# CONFIG_RTC_DRV_MSM6242 is not set +# CONFIG_RTC_DRV_BQ4802 is not set +# CONFIG_RTC_DRV_RP5C01 is not set +# CONFIG_RTC_DRV_V3020 is not set +# CONFIG_RTC_DRV_ZYNQMP is not set + +# +# on-CPU RTC drivers +# +# CONFIG_RTC_DRV_PL030 is not set +CONFIG_RTC_DRV_PL031=y +# CONFIG_RTC_DRV_SNVS is not set + +# +# HID Sensor RTC drivers +# +# CONFIG_RTC_DRV_HID_SENSOR_TIME is not set +# CONFIG_DMADEVICES is not set +# CONFIG_AUXDISPLAY is not set +# CONFIG_UIO is not set +# CONFIG_VIRT_DRIVERS is not set +CONFIG_VIRTIO=y + +# +# Virtio drivers +# +CONFIG_VIRTIO_BALLOON=y +# CONFIG_VIRTIO_INPUT is not set +CONFIG_VIRTIO_MMIO=y +CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES=y + +# +# Microsoft Hyper-V guest support +# +# CONFIG_STAGING is not set +# CONFIG_CHROME_PLATFORMS is not set +CONFIG_CLKDEV_LOOKUP=y +CONFIG_HAVE_CLK_PREPARE=y +CONFIG_COMMON_CLK=y + +# +# Common Clock Framework +# +CONFIG_COMMON_CLK_VERSATILE=y +CONFIG_CLK_SP810=y +CONFIG_CLK_VEXPRESS_OSC=y +# CONFIG_COMMON_CLK_SI5351 is not set +# CONFIG_COMMON_CLK_SI514 is not set +# CONFIG_COMMON_CLK_SI570 is not set +# CONFIG_COMMON_CLK_CDCE925 is not set +# CONFIG_CLK_QORIQ is not set +# CONFIG_COMMON_CLK_PXA is not set +# CONFIG_COMMON_CLK_CDCE706 is not set + +# +# Hardware Spinlock drivers +# + +# +# Clock Source drivers +# +CONFIG_CLKSRC_OF=y +CONFIG_CLKSRC_PROBE=y +CONFIG_CLKSRC_MMIO=y +CONFIG_ARM_ARCH_TIMER=y +CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y +CONFIG_ARM_GLOBAL_TIMER=y +CONFIG_ARM_TIMER_SP804=y +CONFIG_CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK=y +# CONFIG_ATMEL_PIT is not set +# CONFIG_SH_TIMER_CMT is not set +# CONFIG_SH_TIMER_MTU2 is not set +# CONFIG_SH_TIMER_TMU is not set +# CONFIG_EM_TIMER_STI is not set +CONFIG_CLKSRC_VERSATILE=y +# CONFIG_MAILBOX is not set +CONFIG_IOMMU_SUPPORT=y + +# +# Generic IOMMU Pagetable Support +# +# CONFIG_IOMMU_IO_PGTABLE_LPAE is not set +# CONFIG_ARM_SMMU is not set + +# +# Remoteproc drivers +# +# CONFIG_STE_MODEM_RPROC is not set + +# +# Rpmsg drivers +# + +# +# SOC (System On Chip) specific Drivers +# +# CONFIG_SOC_BRCMSTB is not set +# CONFIG_SUNXI_SRAM is not set +# CONFIG_SOC_TI is not set +# CONFIG_PM_DEVFREQ is not set +# CONFIG_EXTCON is not set +# CONFIG_MEMORY is not set +# CONFIG_IIO is not set +# CONFIG_PWM is not set +CONFIG_IRQCHIP=y +CONFIG_ARM_GIC=y +# CONFIG_IPACK_BUS is not set +# CONFIG_RESET_CONTROLLER is not set +# CONFIG_FMC is not set + +# +# PHY Subsystem +# +# CONFIG_GENERIC_PHY is not set +# CONFIG_PHY_PXA_28NM_HSIC is not set +# CONFIG_PHY_PXA_28NM_USB2 is not set +# CONFIG_BCM_KONA_USB2_PHY is not set +# CONFIG_POWERCAP is not set +# CONFIG_MCB is not set + +# +# Performance monitor support +# +CONFIG_ARM_PMU=y +# CONFIG_RAS is not set + +# +# Android +# +# CONFIG_ANDROID is not set +# CONFIG_NVMEM is not set +# CONFIG_STM is not set +# CONFIG_STM_DUMMY is not set +# CONFIG_STM_SOURCE_CONSOLE is not set +# CONFIG_INTEL_TH is not set + +# +# FPGA Configuration Support +# +# CONFIG_FPGA is not set + +# +# Firmware Drivers +# +CONFIG_ARM_PSCI_FW=y +# CONFIG_FIRMWARE_MEMMAP is not set + +# +# File systems +# +CONFIG_DCACHE_WORD_ACCESS=y +CONFIG_EXT2_FS=y +# CONFIG_EXT2_FS_XATTR is not set +CONFIG_EXT3_FS=y +# CONFIG_EXT3_FS_POSIX_ACL is not set +# CONFIG_EXT3_FS_SECURITY is not set +CONFIG_EXT4_FS=y +# CONFIG_EXT4_FS_POSIX_ACL is not set +# CONFIG_EXT4_FS_SECURITY is not set +# CONFIG_EXT4_ENCRYPTION is not set +# CONFIG_EXT4_DEBUG is not set +CONFIG_JBD2=y +# CONFIG_JBD2_DEBUG is not set +CONFIG_FS_MBCACHE=y +# CONFIG_REISERFS_FS is not set +# CONFIG_JFS_FS is not set +# CONFIG_BTRFS_FS is not set +# CONFIG_NILFS2_FS is not set +# CONFIG_F2FS_FS is not set +# CONFIG_FS_POSIX_ACL is not set +CONFIG_FILE_LOCKING=y +CONFIG_FSNOTIFY=y +CONFIG_DNOTIFY=y +CONFIG_INOTIFY_USER=y +# CONFIG_FANOTIFY is not set +# CONFIG_QUOTA is not set +# CONFIG_QUOTACTL is not set +# CONFIG_AUTOFS4_FS is not set +# CONFIG_FUSE_FS is not set +# CONFIG_OVERLAY_FS is not set + +# +# Caches +# +# CONFIG_FSCACHE is not set + +# +# CD-ROM/DVD Filesystems +# +# CONFIG_ISO9660_FS is not set +# CONFIG_UDF_FS is not set + +# +# DOS/FAT/NT Filesystems +# +CONFIG_FAT_FS=y +# CONFIG_MSDOS_FS is not set +CONFIG_VFAT_FS=y +CONFIG_FAT_DEFAULT_CODEPAGE=437 +CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" +# CONFIG_NTFS_FS is not set + +# +# Pseudo filesystems +# +CONFIG_PROC_FS=y +CONFIG_PROC_SYSCTL=y +CONFIG_PROC_PAGE_MONITOR=y +# CONFIG_PROC_CHILDREN is not set +CONFIG_KERNFS=y +CONFIG_SYSFS=y +CONFIG_TMPFS=y +# CONFIG_TMPFS_POSIX_ACL is not set +# CONFIG_TMPFS_XATTR is not set +# CONFIG_HUGETLB_PAGE is not set +# CONFIG_CONFIGFS_FS is not set +CONFIG_MISC_FILESYSTEMS=y +# CONFIG_ADFS_FS is not set +# CONFIG_AFFS_FS is not set +# CONFIG_HFS_FS is not set +# CONFIG_HFSPLUS_FS is not set +# CONFIG_BEFS_FS is not set +# CONFIG_BFS_FS is not set +# CONFIG_EFS_FS is not set +CONFIG_JFFS2_FS=y +CONFIG_JFFS2_FS_DEBUG=0 +CONFIG_JFFS2_FS_WRITEBUFFER=y +# CONFIG_JFFS2_FS_WBUF_VERIFY is not set +# CONFIG_JFFS2_SUMMARY is not set +# CONFIG_JFFS2_FS_XATTR is not set +# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set +CONFIG_JFFS2_ZLIB=y +# CONFIG_JFFS2_LZO is not set +CONFIG_JFFS2_RTIME=y +# CONFIG_JFFS2_RUBIN is not set +CONFIG_UBIFS_FS=y +# CONFIG_UBIFS_FS_ADVANCED_COMPR is not set +CONFIG_UBIFS_FS_LZO=y +CONFIG_UBIFS_FS_ZLIB=y +# CONFIG_UBIFS_ATIME_SUPPORT is not set +# CONFIG_LOGFS is not set +CONFIG_CRAMFS=y +CONFIG_SQUASHFS=y +CONFIG_SQUASHFS_FILE_CACHE=y +# CONFIG_SQUASHFS_FILE_DIRECT is not set +CONFIG_SQUASHFS_DECOMP_SINGLE=y +# CONFIG_SQUASHFS_DECOMP_MULTI is not set +# CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU is not set +# CONFIG_SQUASHFS_XATTR is not set +CONFIG_SQUASHFS_ZLIB=y +# CONFIG_SQUASHFS_LZ4 is not set +CONFIG_SQUASHFS_LZO=y +# CONFIG_SQUASHFS_XZ is not set +# CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set +# CONFIG_SQUASHFS_EMBEDDED is not set +CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 +# CONFIG_VXFS_FS is not set +# CONFIG_MINIX_FS is not set +# CONFIG_OMFS_FS is not set +# CONFIG_HPFS_FS is not set +# CONFIG_QNX4FS_FS is not set +# CONFIG_QNX6FS_FS is not set +# CONFIG_ROMFS_FS is not set +# CONFIG_PSTORE is not set +# CONFIG_SYSV_FS is not set +# CONFIG_UFS_FS is not set +CONFIG_NETWORK_FILESYSTEMS=y +CONFIG_NFS_FS=y +CONFIG_NFS_V2=y +CONFIG_NFS_V3=y +# CONFIG_NFS_V3_ACL is not set +# CONFIG_NFS_V4 is not set +# CONFIG_NFS_SWAP is not set +CONFIG_ROOT_NFS=y +# CONFIG_NFSD is not set +CONFIG_GRACE_PERIOD=y +CONFIG_LOCKD=y +CONFIG_LOCKD_V4=y +CONFIG_NFS_COMMON=y +CONFIG_SUNRPC=y +# CONFIG_SUNRPC_DEBUG is not set +# CONFIG_CEPH_FS is not set +# CONFIG_CIFS is not set +# CONFIG_NCP_FS is not set +# CONFIG_CODA_FS is not set +# CONFIG_AFS_FS is not set +CONFIG_9P_FS=y +# CONFIG_9P_FS_POSIX_ACL is not set +# CONFIG_9P_FS_SECURITY is not set +CONFIG_NLS=y +CONFIG_NLS_DEFAULT="iso8859-1" +CONFIG_NLS_CODEPAGE_437=y +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +# CONFIG_NLS_CODEPAGE_850 is not set +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +# CONFIG_NLS_CODEPAGE_936 is not set +# CONFIG_NLS_CODEPAGE_950 is not set +# CONFIG_NLS_CODEPAGE_932 is not set +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_CODEPAGE_1250 is not set +# CONFIG_NLS_CODEPAGE_1251 is not set +# CONFIG_NLS_ASCII is not set +CONFIG_NLS_ISO8859_1=y +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_9 is not set +# CONFIG_NLS_ISO8859_13 is not set +# CONFIG_NLS_ISO8859_14 is not set +# CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_KOI8_U is not set +# CONFIG_NLS_MAC_ROMAN is not set +# CONFIG_NLS_MAC_CELTIC is not set +# CONFIG_NLS_MAC_CENTEURO is not set +# CONFIG_NLS_MAC_CROATIAN is not set +# CONFIG_NLS_MAC_CYRILLIC is not set +# CONFIG_NLS_MAC_GAELIC is not set +# CONFIG_NLS_MAC_GREEK is not set +# CONFIG_NLS_MAC_ICELAND is not set +# CONFIG_NLS_MAC_INUIT is not set +# CONFIG_NLS_MAC_ROMANIAN is not set +# CONFIG_NLS_MAC_TURKISH is not set +# CONFIG_NLS_UTF8 is not set + +# +# Kernel hacking +# + +# +# printk and dmesg options +# +# CONFIG_PRINTK_TIME is not set +CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 +# CONFIG_BOOT_PRINTK_DELAY is not set +# CONFIG_DYNAMIC_DEBUG is not set + +# +# Compile-time checks and compiler options +# +CONFIG_DEBUG_INFO=y +# CONFIG_DEBUG_INFO_REDUCED is not set +# CONFIG_DEBUG_INFO_SPLIT is not set +# CONFIG_DEBUG_INFO_DWARF4 is not set +# CONFIG_GDB_SCRIPTS is not set +CONFIG_ENABLE_WARN_DEPRECATED=y +CONFIG_ENABLE_MUST_CHECK=y +CONFIG_FRAME_WARN=1024 +# CONFIG_STRIP_ASM_SYMS is not set +# CONFIG_READABLE_ASM is not set +# CONFIG_UNUSED_SYMBOLS is not set +# CONFIG_PAGE_OWNER is not set +CONFIG_DEBUG_FS=y +# CONFIG_HEADERS_CHECK is not set +# CONFIG_DEBUG_SECTION_MISMATCH is not set +CONFIG_SECTION_MISMATCH_WARN_ONLY=y +# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set +CONFIG_MAGIC_SYSRQ=y +CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1 +CONFIG_DEBUG_KERNEL=y + +# +# Memory Debugging +# +# CONFIG_PAGE_EXTENSION is not set +# CONFIG_DEBUG_PAGEALLOC is not set +# CONFIG_DEBUG_OBJECTS is not set +# CONFIG_SLUB_DEBUG_ON is not set +# CONFIG_SLUB_STATS is not set +CONFIG_HAVE_DEBUG_KMEMLEAK=y +# CONFIG_DEBUG_KMEMLEAK is not set +# CONFIG_DEBUG_STACK_USAGE is not set +# CONFIG_DEBUG_VM is not set +CONFIG_DEBUG_MEMORY_INIT=y +# CONFIG_DEBUG_PER_CPU_MAPS is not set +# CONFIG_DEBUG_SHIRQ is not set + +# +# Debug Lockups and Hangs +# +# CONFIG_LOCKUP_DETECTOR is not set +CONFIG_DETECT_HUNG_TASK=y +CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=120 +# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set +CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0 +# CONFIG_PANIC_ON_OOPS is not set +CONFIG_PANIC_ON_OOPS_VALUE=0 +CONFIG_PANIC_TIMEOUT=0 +# CONFIG_SCHED_DEBUG is not set +# CONFIG_SCHED_INFO is not set +# CONFIG_SCHEDSTATS is not set +# CONFIG_SCHED_STACK_END_CHECK is not set +# CONFIG_DEBUG_TIMEKEEPING is not set +# CONFIG_TIMER_STATS is not set + +# +# Lock Debugging (spinlocks, mutexes, etc...) +# +# CONFIG_DEBUG_RT_MUTEXES is not set +# CONFIG_DEBUG_SPINLOCK is not set +# CONFIG_DEBUG_MUTEXES is not set +# CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set +# CONFIG_DEBUG_LOCK_ALLOC is not set +# CONFIG_PROVE_LOCKING is not set +# CONFIG_LOCK_STAT is not set +# CONFIG_DEBUG_ATOMIC_SLEEP is not set +# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set +# CONFIG_LOCK_TORTURE_TEST is not set +# CONFIG_STACKTRACE is not set +# CONFIG_DEBUG_KOBJECT is not set +CONFIG_DEBUG_BUGVERBOSE=y +# CONFIG_DEBUG_LIST is not set +# CONFIG_DEBUG_PI_LIST is not set +# CONFIG_DEBUG_SG is not set +# CONFIG_DEBUG_NOTIFIERS is not set +# CONFIG_DEBUG_CREDENTIALS is not set + +# +# RCU Debugging +# +# CONFIG_PROVE_RCU is not set +# CONFIG_SPARSE_RCU_POINTER is not set +# CONFIG_TORTURE_TEST is not set +# CONFIG_RCU_TORTURE_TEST is not set +CONFIG_RCU_CPU_STALL_TIMEOUT=21 +# CONFIG_RCU_TRACE is not set +# CONFIG_RCU_EQS_DEBUG is not set +# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set +# CONFIG_NOTIFIER_ERROR_INJECTION is not set +# CONFIG_FAULT_INJECTION is not set +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_SYSCALL_TRACEPOINTS=y +CONFIG_HAVE_C_RECORDMCOUNT=y +CONFIG_TRACE_CLOCK=y +CONFIG_RING_BUFFER=y +CONFIG_RING_BUFFER_ALLOW_SWAP=y +CONFIG_TRACING_SUPPORT=y +CONFIG_FTRACE=y +# CONFIG_FUNCTION_TRACER is not set +# CONFIG_IRQSOFF_TRACER is not set +# CONFIG_SCHED_TRACER is not set +# CONFIG_ENABLE_DEFAULT_TRACERS is not set +# CONFIG_FTRACE_SYSCALLS is not set +# CONFIG_TRACER_SNAPSHOT is not set +CONFIG_BRANCH_PROFILE_NONE=y +# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set +# CONFIG_PROFILE_ALL_BRANCHES is not set +# CONFIG_STACK_TRACER is not set +# CONFIG_BLK_DEV_IO_TRACE is not set +# CONFIG_UPROBE_EVENT is not set +# CONFIG_PROBE_EVENTS is not set +# CONFIG_TRACEPOINT_BENCHMARK is not set +# CONFIG_RING_BUFFER_BENCHMARK is not set +# CONFIG_RING_BUFFER_STARTUP_TEST is not set +CONFIG_TRACING_EVENTS_GPIO=y + +# +# Runtime Testing +# +# CONFIG_LKDTM is not set +# CONFIG_TEST_LIST_SORT is not set +# CONFIG_BACKTRACE_SELF_TEST is not set +# CONFIG_RBTREE_TEST is not set +# CONFIG_INTERVAL_TREE_TEST is not set +# CONFIG_PERCPU_TEST is not set +# CONFIG_ATOMIC64_SELFTEST is not set +# CONFIG_TEST_HEXDUMP is not set +# CONFIG_TEST_STRING_HELPERS is not set +# CONFIG_TEST_KSTRTOX is not set +# CONFIG_TEST_PRINTF is not set +# CONFIG_TEST_RHASHTABLE is not set +# CONFIG_DMA_API_DEBUG is not set +# CONFIG_TEST_LKM is not set +# CONFIG_TEST_USER_COPY is not set +# CONFIG_TEST_BPF is not set +# CONFIG_TEST_FIRMWARE is not set +# CONFIG_TEST_UDELAY is not set +# CONFIG_MEMTEST is not set +# CONFIG_TEST_STATIC_KEYS is not set +# CONFIG_SAMPLES is not set +CONFIG_HAVE_ARCH_KGDB=y +# CONFIG_KGDB is not set +# CONFIG_ARM_PTDUMP is not set +# CONFIG_STRICT_DEVMEM is not set +CONFIG_ARM_UNWIND=y +CONFIG_DEBUG_USER=y +# CONFIG_DEBUG_LL is not set +CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S" +# CONFIG_DEBUG_UART_8250 is not set +CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h" +# CONFIG_PID_IN_CONTEXTIDR is not set +# CONFIG_DEBUG_SET_MODULE_RONX is not set +# CONFIG_CORESIGHT is not set + +# +# Security options +# +# CONFIG_KEYS is not set +# CONFIG_SECURITY_DMESG_RESTRICT is not set +# CONFIG_SECURITY is not set +# CONFIG_SECURITYFS is not set +CONFIG_DEFAULT_SECURITY_DAC=y +CONFIG_DEFAULT_SECURITY="" +CONFIG_CRYPTO=y + +# +# Crypto core or helper +# +CONFIG_CRYPTO_ALGAPI=y +CONFIG_CRYPTO_ALGAPI2=y +CONFIG_CRYPTO_AEAD=m +CONFIG_CRYPTO_AEAD2=y +CONFIG_CRYPTO_BLKCIPHER2=y +CONFIG_CRYPTO_HASH=y +CONFIG_CRYPTO_HASH2=y +CONFIG_CRYPTO_RNG=m +CONFIG_CRYPTO_RNG2=y +CONFIG_CRYPTO_RNG_DEFAULT=m +CONFIG_CRYPTO_PCOMP2=y +CONFIG_CRYPTO_AKCIPHER2=y +# CONFIG_CRYPTO_RSA is not set +CONFIG_CRYPTO_MANAGER=m +CONFIG_CRYPTO_MANAGER2=y +# CONFIG_CRYPTO_USER is not set +CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y +# CONFIG_CRYPTO_GF128MUL is not set +CONFIG_CRYPTO_NULL=m +CONFIG_CRYPTO_NULL2=y +# CONFIG_CRYPTO_PCRYPT is not set +CONFIG_CRYPTO_WORKQUEUE=y +# CONFIG_CRYPTO_CRYPTD is not set +# CONFIG_CRYPTO_MCRYPTD is not set +# CONFIG_CRYPTO_AUTHENC is not set +# CONFIG_CRYPTO_TEST is not set + +# +# Authenticated Encryption with Associated Data +# +# CONFIG_CRYPTO_CCM is not set +# CONFIG_CRYPTO_GCM is not set +# CONFIG_CRYPTO_CHACHA20POLY1305 is not set +# CONFIG_CRYPTO_SEQIV is not set +CONFIG_CRYPTO_ECHAINIV=m + +# +# Block modes +# +# CONFIG_CRYPTO_CBC is not set +# CONFIG_CRYPTO_CTR is not set +# CONFIG_CRYPTO_CTS is not set +# CONFIG_CRYPTO_ECB is not set +# CONFIG_CRYPTO_LRW is not set +# CONFIG_CRYPTO_PCBC is not set +# CONFIG_CRYPTO_XTS is not set +# CONFIG_CRYPTO_KEYWRAP is not set + +# +# Hash modes +# +# CONFIG_CRYPTO_CMAC is not set +CONFIG_CRYPTO_HMAC=m +# CONFIG_CRYPTO_XCBC is not set +# CONFIG_CRYPTO_VMAC is not set + +# +# Digest +# +CONFIG_CRYPTO_CRC32C=y +# CONFIG_CRYPTO_CRC32 is not set +# CONFIG_CRYPTO_CRCT10DIF is not set +# CONFIG_CRYPTO_GHASH is not set +# CONFIG_CRYPTO_POLY1305 is not set +# CONFIG_CRYPTO_MD4 is not set +# CONFIG_CRYPTO_MD5 is not set +# CONFIG_CRYPTO_MICHAEL_MIC is not set +# CONFIG_CRYPTO_RMD128 is not set +# CONFIG_CRYPTO_RMD160 is not set +# CONFIG_CRYPTO_RMD256 is not set +# CONFIG_CRYPTO_RMD320 is not set +# CONFIG_CRYPTO_SHA1 is not set +CONFIG_CRYPTO_SHA256=m +# CONFIG_CRYPTO_SHA512 is not set +# CONFIG_CRYPTO_TGR192 is not set +# CONFIG_CRYPTO_WP512 is not set + +# +# Ciphers +# +CONFIG_CRYPTO_AES=y +# CONFIG_CRYPTO_ANUBIS is not set +# CONFIG_CRYPTO_ARC4 is not set +# CONFIG_CRYPTO_BLOWFISH is not set +# CONFIG_CRYPTO_CAMELLIA is not set +# CONFIG_CRYPTO_CAST5 is not set +# CONFIG_CRYPTO_CAST6 is not set +# CONFIG_CRYPTO_DES is not set +# CONFIG_CRYPTO_FCRYPT is not set +# CONFIG_CRYPTO_KHAZAD is not set +# CONFIG_CRYPTO_SALSA20 is not set +# CONFIG_CRYPTO_CHACHA20 is not set +# CONFIG_CRYPTO_SEED is not set +# CONFIG_CRYPTO_SERPENT is not set +# CONFIG_CRYPTO_TEA is not set +# CONFIG_CRYPTO_TWOFISH is not set + +# +# Compression +# +CONFIG_CRYPTO_DEFLATE=y +# CONFIG_CRYPTO_ZLIB is not set +CONFIG_CRYPTO_LZO=y +# CONFIG_CRYPTO_842 is not set +# CONFIG_CRYPTO_LZ4 is not set +# CONFIG_CRYPTO_LZ4HC is not set + +# +# Random Number Generation +# +# CONFIG_CRYPTO_ANSI_CPRNG is not set +CONFIG_CRYPTO_DRBG_MENU=m +CONFIG_CRYPTO_DRBG_HMAC=y +# CONFIG_CRYPTO_DRBG_HASH is not set +# CONFIG_CRYPTO_DRBG_CTR is not set +CONFIG_CRYPTO_DRBG=m +CONFIG_CRYPTO_JITTERENTROPY=m +# CONFIG_CRYPTO_USER_API_HASH is not set +# CONFIG_CRYPTO_USER_API_SKCIPHER is not set +# CONFIG_CRYPTO_USER_API_RNG is not set +# CONFIG_CRYPTO_USER_API_AEAD is not set +# CONFIG_CRYPTO_HW is not set + +# +# Certificates for signature checking +# +# CONFIG_ARM_CRYPTO is not set +# CONFIG_BINARY_PRINTF is not set + +# +# Library routines +# +CONFIG_BITREVERSE=y +CONFIG_HAVE_ARCH_BITREVERSE=y +CONFIG_RATIONAL=y +CONFIG_GENERIC_STRNCPY_FROM_USER=y +CONFIG_GENERIC_STRNLEN_USER=y +CONFIG_GENERIC_NET_UTILS=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_GENERIC_IO=y +CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y +# CONFIG_CRC_CCITT is not set +CONFIG_CRC16=y +# CONFIG_CRC_T10DIF is not set +# CONFIG_CRC_ITU_T is not set +CONFIG_CRC32=y +# CONFIG_CRC32_SELFTEST is not set +CONFIG_CRC32_SLICEBY8=y +# CONFIG_CRC32_SLICEBY4 is not set +# CONFIG_CRC32_SARWATE is not set +# CONFIG_CRC32_BIT is not set +# CONFIG_CRC7 is not set +# CONFIG_LIBCRC32C is not set +# CONFIG_CRC8 is not set +# CONFIG_AUDIT_ARCH_COMPAT_GENERIC is not set +# CONFIG_RANDOM32_SELFTEST is not set +CONFIG_ZLIB_INFLATE=y +CONFIG_ZLIB_DEFLATE=y +CONFIG_LZO_COMPRESS=y +CONFIG_LZO_DECOMPRESS=y +CONFIG_LZ4_DECOMPRESS=y +CONFIG_XZ_DEC=y +CONFIG_XZ_DEC_X86=y +CONFIG_XZ_DEC_POWERPC=y +CONFIG_XZ_DEC_IA64=y +CONFIG_XZ_DEC_ARM=y +CONFIG_XZ_DEC_ARMTHUMB=y +CONFIG_XZ_DEC_SPARC=y +CONFIG_XZ_DEC_BCJ=y +# CONFIG_XZ_DEC_TEST is not set +CONFIG_DECOMPRESS_GZIP=y +CONFIG_DECOMPRESS_BZIP2=y +CONFIG_DECOMPRESS_LZMA=y +CONFIG_DECOMPRESS_XZ=y +CONFIG_DECOMPRESS_LZO=y +CONFIG_DECOMPRESS_LZ4=y +CONFIG_GENERIC_ALLOCATOR=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_DMA=y +CONFIG_CPU_RMAP=y +CONFIG_DQL=y +CONFIG_GLOB=y +# CONFIG_GLOB_SELFTEST is not set +CONFIG_NLATTR=y +CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y +# CONFIG_CORDIC is not set +# CONFIG_DDR is not set +CONFIG_LIBFDT=y +CONFIG_FONT_SUPPORT=y +# CONFIG_FONTS is not set +CONFIG_FONT_8x8=y +CONFIG_FONT_8x16=y +# CONFIG_SG_SPLIT is not set +CONFIG_ARCH_HAS_SG_CHAIN=y +# CONFIG_VIRTUALIZATION is not set diff --git a/src/ci/run.sh b/src/ci/run.sh index 3a2cc47df79..960acc4de7d 100755 --- a/src/ci/run.sh +++ b/src/ci/run.sh @@ -11,11 +11,13 @@ set -e -if [ "$LOCAL_USER_ID" != "" ]; then - useradd --shell /bin/bash -u $LOCAL_USER_ID -o -c "" -m user - export HOME=/home/user - unset LOCAL_USER_ID - exec su --preserve-environment -c "env PATH=$PATH \"$0\"" user +if [ "$NO_CHANGE_USER" = "" ]; then + if [ "$LOCAL_USER_ID" != "" ]; then + useradd --shell /bin/bash -u $LOCAL_USER_ID -o -c "" -m user + export HOME=/home/user + unset LOCAL_USER_ID + exec su --preserve-environment -c "env PATH=$PATH \"$0\"" user + fi fi RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-sccache" diff --git a/src/libstd/sys/unix/process/process_common.rs b/src/libstd/sys/unix/process/process_common.rs index 3497b266340..a4536520376 100644 --- a/src/libstd/sys/unix/process/process_common.rs +++ b/src/libstd/sys/unix/process/process_common.rs @@ -439,6 +439,10 @@ mod tests { #[test] #[cfg_attr(target_os = "macos", ignore)] #[cfg_attr(target_os = "nacl", ignore)] // no signals on NaCl. + // When run under our current QEMU emulation test suite this test fails, + // although the reason isn't very clear as to why. For now this test is + // ignored there. + #[cfg_attr(target_arch = "arm", ignore)] fn test_process_mask() { unsafe { // Test to make sure that a signal mask does not get inherited. @@ -471,7 +475,7 @@ mod tests { // Either EOF or failure (EPIPE) is okay. let mut buf = [0; 5]; if let Ok(ret) = stdout_read.read(&mut buf) { - assert!(ret == 0); + assert_eq!(ret, 0); } t!(cat.wait()); diff --git a/src/test/run-pass/fds-are-cloexec.rs b/src/test/run-pass/fds-are-cloexec.rs index 0abe44d8259..a1b7d42a196 100644 --- a/src/test/run-pass/fds-are-cloexec.rs +++ b/src/test/run-pass/fds-are-cloexec.rs @@ -35,7 +35,7 @@ fn main() { } fn parent() { - let file = File::open(file!()).unwrap(); + let file = File::open(env::current_exe().unwrap()).unwrap(); let tcp1 = TcpListener::bind("127.0.0.1:0").unwrap(); let tcp2 = tcp1.try_clone().unwrap(); let addr = tcp1.local_addr().unwrap(); diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index 1aeb76c0a0e..eb8cdcee6e6 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -185,6 +185,9 @@ pub struct Config { // Print one character per test instead of one line pub quiet: bool, + // where to find the qemu test client process, if we're using it + pub qemu_test_client: Option, + // Configuration for various run-make tests frobbing things like C compilers // or querying about various LLVM component information. pub cc: String, diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs index 43d02479fb1..40ba66a15d5 100644 --- a/src/tools/compiletest/src/main.rs +++ b/src/tools/compiletest/src/main.rs @@ -116,6 +116,7 @@ pub fn parse_config(args: Vec ) -> Config { reqopt("", "llvm-components", "list of LLVM components built in", "LIST"), reqopt("", "llvm-cxxflags", "C++ flags for LLVM", "FLAGS"), optopt("", "nodejs", "the name of nodejs", "PATH"), + optopt("", "qemu-test-client", "path to the qemu test client", "PATH"), optflag("h", "help", "show this message")]; let (argv0, args_) = args.split_first().unwrap(); @@ -196,6 +197,7 @@ pub fn parse_config(args: Vec ) -> Config { lldb_python_dir: matches.opt_str("lldb-python-dir"), verbose: matches.opt_present("verbose"), quiet: matches.opt_present("quiet"), + qemu_test_client: matches.opt_str("qemu-test-client").map(PathBuf::from), cc: matches.opt_str("cc").unwrap(), cxx: matches.opt_str("cxx").unwrap(), @@ -302,6 +304,14 @@ pub fn run_tests(config: &Config) { // time. env::set_var("RUST_TEST_THREADS", "1"); } + + DebugInfoGdb => { + if config.qemu_test_client.is_some() { + println!("WARNING: debuginfo tests are not available when \ + testing with QEMU"); + return + } + } _ => { /* proceed */ } } diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 05d6e21e9aa..04bd792be5c 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1190,7 +1190,45 @@ actual:\n\ "arm-linux-androideabi" | "armv7-linux-androideabi" | "aarch64-linux-android" => { self._arm_exec_compiled_test(env) } - _=> { + + // This is pretty similar to below, we're transforming: + // + // program arg1 arg2 + // + // into + // + // qemu-test-client run program:support-lib.so arg1 arg2 + // + // The test-client program will upload `program` to the emulator + // along with all other support libraries listed (in this case + // `support-lib.so`. It will then execute the program on the + // emulator with the arguments specified (in the environment we give + // the process) and then report back the same result. + _ if self.config.qemu_test_client.is_some() => { + let aux_dir = self.aux_output_dir_name(); + let mut args = self.make_run_args(); + let mut program = args.prog.clone(); + if let Ok(entries) = aux_dir.read_dir() { + for entry in entries { + let entry = entry.unwrap(); + if !entry.path().is_file() { + continue + } + program.push_str(":"); + program.push_str(entry.path().to_str().unwrap()); + } + } + args.args.insert(0, program); + args.args.insert(0, "run".to_string()); + args.prog = self.config.qemu_test_client.clone().unwrap() + .into_os_string().into_string().unwrap(); + self.compose_and_run(args, + env, + self.config.run_lib_path.to_str().unwrap(), + Some(aux_dir.to_str().unwrap()), + None) + } + _ => { let aux_dir = self.aux_output_dir_name(); self.compose_and_run(self.make_run_args(), env, diff --git a/src/tools/qemu-test-client/Cargo.toml b/src/tools/qemu-test-client/Cargo.toml new file mode 100644 index 00000000000..eb326c01de4 --- /dev/null +++ b/src/tools/qemu-test-client/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "qemu-test-client" +version = "0.1.0" +authors = ["The Rust Project Developers"] + +[dependencies] diff --git a/src/tools/qemu-test-client/src/main.rs b/src/tools/qemu-test-client/src/main.rs new file mode 100644 index 00000000000..b7ff4116eb5 --- /dev/null +++ b/src/tools/qemu-test-client/src/main.rs @@ -0,0 +1,221 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +/// This is a small client program intended to pair with `qemu-test-server` in +/// this repository. This client connects to the server over TCP and is used to +/// push artifacts and run tests on the server instead of locally. +/// +/// Here is also where we bake in the support to spawn the QEMU emulator as +/// well. + +use std::env; +use std::fs::File; +use std::io::prelude::*; +use std::io::{self, BufWriter}; +use std::net::TcpStream; +use std::path::Path; +use std::process::{Command, Stdio}; +use std::thread; +use std::time::Duration; + +macro_rules! t { + ($e:expr) => (match $e { + Ok(e) => e, + Err(e) => panic!("{} failed with {}", stringify!($e), e), + }) +} + +fn main() { + let mut args = env::args().skip(1); + + match &args.next().unwrap()[..] { + "spawn-emulator" => { + spawn_emulator(Path::new(&args.next().unwrap()), + Path::new(&args.next().unwrap())) + } + "push" => { + push(Path::new(&args.next().unwrap())) + } + "run" => { + run(args.next().unwrap(), args.collect()) + } + cmd => panic!("unknown command: {}", cmd), + } +} + +fn spawn_emulator(rootfs: &Path, tmpdir: &Path) { + // Generate a new rootfs image now that we've updated the test server + // executable. This is the equivalent of: + // + // find $rootfs -print 0 | cpio --null -o --format=newc > rootfs.img + let rootfs_img = tmpdir.join("rootfs.img"); + let mut cmd = Command::new("cpio"); + cmd.arg("--null") + .arg("-o") + .arg("--format=newc") + .stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .current_dir(rootfs); + let mut child = t!(cmd.spawn()); + let mut stdin = child.stdin.take().unwrap(); + let rootfs = rootfs.to_path_buf(); + thread::spawn(move || add_files(&mut stdin, &rootfs, &rootfs)); + t!(io::copy(&mut child.stdout.take().unwrap(), + &mut t!(File::create(&rootfs_img)))); + assert!(t!(child.wait()).success()); + + // Start up the emulator, in the background + let mut cmd = Command::new("qemu-system-arm"); + cmd.arg("-M").arg("vexpress-a15") + .arg("-m").arg("1024") + .arg("-kernel").arg("/tmp/zImage") + .arg("-initrd").arg(&rootfs_img) + .arg("-dtb").arg("/tmp/vexpress-v2p-ca15-tc1.dtb") + .arg("-append").arg("console=ttyAMA0 root=/dev/ram rdinit=/sbin/init init=/sbin/init") + .arg("-nographic") + .arg("-redir").arg("tcp:12345::12345"); + t!(cmd.spawn()); + + // Wait for the emulator to come online + loop { + let dur = Duration::from_millis(100); + if let Ok(mut client) = TcpStream::connect("127.0.0.1:12345") { + t!(client.set_read_timeout(Some(dur))); + t!(client.set_write_timeout(Some(dur))); + if client.write_all(b"ping").is_ok() { + let mut b = [0; 4]; + if client.read_exact(&mut b).is_ok() { + break + } + } + } + thread::sleep(dur); + } + + fn add_files(w: &mut Write, root: &Path, cur: &Path) { + for entry in t!(cur.read_dir()) { + let entry = t!(entry); + let path = entry.path(); + let to_print = path.strip_prefix(root).unwrap(); + t!(write!(w, "{}\u{0}", to_print.to_str().unwrap())); + if t!(entry.file_type()).is_dir() { + add_files(w, root, &path); + } + } + } +} + +fn push(path: &Path) { + let client = t!(TcpStream::connect("127.0.0.1:12345")); + let mut client = BufWriter::new(client); + t!(client.write_all(b"push")); + t!(client.write_all(path.file_name().unwrap().to_str().unwrap().as_bytes())); + t!(client.write_all(&[0])); + let mut file = t!(File::open(path)); + t!(io::copy(&mut file, &mut client)); + t!(client.flush()); + println!("done pushing {:?}", path); +} + +fn run(files: String, args: Vec) { + let client = t!(TcpStream::connect("127.0.0.1:12345")); + let mut client = BufWriter::new(client); + t!(client.write_all(b"run ")); + + // Send over the args + for arg in args { + t!(client.write_all(arg.as_bytes())); + t!(client.write_all(&[0])); + } + t!(client.write_all(&[0])); + + // Send over env vars + for (k, v) in env::vars() { + if k != "PATH" && k != "LD_LIBRARY_PATH" { + t!(client.write_all(k.as_bytes())); + t!(client.write_all(&[0])); + t!(client.write_all(v.as_bytes())); + t!(client.write_all(&[0])); + } + } + t!(client.write_all(&[0])); + + // Send over support libraries + let mut files = files.split(':'); + let exe = files.next().unwrap(); + for file in files.map(Path::new) { + t!(client.write_all(file.file_name().unwrap().to_str().unwrap().as_bytes())); + t!(client.write_all(&[0])); + send(&file, &mut client); + } + t!(client.write_all(&[0])); + + // Send over the client executable as the last piece + send(exe.as_ref(), &mut client); + + println!("uploaded {:?}, waiting for result", exe); + + // Ok now it's time to read all the output. We're receiving "frames" + // representing stdout/stderr, so we decode all that here. + let mut header = [0; 5]; + let mut stderr_done = false; + let mut stdout_done = false; + let mut client = t!(client.into_inner()); + let mut stdout = io::stdout(); + let mut stderr = io::stderr(); + while !stdout_done || !stderr_done { + t!(client.read_exact(&mut header)); + let amt = ((header[1] as u64) << 24) | + ((header[2] as u64) << 16) | + ((header[3] as u64) << 8) | + ((header[4] as u64) << 0); + if header[0] == 0 { + if amt == 0 { + stdout_done = true; + } else { + t!(io::copy(&mut (&mut client).take(amt), &mut stdout)); + t!(stdout.flush()); + } + } else { + if amt == 0 { + stderr_done = true; + } else { + t!(io::copy(&mut (&mut client).take(amt), &mut stderr)); + t!(stderr.flush()); + } + } + } + + // Finally, read out the exit status + let mut status = [0; 5]; + t!(client.read_exact(&mut status)); + let code = ((status[1] as i32) << 24) | + ((status[2] as i32) << 16) | + ((status[3] as i32) << 8) | + ((status[4] as i32) << 0); + if status[0] == 0 { + std::process::exit(code); + } else { + println!("died due to signal {}", code); + std::process::exit(3); + } +} + +fn send(path: &Path, dst: &mut Write) { + let mut file = t!(File::open(&path)); + let amt = t!(file.metadata()).len(); + t!(dst.write_all(&[ + (amt >> 24) as u8, + (amt >> 16) as u8, + (amt >> 8) as u8, + (amt >> 0) as u8, + ])); + t!(io::copy(&mut file, dst)); +} diff --git a/src/tools/qemu-test-server/Cargo.toml b/src/tools/qemu-test-server/Cargo.toml new file mode 100644 index 00000000000..af445a25935 --- /dev/null +++ b/src/tools/qemu-test-server/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "qemu-test-server" +version = "0.1.0" +authors = ["The Rust Project Developers"] + +[dependencies] diff --git a/src/tools/qemu-test-server/src/main.rs b/src/tools/qemu-test-server/src/main.rs new file mode 100644 index 00000000000..1c5d7b915ba --- /dev/null +++ b/src/tools/qemu-test-server/src/main.rs @@ -0,0 +1,232 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +/// This is a small server which is intended to run inside of an emulator. This +/// server pairs with the `qemu-test-client` program in this repository. The +/// `qemu-test-client` connects to this server over a TCP socket and performs +/// work such as: +/// +/// 1. Pushing shared libraries to the server +/// 2. Running tests through the server +/// +/// The server supports running tests concurrently and also supports tests +/// themselves having support libraries. All data over the TCP sockets is in a +/// basically custom format suiting our needs. + +use std::fs::{self, File, Permissions}; +use std::io::prelude::*; +use std::io::{self, BufReader}; +use std::net::{TcpListener, TcpStream}; +use std::os::unix::prelude::*; +use std::sync::{Arc, Mutex}; +use std::path::Path; +use std::str; +use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering}; +use std::thread; +use std::process::{Command, Stdio}; + +macro_rules! t { + ($e:expr) => (match $e { + Ok(e) => e, + Err(e) => panic!("{} failed with {}", stringify!($e), e), + }) +} + +static TEST: AtomicUsize = ATOMIC_USIZE_INIT; + +fn main() { + println!("starting test server"); + let listener = t!(TcpListener::bind("10.0.2.15:12345")); + println!("listening!"); + + let work = Path::new("/tmp/work"); + t!(fs::create_dir_all(work)); + + let lock = Arc::new(Mutex::new(())); + + for socket in listener.incoming() { + let mut socket = t!(socket); + let mut buf = [0; 4]; + t!(socket.read_exact(&mut buf)); + if &buf[..] == b"ping" { + t!(socket.write_all(b"pong")); + } else if &buf[..] == b"push" { + handle_push(socket, work); + } else if &buf[..] == b"run " { + let lock = lock.clone(); + thread::spawn(move || handle_run(socket, work, &lock)); + } else { + panic!("unknown command {:?}", buf); + } + } +} + +fn handle_push(socket: TcpStream, work: &Path) { + let mut reader = BufReader::new(socket); + let mut filename = Vec::new(); + t!(reader.read_until(0, &mut filename)); + filename.pop(); // chop off the 0 + let filename = t!(str::from_utf8(&filename)); + + let path = work.join(filename); + t!(io::copy(&mut reader, &mut t!(File::create(&path)))); + t!(fs::set_permissions(&path, Permissions::from_mode(0o755))); +} + +struct RemoveOnDrop<'a> { + inner: &'a Path, +} + +impl<'a> Drop for RemoveOnDrop<'a> { + fn drop(&mut self) { + t!(fs::remove_dir_all(self.inner)); + } +} + +fn handle_run(socket: TcpStream, work: &Path, lock: &Mutex<()>) { + let mut arg = Vec::new(); + let mut reader = BufReader::new(socket); + + // Allocate ourselves a directory that we'll delete when we're done to save + // space. + let n = TEST.fetch_add(1, Ordering::SeqCst); + let path = work.join(format!("test{}", n)); + let exe = path.join("exe"); + t!(fs::create_dir(&path)); + let _a = RemoveOnDrop { inner: &path }; + + // First up we'll get a list of arguments delimited with 0 bytes. An empty + // argument means that we're done. + let mut cmd = Command::new(&exe); + while t!(reader.read_until(0, &mut arg)) > 1 { + cmd.arg(t!(str::from_utf8(&arg[..arg.len() - 1]))); + arg.truncate(0); + } + + // Next we'll get a bunch of env vars in pairs delimited by 0s as well + arg.truncate(0); + while t!(reader.read_until(0, &mut arg)) > 1 { + let key_len = arg.len() - 1; + let val_len = t!(reader.read_until(0, &mut arg)) - 1; + { + let key = &arg[..key_len]; + let val = &arg[key_len + 1..][..val_len]; + let key = t!(str::from_utf8(key)); + let val = t!(str::from_utf8(val)); + cmd.env(key, val); + } + arg.truncate(0); + } + + // The section of code from here down to where we drop the lock is going to + // be a critical section for us. On Linux you can't execute a file which is + // open somewhere for writing, as you'll receive the error "text file busy". + // Now here we never have the text file open for writing when we spawn it, + // so why do we still need a critical section? + // + // Process spawning first involves a `fork` on Unix, which clones all file + // descriptors into the child process. This means that it's possible for us + // to open the file for writing (as we're downloading it), then some other + // thread forks, then we close the file and try to exec. At that point the + // other thread created a child process with the file open for writing, and + // we attempt to execute it, so we get an error. + // + // This race is resolve by ensuring that only one thread can writ ethe file + // and spawn a child process at once. Kinda an unfortunate solution, but we + // don't have many other choices with this sort of setup! + // + // In any case the lock is acquired here, before we start writing any files. + // It's then dropped just after we spawn the child. That way we don't lock + // the execution of the child, just the creation of its files. + let lock = lock.lock(); + + // Next there's a list of dynamic libraries preceded by their filenames. + arg.truncate(0); + while t!(reader.read_until(0, &mut arg)) > 1 { + let dst = path.join(t!(str::from_utf8(&arg[..arg.len() - 1]))); + let amt = read_u32(&mut reader) as u64; + t!(io::copy(&mut reader.by_ref().take(amt), + &mut t!(File::create(&dst)))); + t!(fs::set_permissions(&dst, Permissions::from_mode(0o755))); + arg.truncate(0); + } + + // Finally we'll get the binary. The other end will tell us how big the + // binary is and then we'll download it all to the exe path we calculated + // earlier. + let amt = read_u32(&mut reader) as u64; + t!(io::copy(&mut reader.by_ref().take(amt), + &mut t!(File::create(&exe)))); + t!(fs::set_permissions(&exe, Permissions::from_mode(0o755))); + + // Support libraries were uploaded to `work` earlier, so make sure that's + // in `LD_LIBRARY_PATH`. Also include our own current dir which may have + // had some libs uploaded. + cmd.env("LD_LIBRARY_PATH", + format!("{}:{}", work.display(), path.display())); + + // Spawn the child and ferry over stdout/stderr to the socket in a framed + // fashion (poor man's style) + let mut child = t!(cmd.stdin(Stdio::null()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .spawn()); + drop(lock); + let mut stdout = child.stdout.take().unwrap(); + let mut stderr = child.stderr.take().unwrap(); + let socket = Arc::new(Mutex::new(reader.into_inner())); + let socket2 = socket.clone(); + let thread = thread::spawn(move || my_copy(&mut stdout, 0, &*socket2)); + my_copy(&mut stderr, 1, &*socket); + thread.join().unwrap(); + + // Finally send over the exit status. + let status = t!(child.wait()); + let (which, code) = match status.code() { + Some(n) => (0, n), + None => (1, status.signal().unwrap()), + }; + t!(socket.lock().unwrap().write_all(&[ + which, + (code >> 24) as u8, + (code >> 16) as u8, + (code >> 8) as u8, + (code >> 0) as u8, + ])); +} + +fn my_copy(src: &mut Read, which: u8, dst: &Mutex) { + let mut b = [0; 1024]; + loop { + let n = t!(src.read(&mut b)); + let mut dst = dst.lock().unwrap(); + t!(dst.write_all(&[ + which, + (n >> 24) as u8, + (n >> 16) as u8, + (n >> 8) as u8, + (n >> 0) as u8, + ])); + if n > 0 { + t!(dst.write_all(&b[..n])); + } else { + break + } + } +} + +fn read_u32(r: &mut Read) -> u32 { + let mut len = [0; 4]; + t!(r.read_exact(&mut len)); + ((len[0] as u32) << 24) | + ((len[1] as u32) << 16) | + ((len[2] as u32) << 8) | + ((len[3] as u32) << 0) +} From 6d9f3590c5d7d93d3ba02728e7d4f16f0148812d Mon Sep 17 00:00:00 2001 From: "Jonathan A. Kollasch" Date: Mon, 23 Jan 2017 10:21:14 -0600 Subject: [PATCH 10/70] Add i686-unknown-netbsdelf target --- mk/cfg/i686-unknown-netbsdelf.mk | 1 + .../target/i686_unknown_netbsdelf.rs | 30 +++++++++++++++++++ src/librustc_back/target/mod.rs | 1 + 3 files changed, 32 insertions(+) create mode 100644 mk/cfg/i686-unknown-netbsdelf.mk create mode 100644 src/librustc_back/target/i686_unknown_netbsdelf.rs diff --git a/mk/cfg/i686-unknown-netbsdelf.mk b/mk/cfg/i686-unknown-netbsdelf.mk new file mode 100644 index 00000000000..34aee77ae21 --- /dev/null +++ b/mk/cfg/i686-unknown-netbsdelf.mk @@ -0,0 +1 @@ +# rustbuild-only target diff --git a/src/librustc_back/target/i686_unknown_netbsdelf.rs b/src/librustc_back/target/i686_unknown_netbsdelf.rs new file mode 100644 index 00000000000..e7e2ee3f905 --- /dev/null +++ b/src/librustc_back/target/i686_unknown_netbsdelf.rs @@ -0,0 +1,30 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use target::{Target, TargetResult}; + +pub fn target() -> TargetResult { + let mut base = super::netbsd_base::opts(); + base.cpu = "pentium4".to_string(); + base.max_atomic_width = Some(64); + base.pre_link_args.push("-m32".to_string()); + + Ok(Target { + llvm_target: "i686-unknown-netbsdelf".to_string(), + target_endian: "little".to_string(), + target_pointer_width: "32".to_string(), + data_layout: "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128".to_string(), + arch: "x86".to_string(), + target_os: "netbsd".to_string(), + target_env: "".to_string(), + target_vendor: "unknown".to_string(), + options: base, + }) +} diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs index 5afa85d1552..2cfa75475a2 100644 --- a/src/librustc_back/target/mod.rs +++ b/src/librustc_back/target/mod.rs @@ -176,6 +176,7 @@ supported_targets! { ("i686-unknown-openbsd", i686_unknown_openbsd), ("x86_64-unknown-openbsd", x86_64_unknown_openbsd), + ("i686-unknown-netbsdelf", i686_unknown_netbsdelf), ("sparc64-unknown-netbsd", sparc64_unknown_netbsd), ("x86_64-unknown-netbsd", x86_64_unknown_netbsd), ("x86_64-rumprun-netbsd", x86_64_rumprun_netbsd), From cd603e43241561edf9b2fa56a65a37afe20e8610 Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Sat, 28 Jan 2017 12:54:09 -0800 Subject: [PATCH 11/70] add From<(I, u16)> for SocketAddr where I: Into --- src/libstd/net/addr.rs | 7 +++++++ src/libstd/net/ip.rs | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/libstd/net/addr.rs b/src/libstd/net/addr.rs index 751878c687c..84c4acb8d92 100644 --- a/src/libstd/net/addr.rs +++ b/src/libstd/net/addr.rs @@ -456,6 +456,13 @@ impl From for SocketAddr { } } +#[stable(feature = "addr_from_into_ip", since = "1.17.0")] +impl> From<(I, u16)> for SocketAddr { + fn from(pieces: (I, u16)) -> SocketAddr { + SocketAddr::new(pieces.0.into(), pieces.1) + } +} + impl<'a> IntoInner<(*const c::sockaddr, c::socklen_t)> for &'a SocketAddr { fn into_inner(self) -> (*const c::sockaddr, c::socklen_t) { match *self { diff --git a/src/libstd/net/ip.rs b/src/libstd/net/ip.rs index cfd06dfcdd5..b6bd6f8d0a2 100644 --- a/src/libstd/net/ip.rs +++ b/src/libstd/net/ip.rs @@ -1183,8 +1183,8 @@ impl From<[u8; 16]> for IpAddr { #[stable(feature = "ip_from_slice", since = "1.17.0")] impl From<[u16; 8]> for IpAddr { - fn from(octets: [u16; 8]) -> IpAddr { - IpAddr::V6(Ipv6Addr::from(octets)) + fn from(segments: [u16; 8]) -> IpAddr { + IpAddr::V6(Ipv6Addr::from(segments)) } } From 897029d07273315db8bfb734d5e06abcd79f26c3 Mon Sep 17 00:00:00 2001 From: Giang Nguyen Date: Mon, 16 Jan 2017 15:06:30 +0700 Subject: [PATCH 12/70] Update grammar struct field init shorthand From 3388855443ccfdce427dbbbf8c3d7c3c78bd7b81 Mon Sep 17 00:00:00 2001 From: Giang Nguyen Date: Mon, 16 Jan 2017 16:24:30 +0700 Subject: [PATCH 13/70] Add explain struct field init shorthand --- src/doc/reference.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/doc/reference.md b/src/doc/reference.md index dfdfe328820..32e0f9bbed8 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -2757,6 +2757,19 @@ let base = Point3d {x: 1, y: 2, z: 3}; Point3d {y: 0, z: 10, .. base}; ``` +#### Struct field init shorthand + +When initializing a data structure (struct, enum, union) with named fields, allow writing `fieldname` as a shorthand for `fieldname: fieldname`. This allows a compact syntax for initialization, with less duplication. + +In the initializer for a `struct` with named fields, a `union` with named fields, or an enum variant with named fields, accept an identifier `field` as a shorthand for `field: field`. + +Example: + +``` +let a = SomeStruct { field1, field2: expression, field3 }; +let b = SomeStruct { field1: field1, field2: expression, field3: field3 }; +``` + ### Block expressions A _block expression_ is similar to a module in terms of the declarations that From a7b65f15781e479d6d0cd98f0865cc3ec0dc03ac Mon Sep 17 00:00:00 2001 From: Giang Nguyen Date: Mon, 16 Jan 2017 16:58:07 +0700 Subject: [PATCH 14/70] Add doc field init shorthand --- src/doc/book/structs.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/doc/book/structs.md b/src/doc/book/structs.md index cfd00cf997e..5a13746d0a8 100644 --- a/src/doc/book/structs.md +++ b/src/doc/book/structs.md @@ -117,6 +117,28 @@ fn main() { } ``` +We can initializing a data structure (struct, enum, union) with named fields, by writing `fieldname` as a shorthand for `fieldname: fieldname`. This allows a compact syntax for initialization, with less duplication: + +``` +#![feature(field_init_shorthand)] + +#[derive(Debug)] +struct Person<'a> { + name: &'a str, + age: u8 +} + +fn main() { + // Create struct with field init shorthand + let name = "Peter"; + let age = 27; + let peter = Person { name, age }; + + // Print debug struct + println!("{:?}", peter); +} +``` + # Update syntax A `struct` can include `..` to indicate that you want to use a copy of some From c4cd4e19d976240443ef31968e7b763cf83d6fdb Mon Sep 17 00:00:00 2001 From: Son Date: Thu, 2 Feb 2017 22:24:50 +1100 Subject: [PATCH 15/70] Wrap 80 columns --- src/doc/book/structs.md | 6 ++++-- src/doc/reference.md | 8 ++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/doc/book/structs.md b/src/doc/book/structs.md index 5a13746d0a8..811f7b41967 100644 --- a/src/doc/book/structs.md +++ b/src/doc/book/structs.md @@ -117,7 +117,9 @@ fn main() { } ``` -We can initializing a data structure (struct, enum, union) with named fields, by writing `fieldname` as a shorthand for `fieldname: fieldname`. This allows a compact syntax for initialization, with less duplication: +We can initializing a data structure (struct, enum, union) with named fields, +by writing `fieldname` as a shorthand for `fieldname: fieldname`. This allows a +compact syntax for initialization, with less duplication: ``` #![feature(field_init_shorthand)] @@ -133,7 +135,7 @@ fn main() { let name = "Peter"; let age = 27; let peter = Person { name, age }; - + // Print debug struct println!("{:?}", peter); } diff --git a/src/doc/reference.md b/src/doc/reference.md index 32e0f9bbed8..6f2ce5fd8d1 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -2759,9 +2759,13 @@ Point3d {y: 0, z: 10, .. base}; #### Struct field init shorthand -When initializing a data structure (struct, enum, union) with named fields, allow writing `fieldname` as a shorthand for `fieldname: fieldname`. This allows a compact syntax for initialization, with less duplication. +When initializing a data structure (struct, enum, union) with named fields, +allow writing `fieldname` as a shorthand for `fieldname: fieldname`. This +allows a compact syntax for initialization, with less duplication. -In the initializer for a `struct` with named fields, a `union` with named fields, or an enum variant with named fields, accept an identifier `field` as a shorthand for `field: field`. +In the initializer for a `struct` with named fields, a `union` with named +fields, or an enum variant with named fields, accept an identifier `field` as a +shorthand for `field: field`. Example: From 5c9fdd1d668158aa9979a24d5297cc6f60e7df9a Mon Sep 17 00:00:00 2001 From: king6cong Date: Fri, 3 Feb 2017 15:23:40 +0800 Subject: [PATCH 16/70] doc comment rewording --- src/librustc/mir/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index 6e9091cf317..163f1b0cf40 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -63,7 +63,7 @@ macro_rules! newtype_index { } /// Lowered representation of a single function. -// Do not implement clone for Mir, its easy to do so accidently and its kind of expensive. +/// Do not implement clone for Mir, which can be accidently done and kind of expensive. #[derive(RustcEncodable, RustcDecodable, Debug)] pub struct Mir<'tcx> { /// List of basic blocks. References to basic block use a newtyped index type `BasicBlock` From 4ddb56bf4dfdc607ae0bd2207da189c4c4d4c14a Mon Sep 17 00:00:00 2001 From: Son Date: Fri, 3 Feb 2017 23:51:50 +1100 Subject: [PATCH 17/70] Simplify wording & fix test src/doc --- src/doc/book/structs.md | 6 +++--- src/doc/reference.md | 9 +++++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/doc/book/structs.md b/src/doc/book/structs.md index 811f7b41967..dcf74cbb0a7 100644 --- a/src/doc/book/structs.md +++ b/src/doc/book/structs.md @@ -117,9 +117,9 @@ fn main() { } ``` -We can initializing a data structure (struct, enum, union) with named fields, -by writing `fieldname` as a shorthand for `fieldname: fieldname`. This allows a -compact syntax for initialization, with less duplication: +Initialization of a data structure (struct, enum, union) can be simplified if +fields of the data structure are initialized with variables which has same +names as the fields. ``` #![feature(field_init_shorthand)] diff --git a/src/doc/reference.md b/src/doc/reference.md index 6f2ce5fd8d1..8139a712bdd 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -2770,8 +2770,13 @@ shorthand for `field: field`. Example: ``` -let a = SomeStruct { field1, field2: expression, field3 }; -let b = SomeStruct { field1: field1, field2: expression, field3: field3 }; +# #![feature(field_init_shorthand)] +# struct Point3d { x: i32, y: i32, z: i32 } +# let x = 0; +# let y_value = 0; +# let z = 0; +Point3d { x: x, y: y_value, z: z }; +Point3d { x, y: y_value, z }; ``` ### Block expressions From e866d07f55b1b3ed6e37625ef35f61ac5c10f40e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Thu, 2 Feb 2017 13:57:08 +0100 Subject: [PATCH 18/70] lint/ctypes: Don't warn on non-unsized structs with PhantomData. Fixes #34798 --- src/librustc_lint/types.rs | 46 +++++++++++++++++++++++----- src/test/compile-fail/lint-ctypes.rs | 6 ++++ src/test/run-pass/issue-34798.rs | 34 ++++++++++++++++++++ 3 files changed, 79 insertions(+), 7 deletions(-) create mode 100644 src/test/run-pass/issue-34798.rs diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index 9669efa2d86..aff6de5a33d 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -341,6 +341,7 @@ struct ImproperCTypesVisitor<'a, 'tcx: 'a> { enum FfiResult { FfiSafe, + FfiPhantom, FfiUnsafe(&'static str), FfiBadStruct(DefId, &'static str), FfiBadUnion(DefId, &'static str), @@ -385,8 +386,11 @@ fn is_repr_nullable_ptr<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { /// Check if the given type is "ffi-safe" (has a stable, well-defined /// representation which can be exported to C code). - fn check_type_for_ffi(&self, cache: &mut FxHashSet>, ty: Ty<'tcx>) -> FfiResult { + fn check_type_for_ffi(&self, + cache: &mut FxHashSet>, + ty: Ty<'tcx>) -> FfiResult { use self::FfiResult::*; + let cx = self.cx.tcx; // Protect against infinite recursion, for example @@ -399,6 +403,9 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { match ty.sty { ty::TyAdt(def, substs) => { + if def.is_phantom_data() { + return FfiPhantom; + } match def.adt_kind() { AdtKind::Struct => { if !cx.lookup_repr_hints(def.did).contains(&attr::ReprExtern) { @@ -407,18 +414,22 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { consider adding a #[repr(C)] attribute to the type"); } - // We can't completely trust repr(C) markings; make sure the - // fields are actually safe. if def.struct_variant().fields.is_empty() { return FfiUnsafe("found zero-size struct in foreign module, consider \ adding a member to this struct"); } + // We can't completely trust repr(C) markings; make sure the + // fields are actually safe. + let mut all_phantom = true; for field in &def.struct_variant().fields { let field_ty = cx.normalize_associated_type(&field.ty(cx, substs)); let r = self.check_type_for_ffi(cache, field_ty); match r { - FfiSafe => {} + FfiSafe => { + all_phantom = false; + } + FfiPhantom => {} FfiBadStruct(..) | FfiBadUnion(..) | FfiBadEnum(..) => { return r; } @@ -427,7 +438,8 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { } } } - FfiSafe + + if all_phantom { FfiPhantom } else { FfiSafe } } AdtKind::Union => { if !cx.lookup_repr_hints(def.did).contains(&attr::ReprExtern) { @@ -436,11 +448,20 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { consider adding a #[repr(C)] attribute to the type"); } + if def.struct_variant().fields.is_empty() { + return FfiUnsafe("found zero-size union in foreign module, consider \ + adding a member to this union"); + } + + let mut all_phantom = true; for field in &def.struct_variant().fields { let field_ty = cx.normalize_associated_type(&field.ty(cx, substs)); let r = self.check_type_for_ffi(cache, field_ty); match r { - FfiSafe => {} + FfiSafe => { + all_phantom = false; + } + FfiPhantom => {} FfiBadStruct(..) | FfiBadUnion(..) | FfiBadEnum(..) => { return r; } @@ -449,7 +470,8 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { } } } - FfiSafe + + if all_phantom { FfiPhantom } else { FfiSafe } } AdtKind::Enum => { if def.variants.is_empty() { @@ -500,6 +522,10 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { FfiBadStruct(..) | FfiBadUnion(..) | FfiBadEnum(..) => { return r; } + FfiPhantom => { + return FfiBadEnum(def.did, + "Found phantom data in enum variant"); + } FfiUnsafe(s) => { return FfiBadEnum(def.did, s); } @@ -593,6 +619,12 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { match self.check_type_for_ffi(&mut FxHashSet(), ty) { FfiResult::FfiSafe => {} + FfiResult::FfiPhantom => { + self.cx.span_lint(IMPROPER_CTYPES, + sp, + &format!("found zero-sized type composed only \ + of phantom-data in a foreign-function.")); + } FfiResult::FfiUnsafe(s) => { self.cx.span_lint(IMPROPER_CTYPES, sp, s); } diff --git a/src/test/compile-fail/lint-ctypes.rs b/src/test/compile-fail/lint-ctypes.rs index ccc25b58228..608b1eb0872 100644 --- a/src/test/compile-fail/lint-ctypes.rs +++ b/src/test/compile-fail/lint-ctypes.rs @@ -29,6 +29,9 @@ pub type RustBadRet = extern fn() -> Box; pub type CVoidRet = (); pub struct Foo; +#[repr(C)] +pub struct ZeroSizeWithPhantomData(::std::marker::PhantomData); + extern { pub fn ptr_type1(size: *const Foo); //~ ERROR: found struct without pub fn ptr_type2(size: *const Foo); //~ ERROR: found struct without @@ -40,6 +43,9 @@ extern { pub fn tuple_type(p: (i32, i32)); //~ ERROR found Rust tuple type pub fn tuple_type2(p: I32Pair); //~ ERROR found Rust tuple type pub fn zero_size(p: ZeroSize); //~ ERROR found zero-size struct + pub fn zero_size_phantom(p: ZeroSizeWithPhantomData); //~ ERROR found zero-sized type + pub fn zero_size_phantom_toplevel() + -> ::std::marker::PhantomData; //~ ERROR: found zero-sized type pub fn fn_type(p: RustFn); //~ ERROR found function pointer with Rust pub fn fn_type2(p: fn()); //~ ERROR found function pointer with Rust pub fn fn_contained(p: RustBadRet); //~ ERROR: found struct without diff --git a/src/test/run-pass/issue-34798.rs b/src/test/run-pass/issue-34798.rs new file mode 100644 index 00000000000..e217d07ed72 --- /dev/null +++ b/src/test/run-pass/issue-34798.rs @@ -0,0 +1,34 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![forbid(improper_ctypes)] +#![allow(dead_code)] + +#[repr(C)] +pub struct Foo { + size: u8, + __value: ::std::marker::PhantomData, +} + +#[repr(C)] +pub struct ZeroSizeWithPhantomData(::std::marker::PhantomData); + +#[repr(C)] +pub struct Bar { + size: u8, + baz: ZeroSizeWithPhantomData, +} + +extern "C" { + pub fn bar(_: *mut Foo, _: *mut Bar); +} + +fn main() { +} From f98f6c717a6e709b9f0edd3cf0ea4f18e2ca9767 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 3 Feb 2017 22:18:32 -0800 Subject: [PATCH 19/70] Pass -fPIC to native compiles on 32-bit This is apparently a regression from 1.14.0 to 1.15.0. Previously we passed `-fPIC` to C compilers on i686 targets, but the `gcc` crate apparently [explicitly] didn't do this. I don't recall why that was avoided but it was [previously passed by the makefiles][mk] and this seems to have [caused a regression][regression] in Firefox, so this commit reverts back to passing `-fPIC`. [explicitly]: https://github.com/alexcrichton/gcc-rs/commit/362bdf20 [mk]: https://github.com/rust-lang/rust/blob/c781fc4a/mk/cfg/i686-unknown-linux-gnu.mk#L11 [regression]: https://bugzilla.mozilla.org/show_bug.cgi?id=1336155 --- src/Cargo.lock | 20 +- src/vendor/gcc/.cargo-checksum.json | 2 +- src/vendor/gcc/.gitignore | 2 + src/vendor/gcc/.travis.yml | 7 + src/vendor/gcc/Cargo.toml | 10 +- src/vendor/gcc/README.md | 6 +- src/vendor/gcc/src/bin/gcc-shim.rs | 4 +- src/vendor/gcc/src/lib.rs | 641 +++++++++++++++---------- src/vendor/gcc/src/registry.rs | 59 ++- src/vendor/gcc/src/windows_registry.rs | 138 +++--- src/vendor/gcc/tests/support/mod.rs | 42 +- src/vendor/gcc/tests/test.rs | 99 ++-- 12 files changed, 601 insertions(+), 429 deletions(-) diff --git a/src/Cargo.lock b/src/Cargo.lock index 95b963f6a78..288a8b65833 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -19,7 +19,7 @@ version = "0.0.0" dependencies = [ "build_helper 0.1.0", "core 0.0.0", - "gcc 0.3.40 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.0.0", ] @@ -42,7 +42,7 @@ dependencies = [ "build_helper 0.1.0", "cmake 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", "filetime 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "gcc 0.3.40 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", @@ -74,7 +74,7 @@ name = "cmake" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.40 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -91,7 +91,7 @@ name = "compiler_builtins" version = "0.0.0" dependencies = [ "core 0.0.0", - "gcc 0.3.40 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -132,7 +132,7 @@ name = "flate" version = "0.0.0" dependencies = [ "build_helper 0.1.0", - "gcc 0.3.40 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -141,7 +141,7 @@ version = "0.0.0" [[package]] name = "gcc" -version = "0.3.40" +version = "0.3.43" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -396,7 +396,7 @@ name = "rustc_llvm" version = "0.0.0" dependencies = [ "build_helper 0.1.0", - "gcc 0.3.40 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_bitflags 0.0.0", ] @@ -539,7 +539,7 @@ version = "0.0.0" dependencies = [ "arena 0.0.0", "build_helper 0.1.0", - "gcc 0.3.40 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.0.0", "rustc 0.0.0", "rustc_back 0.0.0", @@ -571,7 +571,7 @@ dependencies = [ "collections 0.0.0", "compiler_builtins 0.0.0", "core 0.0.0", - "gcc 0.3.40 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.0.0", "panic_abort 0.0.0", "panic_unwind 0.0.0", @@ -661,7 +661,7 @@ dependencies = [ "checksum cmake 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "0e5bcf27e097a184c1df4437654ed98df3d7a516e8508a6ba45d8b092bbdf283" "checksum env_logger 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "15abd780e45b3ea4f76b4e9a26ff4843258dd8a3eed2775a0e7368c2e7936c2f" "checksum filetime 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "5363ab8e4139b8568a6237db5248646e5a8a2f89bd5ccb02092182b11fd3e922" -"checksum gcc 0.3.40 (registry+https://github.com/rust-lang/crates.io-index)" = "872db9e59486ef2b14f8e8c10e9ef02de2bccef6363d7f34835dedb386b3d950" +"checksum gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)" = "c07c758b972368e703a562686adb39125707cc1ef3399da8c019fc6c2498a75d" "checksum getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9047cfbd08a437050b363d35ef160452c5fe8ea5187ae0a624708c91581d685" "checksum libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)" = "044d1360593a78f5c8e5e710beccdc24ab71d1f01bc19a29bcacdba22e8475d8" "checksum log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ab83497bf8bf4ed2a74259c1c802351fcd67a65baa86394b6ba73c36f4838054" diff --git a/src/vendor/gcc/.cargo-checksum.json b/src/vendor/gcc/.cargo-checksum.json index e85f4b21813..69e2a953a17 100644 --- a/src/vendor/gcc/.cargo-checksum.json +++ b/src/vendor/gcc/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"f9b1ca6ae27d1c18215265024629a8960c31379f206d9ed20f64e0b2dcf79805",".travis.yml":"675ffe583db77282d010306f29e6d81e5070ab081deddd0300137dfbd2cb83de","Cargo.toml":"19bb617b74de761515ef5d087fd0e30912fda1d7c22fd04fa211236dab99a509","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"ecb2d93f4c81edbd48d8742ff7887dc0a4530a5890967839090bbc972d49bebe","appveyor.yml":"46c77d913eaa45871296942c2cd96ef092c9dcaf19201cb5c500a5107faeb06f","src/bin/gcc-shim.rs":"11edfe1fc6f932bd42ffffda5145833302bc163e0b87dc0d54f4bd0997ad4708","src/lib.rs":"7e7c60beccfdd145e876da81bb07dd09c5248dab0b26d93190bab4242799d51a","src/registry.rs":"3e2a42581ebb82e325dd5600c6571cef937b35003b2927dc618967f5238a2058","src/windows_registry.rs":"1f4211caec5a192b5f05c8a47efb27aa6a0ab976c659b9318a0cf603a28d6746","tests/cc_env.rs":"d92c5e3d3d43ac244e63b2cd2c93a521fcf124bf1ccf8d4c6bfa7f8333d88976","tests/support/mod.rs":"f4dad5a8133c3dd6678d9a3de057b82e624ef547b9b3e4ac9508a48962fc387b","tests/test.rs":"164220f11be2eebc20315826513999970660a82feff8cc4b15b4e9d73d98324e"},"package":"872db9e59486ef2b14f8e8c10e9ef02de2bccef6363d7f34835dedb386b3d950"} \ No newline at end of file +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"4cc6445feac7e9a1f8f1e1c51cc3afd0cf7bb931e3c5a6f18c41258401652702",".travis.yml":"e68f9d10a8e367890cf734239c39952ee480cf0e8da9520b377df4a2b8ccc9e8","Cargo.toml":"4c5eb683d4c57fff819ebf564a8db93b5c87284993def6bc066ba1e311d5b090","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"b1a639560fd536f2c3ab708a8e1066b675edd4d018dfa4e5e18d0d7327d81c15","appveyor.yml":"46c77d913eaa45871296942c2cd96ef092c9dcaf19201cb5c500a5107faeb06f","src/bin/gcc-shim.rs":"d6be9137cb48b86891e7b263adbf492e1193ffe682db9ba4a88eb1079b874b58","src/lib.rs":"eb4ca086dd2ffa5e30f022f556d0def6d1142160da392afb328393b3f435e8f7","src/registry.rs":"3876ef9573e3bbc050aef41a684b9a510cc1a91b15ae874fe032cf4377b4d116","src/windows_registry.rs":"36c6a7f8322407faff2dcfd4789d0876d034885944bc0340ac7c1f7cbfc307f1","tests/cc_env.rs":"d92c5e3d3d43ac244e63b2cd2c93a521fcf124bf1ccf8d4c6bfa7f8333d88976","tests/support/mod.rs":"56bcfd1e2ff5ae8e581c71229444a3d96094bf689808808dd80e315bd6632083","tests/test.rs":"b63e74d571e7d585edc53693bcf0caae88fc040613ace91e32437d4a62cddb6a"},"package":"c07c758b972368e703a562686adb39125707cc1ef3399da8c019fc6c2498a75d"} \ No newline at end of file diff --git a/src/vendor/gcc/.gitignore b/src/vendor/gcc/.gitignore index a9d37c560c6..3b874ca574d 100644 --- a/src/vendor/gcc/.gitignore +++ b/src/vendor/gcc/.gitignore @@ -1,2 +1,4 @@ target Cargo.lock +.idea +*.iml diff --git a/src/vendor/gcc/.travis.yml b/src/vendor/gcc/.travis.yml index bf55f49173d..10d3d13d876 100644 --- a/src/vendor/gcc/.travis.yml +++ b/src/vendor/gcc/.travis.yml @@ -3,6 +3,13 @@ rust: - stable - beta - nightly +matrix: + include: + # Minimum version supported + - rust: 1.6.0 + install: + script: cargo build + sudo: false install: - if [ "$TRAVIS_OS_NAME" = "linux" ]; then OS=unknown-linux-gnu; else OS=apple-darwin; fi diff --git a/src/vendor/gcc/Cargo.toml b/src/vendor/gcc/Cargo.toml index 7efdbf9b4b3..9fee7788cef 100644 --- a/src/vendor/gcc/Cargo.toml +++ b/src/vendor/gcc/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "gcc" -version = "0.3.40" +version = "0.3.43" authors = ["Alex Crichton "] license = "MIT/Apache-2.0" repository = "https://github.com/alexcrichton/gcc-rs" -documentation = "http://alexcrichton.com/gcc-rs" +documentation = "https://docs.rs/gcc" description = """ A build-time dependency for Cargo build scripts to assist in invoking the native C compiler to compile native C code into a static archive to be linked into Rust @@ -13,8 +13,12 @@ code. """ keywords = ["build-dependencies"] +[badges] +travis-ci = { repository = "alexcrichton/gcc-rs" } +appveyor = { repository = "alexcrichton/gcc-rs" } + [dependencies] -rayon = { version = "0.4", optional = true } +rayon = { version = "0.6", optional = true } [features] parallel = ["rayon"] diff --git a/src/vendor/gcc/README.md b/src/vendor/gcc/README.md index ecc79c67352..2d3e5ed7387 100644 --- a/src/vendor/gcc/README.md +++ b/src/vendor/gcc/README.md @@ -5,7 +5,7 @@ A library to compile C/C++ code into a Rust library/application. [![Build Status](https://travis-ci.org/alexcrichton/gcc-rs.svg?branch=master)](https://travis-ci.org/alexcrichton/gcc-rs) [![Build status](https://ci.appveyor.com/api/projects/status/onu270iw98h81nwv?svg=true)](https://ci.appveyor.com/project/alexcrichton/gcc-rs) -[Documentation](http://alexcrichton.com/gcc-rs) +[Documentation](https://docs.rs/gcc) A simple library meant to be used as a build dependency with Cargo packages in order to build a set of C/C++ files into a static archive. Note that while this @@ -106,7 +106,9 @@ gcc = { version = "0.3", features = ["parallel"] } ``` By default gcc-rs will limit parallelism to `$NUM_JOBS`, or if not present it -will limit it to the number of cpus on the machine. +will limit it to the number of cpus on the machine. If you are using cargo, +use `-jN` option of `build`, `test` and `run` commands as `$NUM_JOBS` +is supplied by cargo. ## Compile-time Requirements diff --git a/src/vendor/gcc/src/bin/gcc-shim.rs b/src/vendor/gcc/src/bin/gcc-shim.rs index 43fd811d361..7fd0ea8fa84 100644 --- a/src/vendor/gcc/src/bin/gcc-shim.rs +++ b/src/vendor/gcc/src/bin/gcc-shim.rs @@ -10,7 +10,7 @@ fn main() { for i in 0.. { let candidate = out_dir.join(format!("out{}", i)); if candidate.exists() { - continue + continue; } let mut f = File::create(candidate).unwrap(); for arg in env::args().skip(1) { @@ -18,6 +18,6 @@ fn main() { } File::create(out_dir.join("libfoo.a")).unwrap(); - break + break; } } diff --git a/src/vendor/gcc/src/lib.rs b/src/vendor/gcc/src/lib.rs index 43cc371117f..f2d9da7f694 100644 --- a/src/vendor/gcc/src/lib.rs +++ b/src/vendor/gcc/src/lib.rs @@ -42,7 +42,7 @@ //! } //! ``` -#![doc(html_root_url = "http://alexcrichton.com/gcc-rs")] +#![doc(html_root_url = "https://docs.rs/gcc/0.3")] #![cfg_attr(test, deny(warnings))] #![deny(missing_docs)] @@ -52,10 +52,10 @@ extern crate rayon; use std::env; use std::ffi::{OsString, OsStr}; use std::fs; -use std::io; use std::path::{PathBuf, Path}; use std::process::{Command, Stdio}; -use std::io::{BufReader, BufRead, Write}; +use std::io::{self, BufReader, BufRead, Read, Write}; +use std::thread; #[cfg(windows)] mod registry; @@ -94,6 +94,52 @@ pub struct Tool { path: PathBuf, args: Vec, env: Vec<(OsString, OsString)>, + family: ToolFamily +} + +/// Represents the family of tools this tool belongs to. +/// +/// Each family of tools differs in how and what arguments they accept. +/// +/// Detection of a family is done on best-effort basis and may not accurately reflect the tool. +#[derive(Copy, Clone, Debug)] +enum ToolFamily { + /// Tool is GNU Compiler Collection-like. + Gnu, + /// Tool is Clang-like. It differs from the GCC in a sense that it accepts superset of flags + /// and its cross-compilation approach is different. + Clang, + /// Tool is the MSVC cl.exe. + Msvc, +} + +impl ToolFamily { + /// What the flag to request debug info for this family of tools look like + fn debug_flag(&self) -> &'static str { + match *self { + ToolFamily::Msvc => "/Z7", + ToolFamily::Gnu | + ToolFamily::Clang => "-g", + } + } + + /// What the flag to include directories into header search path looks like + fn include_flag(&self) -> &'static str { + match *self { + ToolFamily::Msvc => "/I", + ToolFamily::Gnu | + ToolFamily::Clang => "-I", + } + } + + /// What the flag to request macro-expanded source output looks like + fn expand_flag(&self) -> &'static str { + match *self { + ToolFamily::Msvc => "/E", + ToolFamily::Gnu | + ToolFamily::Clang => "-E", + } + } } /// Compile a library from the given set of input C files. @@ -114,7 +160,7 @@ pub fn compile_library(output: &str, files: &[&str]) { for f in files.iter() { c.file(*f); } - c.compile(output) + c.compile(output); } impl Config { @@ -194,8 +240,7 @@ impl Config { /// otherwise cargo will link against the specified library. /// /// The given library name must not contain the `lib` prefix. - pub fn cpp_link_stdlib(&mut self, cpp_link_stdlib: Option<&str>) - -> &mut Config { + pub fn cpp_link_stdlib(&mut self, cpp_link_stdlib: Option<&str>) -> &mut Config { self.cpp_link_stdlib = Some(cpp_link_stdlib.map(|s| s.into())); self } @@ -220,8 +265,7 @@ impl Config { /// be used, otherwise `-stdlib` is added to the compile invocation. /// /// The given library name must not contain the `lib` prefix. - pub fn cpp_set_stdlib(&mut self, cpp_set_stdlib: Option<&str>) - -> &mut Config { + pub fn cpp_set_stdlib(&mut self, cpp_set_stdlib: Option<&str>) -> &mut Config { self.cpp_set_stdlib = cpp_set_stdlib.map(|s| s.into()); self.cpp_link_stdlib(cpp_set_stdlib); self @@ -322,7 +366,8 @@ impl Config { #[doc(hidden)] pub fn __set_env(&mut self, a: A, b: B) -> &mut Config - where A: AsRef, B: AsRef + where A: AsRef, + B: AsRef { self.env.push((a.as_ref().to_owned(), b.as_ref().to_owned())); self @@ -355,18 +400,18 @@ impl Config { if self.get_target().contains("msvc") { let compiler = self.get_base_compiler(); - let atlmfc_lib = compiler.env().iter().find(|&&(ref var, _)| { - var == OsStr::new("LIB") - }).and_then(|&(_, ref lib_paths)| { - env::split_paths(lib_paths).find(|path| { - let sub = Path::new("atlmfc/lib"); - path.ends_with(sub) || path.parent().map_or(false, |p| p.ends_with(sub)) - }) - }); + let atlmfc_lib = compiler.env() + .iter() + .find(|&&(ref var, _)| var.as_os_str() == OsStr::new("LIB")) + .and_then(|&(_, ref lib_paths)| { + env::split_paths(lib_paths).find(|path| { + let sub = Path::new("atlmfc/lib"); + path.ends_with(sub) || path.parent().map_or(false, |p| p.ends_with(sub)) + }) + }); if let Some(atlmfc_lib) = atlmfc_lib { - self.print(&format!("cargo:rustc-link-search=native={}", - atlmfc_lib.display())); + self.print(&format!("cargo:rustc-link-search=native={}", atlmfc_lib.display())); } } @@ -394,9 +439,7 @@ impl Config { } drop(rayon::initialize(cfg)); - objs.par_iter().weight_max().for_each(|&(ref src, ref dst)| { - self.compile_object(src, dst) - }) + objs.par_iter().weight_max().for_each(|&(ref src, ref dst)| self.compile_object(src, dst)); } #[cfg(not(feature = "parallel"))] @@ -417,8 +460,12 @@ impl Config { for &(ref a, ref b) in self.env.iter() { cmd.env(a, b); } - (cmd, compiler.path.file_name().unwrap() - .to_string_lossy().into_owned()) + (cmd, + compiler.path + .file_name() + .unwrap() + .to_string_lossy() + .into_owned()) }; if msvc && is_asm { cmd.arg("/Fo").arg(dst); @@ -429,12 +476,35 @@ impl Config { } else { cmd.arg("-o").arg(&dst); } - cmd.arg(if msvc {"/c"} else {"-c"}); + cmd.arg(if msvc { "/c" } else { "-c" }); cmd.arg(file); run(&mut cmd, &name); } + /// Run the compiler, returning the macro-expanded version of the input files. + /// + /// This is only relevant for C and C++ files. + pub fn expand(&self) -> Vec { + let compiler = self.get_compiler(); + let mut cmd = compiler.to_command(); + for &(ref a, ref b) in self.env.iter() { + cmd.env(a, b); + } + cmd.arg(compiler.family.expand_flag()); + for file in self.files.iter() { + cmd.arg(file); + } + + let name = compiler.path + .file_name() + .unwrap() + .to_string_lossy() + .into_owned(); + + run(&mut cmd, &name) + } + /// Get the compiler that's in use for this configuration. /// /// This function will return a `Tool` which represents the culmination @@ -451,136 +521,159 @@ impl Config { /// falling back to the default configuration. pub fn get_compiler(&self) -> Tool { let opt_level = self.get_opt_level(); - let debug = self.get_debug(); let target = self.get_target(); - let msvc = target.contains("msvc"); - self.print(&format!("debug={} opt-level={}", debug, opt_level)); let mut cmd = self.get_base_compiler(); - let nvcc = cmd.path.to_str() - .map(|path| path.contains("nvcc")) + let nvcc = cmd.path.file_name() + .and_then(|p| p.to_str()).map(|p| p.contains("nvcc")) .unwrap_or(false); - if msvc { - cmd.args.push("/nologo".into()); - let features = env::var("CARGO_CFG_TARGET_FEATURE") - .unwrap_or(String::new()); - if features.contains("crt-static") { - cmd.args.push("/MT".into()); - } else { - cmd.args.push("/MD".into()); + // Non-target flags + // If the flag is not conditioned on target variable, it belongs here :) + match cmd.family { + ToolFamily::Msvc => { + cmd.args.push("/nologo".into()); + let features = env::var("CARGO_CFG_TARGET_FEATURE") + .unwrap_or(String::new()); + if features.contains("crt-static") { + cmd.args.push("/MT".into()); + } else { + cmd.args.push("/MD".into()); + } + match &opt_level[..] { + "z" | "s" => cmd.args.push("/Os".into()), + "1" => cmd.args.push("/O1".into()), + // -O3 is a valid value for gcc and clang compilers, but not msvc. Cap to /O2. + "2" | "3" => cmd.args.push("/O2".into()), + _ => {} + } } - match &opt_level[..] { - "z" | "s" => cmd.args.push("/Os".into()), - "2" => cmd.args.push("/O2".into()), - "1" => cmd.args.push("/O1".into()), - _ => {} + ToolFamily::Gnu | + ToolFamily::Clang => { + cmd.args.push(format!("-O{}", opt_level).into()); + if !nvcc { + cmd.args.push("-ffunction-sections".into()); + cmd.args.push("-fdata-sections".into()); + if self.pic.unwrap_or(!target.contains("windows-gnu")) { + cmd.args.push("-fPIC".into()); + } + } else if self.pic.unwrap_or(false) { + cmd.args.push("-Xcompiler".into()); + cmd.args.push("\'-fPIC\'".into()); + } } - if target.contains("i586") { - cmd.args.push("/ARCH:IA32".into()); - } - } else if nvcc { - cmd.args.push(format!("-O{}", opt_level).into()); - } else { - cmd.args.push(format!("-O{}", opt_level).into()); - cmd.args.push("-ffunction-sections".into()); - cmd.args.push("-fdata-sections".into()); } for arg in self.envflags(if self.cpp {"CXXFLAGS"} else {"CFLAGS"}) { cmd.args.push(arg.into()); } - if debug { - cmd.args.push(if msvc {"/Z7"} else {"-g"}.into()); + if self.get_debug() { + cmd.args.push(cmd.family.debug_flag().into()); + } + + // Target flags + match cmd.family { + ToolFamily::Clang => { + cmd.args.push(format!("--target={}", target).into()); + } + ToolFamily::Msvc => { + if target.contains("i586") { + cmd.args.push("/ARCH:IA32".into()); + } + } + ToolFamily::Gnu => { + if target.contains("i686") || target.contains("i586") { + cmd.args.push("-m32".into()); + } else if target.contains("x86_64") || target.contains("powerpc64") { + cmd.args.push("-m64".into()); + } + + if target.contains("musl") { + cmd.args.push("-static".into()); + } + + // armv7 targets get to use armv7 instructions + if target.starts_with("armv7-unknown-linux-") { + cmd.args.push("-march=armv7-a".into()); + } + + // On android we can guarantee some extra float instructions + // (specified in the android spec online) + if target.starts_with("armv7-linux-androideabi") { + cmd.args.push("-march=armv7-a".into()); + cmd.args.push("-mfpu=vfpv3-d16".into()); + } + + // For us arm == armv6 by default + if target.starts_with("arm-unknown-linux-") { + cmd.args.push("-march=armv6".into()); + cmd.args.push("-marm".into()); + } + + // Turn codegen down on i586 to avoid some instructions. + if target.starts_with("i586-unknown-linux-") { + cmd.args.push("-march=pentium".into()); + } + + // Set codegen level for i686 correctly + if target.starts_with("i686-unknown-linux-") { + cmd.args.push("-march=i686".into()); + } + + // Looks like `musl-gcc` makes is hard for `-m32` to make its way + // all the way to the linker, so we need to actually instruct the + // linker that we're generating 32-bit executables as well. This'll + // typically only be used for build scripts which transitively use + // these flags that try to compile executables. + if target == "i686-unknown-linux-musl" { + cmd.args.push("-Wl,-melf_i386".into()); + } + + if target.starts_with("thumb") { + cmd.args.push("-mthumb".into()); + + if target.ends_with("eabihf") { + cmd.args.push("-mfloat-abi=hard".into()) + } + } + if target.starts_with("thumbv6m") { + cmd.args.push("-march=armv6s-m".into()); + } + if target.starts_with("thumbv7em") { + cmd.args.push("-march=armv7e-m".into()); + + if target.ends_with("eabihf") { + cmd.args.push("-mfpu=fpv4-sp-d16".into()) + } + } + if target.starts_with("thumbv7m") { + cmd.args.push("-march=armv7-m".into()); + } + } } if target.contains("-ios") { + // FIXME: potential bug. iOS is always compiled with Clang, but Gcc compiler may be + // detected instead. self.ios_flags(&mut cmd); - } else if !msvc { - if target.contains("i686") || target.contains("i586") { - cmd.args.push("-m32".into()); - } else if target.contains("x86_64") || target.contains("powerpc64") { - cmd.args.push("-m64".into()); - } - - if !nvcc && self.pic.unwrap_or(!target.contains("i686") && !target.contains("windows-gnu")) { - cmd.args.push("-fPIC".into()); - } else if nvcc && self.pic.unwrap_or(false) { - cmd.args.push("-Xcompiler".into()); - cmd.args.push("\'-fPIC\'".into()); - } - - if target.contains("musl") { - cmd.args.push("-static".into()); - } - - // armv7 targets get to use armv7 instructions - if target.starts_with("armv7-unknown-linux-") { - cmd.args.push("-march=armv7-a".into()); - } - - // On android we can guarantee some extra float instructions - // (specified in the android spec online) - if target.starts_with("armv7-linux-androideabi") { - cmd.args.push("-march=armv7-a".into()); - cmd.args.push("-mfpu=vfpv3-d16".into()); - } - - // For us arm == armv6 by default - if target.starts_with("arm-unknown-linux-") { - cmd.args.push("-march=armv6".into()); - cmd.args.push("-marm".into()); - } - - // Turn codegen down on i586 to avoid some instructions. - if target.starts_with("i586-unknown-linux-") { - cmd.args.push("-march=pentium".into()); - } - - // Set codegen level for i686 correctly - if target.starts_with("i686-unknown-linux-") { - cmd.args.push("-march=i686".into()); - } - - // Looks like `musl-gcc` makes is hard for `-m32` to make its way - // all the way to the linker, so we need to actually instruct the - // linker that we're generating 32-bit executables as well. This'll - // typically only be used for build scripts which transitively use - // these flags that try to compile executables. - if target == "i686-unknown-linux-musl" { - cmd.args.push("-Wl,-melf_i386".into()); - } - - if target.starts_with("thumb") { - cmd.args.push("-mthumb".into()); - - if target.ends_with("eabihf") { - cmd.args.push("-mfloat-abi=hard".into()) - } - } - if target.starts_with("thumbv6m") { - cmd.args.push("-march=armv6s-m".into()); - } - if target.starts_with("thumbv7em") { - cmd.args.push("-march=armv7e-m".into()); - - if target.ends_with("eabihf") { - cmd.args.push("-mfpu=fpv4-sp-d16".into()) - } - } - if target.starts_with("thumbv7m") { - cmd.args.push("-march=armv7-m".into()); - } } - if self.cpp && !msvc { - if let Some(ref stdlib) = self.cpp_set_stdlib { - cmd.args.push(format!("-stdlib=lib{}", stdlib).into()); + if self.cpp { + match (self.cpp_set_stdlib.as_ref(), cmd.family) { + (None, _) => { } + (Some(stdlib), ToolFamily::Gnu) | + (Some(stdlib), ToolFamily::Clang) => { + cmd.args.push(format!("-stdlib=lib{}", stdlib).into()); + } + _ => { + println!("cargo:warning=cpp_set_stdlib is specified, but the {:?} compiler \ + does not support this option, ignored", cmd.family); + } } } for directory in self.include_directories.iter() { - cmd.args.push(if msvc {"/I"} else {"-I"}.into()); + cmd.args.push(cmd.family.include_flag().into()); cmd.args.push(directory.into()); } @@ -589,7 +682,7 @@ impl Config { } for &(ref key, ref value) in self.definitions.iter() { - let lead = if msvc {"/"} else {"-"}; + let lead = if let ToolFamily::Msvc = cmd.family {"/"} else {"-"}; if let &Some(ref value) = value { cmd.args.push(format!("{}D{}={}", lead, key, value).into()); } else { @@ -601,10 +694,12 @@ impl Config { fn msvc_macro_assembler(&self) -> (Command, String) { let target = self.get_target(); - let tool = if target.contains("x86_64") {"ml64.exe"} else {"ml.exe"}; - let mut cmd = windows_registry::find(&target, tool).unwrap_or_else(|| { - self.cmd(tool) - }); + let tool = if target.contains("x86_64") { + "ml64.exe" + } else { + "ml.exe" + }; + let mut cmd = windows_registry::find(&target, tool).unwrap_or_else(|| self.cmd(tool)); for directory in self.include_directories.iter() { cmd.arg("/I").arg(directory); } @@ -635,31 +730,37 @@ impl Config { if target.contains("msvc") { let mut cmd = match self.archiver { Some(ref s) => self.cmd(s), - None => windows_registry::find(&target, "lib.exe") - .unwrap_or(self.cmd("lib.exe")), + None => windows_registry::find(&target, "lib.exe").unwrap_or(self.cmd("lib.exe")), }; let mut out = OsString::from("/OUT:"); out.push(dst); - run(cmd.arg(out).arg("/nologo") - .args(objects) - .args(&self.objects), "lib.exe"); + run(cmd.arg(out) + .arg("/nologo") + .args(objects) + .args(&self.objects), + "lib.exe"); // The Rust compiler will look for libfoo.a and foo.lib, but the // MSVC linker will also be passed foo.lib, so be sure that both // exist for now. let lib_dst = dst.with_file_name(format!("{}.lib", lib_name)); let _ = fs::remove_file(&lib_dst); - fs::hard_link(&dst, &lib_dst).or_else(|_| { - //if hard-link fails, just copy (ignoring the number of bytes written) - fs::copy(&dst, &lib_dst).map(|_| ()) - }).ok().expect("Copying from {:?} to {:?} failed.");; + fs::hard_link(&dst, &lib_dst) + .or_else(|_| { + // if hard-link fails, just copy (ignoring the number of bytes written) + fs::copy(&dst, &lib_dst).map(|_| ()) + }) + .ok() + .expect("Copying from {:?} to {:?} failed.");; } else { let ar = self.get_ar(); let cmd = ar.file_name().unwrap().to_string_lossy(); - run(self.cmd(&ar).arg("crs") - .arg(dst) - .args(objects) - .args(&self.objects), &cmd); + run(self.cmd(&ar) + .arg("crs") + .arg(dst) + .args(objects) + .args(&self.objects), + &cmd); } } @@ -677,7 +778,7 @@ impl Config { "arm64" | "aarch64" => ArchSpec::Device("arm64"), "i386" | "i686" => ArchSpec::Simulator("-m32"), "x86_64" => ArchSpec::Simulator("-m64"), - _ => fail("Unknown arch for iOS target") + _ => fail("Unknown arch for iOS target"), }; let sdk = match arch { @@ -686,7 +787,7 @@ impl Config { cmd.args.push(arch.into()); cmd.args.push("-miphoneos-version-min=7.0".into()); "iphoneos" - }, + } ArchSpec::Simulator(arch) => { cmd.args.push(arch.into()); cmd.args.push("-mios-simulator-version-min=7.0".into()); @@ -715,12 +816,12 @@ impl Config { for &(ref a, ref b) in self.env.iter() { cmd.env(a, b); } - return cmd + return cmd; } fn get_base_compiler(&self) -> Tool { if let Some(ref c) = self.compiler { - return Tool::new(c.clone()) + return Tool::new(c.clone()); } let host = self.get_host(); let target = self.get_target(); @@ -729,87 +830,88 @@ impl Config { } else { ("CC", "cl.exe", "gcc", "cc") }; - self.env_tool(env).map(|(tool, args)| { - let mut t = Tool::new(PathBuf::from(tool)); - for arg in args { - t.args.push(arg.into()); - } - return t - }).or_else(|| { - if target.contains("emscripten") { - if self.cpp { - Some(Tool::new(PathBuf::from("em++"))) + self.env_tool(env) + .map(|(tool, args)| { + let mut t = Tool::new(PathBuf::from(tool)); + for arg in args { + t.args.push(arg.into()); + } + return t; + }) + .or_else(|| { + if target.contains("emscripten") { + if self.cpp { + Some(Tool::new(PathBuf::from("em++"))) + } else { + Some(Tool::new(PathBuf::from("emcc"))) + } } else { - Some(Tool::new(PathBuf::from("emcc"))) + None } - } else { - None - } - }).or_else(|| { - windows_registry::find_tool(&target, "cl.exe") - }).unwrap_or_else(|| { - let compiler = if host.contains("windows") && - target.contains("windows") { - if target.contains("msvc") { - msvc.to_string() + }) + .or_else(|| windows_registry::find_tool(&target, "cl.exe")) + .unwrap_or_else(|| { + let compiler = if host.contains("windows") && target.contains("windows") { + if target.contains("msvc") { + msvc.to_string() + } else { + format!("{}.exe", gnu) + } + } else if target.contains("android") { + format!("{}-{}", target.replace("armv7", "arm"), gnu) + } else if self.get_host() != target { + // CROSS_COMPILE is of the form: "arm-linux-gnueabi-" + let cc_env = self.getenv("CROSS_COMPILE"); + let cross_compile = cc_env.as_ref().map(|s| s.trim_right_matches('-')); + let prefix = cross_compile.or(match &target[..] { + "aarch64-unknown-linux-gnu" => Some("aarch64-linux-gnu"), + "arm-unknown-linux-gnueabi" => Some("arm-linux-gnueabi"), + "arm-unknown-linux-gnueabihf" => Some("arm-linux-gnueabihf"), + "arm-unknown-linux-musleabi" => Some("arm-linux-musleabi"), + "arm-unknown-linux-musleabihf" => Some("arm-linux-musleabihf"), + "arm-unknown-netbsdelf-eabi" => Some("arm--netbsdelf-eabi"), + "armv6-unknown-netbsdelf-eabihf" => Some("armv6--netbsdelf-eabihf"), + "armv7-unknown-linux-gnueabihf" => Some("arm-linux-gnueabihf"), + "armv7-unknown-linux-musleabihf" => Some("arm-linux-musleabihf"), + "armv7-unknown-netbsdelf-eabihf" => Some("armv7--netbsdelf-eabihf"), + "i686-pc-windows-gnu" => Some("i686-w64-mingw32"), + "i686-unknown-linux-musl" => Some("musl"), + "i686-unknown-netbsdelf" => Some("i486--netbsdelf"), + "mips-unknown-linux-gnu" => Some("mips-linux-gnu"), + "mipsel-unknown-linux-gnu" => Some("mipsel-linux-gnu"), + "mips64-unknown-linux-gnuabi64" => Some("mips64-linux-gnuabi64"), + "mips64el-unknown-linux-gnuabi64" => Some("mips64el-linux-gnuabi64"), + "powerpc-unknown-linux-gnu" => Some("powerpc-linux-gnu"), + "powerpc-unknown-netbsd" => Some("powerpc--netbsd"), + "powerpc64-unknown-linux-gnu" => Some("powerpc-linux-gnu"), + "powerpc64le-unknown-linux-gnu" => Some("powerpc64le-linux-gnu"), + "s390x-unknown-linux-gnu" => Some("s390x-linux-gnu"), + "sparc64-unknown-netbsd" => Some("sparc64--netbsd"), + "thumbv6m-none-eabi" => Some("arm-none-eabi"), + "thumbv7em-none-eabi" => Some("arm-none-eabi"), + "thumbv7em-none-eabihf" => Some("arm-none-eabi"), + "thumbv7m-none-eabi" => Some("arm-none-eabi"), + "x86_64-pc-windows-gnu" => Some("x86_64-w64-mingw32"), + "x86_64-rumprun-netbsd" => Some("x86_64-rumprun-netbsd"), + "x86_64-unknown-linux-musl" => Some("musl"), + "x86_64-unknown-netbsd" => Some("x86_64--netbsd"), + _ => None, + }); + match prefix { + Some(prefix) => format!("{}-{}", prefix, gnu), + None => default.to_string(), + } } else { - format!("{}.exe", gnu) - } - } else if target.contains("android") { - format!("{}-{}", target, gnu) - } else if self.get_host() != target { - // CROSS_COMPILE is of the form: "arm-linux-gnueabi-" - let cc_env = self.getenv("CROSS_COMPILE"); - let cross_compile = cc_env.as_ref().map(|s| s.trim_right_matches('-')); - let prefix = cross_compile.or(match &target[..] { - "aarch64-unknown-linux-gnu" => Some("aarch64-linux-gnu"), - "arm-unknown-linux-gnueabi" => Some("arm-linux-gnueabi"), - "arm-unknown-linux-gnueabihf" => Some("arm-linux-gnueabihf"), - "arm-unknown-linux-musleabi" => Some("arm-linux-musleabi"), - "arm-unknown-linux-musleabihf" => Some("arm-linux-musleabihf"), - "arm-unknown-netbsdelf-eabi" => Some("arm--netbsdelf-eabi"), - "armv6-unknown-netbsdelf-eabihf" => Some("armv6--netbsdelf-eabihf"), - "armv7-unknown-linux-gnueabihf" => Some("arm-linux-gnueabihf"), - "armv7-unknown-linux-musleabihf" => Some("arm-linux-musleabihf"), - "armv7-unknown-netbsdelf-eabihf" => Some("armv7--netbsdelf-eabihf"), - "i686-pc-windows-gnu" => Some("i686-w64-mingw32"), - "i686-unknown-linux-musl" => Some("musl"), - "i686-unknown-netbsdelf" => Some("i486--netbsdelf"), - "mips-unknown-linux-gnu" => Some("mips-linux-gnu"), - "mipsel-unknown-linux-gnu" => Some("mipsel-linux-gnu"), - "mips64-unknown-linux-gnuabi64" => Some("mips64-linux-gnuabi64"), - "mips64el-unknown-linux-gnuabi64" => Some("mips64el-linux-gnuabi64"), - "powerpc-unknown-linux-gnu" => Some("powerpc-linux-gnu"), - "powerpc-unknown-netbsd" => Some("powerpc--netbsd"), - "powerpc64-unknown-linux-gnu" => Some("powerpc-linux-gnu"), - "powerpc64le-unknown-linux-gnu" => Some("powerpc64le-linux-gnu"), - "s390x-unknown-linux-gnu" => Some("s390x-linux-gnu"), - "sparc64-unknown-netbsd" => Some("sparc64--netbsd"), - "thumbv6m-none-eabi" => Some("arm-none-eabi"), - "thumbv7em-none-eabi" => Some("arm-none-eabi"), - "thumbv7em-none-eabihf" => Some("arm-none-eabi"), - "thumbv7m-none-eabi" => Some("arm-none-eabi"), - "x86_64-pc-windows-gnu" => Some("x86_64-w64-mingw32"), - "x86_64-rumprun-netbsd" => Some("x86_64-rumprun-netbsd"), - "x86_64-unknown-linux-musl" => Some("musl"), - "x86_64-unknown-netbsd" => Some("x86_64--netbsd"), - _ => None, - }); - match prefix { - Some(prefix) => format!("{}-{}", prefix, gnu), - None => default.to_string(), - } - } else { - default.to_string() - }; - Tool::new(PathBuf::from(compiler)) - }) + default.to_string() + }; + Tool::new(PathBuf::from(compiler)) + }) } fn get_var(&self, var_base: &str) -> Result { let target = self.get_target(); let host = self.get_host(); - let kind = if host == target {"HOST"} else {"TARGET"}; + let kind = if host == target { "HOST" } else { "TARGET" }; let target_u = target.replace("-", "_"); let res = self.getenv(&format!("{}_{}", var_base, target)) .or_else(|| self.getenv(&format!("{}_{}", var_base, target_u))) @@ -823,8 +925,10 @@ impl Config { } fn envflags(&self, name: &str) -> Vec { - self.get_var(name).unwrap_or(String::new()) - .split(|c: char| c.is_whitespace()).filter(|s| !s.is_empty()) + self.get_var(name) + .unwrap_or(String::new()) + .split(|c: char| c.is_whitespace()) + .filter(|s| !s.is_empty()) .map(|s| s.to_string()) .collect() } @@ -834,8 +938,7 @@ impl Config { let whitelist = ["ccache", "distcc"]; for t in whitelist.iter() { if tool.starts_with(t) && tool[t.len()..].starts_with(" ") { - return (t.to_string(), - vec![tool[t.len()..].trim_left().to_string()]) + return (t.to_string(), vec![tool[t.len()..].trim_left().to_string()]); } } (tool, Vec::new()) @@ -860,17 +963,18 @@ impl Config { } fn get_ar(&self) -> PathBuf { - self.archiver.clone().or_else(|| { - self.get_var("AR").map(PathBuf::from).ok() - }).unwrap_or_else(|| { - if self.get_target().contains("android") { - PathBuf::from(format!("{}-ar", self.get_target())) - } else if self.get_target().contains("emscripten") { - PathBuf::from("emar") - } else { - PathBuf::from("ar") - } - }) + self.archiver + .clone() + .or_else(|| self.get_var("AR").map(PathBuf::from).ok()) + .unwrap_or_else(|| { + if self.get_target().contains("android") { + PathBuf::from(format!("{}-ar", self.get_target().replace("armv7", "arm"))) + } else if self.get_target().contains("emscripten") { + PathBuf::from("emar") + } else { + PathBuf::from("ar") + } + }) } fn get_target(&self) -> String { @@ -882,9 +986,7 @@ impl Config { } fn get_opt_level(&self) -> String { - self.opt_level.as_ref().cloned().unwrap_or_else(|| { - self.getenv_unwrap("OPT_LEVEL") - }) + self.opt_level.as_ref().cloned().unwrap_or_else(|| self.getenv_unwrap("OPT_LEVEL")) } fn get_debug(&self) -> bool { @@ -892,9 +994,7 @@ impl Config { } fn get_out_dir(&self) -> PathBuf { - self.out_dir.clone().unwrap_or_else(|| { - env::var_os("OUT_DIR").map(PathBuf::from).unwrap() - }) + self.out_dir.clone().unwrap_or_else(|| env::var_os("OUT_DIR").map(PathBuf::from).unwrap()) } fn getenv(&self, v: &str) -> Option { @@ -919,10 +1019,23 @@ impl Config { impl Tool { fn new(path: PathBuf) -> Tool { + // Try to detect family of the tool from its name, falling back to Gnu. + let family = if let Some(fname) = path.file_name().and_then(|p| p.to_str()) { + if fname.contains("clang") { + ToolFamily::Clang + } else if fname.contains("cl") { + ToolFamily::Msvc + } else { + ToolFamily::Gnu + } + } else { + ToolFamily::Gnu + }; Tool { path: path, args: Vec::new(), env: Vec::new(), + family: family } } @@ -937,7 +1050,7 @@ impl Tool { for &(ref k, ref v) in self.env.iter() { cmd.env(k, v); } - return cmd + cmd } /// Returns the path for this compiler. @@ -963,23 +1076,27 @@ impl Tool { } } -fn run(cmd: &mut Command, program: &str) { +fn run(cmd: &mut Command, program: &str) -> Vec { println!("running: {:?}", cmd); // Capture the standard error coming from these programs, and write it out // with cargo:warning= prefixes. Note that this is a bit wonky to avoid // requiring the output to be UTF-8, we instead just ship bytes from one // location to another. - let spawn_result = match cmd.stderr(Stdio::piped()).spawn() { + let (spawn_result, stdout) = match cmd.stdout(Stdio::piped()).stderr(Stdio::piped()).spawn() { Ok(mut child) => { let stderr = BufReader::new(child.stderr.take().unwrap()); - for line in stderr.split(b'\n').filter_map(|l| l.ok()) { - print!("cargo:warning="); - std::io::stdout().write_all(&line).unwrap(); - println!(""); - } - child.wait() + thread::spawn(move || { + for line in stderr.split(b'\n').filter_map(|l| l.ok()) { + print!("cargo:warning="); + std::io::stdout().write_all(&line).unwrap(); + println!(""); + } + }); + let mut stdout = vec![]; + child.stdout.take().unwrap().read_to_end(&mut stdout).unwrap(); + (child.wait(), stdout) } - Err(e) => Err(e), + Err(e) => (Err(e), vec![]), }; let status = match spawn_result { Ok(status) => status, @@ -991,7 +1108,10 @@ fn run(cmd: &mut Command, program: &str) { "" }; fail(&format!("failed to execute command: {}\nIs `{}` \ - not installed?{}", e, program, extra)); + not installed?{}", + e, + program, + extra)); } Err(e) => fail(&format!("failed to execute command: {}", e)), }; @@ -999,6 +1119,7 @@ fn run(cmd: &mut Command, program: &str) { if !status.success() { fail(&format!("command did not execute successfully, got: {}", status)); } + stdout } fn fail(s: &str) -> ! { diff --git a/src/vendor/gcc/src/registry.rs b/src/vendor/gcc/src/registry.rs index d871cd21f3c..a45272344db 100644 --- a/src/vendor/gcc/src/registry.rs +++ b/src/vendor/gcc/src/registry.rs @@ -40,7 +40,8 @@ extern "system" { lpSubKey: LPCWSTR, ulOptions: DWORD, samDesired: REGSAM, - phkResult: PHKEY) -> LONG; + phkResult: PHKEY) + -> LONG; fn RegEnumKeyExW(key: HKEY, dwIndex: DWORD, lpName: LPWSTR, @@ -48,13 +49,15 @@ extern "system" { lpReserved: LPDWORD, lpClass: LPWSTR, lpcClass: LPDWORD, - lpftLastWriteTime: PFILETIME) -> LONG; + lpftLastWriteTime: PFILETIME) + -> LONG; fn RegQueryValueExW(hKey: HKEY, lpValueName: LPCWSTR, lpReserved: LPDWORD, lpType: LPDWORD, lpData: LPBYTE, - lpcbData: LPDWORD) -> LONG; + lpcbData: LPDWORD) + -> LONG; fn RegCloseKey(hKey: HKEY) -> LONG; } @@ -73,8 +76,7 @@ pub struct Iter<'a> { unsafe impl Sync for Repr {} unsafe impl Send for Repr {} -pub static LOCAL_MACHINE: RegistryKey = - RegistryKey(Repr::Const(HKEY_LOCAL_MACHINE)); +pub static LOCAL_MACHINE: RegistryKey = RegistryKey(Repr::Const(HKEY_LOCAL_MACHINE)); impl RegistryKey { fn raw(&self) -> HKEY { @@ -88,8 +90,11 @@ impl RegistryKey { let key = key.encode_wide().chain(Some(0)).collect::>(); let mut ret = 0 as *mut _; let err = unsafe { - RegOpenKeyExW(self.raw(), key.as_ptr(), 0, - KEY_READ | KEY_WOW64_32KEY, &mut ret) + RegOpenKeyExW(self.raw(), + key.as_ptr(), + 0, + KEY_READ | KEY_WOW64_32KEY, + &mut ret) }; if err == ERROR_SUCCESS as LONG { Ok(RegistryKey(Repr::Owned(OwnedKey(ret)))) @@ -99,7 +104,10 @@ impl RegistryKey { } pub fn iter(&self) -> Iter { - Iter { idx: 0.., key: self } + Iter { + idx: 0.., + key: self, + } } pub fn query_str(&self, name: &str) -> io::Result { @@ -108,25 +116,31 @@ impl RegistryKey { let mut len = 0; let mut kind = 0; unsafe { - let err = RegQueryValueExW(self.raw(), name.as_ptr(), 0 as *mut _, - &mut kind, 0 as *mut _, &mut len); + let err = RegQueryValueExW(self.raw(), + name.as_ptr(), + 0 as *mut _, + &mut kind, + 0 as *mut _, + &mut len); if err != ERROR_SUCCESS as LONG { - return Err(io::Error::from_raw_os_error(err as i32)) + return Err(io::Error::from_raw_os_error(err as i32)); } if kind != REG_SZ { - return Err(io::Error::new(io::ErrorKind::Other, - "registry key wasn't a string")) + return Err(io::Error::new(io::ErrorKind::Other, "registry key wasn't a string")); } // The length here is the length in bytes, but we're using wide // characters so we need to be sure to halve it for the capacity // passed in. let mut v = Vec::with_capacity(len as usize / 2); - let err = RegQueryValueExW(self.raw(), name.as_ptr(), 0 as *mut _, - 0 as *mut _, v.as_mut_ptr() as *mut _, + let err = RegQueryValueExW(self.raw(), + name.as_ptr(), + 0 as *mut _, + 0 as *mut _, + v.as_mut_ptr() as *mut _, &mut len); if err != ERROR_SUCCESS as LONG { - return Err(io::Error::from_raw_os_error(err as i32)) + return Err(io::Error::from_raw_os_error(err as i32)); } v.set_len(len as usize / 2); @@ -142,7 +156,9 @@ impl RegistryKey { impl Drop for OwnedKey { fn drop(&mut self) { - unsafe { RegCloseKey(self.0); } + unsafe { + RegCloseKey(self.0); + } } } @@ -153,8 +169,13 @@ impl<'a> Iterator for Iter<'a> { self.idx.next().and_then(|i| unsafe { let mut v = Vec::with_capacity(256); let mut len = v.capacity() as DWORD; - let ret = RegEnumKeyExW(self.key.raw(), i, v.as_mut_ptr(), &mut len, - 0 as *mut _, 0 as *mut _, 0 as *mut _, + let ret = RegEnumKeyExW(self.key.raw(), + i, + v.as_mut_ptr(), + &mut len, + 0 as *mut _, + 0 as *mut _, + 0 as *mut _, 0 as *mut _); if ret == ERROR_NO_MORE_ITEMS as LONG { None diff --git a/src/vendor/gcc/src/windows_registry.rs b/src/vendor/gcc/src/windows_registry.rs index e16a33f2464..08b1df5f9b2 100644 --- a/src/vendor/gcc/src/windows_registry.rs +++ b/src/vendor/gcc/src/windows_registry.rs @@ -78,31 +78,29 @@ pub fn find_tool(target: &str, tool: &str) -> Option { add_env(&mut tool, "LIB", libs); add_env(&mut tool, "PATH", path); add_env(&mut tool, "INCLUDE", include); - return tool + tool } } // This logic is all tailored for MSVC, if we're not that then bail out // early. if !target.contains("msvc") { - return None + return None; } // Looks like msbuild isn't located in the same location as other tools like // cl.exe and lib.exe. To handle this we probe for it manually with // dedicated registry keys. if tool.contains("msbuild") { - return find_msbuild(target) + return find_msbuild(target); } // If VCINSTALLDIR is set, then someone's probably already run vcvars and we // should just find whatever that indicates. if env::var_os("VCINSTALLDIR").is_some() { - return env::var_os("PATH").and_then(|path| { - env::split_paths(&path).map(|p| p.join(tool)).find(|p| p.exists()) - }).map(|path| { - Tool::new(path.into()) - }) + return env::var_os("PATH") + .and_then(|path| env::split_paths(&path).map(|p| p.join(tool)).find(|p| p.exists())) + .map(|path| Tool::new(path.into())); } // Ok, if we're here, now comes the fun part of the probing. Default shells @@ -112,13 +110,10 @@ pub fn find_tool(target: &str, tool: &str) -> Option { // environment variables like `LIB`, `INCLUDE`, and `PATH` to ensure that // the tool is actually usable. - return find_msvc_latest(tool, target, "15.0").or_else(|| { - find_msvc_latest(tool, target, "14.0") - }).or_else(|| { - find_msvc_12(tool, target) - }).or_else(|| { - find_msvc_11(tool, target) - }); + return find_msvc_latest(tool, target, "15.0") + .or_else(|| find_msvc_latest(tool, target, "14.0")) + .or_else(|| find_msvc_12(tool, target)) + .or_else(|| find_msvc_11(tool, target)); // For MSVC 14 or newer we need to find the Universal CRT as well as either // the Windows 10 SDK or Windows 8.1 SDK. @@ -151,7 +146,7 @@ pub fn find_tool(target: &str, tool: &str) -> Option { tool.include.push(sdk_include.join("winrt")); tool.include.push(sdk_include.join("shared")); } else { - return None + return None; } Some(tool.into_tool()) } @@ -198,26 +193,27 @@ pub fn find_tool(target: &str, tool: &str) -> Option { // Given a possible MSVC installation directory, we look for the linker and // then add the MSVC library path. fn get_tool(tool: &str, path: &Path, target: &str) -> Option { - bin_subdir(target).into_iter().map(|(sub, host)| { - (path.join("bin").join(sub).join(tool), - path.join("bin").join(host)) - }).filter(|&(ref path, _)| { - path.is_file() - }).map(|(path, host)| { - let mut tool = MsvcTool::new(path); - tool.path.push(host); - tool - }).filter_map(|mut tool| { - let sub = otry!(vc_lib_subdir(target)); - tool.libs.push(path.join("lib").join(sub)); - tool.include.push(path.join("include")); - let atlmfc_path = path.join("atlmfc"); - if atlmfc_path.exists() { - tool.libs.push(atlmfc_path.join("lib").join(sub)); - tool.include.push(atlmfc_path.join("include")); - } - Some(tool) - }).next() + bin_subdir(target) + .into_iter() + .map(|(sub, host)| (path.join("bin").join(sub).join(tool), path.join("bin").join(host))) + .filter(|&(ref path, _)| path.is_file()) + .map(|(path, host)| { + let mut tool = MsvcTool::new(path); + tool.path.push(host); + tool + }) + .filter_map(|mut tool| { + let sub = otry!(vc_lib_subdir(target)); + tool.libs.push(path.join("lib").join(sub)); + tool.include.push(path.join("include")); + let atlmfc_path = path.join("atlmfc"); + if atlmfc_path.exists() { + tool.libs.push(atlmfc_path.join("lib").join(sub)); + tool.include.push(atlmfc_path.join("include")); + } + Some(tool) + }) + .next() } // To find MSVC we look in a specific registry key for the version we are @@ -240,17 +236,16 @@ pub fn find_tool(target: &str, tool: &str) -> Option { let key = otry!(LOCAL_MACHINE.open(key.as_ref()).ok()); let root = otry!(key.query_str("KitsRoot10").ok()); let readdir = otry!(Path::new(&root).join("lib").read_dir().ok()); - let max_libdir = otry!(readdir.filter_map(|dir| { - dir.ok() - }).map(|dir| { - dir.path() - }).filter(|dir| { - dir.components().last().and_then(|c| { - c.as_os_str().to_str() - }).map(|c| { - c.starts_with("10.") && dir.join("ucrt").is_dir() - }).unwrap_or(false) - }).max()); + let max_libdir = otry!(readdir.filter_map(|dir| dir.ok()) + .map(|dir| dir.path()) + .filter(|dir| { + dir.components() + .last() + .and_then(|c| c.as_os_str().to_str()) + .map(|c| c.starts_with("10.") && dir.join("ucrt").is_dir()) + .unwrap_or(false) + }) + .max()); let version = max_libdir.components().last().unwrap(); let version = version.as_os_str().to_str().unwrap().to_string(); Some((root.into(), version)) @@ -270,12 +265,13 @@ pub fn find_tool(target: &str, tool: &str) -> Option { let root = otry!(key.query_str("InstallationFolder").ok()); let readdir = otry!(Path::new(&root).join("lib").read_dir().ok()); let mut dirs = readdir.filter_map(|dir| dir.ok()) - .map(|dir| dir.path()) - .collect::>(); + .map(|dir| dir.path()) + .collect::>(); dirs.sort(); - let dir = otry!(dirs.into_iter().rev().filter(|dir| { - dir.join("um").join("x64").join("kernel32.lib").is_file() - }).next()); + let dir = otry!(dirs.into_iter() + .rev() + .filter(|dir| dir.join("um").join("x64").join("kernel32.lib").is_file()) + .next()); let version = dir.components().last().unwrap(); let version = version.as_os_str().to_str().unwrap().to_string(); Some((root.into(), version)) @@ -319,10 +315,8 @@ pub fn find_tool(target: &str, tool: &str) -> Option { fn bin_subdir(target: &str) -> Vec<(&'static str, &'static str)> { let arch = target.split('-').next().unwrap(); match (arch, host_arch()) { - ("i586", X86) | - ("i686", X86) => vec![("", "")], - ("i586", X86_64) | - ("i686", X86_64) => vec![("amd64_x86", "amd64"), ("", "")], + ("i586", X86) | ("i686", X86) => vec![("", "")], + ("i586", X86_64) | ("i686", X86_64) => vec![("amd64_x86", "amd64"), ("", "")], ("x86_64", X86) => vec![("x86_amd64", "")], ("x86_64", X86_64) => vec![("amd64", "amd64"), ("x86_amd64", "")], ("arm", X86) => vec![("x86_arm", "")], @@ -393,9 +387,8 @@ pub fn find_tool(target: &str, tool: &str) -> Option { let mut max_vers = 0; let mut max_key = None; for subkey in key.iter().filter_map(|k| k.ok()) { - let val = subkey.to_str().and_then(|s| { - s.trim_left_matches("v").replace(".", "").parse().ok() - }); + let val = subkey.to_str() + .and_then(|s| s.trim_left_matches("v").replace(".", "").parse().ok()); let val = match val { Some(s) => s, None => continue, @@ -407,24 +400,25 @@ pub fn find_tool(target: &str, tool: &str) -> Option { } } } - return max_key + max_key } // see http://stackoverflow.com/questions/328017/path-to-msbuild fn find_msbuild(target: &str) -> Option { let key = r"SOFTWARE\Microsoft\MSBuild\ToolsVersions"; - LOCAL_MACHINE.open(key.as_ref()).ok().and_then(|key| { - max_version(&key).and_then(|(_vers, key)| { - key.query_str("MSBuildToolsPath").ok() + LOCAL_MACHINE.open(key.as_ref()) + .ok() + .and_then(|key| { + max_version(&key).and_then(|(_vers, key)| key.query_str("MSBuildToolsPath").ok()) + }) + .map(|path| { + let mut path = PathBuf::from(path); + path.push("MSBuild.exe"); + let mut tool = Tool::new(path); + if target.contains("x86_64") { + tool.env.push(("Platform".into(), "X64".into())); + } + tool }) - }).map(|path| { - let mut path = PathBuf::from(path); - path.push("MSBuild.exe"); - let mut tool = Tool::new(path); - if target.contains("x86_64") { - tool.env.push(("Platform".into(), "X64".into())); - } - tool - }) } } diff --git a/src/vendor/gcc/tests/support/mod.rs b/src/vendor/gcc/tests/support/mod.rs index 5c40984eb6a..135a6635b59 100644 --- a/src/vendor/gcc/tests/support/mod.rs +++ b/src/vendor/gcc/tests/support/mod.rs @@ -37,28 +37,27 @@ impl Test { pub fn gnu() -> Test { let t = Test::new(); t.shim("cc").shim("ar"); - return t + t } pub fn msvc() -> Test { let mut t = Test::new(); t.shim("cl").shim("lib.exe"); t.msvc = true; - return t + t } pub fn shim(&self, name: &str) -> &Test { let fname = format!("{}{}", name, env::consts::EXE_SUFFIX); - fs::hard_link(&self.gcc, self.td.path().join(&fname)).or_else(|_| { - fs::copy(&self.gcc, self.td.path().join(&fname)).map(|_| ()) - }).unwrap(); + fs::hard_link(&self.gcc, self.td.path().join(&fname)) + .or_else(|_| fs::copy(&self.gcc, self.td.path().join(&fname)).map(|_| ())) + .unwrap(); self } pub fn gcc(&self) -> gcc::Config { let mut cfg = gcc::Config::new(); - let mut path = env::split_paths(&env::var_os("PATH").unwrap()) - .collect::>(); + let mut path = env::split_paths(&env::var_os("PATH").unwrap()).collect::>(); path.insert(0, self.td.path().to_owned()); let target = if self.msvc { "x86_64-pc-windows-msvc" @@ -66,26 +65,27 @@ impl Test { "x86_64-unknown-linux-gnu" }; - cfg.target(target).host(target) - .opt_level(2) - .debug(false) - .out_dir(self.td.path()) - .__set_env("PATH", env::join_paths(path).unwrap()) - .__set_env("GCCTEST_OUT_DIR", self.td.path()); + cfg.target(target) + .host(target) + .opt_level(2) + .debug(false) + .out_dir(self.td.path()) + .__set_env("PATH", env::join_paths(path).unwrap()) + .__set_env("GCCTEST_OUT_DIR", self.td.path()); if self.msvc { cfg.compiler(self.td.path().join("cl")); cfg.archiver(self.td.path().join("lib.exe")); } - return cfg + cfg } pub fn cmd(&self, i: u32) -> Execution { let mut s = String::new(); - File::open(self.td.path().join(format!("out{}", i))).unwrap() - .read_to_string(&mut s).unwrap(); - Execution { - args: s.lines().map(|s| s.to_string()).collect(), - } + File::open(self.td.path().join(format!("out{}", i))) + .unwrap() + .read_to_string(&mut s) + .unwrap(); + Execution { args: s.lines().map(|s| s.to_string()).collect() } } } @@ -107,8 +107,6 @@ impl Execution { } pub fn has(&self, p: &OsStr) -> bool { - self.args.iter().any(|arg| { - OsStr::new(arg) == p - }) + self.args.iter().any(|arg| OsStr::new(arg) == p) } } diff --git a/src/vendor/gcc/tests/test.rs b/src/vendor/gcc/tests/test.rs index 1b6a0bd0d10..5a034ff347b 100644 --- a/src/vendor/gcc/tests/test.rs +++ b/src/vendor/gcc/tests/test.rs @@ -9,14 +9,16 @@ mod support; fn gnu_smoke() { let test = Test::gnu(); test.gcc() - .file("foo.c").compile("libfoo.a"); + .file("foo.c") + .compile("libfoo.a"); - test.cmd(0).must_have("-O2") - .must_have("foo.c") - .must_not_have("-g") - .must_have("-c") - .must_have("-ffunction-sections") - .must_have("-fdata-sections"); + test.cmd(0) + .must_have("-O2") + .must_have("foo.c") + .must_not_have("-g") + .must_have("-c") + .must_have("-ffunction-sections") + .must_have("-fdata-sections"); test.cmd(1).must_have(test.td.path().join("foo.o")); } @@ -25,10 +27,12 @@ fn gnu_opt_level_1() { let test = Test::gnu(); test.gcc() .opt_level(1) - .file("foo.c").compile("libfoo.a"); + .file("foo.c") + .compile("libfoo.a"); - test.cmd(0).must_have("-O1") - .must_not_have("-O2"); + test.cmd(0) + .must_have("-O1") + .must_not_have("-O2"); } #[test] @@ -36,13 +40,15 @@ fn gnu_opt_level_s() { let test = Test::gnu(); test.gcc() .opt_level_str("s") - .file("foo.c").compile("libfoo.a"); + .file("foo.c") + .compile("libfoo.a"); - test.cmd(0).must_have("-Os") - .must_not_have("-O1") - .must_not_have("-O2") - .must_not_have("-O3") - .must_not_have("-Oz"); + test.cmd(0) + .must_have("-Os") + .must_not_have("-O1") + .must_not_have("-O2") + .must_not_have("-O3") + .must_not_have("-Oz"); } #[test] @@ -50,7 +56,8 @@ fn gnu_debug() { let test = Test::gnu(); test.gcc() .debug(true) - .file("foo.c").compile("libfoo.a"); + .file("foo.c") + .compile("libfoo.a"); test.cmd(0).must_have("-g"); } @@ -62,10 +69,12 @@ fn gnu_x86_64() { test.gcc() .target(&target) .host(&target) - .file("foo.c").compile("libfoo.a"); + .file("foo.c") + .compile("libfoo.a"); - test.cmd(0).must_have("-fPIC") - .must_have("-m64"); + test.cmd(0) + .must_have("-fPIC") + .must_have("-m64"); } } @@ -78,7 +87,8 @@ fn gnu_x86_64_no_pic() { .pic(false) .target(&target) .host(&target) - .file("foo.c").compile("libfoo.a"); + .file("foo.c") + .compile("libfoo.a"); test.cmd(0).must_not_have("-fPIC"); } @@ -92,10 +102,12 @@ fn gnu_i686() { test.gcc() .target(&target) .host(&target) - .file("foo.c").compile("libfoo.a"); + .file("foo.c") + .compile("libfoo.a"); - test.cmd(0).must_not_have("-fPIC") - .must_have("-m32"); + test.cmd(0) + .must_not_have("-fPIC") + .must_have("-m32"); } } @@ -108,7 +120,8 @@ fn gnu_i686_pic() { .pic(true) .target(&target) .host(&target) - .file("foo.c").compile("libfoo.a"); + .file("foo.c") + .compile("libfoo.a"); test.cmd(0).must_have("-fPIC"); } @@ -119,7 +132,8 @@ fn gnu_set_stdlib() { let test = Test::gnu(); test.gcc() .cpp_set_stdlib(Some("foo")) - .file("foo.c").compile("libfoo.a"); + .file("foo.c") + .compile("libfoo.a"); test.cmd(0).must_not_have("-stdlib=foo"); } @@ -129,7 +143,8 @@ fn gnu_include() { let test = Test::gnu(); test.gcc() .include("foo/bar") - .file("foo.c").compile("libfoo.a"); + .file("foo.c") + .compile("libfoo.a"); test.cmd(0).must_have("-I").must_have("foo/bar"); } @@ -140,7 +155,8 @@ fn gnu_define() { test.gcc() .define("FOO", Some("bar")) .define("BAR", None) - .file("foo.c").compile("libfoo.a"); + .file("foo.c") + .compile("libfoo.a"); test.cmd(0).must_have("-DFOO=bar").must_have("-DBAR"); } @@ -149,7 +165,8 @@ fn gnu_define() { fn gnu_compile_assembly() { let test = Test::gnu(); test.gcc() - .file("foo.S").compile("libfoo.a"); + .file("foo.S") + .compile("libfoo.a"); test.cmd(0).must_have("foo.S"); } @@ -157,12 +174,14 @@ fn gnu_compile_assembly() { fn msvc_smoke() { let test = Test::msvc(); test.gcc() - .file("foo.c").compile("libfoo.a"); + .file("foo.c") + .compile("libfoo.a"); - test.cmd(0).must_have("/O2") - .must_have("foo.c") - .must_not_have("/Z7") - .must_have("/c"); + test.cmd(0) + .must_have("/O2") + .must_have("foo.c") + .must_not_have("/Z7") + .must_have("/c"); test.cmd(1).must_have(test.td.path().join("foo.o")); } @@ -171,7 +190,8 @@ fn msvc_opt_level_0() { let test = Test::msvc(); test.gcc() .opt_level(0) - .file("foo.c").compile("libfoo.a"); + .file("foo.c") + .compile("libfoo.a"); test.cmd(0).must_not_have("/O2"); } @@ -181,7 +201,8 @@ fn msvc_debug() { let test = Test::msvc(); test.gcc() .debug(true) - .file("foo.c").compile("libfoo.a"); + .file("foo.c") + .compile("libfoo.a"); test.cmd(0).must_have("/Z7"); } @@ -190,7 +211,8 @@ fn msvc_include() { let test = Test::msvc(); test.gcc() .include("foo/bar") - .file("foo.c").compile("libfoo.a"); + .file("foo.c") + .compile("libfoo.a"); test.cmd(0).must_have("/I").must_have("foo/bar"); } @@ -201,7 +223,8 @@ fn msvc_define() { test.gcc() .define("FOO", Some("bar")) .define("BAR", None) - .file("foo.c").compile("libfoo.a"); + .file("foo.c") + .compile("libfoo.a"); test.cmd(0).must_have("/DFOO=bar").must_have("/DBAR"); } From b4e6f70edac44c87eb71903d96d47d7fe48c37d8 Mon Sep 17 00:00:00 2001 From: Dylan McKay Date: Sat, 4 Feb 2017 23:51:10 +1300 Subject: [PATCH 20/70] [llvm] Use 32-bits for alignment LLVM 4.0 changes this. This change is fine to make for LLVM 3.9 as we won't have alignments greater than 2^32-1. --- src/librustc_llvm/ffi.rs | 20 ++++++++++---------- src/librustc_trans/debuginfo/metadata.rs | 18 +++++++++--------- src/librustc_trans/debuginfo/mod.rs | 2 +- src/rustllvm/RustWrapper.cpp | 20 ++++++++++---------- 4 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/librustc_llvm/ffi.rs b/src/librustc_llvm/ffi.rs index 58b2017ceb6..a5eae96f133 100644 --- a/src/librustc_llvm/ffi.rs +++ b/src/librustc_llvm/ffi.rs @@ -1363,14 +1363,14 @@ extern "C" { pub fn LLVMRustDIBuilderCreateBasicType(Builder: DIBuilderRef, Name: *const c_char, SizeInBits: u64, - AlignInBits: u64, + AlignInBits: u32, Encoding: c_uint) -> DIBasicType; pub fn LLVMRustDIBuilderCreatePointerType(Builder: DIBuilderRef, PointeeTy: DIType, SizeInBits: u64, - AlignInBits: u64, + AlignInBits: u32, Name: *const c_char) -> DIDerivedType; @@ -1380,7 +1380,7 @@ extern "C" { File: DIFile, LineNumber: c_uint, SizeInBits: u64, - AlignInBits: u64, + AlignInBits: u32, Flags: DIFlags, DerivedFrom: DIType, Elements: DIArray, @@ -1395,7 +1395,7 @@ extern "C" { File: DIFile, LineNo: c_uint, SizeInBits: u64, - AlignInBits: u64, + AlignInBits: u32, OffsetInBits: u64, Flags: DIFlags, Ty: DIType) @@ -1423,7 +1423,7 @@ extern "C" { isLocalToUnit: bool, Val: ValueRef, Decl: DIDescriptor, - AlignInBits: u64) + AlignInBits: u32) -> DIGlobalVariable; pub fn LLVMRustDIBuilderCreateVariable(Builder: DIBuilderRef, @@ -1436,19 +1436,19 @@ extern "C" { AlwaysPreserve: bool, Flags: DIFlags, ArgNo: c_uint, - AlignInBits: u64) + AlignInBits: u32) -> DIVariable; pub fn LLVMRustDIBuilderCreateArrayType(Builder: DIBuilderRef, Size: u64, - AlignInBits: u64, + AlignInBits: u32, Ty: DIType, Subscripts: DIArray) -> DIType; pub fn LLVMRustDIBuilderCreateVectorType(Builder: DIBuilderRef, Size: u64, - AlignInBits: u64, + AlignInBits: u32, Ty: DIType, Subscripts: DIArray) -> DIType; @@ -1483,7 +1483,7 @@ extern "C" { File: DIFile, LineNumber: c_uint, SizeInBits: u64, - AlignInBits: u64, + AlignInBits: u32, Elements: DIArray, ClassType: DIType) -> DIType; @@ -1494,7 +1494,7 @@ extern "C" { File: DIFile, LineNumber: c_uint, SizeInBits: u64, - AlignInBits: u64, + AlignInBits: u32, Flags: DIFlags, Elements: DIArray, RunTimeLang: c_uint, diff --git a/src/librustc_trans/debuginfo/metadata.rs b/src/librustc_trans/debuginfo/metadata.rs index b7e319f2de4..69a2e67366c 100644 --- a/src/librustc_trans/debuginfo/metadata.rs +++ b/src/librustc_trans/debuginfo/metadata.rs @@ -299,7 +299,7 @@ fn fixed_vec_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, llvm::LLVMRustDIBuilderCreateArrayType( DIB(cx), bytes_to_bits(array_size_in_bytes), - bytes_to_bits(element_type_align), + bytes_to_bits(element_type_align) as u32, element_type_metadata, subscripts) }; @@ -730,7 +730,7 @@ fn basic_type_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, DIB(cx), name.as_ptr(), bytes_to_bits(size), - bytes_to_bits(align), + bytes_to_bits(align) as u32, encoding) }; @@ -750,7 +750,7 @@ fn pointer_type_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, DIB(cx), pointee_type_metadata, bytes_to_bits(pointer_size), - bytes_to_bits(pointer_align), + bytes_to_bits(pointer_align) as u32, name.as_ptr()) }; return ptr_metadata; @@ -1504,7 +1504,7 @@ fn prepare_enum_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, file_metadata, UNKNOWN_LINE_NUMBER, bytes_to_bits(discriminant_size), - bytes_to_bits(discriminant_align), + bytes_to_bits(discriminant_align) as u32, create_DIArray(DIB(cx), &enumerators_metadata), discriminant_base_type_metadata) }; @@ -1546,7 +1546,7 @@ fn prepare_enum_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, file_metadata, UNKNOWN_LINE_NUMBER, bytes_to_bits(enum_type_size), - bytes_to_bits(enum_type_align), + bytes_to_bits(enum_type_align) as u32, DIFlags::FlagZero, ptr::null_mut(), 0, // RuntimeLang @@ -1648,7 +1648,7 @@ fn set_members_of_composite_type(cx: &CrateContext, unknown_file_metadata(cx), UNKNOWN_LINE_NUMBER, bytes_to_bits(member_size), - bytes_to_bits(member_align), + bytes_to_bits(member_align) as u32, bytes_to_bits(member_offset), member_description.flags, member_description.type_metadata) @@ -1691,7 +1691,7 @@ fn create_struct_stub(cx: &CrateContext, unknown_file_metadata(cx), UNKNOWN_LINE_NUMBER, bytes_to_bits(struct_size), - bytes_to_bits(struct_align), + bytes_to_bits(struct_align) as u32, DIFlags::FlagZero, ptr::null_mut(), empty_array, @@ -1728,7 +1728,7 @@ fn create_union_stub(cx: &CrateContext, unknown_file_metadata(cx), UNKNOWN_LINE_NUMBER, bytes_to_bits(union_size), - bytes_to_bits(union_align), + bytes_to_bits(union_align) as u32, DIFlags::FlagZero, empty_array, 0, // RuntimeLang @@ -1783,7 +1783,7 @@ pub fn create_global_var_metadata(cx: &CrateContext, is_local_to_unit, global, ptr::null_mut(), - global_align as u64, + global_align as u32, ); } } diff --git a/src/librustc_trans/debuginfo/mod.rs b/src/librustc_trans/debuginfo/mod.rs index e9468e56637..6765cf03776 100644 --- a/src/librustc_trans/debuginfo/mod.rs +++ b/src/librustc_trans/debuginfo/mod.rs @@ -464,7 +464,7 @@ pub fn declare_local<'a, 'tcx>(bcx: &Builder<'a, 'tcx>, cx.sess().opts.optimize != config::OptLevel::No, DIFlags::FlagZero, argument_index, - align as u64, + align as u32, ) }; source_loc::set_debug_location(bcx, diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp index 34ee7d552f3..56f18ec5a0d 100644 --- a/src/rustllvm/RustWrapper.cpp +++ b/src/rustllvm/RustWrapper.cpp @@ -513,7 +513,7 @@ extern "C" LLVMRustMetadataRef LLVMRustDIBuilderCreateFunction( extern "C" LLVMRustMetadataRef LLVMRustDIBuilderCreateBasicType(LLVMRustDIBuilderRef Builder, const char *Name, - uint64_t SizeInBits, uint64_t AlignInBits, + uint64_t SizeInBits, uint32_t AlignInBits, unsigned Encoding) { return wrap(Builder->createBasicType(Name, SizeInBits, #if LLVM_VERSION_LE(3, 9) @@ -524,7 +524,7 @@ LLVMRustDIBuilderCreateBasicType(LLVMRustDIBuilderRef Builder, const char *Name, extern "C" LLVMRustMetadataRef LLVMRustDIBuilderCreatePointerType( LLVMRustDIBuilderRef Builder, LLVMRustMetadataRef PointeeTy, - uint64_t SizeInBits, uint64_t AlignInBits, const char *Name) { + uint64_t SizeInBits, uint32_t AlignInBits, const char *Name) { return wrap(Builder->createPointerType(unwrapDI(PointeeTy), SizeInBits, AlignInBits, Name)); } @@ -532,7 +532,7 @@ extern "C" LLVMRustMetadataRef LLVMRustDIBuilderCreatePointerType( extern "C" LLVMRustMetadataRef LLVMRustDIBuilderCreateStructType( LLVMRustDIBuilderRef Builder, LLVMRustMetadataRef Scope, const char *Name, LLVMRustMetadataRef File, unsigned LineNumber, uint64_t SizeInBits, - uint64_t AlignInBits, LLVMRustDIFlags Flags, + uint32_t AlignInBits, LLVMRustDIFlags Flags, LLVMRustMetadataRef DerivedFrom, LLVMRustMetadataRef Elements, unsigned RunTimeLang, LLVMRustMetadataRef VTableHolder, const char *UniqueId) { @@ -546,7 +546,7 @@ extern "C" LLVMRustMetadataRef LLVMRustDIBuilderCreateStructType( extern "C" LLVMRustMetadataRef LLVMRustDIBuilderCreateMemberType( LLVMRustDIBuilderRef Builder, LLVMRustMetadataRef Scope, const char *Name, LLVMRustMetadataRef File, unsigned LineNo, uint64_t SizeInBits, - uint64_t AlignInBits, uint64_t OffsetInBits, LLVMRustDIFlags Flags, + uint32_t AlignInBits, uint64_t OffsetInBits, LLVMRustDIFlags Flags, LLVMRustMetadataRef Ty) { return wrap(Builder->createMemberType(unwrapDI(Scope), Name, unwrapDI(File), LineNo, @@ -573,7 +573,7 @@ extern "C" LLVMRustMetadataRef LLVMRustDIBuilderCreateStaticVariable( LLVMRustDIBuilderRef Builder, LLVMRustMetadataRef Context, const char *Name, const char *LinkageName, LLVMRustMetadataRef File, unsigned LineNo, LLVMRustMetadataRef Ty, bool IsLocalToUnit, LLVMValueRef V, - LLVMRustMetadataRef Decl = nullptr, uint64_t AlignInBits = 0) { + LLVMRustMetadataRef Decl = nullptr, uint32_t AlignInBits = 0) { Constant *InitVal = cast(unwrap(V)); #if LLVM_VERSION_GE(4, 0) @@ -608,7 +608,7 @@ extern "C" LLVMRustMetadataRef LLVMRustDIBuilderCreateVariable( LLVMRustDIBuilderRef Builder, unsigned Tag, LLVMRustMetadataRef Scope, const char *Name, LLVMRustMetadataRef File, unsigned LineNo, LLVMRustMetadataRef Ty, bool AlwaysPreserve, LLVMRustDIFlags Flags, - unsigned ArgNo, uint64_t AlignInBits) { + unsigned ArgNo, uint32_t AlignInBits) { #if LLVM_VERSION_GE(3, 8) if (Tag == 0x100) { // DW_TAG_auto_variable return wrap(Builder->createAutoVariable( @@ -633,7 +633,7 @@ extern "C" LLVMRustMetadataRef LLVMRustDIBuilderCreateVariable( extern "C" LLVMRustMetadataRef LLVMRustDIBuilderCreateArrayType(LLVMRustDIBuilderRef Builder, uint64_t Size, - uint64_t AlignInBits, LLVMRustMetadataRef Ty, + uint32_t AlignInBits, LLVMRustMetadataRef Ty, LLVMRustMetadataRef Subscripts) { return wrap( Builder->createArrayType(Size, AlignInBits, unwrapDI(Ty), @@ -642,7 +642,7 @@ LLVMRustDIBuilderCreateArrayType(LLVMRustDIBuilderRef Builder, uint64_t Size, extern "C" LLVMRustMetadataRef LLVMRustDIBuilderCreateVectorType(LLVMRustDIBuilderRef Builder, uint64_t Size, - uint64_t AlignInBits, LLVMRustMetadataRef Ty, + uint32_t AlignInBits, LLVMRustMetadataRef Ty, LLVMRustMetadataRef Subscripts) { return wrap( Builder->createVectorType(Size, AlignInBits, unwrapDI(Ty), @@ -683,7 +683,7 @@ LLVMRustDIBuilderCreateEnumerator(LLVMRustDIBuilderRef Builder, extern "C" LLVMRustMetadataRef LLVMRustDIBuilderCreateEnumerationType( LLVMRustDIBuilderRef Builder, LLVMRustMetadataRef Scope, const char *Name, LLVMRustMetadataRef File, unsigned LineNumber, uint64_t SizeInBits, - uint64_t AlignInBits, LLVMRustMetadataRef Elements, + uint32_t AlignInBits, LLVMRustMetadataRef Elements, LLVMRustMetadataRef ClassTy) { return wrap(Builder->createEnumerationType( unwrapDI(Scope), Name, unwrapDI(File), LineNumber, @@ -694,7 +694,7 @@ extern "C" LLVMRustMetadataRef LLVMRustDIBuilderCreateEnumerationType( extern "C" LLVMRustMetadataRef LLVMRustDIBuilderCreateUnionType( LLVMRustDIBuilderRef Builder, LLVMRustMetadataRef Scope, const char *Name, LLVMRustMetadataRef File, unsigned LineNumber, uint64_t SizeInBits, - uint64_t AlignInBits, LLVMRustDIFlags Flags, LLVMRustMetadataRef Elements, + uint32_t AlignInBits, LLVMRustDIFlags Flags, LLVMRustMetadataRef Elements, unsigned RunTimeLang, const char *UniqueId) { return wrap(Builder->createUnionType( unwrapDI(Scope), Name, unwrapDI(File), LineNumber, From 8579218b273a25ee05386034b2df2c9aee9234c7 Mon Sep 17 00:00:00 2001 From: Cengiz Can Date: Tue, 24 Jan 2017 15:19:36 +0000 Subject: [PATCH 21/70] Improve error message for uninferrable types #38812 --- src/librustc/traits/error_reporting.rs | 80 ++++++++++++++----- src/test/compile-fail/issue-12187-1.rs | 4 +- src/test/compile-fail/issue-12187-2.rs | 4 +- src/test/compile-fail/issue-17551.rs | 2 +- src/test/compile-fail/issue-18159.rs | 2 +- src/test/compile-fail/issue-23041.rs | 2 +- src/test/compile-fail/issue-23046.rs | 2 +- src/test/compile-fail/issue-24013.rs | 2 +- src/test/compile-fail/issue-5062.rs | 2 +- src/test/compile-fail/issue-6458-2.rs | 2 +- src/test/compile-fail/issue-6458-3.rs | 4 +- src/test/compile-fail/issue-6458.rs | 4 +- src/test/compile-fail/issue-7813.rs | 5 +- ...method-ambig-one-trait-unknown-int-type.rs | 2 +- ...traits-multidispatch-convert-ambig-dest.rs | 4 +- src/test/compile-fail/unconstrained-none.rs | 4 +- src/test/compile-fail/unconstrained-ref.rs | 4 +- src/test/compile-fail/vector-no-ann.rs | 5 +- .../repair_span_std_macros.stderr | 7 +- .../missing-type-parameter.stderr | 5 +- 20 files changed, 97 insertions(+), 49 deletions(-) diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index 661d47199df..4d45f82a158 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -39,6 +39,8 @@ use util::nodemap::{FxHashMap, FxHashSet}; use std::cmp; use std::fmt; use syntax::ast; +use hir::{intravisit, Local, Pat}; +use hir::intravisit::{Visitor, NestedVisitorMap}; use syntax_pos::{DUMMY_SP, Span}; use errors::DiagnosticBuilder; @@ -60,6 +62,30 @@ impl<'a, 'gcx, 'tcx> TraitErrorKey<'tcx> { } } +struct FindLocalByTypeVisitor<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { + infcx: &'a InferCtxt<'a, 'gcx, 'tcx>, + target_ty: &'a Ty<'tcx>, + found_pattern: Option<&'a Pat>, +} + +impl<'a, 'gcx, 'tcx> Visitor<'a> for FindLocalByTypeVisitor<'a, 'gcx, 'tcx> { + fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'a> { + NestedVisitorMap::None + } + + fn visit_local(&mut self, local: &'a Local) { + if let Some(&ty) = self.infcx.tables.borrow().node_types.get(&local.id) { + let ty = self.infcx.resolve_type_vars_if_possible(&ty); + let is_match = ty.walk().any(|t| t == *self.target_ty); + + if is_match && self.found_pattern.is_none() { + self.found_pattern = Some(&*local.pat); + } + } + intravisit::walk_local(self, local); + } +} + impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { pub fn report_fulfillment_errors(&self, errors: &Vec>) { for error in errors { @@ -775,7 +801,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { self.tcx.lang_items.sized_trait() .map_or(false, |sized_id| sized_id == trait_ref.def_id()) { - self.need_type_info(obligation.cause.span, self_ty); + self.need_type_info(obligation, self_ty); } else { let mut err = struct_span_err!(self.tcx.sess, obligation.cause.span, E0283, @@ -793,7 +819,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { // Same hacky approach as above to avoid deluging user // with error messages. if !ty.references_error() && !self.tcx.sess.has_errors() { - self.need_type_info(obligation.cause.span, ty); + self.need_type_info(obligation, ty); } } @@ -858,26 +884,42 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { } - fn need_type_info(&self, span: Span, ty: Ty<'tcx>) { + fn need_type_info(&self, + obligation: &PredicateObligation<'tcx>, + ty: Ty<'tcx>) { + let ty = self.resolve_type_vars_if_possible(&ty); - let name = if let ty::TyInfer(ty::TyVar(ty_vid)) = ty.sty { - let ty_vars = self.type_variables.borrow(); - if let TypeVariableOrigin::TypeParameterDefinition(_, name) = - *ty_vars.var_origin(ty_vid) - { - name.to_string() - } else { - ty.to_string() - } - } else { - ty.to_string() + let ref cause = obligation.cause; + + let mut err = struct_span_err!(self.tcx.sess, + cause.span, + E0282, + "unable to fully infer type(s)"); + + err.note("type annotations or generic parameter binding required"); + err.span_label(cause.span, &format!("cannot infer type")); + + let expr = self.tcx.hir.expect_expr(cause.body_id); + + let mut local_visitor = FindLocalByTypeVisitor { + infcx: &self, + target_ty: &ty, + found_pattern: None }; - let mut err = struct_span_err!(self.tcx.sess, span, E0282, - "unable to infer enough type information about `{}`", - name); - err.note("type annotations or generic parameter binding required"); - err.span_label(span, &format!("cannot infer type for `{}`", name)); + local_visitor.visit_expr(expr); + + if let Some(pattern) = local_visitor.found_pattern { + let pattern_span = pattern.span; + if let Some(n) = pattern.simple_name() { + err.span_label(pattern_span, + &format!("annotating the type for the variable `{}` would help", n)); + } else { + err.span_label(pattern_span, + &format!("annotating the type of pattern would help")); + } + } + err.emit(); } diff --git a/src/test/compile-fail/issue-12187-1.rs b/src/test/compile-fail/issue-12187-1.rs index 001e4b51beb..8f9b897eae2 100644 --- a/src/test/compile-fail/issue-12187-1.rs +++ b/src/test/compile-fail/issue-12187-1.rs @@ -14,7 +14,7 @@ fn new() -> &'static T { fn main() { let &v = new(); - //~^ ERROR unable to infer enough type information about `_` [E0282] - //~| NOTE cannot infer type for `_` + //~^ ERROR unable to fully infer type(s) [E0282] + //~| NOTE cannot infer type //~| NOTE type annotations or generic parameter binding } diff --git a/src/test/compile-fail/issue-12187-2.rs b/src/test/compile-fail/issue-12187-2.rs index 7cbee402b36..29ae04a3aac 100644 --- a/src/test/compile-fail/issue-12187-2.rs +++ b/src/test/compile-fail/issue-12187-2.rs @@ -14,7 +14,7 @@ fn new<'r, T>() -> &'r T { fn main() { let &v = new(); - //~^ ERROR unable to infer enough type information about `_` [E0282] - //~| NOTE cannot infer type for `_` + //~^ ERROR unable to fully infer type(s) [E0282] + //~| NOTE cannot infer type //~| NOTE type annotations or generic parameter binding } diff --git a/src/test/compile-fail/issue-17551.rs b/src/test/compile-fail/issue-17551.rs index 5e69553d3a4..332d3fb3e2b 100644 --- a/src/test/compile-fail/issue-17551.rs +++ b/src/test/compile-fail/issue-17551.rs @@ -13,6 +13,6 @@ use std::marker; struct B(marker::PhantomData); fn main() { - let foo = B(marker::PhantomData); //~ ERROR unable to infer enough type information + let foo = B(marker::PhantomData); //~ ERROR unable to fully infer type(s) let closure = || foo; } diff --git a/src/test/compile-fail/issue-18159.rs b/src/test/compile-fail/issue-18159.rs index e46bcf46cc3..7338d2cb418 100644 --- a/src/test/compile-fail/issue-18159.rs +++ b/src/test/compile-fail/issue-18159.rs @@ -9,5 +9,5 @@ // except according to those terms. fn main() { - let x; //~ ERROR unable to infer enough type information + let x; //~ ERROR unable to fully infer type(s) } diff --git a/src/test/compile-fail/issue-23041.rs b/src/test/compile-fail/issue-23041.rs index 1be082ba9bb..f67d8affd30 100644 --- a/src/test/compile-fail/issue-23041.rs +++ b/src/test/compile-fail/issue-23041.rs @@ -14,6 +14,6 @@ fn main() fn bar(x:i32) ->i32 { 3*x }; let b:Box = Box::new(bar as fn(_)->_); b.downcast_ref::_>(); //~ ERROR E0282 - //~| NOTE cannot infer type for `_` + //~| NOTE cannot infer type //~| NOTE type annotations or generic parameter binding required } diff --git a/src/test/compile-fail/issue-23046.rs b/src/test/compile-fail/issue-23046.rs index c274665530f..c80923298bc 100644 --- a/src/test/compile-fail/issue-23046.rs +++ b/src/test/compile-fail/issue-23046.rs @@ -25,6 +25,6 @@ pub fn let_<'var, VAR, F: for<'v: 'var> Fn(Expr<'v, VAR>) -> Expr<'v, VAR>> fn main() { let ex = |x| { - let_(add(x,x), |y| { //~ ERROR unable to infer enough type information about `VAR` + let_(add(x,x), |y| { //~ ERROR unable to fully infer type(s) let_(add(x, x), |x|x)})}; } diff --git a/src/test/compile-fail/issue-24013.rs b/src/test/compile-fail/issue-24013.rs index df857a2e6eb..edd876ed663 100644 --- a/src/test/compile-fail/issue-24013.rs +++ b/src/test/compile-fail/issue-24013.rs @@ -13,5 +13,5 @@ fn main() { let a = 1; let b = 2; unsafe {swap::<&mut _>(transmute(&a), transmute(&b))}; - //~^ ERROR unable to infer enough type information about `_` + //~^ ERROR unable to fully infer type(s) } diff --git a/src/test/compile-fail/issue-5062.rs b/src/test/compile-fail/issue-5062.rs index cf78d6d8c0a..e61ca92c78a 100644 --- a/src/test/compile-fail/issue-5062.rs +++ b/src/test/compile-fail/issue-5062.rs @@ -9,4 +9,4 @@ // except according to those terms. fn main() { format!("{:?}", None); } - //~^ ERROR unable to infer enough type information about `T` [E0282] + //~^ ERROR unable to fully infer type(s) [E0282] diff --git a/src/test/compile-fail/issue-6458-2.rs b/src/test/compile-fail/issue-6458-2.rs index 3816896d43d..77eb8b3e7a9 100644 --- a/src/test/compile-fail/issue-6458-2.rs +++ b/src/test/compile-fail/issue-6458-2.rs @@ -11,5 +11,5 @@ fn main() { // Unconstrained type: format!("{:?}", None); - //~^ ERROR unable to infer enough type information about `T` [E0282] + //~^ ERROR unable to fully infer type(s) [E0282] } diff --git a/src/test/compile-fail/issue-6458-3.rs b/src/test/compile-fail/issue-6458-3.rs index 8029522f5d3..a8ad8951c64 100644 --- a/src/test/compile-fail/issue-6458-3.rs +++ b/src/test/compile-fail/issue-6458-3.rs @@ -12,7 +12,7 @@ use std::mem; fn main() { mem::transmute(0); - //~^ ERROR unable to infer enough type information about `U` [E0282] - //~| NOTE cannot infer type for `U` + //~^ ERROR unable to fully infer type(s) [E0282] + //~| NOTE cannot infer type //~| NOTE type annotations or generic parameter binding } diff --git a/src/test/compile-fail/issue-6458.rs b/src/test/compile-fail/issue-6458.rs index f8354ddbf12..7d1b5cfffe4 100644 --- a/src/test/compile-fail/issue-6458.rs +++ b/src/test/compile-fail/issue-6458.rs @@ -17,8 +17,8 @@ pub fn foo(_: TypeWithState) {} pub fn bar() { foo(TypeWithState(marker::PhantomData)); - //~^ ERROR unable to infer enough type information about `State` [E0282] - //~| NOTE cannot infer type for `State` + //~^ ERROR unable to fully infer type(s) [E0282] + //~| NOTE cannot infer type //~| NOTE type annotations or generic parameter binding } diff --git a/src/test/compile-fail/issue-7813.rs b/src/test/compile-fail/issue-7813.rs index e37a8816423..c7510f215be 100644 --- a/src/test/compile-fail/issue-7813.rs +++ b/src/test/compile-fail/issue-7813.rs @@ -10,7 +10,8 @@ fn main() { let v = &[]; - let it = v.iter(); //~ ERROR unable to infer enough type information about `T` [E0282] - //~| NOTE cannot infer type for `T` + let it = v.iter(); //~ ERROR unable to fully infer type(s) [E0282] + //~| NOTE cannot infer type + //~| NOTE annotating the type for the variable `it` would help //~| NOTE type annotations or generic parameter binding } diff --git a/src/test/compile-fail/method-ambig-one-trait-unknown-int-type.rs b/src/test/compile-fail/method-ambig-one-trait-unknown-int-type.rs index 1cf41f95a2d..eeecefd91ae 100644 --- a/src/test/compile-fail/method-ambig-one-trait-unknown-int-type.rs +++ b/src/test/compile-fail/method-ambig-one-trait-unknown-int-type.rs @@ -32,7 +32,7 @@ impl foo for Vec { fn m1() { // we couldn't infer the type of the vector just based on calling foo()... let mut x = Vec::new(); - //~^ ERROR unable to infer enough type information about `T` [E0282] + //~^ ERROR unable to fully infer type(s) [E0282] x.foo(); } diff --git a/src/test/compile-fail/traits-multidispatch-convert-ambig-dest.rs b/src/test/compile-fail/traits-multidispatch-convert-ambig-dest.rs index ed2ffa995e5..6ccd8f66a49 100644 --- a/src/test/compile-fail/traits-multidispatch-convert-ambig-dest.rs +++ b/src/test/compile-fail/traits-multidispatch-convert-ambig-dest.rs @@ -34,8 +34,8 @@ where T : Convert fn a() { test(22, std::default::Default::default()); - //~^ ERROR unable to infer enough type information about `U` [E0282] - //~| NOTE cannot infer type for `U` + //~^ ERROR unable to fully infer type(s) [E0282] + //~| NOTE cannot infer type //~| NOTE type annotations or generic parameter binding } diff --git a/src/test/compile-fail/unconstrained-none.rs b/src/test/compile-fail/unconstrained-none.rs index 88080bc70ca..49818791d2f 100644 --- a/src/test/compile-fail/unconstrained-none.rs +++ b/src/test/compile-fail/unconstrained-none.rs @@ -11,7 +11,7 @@ // Issue #5062 fn main() { - None; //~ ERROR unable to infer enough type information about `T` [E0282] - //~| NOTE cannot infer type for `T` + None; //~ ERROR unable to fully infer type(s) [E0282] + //~| NOTE cannot infer type //~| NOTE type annotations or generic parameter binding } diff --git a/src/test/compile-fail/unconstrained-ref.rs b/src/test/compile-fail/unconstrained-ref.rs index 12278549215..53995af5b86 100644 --- a/src/test/compile-fail/unconstrained-ref.rs +++ b/src/test/compile-fail/unconstrained-ref.rs @@ -13,7 +13,7 @@ struct S<'a, T:'a> { } fn main() { - S { o: &None }; //~ ERROR unable to infer enough type information about `T` [E0282] - //~| NOTE cannot infer type for `T` + S { o: &None }; //~ ERROR unable to fully infer type(s) [E0282] + //~| NOTE cannot infer type //~| NOTE type annotations or generic parameter binding } diff --git a/src/test/compile-fail/vector-no-ann.rs b/src/test/compile-fail/vector-no-ann.rs index d559caf77a1..d470f937190 100644 --- a/src/test/compile-fail/vector-no-ann.rs +++ b/src/test/compile-fail/vector-no-ann.rs @@ -11,7 +11,8 @@ fn main() { let _foo = Vec::new(); - //~^ ERROR unable to infer enough type information about `T` [E0282] - //~| NOTE cannot infer type for `T` + //~^ ERROR unable to fully infer type(s) [E0282] + //~| NOTE cannot infer type + //~| NOTE annotating the type for the variable `_foo` would help //~| NOTE type annotations or generic parameter binding } diff --git a/src/test/ui/codemap_tests/repair_span_std_macros.stderr b/src/test/ui/codemap_tests/repair_span_std_macros.stderr index 7e0d778a3b2..f0be8d07f49 100644 --- a/src/test/ui/codemap_tests/repair_span_std_macros.stderr +++ b/src/test/ui/codemap_tests/repair_span_std_macros.stderr @@ -1,11 +1,14 @@ -error[E0282]: unable to infer enough type information about `T` +error[E0282]: unable to fully infer type(s) --> $DIR/repair_span_std_macros.rs:12:13 | 12 | let x = vec![]; - | ^^^^^^ cannot infer type for `T` + | - ^^^^^^ cannot infer type + | | + | annotating the type for the variable `x` would help | = note: type annotations or generic parameter binding required = note: this error originates in a macro outside of the current crate error: aborting due to previous error + diff --git a/src/test/ui/missing-items/missing-type-parameter.stderr b/src/test/ui/missing-items/missing-type-parameter.stderr index 2d007af4980..df5571787d7 100644 --- a/src/test/ui/missing-items/missing-type-parameter.stderr +++ b/src/test/ui/missing-items/missing-type-parameter.stderr @@ -1,10 +1,11 @@ -error[E0282]: unable to infer enough type information about `X` +error[E0282]: unable to fully infer type(s) --> $DIR/missing-type-parameter.rs:14:5 | 14 | foo(); - | ^^^ cannot infer type for `X` + | ^^^ cannot infer type | = note: type annotations or generic parameter binding required error: aborting due to previous error + From 89ae2caf56577d272be0169aaec68e75dd5bc6af Mon Sep 17 00:00:00 2001 From: Cengiz Can Date: Tue, 24 Jan 2017 20:18:57 +0000 Subject: [PATCH 22/70] Remove extra newlines from expectation files --- src/test/ui/codemap_tests/repair_span_std_macros.stderr | 1 - src/test/ui/missing-items/missing-type-parameter.stderr | 1 - 2 files changed, 2 deletions(-) diff --git a/src/test/ui/codemap_tests/repair_span_std_macros.stderr b/src/test/ui/codemap_tests/repair_span_std_macros.stderr index f0be8d07f49..13e4b246c55 100644 --- a/src/test/ui/codemap_tests/repair_span_std_macros.stderr +++ b/src/test/ui/codemap_tests/repair_span_std_macros.stderr @@ -11,4 +11,3 @@ error[E0282]: unable to fully infer type(s) error: aborting due to previous error - diff --git a/src/test/ui/missing-items/missing-type-parameter.stderr b/src/test/ui/missing-items/missing-type-parameter.stderr index df5571787d7..03e9f61610d 100644 --- a/src/test/ui/missing-items/missing-type-parameter.stderr +++ b/src/test/ui/missing-items/missing-type-parameter.stderr @@ -8,4 +8,3 @@ error[E0282]: unable to fully infer type(s) error: aborting due to previous error - From 7aff6add92c5f8deea29af2a5aa7335d4e5843a9 Mon Sep 17 00:00:00 2001 From: Cengiz Can Date: Wed, 25 Jan 2017 06:26:39 +0000 Subject: [PATCH 23/70] Remove extra note and revert name in message --- src/librustc/traits/error_reporting.rs | 34 +++++++++++++++++--------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index 4d45f82a158..024c14ce9d9 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -883,40 +883,50 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { }) } + fn extract_type_name(&self, ty: &'a Ty<'tcx>) -> String { + if let ty::TyInfer(ty::TyVar(ty_vid)) = (*ty).sty { + let ty_vars = self.type_variables.borrow(); + if let TypeVariableOrigin::TypeParameterDefinition(_, name) = + *ty_vars.var_origin(ty_vid) { + name.to_string() + } else { + ty.to_string() + } + } else { + ty.to_string() + } + } - fn need_type_info(&self, - obligation: &PredicateObligation<'tcx>, - ty: Ty<'tcx>) { - + fn need_type_info(&self, obligation: &PredicateObligation<'tcx>, ty: Ty<'tcx>) { let ty = self.resolve_type_vars_if_possible(&ty); + let name = self.extract_type_name(&ty); let ref cause = obligation.cause; let mut err = struct_span_err!(self.tcx.sess, cause.span, E0282, - "unable to fully infer type(s)"); + "type annotations needed"); - err.note("type annotations or generic parameter binding required"); - err.span_label(cause.span, &format!("cannot infer type")); + err.span_label(cause.span, &format!("cannot infer type for `{}`", name)); let expr = self.tcx.hir.expect_expr(cause.body_id); let mut local_visitor = FindLocalByTypeVisitor { infcx: &self, target_ty: &ty, - found_pattern: None + found_pattern: None, }; local_visitor.visit_expr(expr); if let Some(pattern) = local_visitor.found_pattern { let pattern_span = pattern.span; - if let Some(n) = pattern.simple_name() { + if let Some(simple_name) = pattern.simple_name() { err.span_label(pattern_span, - &format!("annotating the type for the variable `{}` would help", n)); + &format!("consider giving `{}` a type", + simple_name)); } else { - err.span_label(pattern_span, - &format!("annotating the type of pattern would help")); + err.span_label(pattern_span, &format!("consider giving a type to pattern")); } } From 3fa28cb206604fddf67a29e7cbd3a8b22da1edc2 Mon Sep 17 00:00:00 2001 From: Cengiz Can Date: Thu, 2 Feb 2017 21:35:31 +0000 Subject: [PATCH 24/70] Add a new ui test and update existing ones --- src/test/compile-fail/issue-12187-1.rs | 5 ++--- src/test/compile-fail/issue-12187-2.rs | 5 ++--- src/test/compile-fail/issue-16966.rs | 2 +- src/test/compile-fail/issue-17551.rs | 2 +- src/test/compile-fail/issue-18159.rs | 2 +- src/test/compile-fail/issue-23041.rs | 3 +-- src/test/compile-fail/issue-23046.rs | 2 +- src/test/compile-fail/issue-24013.rs | 2 +- src/test/compile-fail/issue-5062.rs | 2 +- src/test/compile-fail/issue-6458-2.rs | 2 +- src/test/compile-fail/issue-6458-3.rs | 5 ++--- src/test/compile-fail/issue-6458.rs | 5 ++--- src/test/compile-fail/issue-7813.rs | 7 +++---- .../method-ambig-one-trait-unknown-int-type.rs | 2 +- .../traits-multidispatch-convert-ambig-dest.rs | 5 ++--- src/test/compile-fail/unconstrained-none.rs | 5 ++--- src/test/compile-fail/unconstrained-ref.rs | 5 ++--- src/test/compile-fail/vector-no-ann.rs | 7 +++---- src/test/ui/codemap_tests/issue-38812-2.rs | 13 +++++++++++++ src/test/ui/codemap_tests/issue-38812-2.stderr | 12 ++++++++++++ .../{repair_span_std_macros.rs => issue-38812.rs} | 2 +- src/test/ui/codemap_tests/issue-38812.stderr | 12 ++++++++++++ .../ui/codemap_tests/repair_span_std_macros.stderr | 13 ------------- src/test/ui/missing-items/missing-type-parameter.rs | 2 +- .../ui/missing-items/missing-type-parameter.stderr | 6 ++---- 25 files changed, 70 insertions(+), 58 deletions(-) create mode 100644 src/test/ui/codemap_tests/issue-38812-2.rs create mode 100644 src/test/ui/codemap_tests/issue-38812-2.stderr rename src/test/ui/codemap_tests/{repair_span_std_macros.rs => issue-38812.rs} (87%) create mode 100644 src/test/ui/codemap_tests/issue-38812.stderr delete mode 100644 src/test/ui/codemap_tests/repair_span_std_macros.stderr diff --git a/src/test/compile-fail/issue-12187-1.rs b/src/test/compile-fail/issue-12187-1.rs index 8f9b897eae2..346fae11070 100644 --- a/src/test/compile-fail/issue-12187-1.rs +++ b/src/test/compile-fail/issue-12187-1.rs @@ -14,7 +14,6 @@ fn new() -> &'static T { fn main() { let &v = new(); - //~^ ERROR unable to fully infer type(s) [E0282] - //~| NOTE cannot infer type - //~| NOTE type annotations or generic parameter binding + //~^ ERROR type annotations needed [E0282] + //~| NOTE cannot infer type for `_` } diff --git a/src/test/compile-fail/issue-12187-2.rs b/src/test/compile-fail/issue-12187-2.rs index 29ae04a3aac..848174d6fe1 100644 --- a/src/test/compile-fail/issue-12187-2.rs +++ b/src/test/compile-fail/issue-12187-2.rs @@ -14,7 +14,6 @@ fn new<'r, T>() -> &'r T { fn main() { let &v = new(); - //~^ ERROR unable to fully infer type(s) [E0282] - //~| NOTE cannot infer type - //~| NOTE type annotations or generic parameter binding + //~^ ERROR type annotations needed [E0282] + //~| NOTE cannot infer type for `_` } diff --git a/src/test/compile-fail/issue-16966.rs b/src/test/compile-fail/issue-16966.rs index 508442fcb94..ecf81c8af17 100644 --- a/src/test/compile-fail/issue-16966.rs +++ b/src/test/compile-fail/issue-16966.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern:type annotations or generic parameter binding required +// error-pattern:type annotations needed fn main() { panic!( std::default::Default::default() diff --git a/src/test/compile-fail/issue-17551.rs b/src/test/compile-fail/issue-17551.rs index 332d3fb3e2b..b55863f0dda 100644 --- a/src/test/compile-fail/issue-17551.rs +++ b/src/test/compile-fail/issue-17551.rs @@ -13,6 +13,6 @@ use std::marker; struct B(marker::PhantomData); fn main() { - let foo = B(marker::PhantomData); //~ ERROR unable to fully infer type(s) + let foo = B(marker::PhantomData); //~ ERROR type annotations needed let closure = || foo; } diff --git a/src/test/compile-fail/issue-18159.rs b/src/test/compile-fail/issue-18159.rs index 7338d2cb418..8991eded3d6 100644 --- a/src/test/compile-fail/issue-18159.rs +++ b/src/test/compile-fail/issue-18159.rs @@ -9,5 +9,5 @@ // except according to those terms. fn main() { - let x; //~ ERROR unable to fully infer type(s) + let x; //~ ERROR type annotations needed } diff --git a/src/test/compile-fail/issue-23041.rs b/src/test/compile-fail/issue-23041.rs index f67d8affd30..4dfad4ee3c3 100644 --- a/src/test/compile-fail/issue-23041.rs +++ b/src/test/compile-fail/issue-23041.rs @@ -14,6 +14,5 @@ fn main() fn bar(x:i32) ->i32 { 3*x }; let b:Box = Box::new(bar as fn(_)->_); b.downcast_ref::_>(); //~ ERROR E0282 - //~| NOTE cannot infer type - //~| NOTE type annotations or generic parameter binding required + //~| NOTE cannot infer type for `_` } diff --git a/src/test/compile-fail/issue-23046.rs b/src/test/compile-fail/issue-23046.rs index c80923298bc..28109747b75 100644 --- a/src/test/compile-fail/issue-23046.rs +++ b/src/test/compile-fail/issue-23046.rs @@ -25,6 +25,6 @@ pub fn let_<'var, VAR, F: for<'v: 'var> Fn(Expr<'v, VAR>) -> Expr<'v, VAR>> fn main() { let ex = |x| { - let_(add(x,x), |y| { //~ ERROR unable to fully infer type(s) + let_(add(x,x), |y| { //~ ERROR type annotations needed let_(add(x, x), |x|x)})}; } diff --git a/src/test/compile-fail/issue-24013.rs b/src/test/compile-fail/issue-24013.rs index edd876ed663..a7232781f6f 100644 --- a/src/test/compile-fail/issue-24013.rs +++ b/src/test/compile-fail/issue-24013.rs @@ -13,5 +13,5 @@ fn main() { let a = 1; let b = 2; unsafe {swap::<&mut _>(transmute(&a), transmute(&b))}; - //~^ ERROR unable to fully infer type(s) + //~^ ERROR type annotations needed } diff --git a/src/test/compile-fail/issue-5062.rs b/src/test/compile-fail/issue-5062.rs index e61ca92c78a..ebfa4975d4d 100644 --- a/src/test/compile-fail/issue-5062.rs +++ b/src/test/compile-fail/issue-5062.rs @@ -9,4 +9,4 @@ // except according to those terms. fn main() { format!("{:?}", None); } - //~^ ERROR unable to fully infer type(s) [E0282] + //~^ ERROR type annotations needed [E0282] diff --git a/src/test/compile-fail/issue-6458-2.rs b/src/test/compile-fail/issue-6458-2.rs index 77eb8b3e7a9..87cf2b3f740 100644 --- a/src/test/compile-fail/issue-6458-2.rs +++ b/src/test/compile-fail/issue-6458-2.rs @@ -11,5 +11,5 @@ fn main() { // Unconstrained type: format!("{:?}", None); - //~^ ERROR unable to fully infer type(s) [E0282] + //~^ ERROR type annotations needed [E0282] } diff --git a/src/test/compile-fail/issue-6458-3.rs b/src/test/compile-fail/issue-6458-3.rs index a8ad8951c64..1503da2baa7 100644 --- a/src/test/compile-fail/issue-6458-3.rs +++ b/src/test/compile-fail/issue-6458-3.rs @@ -12,7 +12,6 @@ use std::mem; fn main() { mem::transmute(0); - //~^ ERROR unable to fully infer type(s) [E0282] - //~| NOTE cannot infer type - //~| NOTE type annotations or generic parameter binding + //~^ ERROR type annotations needed [E0282] + //~| NOTE cannot infer type for `U` } diff --git a/src/test/compile-fail/issue-6458.rs b/src/test/compile-fail/issue-6458.rs index 7d1b5cfffe4..db4d4e76c11 100644 --- a/src/test/compile-fail/issue-6458.rs +++ b/src/test/compile-fail/issue-6458.rs @@ -17,9 +17,8 @@ pub fn foo(_: TypeWithState) {} pub fn bar() { foo(TypeWithState(marker::PhantomData)); - //~^ ERROR unable to fully infer type(s) [E0282] - //~| NOTE cannot infer type - //~| NOTE type annotations or generic parameter binding + //~^ ERROR type annotations needed [E0282] + //~| NOTE cannot infer type for `State` } fn main() { diff --git a/src/test/compile-fail/issue-7813.rs b/src/test/compile-fail/issue-7813.rs index c7510f215be..fdd89058fd3 100644 --- a/src/test/compile-fail/issue-7813.rs +++ b/src/test/compile-fail/issue-7813.rs @@ -10,8 +10,7 @@ fn main() { let v = &[]; - let it = v.iter(); //~ ERROR unable to fully infer type(s) [E0282] - //~| NOTE cannot infer type - //~| NOTE annotating the type for the variable `it` would help - //~| NOTE type annotations or generic parameter binding + let it = v.iter(); //~ ERROR type annotations needed [E0282] + //~| NOTE cannot infer type for `T` + //~| NOTE consider giving `it` a type } diff --git a/src/test/compile-fail/method-ambig-one-trait-unknown-int-type.rs b/src/test/compile-fail/method-ambig-one-trait-unknown-int-type.rs index eeecefd91ae..9acf5a52166 100644 --- a/src/test/compile-fail/method-ambig-one-trait-unknown-int-type.rs +++ b/src/test/compile-fail/method-ambig-one-trait-unknown-int-type.rs @@ -32,7 +32,7 @@ impl foo for Vec { fn m1() { // we couldn't infer the type of the vector just based on calling foo()... let mut x = Vec::new(); - //~^ ERROR unable to fully infer type(s) [E0282] + //~^ ERROR type annotations needed [E0282] x.foo(); } diff --git a/src/test/compile-fail/traits-multidispatch-convert-ambig-dest.rs b/src/test/compile-fail/traits-multidispatch-convert-ambig-dest.rs index 6ccd8f66a49..2e115431c92 100644 --- a/src/test/compile-fail/traits-multidispatch-convert-ambig-dest.rs +++ b/src/test/compile-fail/traits-multidispatch-convert-ambig-dest.rs @@ -34,9 +34,8 @@ where T : Convert fn a() { test(22, std::default::Default::default()); - //~^ ERROR unable to fully infer type(s) [E0282] - //~| NOTE cannot infer type - //~| NOTE type annotations or generic parameter binding + //~^ ERROR type annotations needed [E0282] + //~| NOTE cannot infer type for `U` } fn main() {} diff --git a/src/test/compile-fail/unconstrained-none.rs b/src/test/compile-fail/unconstrained-none.rs index 49818791d2f..52ca91e62f8 100644 --- a/src/test/compile-fail/unconstrained-none.rs +++ b/src/test/compile-fail/unconstrained-none.rs @@ -11,7 +11,6 @@ // Issue #5062 fn main() { - None; //~ ERROR unable to fully infer type(s) [E0282] - //~| NOTE cannot infer type - //~| NOTE type annotations or generic parameter binding + None; //~ ERROR type annotations needed [E0282] + //~| NOTE cannot infer type for `T` } diff --git a/src/test/compile-fail/unconstrained-ref.rs b/src/test/compile-fail/unconstrained-ref.rs index 53995af5b86..6aaed789716 100644 --- a/src/test/compile-fail/unconstrained-ref.rs +++ b/src/test/compile-fail/unconstrained-ref.rs @@ -13,7 +13,6 @@ struct S<'a, T:'a> { } fn main() { - S { o: &None }; //~ ERROR unable to fully infer type(s) [E0282] - //~| NOTE cannot infer type - //~| NOTE type annotations or generic parameter binding + S { o: &None }; //~ ERROR type annotations needed [E0282] + //~| NOTE cannot infer type for `T` } diff --git a/src/test/compile-fail/vector-no-ann.rs b/src/test/compile-fail/vector-no-ann.rs index d470f937190..de229ded463 100644 --- a/src/test/compile-fail/vector-no-ann.rs +++ b/src/test/compile-fail/vector-no-ann.rs @@ -11,8 +11,7 @@ fn main() { let _foo = Vec::new(); - //~^ ERROR unable to fully infer type(s) [E0282] - //~| NOTE cannot infer type - //~| NOTE annotating the type for the variable `_foo` would help - //~| NOTE type annotations or generic parameter binding + //~^ ERROR type annotations needed [E0282] + //~| NOTE cannot infer type for `T` + //~| NOTE consider giving `_foo` a type } diff --git a/src/test/ui/codemap_tests/issue-38812-2.rs b/src/test/ui/codemap_tests/issue-38812-2.rs new file mode 100644 index 00000000000..c476657d207 --- /dev/null +++ b/src/test/ui/codemap_tests/issue-38812-2.rs @@ -0,0 +1,13 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + let (x,) = (vec![],); +} diff --git a/src/test/ui/codemap_tests/issue-38812-2.stderr b/src/test/ui/codemap_tests/issue-38812-2.stderr new file mode 100644 index 00000000000..156a6bdee99 --- /dev/null +++ b/src/test/ui/codemap_tests/issue-38812-2.stderr @@ -0,0 +1,12 @@ +error[E0282]: type annotations needed + --> $DIR/issue-38812-2.rs:12:17 + | +12 | let (x,) = (vec![],); + | ---- ^^^^^^ cannot infer type for `T` + | | + | consider giving a type to pattern + | + = note: this error originates in a macro outside of the current crate + +error: aborting due to previous error + diff --git a/src/test/ui/codemap_tests/repair_span_std_macros.rs b/src/test/ui/codemap_tests/issue-38812.rs similarity index 87% rename from src/test/ui/codemap_tests/repair_span_std_macros.rs rename to src/test/ui/codemap_tests/issue-38812.rs index 3abc91d4f5f..a9943f75336 100644 --- a/src/test/ui/codemap_tests/repair_span_std_macros.rs +++ b/src/test/ui/codemap_tests/issue-38812.rs @@ -1,4 +1,4 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // diff --git a/src/test/ui/codemap_tests/issue-38812.stderr b/src/test/ui/codemap_tests/issue-38812.stderr new file mode 100644 index 00000000000..6365e761453 --- /dev/null +++ b/src/test/ui/codemap_tests/issue-38812.stderr @@ -0,0 +1,12 @@ +error[E0282]: type annotations needed + --> $DIR/issue-38812.rs:12:13 + | +12 | let x = vec![]; + | - ^^^^^^ cannot infer type for `T` + | | + | consider giving `x` a type + | + = note: this error originates in a macro outside of the current crate + +error: aborting due to previous error + diff --git a/src/test/ui/codemap_tests/repair_span_std_macros.stderr b/src/test/ui/codemap_tests/repair_span_std_macros.stderr deleted file mode 100644 index 13e4b246c55..00000000000 --- a/src/test/ui/codemap_tests/repair_span_std_macros.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0282]: unable to fully infer type(s) - --> $DIR/repair_span_std_macros.rs:12:13 - | -12 | let x = vec![]; - | - ^^^^^^ cannot infer type - | | - | annotating the type for the variable `x` would help - | - = note: type annotations or generic parameter binding required - = note: this error originates in a macro outside of the current crate - -error: aborting due to previous error - diff --git a/src/test/ui/missing-items/missing-type-parameter.rs b/src/test/ui/missing-items/missing-type-parameter.rs index 3671abd6624..79368587062 100644 --- a/src/test/ui/missing-items/missing-type-parameter.rs +++ b/src/test/ui/missing-items/missing-type-parameter.rs @@ -1,4 +1,4 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // diff --git a/src/test/ui/missing-items/missing-type-parameter.stderr b/src/test/ui/missing-items/missing-type-parameter.stderr index 03e9f61610d..a16ae5538bf 100644 --- a/src/test/ui/missing-items/missing-type-parameter.stderr +++ b/src/test/ui/missing-items/missing-type-parameter.stderr @@ -1,10 +1,8 @@ -error[E0282]: unable to fully infer type(s) +error[E0282]: type annotations needed --> $DIR/missing-type-parameter.rs:14:5 | 14 | foo(); - | ^^^ cannot infer type - | - = note: type annotations or generic parameter binding required + | ^^^ cannot infer type for `X` error: aborting due to previous error From c7bea760917dcbff5025ac7b5dc62f54308c5530 Mon Sep 17 00:00:00 2001 From: Dylan McKay Date: Sun, 5 Feb 2017 20:19:27 +1300 Subject: [PATCH 25/70] Use u32 for alignments instead of u64 --- src/librustc_trans/debuginfo/metadata.rs | 18 +++++++++--------- src/librustc_trans/debuginfo/mod.rs | 2 +- src/librustc_trans/debuginfo/utils.rs | 11 +++++++---- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/librustc_trans/debuginfo/metadata.rs b/src/librustc_trans/debuginfo/metadata.rs index 69a2e67366c..29d04785d6f 100644 --- a/src/librustc_trans/debuginfo/metadata.rs +++ b/src/librustc_trans/debuginfo/metadata.rs @@ -299,7 +299,7 @@ fn fixed_vec_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, llvm::LLVMRustDIBuilderCreateArrayType( DIB(cx), bytes_to_bits(array_size_in_bytes), - bytes_to_bits(element_type_align) as u32, + bytes_to_bits(element_type_align), element_type_metadata, subscripts) }; @@ -730,7 +730,7 @@ fn basic_type_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, DIB(cx), name.as_ptr(), bytes_to_bits(size), - bytes_to_bits(align) as u32, + bytes_to_bits(align), encoding) }; @@ -750,7 +750,7 @@ fn pointer_type_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, DIB(cx), pointee_type_metadata, bytes_to_bits(pointer_size), - bytes_to_bits(pointer_align) as u32, + bytes_to_bits(pointer_align), name.as_ptr()) }; return ptr_metadata; @@ -1504,7 +1504,7 @@ fn prepare_enum_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, file_metadata, UNKNOWN_LINE_NUMBER, bytes_to_bits(discriminant_size), - bytes_to_bits(discriminant_align) as u32, + bytes_to_bits(discriminant_align), create_DIArray(DIB(cx), &enumerators_metadata), discriminant_base_type_metadata) }; @@ -1546,7 +1546,7 @@ fn prepare_enum_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, file_metadata, UNKNOWN_LINE_NUMBER, bytes_to_bits(enum_type_size), - bytes_to_bits(enum_type_align) as u32, + bytes_to_bits(enum_type_align), DIFlags::FlagZero, ptr::null_mut(), 0, // RuntimeLang @@ -1648,7 +1648,7 @@ fn set_members_of_composite_type(cx: &CrateContext, unknown_file_metadata(cx), UNKNOWN_LINE_NUMBER, bytes_to_bits(member_size), - bytes_to_bits(member_align) as u32, + bytes_to_bits(member_align), bytes_to_bits(member_offset), member_description.flags, member_description.type_metadata) @@ -1691,7 +1691,7 @@ fn create_struct_stub(cx: &CrateContext, unknown_file_metadata(cx), UNKNOWN_LINE_NUMBER, bytes_to_bits(struct_size), - bytes_to_bits(struct_align) as u32, + bytes_to_bits(struct_align), DIFlags::FlagZero, ptr::null_mut(), empty_array, @@ -1728,7 +1728,7 @@ fn create_union_stub(cx: &CrateContext, unknown_file_metadata(cx), UNKNOWN_LINE_NUMBER, bytes_to_bits(union_size), - bytes_to_bits(union_align) as u32, + bytes_to_bits(union_align), DIFlags::FlagZero, empty_array, 0, // RuntimeLang @@ -1783,7 +1783,7 @@ pub fn create_global_var_metadata(cx: &CrateContext, is_local_to_unit, global, ptr::null_mut(), - global_align as u32, + global_align, ); } } diff --git a/src/librustc_trans/debuginfo/mod.rs b/src/librustc_trans/debuginfo/mod.rs index 6765cf03776..6a8fc904366 100644 --- a/src/librustc_trans/debuginfo/mod.rs +++ b/src/librustc_trans/debuginfo/mod.rs @@ -464,7 +464,7 @@ pub fn declare_local<'a, 'tcx>(bcx: &Builder<'a, 'tcx>, cx.sess().opts.optimize != config::OptLevel::No, DIFlags::FlagZero, argument_index, - align as u32, + align, ) }; source_loc::set_debug_location(bcx, diff --git a/src/librustc_trans/debuginfo/utils.rs b/src/librustc_trans/debuginfo/utils.rs index 8d634c0e292..15a1c990aad 100644 --- a/src/librustc_trans/debuginfo/utils.rs +++ b/src/librustc_trans/debuginfo/utils.rs @@ -24,6 +24,8 @@ use type_::Type; use syntax_pos::{self, Span}; use syntax::ast; +use std::ops; + pub fn is_node_local_to_unit(cx: &CrateContext, node_id: ast::NodeId) -> bool { // The is_local_to_unit flag indicates whether a function is local to the @@ -49,12 +51,13 @@ pub fn span_start(cx: &CrateContext, span: Span) -> syntax_pos::Loc { cx.sess().codemap().lookup_char_pos(span.lo) } -pub fn size_and_align_of(cx: &CrateContext, llvm_type: Type) -> (u64, u64) { - (machine::llsize_of_alloc(cx, llvm_type), machine::llalign_of_min(cx, llvm_type) as u64) +pub fn size_and_align_of(cx: &CrateContext, llvm_type: Type) -> (u64, u32) { + (machine::llsize_of_alloc(cx, llvm_type), machine::llalign_of_min(cx, llvm_type)) } -pub fn bytes_to_bits(bytes: u64) -> u64 { - bytes * 8 +pub fn bytes_to_bits(bytes: T) -> T + where T: ops::Mul + From { + bytes * 8u8.into() } #[inline] From 0cc2448e053047546aff4ea0749adb06896092b5 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 21 Jan 2017 00:33:38 +0100 Subject: [PATCH 26/70] Replace PlaceBack Debug implementation with derive --- src/libcollections/binary_heap.rs | 26 +++++++++------------- src/libcollections/btree/map.rs | 28 +++++++----------------- src/libcollections/btree/set.rs | 36 +++++++++++-------------------- src/libcollections/enum_set.rs | 3 +-- src/libcollections/linked_list.rs | 24 ++++++++++++--------- src/libcollections/str.rs | 2 +- src/libcollections/string.rs | 4 ++-- src/libcollections/vec.rs | 14 +++--------- src/libcollections/vec_deque.rs | 16 +++++++------- 9 files changed, 59 insertions(+), 94 deletions(-) diff --git a/src/libcollections/binary_heap.rs b/src/libcollections/binary_heap.rs index b9d90c358fe..fa1c2b7d2aa 100644 --- a/src/libcollections/binary_heap.rs +++ b/src/libcollections/binary_heap.rs @@ -228,7 +228,7 @@ pub struct PeekMut<'a, T: 'a + Ord> { sift: bool, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl<'a, T: Ord + fmt::Debug> fmt::Debug for PeekMut<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_tuple("PeekMut") @@ -977,10 +977,10 @@ pub struct Iter<'a, T: 'a> { iter: slice::Iter<'a, T>, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("BinaryHeap::Iter") + f.debug_tuple("Iter") .field(&self.iter.as_slice()) .finish() } @@ -1034,10 +1034,10 @@ pub struct IntoIter { iter: vec::IntoIter, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl fmt::Debug for IntoIter { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("BinaryHeap::IntoIter") + f.debug_tuple("IntoIter") .field(&self.iter.as_slice()) .finish() } @@ -1078,19 +1078,11 @@ impl FusedIterator for IntoIter {} /// An iterator that drains a `BinaryHeap`. #[stable(feature = "drain", since = "1.6.0")] +#[derive(Debug)] pub struct Drain<'a, T: 'a> { iter: vec::Drain<'a, T>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: 'a + fmt::Debug> fmt::Debug for Drain<'a, T> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("BinaryHeap::Drain") - .field(&self.iter) - .finish() - } -} - #[stable(feature = "drain", since = "1.6.0")] impl<'a, T: 'a> Iterator for Drain<'a, T> { type Item = T; @@ -1236,11 +1228,13 @@ where T: Clone + Ord { place: vec::PlaceBack<'a, T>, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[unstable(feature = "collection_placement", + reason = "placement protocol is subject to change", + issue = "30172")] impl<'a, T: Clone + Ord + fmt::Debug> fmt::Debug for BinaryHeapPlace<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_tuple("BinaryHeapPlace") - .field(&self) + .field(&self.place) .finish() } } diff --git a/src/libcollections/btree/map.rs b/src/libcollections/btree/map.rs index eb6a8ea26a3..e1fabe2cc49 100644 --- a/src/libcollections/btree/map.rs +++ b/src/libcollections/btree/map.rs @@ -270,7 +270,7 @@ pub struct Iter<'a, K: 'a, V: 'a> { length: usize, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Iter<'a, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_list().entries(self.clone()).finish() @@ -279,18 +279,12 @@ impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Iter<'a, K, V> { /// A mutable iterator over a BTreeMap's entries. #[stable(feature = "rust1", since = "1.0.0")] +#[derive(Debug)] pub struct IterMut<'a, K: 'a, V: 'a> { range: RangeMut<'a, K, V>, length: usize, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for IterMut<'a, K, V> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad(&format!("BTreeMap::IterMut({:?})", self.range)) - } -} - /// An owning iterator over a BTreeMap's entries. #[stable(feature = "rust1", since = "1.0.0")] pub struct IntoIter { @@ -299,7 +293,7 @@ pub struct IntoIter { length: usize, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl fmt::Debug for IntoIter { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let range = Range { @@ -316,7 +310,7 @@ pub struct Keys<'a, K: 'a, V: 'a> { inner: Iter<'a, K, V>, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Keys<'a, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_list().entries(self.inner.clone()).finish() @@ -329,7 +323,7 @@ pub struct Values<'a, K: 'a, V: 'a> { inner: Iter<'a, K, V>, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Values<'a, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_list().entries(self.inner.clone()).finish() @@ -338,24 +332,18 @@ impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Values<'a, K, V> /// A mutable iterator over a BTreeMap's values. #[stable(feature = "map_values_mut", since = "1.10.0")] +#[derive(Debug)] pub struct ValuesMut<'a, K: 'a, V: 'a> { inner: IterMut<'a, K, V>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for ValuesMut<'a, K, V> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad(&format!("BTreeMap::ValuesMut({:?})", self.inner)) - } -} - /// An iterator over a sub-range of BTreeMap's entries. pub struct Range<'a, K: 'a, V: 'a> { front: Handle, K, V, marker::Leaf>, marker::Edge>, back: Handle, K, V, marker::Leaf>, marker::Edge>, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for Range<'a, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_list().entries(self.clone()).finish() @@ -371,7 +359,7 @@ pub struct RangeMut<'a, K: 'a, V: 'a> { _marker: PhantomData<&'a mut (K, V)>, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl<'a, K: 'a + fmt::Debug, V: 'a + fmt::Debug> fmt::Debug for RangeMut<'a, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let range = Range { diff --git a/src/libcollections/btree/set.rs b/src/libcollections/btree/set.rs index f90d0df768b..bfffa0b8efa 100644 --- a/src/libcollections/btree/set.rs +++ b/src/libcollections/btree/set.rs @@ -85,10 +85,10 @@ pub struct Iter<'a, T: 'a> { iter: Keys<'a, T, ()>, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("BTreeSet::Iter") + f.debug_tuple("Iter") .field(&self.iter.clone()) .finish() } @@ -101,34 +101,22 @@ impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> { /// /// [`BTreeSet`]: struct.BTreeSet.html #[stable(feature = "rust1", since = "1.0.0")] +#[derive(Debug)] pub struct IntoIter { iter: ::btree_map::IntoIter, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl fmt::Debug for IntoIter { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad(&format!("BTreeSet::IntoIter({:?})", self.iter)) - } -} - /// An iterator over a sub-range of `BTreeSet`'s items. /// /// This structure is created by the [`range`] method on [`BTreeSet`]. /// /// [`BTreeSet`]: struct.BTreeSet.html /// [`range`]: struct.BTreeSet.html#method.range +#[derive(Debug)] pub struct Range<'a, T: 'a> { iter: ::btree_map::Range<'a, T, ()>, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: 'a + fmt::Debug> fmt::Debug for Range<'a, T> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad(&format!("BTreeSet::Range({:?})", self.iter)) - } -} - /// A lazy iterator producing elements in the set difference (in-order). /// /// This structure is created by the [`difference`] method on [`BTreeSet`]. @@ -141,10 +129,10 @@ pub struct Difference<'a, T: 'a> { b: Peekable>, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for Difference<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("BTreeSet::Difference") + f.debug_tuple("Difference") .field(&self.clone()) .finish() } @@ -163,10 +151,10 @@ pub struct SymmetricDifference<'a, T: 'a> { b: Peekable>, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for SymmetricDifference<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("BTreeSet::SymmetricDifference") + f.debug_tuple("SymmetricDifference") .field(&self.clone()) .finish() } @@ -184,10 +172,10 @@ pub struct Intersection<'a, T: 'a> { b: Peekable>, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for Intersection<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("BTreeSet::Intersection") + f.debug_tuple("Intersection") .field(&self.clone()) .finish() } @@ -205,10 +193,10 @@ pub struct Union<'a, T: 'a> { b: Peekable>, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for Union<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("BTreeSet::Union") + f.debug_tuple("Union") .field(&self.clone()) .finish() } diff --git a/src/libcollections/enum_set.rs b/src/libcollections/enum_set.rs index e4498c17617..9bbb1013643 100644 --- a/src/libcollections/enum_set.rs +++ b/src/libcollections/enum_set.rs @@ -220,10 +220,9 @@ pub struct Iter { marker: marker::PhantomData, } -#[stable(feature = "collection_debug", since = "1.15.0")] impl fmt::Debug for Iter { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("EnumSet::Iter") + f.debug_tuple("Iter") .field(&self.clone()) .finish() } diff --git a/src/libcollections/linked_list.rs b/src/libcollections/linked_list.rs index 21be9ac1aab..d4f77d625b3 100644 --- a/src/libcollections/linked_list.rs +++ b/src/libcollections/linked_list.rs @@ -65,10 +65,10 @@ pub struct Iter<'a, T: 'a> { marker: PhantomData<&'a Node>, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("LinkedList::Iter") + f.debug_tuple("Iter") .field(&self.clone()) .finish() } @@ -91,10 +91,10 @@ pub struct IterMut<'a, T: 'a> { len: usize, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for IterMut<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("LinkedList::IterMut") + f.debug_tuple("IterMut") .field(self.clone()) .finish() } @@ -107,10 +107,10 @@ pub struct IntoIter { list: LinkedList, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl fmt::Debug for IntoIter { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("LinkedList::IntoIter") + f.debug_tuple("IntoIter") .field(self.clone()) .finish() } @@ -1104,10 +1104,12 @@ pub struct FrontPlace<'a, T: 'a> { node: IntermediateBox>, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[unstable(feature = "collection_placement", + reason = "struct name and placement protocol are subject to change", + issue = "30172")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for FrontPlace<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("LinkedList::FrontPlace") + f.debug_tuple("FrontPlace") .field(self.clone()) .finish() } @@ -1157,10 +1159,12 @@ pub struct BackPlace<'a, T: 'a> { node: IntermediateBox>, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[unstable(feature = "collection_placement", + reason = "struct name and placement protocol are subject to change", + issue = "30172")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for BackPlace<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("LinkedList::BackPlace") + f.debug_tuple("BackPlace") .field(self.clone()) .finish() } diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index 8dbddbb41d7..da5e8d03ea8 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -123,7 +123,7 @@ pub struct EncodeUtf16<'a> { encoder: Utf16Encoder>, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl<'a> fmt::Debug for EncodeUtf16<'a> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.pad("EncodeUtf16 { .. }") diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index 1a9849f2352..15a533d6d87 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -1979,10 +1979,10 @@ pub struct Drain<'a> { iter: Chars<'a>, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl<'a> fmt::Debug for Drain<'a> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad("String::Drain { .. }") + f.pad("Drain { .. }") } } diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index 2b6343782b1..97ce404a11f 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -2092,10 +2092,10 @@ pub struct Drain<'a, T: 'a> { vec: Shared>, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for Drain<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("Vec::Drain") + f.debug_tuple("Drain") .field(&self.iter.as_slice()) .finish() } @@ -2167,19 +2167,11 @@ impl<'a, T> FusedIterator for Drain<'a, T> {} #[unstable(feature = "collection_placement", reason = "struct name and placement protocol are subject to change", issue = "30172")] +#[derive(Debug)] pub struct PlaceBack<'a, T: 'a> { vec: &'a mut Vec, } -#[stable(feature = "collection_debug", since = "1.15.0")] -impl<'a, T: 'a + fmt::Debug> fmt::Debug for PlaceBack<'a, T> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("Vec::PlaceBack") - .field(&self.vec.as_slice()) - .finish() - } -} - #[unstable(feature = "collection_placement", reason = "placement protocol is subject to change", issue = "30172")] diff --git a/src/libcollections/vec_deque.rs b/src/libcollections/vec_deque.rs index 11aacb0ff43..a88a70888c5 100644 --- a/src/libcollections/vec_deque.rs +++ b/src/libcollections/vec_deque.rs @@ -1866,10 +1866,10 @@ pub struct Iter<'a, T: 'a> { head: usize, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("VecDeque::Iter") + f.debug_tuple("Iter") .field(&self.clone()) .finish() } @@ -1947,10 +1947,10 @@ pub struct IterMut<'a, T: 'a> { head: usize, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for IterMut<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("VecDeque::IterMut") + f.debug_tuple("IterMut") .field(&self.clone()) .finish() } @@ -2022,10 +2022,10 @@ pub struct IntoIter { inner: VecDeque, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl fmt::Debug for IntoIter { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("VecDeque::IntoIter") + f.debug_tuple("IntoIter") .field(&self.clone()) .finish() } @@ -2074,10 +2074,10 @@ pub struct Drain<'a, T: 'a> { deque: Shared>, } -#[stable(feature = "collection_debug", since = "1.15.0")] +#[stable(feature = "collection_debug", since = "1.17.0")] impl<'a, T: 'a + fmt::Debug> fmt::Debug for Drain<'a, T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("VecDeque::Drain") + f.debug_tuple("Drain") .field(&self.clone()) .finish() } From 8b2e334e0e3d3324307c22d37c6620b479eff0f7 Mon Sep 17 00:00:00 2001 From: Clar Charr Date: Thu, 26 Jan 2017 16:10:48 -0500 Subject: [PATCH 27/70] Ipv6Addr <-> u128 --- src/libstd/lib.rs | 3 ++- src/libstd/net/ip.rs | 40 ++++++++++++++++++++++++++++++++++++---- 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 9bcecebf693..1f3526e1a09 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -261,6 +261,8 @@ #![feature(generic_param_attrs)] #![feature(hashmap_hasher)] #![feature(heap_api)] +#![feature(i128)] +#![feature(i128_type)] #![feature(inclusive_range)] #![feature(int_error_internals)] #![feature(integer_atomics)] @@ -304,7 +306,6 @@ #![feature(unwind_attributes)] #![feature(vec_push_all)] #![feature(zero_one)] -#![feature(i128)] #![cfg_attr(test, feature(update_panic_count))] // Explicitly import the prelude. The compiler uses this same unstable attribute diff --git a/src/libstd/net/ip.rs b/src/libstd/net/ip.rs index 7803cf728f2..3dc89e390ee 100644 --- a/src/libstd/net/ip.rs +++ b/src/libstd/net/ip.rs @@ -1149,6 +1149,26 @@ impl FromInner for Ipv6Addr { } } +#[unstable(feature = "i128", issue = "35118")] +impl From for u128 { + fn from(ip: Ipv6Addr) -> u128 { + let ip = ip.segments(); + ((ip[0] as u128) << 112) + ((ip[1] as u128) << 96) + ((ip[2] as u128) << 80) + + ((ip[3] as u128) << 64) + ((ip[4] as u128) << 48) + ((ip[5] as u128) << 32) + + ((ip[6] as u128) << 16) + (ip[7] as u128) + } +} +#[unstable(feature = "i128", issue = "35118")] +impl From for Ipv6Addr { + fn from(ip: u128) -> Ipv6Addr { + Ipv6Addr::new( + (ip >> 112) as u16, (ip >> 96) as u16, (ip >> 80) as u16, + (ip >> 64) as u16, (ip >> 48) as u16, (ip >> 32) as u16, + (ip >> 16) as u16, ip as u16, + ) + } +} + #[stable(feature = "ipv6_from_octets", since = "1.9.0")] impl From<[u8; 16]> for Ipv6Addr { fn from(octets: [u8; 16]) -> Ipv6Addr { @@ -1500,14 +1520,26 @@ mod tests { #[test] fn test_ipv4_to_int() { - let a = Ipv4Addr::new(127, 0, 0, 1); - assert_eq!(u32::from(a), 2130706433); + let a = Ipv4Addr::new(0x11, 0x22, 0x33, 0x44); + assert_eq!(u32::from(a), 0x11223344); } #[test] fn test_int_to_ipv4() { - let a = Ipv4Addr::new(127, 0, 0, 1); - assert_eq!(Ipv4Addr::from(2130706433), a); + let a = Ipv4Addr::new(0x11, 0x22, 0x33, 0x44); + assert_eq!(Ipv4Addr::from(0x11223344), a); + } + + #[test] + fn test_ipv6_to_int() { + let a = Ipv6Addr::new(0x1122, 0x3344, 0x5566, 0x7788, 0x99aa, 0xbbcc, 0xddee, 0xff11); + assert_eq!(u128::from(a), 0x112233445566778899aabbccddeeff11u128); + } + + #[test] + fn test_int_to_ipv6() { + let a = Ipv6Addr::new(0x1122, 0x3344, 0x5566, 0x7788, 0x99aa, 0xbbcc, 0xddee, 0xff11); + assert_eq!(Ipv6Addr::from(0x112233445566778899aabbccddeeff11u128), a); } #[test] From 380ba6dbad874d78fd9e48ebeacb3161ee7fe7af Mon Sep 17 00:00:00 2001 From: king6cong Date: Mon, 6 Feb 2017 10:12:30 +0800 Subject: [PATCH 28/70] go back to use // --- src/librustc/mir/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index 163f1b0cf40..cbb7b2710f5 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -63,7 +63,7 @@ macro_rules! newtype_index { } /// Lowered representation of a single function. -/// Do not implement clone for Mir, which can be accidently done and kind of expensive. +// Do not implement clone for Mir, which can be accidently done and kind of expensive. #[derive(RustcEncodable, RustcDecodable, Debug)] pub struct Mir<'tcx> { /// List of basic blocks. References to basic block use a newtyped index type `BasicBlock` From 7c8c45e76225ecf0a219e994a9a10d71d0b9a4e4 Mon Sep 17 00:00:00 2001 From: Son Date: Mon, 6 Feb 2017 21:38:47 +1100 Subject: [PATCH 29/70] Extract collections benchmarks to libcollections/benches And libcore/benches --- src/libcollections/Cargo.toml | 7 +- .../benches/btree/map.rs} | 71 ++- src/libcollections/benches/btree/mod.rs | 11 + src/libcollections/benches/lib.rs | 24 + src/libcollections/benches/linked_list.rs | 87 ++++ src/libcollections/benches/slice.rs | 280 ++++++++++ src/libcollections/benches/str.rs | 298 +++++++++++ src/libcollections/benches/string.rs | 134 +++++ src/libcollections/benches/vec.rs | 492 ++++++++++++++++++ src/libcollections/benches/vec_deque.rs | 57 ++ src/libcollectionstest/btree/map.rs | 49 -- src/libcollectionstest/lib.rs | 4 - src/libcollectionstest/linked_list.rs | 77 --- src/libcollectionstest/slice.rs | 273 ---------- src/libcollectionstest/str.rs | 291 ----------- src/libcollectionstest/string.rs | 125 ----- src/libcollectionstest/vec.rs | 483 ----------------- src/libcollectionstest/vec_deque.rs | 47 -- src/libcore/Cargo.toml | 4 +- src/libcore/{bench => benches}/any.rs | 0 src/libcore/{bench => benches}/hash/mod.rs | 0 src/libcore/{bench => benches}/hash/sip.rs | 0 src/libcore/{bench => benches}/iter.rs | 0 src/libcore/{bench => benches}/lib.rs | 0 src/libcore/{bench => benches}/mem.rs | 0 .../{bench => benches}/num/dec2flt/mod.rs | 0 .../{bench => benches}/num/flt2dec/mod.rs | 0 .../num/flt2dec/strategy/dragon.rs | 0 .../num/flt2dec/strategy/grisu.rs | 0 src/libcore/{bench => benches}/num/mod.rs | 0 src/libcore/{bench => benches}/ops.rs | 0 31 files changed, 1442 insertions(+), 1372 deletions(-) rename src/{libcollectionstest/bench.rs => libcollections/benches/btree/map.rs} (66%) create mode 100644 src/libcollections/benches/btree/mod.rs create mode 100644 src/libcollections/benches/lib.rs create mode 100644 src/libcollections/benches/linked_list.rs create mode 100644 src/libcollections/benches/slice.rs create mode 100644 src/libcollections/benches/str.rs create mode 100644 src/libcollections/benches/string.rs create mode 100644 src/libcollections/benches/vec.rs create mode 100644 src/libcollections/benches/vec_deque.rs rename src/libcore/{bench => benches}/any.rs (100%) rename src/libcore/{bench => benches}/hash/mod.rs (100%) rename src/libcore/{bench => benches}/hash/sip.rs (100%) rename src/libcore/{bench => benches}/iter.rs (100%) rename src/libcore/{bench => benches}/lib.rs (100%) rename src/libcore/{bench => benches}/mem.rs (100%) rename src/libcore/{bench => benches}/num/dec2flt/mod.rs (100%) rename src/libcore/{bench => benches}/num/flt2dec/mod.rs (100%) rename src/libcore/{bench => benches}/num/flt2dec/strategy/dragon.rs (100%) rename src/libcore/{bench => benches}/num/flt2dec/strategy/grisu.rs (100%) rename src/libcore/{bench => benches}/num/mod.rs (100%) rename src/libcore/{bench => benches}/ops.rs (100%) diff --git a/src/libcollections/Cargo.toml b/src/libcollections/Cargo.toml index 186ba6e8f21..02b2171a224 100644 --- a/src/libcollections/Cargo.toml +++ b/src/libcollections/Cargo.toml @@ -16,7 +16,6 @@ std_unicode = { path = "../libstd_unicode" } name = "collectionstest" path = "../libcollectionstest/lib.rs" -# FIXME: need to extract benchmarks to separate crate -#[[bench]] -#name = "collectionstest" -#path = "../libcollectionstest/lib.rs" +[[bench]] +name = "collectionsbenches" +path = "../libcollections/benches/lib.rs" diff --git a/src/libcollectionstest/bench.rs b/src/libcollections/benches/btree/map.rs similarity index 66% rename from src/libcollectionstest/bench.rs rename to src/libcollections/benches/btree/map.rs index 4e150d4a222..744afb991b0 100644 --- a/src/libcollectionstest/bench.rs +++ b/src/libcollections/benches/btree/map.rs @@ -1,4 +1,4 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // @@ -8,13 +8,17 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. + +use std::iter::Iterator; +use std::vec::Vec; +use std::collections::BTreeMap; +use std::__rand::{Rng, thread_rng}; +use test::{Bencher, black_box}; + macro_rules! map_insert_rand_bench { ($name: ident, $n: expr, $map: ident) => ( #[bench] - pub fn $name(b: &mut ::test::Bencher) { - use std::__rand::{thread_rng, Rng}; - use test::black_box; - + pub fn $name(b: &mut Bencher) { let n: usize = $n; let mut map = $map::new(); // setup @@ -39,9 +43,7 @@ macro_rules! map_insert_rand_bench { macro_rules! map_insert_seq_bench { ($name: ident, $n: expr, $map: ident) => ( #[bench] - pub fn $name(b: &mut ::test::Bencher) { - use test::black_box; - + pub fn $name(b: &mut Bencher) { let mut map = $map::new(); let n: usize = $n; // setup @@ -64,12 +66,7 @@ macro_rules! map_insert_seq_bench { macro_rules! map_find_rand_bench { ($name: ident, $n: expr, $map: ident) => ( #[bench] - pub fn $name(b: &mut ::test::Bencher) { - use std::iter::Iterator; - use std::__rand::{thread_rng, Rng}; - use std::vec::Vec; - use test::black_box; - + pub fn $name(b: &mut Bencher) { let mut map = $map::new(); let n: usize = $n; @@ -97,9 +94,7 @@ macro_rules! map_find_rand_bench { macro_rules! map_find_seq_bench { ($name: ident, $n: expr, $map: ident) => ( #[bench] - pub fn $name(b: &mut ::test::Bencher) { - use test::black_box; - + pub fn $name(b: &mut Bencher) { let mut map = $map::new(); let n: usize = $n; @@ -118,3 +113,45 @@ macro_rules! map_find_seq_bench { } ) } + +map_insert_rand_bench!{insert_rand_100, 100, BTreeMap} +map_insert_rand_bench!{insert_rand_10_000, 10_000, BTreeMap} + +map_insert_seq_bench!{insert_seq_100, 100, BTreeMap} +map_insert_seq_bench!{insert_seq_10_000, 10_000, BTreeMap} + +map_find_rand_bench!{find_rand_100, 100, BTreeMap} +map_find_rand_bench!{find_rand_10_000, 10_000, BTreeMap} + +map_find_seq_bench!{find_seq_100, 100, BTreeMap} +map_find_seq_bench!{find_seq_10_000, 10_000, BTreeMap} + +fn bench_iter(b: &mut Bencher, size: i32) { + let mut map = BTreeMap::::new(); + let mut rng = thread_rng(); + + for _ in 0..size { + map.insert(rng.gen(), rng.gen()); + } + + b.iter(|| { + for entry in &map { + black_box(entry); + } + }); +} + +#[bench] +pub fn iter_20(b: &mut Bencher) { + bench_iter(b, 20); +} + +#[bench] +pub fn iter_1000(b: &mut Bencher) { + bench_iter(b, 1000); +} + +#[bench] +pub fn iter_100000(b: &mut Bencher) { + bench_iter(b, 100000); +} diff --git a/src/libcollections/benches/btree/mod.rs b/src/libcollections/benches/btree/mod.rs new file mode 100644 index 00000000000..f436b0ac0c0 --- /dev/null +++ b/src/libcollections/benches/btree/mod.rs @@ -0,0 +1,11 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +mod map; diff --git a/src/libcollections/benches/lib.rs b/src/libcollections/benches/lib.rs new file mode 100644 index 00000000000..1a21db5e344 --- /dev/null +++ b/src/libcollections/benches/lib.rs @@ -0,0 +1,24 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![deny(warnings)] + +#![feature(rand)] +#![feature(test)] + +extern crate test; + +mod btree; +mod linked_list; +mod string; +mod str; +mod slice; +mod vec; +mod vec_deque; diff --git a/src/libcollections/benches/linked_list.rs b/src/libcollections/benches/linked_list.rs new file mode 100644 index 00000000000..bbac44553f1 --- /dev/null +++ b/src/libcollections/benches/linked_list.rs @@ -0,0 +1,87 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::collections::LinkedList; +use test::Bencher; + +#[bench] +fn bench_collect_into(b: &mut Bencher) { + let v = &[0; 64]; + b.iter(|| { + let _: LinkedList<_> = v.iter().cloned().collect(); + }) +} + +#[bench] +fn bench_push_front(b: &mut Bencher) { + let mut m: LinkedList<_> = LinkedList::new(); + b.iter(|| { + m.push_front(0); + }) +} + +#[bench] +fn bench_push_back(b: &mut Bencher) { + let mut m: LinkedList<_> = LinkedList::new(); + b.iter(|| { + m.push_back(0); + }) +} + +#[bench] +fn bench_push_back_pop_back(b: &mut Bencher) { + let mut m: LinkedList<_> = LinkedList::new(); + b.iter(|| { + m.push_back(0); + m.pop_back(); + }) +} + +#[bench] +fn bench_push_front_pop_front(b: &mut Bencher) { + let mut m: LinkedList<_> = LinkedList::new(); + b.iter(|| { + m.push_front(0); + m.pop_front(); + }) +} + +#[bench] +fn bench_iter(b: &mut Bencher) { + let v = &[0; 128]; + let m: LinkedList<_> = v.iter().cloned().collect(); + b.iter(|| { + assert!(m.iter().count() == 128); + }) +} +#[bench] +fn bench_iter_mut(b: &mut Bencher) { + let v = &[0; 128]; + let mut m: LinkedList<_> = v.iter().cloned().collect(); + b.iter(|| { + assert!(m.iter_mut().count() == 128); + }) +} +#[bench] +fn bench_iter_rev(b: &mut Bencher) { + let v = &[0; 128]; + let m: LinkedList<_> = v.iter().cloned().collect(); + b.iter(|| { + assert!(m.iter().rev().count() == 128); + }) +} +#[bench] +fn bench_iter_mut_rev(b: &mut Bencher) { + let v = &[0; 128]; + let mut m: LinkedList<_> = v.iter().cloned().collect(); + b.iter(|| { + assert!(m.iter_mut().rev().count() == 128); + }) +} diff --git a/src/libcollections/benches/slice.rs b/src/libcollections/benches/slice.rs new file mode 100644 index 00000000000..eb4b76509f9 --- /dev/null +++ b/src/libcollections/benches/slice.rs @@ -0,0 +1,280 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::{mem, ptr}; +use std::__rand::{Rng, thread_rng}; + +use test::{Bencher, black_box}; + +#[bench] +fn iterator(b: &mut Bencher) { + // peculiar numbers to stop LLVM from optimising the summation + // out. + let v: Vec<_> = (0..100).map(|i| i ^ (i << 1) ^ (i >> 1)).collect(); + + b.iter(|| { + let mut sum = 0; + for x in &v { + sum += *x; + } + // sum == 11806, to stop dead code elimination. + if sum == 0 { + panic!() + } + }) +} + +#[bench] +fn mut_iterator(b: &mut Bencher) { + let mut v = vec![0; 100]; + + b.iter(|| { + let mut i = 0; + for x in &mut v { + *x = i; + i += 1; + } + }) +} + +#[bench] +fn concat(b: &mut Bencher) { + let xss: Vec> = (0..100).map(|i| (0..i).collect()).collect(); + b.iter(|| { + xss.concat(); + }); +} + +#[bench] +fn join(b: &mut Bencher) { + let xss: Vec> = (0..100).map(|i| (0..i).collect()).collect(); + b.iter(|| xss.join(&0)); +} + +#[bench] +fn push(b: &mut Bencher) { + let mut vec = Vec::::new(); + b.iter(|| { + vec.push(0); + black_box(&vec); + }); +} + +#[bench] +fn starts_with_same_vector(b: &mut Bencher) { + let vec: Vec<_> = (0..100).collect(); + b.iter(|| vec.starts_with(&vec)) +} + +#[bench] +fn starts_with_single_element(b: &mut Bencher) { + let vec: Vec<_> = vec![0]; + b.iter(|| vec.starts_with(&vec)) +} + +#[bench] +fn starts_with_diff_one_element_at_end(b: &mut Bencher) { + let vec: Vec<_> = (0..100).collect(); + let mut match_vec: Vec<_> = (0..99).collect(); + match_vec.push(0); + b.iter(|| vec.starts_with(&match_vec)) +} + +#[bench] +fn ends_with_same_vector(b: &mut Bencher) { + let vec: Vec<_> = (0..100).collect(); + b.iter(|| vec.ends_with(&vec)) +} + +#[bench] +fn ends_with_single_element(b: &mut Bencher) { + let vec: Vec<_> = vec![0]; + b.iter(|| vec.ends_with(&vec)) +} + +#[bench] +fn ends_with_diff_one_element_at_beginning(b: &mut Bencher) { + let vec: Vec<_> = (0..100).collect(); + let mut match_vec: Vec<_> = (0..100).collect(); + match_vec[0] = 200; + b.iter(|| vec.starts_with(&match_vec)) +} + +#[bench] +fn contains_last_element(b: &mut Bencher) { + let vec: Vec<_> = (0..100).collect(); + b.iter(|| vec.contains(&99)) +} + +#[bench] +fn zero_1kb_from_elem(b: &mut Bencher) { + b.iter(|| vec![0u8; 1024]); +} + +#[bench] +fn zero_1kb_set_memory(b: &mut Bencher) { + b.iter(|| { + let mut v = Vec::::with_capacity(1024); + unsafe { + let vp = v.as_mut_ptr(); + ptr::write_bytes(vp, 0, 1024); + v.set_len(1024); + } + v + }); +} + +#[bench] +fn zero_1kb_loop_set(b: &mut Bencher) { + b.iter(|| { + let mut v = Vec::::with_capacity(1024); + unsafe { + v.set_len(1024); + } + for i in 0..1024 { + v[i] = 0; + } + }); +} + +#[bench] +fn zero_1kb_mut_iter(b: &mut Bencher) { + b.iter(|| { + let mut v = Vec::::with_capacity(1024); + unsafe { + v.set_len(1024); + } + for x in &mut v { + *x = 0; + } + v + }); +} + +#[bench] +fn random_inserts(b: &mut Bencher) { + let mut rng = thread_rng(); + b.iter(|| { + let mut v = vec![(0, 0); 30]; + for _ in 0..100 { + let l = v.len(); + v.insert(rng.gen::() % (l + 1), (1, 1)); + } + }) +} +#[bench] +fn random_removes(b: &mut Bencher) { + let mut rng = thread_rng(); + b.iter(|| { + let mut v = vec![(0, 0); 130]; + for _ in 0..100 { + let l = v.len(); + v.remove(rng.gen::() % l); + } + }) +} + +fn gen_ascending(len: usize) -> Vec { + (0..len as u64).collect() +} + +fn gen_descending(len: usize) -> Vec { + (0..len as u64).rev().collect() +} + +fn gen_random(len: usize) -> Vec { + let mut rng = thread_rng(); + rng.gen_iter::().take(len).collect() +} + +fn gen_mostly_ascending(len: usize) -> Vec { + let mut rng = thread_rng(); + let mut v = gen_ascending(len); + for _ in (0usize..).take_while(|x| x * x <= len) { + let x = rng.gen::() % len; + let y = rng.gen::() % len; + v.swap(x, y); + } + v +} + +fn gen_mostly_descending(len: usize) -> Vec { + let mut rng = thread_rng(); + let mut v = gen_descending(len); + for _ in (0usize..).take_while(|x| x * x <= len) { + let x = rng.gen::() % len; + let y = rng.gen::() % len; + v.swap(x, y); + } + v +} + +fn gen_big_random(len: usize) -> Vec<[u64; 16]> { + let mut rng = thread_rng(); + rng.gen_iter().map(|x| [x; 16]).take(len).collect() +} + +fn gen_big_ascending(len: usize) -> Vec<[u64; 16]> { + (0..len as u64).map(|x| [x; 16]).take(len).collect() +} + +fn gen_big_descending(len: usize) -> Vec<[u64; 16]> { + (0..len as u64).rev().map(|x| [x; 16]).take(len).collect() +} + +macro_rules! sort_bench { + ($name:ident, $gen:expr, $len:expr) => { + #[bench] + fn $name(b: &mut Bencher) { + b.iter(|| $gen($len).sort()); + b.bytes = $len * mem::size_of_val(&$gen(1)[0]) as u64; + } + } +} + +sort_bench!(sort_small_random, gen_random, 10); +sort_bench!(sort_small_ascending, gen_ascending, 10); +sort_bench!(sort_small_descending, gen_descending, 10); + +sort_bench!(sort_small_big_random, gen_big_random, 10); +sort_bench!(sort_small_big_ascending, gen_big_ascending, 10); +sort_bench!(sort_small_big_descending, gen_big_descending, 10); + +sort_bench!(sort_medium_random, gen_random, 100); +sort_bench!(sort_medium_ascending, gen_ascending, 100); +sort_bench!(sort_medium_descending, gen_descending, 100); + +sort_bench!(sort_large_random, gen_random, 10000); +sort_bench!(sort_large_ascending, gen_ascending, 10000); +sort_bench!(sort_large_descending, gen_descending, 10000); +sort_bench!(sort_large_mostly_ascending, gen_mostly_ascending, 10000); +sort_bench!(sort_large_mostly_descending, gen_mostly_descending, 10000); + +sort_bench!(sort_large_big_random, gen_big_random, 10000); +sort_bench!(sort_large_big_ascending, gen_big_ascending, 10000); +sort_bench!(sort_large_big_descending, gen_big_descending, 10000); + +#[bench] +fn sort_large_random_expensive(b: &mut Bencher) { + let len = 10000; + b.iter(|| { + let mut v = gen_random(len); + let mut count = 0; + v.sort_by(|a: &u64, b: &u64| { + count += 1; + if count % 1_000_000_000 == 0 { + panic!("should not happen"); + } + (*a as f64).cos().partial_cmp(&(*b as f64).cos()).unwrap() + }); + black_box(count); + }); + b.bytes = len as u64 * mem::size_of::() as u64; +} \ No newline at end of file diff --git a/src/libcollections/benches/str.rs b/src/libcollections/benches/str.rs new file mode 100644 index 00000000000..7f727078101 --- /dev/null +++ b/src/libcollections/benches/str.rs @@ -0,0 +1,298 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use test::{Bencher, black_box}; + +#[bench] +fn char_iterator(b: &mut Bencher) { + let s = "ศไทย中华Việt Nam; Mary had a little lamb, Little lamb"; + + b.iter(|| s.chars().count()); +} + +#[bench] +fn char_iterator_for(b: &mut Bencher) { + let s = "ศไทย中华Việt Nam; Mary had a little lamb, Little lamb"; + + b.iter(|| { + for ch in s.chars() { black_box(ch); } + }); +} + +#[bench] +fn char_iterator_ascii(b: &mut Bencher) { + let s = "Mary had a little lamb, Little lamb + Mary had a little lamb, Little lamb + Mary had a little lamb, Little lamb + Mary had a little lamb, Little lamb + Mary had a little lamb, Little lamb + Mary had a little lamb, Little lamb"; + + b.iter(|| s.chars().count()); +} + +#[bench] +fn char_iterator_rev(b: &mut Bencher) { + let s = "ศไทย中华Việt Nam; Mary had a little lamb, Little lamb"; + + b.iter(|| s.chars().rev().count()); +} + +#[bench] +fn char_iterator_rev_for(b: &mut Bencher) { + let s = "ศไทย中华Việt Nam; Mary had a little lamb, Little lamb"; + + b.iter(|| { + for ch in s.chars().rev() { black_box(ch); } + }); +} + +#[bench] +fn char_indicesator(b: &mut Bencher) { + let s = "ศไทย中华Việt Nam; Mary had a little lamb, Little lamb"; + let len = s.chars().count(); + + b.iter(|| assert_eq!(s.char_indices().count(), len)); +} + +#[bench] +fn char_indicesator_rev(b: &mut Bencher) { + let s = "ศไทย中华Việt Nam; Mary had a little lamb, Little lamb"; + let len = s.chars().count(); + + b.iter(|| assert_eq!(s.char_indices().rev().count(), len)); +} + +#[bench] +fn split_unicode_ascii(b: &mut Bencher) { + let s = "ประเทศไทย中华Việt Namประเทศไทย中华Việt Nam"; + + b.iter(|| assert_eq!(s.split('V').count(), 3)); +} + +#[bench] +fn split_ascii(b: &mut Bencher) { + let s = "Mary had a little lamb, Little lamb, little-lamb."; + let len = s.split(' ').count(); + + b.iter(|| assert_eq!(s.split(' ').count(), len)); +} + +#[bench] +fn split_extern_fn(b: &mut Bencher) { + let s = "Mary had a little lamb, Little lamb, little-lamb."; + let len = s.split(' ').count(); + fn pred(c: char) -> bool { c == ' ' } + + b.iter(|| assert_eq!(s.split(pred).count(), len)); +} + +#[bench] +fn split_closure(b: &mut Bencher) { + let s = "Mary had a little lamb, Little lamb, little-lamb."; + let len = s.split(' ').count(); + + b.iter(|| assert_eq!(s.split(|c: char| c == ' ').count(), len)); +} + +#[bench] +fn split_slice(b: &mut Bencher) { + let s = "Mary had a little lamb, Little lamb, little-lamb."; + let len = s.split(' ').count(); + + let c: &[char] = &[' ']; + b.iter(|| assert_eq!(s.split(c).count(), len)); +} + +#[bench] +fn bench_join(b: &mut Bencher) { + let s = "ศไทย中华Việt Nam; Mary had a little lamb, Little lamb"; + let sep = "→"; + let v = vec![s, s, s, s, s, s, s, s, s, s]; + b.iter(|| { + assert_eq!(v.join(sep).len(), s.len() * 10 + sep.len() * 9); + }) +} + +#[bench] +fn bench_contains_short_short(b: &mut Bencher) { + let haystack = "Lorem ipsum dolor sit amet, consectetur adipiscing elit."; + let needle = "sit"; + + b.iter(|| { + assert!(haystack.contains(needle)); + }) +} + +#[bench] +fn bench_contains_short_long(b: &mut Bencher) { + let haystack = "\ +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse quis lorem sit amet dolor \ +ultricies condimentum. Praesent iaculis purus elit, ac malesuada quam malesuada in. Duis sed orci \ +eros. Suspendisse sit amet magna mollis, mollis nunc luctus, imperdiet mi. Integer fringilla non \ +sem ut lacinia. Fusce varius tortor a risus porttitor hendrerit. Morbi mauris dui, ultricies nec \ +tempus vel, gravida nec quam. + +In est dui, tincidunt sed tempus interdum, adipiscing laoreet ante. Etiam tempor, tellus quis \ +sagittis interdum, nulla purus mattis sem, quis auctor erat odio ac tellus. In nec nunc sit amet \ +diam volutpat molestie at sed ipsum. Vestibulum laoreet consequat vulputate. Integer accumsan \ +lorem ac dignissim placerat. Suspendisse convallis faucibus lorem. Aliquam erat volutpat. In vel \ +eleifend felis. Sed suscipit nulla lorem, sed mollis est sollicitudin et. Nam fermentum egestas \ +interdum. Curabitur ut nisi justo. + +Sed sollicitudin ipsum tellus, ut condimentum leo eleifend nec. Cras ut velit ante. Phasellus nec \ +mollis odio. Mauris molestie erat in arcu mattis, at aliquet dolor vehicula. Quisque malesuada \ +lectus sit amet nisi pretium, a condimentum ipsum porta. Morbi at dapibus diam. Praesent egestas \ +est sed risus elementum, eu rutrum metus ultrices. Etiam fermentum consectetur magna, id rutrum \ +felis accumsan a. Aliquam ut pellentesque libero. Sed mi nulla, lobortis eu tortor id, suscipit \ +ultricies neque. Morbi iaculis sit amet risus at iaculis. Praesent eget ligula quis turpis \ +feugiat suscipit vel non arcu. Interdum et malesuada fames ac ante ipsum primis in faucibus. \ +Aliquam sit amet placerat lorem. + +Cras a lacus vel ante posuere elementum. Nunc est leo, bibendum ut facilisis vel, bibendum at \ +mauris. Nullam adipiscing diam vel odio ornare, luctus adipiscing mi luctus. Nulla facilisi. \ +Mauris adipiscing bibendum neque, quis adipiscing lectus tempus et. Sed feugiat erat et nisl \ +lobortis pharetra. Donec vitae erat enim. Nullam sit amet felis et quam lacinia tincidunt. Aliquam \ +suscipit dapibus urna. Sed volutpat urna in magna pulvinar volutpat. Phasellus nec tellus ac diam \ +cursus accumsan. + +Nam lectus enim, dapibus non nisi tempor, consectetur convallis massa. Maecenas eleifend dictum \ +feugiat. Etiam quis mauris vel risus luctus mattis a a nunc. Nullam orci quam, imperdiet id \ +vehicula in, porttitor ut nibh. Duis sagittis adipiscing nisl vitae congue. Donec mollis risus eu \ +leo suscipit, varius porttitor nulla porta. Pellentesque ut sem nec nisi euismod vehicula. Nulla \ +malesuada sollicitudin quam eu fermentum."; + let needle = "english"; + + b.iter(|| { + assert!(!haystack.contains(needle)); + }) +} + +#[bench] +fn bench_contains_bad_naive(b: &mut Bencher) { + let haystack = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; + let needle = "aaaaaaaab"; + + b.iter(|| { + assert!(!haystack.contains(needle)); + }) +} + +#[bench] +fn bench_contains_equal(b: &mut Bencher) { + let haystack = "Lorem ipsum dolor sit amet, consectetur adipiscing elit."; + let needle = "Lorem ipsum dolor sit amet, consectetur adipiscing elit."; + + b.iter(|| { + assert!(haystack.contains(needle)); + }) +} + +macro_rules! make_test_inner { + ($s:ident, $code:expr, $name:ident, $str:expr) => { + #[bench] + fn $name(bencher: &mut Bencher) { + let mut $s = $str; + black_box(&mut $s); + bencher.iter(|| $code); + } + } +} + +macro_rules! make_test { + ($name:ident, $s:ident, $code:expr) => { + mod $name { + use test::Bencher; + use test::black_box; + + // Short strings: 65 bytes each + make_test_inner!($s, $code, short_ascii, + "Mary had a little lamb, Little lamb Mary had a littl lamb, lamb!"); + make_test_inner!($s, $code, short_mixed, + "ศไทย中华Việt Nam; Mary had a little lamb, Little lam!"); + make_test_inner!($s, $code, short_pile_of_poo, + "💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩!"); + make_test_inner!($s, $code, long_lorem_ipsum,"\ +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse quis lorem sit amet dolor \ +ultricies condimentum. Praesent iaculis purus elit, ac malesuada quam malesuada in. Duis sed orci \ +eros. Suspendisse sit amet magna mollis, mollis nunc luctus, imperdiet mi. Integer fringilla non \ +sem ut lacinia. Fusce varius tortor a risus porttitor hendrerit. Morbi mauris dui, ultricies nec \ +tempus vel, gravida nec quam. + +In est dui, tincidunt sed tempus interdum, adipiscing laoreet ante. Etiam tempor, tellus quis \ +sagittis interdum, nulla purus mattis sem, quis auctor erat odio ac tellus. In nec nunc sit amet \ +diam volutpat molestie at sed ipsum. Vestibulum laoreet consequat vulputate. Integer accumsan \ +lorem ac dignissim placerat. Suspendisse convallis faucibus lorem. Aliquam erat volutpat. In vel \ +eleifend felis. Sed suscipit nulla lorem, sed mollis est sollicitudin et. Nam fermentum egestas \ +interdum. Curabitur ut nisi justo. + +Sed sollicitudin ipsum tellus, ut condimentum leo eleifend nec. Cras ut velit ante. Phasellus nec \ +mollis odio. Mauris molestie erat in arcu mattis, at aliquet dolor vehicula. Quisque malesuada \ +lectus sit amet nisi pretium, a condimentum ipsum porta. Morbi at dapibus diam. Praesent egestas \ +est sed risus elementum, eu rutrum metus ultrices. Etiam fermentum consectetur magna, id rutrum \ +felis accumsan a. Aliquam ut pellentesque libero. Sed mi nulla, lobortis eu tortor id, suscipit \ +ultricies neque. Morbi iaculis sit amet risus at iaculis. Praesent eget ligula quis turpis \ +feugiat suscipit vel non arcu. Interdum et malesuada fames ac ante ipsum primis in faucibus. \ +Aliquam sit amet placerat lorem. + +Cras a lacus vel ante posuere elementum. Nunc est leo, bibendum ut facilisis vel, bibendum at \ +mauris. Nullam adipiscing diam vel odio ornare, luctus adipiscing mi luctus. Nulla facilisi. \ +Mauris adipiscing bibendum neque, quis adipiscing lectus tempus et. Sed feugiat erat et nisl \ +lobortis pharetra. Donec vitae erat enim. Nullam sit amet felis et quam lacinia tincidunt. Aliquam \ +suscipit dapibus urna. Sed volutpat urna in magna pulvinar volutpat. Phasellus nec tellus ac diam \ +cursus accumsan. + +Nam lectus enim, dapibus non nisi tempor, consectetur convallis massa. Maecenas eleifend dictum \ +feugiat. Etiam quis mauris vel risus luctus mattis a a nunc. Nullam orci quam, imperdiet id \ +vehicula in, porttitor ut nibh. Duis sagittis adipiscing nisl vitae congue. Donec mollis risus eu \ +leo suscipit, varius porttitor nulla porta. Pellentesque ut sem nec nisi euismod vehicula. Nulla \ +malesuada sollicitudin quam eu fermentum!"); + } + } +} + +make_test!(chars_count, s, s.chars().count()); + +make_test!(contains_bang_str, s, s.contains("!")); +make_test!(contains_bang_char, s, s.contains('!')); + +make_test!(match_indices_a_str, s, s.match_indices("a").count()); + +make_test!(split_a_str, s, s.split("a").count()); + +make_test!(trim_ascii_char, s, { + use std::ascii::AsciiExt; + s.trim_matches(|c: char| c.is_ascii()) +}); +make_test!(trim_left_ascii_char, s, { + use std::ascii::AsciiExt; + s.trim_left_matches(|c: char| c.is_ascii()) +}); +make_test!(trim_right_ascii_char, s, { + use std::ascii::AsciiExt; + s.trim_right_matches(|c: char| c.is_ascii()) +}); + +make_test!(find_underscore_char, s, s.find('_')); +make_test!(rfind_underscore_char, s, s.rfind('_')); +make_test!(find_underscore_str, s, s.find("_")); + +make_test!(find_zzz_char, s, s.find('\u{1F4A4}')); +make_test!(rfind_zzz_char, s, s.rfind('\u{1F4A4}')); +make_test!(find_zzz_str, s, s.find("\u{1F4A4}")); + +make_test!(split_space_char, s, s.split(' ').count()); +make_test!(split_terminator_space_char, s, s.split_terminator(' ').count()); + +make_test!(splitn_space_char, s, s.splitn(10, ' ').count()); +make_test!(rsplitn_space_char, s, s.rsplitn(10, ' ').count()); + +make_test!(split_space_str, s, s.split(" ").count()); +make_test!(split_ad_str, s, s.split("ad").count()); diff --git a/src/libcollections/benches/string.rs b/src/libcollections/benches/string.rs new file mode 100644 index 00000000000..36be21d978e --- /dev/null +++ b/src/libcollections/benches/string.rs @@ -0,0 +1,134 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::iter::repeat; +use test::Bencher; + +#[bench] +fn bench_with_capacity(b: &mut Bencher) { + b.iter(|| String::with_capacity(100)); +} + +#[bench] +fn bench_push_str(b: &mut Bencher) { + let s = "ศไทย中华Việt Nam; Mary had a little lamb, Little lamb"; + b.iter(|| { + let mut r = String::new(); + r.push_str(s); + }); +} + +const REPETITIONS: u64 = 10_000; + +#[bench] +fn bench_push_str_one_byte(b: &mut Bencher) { + b.bytes = REPETITIONS; + b.iter(|| { + let mut r = String::new(); + for _ in 0..REPETITIONS { + r.push_str("a") + } + }); +} + +#[bench] +fn bench_push_char_one_byte(b: &mut Bencher) { + b.bytes = REPETITIONS; + b.iter(|| { + let mut r = String::new(); + for _ in 0..REPETITIONS { + r.push('a') + } + }); +} + +#[bench] +fn bench_push_char_two_bytes(b: &mut Bencher) { + b.bytes = REPETITIONS * 2; + b.iter(|| { + let mut r = String::new(); + for _ in 0..REPETITIONS { + r.push('â') + } + }); +} + +#[bench] +fn from_utf8_lossy_100_ascii(b: &mut Bencher) { + let s = b"Hello there, the quick brown fox jumped over the lazy dog! \ + Lorem ipsum dolor sit amet, consectetur. "; + + assert_eq!(100, s.len()); + b.iter(|| { + let _ = String::from_utf8_lossy(s); + }); +} + +#[bench] +fn from_utf8_lossy_100_multibyte(b: &mut Bencher) { + let s = "𐌀𐌖𐌋𐌄𐌑𐌉ปรدولة الكويتทศไทย中华𐍅𐌿𐌻𐍆𐌹𐌻𐌰".as_bytes(); + assert_eq!(100, s.len()); + b.iter(|| { + let _ = String::from_utf8_lossy(s); + }); +} + +#[bench] +fn from_utf8_lossy_invalid(b: &mut Bencher) { + let s = b"Hello\xC0\x80 There\xE6\x83 Goodbye"; + b.iter(|| { + let _ = String::from_utf8_lossy(s); + }); +} + +#[bench] +fn from_utf8_lossy_100_invalid(b: &mut Bencher) { + let s = repeat(0xf5).take(100).collect::>(); + b.iter(|| { + let _ = String::from_utf8_lossy(&s); + }); +} + +#[bench] +fn bench_exact_size_shrink_to_fit(b: &mut Bencher) { + let s = "Hello there, the quick brown fox jumped over the lazy dog! \ + Lorem ipsum dolor sit amet, consectetur. "; + // ensure our operation produces an exact-size string before we benchmark it + let mut r = String::with_capacity(s.len()); + r.push_str(s); + assert_eq!(r.len(), r.capacity()); + b.iter(|| { + let mut r = String::with_capacity(s.len()); + r.push_str(s); + r.shrink_to_fit(); + r + }); +} + +#[bench] +fn bench_from_str(b: &mut Bencher) { + let s = "Hello there, the quick brown fox jumped over the lazy dog! \ + Lorem ipsum dolor sit amet, consectetur. "; + b.iter(|| String::from(s)) +} + +#[bench] +fn bench_from(b: &mut Bencher) { + let s = "Hello there, the quick brown fox jumped over the lazy dog! \ + Lorem ipsum dolor sit amet, consectetur. "; + b.iter(|| String::from(s)) +} + +#[bench] +fn bench_to_string(b: &mut Bencher) { + let s = "Hello there, the quick brown fox jumped over the lazy dog! \ + Lorem ipsum dolor sit amet, consectetur. "; + b.iter(|| s.to_string()) +} diff --git a/src/libcollections/benches/vec.rs b/src/libcollections/benches/vec.rs new file mode 100644 index 00000000000..41490117068 --- /dev/null +++ b/src/libcollections/benches/vec.rs @@ -0,0 +1,492 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use test::Bencher; +use std::iter::{FromIterator, repeat}; + +#[bench] +fn bench_new(b: &mut Bencher) { + b.iter(|| { + let v: Vec = Vec::new(); + assert_eq!(v.len(), 0); + assert_eq!(v.capacity(), 0); + }) +} + +fn do_bench_with_capacity(b: &mut Bencher, src_len: usize) { + b.bytes = src_len as u64; + + b.iter(|| { + let v: Vec = Vec::with_capacity(src_len); + assert_eq!(v.len(), 0); + assert_eq!(v.capacity(), src_len); + }) +} + +#[bench] +fn bench_with_capacity_0000(b: &mut Bencher) { + do_bench_with_capacity(b, 0) +} + +#[bench] +fn bench_with_capacity_0010(b: &mut Bencher) { + do_bench_with_capacity(b, 10) +} + +#[bench] +fn bench_with_capacity_0100(b: &mut Bencher) { + do_bench_with_capacity(b, 100) +} + +#[bench] +fn bench_with_capacity_1000(b: &mut Bencher) { + do_bench_with_capacity(b, 1000) +} + +fn do_bench_from_fn(b: &mut Bencher, src_len: usize) { + b.bytes = src_len as u64; + + b.iter(|| { + let dst = (0..src_len).collect::>(); + assert_eq!(dst.len(), src_len); + assert!(dst.iter().enumerate().all(|(i, x)| i == *x)); + }) +} + +#[bench] +fn bench_from_fn_0000(b: &mut Bencher) { + do_bench_from_fn(b, 0) +} + +#[bench] +fn bench_from_fn_0010(b: &mut Bencher) { + do_bench_from_fn(b, 10) +} + +#[bench] +fn bench_from_fn_0100(b: &mut Bencher) { + do_bench_from_fn(b, 100) +} + +#[bench] +fn bench_from_fn_1000(b: &mut Bencher) { + do_bench_from_fn(b, 1000) +} + +fn do_bench_from_elem(b: &mut Bencher, src_len: usize) { + b.bytes = src_len as u64; + + b.iter(|| { + let dst: Vec = repeat(5).take(src_len).collect(); + assert_eq!(dst.len(), src_len); + assert!(dst.iter().all(|x| *x == 5)); + }) +} + +#[bench] +fn bench_from_elem_0000(b: &mut Bencher) { + do_bench_from_elem(b, 0) +} + +#[bench] +fn bench_from_elem_0010(b: &mut Bencher) { + do_bench_from_elem(b, 10) +} + +#[bench] +fn bench_from_elem_0100(b: &mut Bencher) { + do_bench_from_elem(b, 100) +} + +#[bench] +fn bench_from_elem_1000(b: &mut Bencher) { + do_bench_from_elem(b, 1000) +} + +fn do_bench_from_slice(b: &mut Bencher, src_len: usize) { + let src: Vec<_> = FromIterator::from_iter(0..src_len); + + b.bytes = src_len as u64; + + b.iter(|| { + let dst = src.clone()[..].to_vec(); + assert_eq!(dst.len(), src_len); + assert!(dst.iter().enumerate().all(|(i, x)| i == *x)); + }); +} + +#[bench] +fn bench_from_slice_0000(b: &mut Bencher) { + do_bench_from_slice(b, 0) +} + +#[bench] +fn bench_from_slice_0010(b: &mut Bencher) { + do_bench_from_slice(b, 10) +} + +#[bench] +fn bench_from_slice_0100(b: &mut Bencher) { + do_bench_from_slice(b, 100) +} + +#[bench] +fn bench_from_slice_1000(b: &mut Bencher) { + do_bench_from_slice(b, 1000) +} + +fn do_bench_from_iter(b: &mut Bencher, src_len: usize) { + let src: Vec<_> = FromIterator::from_iter(0..src_len); + + b.bytes = src_len as u64; + + b.iter(|| { + let dst: Vec<_> = FromIterator::from_iter(src.clone()); + assert_eq!(dst.len(), src_len); + assert!(dst.iter().enumerate().all(|(i, x)| i == *x)); + }); +} + +#[bench] +fn bench_from_iter_0000(b: &mut Bencher) { + do_bench_from_iter(b, 0) +} + +#[bench] +fn bench_from_iter_0010(b: &mut Bencher) { + do_bench_from_iter(b, 10) +} + +#[bench] +fn bench_from_iter_0100(b: &mut Bencher) { + do_bench_from_iter(b, 100) +} + +#[bench] +fn bench_from_iter_1000(b: &mut Bencher) { + do_bench_from_iter(b, 1000) +} + +fn do_bench_extend(b: &mut Bencher, dst_len: usize, src_len: usize) { + let dst: Vec<_> = FromIterator::from_iter(0..dst_len); + let src: Vec<_> = FromIterator::from_iter(dst_len..dst_len + src_len); + + b.bytes = src_len as u64; + + b.iter(|| { + let mut dst = dst.clone(); + dst.extend(src.clone()); + assert_eq!(dst.len(), dst_len + src_len); + assert!(dst.iter().enumerate().all(|(i, x)| i == *x)); + }); +} + +#[bench] +fn bench_extend_0000_0000(b: &mut Bencher) { + do_bench_extend(b, 0, 0) +} + +#[bench] +fn bench_extend_0000_0010(b: &mut Bencher) { + do_bench_extend(b, 0, 10) +} + +#[bench] +fn bench_extend_0000_0100(b: &mut Bencher) { + do_bench_extend(b, 0, 100) +} + +#[bench] +fn bench_extend_0000_1000(b: &mut Bencher) { + do_bench_extend(b, 0, 1000) +} + +#[bench] +fn bench_extend_0010_0010(b: &mut Bencher) { + do_bench_extend(b, 10, 10) +} + +#[bench] +fn bench_extend_0100_0100(b: &mut Bencher) { + do_bench_extend(b, 100, 100) +} + +#[bench] +fn bench_extend_1000_1000(b: &mut Bencher) { + do_bench_extend(b, 1000, 1000) +} + +fn do_bench_push_all(b: &mut Bencher, dst_len: usize, src_len: usize) { + let dst: Vec<_> = FromIterator::from_iter(0..dst_len); + let src: Vec<_> = FromIterator::from_iter(dst_len..dst_len + src_len); + + b.bytes = src_len as u64; + + b.iter(|| { + let mut dst = dst.clone(); + dst.extend_from_slice(&src); + assert_eq!(dst.len(), dst_len + src_len); + assert!(dst.iter().enumerate().all(|(i, x)| i == *x)); + }); +} + +#[bench] +fn bench_push_all_0000_0000(b: &mut Bencher) { + do_bench_push_all(b, 0, 0) +} + +#[bench] +fn bench_push_all_0000_0010(b: &mut Bencher) { + do_bench_push_all(b, 0, 10) +} + +#[bench] +fn bench_push_all_0000_0100(b: &mut Bencher) { + do_bench_push_all(b, 0, 100) +} + +#[bench] +fn bench_push_all_0000_1000(b: &mut Bencher) { + do_bench_push_all(b, 0, 1000) +} + +#[bench] +fn bench_push_all_0010_0010(b: &mut Bencher) { + do_bench_push_all(b, 10, 10) +} + +#[bench] +fn bench_push_all_0100_0100(b: &mut Bencher) { + do_bench_push_all(b, 100, 100) +} + +#[bench] +fn bench_push_all_1000_1000(b: &mut Bencher) { + do_bench_push_all(b, 1000, 1000) +} + +fn do_bench_push_all_move(b: &mut Bencher, dst_len: usize, src_len: usize) { + let dst: Vec<_> = FromIterator::from_iter(0..dst_len); + let src: Vec<_> = FromIterator::from_iter(dst_len..dst_len + src_len); + + b.bytes = src_len as u64; + + b.iter(|| { + let mut dst = dst.clone(); + dst.extend(src.clone()); + assert_eq!(dst.len(), dst_len + src_len); + assert!(dst.iter().enumerate().all(|(i, x)| i == *x)); + }); +} + +#[bench] +fn bench_push_all_move_0000_0000(b: &mut Bencher) { + do_bench_push_all_move(b, 0, 0) +} + +#[bench] +fn bench_push_all_move_0000_0010(b: &mut Bencher) { + do_bench_push_all_move(b, 0, 10) +} + +#[bench] +fn bench_push_all_move_0000_0100(b: &mut Bencher) { + do_bench_push_all_move(b, 0, 100) +} + +#[bench] +fn bench_push_all_move_0000_1000(b: &mut Bencher) { + do_bench_push_all_move(b, 0, 1000) +} + +#[bench] +fn bench_push_all_move_0010_0010(b: &mut Bencher) { + do_bench_push_all_move(b, 10, 10) +} + +#[bench] +fn bench_push_all_move_0100_0100(b: &mut Bencher) { + do_bench_push_all_move(b, 100, 100) +} + +#[bench] +fn bench_push_all_move_1000_1000(b: &mut Bencher) { + do_bench_push_all_move(b, 1000, 1000) +} + +fn do_bench_clone(b: &mut Bencher, src_len: usize) { + let src: Vec = FromIterator::from_iter(0..src_len); + + b.bytes = src_len as u64; + + b.iter(|| { + let dst = src.clone(); + assert_eq!(dst.len(), src_len); + assert!(dst.iter().enumerate().all(|(i, x)| i == *x)); + }); +} + +#[bench] +fn bench_clone_0000(b: &mut Bencher) { + do_bench_clone(b, 0) +} + +#[bench] +fn bench_clone_0010(b: &mut Bencher) { + do_bench_clone(b, 10) +} + +#[bench] +fn bench_clone_0100(b: &mut Bencher) { + do_bench_clone(b, 100) +} + +#[bench] +fn bench_clone_1000(b: &mut Bencher) { + do_bench_clone(b, 1000) +} + +fn do_bench_clone_from(b: &mut Bencher, times: usize, dst_len: usize, src_len: usize) { + let dst: Vec<_> = FromIterator::from_iter(0..src_len); + let src: Vec<_> = FromIterator::from_iter(dst_len..dst_len + src_len); + + b.bytes = (times * src_len) as u64; + + b.iter(|| { + let mut dst = dst.clone(); + + for _ in 0..times { + dst.clone_from(&src); + + assert_eq!(dst.len(), src_len); + assert!(dst.iter().enumerate().all(|(i, x)| dst_len + i == *x)); + } + }); +} + +#[bench] +fn bench_clone_from_01_0000_0000(b: &mut Bencher) { + do_bench_clone_from(b, 1, 0, 0) +} + +#[bench] +fn bench_clone_from_01_0000_0010(b: &mut Bencher) { + do_bench_clone_from(b, 1, 0, 10) +} + +#[bench] +fn bench_clone_from_01_0000_0100(b: &mut Bencher) { + do_bench_clone_from(b, 1, 0, 100) +} + +#[bench] +fn bench_clone_from_01_0000_1000(b: &mut Bencher) { + do_bench_clone_from(b, 1, 0, 1000) +} + +#[bench] +fn bench_clone_from_01_0010_0010(b: &mut Bencher) { + do_bench_clone_from(b, 1, 10, 10) +} + +#[bench] +fn bench_clone_from_01_0100_0100(b: &mut Bencher) { + do_bench_clone_from(b, 1, 100, 100) +} + +#[bench] +fn bench_clone_from_01_1000_1000(b: &mut Bencher) { + do_bench_clone_from(b, 1, 1000, 1000) +} + +#[bench] +fn bench_clone_from_01_0010_0100(b: &mut Bencher) { + do_bench_clone_from(b, 1, 10, 100) +} + +#[bench] +fn bench_clone_from_01_0100_1000(b: &mut Bencher) { + do_bench_clone_from(b, 1, 100, 1000) +} + +#[bench] +fn bench_clone_from_01_0010_0000(b: &mut Bencher) { + do_bench_clone_from(b, 1, 10, 0) +} + +#[bench] +fn bench_clone_from_01_0100_0010(b: &mut Bencher) { + do_bench_clone_from(b, 1, 100, 10) +} + +#[bench] +fn bench_clone_from_01_1000_0100(b: &mut Bencher) { + do_bench_clone_from(b, 1, 1000, 100) +} + +#[bench] +fn bench_clone_from_10_0000_0000(b: &mut Bencher) { + do_bench_clone_from(b, 10, 0, 0) +} + +#[bench] +fn bench_clone_from_10_0000_0010(b: &mut Bencher) { + do_bench_clone_from(b, 10, 0, 10) +} + +#[bench] +fn bench_clone_from_10_0000_0100(b: &mut Bencher) { + do_bench_clone_from(b, 10, 0, 100) +} + +#[bench] +fn bench_clone_from_10_0000_1000(b: &mut Bencher) { + do_bench_clone_from(b, 10, 0, 1000) +} + +#[bench] +fn bench_clone_from_10_0010_0010(b: &mut Bencher) { + do_bench_clone_from(b, 10, 10, 10) +} + +#[bench] +fn bench_clone_from_10_0100_0100(b: &mut Bencher) { + do_bench_clone_from(b, 10, 100, 100) +} + +#[bench] +fn bench_clone_from_10_1000_1000(b: &mut Bencher) { + do_bench_clone_from(b, 10, 1000, 1000) +} + +#[bench] +fn bench_clone_from_10_0010_0100(b: &mut Bencher) { + do_bench_clone_from(b, 10, 10, 100) +} + +#[bench] +fn bench_clone_from_10_0100_1000(b: &mut Bencher) { + do_bench_clone_from(b, 10, 100, 1000) +} + +#[bench] +fn bench_clone_from_10_0010_0000(b: &mut Bencher) { + do_bench_clone_from(b, 10, 10, 0) +} + +#[bench] +fn bench_clone_from_10_0100_0010(b: &mut Bencher) { + do_bench_clone_from(b, 10, 100, 10) +} + +#[bench] +fn bench_clone_from_10_1000_0100(b: &mut Bencher) { + do_bench_clone_from(b, 10, 1000, 100) +} diff --git a/src/libcollections/benches/vec_deque.rs b/src/libcollections/benches/vec_deque.rs new file mode 100644 index 00000000000..380645e7cd0 --- /dev/null +++ b/src/libcollections/benches/vec_deque.rs @@ -0,0 +1,57 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::collections::VecDeque; +use test::{Bencher, black_box}; + +#[bench] +fn bench_new(b: &mut Bencher) { + b.iter(|| { + let ring: VecDeque = VecDeque::new(); + black_box(ring); + }) +} + +#[bench] +fn bench_grow_1025(b: &mut Bencher) { + b.iter(|| { + let mut deq = VecDeque::new(); + for i in 0..1025 { + deq.push_front(i); + } + black_box(deq); + }) +} + +#[bench] +fn bench_iter_1000(b: &mut Bencher) { + let ring: VecDeque<_> = (0..1000).collect(); + + b.iter(|| { + let mut sum = 0; + for &i in &ring { + sum += i; + } + black_box(sum); + }) +} + +#[bench] +fn bench_mut_iter_1000(b: &mut Bencher) { + let mut ring: VecDeque<_> = (0..1000).collect(); + + b.iter(|| { + let mut sum = 0; + for i in &mut ring { + sum += *i; + } + black_box(sum); + }) +} diff --git a/src/libcollectionstest/btree/map.rs b/src/libcollectionstest/btree/map.rs index c84753415a2..11be13426e4 100644 --- a/src/libcollectionstest/btree/map.rs +++ b/src/libcollectionstest/btree/map.rs @@ -606,52 +606,3 @@ fn test_split_off_large_random_sorted() { assert!(map.into_iter().eq(data.clone().into_iter().filter(|x| x.0 < key))); assert!(right.into_iter().eq(data.into_iter().filter(|x| x.0 >= key))); } - -mod bench { - use std::collections::BTreeMap; - use std::__rand::{Rng, thread_rng}; - - use test::{Bencher, black_box}; - - map_insert_rand_bench!{insert_rand_100, 100, BTreeMap} - map_insert_rand_bench!{insert_rand_10_000, 10_000, BTreeMap} - - map_insert_seq_bench!{insert_seq_100, 100, BTreeMap} - map_insert_seq_bench!{insert_seq_10_000, 10_000, BTreeMap} - - map_find_rand_bench!{find_rand_100, 100, BTreeMap} - map_find_rand_bench!{find_rand_10_000, 10_000, BTreeMap} - - map_find_seq_bench!{find_seq_100, 100, BTreeMap} - map_find_seq_bench!{find_seq_10_000, 10_000, BTreeMap} - - fn bench_iter(b: &mut Bencher, size: i32) { - let mut map = BTreeMap::::new(); - let mut rng = thread_rng(); - - for _ in 0..size { - map.insert(rng.gen(), rng.gen()); - } - - b.iter(|| { - for entry in &map { - black_box(entry); - } - }); - } - - #[bench] - pub fn iter_20(b: &mut Bencher) { - bench_iter(b, 20); - } - - #[bench] - pub fn iter_1000(b: &mut Bencher) { - bench_iter(b, 1000); - } - - #[bench] - pub fn iter_100000(b: &mut Bencher) { - bench_iter(b, 100000); - } -} diff --git a/src/libcollectionstest/lib.rs b/src/libcollectionstest/lib.rs index b146672893f..57e3c2df059 100644 --- a/src/libcollectionstest/lib.rs +++ b/src/libcollectionstest/lib.rs @@ -35,10 +35,6 @@ extern crate std_unicode; use std::hash::{Hash, Hasher}; use std::collections::hash_map::DefaultHasher; -#[cfg(test)] -#[macro_use] -mod bench; - mod binary_heap; mod btree; mod cow_str; diff --git a/src/libcollectionstest/linked_list.rs b/src/libcollectionstest/linked_list.rs index 956d75a95a5..a59724a017b 100644 --- a/src/libcollectionstest/linked_list.rs +++ b/src/libcollectionstest/linked_list.rs @@ -10,8 +10,6 @@ use std::collections::LinkedList; -use test; - #[test] fn test_basic() { let mut m = LinkedList::>::new(); @@ -356,81 +354,6 @@ fn test_extend() { assert!(a.iter().eq(&[1, 2, 3, 4, 5, 6, 7])); } -#[bench] -fn bench_collect_into(b: &mut test::Bencher) { - let v = &[0; 64]; - b.iter(|| { - let _: LinkedList<_> = v.iter().cloned().collect(); - }) -} - -#[bench] -fn bench_push_front(b: &mut test::Bencher) { - let mut m: LinkedList<_> = LinkedList::new(); - b.iter(|| { - m.push_front(0); - }) -} - -#[bench] -fn bench_push_back(b: &mut test::Bencher) { - let mut m: LinkedList<_> = LinkedList::new(); - b.iter(|| { - m.push_back(0); - }) -} - -#[bench] -fn bench_push_back_pop_back(b: &mut test::Bencher) { - let mut m: LinkedList<_> = LinkedList::new(); - b.iter(|| { - m.push_back(0); - m.pop_back(); - }) -} - -#[bench] -fn bench_push_front_pop_front(b: &mut test::Bencher) { - let mut m: LinkedList<_> = LinkedList::new(); - b.iter(|| { - m.push_front(0); - m.pop_front(); - }) -} - -#[bench] -fn bench_iter(b: &mut test::Bencher) { - let v = &[0; 128]; - let m: LinkedList<_> = v.iter().cloned().collect(); - b.iter(|| { - assert!(m.iter().count() == 128); - }) -} -#[bench] -fn bench_iter_mut(b: &mut test::Bencher) { - let v = &[0; 128]; - let mut m: LinkedList<_> = v.iter().cloned().collect(); - b.iter(|| { - assert!(m.iter_mut().count() == 128); - }) -} -#[bench] -fn bench_iter_rev(b: &mut test::Bencher) { - let v = &[0; 128]; - let m: LinkedList<_> = v.iter().cloned().collect(); - b.iter(|| { - assert!(m.iter().rev().count() == 128); - }) -} -#[bench] -fn bench_iter_mut_rev(b: &mut test::Bencher) { - let v = &[0; 128]; - let mut m: LinkedList<_> = v.iter().cloned().collect(); - b.iter(|| { - assert!(m.iter_mut().rev().count() == 128); - }) -} - #[test] fn test_contains() { let mut l = LinkedList::new(); diff --git a/src/libcollectionstest/slice.rs b/src/libcollectionstest/slice.rs index b9dec6be7b8..a7f7baf3851 100644 --- a/src/libcollectionstest/slice.rs +++ b/src/libcollectionstest/slice.rs @@ -1170,276 +1170,3 @@ fn test_copy_from_slice_dst_shorter() { let mut dst = [0; 3]; dst.copy_from_slice(&src); } - -mod bench { - use std::{mem, ptr}; - use std::__rand::{Rng, thread_rng}; - - use test::{Bencher, black_box}; - - #[bench] - fn iterator(b: &mut Bencher) { - // peculiar numbers to stop LLVM from optimising the summation - // out. - let v: Vec<_> = (0..100).map(|i| i ^ (i << 1) ^ (i >> 1)).collect(); - - b.iter(|| { - let mut sum = 0; - for x in &v { - sum += *x; - } - // sum == 11806, to stop dead code elimination. - if sum == 0 { - panic!() - } - }) - } - - #[bench] - fn mut_iterator(b: &mut Bencher) { - let mut v = vec![0; 100]; - - b.iter(|| { - let mut i = 0; - for x in &mut v { - *x = i; - i += 1; - } - }) - } - - #[bench] - fn concat(b: &mut Bencher) { - let xss: Vec> = (0..100).map(|i| (0..i).collect()).collect(); - b.iter(|| { - xss.concat(); - }); - } - - #[bench] - fn join(b: &mut Bencher) { - let xss: Vec> = (0..100).map(|i| (0..i).collect()).collect(); - b.iter(|| xss.join(&0)); - } - - #[bench] - fn push(b: &mut Bencher) { - let mut vec = Vec::::new(); - b.iter(|| { - vec.push(0); - black_box(&vec); - }); - } - - #[bench] - fn starts_with_same_vector(b: &mut Bencher) { - let vec: Vec<_> = (0..100).collect(); - b.iter(|| vec.starts_with(&vec)) - } - - #[bench] - fn starts_with_single_element(b: &mut Bencher) { - let vec: Vec<_> = vec![0]; - b.iter(|| vec.starts_with(&vec)) - } - - #[bench] - fn starts_with_diff_one_element_at_end(b: &mut Bencher) { - let vec: Vec<_> = (0..100).collect(); - let mut match_vec: Vec<_> = (0..99).collect(); - match_vec.push(0); - b.iter(|| vec.starts_with(&match_vec)) - } - - #[bench] - fn ends_with_same_vector(b: &mut Bencher) { - let vec: Vec<_> = (0..100).collect(); - b.iter(|| vec.ends_with(&vec)) - } - - #[bench] - fn ends_with_single_element(b: &mut Bencher) { - let vec: Vec<_> = vec![0]; - b.iter(|| vec.ends_with(&vec)) - } - - #[bench] - fn ends_with_diff_one_element_at_beginning(b: &mut Bencher) { - let vec: Vec<_> = (0..100).collect(); - let mut match_vec: Vec<_> = (0..100).collect(); - match_vec[0] = 200; - b.iter(|| vec.starts_with(&match_vec)) - } - - #[bench] - fn contains_last_element(b: &mut Bencher) { - let vec: Vec<_> = (0..100).collect(); - b.iter(|| vec.contains(&99)) - } - - #[bench] - fn zero_1kb_from_elem(b: &mut Bencher) { - b.iter(|| vec![0u8; 1024]); - } - - #[bench] - fn zero_1kb_set_memory(b: &mut Bencher) { - b.iter(|| { - let mut v = Vec::::with_capacity(1024); - unsafe { - let vp = v.as_mut_ptr(); - ptr::write_bytes(vp, 0, 1024); - v.set_len(1024); - } - v - }); - } - - #[bench] - fn zero_1kb_loop_set(b: &mut Bencher) { - b.iter(|| { - let mut v = Vec::::with_capacity(1024); - unsafe { - v.set_len(1024); - } - for i in 0..1024 { - v[i] = 0; - } - }); - } - - #[bench] - fn zero_1kb_mut_iter(b: &mut Bencher) { - b.iter(|| { - let mut v = Vec::::with_capacity(1024); - unsafe { - v.set_len(1024); - } - for x in &mut v { - *x = 0; - } - v - }); - } - - #[bench] - fn random_inserts(b: &mut Bencher) { - let mut rng = thread_rng(); - b.iter(|| { - let mut v = vec![(0, 0); 30]; - for _ in 0..100 { - let l = v.len(); - v.insert(rng.gen::() % (l + 1), (1, 1)); - } - }) - } - #[bench] - fn random_removes(b: &mut Bencher) { - let mut rng = thread_rng(); - b.iter(|| { - let mut v = vec![(0, 0); 130]; - for _ in 0..100 { - let l = v.len(); - v.remove(rng.gen::() % l); - } - }) - } - - fn gen_ascending(len: usize) -> Vec { - (0..len as u64).collect() - } - - fn gen_descending(len: usize) -> Vec { - (0..len as u64).rev().collect() - } - - fn gen_random(len: usize) -> Vec { - let mut rng = thread_rng(); - rng.gen_iter::().take(len).collect() - } - - fn gen_mostly_ascending(len: usize) -> Vec { - let mut rng = thread_rng(); - let mut v = gen_ascending(len); - for _ in (0usize..).take_while(|x| x * x <= len) { - let x = rng.gen::() % len; - let y = rng.gen::() % len; - v.swap(x, y); - } - v - } - - fn gen_mostly_descending(len: usize) -> Vec { - let mut rng = thread_rng(); - let mut v = gen_descending(len); - for _ in (0usize..).take_while(|x| x * x <= len) { - let x = rng.gen::() % len; - let y = rng.gen::() % len; - v.swap(x, y); - } - v - } - - fn gen_big_random(len: usize) -> Vec<[u64; 16]> { - let mut rng = thread_rng(); - rng.gen_iter().map(|x| [x; 16]).take(len).collect() - } - - fn gen_big_ascending(len: usize) -> Vec<[u64; 16]> { - (0..len as u64).map(|x| [x; 16]).take(len).collect() - } - - fn gen_big_descending(len: usize) -> Vec<[u64; 16]> { - (0..len as u64).rev().map(|x| [x; 16]).take(len).collect() - } - - macro_rules! sort_bench { - ($name:ident, $gen:expr, $len:expr) => { - #[bench] - fn $name(b: &mut Bencher) { - b.iter(|| $gen($len).sort()); - b.bytes = $len * mem::size_of_val(&$gen(1)[0]) as u64; - } - } - } - - sort_bench!(sort_small_random, gen_random, 10); - sort_bench!(sort_small_ascending, gen_ascending, 10); - sort_bench!(sort_small_descending, gen_descending, 10); - - sort_bench!(sort_small_big_random, gen_big_random, 10); - sort_bench!(sort_small_big_ascending, gen_big_ascending, 10); - sort_bench!(sort_small_big_descending, gen_big_descending, 10); - - sort_bench!(sort_medium_random, gen_random, 100); - sort_bench!(sort_medium_ascending, gen_ascending, 100); - sort_bench!(sort_medium_descending, gen_descending, 100); - - sort_bench!(sort_large_random, gen_random, 10000); - sort_bench!(sort_large_ascending, gen_ascending, 10000); - sort_bench!(sort_large_descending, gen_descending, 10000); - sort_bench!(sort_large_mostly_ascending, gen_mostly_ascending, 10000); - sort_bench!(sort_large_mostly_descending, gen_mostly_descending, 10000); - - sort_bench!(sort_large_big_random, gen_big_random, 10000); - sort_bench!(sort_large_big_ascending, gen_big_ascending, 10000); - sort_bench!(sort_large_big_descending, gen_big_descending, 10000); - - #[bench] - fn sort_large_random_expensive(b: &mut Bencher) { - let len = 10000; - b.iter(|| { - let mut v = gen_random(len); - let mut count = 0; - v.sort_by(|a: &u64, b: &u64| { - count += 1; - if count % 1_000_000_000 == 0 { - panic!("should not happen"); - } - (*a as f64).cos().partial_cmp(&(*b as f64).cos()).unwrap() - }); - black_box(count); - }); - b.bytes = len as u64 * mem::size_of::() as u64; - } -} diff --git a/src/libcollectionstest/str.rs b/src/libcollectionstest/str.rs index 5e685847e3c..6221888f5e5 100644 --- a/src/libcollectionstest/str.rs +++ b/src/libcollectionstest/str.rs @@ -1564,294 +1564,3 @@ fn different_str_pattern_forwarding_lifetimes() { foo::<&str>("x"); } - -mod bench { - use test::{Bencher, black_box}; - - #[bench] - fn char_iterator(b: &mut Bencher) { - let s = "ศไทย中华Việt Nam; Mary had a little lamb, Little lamb"; - - b.iter(|| s.chars().count()); - } - - #[bench] - fn char_iterator_for(b: &mut Bencher) { - let s = "ศไทย中华Việt Nam; Mary had a little lamb, Little lamb"; - - b.iter(|| { - for ch in s.chars() { black_box(ch); } - }); - } - - #[bench] - fn char_iterator_ascii(b: &mut Bencher) { - let s = "Mary had a little lamb, Little lamb - Mary had a little lamb, Little lamb - Mary had a little lamb, Little lamb - Mary had a little lamb, Little lamb - Mary had a little lamb, Little lamb - Mary had a little lamb, Little lamb"; - - b.iter(|| s.chars().count()); - } - - #[bench] - fn char_iterator_rev(b: &mut Bencher) { - let s = "ศไทย中华Việt Nam; Mary had a little lamb, Little lamb"; - - b.iter(|| s.chars().rev().count()); - } - - #[bench] - fn char_iterator_rev_for(b: &mut Bencher) { - let s = "ศไทย中华Việt Nam; Mary had a little lamb, Little lamb"; - - b.iter(|| { - for ch in s.chars().rev() { black_box(ch); } - }); - } - - #[bench] - fn char_indicesator(b: &mut Bencher) { - let s = "ศไทย中华Việt Nam; Mary had a little lamb, Little lamb"; - let len = s.chars().count(); - - b.iter(|| assert_eq!(s.char_indices().count(), len)); - } - - #[bench] - fn char_indicesator_rev(b: &mut Bencher) { - let s = "ศไทย中华Việt Nam; Mary had a little lamb, Little lamb"; - let len = s.chars().count(); - - b.iter(|| assert_eq!(s.char_indices().rev().count(), len)); - } - - #[bench] - fn split_unicode_ascii(b: &mut Bencher) { - let s = "ประเทศไทย中华Việt Namประเทศไทย中华Việt Nam"; - - b.iter(|| assert_eq!(s.split('V').count(), 3)); - } - - #[bench] - fn split_ascii(b: &mut Bencher) { - let s = "Mary had a little lamb, Little lamb, little-lamb."; - let len = s.split(' ').count(); - - b.iter(|| assert_eq!(s.split(' ').count(), len)); - } - - #[bench] - fn split_extern_fn(b: &mut Bencher) { - let s = "Mary had a little lamb, Little lamb, little-lamb."; - let len = s.split(' ').count(); - fn pred(c: char) -> bool { c == ' ' } - - b.iter(|| assert_eq!(s.split(pred).count(), len)); - } - - #[bench] - fn split_closure(b: &mut Bencher) { - let s = "Mary had a little lamb, Little lamb, little-lamb."; - let len = s.split(' ').count(); - - b.iter(|| assert_eq!(s.split(|c: char| c == ' ').count(), len)); - } - - #[bench] - fn split_slice(b: &mut Bencher) { - let s = "Mary had a little lamb, Little lamb, little-lamb."; - let len = s.split(' ').count(); - - let c: &[char] = &[' ']; - b.iter(|| assert_eq!(s.split(c).count(), len)); - } - - #[bench] - fn bench_join(b: &mut Bencher) { - let s = "ศไทย中华Việt Nam; Mary had a little lamb, Little lamb"; - let sep = "→"; - let v = vec![s, s, s, s, s, s, s, s, s, s]; - b.iter(|| { - assert_eq!(v.join(sep).len(), s.len() * 10 + sep.len() * 9); - }) - } - - #[bench] - fn bench_contains_short_short(b: &mut Bencher) { - let haystack = "Lorem ipsum dolor sit amet, consectetur adipiscing elit."; - let needle = "sit"; - - b.iter(|| { - assert!(haystack.contains(needle)); - }) - } - - #[bench] - fn bench_contains_short_long(b: &mut Bencher) { - let haystack = "\ -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse quis lorem sit amet dolor \ -ultricies condimentum. Praesent iaculis purus elit, ac malesuada quam malesuada in. Duis sed orci \ -eros. Suspendisse sit amet magna mollis, mollis nunc luctus, imperdiet mi. Integer fringilla non \ -sem ut lacinia. Fusce varius tortor a risus porttitor hendrerit. Morbi mauris dui, ultricies nec \ -tempus vel, gravida nec quam. - -In est dui, tincidunt sed tempus interdum, adipiscing laoreet ante. Etiam tempor, tellus quis \ -sagittis interdum, nulla purus mattis sem, quis auctor erat odio ac tellus. In nec nunc sit amet \ -diam volutpat molestie at sed ipsum. Vestibulum laoreet consequat vulputate. Integer accumsan \ -lorem ac dignissim placerat. Suspendisse convallis faucibus lorem. Aliquam erat volutpat. In vel \ -eleifend felis. Sed suscipit nulla lorem, sed mollis est sollicitudin et. Nam fermentum egestas \ -interdum. Curabitur ut nisi justo. - -Sed sollicitudin ipsum tellus, ut condimentum leo eleifend nec. Cras ut velit ante. Phasellus nec \ -mollis odio. Mauris molestie erat in arcu mattis, at aliquet dolor vehicula. Quisque malesuada \ -lectus sit amet nisi pretium, a condimentum ipsum porta. Morbi at dapibus diam. Praesent egestas \ -est sed risus elementum, eu rutrum metus ultrices. Etiam fermentum consectetur magna, id rutrum \ -felis accumsan a. Aliquam ut pellentesque libero. Sed mi nulla, lobortis eu tortor id, suscipit \ -ultricies neque. Morbi iaculis sit amet risus at iaculis. Praesent eget ligula quis turpis \ -feugiat suscipit vel non arcu. Interdum et malesuada fames ac ante ipsum primis in faucibus. \ -Aliquam sit amet placerat lorem. - -Cras a lacus vel ante posuere elementum. Nunc est leo, bibendum ut facilisis vel, bibendum at \ -mauris. Nullam adipiscing diam vel odio ornare, luctus adipiscing mi luctus. Nulla facilisi. \ -Mauris adipiscing bibendum neque, quis adipiscing lectus tempus et. Sed feugiat erat et nisl \ -lobortis pharetra. Donec vitae erat enim. Nullam sit amet felis et quam lacinia tincidunt. Aliquam \ -suscipit dapibus urna. Sed volutpat urna in magna pulvinar volutpat. Phasellus nec tellus ac diam \ -cursus accumsan. - -Nam lectus enim, dapibus non nisi tempor, consectetur convallis massa. Maecenas eleifend dictum \ -feugiat. Etiam quis mauris vel risus luctus mattis a a nunc. Nullam orci quam, imperdiet id \ -vehicula in, porttitor ut nibh. Duis sagittis adipiscing nisl vitae congue. Donec mollis risus eu \ -leo suscipit, varius porttitor nulla porta. Pellentesque ut sem nec nisi euismod vehicula. Nulla \ -malesuada sollicitudin quam eu fermentum."; - let needle = "english"; - - b.iter(|| { - assert!(!haystack.contains(needle)); - }) - } - - #[bench] - fn bench_contains_bad_naive(b: &mut Bencher) { - let haystack = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; - let needle = "aaaaaaaab"; - - b.iter(|| { - assert!(!haystack.contains(needle)); - }) - } - - #[bench] - fn bench_contains_equal(b: &mut Bencher) { - let haystack = "Lorem ipsum dolor sit amet, consectetur adipiscing elit."; - let needle = "Lorem ipsum dolor sit amet, consectetur adipiscing elit."; - - b.iter(|| { - assert!(haystack.contains(needle)); - }) - } - - macro_rules! make_test_inner { - ($s:ident, $code:expr, $name:ident, $str:expr) => { - #[bench] - fn $name(bencher: &mut Bencher) { - let mut $s = $str; - black_box(&mut $s); - bencher.iter(|| $code); - } - } - } - - macro_rules! make_test { - ($name:ident, $s:ident, $code:expr) => { - mod $name { - use test::Bencher; - use test::black_box; - - // Short strings: 65 bytes each - make_test_inner!($s, $code, short_ascii, - "Mary had a little lamb, Little lamb Mary had a littl lamb, lamb!"); - make_test_inner!($s, $code, short_mixed, - "ศไทย中华Việt Nam; Mary had a little lamb, Little lam!"); - make_test_inner!($s, $code, short_pile_of_poo, - "💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩!"); - make_test_inner!($s, $code, long_lorem_ipsum,"\ -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse quis lorem sit amet dolor \ -ultricies condimentum. Praesent iaculis purus elit, ac malesuada quam malesuada in. Duis sed orci \ -eros. Suspendisse sit amet magna mollis, mollis nunc luctus, imperdiet mi. Integer fringilla non \ -sem ut lacinia. Fusce varius tortor a risus porttitor hendrerit. Morbi mauris dui, ultricies nec \ -tempus vel, gravida nec quam. - -In est dui, tincidunt sed tempus interdum, adipiscing laoreet ante. Etiam tempor, tellus quis \ -sagittis interdum, nulla purus mattis sem, quis auctor erat odio ac tellus. In nec nunc sit amet \ -diam volutpat molestie at sed ipsum. Vestibulum laoreet consequat vulputate. Integer accumsan \ -lorem ac dignissim placerat. Suspendisse convallis faucibus lorem. Aliquam erat volutpat. In vel \ -eleifend felis. Sed suscipit nulla lorem, sed mollis est sollicitudin et. Nam fermentum egestas \ -interdum. Curabitur ut nisi justo. - -Sed sollicitudin ipsum tellus, ut condimentum leo eleifend nec. Cras ut velit ante. Phasellus nec \ -mollis odio. Mauris molestie erat in arcu mattis, at aliquet dolor vehicula. Quisque malesuada \ -lectus sit amet nisi pretium, a condimentum ipsum porta. Morbi at dapibus diam. Praesent egestas \ -est sed risus elementum, eu rutrum metus ultrices. Etiam fermentum consectetur magna, id rutrum \ -felis accumsan a. Aliquam ut pellentesque libero. Sed mi nulla, lobortis eu tortor id, suscipit \ -ultricies neque. Morbi iaculis sit amet risus at iaculis. Praesent eget ligula quis turpis \ -feugiat suscipit vel non arcu. Interdum et malesuada fames ac ante ipsum primis in faucibus. \ -Aliquam sit amet placerat lorem. - -Cras a lacus vel ante posuere elementum. Nunc est leo, bibendum ut facilisis vel, bibendum at \ -mauris. Nullam adipiscing diam vel odio ornare, luctus adipiscing mi luctus. Nulla facilisi. \ -Mauris adipiscing bibendum neque, quis adipiscing lectus tempus et. Sed feugiat erat et nisl \ -lobortis pharetra. Donec vitae erat enim. Nullam sit amet felis et quam lacinia tincidunt. Aliquam \ -suscipit dapibus urna. Sed volutpat urna in magna pulvinar volutpat. Phasellus nec tellus ac diam \ -cursus accumsan. - -Nam lectus enim, dapibus non nisi tempor, consectetur convallis massa. Maecenas eleifend dictum \ -feugiat. Etiam quis mauris vel risus luctus mattis a a nunc. Nullam orci quam, imperdiet id \ -vehicula in, porttitor ut nibh. Duis sagittis adipiscing nisl vitae congue. Donec mollis risus eu \ -leo suscipit, varius porttitor nulla porta. Pellentesque ut sem nec nisi euismod vehicula. Nulla \ -malesuada sollicitudin quam eu fermentum!"); - } - } - } - - make_test!(chars_count, s, s.chars().count()); - - make_test!(contains_bang_str, s, s.contains("!")); - make_test!(contains_bang_char, s, s.contains('!')); - - make_test!(match_indices_a_str, s, s.match_indices("a").count()); - - make_test!(split_a_str, s, s.split("a").count()); - - make_test!(trim_ascii_char, s, { - use std::ascii::AsciiExt; - s.trim_matches(|c: char| c.is_ascii()) - }); - make_test!(trim_left_ascii_char, s, { - use std::ascii::AsciiExt; - s.trim_left_matches(|c: char| c.is_ascii()) - }); - make_test!(trim_right_ascii_char, s, { - use std::ascii::AsciiExt; - s.trim_right_matches(|c: char| c.is_ascii()) - }); - - make_test!(find_underscore_char, s, s.find('_')); - make_test!(rfind_underscore_char, s, s.rfind('_')); - make_test!(find_underscore_str, s, s.find("_")); - - make_test!(find_zzz_char, s, s.find('\u{1F4A4}')); - make_test!(rfind_zzz_char, s, s.rfind('\u{1F4A4}')); - make_test!(find_zzz_str, s, s.find("\u{1F4A4}")); - - make_test!(split_space_char, s, s.split(' ').count()); - make_test!(split_terminator_space_char, s, s.split_terminator(' ').count()); - - make_test!(splitn_space_char, s, s.splitn(10, ' ').count()); - make_test!(rsplitn_space_char, s, s.rsplitn(10, ' ').count()); - - make_test!(split_space_str, s, s.split(" ").count()); - make_test!(split_ad_str, s, s.split("ad").count()); -} diff --git a/src/libcollectionstest/string.rs b/src/libcollectionstest/string.rs index a7d85d0bea1..f77dd510303 100644 --- a/src/libcollectionstest/string.rs +++ b/src/libcollectionstest/string.rs @@ -9,9 +9,6 @@ // except according to those terms. use std::borrow::Cow; -use std::iter::repeat; - -use test::Bencher; pub trait IntoCow<'a, B: ?Sized> where B: ToOwned { fn into_cow(self) -> Cow<'a, B>; @@ -436,125 +433,3 @@ fn test_into_boxed_str() { let ys = xs.into_boxed_str(); assert_eq!(&*ys, "hello my name is bob"); } - -#[bench] -fn bench_with_capacity(b: &mut Bencher) { - b.iter(|| String::with_capacity(100)); -} - -#[bench] -fn bench_push_str(b: &mut Bencher) { - let s = "ศไทย中华Việt Nam; Mary had a little lamb, Little lamb"; - b.iter(|| { - let mut r = String::new(); - r.push_str(s); - }); -} - -const REPETITIONS: u64 = 10_000; - -#[bench] -fn bench_push_str_one_byte(b: &mut Bencher) { - b.bytes = REPETITIONS; - b.iter(|| { - let mut r = String::new(); - for _ in 0..REPETITIONS { - r.push_str("a") - } - }); -} - -#[bench] -fn bench_push_char_one_byte(b: &mut Bencher) { - b.bytes = REPETITIONS; - b.iter(|| { - let mut r = String::new(); - for _ in 0..REPETITIONS { - r.push('a') - } - }); -} - -#[bench] -fn bench_push_char_two_bytes(b: &mut Bencher) { - b.bytes = REPETITIONS * 2; - b.iter(|| { - let mut r = String::new(); - for _ in 0..REPETITIONS { - r.push('â') - } - }); -} - -#[bench] -fn from_utf8_lossy_100_ascii(b: &mut Bencher) { - let s = b"Hello there, the quick brown fox jumped over the lazy dog! \ - Lorem ipsum dolor sit amet, consectetur. "; - - assert_eq!(100, s.len()); - b.iter(|| { - let _ = String::from_utf8_lossy(s); - }); -} - -#[bench] -fn from_utf8_lossy_100_multibyte(b: &mut Bencher) { - let s = "𐌀𐌖𐌋𐌄𐌑𐌉ปรدولة الكويتทศไทย中华𐍅𐌿𐌻𐍆𐌹𐌻𐌰".as_bytes(); - assert_eq!(100, s.len()); - b.iter(|| { - let _ = String::from_utf8_lossy(s); - }); -} - -#[bench] -fn from_utf8_lossy_invalid(b: &mut Bencher) { - let s = b"Hello\xC0\x80 There\xE6\x83 Goodbye"; - b.iter(|| { - let _ = String::from_utf8_lossy(s); - }); -} - -#[bench] -fn from_utf8_lossy_100_invalid(b: &mut Bencher) { - let s = repeat(0xf5).take(100).collect::>(); - b.iter(|| { - let _ = String::from_utf8_lossy(&s); - }); -} - -#[bench] -fn bench_exact_size_shrink_to_fit(b: &mut Bencher) { - let s = "Hello there, the quick brown fox jumped over the lazy dog! \ - Lorem ipsum dolor sit amet, consectetur. "; - // ensure our operation produces an exact-size string before we benchmark it - let mut r = String::with_capacity(s.len()); - r.push_str(s); - assert_eq!(r.len(), r.capacity()); - b.iter(|| { - let mut r = String::with_capacity(s.len()); - r.push_str(s); - r.shrink_to_fit(); - r - }); -} - -#[bench] -fn bench_from_str(b: &mut Bencher) { - let s = "Hello there, the quick brown fox jumped over the lazy dog! \ - Lorem ipsum dolor sit amet, consectetur. "; - b.iter(|| String::from(s)) -} - -#[bench] -fn bench_from(b: &mut Bencher) { - let s = "Hello there, the quick brown fox jumped over the lazy dog! \ - Lorem ipsum dolor sit amet, consectetur. "; - b.iter(|| String::from(s)) -} - -#[bench] -fn bench_to_string(b: &mut Bencher) { - let s = "Hello there, the quick brown fox jumped over the lazy dog! \ - Lorem ipsum dolor sit amet, consectetur. "; - b.iter(|| s.to_string()) -} diff --git a/src/libcollectionstest/vec.rs b/src/libcollectionstest/vec.rs index 6d0f1eaffaa..edeedf1d40b 100644 --- a/src/libcollectionstest/vec.rs +++ b/src/libcollectionstest/vec.rs @@ -10,13 +10,10 @@ use std::ascii::AsciiExt; use std::borrow::Cow; -use std::iter::{FromIterator, repeat}; use std::mem::size_of; use std::panic; use std::vec::{Drain, IntoIter}; -use test::Bencher; - struct DropCounter<'a> { count: &'a mut u32, } @@ -633,483 +630,3 @@ fn test_placement_panic() { let _ = panic::catch_unwind(panic::AssertUnwindSafe(|| { vec.place_back() <- mkpanic(); })); assert_eq!(vec.len(), 3); } - -#[bench] -fn bench_new(b: &mut Bencher) { - b.iter(|| { - let v: Vec = Vec::new(); - assert_eq!(v.len(), 0); - assert_eq!(v.capacity(), 0); - }) -} - -fn do_bench_with_capacity(b: &mut Bencher, src_len: usize) { - b.bytes = src_len as u64; - - b.iter(|| { - let v: Vec = Vec::with_capacity(src_len); - assert_eq!(v.len(), 0); - assert_eq!(v.capacity(), src_len); - }) -} - -#[bench] -fn bench_with_capacity_0000(b: &mut Bencher) { - do_bench_with_capacity(b, 0) -} - -#[bench] -fn bench_with_capacity_0010(b: &mut Bencher) { - do_bench_with_capacity(b, 10) -} - -#[bench] -fn bench_with_capacity_0100(b: &mut Bencher) { - do_bench_with_capacity(b, 100) -} - -#[bench] -fn bench_with_capacity_1000(b: &mut Bencher) { - do_bench_with_capacity(b, 1000) -} - -fn do_bench_from_fn(b: &mut Bencher, src_len: usize) { - b.bytes = src_len as u64; - - b.iter(|| { - let dst = (0..src_len).collect::>(); - assert_eq!(dst.len(), src_len); - assert!(dst.iter().enumerate().all(|(i, x)| i == *x)); - }) -} - -#[bench] -fn bench_from_fn_0000(b: &mut Bencher) { - do_bench_from_fn(b, 0) -} - -#[bench] -fn bench_from_fn_0010(b: &mut Bencher) { - do_bench_from_fn(b, 10) -} - -#[bench] -fn bench_from_fn_0100(b: &mut Bencher) { - do_bench_from_fn(b, 100) -} - -#[bench] -fn bench_from_fn_1000(b: &mut Bencher) { - do_bench_from_fn(b, 1000) -} - -fn do_bench_from_elem(b: &mut Bencher, src_len: usize) { - b.bytes = src_len as u64; - - b.iter(|| { - let dst: Vec = repeat(5).take(src_len).collect(); - assert_eq!(dst.len(), src_len); - assert!(dst.iter().all(|x| *x == 5)); - }) -} - -#[bench] -fn bench_from_elem_0000(b: &mut Bencher) { - do_bench_from_elem(b, 0) -} - -#[bench] -fn bench_from_elem_0010(b: &mut Bencher) { - do_bench_from_elem(b, 10) -} - -#[bench] -fn bench_from_elem_0100(b: &mut Bencher) { - do_bench_from_elem(b, 100) -} - -#[bench] -fn bench_from_elem_1000(b: &mut Bencher) { - do_bench_from_elem(b, 1000) -} - -fn do_bench_from_slice(b: &mut Bencher, src_len: usize) { - let src: Vec<_> = FromIterator::from_iter(0..src_len); - - b.bytes = src_len as u64; - - b.iter(|| { - let dst = src.clone()[..].to_vec(); - assert_eq!(dst.len(), src_len); - assert!(dst.iter().enumerate().all(|(i, x)| i == *x)); - }); -} - -#[bench] -fn bench_from_slice_0000(b: &mut Bencher) { - do_bench_from_slice(b, 0) -} - -#[bench] -fn bench_from_slice_0010(b: &mut Bencher) { - do_bench_from_slice(b, 10) -} - -#[bench] -fn bench_from_slice_0100(b: &mut Bencher) { - do_bench_from_slice(b, 100) -} - -#[bench] -fn bench_from_slice_1000(b: &mut Bencher) { - do_bench_from_slice(b, 1000) -} - -fn do_bench_from_iter(b: &mut Bencher, src_len: usize) { - let src: Vec<_> = FromIterator::from_iter(0..src_len); - - b.bytes = src_len as u64; - - b.iter(|| { - let dst: Vec<_> = FromIterator::from_iter(src.clone()); - assert_eq!(dst.len(), src_len); - assert!(dst.iter().enumerate().all(|(i, x)| i == *x)); - }); -} - -#[bench] -fn bench_from_iter_0000(b: &mut Bencher) { - do_bench_from_iter(b, 0) -} - -#[bench] -fn bench_from_iter_0010(b: &mut Bencher) { - do_bench_from_iter(b, 10) -} - -#[bench] -fn bench_from_iter_0100(b: &mut Bencher) { - do_bench_from_iter(b, 100) -} - -#[bench] -fn bench_from_iter_1000(b: &mut Bencher) { - do_bench_from_iter(b, 1000) -} - -fn do_bench_extend(b: &mut Bencher, dst_len: usize, src_len: usize) { - let dst: Vec<_> = FromIterator::from_iter(0..dst_len); - let src: Vec<_> = FromIterator::from_iter(dst_len..dst_len + src_len); - - b.bytes = src_len as u64; - - b.iter(|| { - let mut dst = dst.clone(); - dst.extend(src.clone()); - assert_eq!(dst.len(), dst_len + src_len); - assert!(dst.iter().enumerate().all(|(i, x)| i == *x)); - }); -} - -#[bench] -fn bench_extend_0000_0000(b: &mut Bencher) { - do_bench_extend(b, 0, 0) -} - -#[bench] -fn bench_extend_0000_0010(b: &mut Bencher) { - do_bench_extend(b, 0, 10) -} - -#[bench] -fn bench_extend_0000_0100(b: &mut Bencher) { - do_bench_extend(b, 0, 100) -} - -#[bench] -fn bench_extend_0000_1000(b: &mut Bencher) { - do_bench_extend(b, 0, 1000) -} - -#[bench] -fn bench_extend_0010_0010(b: &mut Bencher) { - do_bench_extend(b, 10, 10) -} - -#[bench] -fn bench_extend_0100_0100(b: &mut Bencher) { - do_bench_extend(b, 100, 100) -} - -#[bench] -fn bench_extend_1000_1000(b: &mut Bencher) { - do_bench_extend(b, 1000, 1000) -} - -fn do_bench_push_all(b: &mut Bencher, dst_len: usize, src_len: usize) { - let dst: Vec<_> = FromIterator::from_iter(0..dst_len); - let src: Vec<_> = FromIterator::from_iter(dst_len..dst_len + src_len); - - b.bytes = src_len as u64; - - b.iter(|| { - let mut dst = dst.clone(); - dst.extend_from_slice(&src); - assert_eq!(dst.len(), dst_len + src_len); - assert!(dst.iter().enumerate().all(|(i, x)| i == *x)); - }); -} - -#[bench] -fn bench_push_all_0000_0000(b: &mut Bencher) { - do_bench_push_all(b, 0, 0) -} - -#[bench] -fn bench_push_all_0000_0010(b: &mut Bencher) { - do_bench_push_all(b, 0, 10) -} - -#[bench] -fn bench_push_all_0000_0100(b: &mut Bencher) { - do_bench_push_all(b, 0, 100) -} - -#[bench] -fn bench_push_all_0000_1000(b: &mut Bencher) { - do_bench_push_all(b, 0, 1000) -} - -#[bench] -fn bench_push_all_0010_0010(b: &mut Bencher) { - do_bench_push_all(b, 10, 10) -} - -#[bench] -fn bench_push_all_0100_0100(b: &mut Bencher) { - do_bench_push_all(b, 100, 100) -} - -#[bench] -fn bench_push_all_1000_1000(b: &mut Bencher) { - do_bench_push_all(b, 1000, 1000) -} - -fn do_bench_push_all_move(b: &mut Bencher, dst_len: usize, src_len: usize) { - let dst: Vec<_> = FromIterator::from_iter(0..dst_len); - let src: Vec<_> = FromIterator::from_iter(dst_len..dst_len + src_len); - - b.bytes = src_len as u64; - - b.iter(|| { - let mut dst = dst.clone(); - dst.extend(src.clone()); - assert_eq!(dst.len(), dst_len + src_len); - assert!(dst.iter().enumerate().all(|(i, x)| i == *x)); - }); -} - -#[bench] -fn bench_push_all_move_0000_0000(b: &mut Bencher) { - do_bench_push_all_move(b, 0, 0) -} - -#[bench] -fn bench_push_all_move_0000_0010(b: &mut Bencher) { - do_bench_push_all_move(b, 0, 10) -} - -#[bench] -fn bench_push_all_move_0000_0100(b: &mut Bencher) { - do_bench_push_all_move(b, 0, 100) -} - -#[bench] -fn bench_push_all_move_0000_1000(b: &mut Bencher) { - do_bench_push_all_move(b, 0, 1000) -} - -#[bench] -fn bench_push_all_move_0010_0010(b: &mut Bencher) { - do_bench_push_all_move(b, 10, 10) -} - -#[bench] -fn bench_push_all_move_0100_0100(b: &mut Bencher) { - do_bench_push_all_move(b, 100, 100) -} - -#[bench] -fn bench_push_all_move_1000_1000(b: &mut Bencher) { - do_bench_push_all_move(b, 1000, 1000) -} - -fn do_bench_clone(b: &mut Bencher, src_len: usize) { - let src: Vec = FromIterator::from_iter(0..src_len); - - b.bytes = src_len as u64; - - b.iter(|| { - let dst = src.clone(); - assert_eq!(dst.len(), src_len); - assert!(dst.iter().enumerate().all(|(i, x)| i == *x)); - }); -} - -#[bench] -fn bench_clone_0000(b: &mut Bencher) { - do_bench_clone(b, 0) -} - -#[bench] -fn bench_clone_0010(b: &mut Bencher) { - do_bench_clone(b, 10) -} - -#[bench] -fn bench_clone_0100(b: &mut Bencher) { - do_bench_clone(b, 100) -} - -#[bench] -fn bench_clone_1000(b: &mut Bencher) { - do_bench_clone(b, 1000) -} - -fn do_bench_clone_from(b: &mut Bencher, times: usize, dst_len: usize, src_len: usize) { - let dst: Vec<_> = FromIterator::from_iter(0..src_len); - let src: Vec<_> = FromIterator::from_iter(dst_len..dst_len + src_len); - - b.bytes = (times * src_len) as u64; - - b.iter(|| { - let mut dst = dst.clone(); - - for _ in 0..times { - dst.clone_from(&src); - - assert_eq!(dst.len(), src_len); - assert!(dst.iter().enumerate().all(|(i, x)| dst_len + i == *x)); - } - }); -} - -#[bench] -fn bench_clone_from_01_0000_0000(b: &mut Bencher) { - do_bench_clone_from(b, 1, 0, 0) -} - -#[bench] -fn bench_clone_from_01_0000_0010(b: &mut Bencher) { - do_bench_clone_from(b, 1, 0, 10) -} - -#[bench] -fn bench_clone_from_01_0000_0100(b: &mut Bencher) { - do_bench_clone_from(b, 1, 0, 100) -} - -#[bench] -fn bench_clone_from_01_0000_1000(b: &mut Bencher) { - do_bench_clone_from(b, 1, 0, 1000) -} - -#[bench] -fn bench_clone_from_01_0010_0010(b: &mut Bencher) { - do_bench_clone_from(b, 1, 10, 10) -} - -#[bench] -fn bench_clone_from_01_0100_0100(b: &mut Bencher) { - do_bench_clone_from(b, 1, 100, 100) -} - -#[bench] -fn bench_clone_from_01_1000_1000(b: &mut Bencher) { - do_bench_clone_from(b, 1, 1000, 1000) -} - -#[bench] -fn bench_clone_from_01_0010_0100(b: &mut Bencher) { - do_bench_clone_from(b, 1, 10, 100) -} - -#[bench] -fn bench_clone_from_01_0100_1000(b: &mut Bencher) { - do_bench_clone_from(b, 1, 100, 1000) -} - -#[bench] -fn bench_clone_from_01_0010_0000(b: &mut Bencher) { - do_bench_clone_from(b, 1, 10, 0) -} - -#[bench] -fn bench_clone_from_01_0100_0010(b: &mut Bencher) { - do_bench_clone_from(b, 1, 100, 10) -} - -#[bench] -fn bench_clone_from_01_1000_0100(b: &mut Bencher) { - do_bench_clone_from(b, 1, 1000, 100) -} - -#[bench] -fn bench_clone_from_10_0000_0000(b: &mut Bencher) { - do_bench_clone_from(b, 10, 0, 0) -} - -#[bench] -fn bench_clone_from_10_0000_0010(b: &mut Bencher) { - do_bench_clone_from(b, 10, 0, 10) -} - -#[bench] -fn bench_clone_from_10_0000_0100(b: &mut Bencher) { - do_bench_clone_from(b, 10, 0, 100) -} - -#[bench] -fn bench_clone_from_10_0000_1000(b: &mut Bencher) { - do_bench_clone_from(b, 10, 0, 1000) -} - -#[bench] -fn bench_clone_from_10_0010_0010(b: &mut Bencher) { - do_bench_clone_from(b, 10, 10, 10) -} - -#[bench] -fn bench_clone_from_10_0100_0100(b: &mut Bencher) { - do_bench_clone_from(b, 10, 100, 100) -} - -#[bench] -fn bench_clone_from_10_1000_1000(b: &mut Bencher) { - do_bench_clone_from(b, 10, 1000, 1000) -} - -#[bench] -fn bench_clone_from_10_0010_0100(b: &mut Bencher) { - do_bench_clone_from(b, 10, 10, 100) -} - -#[bench] -fn bench_clone_from_10_0100_1000(b: &mut Bencher) { - do_bench_clone_from(b, 10, 100, 1000) -} - -#[bench] -fn bench_clone_from_10_0010_0000(b: &mut Bencher) { - do_bench_clone_from(b, 10, 10, 0) -} - -#[bench] -fn bench_clone_from_10_0100_0010(b: &mut Bencher) { - do_bench_clone_from(b, 10, 100, 10) -} - -#[bench] -fn bench_clone_from_10_1000_0100(b: &mut Bencher) { - do_bench_clone_from(b, 10, 1000, 100) -} diff --git a/src/libcollectionstest/vec_deque.rs b/src/libcollectionstest/vec_deque.rs index bb60f888f8b..1541061a198 100644 --- a/src/libcollectionstest/vec_deque.rs +++ b/src/libcollectionstest/vec_deque.rs @@ -12,8 +12,6 @@ use std::collections::VecDeque; use std::fmt::Debug; use std::collections::vec_deque::Drain; -use test; - use self::Taggy::*; use self::Taggypar::*; @@ -124,51 +122,6 @@ fn test_index_out_of_bounds() { deq[3]; } -#[bench] -fn bench_new(b: &mut test::Bencher) { - b.iter(|| { - let ring: VecDeque = VecDeque::new(); - test::black_box(ring); - }) -} - -#[bench] -fn bench_grow_1025(b: &mut test::Bencher) { - b.iter(|| { - let mut deq = VecDeque::new(); - for i in 0..1025 { - deq.push_front(i); - } - test::black_box(deq); - }) -} - -#[bench] -fn bench_iter_1000(b: &mut test::Bencher) { - let ring: VecDeque<_> = (0..1000).collect(); - - b.iter(|| { - let mut sum = 0; - for &i in &ring { - sum += i; - } - test::black_box(sum); - }) -} - -#[bench] -fn bench_mut_iter_1000(b: &mut test::Bencher) { - let mut ring: VecDeque<_> = (0..1000).collect(); - - b.iter(|| { - let mut sum = 0; - for i in &mut ring { - sum += *i; - } - test::black_box(sum); - }) -} - #[derive(Clone, PartialEq, Debug)] enum Taggy { One(i32), diff --git a/src/libcore/Cargo.toml b/src/libcore/Cargo.toml index 4f7cd7b016d..e847c7fa3a0 100644 --- a/src/libcore/Cargo.toml +++ b/src/libcore/Cargo.toml @@ -14,5 +14,5 @@ name = "coretest" path = "../libcoretest/lib.rs" [[bench]] -name = "corebench" -path = "../libcore/bench/lib.rs" +name = "corebenches" +path = "../libcore/benches/lib.rs" diff --git a/src/libcore/bench/any.rs b/src/libcore/benches/any.rs similarity index 100% rename from src/libcore/bench/any.rs rename to src/libcore/benches/any.rs diff --git a/src/libcore/bench/hash/mod.rs b/src/libcore/benches/hash/mod.rs similarity index 100% rename from src/libcore/bench/hash/mod.rs rename to src/libcore/benches/hash/mod.rs diff --git a/src/libcore/bench/hash/sip.rs b/src/libcore/benches/hash/sip.rs similarity index 100% rename from src/libcore/bench/hash/sip.rs rename to src/libcore/benches/hash/sip.rs diff --git a/src/libcore/bench/iter.rs b/src/libcore/benches/iter.rs similarity index 100% rename from src/libcore/bench/iter.rs rename to src/libcore/benches/iter.rs diff --git a/src/libcore/bench/lib.rs b/src/libcore/benches/lib.rs similarity index 100% rename from src/libcore/bench/lib.rs rename to src/libcore/benches/lib.rs diff --git a/src/libcore/bench/mem.rs b/src/libcore/benches/mem.rs similarity index 100% rename from src/libcore/bench/mem.rs rename to src/libcore/benches/mem.rs diff --git a/src/libcore/bench/num/dec2flt/mod.rs b/src/libcore/benches/num/dec2flt/mod.rs similarity index 100% rename from src/libcore/bench/num/dec2flt/mod.rs rename to src/libcore/benches/num/dec2flt/mod.rs diff --git a/src/libcore/bench/num/flt2dec/mod.rs b/src/libcore/benches/num/flt2dec/mod.rs similarity index 100% rename from src/libcore/bench/num/flt2dec/mod.rs rename to src/libcore/benches/num/flt2dec/mod.rs diff --git a/src/libcore/bench/num/flt2dec/strategy/dragon.rs b/src/libcore/benches/num/flt2dec/strategy/dragon.rs similarity index 100% rename from src/libcore/bench/num/flt2dec/strategy/dragon.rs rename to src/libcore/benches/num/flt2dec/strategy/dragon.rs diff --git a/src/libcore/bench/num/flt2dec/strategy/grisu.rs b/src/libcore/benches/num/flt2dec/strategy/grisu.rs similarity index 100% rename from src/libcore/bench/num/flt2dec/strategy/grisu.rs rename to src/libcore/benches/num/flt2dec/strategy/grisu.rs diff --git a/src/libcore/bench/num/mod.rs b/src/libcore/benches/num/mod.rs similarity index 100% rename from src/libcore/bench/num/mod.rs rename to src/libcore/benches/num/mod.rs diff --git a/src/libcore/bench/ops.rs b/src/libcore/benches/ops.rs similarity index 100% rename from src/libcore/bench/ops.rs rename to src/libcore/benches/ops.rs From b9757863df0c30fbff1a6b4c95c48342d25e9b4a Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Mon, 6 Feb 2017 09:37:32 -0500 Subject: [PATCH 30/70] regr test --- src/test/incremental/issue-39569.rs | 38 +++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/test/incremental/issue-39569.rs diff --git a/src/test/incremental/issue-39569.rs b/src/test/incremental/issue-39569.rs new file mode 100644 index 00000000000..55e0436f0a8 --- /dev/null +++ b/src/test/incremental/issue-39569.rs @@ -0,0 +1,38 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Regression test for a weird corner case in our dep-graph reduction +// code. When we solve `CoerceUnsized`, we find no impls, so we +// don't end up with an edge to any HIR nodes, but it still gets +// preserved in the dep graph. + +// revisions:rpass1 rpass2 +// compile-flags: -Z query-dep-graph + +use std::sync::Arc; + +#[cfg(rpass1)] +struct Foo { x: usize } + +#[cfg(rpass1)] +fn main() { + let x: Arc = Arc::new(Foo { x: 22 }); + let y: Arc = x; +} + +#[cfg(rpass2)] +struct FooX { x: usize } + +#[cfg(rpass2)] +fn main() { + let x: Arc = Arc::new(Foo { x: 22 }); + let y: Arc = x; +} + From 78f542b78a1095f71f8c0edf0638a1873346f91e Mon Sep 17 00:00:00 2001 From: "Jonathan A. Kollasch" Date: Mon, 6 Feb 2017 08:49:16 -0600 Subject: [PATCH 31/70] Rename i686-unknown-netbsdelf target to i686-unknown-netbsd --- mk/cfg/{i686-unknown-netbsdelf.mk => i686-unknown-netbsd.mk} | 0 .../{i686_unknown_netbsdelf.rs => i686_unknown_netbsd.rs} | 0 src/librustc_back/target/mod.rs | 2 +- 3 files changed, 1 insertion(+), 1 deletion(-) rename mk/cfg/{i686-unknown-netbsdelf.mk => i686-unknown-netbsd.mk} (100%) rename src/librustc_back/target/{i686_unknown_netbsdelf.rs => i686_unknown_netbsd.rs} (100%) diff --git a/mk/cfg/i686-unknown-netbsdelf.mk b/mk/cfg/i686-unknown-netbsd.mk similarity index 100% rename from mk/cfg/i686-unknown-netbsdelf.mk rename to mk/cfg/i686-unknown-netbsd.mk diff --git a/src/librustc_back/target/i686_unknown_netbsdelf.rs b/src/librustc_back/target/i686_unknown_netbsd.rs similarity index 100% rename from src/librustc_back/target/i686_unknown_netbsdelf.rs rename to src/librustc_back/target/i686_unknown_netbsd.rs diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs index 2cfa75475a2..638ca6dcd60 100644 --- a/src/librustc_back/target/mod.rs +++ b/src/librustc_back/target/mod.rs @@ -176,7 +176,7 @@ supported_targets! { ("i686-unknown-openbsd", i686_unknown_openbsd), ("x86_64-unknown-openbsd", x86_64_unknown_openbsd), - ("i686-unknown-netbsdelf", i686_unknown_netbsdelf), + ("i686-unknown-netbsd", i686_unknown_netbsd), ("sparc64-unknown-netbsd", sparc64_unknown_netbsd), ("x86_64-unknown-netbsd", x86_64_unknown_netbsd), ("x86_64-rumprun-netbsd", x86_64_rumprun_netbsd), From fa0a728ed60586a9b5d3e7dc755c03c4424ea79b Mon Sep 17 00:00:00 2001 From: Michael Woerister Date: Mon, 6 Feb 2017 10:15:20 -0500 Subject: [PATCH 32/70] back: Limit the number of LLVM worker threads. --- src/librustc_trans/back/write.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/librustc_trans/back/write.rs b/src/librustc_trans/back/write.rs index b3a2d66a07c..9a761e17e75 100644 --- a/src/librustc_trans/back/write.rs +++ b/src/librustc_trans/back/write.rs @@ -27,6 +27,7 @@ use errors::emitter::Emitter; use syntax_pos::MultiSpan; use context::{is_pie_binary, get_reloc_model}; +use std::cmp; use std::ffi::CString; use std::fs; use std::path::{Path, PathBuf}; @@ -754,10 +755,13 @@ pub fn run_passes(sess: &Session, } // Process the work items, optionally using worker threads. - // NOTE: This code is not really adapted to incremental compilation where - // the compiler decides the number of codegen units (and will - // potentially create hundreds of them). - let num_workers = work_items.len() - 1; + // NOTE: We are hardcoding a limit of worker threads for now. With + // incremental compilation we can run into situations where we would + // open hundreds of threads otherwise -- which can make things slower + // if things don't fit into memory anymore, or can cause the compiler + // to crash because of too many open file handles. See #39280 for + // some discussion on how to improve this in the future. + let num_workers = cmp::min(work_items.len() - 1, 32); if num_workers <= 1 { run_work_singlethreaded(sess, &trans.exported_symbols, work_items); } else { From 4f5fc4e24219f64235f08ba91ccf4b447a8643ee Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Mon, 6 Feb 2017 10:20:23 -0500 Subject: [PATCH 33/70] fix case where some edges can't be recreated by expanding the graph cc #39569 -- almost certainly a fix for that --- src/librustc_incremental/persist/load.rs | 119 ++++++++++++++++------- src/test/incremental/issue-39569.rs | 2 +- 2 files changed, 85 insertions(+), 36 deletions(-) diff --git a/src/librustc_incremental/persist/load.rs b/src/librustc_incremental/persist/load.rs index b371ab6aa31..7724658a9d6 100644 --- a/src/librustc_incremental/persist/load.rs +++ b/src/librustc_incremental/persist/load.rs @@ -176,46 +176,32 @@ pub fn decode_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // Recreate the edges in the graph that are still clean. let mut clean_work_products = FxHashSet(); let mut dirty_work_products = FxHashSet(); // incomplete; just used to suppress debug output + let mut extra_edges = vec![]; for (source, targets) in &edge_map { for target in targets { - // If the target is dirty, skip the edge. If this is an edge - // that targets a work-product, we can print the blame - // information now. - if let Some(blame) = dirty_raw_nodes.get(target) { - if let DepNode::WorkProduct(ref wp) = *target { - if tcx.sess.opts.debugging_opts.incremental_info { - if dirty_work_products.insert(wp.clone()) { - // It'd be nice to pretty-print these paths better than just - // using the `Debug` impls, but wev. - println!("incremental: module {:?} is dirty because {:?} \ - changed or was removed", - wp, - blame.map_def(|&index| { - Some(directory.def_path_string(tcx, index)) - }).unwrap()); - } - } - } - continue; - } - - // If the source is dirty, the target will be dirty. - assert!(!dirty_raw_nodes.contains_key(source)); - - // Retrace the source -> target edges to def-ids and then - // create an edge in the graph. Retracing may yield none if - // some of the data happens to have been removed; this ought - // to be impossible unless it is dirty, so we can unwrap. - let source_node = retraced.map(source).unwrap(); - let target_node = retraced.map(target).unwrap(); - let _task = tcx.dep_graph.in_task(target_node); - tcx.dep_graph.read(source_node); - if let DepNode::WorkProduct(ref wp) = *target { - clean_work_products.insert(wp.clone()); - } + process_edges(tcx, source, target, &edge_map, &directory, &retraced, &dirty_raw_nodes, + &mut clean_work_products, &mut dirty_work_products, &mut extra_edges); } } + // Subtle. Sometimes we have intermediate nodes that we can't recreate in the new graph. + // This is pretty unusual but it arises in a scenario like this: + // + // Hir(X) -> Foo(Y) -> Bar + // + // Note that the `Hir(Y)` is not an input to `Foo(Y)` -- this + // almost never happens, but can happen in some obscure + // scenarios. In that case, if `Y` is removed, then we can't + // recreate `Foo(Y)` (the def-id `Y` no longer exists); what we do + // then is to push the edge `Hir(X) -> Bar` onto `extra_edges` + // (along with any other targets of `Foo(Y)`). We will then add + // the edge from `Hir(X)` to `Bar` (or, if `Bar` itself cannot be + // recreated, to the targets of `Bar`). + while let Some((source, target)) = extra_edges.pop() { + process_edges(tcx, source, target, &edge_map, &directory, &retraced, &dirty_raw_nodes, + &mut clean_work_products, &mut dirty_work_products, &mut extra_edges); + } + // Add in work-products that are still clean, and delete those that are // dirty. reconcile_work_products(tcx, work_products, &clean_work_products); @@ -393,3 +379,66 @@ fn load_prev_metadata_hashes(tcx: TyCtxt, serialized_hashes.index_map.len()); } +fn process_edges<'a, 'tcx, 'edges>( + tcx: TyCtxt<'a, 'tcx, 'tcx>, + source: &'edges DepNode, + target: &'edges DepNode, + edges: &'edges FxHashMap, Vec>>, + directory: &DefIdDirectory, + retraced: &RetracedDefIdDirectory, + dirty_raw_nodes: &DirtyNodes, + clean_work_products: &mut FxHashSet>, + dirty_work_products: &mut FxHashSet>, + extra_edges: &mut Vec<(&'edges DepNode, &'edges DepNode)>) +{ + // If the target is dirty, skip the edge. If this is an edge + // that targets a work-product, we can print the blame + // information now. + if let Some(blame) = dirty_raw_nodes.get(target) { + if let DepNode::WorkProduct(ref wp) = *target { + if tcx.sess.opts.debugging_opts.incremental_info { + if dirty_work_products.insert(wp.clone()) { + // It'd be nice to pretty-print these paths better than just + // using the `Debug` impls, but wev. + println!("incremental: module {:?} is dirty because {:?} \ + changed or was removed", + wp, + blame.map_def(|&index| { + Some(directory.def_path_string(tcx, index)) + }).unwrap()); + } + } + } + return; + } + + // If the source is dirty, the target will be dirty. + assert!(!dirty_raw_nodes.contains_key(source)); + + // Retrace the source -> target edges to def-ids and then create + // an edge in the graph. Retracing may yield none if some of the + // data happens to have been removed. + if let Some(source_node) = retraced.map(source) { + if let Some(target_node) = retraced.map(target) { + let _task = tcx.dep_graph.in_task(target_node); + tcx.dep_graph.read(source_node); + if let DepNode::WorkProduct(ref wp) = *target { + clean_work_products.insert(wp.clone()); + } + } else { + // As discussed in `decode_dep_graph` above, sometimes the + // target cannot be recreated again, in which case we add + // edges to go from `source` to the targets of `target`. + extra_edges.extend( + edges[target].iter().map(|t| (source, t))); + } + } else { + // It's also possible that the source can't be created! But we + // can ignore such cases, because (a) if `source` is a HIR + // node, it would be considered dirty; and (b) in other cases, + // there must be some input to this node that is clean, and so + // we'll re-create the edges over in the case where target is + // undefined. + } +} + diff --git a/src/test/incremental/issue-39569.rs b/src/test/incremental/issue-39569.rs index 55e0436f0a8..5b53e948253 100644 --- a/src/test/incremental/issue-39569.rs +++ b/src/test/incremental/issue-39569.rs @@ -32,7 +32,7 @@ struct FooX { x: usize } #[cfg(rpass2)] fn main() { - let x: Arc = Arc::new(Foo { x: 22 }); + let x: Arc = Arc::new(FooX { x: 22 }); let y: Arc = x; } From 9ab8090bd4c8fed848cfebe2ab818a91e43e225c Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 23 Jan 2017 15:47:07 -0800 Subject: [PATCH 34/70] Delete the `mk` folder This commit deletes the old build system located in the `mk` folder as it's now been obsoleted for two cycles and is replaced by rustbuild. --- Makefile.in | 297 ------ mk/cfg/aarch64-apple-ios.mk | 33 - mk/cfg/aarch64-linux-android.mk | 26 - mk/cfg/aarch64-unknown-fuchsia.mk | 1 - mk/cfg/aarch64-unknown-linux-gnu.mk | 26 - mk/cfg/arm-linux-androideabi.mk | 25 - mk/cfg/arm-unknown-linux-gnueabi.mk | 26 - mk/cfg/arm-unknown-linux-gnueabihf.mk | 26 - mk/cfg/arm-unknown-linux-musleabi.mk | 26 - mk/cfg/arm-unknown-linux-musleabihf.mk | 3 - mk/cfg/armv5te-unknown-linux-gnueabi.mk | 26 - mk/cfg/armv7-apple-ios.mk | 30 - mk/cfg/armv7-linux-androideabi.mk | 25 - mk/cfg/armv7-unknown-linux-gnueabihf.mk | 26 - mk/cfg/armv7-unknown-linux-musleabihf.mk | 3 - mk/cfg/armv7s-apple-ios.mk | 30 - mk/cfg/asmjs-unknown-emscripten.mk | 24 - mk/cfg/i386-apple-ios.mk | 30 - mk/cfg/i586-pc-windows-msvc.mk | 28 - mk/cfg/i586-unknown-linux-gnu.mk | 23 - mk/cfg/i686-apple-darwin.mk | 23 - mk/cfg/i686-linux-android.mk | 25 - mk/cfg/i686-pc-windows-gnu.mk | 27 - mk/cfg/i686-pc-windows-msvc.mk | 28 - mk/cfg/i686-unknown-freebsd.mk | 22 - mk/cfg/i686-unknown-haiku.mk | 27 - mk/cfg/i686-unknown-linux-gnu.mk | 23 - mk/cfg/i686-unknown-linux-musl.mk | 29 - mk/cfg/i686-unknown-openbsd.mk | 24 - mk/cfg/le32-unknown-nacl.mk | 40 - mk/cfg/mips-unknown-linux-gnu.mk | 24 - mk/cfg/mips-unknown-linux-musl.mk | 24 - mk/cfg/mips-unknown-linux-uclibc.mk | 1 - mk/cfg/mips64-unknown-linux-gnuabi64.mk | 1 - mk/cfg/mips64el-unknown-linux-gnuabi64.mk | 1 - mk/cfg/mipsel-unknown-linux-gnu.mk | 24 - mk/cfg/mipsel-unknown-linux-musl.mk | 24 - mk/cfg/mipsel-unknown-linux-uclibc.mk | 1 - mk/cfg/powerpc-unknown-linux-gnu.mk | 24 - mk/cfg/powerpc64-unknown-linux-gnu.mk | 25 - mk/cfg/powerpc64le-unknown-linux-gnu.mk | 24 - mk/cfg/s390x-unknown-linux-gnu.mk | 24 - mk/cfg/sparc64-unknown-linux-gnu.mk | 1 - mk/cfg/sparc64-unknown-netbsd.mk | 3 - mk/cfg/wasm32-unknown-emscripten.mk | 24 - mk/cfg/x86_64-apple-darwin.mk | 23 - mk/cfg/x86_64-apple-ios.mk | 32 - mk/cfg/x86_64-pc-windows-gnu.mk | 27 - mk/cfg/x86_64-pc-windows-msvc.mk | 28 - mk/cfg/x86_64-rumprun-netbsd.mk | 25 - mk/cfg/x86_64-sun-solaris.mk | 23 - mk/cfg/x86_64-unknown-bitrig.mk | 23 - mk/cfg/x86_64-unknown-dragonfly.mk | 22 - mk/cfg/x86_64-unknown-freebsd.mk | 22 - mk/cfg/x86_64-unknown-fuchsia.mk | 1 - mk/cfg/x86_64-unknown-haiku.mk | 27 - mk/cfg/x86_64-unknown-linux-gnu.mk | 23 - mk/cfg/x86_64-unknown-linux-musl.mk | 29 - mk/cfg/x86_64-unknown-netbsd.mk | 23 - mk/cfg/x86_64-unknown-openbsd.mk | 24 - mk/cfg/x86_64-unknown-redox.mk | 1 - mk/clean.mk | 122 --- mk/crates.mk | 228 ----- mk/ctags.mk | 35 - mk/debuggers.mk | 145 --- mk/dist.mk | 382 -------- mk/docs.mk | 222 ----- mk/grammar.mk | 117 --- mk/host.mk | 84 -- mk/install.mk | 138 --- mk/llvm.mk | 124 --- mk/main.mk | 641 ------------- mk/platform.mk | 250 ----- mk/prepare.mk | 251 ----- mk/reconfig.mk | 43 - mk/rt.mk | 721 -------------- mk/rustllvm.mk | 71 -- mk/stage0.mk | 49 - mk/target.mk | 209 ---- mk/tests.mk | 1057 --------------------- mk/util.mk | 23 - 81 files changed, 6492 deletions(-) delete mode 100644 Makefile.in delete mode 100644 mk/cfg/aarch64-apple-ios.mk delete mode 100644 mk/cfg/aarch64-linux-android.mk delete mode 100644 mk/cfg/aarch64-unknown-fuchsia.mk delete mode 100644 mk/cfg/aarch64-unknown-linux-gnu.mk delete mode 100644 mk/cfg/arm-linux-androideabi.mk delete mode 100644 mk/cfg/arm-unknown-linux-gnueabi.mk delete mode 100644 mk/cfg/arm-unknown-linux-gnueabihf.mk delete mode 100644 mk/cfg/arm-unknown-linux-musleabi.mk delete mode 100644 mk/cfg/arm-unknown-linux-musleabihf.mk delete mode 100644 mk/cfg/armv5te-unknown-linux-gnueabi.mk delete mode 100644 mk/cfg/armv7-apple-ios.mk delete mode 100644 mk/cfg/armv7-linux-androideabi.mk delete mode 100644 mk/cfg/armv7-unknown-linux-gnueabihf.mk delete mode 100644 mk/cfg/armv7-unknown-linux-musleabihf.mk delete mode 100644 mk/cfg/armv7s-apple-ios.mk delete mode 100644 mk/cfg/asmjs-unknown-emscripten.mk delete mode 100644 mk/cfg/i386-apple-ios.mk delete mode 100644 mk/cfg/i586-pc-windows-msvc.mk delete mode 100644 mk/cfg/i586-unknown-linux-gnu.mk delete mode 100644 mk/cfg/i686-apple-darwin.mk delete mode 100644 mk/cfg/i686-linux-android.mk delete mode 100644 mk/cfg/i686-pc-windows-gnu.mk delete mode 100644 mk/cfg/i686-pc-windows-msvc.mk delete mode 100644 mk/cfg/i686-unknown-freebsd.mk delete mode 100644 mk/cfg/i686-unknown-haiku.mk delete mode 100644 mk/cfg/i686-unknown-linux-gnu.mk delete mode 100644 mk/cfg/i686-unknown-linux-musl.mk delete mode 100644 mk/cfg/i686-unknown-openbsd.mk delete mode 100644 mk/cfg/le32-unknown-nacl.mk delete mode 100644 mk/cfg/mips-unknown-linux-gnu.mk delete mode 100644 mk/cfg/mips-unknown-linux-musl.mk delete mode 100644 mk/cfg/mips-unknown-linux-uclibc.mk delete mode 100644 mk/cfg/mips64-unknown-linux-gnuabi64.mk delete mode 100644 mk/cfg/mips64el-unknown-linux-gnuabi64.mk delete mode 100644 mk/cfg/mipsel-unknown-linux-gnu.mk delete mode 100644 mk/cfg/mipsel-unknown-linux-musl.mk delete mode 100644 mk/cfg/mipsel-unknown-linux-uclibc.mk delete mode 100644 mk/cfg/powerpc-unknown-linux-gnu.mk delete mode 100644 mk/cfg/powerpc64-unknown-linux-gnu.mk delete mode 100644 mk/cfg/powerpc64le-unknown-linux-gnu.mk delete mode 100644 mk/cfg/s390x-unknown-linux-gnu.mk delete mode 100644 mk/cfg/sparc64-unknown-linux-gnu.mk delete mode 100644 mk/cfg/sparc64-unknown-netbsd.mk delete mode 100644 mk/cfg/wasm32-unknown-emscripten.mk delete mode 100644 mk/cfg/x86_64-apple-darwin.mk delete mode 100644 mk/cfg/x86_64-apple-ios.mk delete mode 100644 mk/cfg/x86_64-pc-windows-gnu.mk delete mode 100644 mk/cfg/x86_64-pc-windows-msvc.mk delete mode 100644 mk/cfg/x86_64-rumprun-netbsd.mk delete mode 100644 mk/cfg/x86_64-sun-solaris.mk delete mode 100644 mk/cfg/x86_64-unknown-bitrig.mk delete mode 100644 mk/cfg/x86_64-unknown-dragonfly.mk delete mode 100644 mk/cfg/x86_64-unknown-freebsd.mk delete mode 100644 mk/cfg/x86_64-unknown-fuchsia.mk delete mode 100644 mk/cfg/x86_64-unknown-haiku.mk delete mode 100644 mk/cfg/x86_64-unknown-linux-gnu.mk delete mode 100644 mk/cfg/x86_64-unknown-linux-musl.mk delete mode 100644 mk/cfg/x86_64-unknown-netbsd.mk delete mode 100644 mk/cfg/x86_64-unknown-openbsd.mk delete mode 100644 mk/cfg/x86_64-unknown-redox.mk delete mode 100644 mk/clean.mk delete mode 100644 mk/crates.mk delete mode 100644 mk/ctags.mk delete mode 100644 mk/debuggers.mk delete mode 100644 mk/dist.mk delete mode 100644 mk/docs.mk delete mode 100644 mk/grammar.mk delete mode 100644 mk/host.mk delete mode 100644 mk/install.mk delete mode 100644 mk/llvm.mk delete mode 100644 mk/main.mk delete mode 100644 mk/platform.mk delete mode 100644 mk/prepare.mk delete mode 100644 mk/reconfig.mk delete mode 100644 mk/rt.mk delete mode 100644 mk/rustllvm.mk delete mode 100644 mk/stage0.mk delete mode 100644 mk/target.mk delete mode 100644 mk/tests.mk delete mode 100644 mk/util.mk diff --git a/Makefile.in b/Makefile.in deleted file mode 100644 index 8dbe2421390..00000000000 --- a/Makefile.in +++ /dev/null @@ -1,297 +0,0 @@ -# Copyright 2012 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -# \(^o^)/ -# -# Greetings, adventurer! The Rust Build System is at your service. -# -# Whether you want a genuine copy of `rustc`, access to the latest and -# most authoritative Rust documentation, or even to investigate the -# most intimate workings of the compiler itself, you've come to the -# right place. Let's see what's on the menu. -# -# Please note that most of these options only work if configure was -# run with --disable-rustbuild. For documentation on the new build -# system, see CONTRIBUTING.md. -# -# First, start with one of these build targets: -# -# * all - The default. Build a complete, bootstrapped compiler. -# `rustc` will be in `${target-triple}/stage2/bin/`. Run it -# directly from the build directory if you like. This also -# comes with docs in `doc/`. -# -# * check - Run the complete test suite -# -# * clean - Clean the build repository. It is advised to run this -# command if you want to build Rust again, after an update -# of the git repository. -# -# * install - Install Rust. Note that installation is not necessary -# to use the compiler. -# -# * uninstall - Uninstall the binaries -# -# For tips on working with The Rust Build System, just: -# -# run `make tips` -# -# Otherwise -# -# run `make` -# -# -# -# -# -# # The Rust Build System Tip Line -# -# There are a bazillion different targets you might want to build. Here -# are a few ideas. -# -# * docs - Build gobs of HTML documentation and put it into `doc/` -# * check-$(crate) - Test a crate, e.g. `check-std` -# * check-ref - Run the language reference tests -# * check-docs - Test the documentation examples -# * check-stage$(stage)-$(crate) - Test a crate in a specific stage -# * check-stage$(stage)-{rpass,rfail,cfail,rmake,...} - Run tests in src/test/ -# * check-stage1-T-$(target)-H-$(host) - Run cross-compiled-tests -# * tidy - Basic style check, show highest rustc error code and -# the status of language and lib features -# * rustc-stage$(stage) - Only build up to a specific stage -# * $host/stage1/bin/rustc - Only build stage1 rustc, not libstd. For further -# information see "Rust recipes for build system success" below. -# -# Then mix in some of these environment variables to harness the -# ultimate power of The Rust Build System. -# -# * `VERBOSE=1` - Print all commands. Use this to see what's going on. -# * `RUSTFLAGS=...` - Add compiler flags to all `rustc` invocations -# * `JEMALLOC_FLAGS=...` - Pass flags to jemalloc's configure script -# -# * `TESTNAME=...` - Specify the name of tests to run -# * `CHECK_IGNORED=1` - Run normally-ignored tests -# * `PLEASE_BENCH=1` - Run crate benchmarks (enable `--bench` flag) -# -# * `CFG_ENABLE_VALGRIND=1` - Run tests under valgrind -# * `VALGRIND_COMPILE=1` - Run the compiler itself under valgrind -# (requires `CFG_ENABLE_VALGRIND`) -# -# * `NO_REBUILD=1` - Don't rebootstrap when testing std -# (and possibly other crates) -# * `NO_MKFILE_DEPS=1` - Don't rebuild for modified .mk files -# -# * `SAVE_TEMPS=1` - Use `--save-temps` flag on all `rustc` invocations -# * `ASM_COMMENTS=1` - Use `-Z asm-comments` -# * `TIME_PASSES=1` - Use `-Z time-passes` -# * `TIME_LLVM_PASSES=1` - Use `-Z time-llvm-passes` -# * `TRACE=1` - Use `-Z trace` -# -# # Rust recipes for build system success -# -# // Modifying libstd? Use this command to run unit tests just on your change -# make check-stage1-std NO_REBUILD=1 NO_BENCH=1 -# -# // Modifying just rustc? -# // Compile rustc+libstd once -# make rustc-stage1 -# // From now on use this command to rebuild just rustc and reuse the previously built libstd -# // $host is a target triple, eg. x86_64-unknown-linux-gnu -# // The resulting binary is located at $host/stage1/bin/rustc. -# // If there are any issues with libstd recompile it with the command above. -# make $host/stage1/bin/rustc -# -# // Added a run-pass test? Use this to test running your test -# make check-stage1-rpass TESTNAME=my-shiny-new-test -# -# // Having trouble figuring out which test is failing? Turn off parallel tests -# make check-stage1-std RUST_TEST_THREADS=1 -# -# // To make debug!() and other logging calls visible, reconfigure: -# ./configure --enable-debug-assertions -# make .... -# -# If you really feel like getting your hands dirty, then: -# -# run `make nitty-gritty` -# -# # Make command examples -# -# ## Docs linked commands -# -# * make check-stage1-rustdocck: Builds rustdoc. It has the advantage to compile -# quite quickly since we're only using stage1 -# executables. -# * make doc/error-index.md: Gets all doc blocks from doc comments and error -# explanations to put them in a markdown file. You -# can then test them by running -# "rustdoc --test error-index.md". -# -# And of course, the wonderfully useful 'make tidy'! Always run it before opening a pull request to rust! -# -# -# -# -# -# # The Rust Build System -# -# Gosh I wish there was something useful here (TODO). -# -# # An (old) explanation of how the build is structured: -# -# *Note: Hey, like, this is probably inaccurate, and is definitely -# an outdated and insufficient explanation of the remarkable -# Rust Build System.* -# -# There are multiple build stages (0-3) needed to verify that the -# compiler is properly self-hosting. Each stage is divided between -# 'host' artifacts and 'target' artifacts, where the stageN host -# compiler builds artifacts for 1 or more stageN target architectures. -# Once the stageN target compiler has been built for the host -# architecture it is promoted (copied) to a stageN+1 host artifact. -# -# The stage3 host compiler is a compiler that successfully builds -# itself and should (in theory) be bitwise identical to the stage2 -# host compiler. The process is bootstrapped using a stage0 host -# compiler downloaded from a previous snapshot. -# -# At no time should stageN artifacts be interacting with artifacts -# from other stages. For consistency, we use the 'promotion' logic -# for all artifacts, even those that don't make sense on non-host -# architectures. -# -# The directory layout for a stage is intended to match the layout -# of the installed compiler, and looks like the following: -# -# stageN - this is the system root, corresponding to, e.g. /usr -# bin - binaries compiled for the host -# lib - libraries used by the host compiler -# rustlib - rustc's own place to organize libraries -# $(target) - target-specific artifacts -# bin - binaries for target architectures -# lib - libraries for target architectures -# -# A note about host libraries: -# -# The only libraries that get promoted to stageN/lib are those needed -# by rustc. In general, rust programs, even those compiled for the -# host architecture will use libraries from the target -# directories. This gives rust some freedom to experiment with how -# libraries are managed and versioned without polluting the common -# areas of the filesystem. -# -# General rust binaries may still live in the host bin directory; they -# will just link against the libraries in the target lib directory. -# -# Admittedly this is a little convoluted. -# -# If you find yourself working on the make infrastructure itself, and trying to -# find the value of a given variable after expansion, you can use: -# -# make print-VARIABLE_NAME -# -# To extract it -# -# -# - -###################################################################### -# Primary rules -###################################################################### - -# Issue #9531: If you change the order of any of the following (or add -# new definitions), make sure definitions always precede their uses, -# especially for the dependency lists of recipes. - -# First, load the variables exported by the configure script -include config.mk - -# Just a few macros used everywhere -include $(CFG_SRC_DIR)mk/util.mk -# Reconfiguring when the makefiles or submodules change -include $(CFG_SRC_DIR)mk/reconfig.mk -# All crates and their dependencies -include $(CFG_SRC_DIR)mk/crates.mk -# Various bits of setup, common macros, and top-level rules -include $(CFG_SRC_DIR)mk/main.mk -# C and assembly components that are not LLVM -include $(CFG_SRC_DIR)mk/rt.mk -# Rules for crates in the target directories -include $(CFG_SRC_DIR)mk/target.mk -# Rules for crates in the host directories -include $(CFG_SRC_DIR)mk/host.mk -# Special rules for bootstrapping stage0 -include $(CFG_SRC_DIR)mk/stage0.mk -# Rust-specific LLVM extensions -include $(CFG_SRC_DIR)mk/rustllvm.mk -# Documentation -include $(CFG_SRC_DIR)mk/docs.mk -# LLVM -include $(CFG_SRC_DIR)mk/llvm.mk -# Rules for installing debugger scripts -include $(CFG_SRC_DIR)mk/debuggers.mk - -###################################################################### -# Secondary makefiles, conditionalized for speed -###################################################################### - -# The test suite -ifneq ($(strip $(findstring check,$(MAKECMDGOALS)) \ - $(findstring test,$(MAKECMDGOALS)) \ - $(findstring tidy,$(MAKECMDGOALS))),) - CFG_INFO := $(info cfg: including test rules) - include $(CFG_SRC_DIR)mk/tests.mk - include $(CFG_SRC_DIR)mk/grammar.mk -endif - -# Copy all the distributables to another directory for binary install -ifneq ($(strip $(findstring prepare,$(MAKECMDGOALS)) \ - $(findstring dist,$(MAKECMDGOALS)) \ - $(findstring install,$(MAKECMDGOALS))),) - CFG_INFO := $(info cfg: including prepare rules) - include $(CFG_SRC_DIR)mk/prepare.mk -endif - -# Source and binary distribution artifacts -ifneq ($(strip $(findstring dist,$(MAKECMDGOALS)) \ - $(findstring install,$(MAKECMDGOALS)) \ - $(findstring clean,$(MAKECMDGOALS))),) - CFG_INFO := $(info cfg: including dist rules) - include $(CFG_SRC_DIR)mk/dist.mk -endif - -# (Unix) Installation from the build directory -ifneq ($(findstring install,$(MAKECMDGOALS)),) - CFG_INFO := $(info cfg: including install rules) - include $(CFG_SRC_DIR)mk/install.mk -endif - -# Cleaning -ifneq ($(findstring clean,$(MAKECMDGOALS)),) - CFG_INFO := $(info cfg: including clean rules) - include $(CFG_SRC_DIR)mk/clean.mk -endif - -# CTAGS building -ifneq ($(strip $(findstring TAGS.emacs,$(MAKECMDGOALS)) \ - $(findstring TAGS.vi,$(MAKECMDGOALS)) \ - $(findstring TAGS.rustc.emacs,$(MAKECMDGOALS)) \ - $(findstring TAGS.rustc.vi,$(MAKECMDGOALS))),) - CFG_INFO := $(info cfg: including ctags rules) - include $(CFG_SRC_DIR)mk/ctags.mk -endif - -.DEFAULT: - @echo - @echo "======================================================" - @echo "== If you need help, run 'make help' or 'make tips' ==" - @echo "======================================================" - @echo - exit 1 diff --git a/mk/cfg/aarch64-apple-ios.mk b/mk/cfg/aarch64-apple-ios.mk deleted file mode 100644 index 5d822f1b1ab..00000000000 --- a/mk/cfg/aarch64-apple-ios.mk +++ /dev/null @@ -1,33 +0,0 @@ -# aarch64-apple-ios configuration -CFG_SDK_NAME_aarch64-apple-ios := iphoneos -CFG_SDK_ARCHS_aarch64-apple-ios := arm64 -ifneq ($(findstring darwin,$(CFG_OSTYPE)),) -CFG_IOS_SDK_aarch64-apple-ios := $(shell xcrun --show-sdk-path -sdk iphoneos 2>/dev/null) -CFG_IOS_SDK_FLAGS_aarch64-apple-ios := -target aarch64-apple-darwin -isysroot $(CFG_IOS_SDK_aarch64-apple-ios) -mios-version-min=7.0 -arch arm64 -CC_aarch64-apple-ios = $(shell xcrun -find -sdk iphoneos clang) -LINK_aarch64-apple-ios = $(shell xcrun -find -sdk iphoneos clang) -CXX_aarch64-apple-ios = $(shell xcrun -find -sdk iphoneos clang++) -CPP_aarch64-apple-ios = $(shell xcrun -find -sdk iphoneos clang++) -AR_aarch64-apple-ios = $(shell xcrun -find -sdk iphoneos ar) -endif -CFG_LIB_NAME_aarch64-apple-ios = lib$(1).a -CFG_LIB_GLOB_aarch64-apple-ios = lib$(1)-*.a -CFG_INSTALL_ONLY_RLIB_aarch64-apple-ios = 1 -CFG_STATIC_LIB_NAME_aarch64-apple-ios=lib$(1).a -CFG_LIB_DSYM_GLOB_aarch64-apple-ios = lib$(1)-*.a.dSYM -CFG_CFLAGS_aarch64-apple-ios := $(CFG_IOS_SDK_FLAGS_aarch64-apple-ios) -CFG_JEMALLOC_CFLAGS_aarch64-apple-ios := $(CFG_IOS_SDK_FLAGS_aarch64-apple-ios) -CFG_GCCISH_CFLAGS_aarch64-apple-ios := -fPIC $(CFG_IOS_SDK_FLAGS_aarch64-apple-ios) -CFG_GCCISH_CXXFLAGS_aarch64-apple-ios := -fno-rtti $(CFG_IOS_SDK_FLAGS_aarch64-apple-ios) -I$(CFG_IOS_SDK_aarch64-apple-ios)/usr/include/c++/4.2.1 -CFG_GCCISH_LINK_FLAGS_aarch64-apple-ios := -lpthread -syslibroot $(CFG_IOS_SDK_aarch64-apple-ios) -Wl,-no_compact_unwind -CFG_GCCISH_DEF_FLAG_aarch64-apple-ios := -Wl,-exported_symbols_list, -CFG_LLC_FLAGS_aarch64-apple-ios := -mattr=+neon,+cyclone,+fp-armv8 -CFG_INSTALL_NAME_aarch64-apple-ios = -Wl,-install_name,@rpath/$(1) -CFG_LIBUV_LINK_FLAGS_aarch64-apple-ios = -CFG_EXE_SUFFIX_aarch64-apple-ios := -CFG_WINDOWSY_aarch64-apple-ios := -CFG_UNIXY_aarch64-apple-ios := 1 -CFG_LDPATH_aarch64-apple-ios := -CFG_RUN_aarch64-apple-ios = $(2) -CFG_RUN_TARG_aarch64-apple-ios = $(call CFG_RUN_aarch64-apple-ios,,$(2)) -CFG_GNU_TRIPLE_aarch64-apple-ios := aarch64-apple-ios diff --git a/mk/cfg/aarch64-linux-android.mk b/mk/cfg/aarch64-linux-android.mk deleted file mode 100644 index 274f73834d4..00000000000 --- a/mk/cfg/aarch64-linux-android.mk +++ /dev/null @@ -1,26 +0,0 @@ -# aarch64-linux-android configuration -# CROSS_PREFIX_aarch64-linux-android- -CC_aarch64-linux-android=$(CFG_AARCH64_LINUX_ANDROID_NDK)/bin/aarch64-linux-android-gcc -CXX_aarch64-linux-android=$(CFG_AARCH64_LINUX_ANDROID_NDK)/bin/aarch64-linux-android-g++ -CPP_aarch64-linux-android=$(CFG_AARCH64_LINUX_ANDROID_NDK)/bin/aarch64-linux-android-gcc -E -AR_aarch64-linux-android=$(CFG_AARCH64_LINUX_ANDROID_NDK)/bin/aarch64-linux-android-ar -CFG_LIB_NAME_aarch64-linux-android=lib$(1).so -CFG_STATIC_LIB_NAME_aarch64-linux-android=lib$(1).a -CFG_LIB_GLOB_aarch64-linux-android=lib$(1)-*.so -CFG_LIB_DSYM_GLOB_aarch64-linux-android=lib$(1)-*.dylib.dSYM -CFG_JEMALLOC_CFLAGS_aarch64-linux-android := -D__aarch64__ -DANDROID -D__ANDROID__ $(CFLAGS) -CFG_GCCISH_CFLAGS_aarch64-linux-android := -Wall -g -fPIC -D__aarch64__ -DANDROID -D__ANDROID__ $(CFLAGS) -CFG_GCCISH_CXXFLAGS_aarch64-linux-android := -fno-rtti $(CXXFLAGS) -CFG_GCCISH_LINK_FLAGS_aarch64-linux-android := -shared -fPIC -ldl -g -lm -lsupc++ -CFG_GCCISH_DEF_FLAG_aarch64-linux-android := -Wl,--export-dynamic,--dynamic-list= -CFG_LLC_FLAGS_aarch64-linux-android := -CFG_INSTALL_NAME_aarch64-linux-android = -CFG_EXE_SUFFIX_aarch64-linux-android := -CFG_WINDOWSY_aarch64-linux-android := -CFG_UNIXY_aarch64-linux-android := 1 -CFG_LDPATH_aarch64-linux-android := -CFG_RUN_aarch64-linux-android= -CFG_RUN_TARG_aarch64-linux-android= -RUSTC_FLAGS_aarch64-linux-android := -RUSTC_CROSS_FLAGS_aarch64-linux-android := -CFG_GNU_TRIPLE_aarch64-linux-android := aarch64-linux-android diff --git a/mk/cfg/aarch64-unknown-fuchsia.mk b/mk/cfg/aarch64-unknown-fuchsia.mk deleted file mode 100644 index 34aee77ae21..00000000000 --- a/mk/cfg/aarch64-unknown-fuchsia.mk +++ /dev/null @@ -1 +0,0 @@ -# rustbuild-only target diff --git a/mk/cfg/aarch64-unknown-linux-gnu.mk b/mk/cfg/aarch64-unknown-linux-gnu.mk deleted file mode 100644 index 6637423e495..00000000000 --- a/mk/cfg/aarch64-unknown-linux-gnu.mk +++ /dev/null @@ -1,26 +0,0 @@ -# aarch64-unknown-linux-gnu configuration -CROSS_PREFIX_aarch64-unknown-linux-gnu=aarch64-linux-gnu- -CC_aarch64-unknown-linux-gnu=gcc -CXX_aarch64-unknown-linux-gnu=g++ -CPP_aarch64-unknown-linux-gnu=gcc -E -AR_aarch64-unknown-linux-gnu=ar -CFG_LIB_NAME_aarch64-unknown-linux-gnu=lib$(1).so -CFG_STATIC_LIB_NAME_aarch64-unknown-linux-gnu=lib$(1).a -CFG_LIB_GLOB_aarch64-unknown-linux-gnu=lib$(1)-*.so -CFG_LIB_DSYM_GLOB_aarch64-unknown-linux-gnu=lib$(1)-*.dylib.dSYM -CFG_JEMALLOC_CFLAGS_aarch64-unknown-linux-gnu := -D__aarch64__ $(CFLAGS) -CFG_GCCISH_CFLAGS_aarch64-unknown-linux-gnu := -Wall -g -fPIC -D__aarch64__ $(CFLAGS) -CFG_GCCISH_CXXFLAGS_aarch64-unknown-linux-gnu := -fno-rtti $(CXXFLAGS) -CFG_GCCISH_LINK_FLAGS_aarch64-unknown-linux-gnu := -shared -fPIC -g -CFG_GCCISH_DEF_FLAG_aarch64-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list= -CFG_LLC_FLAGS_aarch64-unknown-linux-gnu := -CFG_INSTALL_NAME_aarch64-unknown-linux-gnu = -CFG_EXE_SUFFIX_aarch64-unknown-linux-gnu := -CFG_WINDOWSY_aarch64-unknown-linux-gnu := -CFG_UNIXY_aarch64-unknown-linux-gnu := 1 -CFG_LDPATH_aarch64-unknown-linux-gnu := -CFG_RUN_aarch64-unknown-linux-gnu=$(2) -CFG_RUN_TARG_aarch64-unknown-linux-gnu=$(call CFG_RUN_aarch64-unknown-linux-gnu,,$(2)) -RUSTC_FLAGS_aarch64-unknown-linux-gnu := -RUSTC_CROSS_FLAGS_aarch64-unknown-linux-gnu := -CFG_GNU_TRIPLE_aarch64-unknown-linux-gnu := aarch64-unknown-linux-gnu diff --git a/mk/cfg/arm-linux-androideabi.mk b/mk/cfg/arm-linux-androideabi.mk deleted file mode 100644 index c084954f2e9..00000000000 --- a/mk/cfg/arm-linux-androideabi.mk +++ /dev/null @@ -1,25 +0,0 @@ -# arm-linux-androideabi configuration -CC_arm-linux-androideabi=$(CFG_ARM_LINUX_ANDROIDEABI_NDK)/bin/arm-linux-androideabi-gcc -CXX_arm-linux-androideabi=$(CFG_ARM_LINUX_ANDROIDEABI_NDK)/bin/arm-linux-androideabi-g++ -CPP_arm-linux-androideabi=$(CFG_ARM_LINUX_ANDROIDEABI_NDK)/bin/arm-linux-androideabi-gcc -E -AR_arm-linux-androideabi=$(CFG_ARM_LINUX_ANDROIDEABI_NDK)/bin/arm-linux-androideabi-ar -CFG_LIB_NAME_arm-linux-androideabi=lib$(1).so -CFG_STATIC_LIB_NAME_arm-linux-androideabi=lib$(1).a -CFG_LIB_GLOB_arm-linux-androideabi=lib$(1)-*.so -CFG_LIB_DSYM_GLOB_arm-linux-androideabi=lib$(1)-*.dylib.dSYM -CFG_JEMALLOC_CFLAGS_arm-linux-androideabi := -D__arm__ -DANDROID -D__ANDROID__ $(CFLAGS) -CFG_GCCISH_CFLAGS_arm-linux-androideabi := -Wall -g -fPIC -D__arm__ -DANDROID -D__ANDROID__ $(CFLAGS) -CFG_GCCISH_CXXFLAGS_arm-linux-androideabi := -fno-rtti $(CXXFLAGS) -CFG_GCCISH_LINK_FLAGS_arm-linux-androideabi := -shared -fPIC -ldl -g -lm -lsupc++ -CFG_GCCISH_DEF_FLAG_arm-linux-androideabi := -Wl,--export-dynamic,--dynamic-list= -CFG_LLC_FLAGS_arm-linux-androideabi := -CFG_INSTALL_NAME_arm-linux-androideabi = -CFG_EXE_SUFFIX_arm-linux-androideabi := -CFG_WINDOWSY_arm-linux-androideabi := -CFG_UNIXY_arm-linux-androideabi := 1 -CFG_LDPATH_arm-linux-androideabi := -CFG_RUN_arm-linux-androideabi= -CFG_RUN_TARG_arm-linux-androideabi= -RUSTC_FLAGS_arm-linux-androideabi := -RUSTC_CROSS_FLAGS_arm-linux-androideabi := -CFG_GNU_TRIPLE_arm-linux-androideabi := arm-linux-androideabi diff --git a/mk/cfg/arm-unknown-linux-gnueabi.mk b/mk/cfg/arm-unknown-linux-gnueabi.mk deleted file mode 100644 index f66ad04eefe..00000000000 --- a/mk/cfg/arm-unknown-linux-gnueabi.mk +++ /dev/null @@ -1,26 +0,0 @@ -# arm-unknown-linux-gnueabi configuration -CROSS_PREFIX_arm-unknown-linux-gnueabi=arm-linux-gnueabi- -CC_arm-unknown-linux-gnueabi=gcc -CXX_arm-unknown-linux-gnueabi=g++ -CPP_arm-unknown-linux-gnueabi=gcc -E -AR_arm-unknown-linux-gnueabi=ar -CFG_LIB_NAME_arm-unknown-linux-gnueabi=lib$(1).so -CFG_STATIC_LIB_NAME_arm-unknown-linux-gnueabi=lib$(1).a -CFG_LIB_GLOB_arm-unknown-linux-gnueabi=lib$(1)-*.so -CFG_LIB_DSYM_GLOB_arm-unknown-linux-gnueabi=lib$(1)-*.dylib.dSYM -CFG_JEMALLOC_CFLAGS_arm-unknown-linux-gnueabi := -D__arm__ -mfloat-abi=soft $(CFLAGS) -march=armv6 -marm -CFG_GCCISH_CFLAGS_arm-unknown-linux-gnueabi := -Wall -g -fPIC -D__arm__ -mfloat-abi=soft $(CFLAGS) -march=armv6 -marm -CFG_GCCISH_CXXFLAGS_arm-unknown-linux-gnueabi := -fno-rtti $(CXXFLAGS) -CFG_GCCISH_LINK_FLAGS_arm-unknown-linux-gnueabi := -shared -fPIC -g -CFG_GCCISH_DEF_FLAG_arm-unknown-linux-gnueabi := -Wl,--export-dynamic,--dynamic-list= -CFG_LLC_FLAGS_arm-unknown-linux-gnueabi := -CFG_INSTALL_NAME_arm-unknown-linux-gnueabi = -CFG_EXE_SUFFIX_arm-unknown-linux-gnueabi := -CFG_WINDOWSY_arm-unknown-linux-gnueabi := -CFG_UNIXY_arm-unknown-linux-gnueabi := 1 -CFG_LDPATH_arm-unknown-linux-gnueabi := -CFG_RUN_arm-unknown-linux-gnueabi=$(2) -CFG_RUN_TARG_arm-unknown-linux-gnueabi=$(call CFG_RUN_arm-unknown-linux-gnueabi,,$(2)) -RUSTC_FLAGS_arm-unknown-linux-gnueabi := -RUSTC_CROSS_FLAGS_arm-unknown-linux-gnueabi := -CFG_GNU_TRIPLE_arm-unknown-linux-gnueabi := arm-unknown-linux-gnueabi diff --git a/mk/cfg/arm-unknown-linux-gnueabihf.mk b/mk/cfg/arm-unknown-linux-gnueabihf.mk deleted file mode 100644 index defe0dc3e70..00000000000 --- a/mk/cfg/arm-unknown-linux-gnueabihf.mk +++ /dev/null @@ -1,26 +0,0 @@ -# arm-unknown-linux-gnueabihf configuration -CROSS_PREFIX_arm-unknown-linux-gnueabihf=arm-linux-gnueabihf- -CC_arm-unknown-linux-gnueabihf=gcc -CXX_arm-unknown-linux-gnueabihf=g++ -CPP_arm-unknown-linux-gnueabihf=gcc -E -AR_arm-unknown-linux-gnueabihf=ar -CFG_LIB_NAME_arm-unknown-linux-gnueabihf=lib$(1).so -CFG_STATIC_LIB_NAME_arm-unknown-linux-gnueabihf=lib$(1).a -CFG_LIB_GLOB_arm-unknown-linux-gnueabihf=lib$(1)-*.so -CFG_LIB_DSYM_GLOB_arm-unknown-linux-gnueabihf=lib$(1)-*.dylib.dSYM -CFG_JEMALLOC_CFLAGS_arm-unknown-linux-gnueabihf := -D__arm__ $(CFLAGS) -march=armv6 -marm -CFG_GCCISH_CFLAGS_arm-unknown-linux-gnueabihf := -Wall -g -fPIC -D__arm__ $(CFLAGS) -march=armv6 -marm -CFG_GCCISH_CXXFLAGS_arm-unknown-linux-gnueabihf := -fno-rtti $(CXXFLAGS) -CFG_GCCISH_LINK_FLAGS_arm-unknown-linux-gnueabihf := -shared -fPIC -g -CFG_GCCISH_DEF_FLAG_arm-unknown-linux-gnueabihf := -Wl,--export-dynamic,--dynamic-list= -CFG_LLC_FLAGS_arm-unknown-linux-gnueabihf := -CFG_INSTALL_NAME_ar,-unknown-linux-gnueabihf = -CFG_EXE_SUFFIX_arm-unknown-linux-gnueabihf := -CFG_WINDOWSY_arm-unknown-linux-gnueabihf := -CFG_UNIXY_arm-unknown-linux-gnueabihf := 1 -CFG_LDPATH_arm-unknown-linux-gnueabihf := -CFG_RUN_arm-unknown-linux-gnueabihf=$(2) -CFG_RUN_TARG_arm-unknown-linux-gnueabihf=$(call CFG_RUN_arm-unknown-linux-gnueabihf,,$(2)) -RUSTC_FLAGS_arm-unknown-linux-gnueabihf := -C target-feature=+v6,+vfp2 -RUSTC_CROSS_FLAGS_arm-unknown-linux-gnueabihf := -CFG_GNU_TRIPLE_arm-unknown-linux-gnueabihf := arm-unknown-linux-gnueabihf diff --git a/mk/cfg/arm-unknown-linux-musleabi.mk b/mk/cfg/arm-unknown-linux-musleabi.mk deleted file mode 100644 index 4d1438d592e..00000000000 --- a/mk/cfg/arm-unknown-linux-musleabi.mk +++ /dev/null @@ -1,26 +0,0 @@ -# arm-unknown-linux-musleabi configuration -CROSS_PREFIX_arm-unknown-linux-musleabi=arm-linux-musleabi- -CC_arm-unknown-linux-musleabi=gcc -CXX_arm-unknown-linux-musleabi=g++ -CPP_arm-unknown-linux-musleabi=gcc -E -AR_arm-unknown-linux-musleabi=ar -CFG_LIB_NAME_arm-unknown-linux-musleabi=lib$(1).so -CFG_STATIC_LIB_NAME_arm-unknown-linux-musleabi=lib$(1).a -CFG_LIB_GLOB_arm-unknown-linux-musleabi=lib$(1)-*.so -CFG_LIB_DSYM_GLOB_arm-unknown-linux-musleabi=lib$(1)-*.dylib.dSYM -CFG_JEMALLOC_CFLAGS_arm-unknown-linux-musleabi := -D__arm__ -mfloat-abi=soft $(CFLAGS) -march=armv6 -marm -CFG_GCCISH_CFLAGS_arm-unknown-linux-musleabi := -Wall -g -fPIC -D__arm__ -mfloat-abi=soft $(CFLAGS) -march=armv6 -marm -CFG_GCCISH_CXXFLAGS_arm-unknown-linux-musleabi := -fno-rtti $(CXXFLAGS) -CFG_GCCISH_LINK_FLAGS_arm-unknown-linux-musleabi := -shared -fPIC -g -CFG_GCCISH_DEF_FLAG_arm-unknown-linux-musleabi := -Wl,--export-dynamic,--dynamic-list= -CFG_LLC_FLAGS_arm-unknown-linux-musleabi := -CFG_INSTALL_NAME_arm-unknown-linux-musleabi = -CFG_EXE_SUFFIX_arm-unknown-linux-musleabi := -CFG_WINDOWSY_arm-unknown-linux-musleabi := -CFG_UNIXY_arm-unknown-linux-musleabi := 1 -CFG_LDPATH_arm-unknown-linux-musleabi := -CFG_RUN_arm-unknown-linux-musleabi=$(2) -CFG_RUN_TARG_arm-unknown-linux-musleabi=$(call CFG_RUN_arm-unknown-linux-musleabi,,$(2)) -RUSTC_FLAGS_arm-unknown-linux-musleabi := -RUSTC_CROSS_FLAGS_arm-unknown-linux-musleabi := -CFG_GNU_TRIPLE_arm-unknown-linux-musleabi := arm-unknown-linux-musleabi diff --git a/mk/cfg/arm-unknown-linux-musleabihf.mk b/mk/cfg/arm-unknown-linux-musleabihf.mk deleted file mode 100644 index 8120250150d..00000000000 --- a/mk/cfg/arm-unknown-linux-musleabihf.mk +++ /dev/null @@ -1,3 +0,0 @@ -# This file is intentially left empty to indicate that, while this target is -# supported, it's not supported using plain GNU Make builds. Use a --rustbuild -# instead. \ No newline at end of file diff --git a/mk/cfg/armv5te-unknown-linux-gnueabi.mk b/mk/cfg/armv5te-unknown-linux-gnueabi.mk deleted file mode 100644 index 98567a03c28..00000000000 --- a/mk/cfg/armv5te-unknown-linux-gnueabi.mk +++ /dev/null @@ -1,26 +0,0 @@ -# armv5-unknown-linux-gnueabi configuration -CROSS_PREFIX_armv5te-unknown-linux-gnueabi=arm-linux-gnueabi- -CC_armv5te-unknown-linux-gnueabi=gcc -CXX_armv5te-unknown-linux-gnueabi=g++ -CPP_armv5te-unknown-linux-gnueabi=gcc -E -AR_armv5te-unknown-linux-gnueabi=ar -CFG_LIB_NAME_armv5te-unknown-linux-gnueabi=lib$(1).so -CFG_STATIC_LIB_NAME_armv5te-unknown-linux-gnueabi=lib$(1).a -CFG_LIB_GLOB_armv5te-unknown-linux-gnueabi=lib$(1)-*.so -CFG_LIB_DSYM_GLOB_armv5te-unknown-linux-gnueabi=lib$(1)-*.dylib.dSYM -CFG_JEMALLOC_CFLAGS_armv5te-unknown-linux-gnueabi := -D__arm__ -mfloat-abi=soft $(CFLAGS) -march=armv5te -marm -CFG_GCCISH_CFLAGS_armv5te-unknown-linux-gnueabi := -Wall -g -fPIC -D__arm__ -mfloat-abi=soft $(CFLAGS) -march=armv5te -marm -CFG_GCCISH_CXXFLAGS_armv5te-unknown-linux-gnueabi := -fno-rtti $(CXXFLAGS) -CFG_GCCISH_LINK_FLAGS_armv5te-unknown-linux-gnueabi := -shared -fPIC -g -CFG_GCCISH_DEF_FLAG_armv5te-unknown-linux-gnueabi := -Wl,--export-dynamic,--dynamic-list= -CFG_LLC_FLAGS_armv5te-unknown-linux-gnueabi := -CFG_INSTALL_NAME_ar,-unknown-linux-gnueabi = -CFG_EXE_SUFFIX_armv5te-unknown-linux-gnueabi := -CFG_WINDOWSY_armv5te-unknown-linux-gnueabi := -CFG_UNIXY_armv5te-unknown-linux-gnueabi := 1 -CFG_LDPATH_armv5te-unknown-linux-gnueabi := -CFG_RUN_armv5te-unknown-linux-gnueabi=$(2) -CFG_RUN_TARG_armv5te-unknown-linux-gnueabi=$(call CFG_RUN_armv5te-unknown-linux-gnueabi,,$(2)) -RUSTC_FLAGS_armv5te-unknown-linux-gnueabi := -RUSTC_CROSS_FLAGS_armv5te-unknown-linux-gnueabi := -CFG_GNU_TRIPLE_armv5te-unknown-linux-gnueabi := armv5te-unknown-linux-gnueabi diff --git a/mk/cfg/armv7-apple-ios.mk b/mk/cfg/armv7-apple-ios.mk deleted file mode 100644 index 34ca4de6563..00000000000 --- a/mk/cfg/armv7-apple-ios.mk +++ /dev/null @@ -1,30 +0,0 @@ -# armv7-apple-ios configuration -CFG_SDK_NAME_armv7-apple-ios := iphoneos -CFG_SDK_ARCHS_armv7-apple-ios := armv7 -ifneq ($(findstring darwin,$(CFG_OSTYPE)),) -CFG_IOS_SDK_armv7-apple-ios := $(shell xcrun --show-sdk-path -sdk iphoneos 2>/dev/null) -CFG_IOS_SDK_FLAGS_armv7-apple-ios := -target armv7-apple-ios -isysroot $(CFG_IOS_SDK_armv7-apple-ios) -mios-version-min=7.0 -CC_armv7-apple-ios = $(shell xcrun -find -sdk iphoneos clang) -CXX_armv7-apple-ios = $(shell xcrun -find -sdk iphoneos clang++) -CPP_armv7-apple-ios = $(shell xcrun -find -sdk iphoneos clang++) -AR_armv7-apple-ios = $(shell xcrun -find -sdk iphoneos ar) -endif -CFG_LIB_NAME_armv7-apple-ios = lib$(1).a -CFG_LIB_GLOB_armv7-apple-ios = lib$(1)-*.a -CFG_INSTALL_ONLY_RLIB_armv7-apple-ios = 1 -CFG_STATIC_LIB_NAME_armv7-apple-ios=lib$(1).a -CFG_LIB_DSYM_GLOB_armv7-apple-ios = lib$(1)-*.a.dSYM -CFG_JEMALLOC_CFLAGS_armv7-apple-ios := -arch armv7 -mfpu=vfp3 $(CFG_IOS_SDK_FLAGS_armv7-apple-ios) -CFG_GCCISH_CFLAGS_armv7-apple-ios := -g -fPIC $(CFG_IOS_SDK_FLAGS_armv7-apple-ios) -mfpu=vfp3 -arch armv7 -CFG_GCCISH_CXXFLAGS_armv7-apple-ios := -fno-rtti $(CFG_IOS_SDK_FLAGS_armv7-apple-ios) -I$(CFG_IOS_SDK_armv7-apple-ios)/usr/include/c++/4.2.1 -CFG_GCCISH_LINK_FLAGS_armv7-apple-ios := -lpthread -syslibroot $(CFG_IOS_SDK_armv7-apple-ios) -Wl,-no_compact_unwind -CFG_GCCISH_DEF_FLAG_armv7-apple-ios := -Wl,-exported_symbols_list, -CFG_LLC_FLAGS_armv7-apple-ios := -mattr=+vfp3,+v7,+neon -march=arm -CFG_INSTALL_NAME_armv7-apple-ios = -Wl,-install_name,@rpath/$(1) -CFG_EXE_SUFFIX_armv7-apple-ios := -CFG_WINDOWSY_armv7-apple-ios := -CFG_UNIXY_armv7-apple-ios := 1 -CFG_LDPATH_armv7-apple-ios := -CFG_RUN_armv7-apple-ios = $(2) -CFG_RUN_TARG_armv7-apple-ios = $(call CFG_RUN_armv7-apple-ios,,$(2)) -CFG_GNU_TRIPLE_armv7-apple-ios := armv7-apple-ios diff --git a/mk/cfg/armv7-linux-androideabi.mk b/mk/cfg/armv7-linux-androideabi.mk deleted file mode 100644 index e5bf2e4df7a..00000000000 --- a/mk/cfg/armv7-linux-androideabi.mk +++ /dev/null @@ -1,25 +0,0 @@ -# armv7-linux-androideabi configuration -CC_armv7-linux-androideabi=$(CFG_ARMV7_LINUX_ANDROIDEABI_NDK)/bin/arm-linux-androideabi-gcc -CXX_armv7-linux-androideabi=$(CFG_ARMV7_LINUX_ANDROIDEABI_NDK)/bin/arm-linux-androideabi-g++ -CPP_armv7-linux-androideabi=$(CFG_ARMV7_LINUX_ANDROIDEABI_NDK)/bin/arm-linux-androideabi-gcc -E -AR_armv7-linux-androideabi=$(CFG_ARMV7_LINUX_ANDROIDEABI_NDK)/bin/arm-linux-androideabi-ar -CFG_LIB_NAME_armv7-linux-androideabi=lib$(1).so -CFG_STATIC_LIB_NAME_armv7-linux-androideabi=lib$(1).a -CFG_LIB_GLOB_armv7-linux-androideabi=lib$(1)-*.so -CFG_LIB_DSYM_GLOB_armv7-linux-androideabi=lib$(1)-*.dylib.dSYM -CFG_JEMALLOC_CFLAGS_armv7-linux-androideabi := -D__arm__ -DANDROID -D__ANDROID__ $(CFLAGS) -CFG_GCCISH_CFLAGS_armv7-linux-androideabi := -Wall -g -fPIC -D__arm__ -mfloat-abi=softfp -march=armv7-a -mfpu=vfpv3-d16 -DANDROID -D__ANDROID__ $(CFLAGS) -CFG_GCCISH_CXXFLAGS_armv7-linux-androideabi := -fno-rtti $(CXXFLAGS) -CFG_GCCISH_LINK_FLAGS_armv7-linux-androideabi := -shared -fPIC -ldl -g -lm -lsupc++ -CFG_GCCISH_DEF_FLAG_armv7-linux-androideabi := -Wl,--export-dynamic,--dynamic-list= -CFG_LLC_FLAGS_armv7-linux-androideabi := -CFG_INSTALL_NAME_armv7-linux-androideabi = -CFG_EXE_SUFFIX_armv7-linux-androideabi := -CFG_WINDOWSY_armv7-linux-androideabi := -CFG_UNIXY_armv7-linux-androideabi := 1 -CFG_LDPATH_armv7-linux-androideabi := -CFG_RUN_armv7-linux-androideabi= -CFG_RUN_TARG_armv7-linux-androideabi= -RUSTC_FLAGS_armv7-linux-androideabi := -RUSTC_CROSS_FLAGS_armv7-linux-androideabi := -CFG_GNU_TRIPLE_armv7-linux-androideabi := arm-linux-androideabi diff --git a/mk/cfg/armv7-unknown-linux-gnueabihf.mk b/mk/cfg/armv7-unknown-linux-gnueabihf.mk deleted file mode 100644 index a8e39668ded..00000000000 --- a/mk/cfg/armv7-unknown-linux-gnueabihf.mk +++ /dev/null @@ -1,26 +0,0 @@ -# armv7-unknown-linux-gnueabihf configuration -CROSS_PREFIX_armv7-unknown-linux-gnueabihf=arm-linux-gnueabihf- -CC_armv7-unknown-linux-gnueabihf=gcc -CXX_armv7-unknown-linux-gnueabihf=g++ -CPP_armv7-unknown-linux-gnueabihf=gcc -E -AR_armv7-unknown-linux-gnueabihf=ar -CFG_LIB_NAME_armv7-unknown-linux-gnueabihf=lib$(1).so -CFG_STATIC_LIB_NAME_armv7-unknown-linux-gnueabihf=lib$(1).a -CFG_LIB_GLOB_armv7-unknown-linux-gnueabihf=lib$(1)-*.so -CFG_LIB_DSYM_GLOB_armv7-unknown-linux-gnueabihf=lib$(1)-*.dylib.dSYM -CFG_JEMALLOC_CFLAGS_armv7-unknown-linux-gnueabihf := -D__arm__ $(CFLAGS) -march=armv7-a -CFG_GCCISH_CFLAGS_armv7-unknown-linux-gnueabihf := -Wall -g -fPIC -D__arm__ $(CFLAGS) -march=armv7-a -CFG_GCCISH_CXXFLAGS_armv7-unknown-linux-gnueabihf := -fno-rtti $(CXXFLAGS) -CFG_GCCISH_LINK_FLAGS_armv7-unknown-linux-gnueabihf := -shared -fPIC -g -CFG_GCCISH_DEF_FLAG_armv7-unknown-linux-gnueabihf := -Wl,--export-dynamic,--dynamic-list= -CFG_LLC_FLAGS_armv7-unknown-linux-gnueabihf := -CFG_INSTALL_NAME_ar,-unknown-linux-gnueabihf = -CFG_EXE_SUFFIX_armv7-unknown-linux-gnueabihf := -CFG_WINDOWSY_armv7-unknown-linux-gnueabihf := -CFG_UNIXY_armv7-unknown-linux-gnueabihf := 1 -CFG_LDPATH_armv7-unknown-linux-gnueabihf := -CFG_RUN_armv7-unknown-linux-gnueabihf=$(2) -CFG_RUN_TARG_armv7-unknown-linux-gnueabihf=$(call CFG_RUN_armv7-unknown-linux-gnueabihf,,$(2)) -RUSTC_FLAGS_armv7-unknown-linux-gnueabihf := -RUSTC_CROSS_FLAGS_armv7-unknown-linux-gnueabihf := -CFG_GNU_TRIPLE_armv7-unknown-linux-gnueabihf := armv7-unknown-linux-gnueabihf diff --git a/mk/cfg/armv7-unknown-linux-musleabihf.mk b/mk/cfg/armv7-unknown-linux-musleabihf.mk deleted file mode 100644 index 8120250150d..00000000000 --- a/mk/cfg/armv7-unknown-linux-musleabihf.mk +++ /dev/null @@ -1,3 +0,0 @@ -# This file is intentially left empty to indicate that, while this target is -# supported, it's not supported using plain GNU Make builds. Use a --rustbuild -# instead. \ No newline at end of file diff --git a/mk/cfg/armv7s-apple-ios.mk b/mk/cfg/armv7s-apple-ios.mk deleted file mode 100644 index 6da7905a700..00000000000 --- a/mk/cfg/armv7s-apple-ios.mk +++ /dev/null @@ -1,30 +0,0 @@ -# armv7s-apple-ios configuration -CFG_SDK_NAME_armv7s-apple-ios := iphoneos -CFG_SDK_ARCHS_armv7s-apple-ios := armv7s -ifneq ($(findstring darwin,$(CFG_OSTYPE)),) -CFG_IOS_SDK_armv7s-apple-ios := $(shell xcrun --show-sdk-path -sdk iphoneos 2>/dev/null) -CFG_IOS_SDK_FLAGS_armv7s-apple-ios := -target armv7s-apple-ios -isysroot $(CFG_IOS_SDK_armv7s-apple-ios) -mios-version-min=7.0 -CC_armv7s-apple-ios = $(shell xcrun -find -sdk iphoneos clang) -CXX_armv7s-apple-ios = $(shell xcrun -find -sdk iphoneos clang++) -CPP_armv7s-apple-ios = $(shell xcrun -find -sdk iphoneos clang++) -AR_armv7s-apple-ios = $(shell xcrun -find -sdk iphoneos ar) -endif -CFG_LIB_NAME_armv7s-apple-ios = lib$(1).a -CFG_LIB_GLOB_armv7s-apple-ios = lib$(1)-*.a -CFG_INSTALL_ONLY_RLIB_armv7s-apple-ios = 1 -CFG_STATIC_LIB_NAME_armv7s-apple-ios=lib$(1).a -CFG_LIB_DSYM_GLOB_armv7s-apple-ios = lib$(1)-*.a.dSYM -CFG_JEMALLOC_CFLAGS_armv7s-apple-ios := -arch armv7s $(CFG_IOS_SDK_FLAGS_armv7s-apple-ios) -CFG_GCCISH_CFLAGS_armv7s-apple-ios := -g -fPIC $(CFG_IOS_SDK_FLAGS_armv7s-apple-ios) -arch armv7s -CFG_GCCISH_CXXFLAGS_armv7s-apple-ios := -fno-rtti $(CFG_IOS_SDK_FLAGS_armv7s-apple-ios) -I$(CFG_IOS_SDK_armv7s-apple-ios)/usr/include/c++/4.2.1 -CFG_GCCISH_LINK_FLAGS_armv7s-apple-ios := -lpthread -syslibroot $(CFG_IOS_SDK_armv7s-apple-ios) -Wl,-no_compact_unwind -CFG_GCCISH_DEF_FLAG_armv7s-apple-ios := -Wl,-exported_symbols_list, -CFG_LLC_FLAGS_armv7s-apple-ios := -mattr=+vfp4,+v7,+neon -CFG_INSTALL_NAME_armv7s-apple-ios = -Wl,-install_name,@rpath/$(1) -CFG_EXE_SUFFIX_armv7s-apple-ios := -CFG_WINDOWSY_armv7s-apple-ios := -CFG_UNIXY_armv7s-apple-ios := 1 -CFG_LDPATH_armv7s-apple-ios := -CFG_RUN_armv7s-apple-ios = $(2) -CFG_RUN_TARG_armv7s-apple-ios = $(call CFG_RUN_armv7s-apple-ios,,$(2)) -CFG_GNU_TRIPLE_armv7s-apple-ios := armv7s-apple-ios diff --git a/mk/cfg/asmjs-unknown-emscripten.mk b/mk/cfg/asmjs-unknown-emscripten.mk deleted file mode 100644 index a98a51b06b5..00000000000 --- a/mk/cfg/asmjs-unknown-emscripten.mk +++ /dev/null @@ -1,24 +0,0 @@ -# asmjs-unknown-emscripten configuration -CC_asmjs-unknown-emscripten=emcc -CXX_asmjs-unknown-emscripten=em++ -CPP_asmjs-unknown-emscripten=$(CPP) -AR_asmjs-unknown-emscripten=emar -CFG_LIB_NAME_asmjs-unknown-emscripten=lib$(1).so -CFG_STATIC_LIB_NAME_asmjs-unknown-emscripten=lib$(1).a -CFG_LIB_GLOB_asmjs-unknown-emscripten=lib$(1)-*.so -CFG_LIB_DSYM_GLOB_asmjs-unknown-emscripten=lib$(1)-*.dylib.dSYM -CFG_JEMALLOC_CFLAGS_asmjs-unknown-emscripten := -m32 $(CFLAGS) -CFG_GCCISH_CFLAGS_asmjs-unknown-emscripten := -g -fPIC -m32 $(CFLAGS) -CFG_GCCISH_CXXFLAGS_asmjs-unknown-emscripten := -fno-rtti $(CXXFLAGS) -CFG_GCCISH_LINK_FLAGS_asmjs-unknown-emscripten := -shared -fPIC -ldl -pthread -lrt -g -m32 -CFG_GCCISH_DEF_FLAG_asmjs-unknown-emscripten := -Wl,--export-dynamic,--dynamic-list= -CFG_LLC_FLAGS_asmjs-unknown-emscripten := -CFG_INSTALL_NAME_asmjs-unknown-emscripten = -CFG_EXE_SUFFIX_asmjs-unknown-emscripten = -CFG_WINDOWSY_asmjs-unknown-emscripten := -CFG_UNIXY_asmjs-unknown-emscripten := 1 -CFG_LDPATH_asmjs-unknown-emscripten := -CFG_RUN_asmjs-unknown-emscripten=$(2) -CFG_RUN_TARG_asmjs-unknown-emscripten=$(call CFG_RUN_asmjs-unknown-emscripten,,$(2)) -CFG_GNU_TRIPLE_asmjs-unknown-emscripten := asmjs-unknown-emscripten -CFG_DISABLE_JEMALLOC_asmjs-unknown-emscripten := 1 diff --git a/mk/cfg/i386-apple-ios.mk b/mk/cfg/i386-apple-ios.mk deleted file mode 100644 index bfb7fa281f2..00000000000 --- a/mk/cfg/i386-apple-ios.mk +++ /dev/null @@ -1,30 +0,0 @@ -# i386-apple-ios configuration -CFG_SDK_NAME_i386-apple-ios := iphonesimulator -CFG_SDK_ARCHS_i386-apple-ios := i386 -ifneq ($(findstring darwin,$(CFG_OSTYPE)),) -CFG_IOSSIM_SDK_i386-apple-ios := $(shell xcrun --show-sdk-path -sdk iphonesimulator 2>/dev/null) -CFG_IOSSIM_FLAGS_i386-apple-ios := -m32 -target i386-apple-ios -isysroot $(CFG_IOSSIM_SDK_i386-apple-ios) -mios-simulator-version-min=7.0 -CC_i386-apple-ios = $(shell xcrun -find -sdk iphonesimulator clang) -CXX_i386-apple-ios = $(shell xcrun -find -sdk iphonesimulator clang++) -CPP_i386-apple-ios = $(shell xcrun -find -sdk iphonesimulator clang++) -AR_i386-apple-ios = $(shell xcrun -find -sdk iphonesimulator ar) -endif -CFG_LIB_NAME_i386-apple-ios = lib$(1).a -CFG_LIB_GLOB_i386-apple-ios = lib$(1)-*.dylib -CFG_INSTALL_ONLY_RLIB_i386-apple-ios = 1 -CFG_STATIC_LIB_NAME_i386-apple-ios=lib$(1).a -CFG_LIB_DSYM_GLOB_i386-apple-ios = lib$(1)-*.dylib.dSYM -CFG_GCCISH_CFLAGS_i386-apple-ios := -g -fPIC -m32 $(CFG_IOSSIM_FLAGS_i386-apple-ios) -CFG_GCCISH_CXXFLAGS_i386-apple-ios := -fno-rtti $(CFG_IOSSIM_FLAGS_i386-apple-ios) -I$(CFG_IOSSIM_SDK_i386-apple-ios)/usr/include/c++/4.2.1 -CFG_GCCISH_LINK_FLAGS_i386-apple-ios := -lpthread -m32 -Wl,-no_compact_unwind -m32 -Wl,-syslibroot $(CFG_IOSSIM_SDK_i386-apple-ios) -CFG_GCCISH_DEF_FLAG_i386-apple-ios := -Wl,-exported_symbols_list, -CFG_LLC_FLAGS_i386-apple-ios = -CFG_INSTALL_NAME_i386-apple-ios = -Wl,-install_name,@rpath/$(1) -CFG_EXE_SUFFIX_i386-apple-ios := -CFG_WINDOWSY_i386-apple-ios := -CFG_UNIXY_i386-apple-ios := 1 -CFG_LDPATH_i386-apple-ios = -CFG_RUN_i386-apple-ios = $(2) -CFG_RUN_TARG_i386-apple-ios = $(call CFG_RUN_i386-apple-ios,,$(2)) -CFG_JEMALLOC_CFLAGS_i386-apple-ios = $(CFG_IOSSIM_FLAGS_i386-apple-ios) -target i386-apple-ios #-Wl,-syslibroot $(CFG_IOSSIM_SDK_i386-apple-ios) -Wl,-no_compact_unwind -CFG_GNU_TRIPLE_i386-apple-ios := i386-apple-ios diff --git a/mk/cfg/i586-pc-windows-msvc.mk b/mk/cfg/i586-pc-windows-msvc.mk deleted file mode 100644 index 48f1ecec3a7..00000000000 --- a/mk/cfg/i586-pc-windows-msvc.mk +++ /dev/null @@ -1,28 +0,0 @@ -# i586-pc-windows-msvc configuration -CC_i586-pc-windows-msvc=$(CFG_MSVC_CL_i386) -LINK_i586-pc-windows-msvc=$(CFG_MSVC_LINK_i386) -CXX_i586-pc-windows-msvc=$(CFG_MSVC_CL_i386) -CPP_i586-pc-windows-msvc=$(CFG_MSVC_CL_i386) -AR_i586-pc-windows-msvc=$(CFG_MSVC_LIB_i386) -CFG_LIB_NAME_i586-pc-windows-msvc=$(1).dll -CFG_STATIC_LIB_NAME_i586-pc-windows-msvc=$(1).lib -CFG_LIB_GLOB_i586-pc-windows-msvc=$(1)-*.{dll,lib} -CFG_LIB_DSYM_GLOB_i586-pc-windows-msvc=$(1)-*.dylib.dSYM -CFG_JEMALLOC_CFLAGS_i586-pc-windows-msvc := -CFG_GCCISH_CFLAGS_i586-pc-windows-msvc := -MD -arch:IA32 -nologo -CFG_GCCISH_CXXFLAGS_i586-pc-windows-msvc := -MD -arch:IA32 -nologo -CFG_GCCISH_LINK_FLAGS_i586-pc-windows-msvc := -CFG_GCCISH_DEF_FLAG_i586-pc-windows-msvc := -CFG_LLC_FLAGS_i586-pc-windows-msvc := -CFG_INSTALL_NAME_i586-pc-windows-msvc = -CFG_EXE_SUFFIX_i586-pc-windows-msvc := .exe -CFG_WINDOWSY_i586-pc-windows-msvc := 1 -CFG_UNIXY_i586-pc-windows-msvc := -CFG_LDPATH_i586-pc-windows-msvc := -CFG_RUN_i586-pc-windows-msvc=$(2) -CFG_RUN_TARG_i586-pc-windows-msvc=$(call CFG_RUN_i586-pc-windows-msvc,,$(2)) -CFG_GNU_TRIPLE_i586-pc-windows-msvc := i586-pc-win32 - -# Currently the build system is not configured to build jemalloc -# with MSVC, so we omit this optional dependency. -CFG_DISABLE_JEMALLOC_i586-pc-windows-msvc := 1 diff --git a/mk/cfg/i586-unknown-linux-gnu.mk b/mk/cfg/i586-unknown-linux-gnu.mk deleted file mode 100644 index fa2909196dc..00000000000 --- a/mk/cfg/i586-unknown-linux-gnu.mk +++ /dev/null @@ -1,23 +0,0 @@ -# i586-unknown-linux-gnu configuration -CC_i586-unknown-linux-gnu=$(CC) -CXX_i586-unknown-linux-gnu=$(CXX) -CPP_i586-unknown-linux-gnu=$(CPP) -AR_i586-unknown-linux-gnu=$(AR) -CFG_LIB_NAME_i586-unknown-linux-gnu=lib$(1).so -CFG_STATIC_LIB_NAME_i586-unknown-linux-gnu=lib$(1).a -CFG_LIB_GLOB_i586-unknown-linux-gnu=lib$(1)-*.so -CFG_LIB_DSYM_GLOB_i586-unknown-linux-gnu=lib$(1)-*.dylib.dSYM -CFG_JEMALLOC_CFLAGS_i586-unknown-linux-gnu := -m32 $(CFLAGS) -march=pentium -Wa,-mrelax-relocations=no -CFG_GCCISH_CFLAGS_i586-unknown-linux-gnu := -g -fPIC -m32 $(CFLAGS) -march=pentium -Wa,-mrelax-relocations=no -CFG_GCCISH_CXXFLAGS_i586-unknown-linux-gnu := -fno-rtti $(CXXFLAGS) -march=pentium -CFG_GCCISH_LINK_FLAGS_i586-unknown-linux-gnu := -shared -fPIC -ldl -pthread -lrt -g -m32 -CFG_GCCISH_DEF_FLAG_i586-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list= -CFG_LLC_FLAGS_i586-unknown-linux-gnu := -CFG_INSTALL_NAME_i586-unknown-linux-gnu = -CFG_EXE_SUFFIX_i586-unknown-linux-gnu = -CFG_WINDOWSY_i586-unknown-linux-gnu := -CFG_UNIXY_i586-unknown-linux-gnu := 1 -CFG_LDPATH_i586-unknown-linux-gnu := -CFG_RUN_i586-unknown-linux-gnu=$(2) -CFG_RUN_TARG_i586-unknown-linux-gnu=$(call CFG_RUN_i586-unknown-linux-gnu,,$(2)) -CFG_GNU_TRIPLE_i586-unknown-linux-gnu := i586-unknown-linux-gnu diff --git a/mk/cfg/i686-apple-darwin.mk b/mk/cfg/i686-apple-darwin.mk deleted file mode 100644 index e4b3431e8b6..00000000000 --- a/mk/cfg/i686-apple-darwin.mk +++ /dev/null @@ -1,23 +0,0 @@ -# i686-apple-darwin configuration -CC_i686-apple-darwin=$(CC) -CXX_i686-apple-darwin=$(CXX) -CPP_i686-apple-darwin=$(CPP) -AR_i686-apple-darwin=$(AR) -CFG_LIB_NAME_i686-apple-darwin=lib$(1).dylib -CFG_STATIC_LIB_NAME_i686-apple-darwin=lib$(1).a -CFG_LIB_GLOB_i686-apple-darwin=lib$(1)-*.dylib -CFG_LIB_DSYM_GLOB_i686-apple-darwin=lib$(1)-*.dylib.dSYM -CFG_JEMALLOC_CFLAGS_i686-apple-darwin := -m32 -arch i386 $(CFLAGS) -CFG_GCCISH_CFLAGS_i686-apple-darwin := -g -fPIC -m32 -arch i386 $(CFLAGS) -CFG_GCCISH_CXXFLAGS_i686-apple-darwin := -fno-rtti $(CXXFLAGS) -CFG_GCCISH_LINK_FLAGS_i686-apple-darwin := -dynamiclib -pthread -framework CoreServices -m32 -CFG_GCCISH_DEF_FLAG_i686-apple-darwin := -Wl,-exported_symbols_list, -CFG_LLC_FLAGS_i686-apple-darwin := -CFG_INSTALL_NAME_i686-apple-darwin = -Wl,-install_name,@rpath/$(1) -CFG_EXE_SUFFIX_i686-apple-darwin := -CFG_WINDOWSY_i686-apple-darwin := -CFG_UNIXY_i686-apple-darwin := 1 -CFG_LDPATH_i686-apple-darwin := -CFG_RUN_i686-apple-darwin=$(2) -CFG_RUN_TARG_i686-apple-darwin=$(call CFG_RUN_i686-apple-darwin,,$(2)) -CFG_GNU_TRIPLE_i686-apple-darwin := i686-apple-darwin diff --git a/mk/cfg/i686-linux-android.mk b/mk/cfg/i686-linux-android.mk deleted file mode 100644 index 2843a8e9be5..00000000000 --- a/mk/cfg/i686-linux-android.mk +++ /dev/null @@ -1,25 +0,0 @@ -# i686-linux-android configuration -CC_i686-linux-android=$(CFG_I686_LINUX_ANDROID_NDK)/bin/i686-linux-android-gcc -CXX_i686-linux-android=$(CFG_I686_LINUX_ANDROID_NDK)/bin/i686-linux-android-g++ -CPP_i686-linux-android=$(CFG_I686_LINUX_ANDROID_NDK)/bin/i686-linux-android-gcc -E -AR_i686-linux-android=$(CFG_I686_LINUX_ANDROID_NDK)/bin/i686-linux-android-ar -CFG_LIB_NAME_i686-linux-android=lib$(1).so -CFG_STATIC_LIB_NAME_i686-linux-android=lib$(1).a -CFG_LIB_GLOB_i686-linux-android=lib$(1)-*.so -CFG_LIB_DSYM_GLOB_i686-linux-android=lib$(1)-*.dylib.dSYM -CFG_JEMALLOC_CFLAGS_i686-linux-android := -D__i686__ -DANDROID -D__ANDROID__ $(CFLAGS) -CFG_GCCISH_CFLAGS_i686-linux-android := -Wall -g -fPIC -D__i686__ -DANDROID -D__ANDROID__ $(CFLAGS) -CFG_GCCISH_CXXFLAGS_i686-linux-android := -fno-rtti $(CXXFLAGS) -CFG_GCCISH_LINK_FLAGS_i686-linux-android := -shared -fPIC -ldl -g -lm -lsupc++ -CFG_GCCISH_DEF_FLAG_i686-linux-android := -Wl,--export-dynamic,--dynamic-list= -CFG_LLC_FLAGS_i686-linux-android := -CFG_INSTALL_NAME_i686-linux-android = -CFG_EXE_SUFFIX_i686-linux-android := -CFG_WINDOWSY_i686-linux-android := -CFG_UNIXY_i686-linux-android := 1 -CFG_LDPATH_i686-linux-android := -CFG_RUN_i686-linux-android= -CFG_RUN_TARG_i686-linux-android= -RUSTC_FLAGS_i686-linux-android := -RUSTC_CROSS_FLAGS_i686-linux-android := -CFG_GNU_TRIPLE_i686-linux-android := i686-linux-android diff --git a/mk/cfg/i686-pc-windows-gnu.mk b/mk/cfg/i686-pc-windows-gnu.mk deleted file mode 100644 index 50c2b8c98ac..00000000000 --- a/mk/cfg/i686-pc-windows-gnu.mk +++ /dev/null @@ -1,27 +0,0 @@ -# i686-pc-windows-gnu configuration -CROSS_PREFIX_i686-pc-windows-gnu=i686-w64-mingw32- -CC_i686-pc-windows-gnu=gcc -CXX_i686-pc-windows-gnu=g++ -CPP_i686-pc-windows-gnu=gcc -E -AR_i686-pc-windows-gnu=ar -CFG_LIB_NAME_i686-pc-windows-gnu=$(1).dll -CFG_STATIC_LIB_NAME_i686-pc-windows-gnu=$(1).lib -CFG_LIB_GLOB_i686-pc-windows-gnu=$(1)-*.dll -CFG_LIB_DSYM_GLOB_i686-pc-windows-gnu=$(1)-*.dylib.dSYM -CFG_JEMALLOC_CFLAGS_i686-pc-windows-gnu := -march=i686 -m32 -D_WIN32_WINNT=0x0600 -D__USE_MINGW_ANSI_STDIO=1 $(CFLAGS) -CFG_GCCISH_CFLAGS_i686-pc-windows-gnu := -g -m32 -D_WIN32_WINNT=0x0600 -D__USE_MINGW_ANSI_STDIO=1 $(CFLAGS) -CFG_GCCISH_CXXFLAGS_i686-pc-windows-gnu := -fno-rtti $(CXXFLAGS) -CFG_GCCISH_LINK_FLAGS_i686-pc-windows-gnu := -shared -g -m32 -CFG_GCCISH_DEF_FLAG_i686-pc-windows-gnu := -CFG_LLC_FLAGS_i686-pc-windows-gnu := -CFG_INSTALL_NAME_i686-pc-windows-gnu = -CFG_EXE_SUFFIX_i686-pc-windows-gnu := .exe -CFG_WINDOWSY_i686-pc-windows-gnu := 1 -CFG_UNIXY_i686-pc-windows-gnu := -CFG_LDPATH_i686-pc-windows-gnu := -CFG_RUN_i686-pc-windows-gnu=$(2) -CFG_RUN_TARG_i686-pc-windows-gnu=$(call CFG_RUN_i686-pc-windows-gnu,,$(2)) -CFG_GNU_TRIPLE_i686-pc-windows-gnu := i686-w64-mingw32 -CFG_THIRD_PARTY_OBJECTS_i686-pc-windows-gnu := crt2.o dllcrt2.o -CFG_INSTALLED_OBJECTS_i686-pc-windows-gnu := crt2.o dllcrt2.o rsbegin.o rsend.o -CFG_RUSTRT_HAS_STARTUP_OBJS_i686-pc-windows-gnu := 1 diff --git a/mk/cfg/i686-pc-windows-msvc.mk b/mk/cfg/i686-pc-windows-msvc.mk deleted file mode 100644 index b0289b9892e..00000000000 --- a/mk/cfg/i686-pc-windows-msvc.mk +++ /dev/null @@ -1,28 +0,0 @@ -# i686-pc-windows-msvc configuration -CC_i686-pc-windows-msvc=$(CFG_MSVC_CL_i386) -LINK_i686-pc-windows-msvc=$(CFG_MSVC_LINK_i386) -CXX_i686-pc-windows-msvc=$(CFG_MSVC_CL_i386) -CPP_i686-pc-windows-msvc=$(CFG_MSVC_CL_i386) -AR_i686-pc-windows-msvc=$(CFG_MSVC_LIB_i386) -CFG_LIB_NAME_i686-pc-windows-msvc=$(1).dll -CFG_STATIC_LIB_NAME_i686-pc-windows-msvc=$(1).lib -CFG_LIB_GLOB_i686-pc-windows-msvc=$(1)-*.{dll,lib} -CFG_LIB_DSYM_GLOB_i686-pc-windows-msvc=$(1)-*.dylib.dSYM -CFG_JEMALLOC_CFLAGS_i686-pc-windows-msvc := -CFG_GCCISH_CFLAGS_i686-pc-windows-msvc := -MD -nologo -CFG_GCCISH_CXXFLAGS_i686-pc-windows-msvc := -MD -nologo -CFG_GCCISH_LINK_FLAGS_i686-pc-windows-msvc := -CFG_GCCISH_DEF_FLAG_i686-pc-windows-msvc := -CFG_LLC_FLAGS_i686-pc-windows-msvc := -CFG_INSTALL_NAME_i686-pc-windows-msvc = -CFG_EXE_SUFFIX_i686-pc-windows-msvc := .exe -CFG_WINDOWSY_i686-pc-windows-msvc := 1 -CFG_UNIXY_i686-pc-windows-msvc := -CFG_LDPATH_i686-pc-windows-msvc := -CFG_RUN_i686-pc-windows-msvc=$(2) -CFG_RUN_TARG_i686-pc-windows-msvc=$(call CFG_RUN_i686-pc-windows-msvc,,$(2)) -CFG_GNU_TRIPLE_i686-pc-windows-msvc := i686-pc-win32 - -# Currently the build system is not configured to build jemalloc -# with MSVC, so we omit this optional dependency. -CFG_DISABLE_JEMALLOC_i686-pc-windows-msvc := 1 diff --git a/mk/cfg/i686-unknown-freebsd.mk b/mk/cfg/i686-unknown-freebsd.mk deleted file mode 100644 index a9d4446d5d4..00000000000 --- a/mk/cfg/i686-unknown-freebsd.mk +++ /dev/null @@ -1,22 +0,0 @@ -# i686-unknown-freebsd configuration -CC_i686-unknown-freebsd=$(CC) -CXX_i686-unknown-freebsd=$(CXX) -CPP_i686-unknown-freebsd=$(CPP) -AR_i686-unknown-freebsd=$(AR) -CFG_LIB_NAME_i686-unknown-freebsd=lib$(1).so -CFG_STATIC_LIB_NAME_i686-unknown-freebsd=lib$(1).a -CFG_LIB_GLOB_i686-unknown-freebsd=lib$(1)-*.so -CFG_LIB_DSYM_GLOB_i686-unknown-freebsd=$(1)-*.dylib.dSYM -CFG_JEMALLOC_CFLAGS_i686-unknown-freebsd := -m32 -I/usr/local/include $(CFLAGS) -CFG_GCCISH_CFLAGS_i686-unknown-freebsd := -g -fPIC -m32 -arch i386 -I/usr/local/include $(CFLAGS) -CFG_GCCISH_LINK_FLAGS_i686-unknown-freebsd := -m32 -shared -fPIC -g -pthread -lrt -CFG_GCCISH_DEF_FLAG_i686-unknown-freebsd := -Wl,--export-dynamic,--dynamic-list= -CFG_LLC_FLAGS_i686-unknown-freebsd := -CFG_INSTALL_NAME_i686-unknown-freebsd = -CFG_EXE_SUFFIX_i686-unknown-freebsd := -CFG_WINDOWSY_i686-unknown-freebsd := -CFG_UNIXY_i686-unknown-freebsd := 1 -CFG_LDPATH_i686-unknown-freebsd := -CFG_RUN_i686-unknown-freebsd=$(2) -CFG_RUN_TARG_i686-unknown-freebsd=$(call CFG_RUN_i686-unknown-freebsd,,$(2)) -CFG_GNU_TRIPLE_i686-unknown-freebsd := i686-unknown-freebsd diff --git a/mk/cfg/i686-unknown-haiku.mk b/mk/cfg/i686-unknown-haiku.mk deleted file mode 100644 index cbacbff070e..00000000000 --- a/mk/cfg/i686-unknown-haiku.mk +++ /dev/null @@ -1,27 +0,0 @@ -# i686-unknown-haiku configuration -CROSS_PREFIX_i686-unknown-haiku=i586-pc-haiku- -CC_i686-unknown-haiku=$(CC) -CXX_i686-unknown-haiku=$(CXX) -CPP_i686-unknown-haiku=$(CPP) -AR_i686-unknown-haiku=$(AR) -CFG_LIB_NAME_i686-unknown-haiku=lib$(1).so -CFG_STATIC_LIB_NAME_i686-unknown-haiku=lib$(1).a -CFG_LIB_GLOB_i686-unknown-haiku=lib$(1)-*.so -CFG_LIB_DSYM_GLOB_i686-unknown-haiku=lib$(1)-*.dylib.dSYM -CFG_CFLAGS_i686-unknown-haiku := -m32 $(CFLAGS) -CFG_GCCISH_CFLAGS_i686-unknown-haiku := -Wall -Werror -g -fPIC -m32 $(CFLAGS) -CFG_GCCISH_CXXFLAGS_i686-unknown-haiku := -fno-rtti $(CXXFLAGS) -CFG_GCCISH_LINK_FLAGS_i686-unknown-haiku := -shared -fPIC -ldl -pthread -lrt -g -m32 -CFG_GCCISH_PRE_LIB_FLAGS_i686-unknown-haiku := -Wl,-whole-archive -CFG_GCCISH_POST_LIB_FLAGS_i686-unknown-haiku := -Wl,-no-whole-archive -CFG_DEF_SUFFIX_i686-unknown-haiku := .linux.def -CFG_LLC_FLAGS_i686-unknown-haiku := -CFG_INSTALL_NAME_i686-unknown-haiku = -CFG_EXE_SUFFIX_i686-unknown-haiku = -CFG_WINDOWSY_i686-unknown-haiku := -CFG_UNIXY_i686-unknown-haiku := 1 -CFG_PATH_MUNGE_i686-unknown-haiku := true -CFG_LDPATH_i686-unknown-haiku := -CFG_RUN_i686-unknown-haiku=$(2) -CFG_RUN_TARG_i686-unknown-haiku=$(call CFG_RUN_i686-unknown-haiku,,$(2)) -CFG_GNU_TRIPLE_i686-unknown-haiku := i686-unknown-haiku diff --git a/mk/cfg/i686-unknown-linux-gnu.mk b/mk/cfg/i686-unknown-linux-gnu.mk deleted file mode 100644 index 9e2312008a1..00000000000 --- a/mk/cfg/i686-unknown-linux-gnu.mk +++ /dev/null @@ -1,23 +0,0 @@ -# i686-unknown-linux-gnu configuration -CC_i686-unknown-linux-gnu=$(CC) -CXX_i686-unknown-linux-gnu=$(CXX) -CPP_i686-unknown-linux-gnu=$(CPP) -AR_i686-unknown-linux-gnu=$(AR) -CFG_LIB_NAME_i686-unknown-linux-gnu=lib$(1).so -CFG_STATIC_LIB_NAME_i686-unknown-linux-gnu=lib$(1).a -CFG_LIB_GLOB_i686-unknown-linux-gnu=lib$(1)-*.so -CFG_LIB_DSYM_GLOB_i686-unknown-linux-gnu=lib$(1)-*.dylib.dSYM -CFG_JEMALLOC_CFLAGS_i686-unknown-linux-gnu := -m32 $(CFLAGS) -CFG_GCCISH_CFLAGS_i686-unknown-linux-gnu := -g -fPIC -m32 $(CFLAGS) -march=i686 -CFG_GCCISH_CXXFLAGS_i686-unknown-linux-gnu := -fno-rtti $(CXXFLAGS) -CFG_GCCISH_LINK_FLAGS_i686-unknown-linux-gnu := -shared -fPIC -ldl -pthread -lrt -g -m32 -CFG_GCCISH_DEF_FLAG_i686-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list= -CFG_LLC_FLAGS_i686-unknown-linux-gnu := -CFG_INSTALL_NAME_i686-unknown-linux-gnu = -CFG_EXE_SUFFIX_i686-unknown-linux-gnu = -CFG_WINDOWSY_i686-unknown-linux-gnu := -CFG_UNIXY_i686-unknown-linux-gnu := 1 -CFG_LDPATH_i686-unknown-linux-gnu := -CFG_RUN_i686-unknown-linux-gnu=$(2) -CFG_RUN_TARG_i686-unknown-linux-gnu=$(call CFG_RUN_i686-unknown-linux-gnu,,$(2)) -CFG_GNU_TRIPLE_i686-unknown-linux-gnu := i686-unknown-linux-gnu diff --git a/mk/cfg/i686-unknown-linux-musl.mk b/mk/cfg/i686-unknown-linux-musl.mk deleted file mode 100644 index d6c1ce8967a..00000000000 --- a/mk/cfg/i686-unknown-linux-musl.mk +++ /dev/null @@ -1,29 +0,0 @@ -# i686-unknown-linux-musl configuration -CC_i686-unknown-linux-musl=$(CFG_MUSL_ROOT)/bin/musl-gcc -CXX_i686-unknown-linux-musl=$(CXX) -CPP_i686-unknown-linux-musl=$(CFG_MUSL_ROOT)/bin/musl-gcc -E -AR_i686-unknown-linux-musl=$(AR) -CFG_INSTALL_ONLY_RLIB_i686-unknown-linux-musl = 1 -CFG_LIB_NAME_i686-unknown-linux-musl=lib$(1).so -CFG_STATIC_LIB_NAME_i686-unknown-linux-musl=lib$(1).a -CFG_LIB_GLOB_i686-unknown-linux-musl=lib$(1)-*.so -CFG_JEMALLOC_CFLAGS_i686-unknown-linux-musl := -m32 -Wl,-melf_i386 -Wa,-mrelax-relocations=no -CFG_GCCISH_CFLAGS_i686-unknown-linux-musl := -g -fPIC -m32 -Wl,-melf_i386 -Wa,-mrelax-relocations=no -CFG_GCCISH_CXXFLAGS_i686-unknown-linux-musl := -CFG_GCCISH_LINK_FLAGS_i686-unknown-linux-musl := -CFG_GCCISH_DEF_FLAG_i686-unknown-linux-musl := -CFG_LLC_FLAGS_i686-unknown-linux-musl := -CFG_INSTALL_NAME_i686-unknown-linux-musl = -CFG_EXE_SUFFIX_i686-unknown-linux-musl = -CFG_WINDOWSY_i686-unknown-linux-musl := -CFG_UNIXY_i686-unknown-linux-musl := 1 -CFG_LDPATH_i686-unknown-linux-musl := -CFG_RUN_i686-unknown-linux-musl=$(2) -CFG_RUN_TARG_i686-unknown-linux-musl=$(call CFG_RUN_i686-unknown-linux-musl,,$(2)) -CFG_GNU_TRIPLE_i686-unknown-linux-musl := i686-unknown-linux-musl -CFG_THIRD_PARTY_OBJECTS_i686-unknown-linux-musl := crt1.o crti.o crtn.o -CFG_INSTALLED_OBJECTS_i686-unknown-linux-musl := crt1.o crti.o crtn.o - -NATIVE_DEPS_libc_T_i686-unknown-linux-musl += libc.a -NATIVE_DEPS_std_T_i686-unknown-linux-musl += crt1.o crti.o crtn.o -NATIVE_DEPS_unwind_T_i686-unknown-linux-musl += libunwind.a diff --git a/mk/cfg/i686-unknown-openbsd.mk b/mk/cfg/i686-unknown-openbsd.mk deleted file mode 100644 index b839937c976..00000000000 --- a/mk/cfg/i686-unknown-openbsd.mk +++ /dev/null @@ -1,24 +0,0 @@ -# i686-unknown-openbsd configuration -CC_i686-unknown-openbsd=$(CC) -CXX_i686-unknown-openbsd=$(CXX) -CPP_i686-unknown-openbsd=$(CPP) -AR_i686-unknown-openbsd=$(AR) -CFG_LIB_NAME_i686-unknown-openbsd=lib$(1).so -CFG_STATIC_LIB_NAME_i686-unknown-openbsd=lib$(1).a -CFG_LIB_GLOB_i686-unknown-openbsd=lib$(1)-*.so -CFG_LIB_DSYM_GLOB_i686-unknown-openbsd=$(1)-*.dylib.dSYM -CFG_JEMALLOC_CFLAGS_i686-unknown-openbsd := -m32 -I/usr/include $(CFLAGS) -CFG_GCCISH_CFLAGS_i686-unknown-openbsd := -g -fPIC -m32 -I/usr/include $(CFLAGS) -CFG_GCCISH_LINK_FLAGS_i686-unknown-openbsd := -shared -fPIC -g -pthread -m32 -CFG_GCCISH_DEF_FLAG_i686-unknown-openbsd := -Wl,--export-dynamic,--dynamic-list= -CFG_LLC_FLAGS_i686-unknown-openbsd := -CFG_INSTALL_NAME_i686-unknown-openbsd = -CFG_EXE_SUFFIX_i686-unknown-openbsd := -CFG_WINDOWSY_i686-unknown-openbsd := -CFG_UNIXY_i686-unknown-openbsd := 1 -CFG_LDPATH_i686-unknown-openbsd := -CFG_RUN_i686-unknown-openbsd=$(2) -CFG_RUN_TARG_i686-unknown-openbsd=$(call CFG_RUN_i686-unknown-openbsd,,$(2)) -CFG_GNU_TRIPLE_i686-unknown-openbsd := i686-unknown-openbsd -RUSTC_FLAGS_i686-unknown-openbsd=-C linker=$(call FIND_COMPILER,$(CC)) -CFG_DISABLE_JEMALLOC_i686-unknown-openbsd := 1 diff --git a/mk/cfg/le32-unknown-nacl.mk b/mk/cfg/le32-unknown-nacl.mk deleted file mode 100644 index a7336729174..00000000000 --- a/mk/cfg/le32-unknown-nacl.mk +++ /dev/null @@ -1,40 +0,0 @@ -# le32-unknown-nacl (portable, PNaCl) -ifneq ($(CFG_NACL_CROSS_PATH),) - -CC_le32-unknown-nacl=$(shell $(CFG_PYTHON) $(CFG_NACL_CROSS_PATH)/tools/nacl_config.py -t pnacl --tool cc) -CXX_le32-unknown-nacl=$(shell $(CFG_PYTHON) $(CFG_NACL_CROSS_PATH)/tools/nacl_config.py -t pnacl --tool c++) -CPP_le32-unknown-nacl=$(CXX_le32-unknown-nacl) -E -AR_le32-unknown-nacl=$(shell $(CFG_PYTHON) $(CFG_NACL_CROSS_PATH)/tools/nacl_config.py -t pnacl --tool ar) - -CFG_PNACL_TOOLCHAIN := $(abspath $(dir $(AR_le32-unknown-nacl)/../)) - -# Note: pso's aren't supported by PNaCl. -CFG_LIB_NAME_le32-unknown-nacl=lib$(1).pso -CFG_STATIC_LIB_NAME_le32-unknown-nacl=lib$(1).a -CFG_LIB_GLOB_le32-unknown-nacl=lib$(1)-*.pso -CFG_LIB_DSYM_GLOB_le32-unknown-nacl=lib$(1)-*.dylib.dSYM -CFG_GCCISH_CFLAGS_le32-unknown-nacl := -Wall -Wno-unused-variable -Wno-unused-value $(shell $(CFG_PYTHON) $(CFG_NACL_CROSS_PATH)/tools/nacl_config.py -t pnacl --cflags) -D_YUGA_LITTLE_ENDIAN=1 -D_YUGA_BIG_ENDIAN=0 -CFG_GCCISH_CXXFLAGS_le32-unknown-nacl := -stdlib=libc++ $(CFG_GCCISH_CFLAGS_le32-unknown-nacl) -CFG_GCCISH_LINK_FLAGS_le32-unknown-nacl := -static -pthread -lm -CFG_GCCISH_DEF_FLAG_le32-unknown-nacl := -Wl,--export-dynamic,--dynamic-list= -CFG_GCCISH_PRE_LIB_FLAGS_le32-unknown-nacl := -Wl,-no-whole-archive -CFG_GCCISH_POST_LIB_FLAGS_le32-unknown-nacl := -CFG_DEF_SUFFIX_le32-unknown-nacl := .le32.nacl.def -CFG_INSTALL_NAME_le32-unknown-nacl = -CFG_EXE_SUFFIX_le32-unknown-nacl = .pexe -CFG_WINDOWSY_le32-unknown-nacl := -CFG_UNIXY_le32-unknown-nacl := 1 -CFG_NACLY_le32-unknown-nacl := 1 -CFG_PATH_MUNGE_le32-unknown-nacl := true -CFG_LDPATH_le32-unknown-nacl := -CFG_RUN_le32-unknown-nacl=$(2) -CFG_RUN_TARG_le32-unknown-nacl=$(call CFG_RUN_le32-unknown-nacl,,$(2)) -RUSTC_FLAGS_le32-unknown-nacl:= -RUSTC_CROSS_FLAGS_le32-unknown-nacl=-L $(CFG_NACL_CROSS_PATH)/lib/pnacl/Release -L $(CFG_PNACL_TOOLCHAIN)/lib/clang/3.7.0/lib/le32-nacl -L $(CFG_PNACL_TOOLCHAIN)/le32-nacl/usr/lib -L $(CFG_PNACL_TOOLCHAIN)/le32-nacl/lib -CFG_GNU_TRIPLE_le32-unknown-nacl := le32-unknown-nacl - -# strdup isn't defined unless -std=gnu++11 is used :/ -LLVM_FILTER_CXXFLAGS_le32-unknown-nacl := -std=c++11 -LLVM_EXTRA_CXXFLAGS_le32-unknown-nacl := -std=gnu++11 - -endif diff --git a/mk/cfg/mips-unknown-linux-gnu.mk b/mk/cfg/mips-unknown-linux-gnu.mk deleted file mode 100644 index 0783a4c17a4..00000000000 --- a/mk/cfg/mips-unknown-linux-gnu.mk +++ /dev/null @@ -1,24 +0,0 @@ -# mips-unknown-linux-gnu configuration -CC_mips-unknown-linux-gnu=mips-linux-gnu-gcc -CXX_mips-unknown-linux-gnu=mips-linux-gnu-g++ -CPP_mips-unknown-linux-gnu=mips-linux-gnu-gcc -E -AR_mips-unknown-linux-gnu=mips-linux-gnu-ar -CFG_LIB_NAME_mips-unknown-linux-gnu=lib$(1).so -CFG_STATIC_LIB_NAME_mips-unknown-linux-gnu=lib$(1).a -CFG_LIB_GLOB_mips-unknown-linux-gnu=lib$(1)-*.so -CFG_LIB_DSYM_GLOB_mips-unknown-linux-gnu=lib$(1)-*.dylib.dSYM -CFG_JEMALLOC_CFLAGS_mips-unknown-linux-gnu := -mips32r2 -mabi=32 $(CFLAGS) -CFG_GCCISH_CFLAGS_mips-unknown-linux-gnu := -Wall -g -fPIC -mips32r2 -mabi=32 $(CFLAGS) -CFG_GCCISH_CXXFLAGS_mips-unknown-linux-gnu := -fno-rtti $(CXXFLAGS) -CFG_GCCISH_LINK_FLAGS_mips-unknown-linux-gnu := -shared -fPIC -g -mips32r2 -mabi=32 -CFG_GCCISH_DEF_FLAG_mips-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list= -CFG_LLC_FLAGS_mips-unknown-linux-gnu := -CFG_INSTALL_NAME_mips-unknown-linux-gnu = -CFG_EXE_SUFFIX_mips-unknown-linux-gnu := -CFG_WINDOWSY_mips-unknown-linux-gnu := -CFG_UNIXY_mips-unknown-linux-gnu := 1 -CFG_LDPATH_mips-unknown-linux-gnu := -CFG_RUN_mips-unknown-linux-gnu= -CFG_RUN_TARG_mips-unknown-linux-gnu= -RUSTC_FLAGS_mips-unknown-linux-gnu := -CFG_GNU_TRIPLE_mips-unknown-linux-gnu := mips-unknown-linux-gnu diff --git a/mk/cfg/mips-unknown-linux-musl.mk b/mk/cfg/mips-unknown-linux-musl.mk deleted file mode 100644 index 33528b986f6..00000000000 --- a/mk/cfg/mips-unknown-linux-musl.mk +++ /dev/null @@ -1,24 +0,0 @@ -# mips-unknown-linux-musl configuration -CC_mips-unknown-linux-musl=mips-linux-musl-gcc -CXX_mips-unknown-linux-musl=mips-linux-musl-g++ -CPP_mips-unknown-linux-musl=mips-linux-musl-gcc -E -AR_mips-unknown-linux-musl=mips-linux-musl-ar -CFG_LIB_NAME_mips-unknown-linux-musl=lib$(1).so -CFG_STATIC_LIB_NAME_mips-unknown-linux-musl=lib$(1).a -CFG_LIB_GLOB_mips-unknown-linux-musl=lib$(1)-*.so -CFG_LIB_DSYM_GLOB_mips-unknown-linux-musl=lib$(1)-*.dylib.dSYM -CFG_JEMALLOC_CFLAGS_mips-unknown-linux-musl := -mips32r2 -msoft-float -mabi=32 $(CFLAGS) -CFG_GCCISH_CFLAGS_mips-unknown-linux-musl := -Wall -g -fPIC -mips32r2 -msoft-float -mabi=32 $(CFLAGS) -CFG_GCCISH_CXXFLAGS_mips-unknown-linux-musl := -fno-rtti $(CXXFLAGS) -CFG_GCCISH_LINK_FLAGS_mips-unknown-linux-musl := -shared -fPIC -g -mips32r2 -msoft-float -mabi=32 -CFG_GCCISH_DEF_FLAG_mips-unknown-linux-musl := -Wl,--export-dynamic,--dynamic-list= -CFG_LLC_FLAGS_mips-unknown-linux-musl := -CFG_INSTALL_NAME_mips-unknown-linux-musl = -CFG_EXE_SUFFIX_mips-unknown-linux-musl = -CFG_WINDOWSY_mips-unknown-linux-musl := -CFG_UNIXY_mips-unknown-linux-musl := 1 -CFG_LDPATH_mips-unknown-linux-musl := -CFG_RUN_mips-unknown-linux-musl= -CFG_RUN_TARG_mips-unknown-linux-musl= -RUSTC_FLAGS_mips-unknown-linux-musl := -CFG_GNU_TRIPLE_mips-unknown-linux-musl := mips-unknown-linux-musl diff --git a/mk/cfg/mips-unknown-linux-uclibc.mk b/mk/cfg/mips-unknown-linux-uclibc.mk deleted file mode 100644 index 34aee77ae21..00000000000 --- a/mk/cfg/mips-unknown-linux-uclibc.mk +++ /dev/null @@ -1 +0,0 @@ -# rustbuild-only target diff --git a/mk/cfg/mips64-unknown-linux-gnuabi64.mk b/mk/cfg/mips64-unknown-linux-gnuabi64.mk deleted file mode 100644 index 34aee77ae21..00000000000 --- a/mk/cfg/mips64-unknown-linux-gnuabi64.mk +++ /dev/null @@ -1 +0,0 @@ -# rustbuild-only target diff --git a/mk/cfg/mips64el-unknown-linux-gnuabi64.mk b/mk/cfg/mips64el-unknown-linux-gnuabi64.mk deleted file mode 100644 index 34aee77ae21..00000000000 --- a/mk/cfg/mips64el-unknown-linux-gnuabi64.mk +++ /dev/null @@ -1 +0,0 @@ -# rustbuild-only target diff --git a/mk/cfg/mipsel-unknown-linux-gnu.mk b/mk/cfg/mipsel-unknown-linux-gnu.mk deleted file mode 100644 index f15a086b64e..00000000000 --- a/mk/cfg/mipsel-unknown-linux-gnu.mk +++ /dev/null @@ -1,24 +0,0 @@ -# mipsel-unknown-linux-gnu configuration -CC_mipsel-unknown-linux-gnu=mipsel-linux-gnu-gcc -CXX_mipsel-unknown-linux-gnu=mipsel-linux-gnu-g++ -CPP_mipsel-unknown-linux-gnu=mipsel-linux-gnu-gcc -AR_mipsel-unknown-linux-gnu=mipsel-linux-gnu-ar -CFG_LIB_NAME_mipsel-unknown-linux-gnu=lib$(1).so -CFG_STATIC_LIB_NAME_mipsel-unknown-linux-gnu=lib$(1).a -CFG_LIB_GLOB_mipsel-unknown-linux-gnu=lib$(1)-*.so -CFG_LIB_DSYM_GLOB_mipsel-unknown-linux-gnu=lib$(1)-*.dylib.dSYM -CFG_JEMALLOC_CFLAGS_mipsel-unknown-linux-gnu := -mips32 -mabi=32 $(CFLAGS) -CFG_GCCISH_CFLAGS_mipsel-unknown-linux-gnu := -Wall -g -fPIC -mips32 -mabi=32 $(CFLAGS) -CFG_GCCISH_CXXFLAGS_mipsel-unknown-linux-gnu := -fno-rtti $(CXXFLAGS) -CFG_GCCISH_LINK_FLAGS_mipsel-unknown-linux-gnu := -shared -fPIC -g -mips32 -CFG_GCCISH_DEF_FLAG_mipsel-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list= -CFG_LLC_FLAGS_mipsel-unknown-linux-gnu := -CFG_INSTALL_NAME_mipsel-unknown-linux-gnu = -CFG_EXE_SUFFIX_mipsel-unknown-linux-gnu := -CFG_WINDOWSY_mipsel-unknown-linux-gnu := -CFG_UNIXY_mipsel-unknown-linux-gnu := 1 -CFG_LDPATH_mipsel-unknown-linux-gnu := -CFG_RUN_mipsel-unknown-linux-gnu= -CFG_RUN_TARG_mipsel-unknown-linux-gnu= -RUSTC_FLAGS_mipsel-unknown-linux-gnu := -CFG_GNU_TRIPLE_mipsel-unknown-linux-gnu := mipsel-unknown-linux-gnu diff --git a/mk/cfg/mipsel-unknown-linux-musl.mk b/mk/cfg/mipsel-unknown-linux-musl.mk deleted file mode 100644 index db836b81c5f..00000000000 --- a/mk/cfg/mipsel-unknown-linux-musl.mk +++ /dev/null @@ -1,24 +0,0 @@ -# mipsel-unknown-linux-musl configuration -CC_mipsel-unknown-linux-musl=mipsel-linux-musl-gcc -CXX_mipsel-unknown-linux-musl=mipsel-linux-musl-g++ -CPP_mipsel-unknown-linux-musl=mipsel-linux-musl-gcc -AR_mipsel-unknown-linux-musl=mipsel-linux-musl-ar -CFG_LIB_NAME_mipsel-unknown-linux-musl=lib$(1).so -CFG_STATIC_LIB_NAME_mipsel-unknown-linux-musl=lib$(1).a -CFG_LIB_GLOB_mipsel-unknown-linux-musl=lib$(1)-*.so -CFG_LIB_DSYM_GLOB_mipsel-unknown-linux-musl=lib$(1)-*.dylib.dSYM -CFG_JEMALLOC_CFLAGS_mipsel-unknown-linux-musl := -mips32 -mabi=32 $(CFLAGS) -CFG_GCCISH_CFLAGS_mipsel-unknown-linux-musl := -Wall -g -fPIC -mips32 -mabi=32 $(CFLAGS) -CFG_GCCISH_CXXFLAGS_mipsel-unknown-linux-musl := -fno-rtti $(CXXFLAGS) -CFG_GCCISH_LINK_FLAGS_mipsel-unknown-linux-musl := -shared -fPIC -g -mips32 -CFG_GCCISH_DEF_FLAG_mipsel-unknown-linux-musl := -Wl,--export-dynamic,--dynamic-list= -CFG_LLC_FLAGS_mipsel-unknown-linux-musl := -CFG_INSTALL_NAME_mipsel-unknown-linux-musl = -CFG_EXE_SUFFIX_mipsel-unknown-linux-musl := -CFG_WINDOWSY_mipsel-unknown-linux-musl := -CFG_UNIXY_mipsel-unknown-linux-musl := 1 -CFG_LDPATH_mipsel-unknown-linux-musl := -CFG_RUN_mipsel-unknown-linux-musl= -CFG_RUN_TARG_mipsel-unknown-linux-musl= -RUSTC_FLAGS_mipsel-unknown-linux-musl := -CFG_GNU_TRIPLE_mipsel-unknown-linux-musl := mipsel-unknown-linux-musl diff --git a/mk/cfg/mipsel-unknown-linux-uclibc.mk b/mk/cfg/mipsel-unknown-linux-uclibc.mk deleted file mode 100644 index 34aee77ae21..00000000000 --- a/mk/cfg/mipsel-unknown-linux-uclibc.mk +++ /dev/null @@ -1 +0,0 @@ -# rustbuild-only target diff --git a/mk/cfg/powerpc-unknown-linux-gnu.mk b/mk/cfg/powerpc-unknown-linux-gnu.mk deleted file mode 100644 index 9c5720de4b3..00000000000 --- a/mk/cfg/powerpc-unknown-linux-gnu.mk +++ /dev/null @@ -1,24 +0,0 @@ -# powerpc-unknown-linux-gnu configuration -CROSS_PREFIX_powerpc-unknown-linux-gnu=powerpc-linux-gnu- -CC_powerpc-unknown-linux-gnu=$(CC) -CXX_powerpc-unknown-linux-gnu=$(CXX) -CPP_powerpc-unknown-linux-gnu=$(CPP) -AR_powerpc-unknown-linux-gnu=$(AR) -CFG_LIB_NAME_powerpc-unknown-linux-gnu=lib$(1).so -CFG_STATIC_LIB_NAME_powerpc-unknown-linux-gnu=lib$(1).a -CFG_LIB_GLOB_powerpc-unknown-linux-gnu=lib$(1)-*.so -CFG_LIB_DSYM_GLOB_powerpc-unknown-linux-gnu=lib$(1)-*.dylib.dSYM -CFG_CFLAGS_powerpc-unknown-linux-gnu := -m32 $(CFLAGS) -CFG_GCCISH_CFLAGS_powerpc-unknown-linux-gnu := -g -fPIC -m32 $(CFLAGS) -CFG_GCCISH_CXXFLAGS_powerpc-unknown-linux-gnu := -fno-rtti $(CXXFLAGS) -CFG_GCCISH_LINK_FLAGS_powerpc-unknown-linux-gnu := -shared -fPIC -ldl -pthread -lrt -g -m32 -CFG_GCCISH_DEF_FLAG_powerpc-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list= -CFG_LLC_FLAGS_powerpc-unknown-linux-gnu := -CFG_INSTALL_NAME_powerpc-unknown-linux-gnu = -CFG_EXE_SUFFIX_powerpc-unknown-linux-gnu = -CFG_WINDOWSY_powerpc-unknown-linux-gnu := -CFG_UNIXY_powerpc-unknown-linux-gnu := 1 -CFG_LDPATH_powerpc-unknown-linux-gnu := -CFG_RUN_powerpc-unknown-linux-gnu=$(2) -CFG_RUN_TARG_powerpc-unknown-linux-gnu=$(call CFG_RUN_powerpc-unknown-linux-gnu,,$(2)) -CFG_GNU_TRIPLE_powerpc-unknown-linux-gnu := powerpc-unknown-linux-gnu diff --git a/mk/cfg/powerpc64-unknown-linux-gnu.mk b/mk/cfg/powerpc64-unknown-linux-gnu.mk deleted file mode 100644 index 389bb6f0cab..00000000000 --- a/mk/cfg/powerpc64-unknown-linux-gnu.mk +++ /dev/null @@ -1,25 +0,0 @@ -# powerpc64-unknown-linux-gnu configuration -CROSS_PREFIX_powerpc64-unknown-linux-gnu=powerpc-linux-gnu- -CC_powerpc64-unknown-linux-gnu=$(CC) -CXX_powerpc64-unknown-linux-gnu=$(CXX) -CPP_powerpc64-unknown-linux-gnu=$(CPP) -AR_powerpc64-unknown-linux-gnu=$(AR) -CFG_LIB_NAME_powerpc64-unknown-linux-gnu=lib$(1).so -CFG_STATIC_LIB_NAME_powerpc64-unknown-linux-gnu=lib$(1).a -CFG_LIB_GLOB_powerpc64-unknown-linux-gnu=lib$(1)-*.so -CFG_LIB_DSYM_GLOB_powerpc64-unknown-linux-gnu=lib$(1)-*.dylib.dSYM -CFG_JEMALLOC_CFLAGS_powerpc64-unknown-linux-gnu := -m64 -CFG_CFLAGS_powerpc64-unknown-linux-gnu := -m64 $(CFLAGS) -CFG_GCCISH_CFLAGS_powerpc64-unknown-linux-gnu := -g -fPIC -m64 $(CFLAGS) -CFG_GCCISH_CXXFLAGS_powerpc64-unknown-linux-gnu := -fno-rtti $(CXXFLAGS) -CFG_GCCISH_LINK_FLAGS_powerpc64-unknown-linux-gnu := -shared -fPIC -ldl -pthread -lrt -g -m64 -CFG_GCCISH_DEF_FLAG_powerpc64-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list= -CFG_LLC_FLAGS_powerpc64-unknown-linux-gnu := -CFG_INSTALL_NAME_powerpc64-unknown-linux-gnu = -CFG_EXE_SUFFIX_powerpc64-unknown-linux-gnu = -CFG_WINDOWSY_powerpc64-unknown-linux-gnu := -CFG_UNIXY_powerpc64-unknown-linux-gnu := 1 -CFG_LDPATH_powerpc64-unknown-linux-gnu := -CFG_RUN_powerpc64-unknown-linux-gnu=$(2) -CFG_RUN_TARG_powerpc64-unknown-linux-gnu=$(call CFG_RUN_powerpc64-unknown-linux-gnu,,$(2)) -CFG_GNU_TRIPLE_powerpc64-unknown-linux-gnu := powerpc64-unknown-linux-gnu diff --git a/mk/cfg/powerpc64le-unknown-linux-gnu.mk b/mk/cfg/powerpc64le-unknown-linux-gnu.mk deleted file mode 100644 index 6884fa11e74..00000000000 --- a/mk/cfg/powerpc64le-unknown-linux-gnu.mk +++ /dev/null @@ -1,24 +0,0 @@ -# powerpc64le-unknown-linux-gnu configuration -CROSS_PREFIX_powerpc64le-unknown-linux-gnu=powerpc64le-linux-gnu- -CC_powerpc64le-unknown-linux-gnu=$(CC) -CXX_powerpc64le-unknown-linux-gnu=$(CXX) -CPP_powerpc64le-unknown-linux-gnu=$(CPP) -AR_powerpc64le-unknown-linux-gnu=$(AR) -CFG_LIB_NAME_powerpc64le-unknown-linux-gnu=lib$(1).so -CFG_STATIC_LIB_NAME_powerpc64le-unknown-linux-gnu=lib$(1).a -CFG_LIB_GLOB_powerpc64le-unknown-linux-gnu=lib$(1)-*.so -CFG_LIB_DSYM_GLOB_powerpc64le-unknown-linux-gnu=lib$(1)-*.dylib.dSYM -CFG_CFLAGS_powerpc64le-unknown-linux-gnu := -m64 $(CFLAGS) -CFG_GCCISH_CFLAGS_powerpc64le-unknown-linux-gnu := -g -fPIC -m64 $(CFLAGS) -CFG_GCCISH_CXXFLAGS_powerpc64le-unknown-linux-gnu := -fno-rtti $(CXXFLAGS) -CFG_GCCISH_LINK_FLAGS_powerpc64le-unknown-linux-gnu := -shared -fPIC -ldl -pthread -lrt -g -m64 -CFG_GCCISH_DEF_FLAG_powerpc64le-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list= -CFG_LLC_FLAGS_powerpc64le-unknown-linux-gnu := -CFG_INSTALL_NAME_powerpc64le-unknown-linux-gnu = -CFG_EXE_SUFFIX_powerpc64le-unknown-linux-gnu = -CFG_WINDOWSY_powerpc64le-unknown-linux-gnu := -CFG_UNIXY_powerpc64le-unknown-linux-gnu := 1 -CFG_LDPATH_powerpc64le-unknown-linux-gnu := -CFG_RUN_powerpc64le-unknown-linux-gnu=$(2) -CFG_RUN_TARG_powerpc64le-unknown-linux-gnu=$(call CFG_RUN_powerpc64le-unknown-linux-gnu,,$(2)) -CFG_GNU_TRIPLE_powerpc64le-unknown-linux-gnu := powerpc64le-unknown-linux-gnu diff --git a/mk/cfg/s390x-unknown-linux-gnu.mk b/mk/cfg/s390x-unknown-linux-gnu.mk deleted file mode 100644 index eb1cb2329c4..00000000000 --- a/mk/cfg/s390x-unknown-linux-gnu.mk +++ /dev/null @@ -1,24 +0,0 @@ -# s390x-unknown-linux-gnu configuration -CROSS_PREFIX_s390x-unknown-linux-gnu=s390x-linux-gnu- -CC_s390x-unknown-linux-gnu=$(CC) -CXX_s390x-unknown-linux-gnu=$(CXX) -CPP_s390x-unknown-linux-gnu=$(CPP) -AR_s390x-unknown-linux-gnu=$(AR) -CFG_LIB_NAME_s390x-unknown-linux-gnu=lib$(1).so -CFG_STATIC_LIB_NAME_s390x-unknown-linux-gnu=lib$(1).a -CFG_LIB_GLOB_s390x-unknown-linux-gnu=lib$(1)-*.so -CFG_LIB_DSYM_GLOB_s390x-unknown-linux-gnu=lib$(1)-*.dylib.dSYM -CFG_CFLAGS_s390x-unknown-linux-gnu := -m64 $(CFLAGS) -CFG_GCCISH_CFLAGS_s390x-unknown-linux-gnu := -g -fPIC -m64 $(CFLAGS) -CFG_GCCISH_CXXFLAGS_s390x-unknown-linux-gnu := -fno-rtti $(CXXFLAGS) -CFG_GCCISH_LINK_FLAGS_s390x-unknown-linux-gnu := -shared -fPIC -ldl -pthread -lrt -g -m64 -CFG_GCCISH_DEF_FLAG_s390x-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list= -CFG_LLC_FLAGS_s390x-unknown-linux-gnu := -CFG_INSTALL_NAME_s390x-unknown-linux-gnu = -CFG_EXE_SUFFIX_s390x-unknown-linux-gnu = -CFG_WINDOWSY_s390x-unknown-linux-gnu := -CFG_UNIXY_s390x-unknown-linux-gnu := 1 -CFG_LDPATH_s390x-unknown-linux-gnu := -CFG_RUN_s390x-unknown-linux-gnu=$(2) -CFG_RUN_TARG_s390x-unknown-linux-gnu=$(call CFG_RUN_s390x-unknown-linux-gnu,,$(2)) -CFG_GNU_TRIPLE_s390x-unknown-linux-gnu := s390x-unknown-linux-gnu diff --git a/mk/cfg/sparc64-unknown-linux-gnu.mk b/mk/cfg/sparc64-unknown-linux-gnu.mk deleted file mode 100644 index 34aee77ae21..00000000000 --- a/mk/cfg/sparc64-unknown-linux-gnu.mk +++ /dev/null @@ -1 +0,0 @@ -# rustbuild-only target diff --git a/mk/cfg/sparc64-unknown-netbsd.mk b/mk/cfg/sparc64-unknown-netbsd.mk deleted file mode 100644 index a2b01ba0537..00000000000 --- a/mk/cfg/sparc64-unknown-netbsd.mk +++ /dev/null @@ -1,3 +0,0 @@ -# This file is intentially left empty to indicate that, while this target is -# supported, it's not supported using plain GNU Make builds. Use a --rustbuild -# instead. diff --git a/mk/cfg/wasm32-unknown-emscripten.mk b/mk/cfg/wasm32-unknown-emscripten.mk deleted file mode 100644 index 997bdfbf03a..00000000000 --- a/mk/cfg/wasm32-unknown-emscripten.mk +++ /dev/null @@ -1,24 +0,0 @@ -# wasm32-unknown-emscripten configuration -CC_wasm32-unknown-emscripten=emcc -CXX_wasm32-unknown-emscripten=em++ -CPP_wasm32-unknown-emscripten=$(CPP) -AR_wasm32-unknown-emscripten=emar -CFG_LIB_NAME_wasm32-unknown-emscripten=lib$(1).so -CFG_STATIC_LIB_NAME_wasm32-unknown-emscripten=lib$(1).a -CFG_LIB_GLOB_wasm32-unknown-emscripten=lib$(1)-*.so -CFG_LIB_DSYM_GLOB_wasm32-unknown-emscripten=lib$(1)-*.dylib.dSYM -CFG_JEMALLOC_CFLAGS_wasm32-unknown-emscripten := -m32 $(CFLAGS) -CFG_GCCISH_CFLAGS_wasm32-unknown-emscripten := -g -fPIC -m32 -s BINARYEN=1 $(CFLAGS) -CFG_GCCISH_CXXFLAGS_wasm32-unknown-emscripten := -fno-rtti -s BINARYEN=1 $(CXXFLAGS) -CFG_GCCISH_LINK_FLAGS_wasm32-unknown-emscripten := -shared -fPIC -ldl -pthread -lrt -g -m32 -s BINARYEN=1 -CFG_GCCISH_DEF_FLAG_wasm32-unknown-emscripten := -Wl,--export-dynamic,--dynamic-list= -CFG_LLC_FLAGS_wasm32-unknown-emscripten := -CFG_INSTALL_NAME_wasm32-unknown-emscripten = -CFG_EXE_SUFFIX_wasm32-unknown-emscripten = -CFG_WINDOWSY_wasm32-unknown-emscripten := -CFG_UNIXY_wasm32-unknown-emscripten := 1 -CFG_LDPATH_wasm32-unknown-emscripten := -CFG_RUN_wasm32-unknown-emscripten=$(2) -CFG_RUN_TARG_wasm32-unknown-emscripten=$(call CFG_RUN_wasm32-unknown-emscripten,,$(2)) -CFG_GNU_TRIPLE_wasm32-unknown-emscripten := wasm32-unknown-emscripten -CFG_DISABLE_JEMALLOC_wasm32-unknown-emscripten := 1 diff --git a/mk/cfg/x86_64-apple-darwin.mk b/mk/cfg/x86_64-apple-darwin.mk deleted file mode 100644 index 8af47b671a8..00000000000 --- a/mk/cfg/x86_64-apple-darwin.mk +++ /dev/null @@ -1,23 +0,0 @@ -# x86_64-apple-darwin configuration -CC_x86_64-apple-darwin=$(CC) -CXX_x86_64-apple-darwin=$(CXX) -CPP_x86_64-apple-darwin=$(CPP) -AR_x86_64-apple-darwin=$(AR) -CFG_LIB_NAME_x86_64-apple-darwin=lib$(1).dylib -CFG_STATIC_LIB_NAME_x86_64-apple-darwin=lib$(1).a -CFG_LIB_GLOB_x86_64-apple-darwin=lib$(1)-*.dylib -CFG_LIB_DSYM_GLOB_x86_64-apple-darwin=lib$(1)-*.dylib.dSYM -CFG_JEMALLOC_CFLAGS_x86_64-apple-darwin := -m64 -arch x86_64 $(CFLAGS) -CFG_GCCISH_CFLAGS_x86_64-apple-darwin := -g -fPIC -m64 -arch x86_64 $(CFLAGS) -CFG_GCCISH_CXXFLAGS_x86_64-apple-darwin := -fno-rtti $(CXXFLAGS) -CFG_GCCISH_LINK_FLAGS_x86_64-apple-darwin := -dynamiclib -pthread -framework CoreServices -m64 -CFG_GCCISH_DEF_FLAG_x86_64-apple-darwin := -Wl,-exported_symbols_list, -CFG_LLC_FLAGS_x86_64-apple-darwin := -CFG_INSTALL_NAME_x86_64-apple-darwin = -Wl,-install_name,@rpath/$(1) -CFG_EXE_SUFFIX_x86_64-apple-darwin := -CFG_WINDOWSY_x86_64-apple-darwin := -CFG_UNIXY_x86_64-apple-darwin := 1 -CFG_LDPATH_x86_64-apple-darwin := -CFG_RUN_x86_64-apple-darwin=$(2) -CFG_RUN_TARG_x86_64-apple-darwin=$(call CFG_RUN_x86_64-apple-darwin,,$(2)) -CFG_GNU_TRIPLE_x86_64-apple-darwin := x86_64-apple-darwin diff --git a/mk/cfg/x86_64-apple-ios.mk b/mk/cfg/x86_64-apple-ios.mk deleted file mode 100644 index 764cdc15996..00000000000 --- a/mk/cfg/x86_64-apple-ios.mk +++ /dev/null @@ -1,32 +0,0 @@ -# x86_64-apple-ios configuration -CFG_SDK_NAME_x86_64-apple-ios := iphonesimulator -CFG_SDK_ARCHS_x86_64-apple-ios := x86_64 -ifneq ($(findstring darwin,$(CFG_OSTYPE)),) -CFG_IOSSIM_SDK_x86_64-apple-ios := $(shell xcrun --show-sdk-path -sdk iphonesimulator 2>/dev/null) -CFG_IOSSIM_FLAGS_x86_64-apple-ios := -m64 -target x86_64-apple-ios -isysroot $(CFG_IOSSIM_SDK_x86_64-apple-ios) -mios-simulator-version-min=7.0 -CC_x86_64-apple-ios = $(shell xcrun -find -sdk iphonesimulator clang) -CXX_x86_64-apple-ios = $(shell xcrun -find -sdk iphonesimulator clang++) -CPP_x86_64-apple-ios = $(shell xcrun -find -sdk iphonesimulator clang++) -AR_x86_64-apple-ios = $(shell xcrun -find -sdk iphonesimulator ar) -endif -CFG_LIB_NAME_x86_64-apple-ios = lib$(1).a -CFG_LIB_GLOB_x86_64-apple-ios = lib$(1)-*.a -CFG_INSTALL_ONLY_RLIB_x86_64-apple-ios = 1 -CFG_STATIC_LIB_NAME_x86_64-apple-ios=lib$(1).a -CFG_LIB_DSYM_GLOB_x86_64-apple-ios = lib$(1)-*.a.dSYM -CFG_CFLAGS_x86_64-apple-ios := $(CFG_IOSSIM_FLAGS_x86_64-apple-ios) -CFG_JEMALLOC_CFLAGS_x86_64-apple-ios := $(CFG_IOSSIM_FLAGS_x86_64-apple-ios) -CFG_GCCISH_CFLAGS_x86_64-apple-ios := -fPIC $(CFG_IOSSIM_FLAGS_x86_64-apple-ios) -CFG_GCCISH_CXXFLAGS_x86_64-apple-ios := -fno-rtti $(CFG_IOSSIM_FLAGS_x86_64-apple-ios) -I$(CFG_IOSSIM_SDK_x86_64-apple-ios)/usr/include/c++/4.2.1 -CFG_GCCISH_LINK_FLAGS_x86_64-apple-ios := -lpthread -Wl,-no_compact_unwind -m64 -Wl,-syslibroot $(CFG_IOSSIM_SDK_x86_64-apple-ios) -CFG_GCCISH_DEF_FLAG_x86_64-apple-ios := -Wl,-exported_symbols_list, -CFG_LLC_FLAGS_x86_64-apple-ios := -CFG_INSTALL_NAME_x86_64-apple-ios = -Wl,-install_name,@rpath/$(1) -CFG_LIBUV_LINK_FLAGS_x86_64-apple-ios := -CFG_EXE_SUFFIX_x86_64-apple-ios := -CFG_WINDOWSY_x86_64-apple-ios := -CFG_UNIXY_x86_64-apple-ios := 1 -CFG_LDPATH_x86_64-apple-ios := -CFG_RUN_x86_64-apple-ios = $(2) -CFG_RUN_TARG_x86_64-apple-ios = $(call CFG_RUN_x86_64-apple-ios,,$(2)) -CFG_GNU_TRIPLE_i386-apple-ios := x86_64-apple-ios diff --git a/mk/cfg/x86_64-pc-windows-gnu.mk b/mk/cfg/x86_64-pc-windows-gnu.mk deleted file mode 100644 index 82e7b23279f..00000000000 --- a/mk/cfg/x86_64-pc-windows-gnu.mk +++ /dev/null @@ -1,27 +0,0 @@ -# x86_64-pc-windows-gnu configuration -CROSS_PREFIX_x86_64-pc-windows-gnu=x86_64-w64-mingw32- -CC_x86_64-pc-windows-gnu=gcc -CXX_x86_64-pc-windows-gnu=g++ -CPP_x86_64-pc-windows-gnu=gcc -E -AR_x86_64-pc-windows-gnu=ar -CFG_LIB_NAME_x86_64-pc-windows-gnu=$(1).dll -CFG_STATIC_LIB_NAME_x86_64-pc-windows-gnu=$(1).lib -CFG_LIB_GLOB_x86_64-pc-windows-gnu=$(1)-*.dll -CFG_LIB_DSYM_GLOB_x86_64-pc-windows-gnu=$(1)-*.dylib.dSYM -CFG_JEMALLOC_CFLAGS_x86_64-pc-windows-gnu := -m64 -D_WIN32_WINNT=0x0600 -D__USE_MINGW_ANSI_STDIO=1 $(CFLAGS) -CFG_GCCISH_CFLAGS_x86_64-pc-windows-gnu := -g -m64 -D_WIN32_WINNT=0x0600 -D__USE_MINGW_ANSI_STDIO=1 $(CFLAGS) -CFG_GCCISH_CXXFLAGS_x86_64-pc-windows-gnu := -fno-rtti $(CXXFLAGS) -CFG_GCCISH_LINK_FLAGS_x86_64-pc-windows-gnu := -shared -g -m64 -CFG_GCCISH_DEF_FLAG_x86_64-pc-windows-gnu := -CFG_LLC_FLAGS_x86_64-pc-windows-gnu := -CFG_INSTALL_NAME_x86_64-pc-windows-gnu = -CFG_EXE_SUFFIX_x86_64-pc-windows-gnu := .exe -CFG_WINDOWSY_x86_64-pc-windows-gnu := 1 -CFG_UNIXY_x86_64-pc-windows-gnu := -CFG_LDPATH_x86_64-pc-windows-gnu := -CFG_RUN_x86_64-pc-windows-gnu=$(2) -CFG_RUN_TARG_x86_64-pc-windows-gnu=$(call CFG_RUN_x86_64-pc-windows-gnu,,$(2)) -CFG_GNU_TRIPLE_x86_64-pc-windows-gnu := x86_64-w64-mingw32 -CFG_THIRD_PARTY_OBJECTS_x86_64-pc-windows-gnu := crt2.o dllcrt2.o -CFG_INSTALLED_OBJECTS_x86_64-pc-windows-gnu := crt2.o dllcrt2.o rsbegin.o rsend.o -CFG_RUSTRT_HAS_STARTUP_OBJS_x86_64-pc-windows-gnu := 1 diff --git a/mk/cfg/x86_64-pc-windows-msvc.mk b/mk/cfg/x86_64-pc-windows-msvc.mk deleted file mode 100644 index 30e996a9727..00000000000 --- a/mk/cfg/x86_64-pc-windows-msvc.mk +++ /dev/null @@ -1,28 +0,0 @@ -# x86_64-pc-windows-msvc configuration -CC_x86_64-pc-windows-msvc=$(CFG_MSVC_CL_x86_64) -LINK_x86_64-pc-windows-msvc=$(CFG_MSVC_LINK_x86_64) -CXX_x86_64-pc-windows-msvc=$(CFG_MSVC_CL_x86_64) -CPP_x86_64-pc-windows-msvc=$(CFG_MSVC_CL_x86_64) -AR_x86_64-pc-windows-msvc=$(CFG_MSVC_LIB_x86_64) -CFG_LIB_NAME_x86_64-pc-windows-msvc=$(1).dll -CFG_STATIC_LIB_NAME_x86_64-pc-windows-msvc=$(1).lib -CFG_LIB_GLOB_x86_64-pc-windows-msvc=$(1)-*.{dll,lib} -CFG_LIB_DSYM_GLOB_x86_64-pc-windows-msvc=$(1)-*.dylib.dSYM -CFG_JEMALLOC_CFLAGS_x86_64-pc-windows-msvc := -CFG_GCCISH_CFLAGS_x86_64-pc-windows-msvc := -MD -nologo -CFG_GCCISH_CXXFLAGS_x86_64-pc-windows-msvc := -MD -nologo -CFG_GCCISH_LINK_FLAGS_x86_64-pc-windows-msvc := -CFG_GCCISH_DEF_FLAG_x86_64-pc-windows-msvc := -CFG_LLC_FLAGS_x86_64-pc-windows-msvc := -CFG_INSTALL_NAME_x86_64-pc-windows-msvc = -CFG_EXE_SUFFIX_x86_64-pc-windows-msvc := .exe -CFG_WINDOWSY_x86_64-pc-windows-msvc := 1 -CFG_UNIXY_x86_64-pc-windows-msvc := -CFG_LDPATH_x86_64-pc-windows-msvc := -CFG_RUN_x86_64-pc-windows-msvc=$(2) -CFG_RUN_TARG_x86_64-pc-windows-msvc=$(call CFG_RUN_x86_64-pc-windows-msvc,,$(2)) -CFG_GNU_TRIPLE_x86_64-pc-windows-msvc := x86_64-pc-win32 - -# Currently the build system is not configured to build jemalloc -# with MSVC, so we omit this optional dependency. -CFG_DISABLE_JEMALLOC_x86_64-pc-windows-msvc := 1 diff --git a/mk/cfg/x86_64-rumprun-netbsd.mk b/mk/cfg/x86_64-rumprun-netbsd.mk deleted file mode 100644 index 53d58b9fcea..00000000000 --- a/mk/cfg/x86_64-rumprun-netbsd.mk +++ /dev/null @@ -1,25 +0,0 @@ -# x86_64-rumprun-netbsd configuration -CROSS_PREFIX_x86_64-rumprun-netbsd=x86_64-rumprun-netbsd- -CC_x86_64-rumprun-netbsd=gcc -CXX_x86_64-rumprun-netbsd=g++ -CPP_x86_64-rumprun-netbsd=gcc -E -AR_x86_64-rumprun-netbsd=ar -CFG_INSTALL_ONLY_RLIB_x86_64-rumprun-netbsd = 1 -CFG_LIB_NAME_x86_64-rumprun-netbsd=lib$(1).so -CFG_STATIC_LIB_NAME_x86_64-rumprun-netbsd=lib$(1).a -CFG_LIB_GLOB_x86_64-rumprun-netbsd=lib$(1)-*.so -CFG_JEMALLOC_CFLAGS_x86_64-rumprun-netbsd := -m64 -CFG_GCCISH_CFLAGS_x86_64-rumprun-netbsd := -g -fPIC -m64 -CFG_GCCISH_CXXFLAGS_x86_64-rumprun-netbsd := -CFG_GCCISH_LINK_FLAGS_x86_64-rumprun-netbsd := -CFG_GCCISH_DEF_FLAG_x86_64-rumprun-netbsd := -CFG_LLC_FLAGS_x86_64-rumprun-netbsd := -CFG_INSTALL_NAME_x86_64-rumprun-netbsd = -CFG_EXE_SUFFIX_x86_64-rumprun-netbsd = -CFG_WINDOWSY_x86_64-rumprun-netbsd := -CFG_UNIXY_x86_64-rumprun-netbsd := 1 -CFG_LDPATH_x86_64-rumprun-netbsd := -CFG_RUN_x86_64-rumprun-netbsd=$(2) -CFG_RUN_TARG_x86_64-rumprun-netbsd=$(call CFG_RUN_x86_64-rumprun-netbsd,,$(2)) -CFG_GNU_TRIPLE_x86_64-rumprun-netbsd := x86_64-rumprun-netbsd -CFG_DISABLE_JEMALLOC_x86_64-rumprun-netbsd := 1 diff --git a/mk/cfg/x86_64-sun-solaris.mk b/mk/cfg/x86_64-sun-solaris.mk deleted file mode 100644 index 7fc323b234a..00000000000 --- a/mk/cfg/x86_64-sun-solaris.mk +++ /dev/null @@ -1,23 +0,0 @@ -# x86_64-sun-solaris configuration -CROSS_PREFIX_x86_64-sun-solaris=x86_64-sun-solaris2.11- -CC_x86_64-sun-solaris=$(CC) -CXX_x86_64-sun-solaris=$(CXX) -CPP_x86_64-sun-solaris=$(CPP) -AR_x86_64-sun-solaris=$(AR) -CFG_LIB_NAME_x86_64-sun-solaris=lib$(1).so -CFG_STATIC_LIB_NAME_x86_64-sun-solaris=lib$(1).a -CFG_LIB_GLOB_x86_64-sun-solaris=lib$(1)-*.so -CFG_LIB_DSYM_GLOB_x86_64-sun-solaris=$(1)-*.dylib.dSYM -CFG_JEMALLOC_CFLAGS_x86_64-sun-solaris := -I/usr/local/include $(CFLAGS) -CFG_GCCISH_CFLAGS_x86_64-sun-solaris := -g -D_POSIX_PTHREAD_SEMANTICS -fPIC -I/usr/local/include $(CFLAGS) -CFG_GCCISH_LINK_FLAGS_x86_64-sun-solaris := -shared -fPIC -g -pthread -lrt -CFG_GCCISH_DEF_FLAG_x86_64-sun-solaris := -Wl,--export-dynamic,--dynamic-list= -CFG_LLC_FLAGS_x86_64-sun-solaris := -CFG_INSTALL_NAME_x86_64-sun-solaris = -CFG_EXE_SUFFIX_x86_64-sun-solaris := -CFG_WINDOWSY_x86_64-sun-solaris := -CFG_UNIXY_x86_64-sun-solaris := 1 -CFG_LDPATH_x86_64-sun-solaris := -CFG_RUN_x86_64-sun-solaris=$(2) -CFG_RUN_TARG_x86_64-sun-solaris=$(call CFG_RUN_x86_64-sun-solaris,,$(2)) -CFG_GNU_TRIPLE_x86_64-sun-solaris := x86_64-sun-solaris diff --git a/mk/cfg/x86_64-unknown-bitrig.mk b/mk/cfg/x86_64-unknown-bitrig.mk deleted file mode 100644 index 8ac31c17618..00000000000 --- a/mk/cfg/x86_64-unknown-bitrig.mk +++ /dev/null @@ -1,23 +0,0 @@ -# x86_64-unknown-bitrig-elf configuration -CC_x86_64-unknown-bitrig=$(CC) -CXX_x86_64-unknown-bitrig=$(CXX) -CPP_x86_64-unknown-bitrig=$(CPP) -AR_x86_64-unknown-bitrig=$(AR) -CFG_LIB_NAME_x86_64-unknown-bitrig=lib$(1).so -CFG_STATIC_LIB_NAME_x86_64-unknown-bitrig=lib$(1).a -CFG_LIB_GLOB_x86_64-unknown-bitrig=lib$(1)-*.so -CFG_LIB_DSYM_GLOB_x86_64-unknown-bitrig=$(1)-*.dylib.dSYM -CFG_JEMALLOC_CFLAGS_x86_64-unknown-bitrig := -m64 -I/usr/include $(CFLAGS) -CFG_GCCISH_CFLAGS_x86_64-unknown-bitrig := -fPIE -fPIC -m64 -I/usr/include $(CFLAGS) -CFG_GCCISH_LINK_FLAGS_x86_64-unknown-bitrig := -shared -pic -pthread -m64 $(LDFLAGS) -CFG_GCCISH_DEF_FLAG_x86_64-unknown-bitrig := -Wl,--export-dynamic,--dynamic-list= -CFG_LLC_FLAGS_x86_64-unknown-bitrig := -CFG_INSTALL_NAME_x86_64-unknown-bitrig = -CFG_EXE_SUFFIX_x86_64-unknown-bitrig := -CFG_WINDOWSY_x86_64-unknown-bitrig := -CFG_UNIXY_x86_64-unknown-bitrig := 1 -CFG_LDPATH_x86_64-unknown-bitrig := -CFG_RUN_x86_64-unknown-bitrig=$(2) -CFG_RUN_TARG_x86_64-unknown-bitrig=$(call CFG_RUN_x86_64-unknown-bitrig,,$(2)) -CFG_GNU_TRIPLE_x86_64-unknown-bitrig := x86_64-unknown-bitrig -CFG_DISABLE_JEMALLOC_x86_64-unknown-bitrig := 1 diff --git a/mk/cfg/x86_64-unknown-dragonfly.mk b/mk/cfg/x86_64-unknown-dragonfly.mk deleted file mode 100644 index 579a9a809e2..00000000000 --- a/mk/cfg/x86_64-unknown-dragonfly.mk +++ /dev/null @@ -1,22 +0,0 @@ -# x86_64-pc-dragonfly-elf configuration -CC_x86_64-unknown-dragonfly=$(CC) -CXX_x86_64-unknown-dragonfly=$(CXX) -CPP_x86_64-unknown-dragonfly=$(CPP) -AR_x86_64-unknown-dragonfly=$(AR) -CFG_LIB_NAME_x86_64-unknown-dragonfly=lib$(1).so -CFG_STATIC_LIB_NAME_x86_64-unknown-dragonfly=lib$(1).a -CFG_LIB_GLOB_x86_64-unknown-dragonfly=lib$(1)-*.so -CFG_LIB_DSYM_GLOB_x86_64-unknown-dragonfly=$(1)-*.dylib.dSYM -CFG_JEMALLOC_CFLAGS_x86_64-unknown-dragonfly := -m64 -I/usr/include -I/usr/local/include $(CFLAGS) -CFG_GCCISH_CFLAGS_x86_64-unknown-dragonfly := -g -fPIC -m64 -I/usr/include -I/usr/local/include $(CFLAGS) -CFG_GCCISH_LINK_FLAGS_x86_64-unknown-dragonfly := -shared -fPIC -g -pthread -lrt -m64 -CFG_GCCISH_DEF_FLAG_x86_64-unknown-dragonfly := -Wl,--export-dynamic,--dynamic-list= -CFG_LLC_FLAGS_x86_64-unknown-dragonfly := -CFG_INSTALL_NAME_x86_64-unknown-dragonfly = -CFG_EXE_SUFFIX_x86_64-unknown-dragonfly := -CFG_WINDOWSY_x86_64-unknown-dragonfly := -CFG_UNIXY_x86_64-unknown-dragonfly := 1 -CFG_LDPATH_x86_64-unknown-dragonfly := -CFG_RUN_x86_64-unknown-dragonfly=$(2) -CFG_RUN_TARG_x86_64-unknown-dragonfly=$(call CFG_RUN_x86_64-unknown-dragonfly,,$(2)) -CFG_GNU_TRIPLE_x86_64-unknown-dragonfly := x86_64-unknown-dragonfly diff --git a/mk/cfg/x86_64-unknown-freebsd.mk b/mk/cfg/x86_64-unknown-freebsd.mk deleted file mode 100644 index c700601eac7..00000000000 --- a/mk/cfg/x86_64-unknown-freebsd.mk +++ /dev/null @@ -1,22 +0,0 @@ -# x86_64-unknown-freebsd configuration -CC_x86_64-unknown-freebsd=$(CC) -CXX_x86_64-unknown-freebsd=$(CXX) -CPP_x86_64-unknown-freebsd=$(CPP) -AR_x86_64-unknown-freebsd=$(AR) -CFG_LIB_NAME_x86_64-unknown-freebsd=lib$(1).so -CFG_STATIC_LIB_NAME_x86_64-unknown-freebsd=lib$(1).a -CFG_LIB_GLOB_x86_64-unknown-freebsd=lib$(1)-*.so -CFG_LIB_DSYM_GLOB_x86_64-unknown-freebsd=$(1)-*.dylib.dSYM -CFG_JEMALLOC_CFLAGS_x86_64-unknown-freebsd := -I/usr/local/include $(CFLAGS) -CFG_GCCISH_CFLAGS_x86_64-unknown-freebsd := -g -fPIC -I/usr/local/include $(CFLAGS) -CFG_GCCISH_LINK_FLAGS_x86_64-unknown-freebsd := -shared -fPIC -g -pthread -lrt -CFG_GCCISH_DEF_FLAG_x86_64-unknown-freebsd := -Wl,--export-dynamic,--dynamic-list= -CFG_LLC_FLAGS_x86_64-unknown-freebsd := -CFG_INSTALL_NAME_x86_64-unknown-freebsd = -CFG_EXE_SUFFIX_x86_64-unknown-freebsd := -CFG_WINDOWSY_x86_64-unknown-freebsd := -CFG_UNIXY_x86_64-unknown-freebsd := 1 -CFG_LDPATH_x86_64-unknown-freebsd := -CFG_RUN_x86_64-unknown-freebsd=$(2) -CFG_RUN_TARG_x86_64-unknown-freebsd=$(call CFG_RUN_x86_64-unknown-freebsd,,$(2)) -CFG_GNU_TRIPLE_x86_64-unknown-freebsd := x86_64-unknown-freebsd diff --git a/mk/cfg/x86_64-unknown-fuchsia.mk b/mk/cfg/x86_64-unknown-fuchsia.mk deleted file mode 100644 index 34aee77ae21..00000000000 --- a/mk/cfg/x86_64-unknown-fuchsia.mk +++ /dev/null @@ -1 +0,0 @@ -# rustbuild-only target diff --git a/mk/cfg/x86_64-unknown-haiku.mk b/mk/cfg/x86_64-unknown-haiku.mk deleted file mode 100644 index 4c2d888be06..00000000000 --- a/mk/cfg/x86_64-unknown-haiku.mk +++ /dev/null @@ -1,27 +0,0 @@ -# x86_64-unknown-haiku configuration -CROSS_PREFIX_x86_64-unknown-haiku=x86_64-unknown-haiku- -CC_x86_64-unknown-haiku=$(CC) -CXX_x86_64-unknown-haiku=$(CXX) -CPP_x86_64-unknown-haiku=$(CPP) -AR_x86_64-unknown-haiku=$(AR) -CFG_LIB_NAME_x86_64-unknown-haiku=lib$(1).so -CFG_STATIC_LIB_NAME_x86_64-unknown-haiku=lib$(1).a -CFG_LIB_GLOB_x86_64-unknown-haiku=lib$(1)-*.so -CFG_LIB_DSYM_GLOB_x86_64-unknown-haiku=lib$(1)-*.dylib.dSYM -CFG_CFLAGS_x86_64-unknown-haiku := -m64 $(CFLAGS) -CFG_GCCISH_CFLAGS_x86_64-unknown-haiku := -Wall -Werror -g -fPIC -m64 $(CFLAGS) -CFG_GCCISH_CXXFLAGS_x86_64-unknown-haiku := -fno-rtti $(CXXFLAGS) -CFG_GCCISH_LINK_FLAGS_x86_64-unknown-haiku := -shared -fPIC -ldl -pthread -lrt -g -m64 -CFG_GCCISH_PRE_LIB_FLAGS_x86_64-unknown-haiku := -Wl,-whole-archive -CFG_GCCISH_POST_LIB_FLAGS_x86_64-unknown-haiku := -Wl,-no-whole-archive -CFG_DEF_SUFFIX_x86_64-unknown-haiku := .linux.def -CFG_LLC_FLAGS_x86_64-unknown-haiku := -CFG_INSTALL_NAME_x86_64-unknown-haiku = -CFG_EXE_SUFFIX_x86_64-unknown-haiku = -CFG_WINDOWSY_x86_64-unknown-haiku := -CFG_UNIXY_x86_64-unknown-haiku := 1 -CFG_PATH_MUNGE_x86_64-unknown-haiku := true -CFG_LDPATH_x86_64-unknown-haiku := -CFG_RUN_x86_64-unknown-haiku=$(2) -CFG_RUN_TARG_x86_64-unknown-haiku=$(call CFG_RUN_x86_64-unknown-haiku,,$(2)) -CFG_GNU_TRIPLE_x86_64-unknown-haiku := x86_64-unknown-haiku diff --git a/mk/cfg/x86_64-unknown-linux-gnu.mk b/mk/cfg/x86_64-unknown-linux-gnu.mk deleted file mode 100644 index 817ce22e4f5..00000000000 --- a/mk/cfg/x86_64-unknown-linux-gnu.mk +++ /dev/null @@ -1,23 +0,0 @@ -# x86_64-unknown-linux-gnu configuration -CC_x86_64-unknown-linux-gnu=$(CC) -CXX_x86_64-unknown-linux-gnu=$(CXX) -CPP_x86_64-unknown-linux-gnu=$(CPP) -AR_x86_64-unknown-linux-gnu=$(AR) -CFG_LIB_NAME_x86_64-unknown-linux-gnu=lib$(1).so -CFG_STATIC_LIB_NAME_x86_64-unknown-linux-gnu=lib$(1).a -CFG_LIB_GLOB_x86_64-unknown-linux-gnu=lib$(1)-*.so -CFG_LIB_DSYM_GLOB_x86_64-unknown-linux-gnu=lib$(1)-*.dylib.dSYM -CFG_JEMALLOC_CFLAGS_x86_64-unknown-linux-gnu := -m64 -CFG_GCCISH_CFLAGS_x86_64-unknown-linux-gnu := -g -fPIC -m64 -CFG_GCCISH_CXXFLAGS_x86_64-unknown-linux-gnu := -fno-rtti -CFG_GCCISH_LINK_FLAGS_x86_64-unknown-linux-gnu := -shared -fPIC -ldl -pthread -lrt -g -m64 -CFG_GCCISH_DEF_FLAG_x86_64-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list= -CFG_LLC_FLAGS_x86_64-unknown-linux-gnu := -CFG_INSTALL_NAME_x86_64-unknown-linux-gnu = -CFG_EXE_SUFFIX_x86_64-unknown-linux-gnu = -CFG_WINDOWSY_x86_64-unknown-linux-gnu := -CFG_UNIXY_x86_64-unknown-linux-gnu := 1 -CFG_LDPATH_x86_64-unknown-linux-gnu := -CFG_RUN_x86_64-unknown-linux-gnu=$(2) -CFG_RUN_TARG_x86_64-unknown-linux-gnu=$(call CFG_RUN_x86_64-unknown-linux-gnu,,$(2)) -CFG_GNU_TRIPLE_x86_64-unknown-linux-gnu := x86_64-unknown-linux-gnu diff --git a/mk/cfg/x86_64-unknown-linux-musl.mk b/mk/cfg/x86_64-unknown-linux-musl.mk deleted file mode 100644 index 6f707ac3b3f..00000000000 --- a/mk/cfg/x86_64-unknown-linux-musl.mk +++ /dev/null @@ -1,29 +0,0 @@ -# x86_64-unknown-linux-musl configuration -CC_x86_64-unknown-linux-musl=$(CFG_MUSL_ROOT)/bin/musl-gcc -CXX_x86_64-unknown-linux-musl=$(CXX) -CPP_x86_64-unknown-linux-musl=$(CFG_MUSL_ROOT)/bin/musl-gcc -E -AR_x86_64-unknown-linux-musl=$(AR) -CFG_INSTALL_ONLY_RLIB_x86_64-unknown-linux-musl = 1 -CFG_LIB_NAME_x86_64-unknown-linux-musl=lib$(1).so -CFG_STATIC_LIB_NAME_x86_64-unknown-linux-musl=lib$(1).a -CFG_LIB_GLOB_x86_64-unknown-linux-musl=lib$(1)-*.so -CFG_JEMALLOC_CFLAGS_x86_64-unknown-linux-musl := -m64 -Wa,-mrelax-relocations=no -CFG_GCCISH_CFLAGS_x86_64-unknown-linux-musl := -g -fPIC -m64 -Wa,-mrelax-relocations=no -CFG_GCCISH_CXXFLAGS_x86_64-unknown-linux-musl := -CFG_GCCISH_LINK_FLAGS_x86_64-unknown-linux-musl := -CFG_GCCISH_DEF_FLAG_x86_64-unknown-linux-musl := -CFG_LLC_FLAGS_x86_64-unknown-linux-musl := -CFG_INSTALL_NAME_x86_64-unknown-linux-musl = -CFG_EXE_SUFFIX_x86_64-unknown-linux-musl = -CFG_WINDOWSY_x86_64-unknown-linux-musl := -CFG_UNIXY_x86_64-unknown-linux-musl := 1 -CFG_LDPATH_x86_64-unknown-linux-musl := -CFG_RUN_x86_64-unknown-linux-musl=$(2) -CFG_RUN_TARG_x86_64-unknown-linux-musl=$(call CFG_RUN_x86_64-unknown-linux-musl,,$(2)) -CFG_GNU_TRIPLE_x86_64-unknown-linux-musl := x86_64-unknown-linux-musl -CFG_THIRD_PARTY_OBJECTS_x86_64-unknown-linux-musl := crt1.o crti.o crtn.o -CFG_INSTALLED_OBJECTS_x86_64-unknown-linux-musl := crt1.o crti.o crtn.o - -NATIVE_DEPS_libc_T_x86_64-unknown-linux-musl += libc.a -NATIVE_DEPS_std_T_x86_64-unknown-linux-musl += crt1.o crti.o crtn.o -NATIVE_DEPS_unwind_T_x86_64-unknown-linux-musl += libunwind.a diff --git a/mk/cfg/x86_64-unknown-netbsd.mk b/mk/cfg/x86_64-unknown-netbsd.mk deleted file mode 100644 index 93bb2d67265..00000000000 --- a/mk/cfg/x86_64-unknown-netbsd.mk +++ /dev/null @@ -1,23 +0,0 @@ -# x86_64-unknown-netbsd configuration -CROSS_PREFIX_x86_64-unknown-netbsd=x86_64-unknown-netbsd- -CC_x86_64-unknown-netbsd=$(CC) -CXX_x86_64-unknown-netbsd=$(CXX) -CPP_x86_64-unknown-netbsd=$(CPP) -AR_x86_64-unknown-netbsd=$(AR) -CFG_LIB_NAME_x86_64-unknown-netbsd=lib$(1).so -CFG_STATIC_LIB_NAME_x86_64-unknown-netbsd=lib$(1).a -CFG_LIB_GLOB_x86_64-unknown-netbsd=lib$(1)-*.so -CFG_LIB_DSYM_GLOB_x86_64-unknown-netbsd=$(1)-*.dylib.dSYM -CFG_JEMALLOC_CFLAGS_x86_64-unknown-netbsd := -I/usr/local/include $(CFLAGS) -CFG_GCCISH_CFLAGS_x86_64-unknown-netbsd := -g -fPIC -I/usr/local/include $(CFLAGS) -CFG_GCCISH_LINK_FLAGS_x86_64-unknown-netbsd := -shared -fPIC -g -pthread -lrt -CFG_GCCISH_DEF_FLAG_x86_64-unknown-netbsd := -Wl,--export-dynamic,--dynamic-list= -CFG_LLC_FLAGS_x86_64-unknown-netbsd := -CFG_INSTALL_NAME_x86_64-unknown-netbsd = -CFG_EXE_SUFFIX_x86_64-unknown-netbsd := -CFG_WINDOWSY_x86_64-unknown-netbsd := -CFG_UNIXY_x86_64-unknown-netbsd := 1 -CFG_LDPATH_x86_64-unknown-netbsd := -CFG_RUN_x86_64-unknown-netbsd=$(2) -CFG_RUN_TARG_x86_64-unknown-netbsd=$(call CFG_RUN_x86_64-unknown-netbsd,,$(2)) -CFG_GNU_TRIPLE_x86_64-unknown-netbsd := x86_64-unknown-netbsd diff --git a/mk/cfg/x86_64-unknown-openbsd.mk b/mk/cfg/x86_64-unknown-openbsd.mk deleted file mode 100644 index 7cca1f7b18b..00000000000 --- a/mk/cfg/x86_64-unknown-openbsd.mk +++ /dev/null @@ -1,24 +0,0 @@ -# x86_64-pc-openbsd-elf configuration -CC_x86_64-unknown-openbsd=$(CC) -CXX_x86_64-unknown-openbsd=$(CXX) -CPP_x86_64-unknown-openbsd=$(CPP) -AR_x86_64-unknown-openbsd=$(AR) -CFG_LIB_NAME_x86_64-unknown-openbsd=lib$(1).so -CFG_STATIC_LIB_NAME_x86_64-unknown-openbsd=lib$(1).a -CFG_LIB_GLOB_x86_64-unknown-openbsd=lib$(1)-*.so -CFG_LIB_DSYM_GLOB_x86_64-unknown-openbsd=$(1)-*.dylib.dSYM -CFG_JEMALLOC_CFLAGS_x86_64-unknown-openbsd := -m64 -I/usr/include $(CFLAGS) -CFG_GCCISH_CFLAGS_x86_64-unknown-openbsd := -g -fPIC -m64 -I/usr/include $(CFLAGS) -CFG_GCCISH_LINK_FLAGS_x86_64-unknown-openbsd := -shared -fPIC -g -pthread -m64 -CFG_GCCISH_DEF_FLAG_x86_64-unknown-openbsd := -Wl,--export-dynamic,--dynamic-list= -CFG_LLC_FLAGS_x86_64-unknown-openbsd := -CFG_INSTALL_NAME_x86_64-unknown-openbsd = -CFG_EXE_SUFFIX_x86_64-unknown-openbsd := -CFG_WINDOWSY_x86_64-unknown-openbsd := -CFG_UNIXY_x86_64-unknown-openbsd := 1 -CFG_LDPATH_x86_64-unknown-openbsd := -CFG_RUN_x86_64-unknown-openbsd=$(2) -CFG_RUN_TARG_x86_64-unknown-openbsd=$(call CFG_RUN_x86_64-unknown-openbsd,,$(2)) -CFG_GNU_TRIPLE_x86_64-unknown-openbsd := x86_64-unknown-openbsd -RUSTC_FLAGS_x86_64-unknown-openbsd=-C linker=$(call FIND_COMPILER,$(CC)) -CFG_DISABLE_JEMALLOC_x86_64-unknown-openbsd := 1 diff --git a/mk/cfg/x86_64-unknown-redox.mk b/mk/cfg/x86_64-unknown-redox.mk deleted file mode 100644 index 34aee77ae21..00000000000 --- a/mk/cfg/x86_64-unknown-redox.mk +++ /dev/null @@ -1 +0,0 @@ -# rustbuild-only target diff --git a/mk/clean.mk b/mk/clean.mk deleted file mode 100644 index 7013d9f03f8..00000000000 --- a/mk/clean.mk +++ /dev/null @@ -1,122 +0,0 @@ -# Copyright 2012 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -###################################################################### -# Cleanup -###################################################################### - -CLEAN_STAGE_RULES := \ - $(foreach stage, $(STAGES), \ - $(foreach host, $(CFG_HOST), \ - clean$(stage)_H_$(host) \ - $(foreach target, $(CFG_TARGET), \ - clean$(stage)_T_$(target)_H_$(host)))) - -CLEAN_STAGE_RULES := $(CLEAN_STAGE_RULES) \ - $(foreach host, $(CFG_HOST), clean-generic-H-$(host)) - -CLEAN_STAGE_RULES := $(CLEAN_STAGE_RULES) \ - $(foreach host, $(CFG_TARGET), clean-generic-T-$(host)) - -CLEAN_LLVM_RULES = \ - $(foreach target, $(CFG_HOST), \ - clean-llvm$(target)) - -.PHONY: clean clean-all clean-misc clean-llvm - -clean-all: clean clean-llvm - -clean-llvm: $(CLEAN_LLVM_RULES) - -clean: clean-misc clean-grammar $(CLEAN_STAGE_RULES) - -clean-misc: - @$(call E, cleaning) - $(Q)rm -f $(RUNTIME_OBJS) $(RUNTIME_DEF) - $(Q)rm -f $(RUSTLLVM_LIB_OBJS) $(RUSTLLVM_OBJS_OBJS) $(RUSTLLVM_DEF) - $(Q)rm -Rf $(GENERATED) - $(Q)rm -Rf tmp/* - $(Q)rm -Rf rust-stage0-*.tar.bz2 $(PKG_NAME)-*.tar.gz $(PKG_NAME)-*.exe - $(Q)rm -Rf dist/* - $(Q)rm -Rf doc - -clean-grammar: - @$(call E, cleaning grammar verification) - $(Q)rm -Rf grammar -define CLEAN_GENERIC - -clean-generic-$(2)-$(1): - $(Q)find $(1)/rustllvm \ - $(1)/rt \ - $(1)/test \ - $(1)/stage* \ - -type f \( \ - -name '*.[odasS]' -o \ - -name '*.so' -o \ - -name '*.dylib' -o \ - -name '*.rlib' -o \ - -name 'stamp.*' -o \ - -name '*.lib' -o \ - -name '*.dll' -o \ - -name '*.def' -o \ - -name '*.py' -o \ - -name '*.pyc' -o \ - -name '*.bc' -o \ - -name '*.rs' \ - \) \ - | xargs rm -f - $(Q)find $(1) \ - -name '*.dSYM' \ - | xargs rm -Rf -endef - -$(foreach host, $(CFG_HOST), $(eval $(call CLEAN_GENERIC,$(host),H))) -$(foreach targ, $(CFG_TARGET), $(eval $(call CLEAN_GENERIC,$(targ),T))) - -define CLEAN_HOST_STAGE_N - -clean$(1)_H_$(2): \ - $$(foreach crate,$$(CRATES),clean$(1)_H_$(2)-lib-$$(crate)) \ - $$(foreach tool,$$(TOOLS) $$(DEBUGGER_BIN_SCRIPTS_ALL),clean$(1)_H_$(2)-tool-$$(tool)) - $$(Q)rm -fr $(2)/rt/libbacktrace - -clean$(1)_H_$(2)-tool-%: - $$(Q)rm -f $$(HBIN$(1)_H_$(2))/$$*$$(X_$(2)) - -clean$(1)_H_$(2)-lib-%: - $$(Q)rm -f $$(HLIB$(1)_H_$(2))/$$(call CFG_LIB_GLOB_$(2),$$*) - $$(Q)rm -f $$(HLIB$(1)_H_$(2))/$$(call CFG_RLIB_GLOB,$$*) - -endef - -$(foreach host, $(CFG_HOST), \ - $(eval $(foreach stage, $(STAGES), \ - $(eval $(call CLEAN_HOST_STAGE_N,$(stage),$(host)))))) - -define CLEAN_TARGET_STAGE_N - -clean$(1)_T_$(2)_H_$(3): \ - $$(foreach crate,$$(CRATES),clean$(1)_T_$(2)_H_$(3)-lib-$$(crate)) \ - $$(foreach tool,$$(TOOLS) $$(DEBUGGER_BIN_SCRIPTS_ALL),clean$(1)_T_$(2)_H_$(3)-tool-$$(tool)) - $(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/librun_pass_stage* # For unix - $(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/run_pass_stage* # For windows - -clean$(1)_T_$(2)_H_$(3)-tool-%: - $$(Q)rm -f $$(TBIN$(1)_T_$(2)_H_$(3))/$$*$$(X_$(2)) - -clean$(1)_T_$(2)_H_$(3)-lib-%: - $$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$$(call CFG_LIB_GLOB_$(2),$$*) - $$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$$(call CFG_RLIB_GLOB,$$*) -endef - -$(foreach host, $(CFG_HOST), \ - $(eval $(foreach target, $(CFG_TARGET), \ - $(eval $(foreach stage, 0 1 2 3, \ - $(eval $(call CLEAN_TARGET_STAGE_N,$(stage),$(target),$(host)))))))) diff --git a/mk/crates.mk b/mk/crates.mk deleted file mode 100644 index 320ba44ed80..00000000000 --- a/mk/crates.mk +++ /dev/null @@ -1,228 +0,0 @@ -# Copyright 2014 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -################################################################################ -# Rust's standard distribution of crates and tools -# -# The crates outlined below are the standard distribution of libraries provided -# in a rust installation. These rules are meant to abstract over the -# dependencies (both native and rust) of crates and basically generate all the -# necessary makefile rules necessary to build everything. -# -# Here's an explanation of the variables below -# -# TARGET_CRATES -# This list of crates will be built for all targets, including -# cross-compiled targets -# -# HOST_CRATES -# This list of crates will be compiled for only host targets. Note that -# this set is explicitly *not* a subset of TARGET_CRATES, but rather it is -# a disjoint set. Nothing in the TARGET_CRATES set can depend on crates in -# the HOST_CRATES set, but the HOST_CRATES set can depend on target -# crates. -# -# TOOLS -# A list of all tools which will be built as part of the compilation -# process. It is currently assumed that most tools are built through -# src/driver/driver.rs with a particular configuration (there's a -# corresponding library providing the implementation) -# -# DEPS_ -# These lists are the dependencies of the that is to be built. -# Rust dependencies are listed bare (i.e. std) and native -# dependencies have a "native:" prefix (i.e. native:hoedown). All deps -# will be built before the crate itself is built. -# -# TOOL_DEPS_/TOOL_SOURCE_ -# Similar to the DEPS variable, this is the library crate dependencies -# list for tool as well as the source file for the specified tool -# -# You shouldn't need to modify much other than these variables. Crates are -# automatically generated for all stage/host/target combinations. -################################################################################ - -TARGET_CRATES := libc std term \ - getopts collections test rand \ - compiler_builtins core alloc \ - std_unicode rustc_bitflags \ - alloc_system alloc_jemalloc \ - panic_abort panic_unwind unwind -RUSTC_CRATES := rustc rustc_typeck rustc_mir rustc_borrowck rustc_resolve rustc_driver \ - rustc_trans rustc_back rustc_llvm rustc_privacy rustc_lint \ - rustc_data_structures rustc_platform_intrinsics rustc_errors \ - rustc_plugin rustc_metadata rustc_passes rustc_save_analysis \ - rustc_const_eval rustc_const_math rustc_incremental proc_macro -HOST_CRATES := syntax syntax_ext proc_macro_plugin syntax_pos $(RUSTC_CRATES) \ - rustdoc fmt_macros flate arena graphviz log serialize -TOOLS := compiletest rustdoc rustc rustbook error_index_generator - -DEPS_core := -DEPS_compiler_builtins := core native:compiler-rt -DEPS_alloc := core libc alloc_system -DEPS_alloc_system := core libc -DEPS_alloc_jemalloc := core libc native:jemalloc -DEPS_collections := core alloc std_unicode -DEPS_libc := core -DEPS_rand := core -DEPS_rustc_bitflags := core -DEPS_std_unicode := core -DEPS_panic_abort := libc alloc -DEPS_panic_unwind := libc alloc unwind -DEPS_unwind := libc - -RUSTFLAGS_compiler_builtins := -lstatic=compiler-rt -RUSTFLAGS_panic_abort := -C panic=abort - -DEPS_std := core libc rand alloc collections compiler_builtins std_unicode \ - native:backtrace \ - alloc_system panic_abort panic_unwind unwind -DEPS_arena := std -DEPS_glob := std -DEPS_flate := std native:miniz -DEPS_fmt_macros = std -DEPS_getopts := std -DEPS_graphviz := std -DEPS_log := std -DEPS_num := std -DEPS_serialize := std log -DEPS_term := std -DEPS_test := std getopts term native:rust_test_helpers - -DEPS_syntax := std term serialize log arena libc rustc_bitflags std_unicode rustc_errors \ - syntax_pos rustc_data_structures -DEPS_syntax_ext := syntax syntax_pos rustc_errors fmt_macros proc_macro -DEPS_proc_macro := syntax syntax_pos rustc_plugin log -DEPS_syntax_pos := serialize -DEPS_proc_macro_plugin := syntax syntax_pos rustc_plugin - -DEPS_rustc_const_math := std syntax log serialize -DEPS_rustc_const_eval := rustc_const_math rustc syntax log serialize \ - rustc_back graphviz syntax_pos - -DEPS_rustc := syntax fmt_macros flate arena serialize getopts \ - log graphviz rustc_llvm rustc_back rustc_data_structures\ - rustc_const_math syntax_pos rustc_errors -DEPS_rustc_back := std syntax flate log libc -DEPS_rustc_borrowck := rustc log graphviz syntax syntax_pos rustc_errors rustc_mir -DEPS_rustc_data_structures := std log serialize libc -DEPS_rustc_driver := arena flate getopts graphviz libc rustc rustc_back rustc_borrowck \ - rustc_typeck rustc_mir rustc_resolve log syntax serialize rustc_llvm \ - rustc_trans rustc_privacy rustc_lint rustc_plugin \ - rustc_metadata syntax_ext proc_macro_plugin \ - rustc_passes rustc_save_analysis rustc_const_eval \ - rustc_incremental syntax_pos rustc_errors proc_macro rustc_data_structures -DEPS_rustc_errors := log libc serialize syntax_pos -DEPS_rustc_lint := rustc log syntax syntax_pos rustc_const_eval -DEPS_rustc_llvm := native:rustllvm libc std rustc_bitflags -DEPS_proc_macro := std syntax -DEPS_rustc_metadata := rustc syntax syntax_pos rustc_errors rustc_const_math \ - proc_macro syntax_ext -DEPS_rustc_passes := syntax syntax_pos rustc core rustc_const_eval rustc_errors -DEPS_rustc_mir := rustc syntax syntax_pos rustc_const_math rustc_const_eval rustc_bitflags -DEPS_rustc_resolve := arena rustc log syntax syntax_pos rustc_errors -DEPS_rustc_platform_intrinsics := std -DEPS_rustc_plugin := rustc rustc_metadata syntax syntax_pos rustc_errors -DEPS_rustc_privacy := rustc log syntax syntax_pos -DEPS_rustc_trans := arena flate getopts graphviz libc rustc rustc_back \ - log syntax serialize rustc_llvm rustc_platform_intrinsics \ - rustc_const_math rustc_const_eval rustc_incremental rustc_errors syntax_pos -DEPS_rustc_incremental := rustc syntax_pos serialize rustc_data_structures -DEPS_rustc_save_analysis := rustc log syntax syntax_pos serialize -DEPS_rustc_typeck := rustc syntax syntax_pos rustc_platform_intrinsics rustc_const_math \ - rustc_const_eval rustc_errors rustc_data_structures - -DEPS_rustdoc := rustc rustc_driver native:hoedown serialize getopts test \ - rustc_lint rustc_const_eval syntax_pos rustc_data_structures - -TOOL_DEPS_compiletest := test getopts log serialize -TOOL_DEPS_rustdoc := rustdoc -TOOL_DEPS_rustc := rustc_driver -TOOL_DEPS_rustbook := std rustdoc -TOOL_DEPS_error_index_generator := rustdoc syntax serialize -TOOL_SOURCE_compiletest := $(S)src/tools/compiletest/src/main.rs -TOOL_SOURCE_rustdoc := $(S)src/driver/driver.rs -TOOL_SOURCE_rustc := $(S)src/driver/driver.rs -TOOL_SOURCE_rustbook := $(S)src/tools/rustbook/main.rs -TOOL_SOURCE_error_index_generator := $(S)src/tools/error_index_generator/main.rs - -ONLY_RLIB_compiler_builtins := 1 -ONLY_RLIB_core := 1 -ONLY_RLIB_libc := 1 -ONLY_RLIB_alloc := 1 -ONLY_RLIB_rand := 1 -ONLY_RLIB_collections := 1 -ONLY_RLIB_std_unicode := 1 -ONLY_RLIB_rustc_bitflags := 1 -ONLY_RLIB_alloc_system := 1 -ONLY_RLIB_alloc_jemalloc := 1 -ONLY_RLIB_panic_unwind := 1 -ONLY_RLIB_panic_abort := 1 -ONLY_RLIB_unwind := 1 - -TARGET_SPECIFIC_alloc_jemalloc := 1 - -# Documented-by-default crates -DOC_CRATES := std alloc collections core libc std_unicode - -ifeq ($(CFG_DISABLE_JEMALLOC),) -RUSTFLAGS_rustc_back := --cfg 'feature="jemalloc"' -endif - -################################################################################ -# You should not need to edit below this line -################################################################################ - -CRATES := $(TARGET_CRATES) $(HOST_CRATES) - -# This macro creates some simple definitions for each crate being built, just -# some munging of all of the parameters above. -# -# $(1) is the crate to generate variables for -define RUST_CRATE -CRATEFILE_$(1) := $$(SREL)src/lib$(1)/lib.rs -RSINPUTS_$(1) := $$(call rwildcard,$(S)src/lib$(1)/,*.rs) -NATIVE_DEPS_$(1) := $$(patsubst native:%,%,$$(filter native:%,$$(DEPS_$(1)))) -endef - -$(foreach crate,$(CRATES),$(eval $(call RUST_CRATE,$(crate)))) - -# $(1) - crate -# $(2) - target -define RUST_CRATE_DEPS -RUST_DEPS_$(1)_T_$(2) := $$(filter-out native:%,$$(DEPS_$(1))) -endef - -$(foreach target,$(CFG_TARGET),\ - $(foreach crate,$(CRATES),$(eval $(call RUST_CRATE_DEPS,$(crate),$(target))))) - -# $(1) - target -# $(2) - crate -define DEFINE_TARGET_CRATES -ifndef TARGET_SPECIFIC_$(2) -TARGET_CRATES_$(1) += $(2) -endif -endef - -$(foreach target,$(CFG_TARGET),\ - $(foreach crate,$(TARGET_CRATES),\ - $(eval $(call DEFINE_TARGET_CRATES,$(target),$(crate))))) - -# Similar to the macro above for crates, this macro is for tools -# -# $(1) is the crate to generate variables for -define RUST_TOOL -TOOL_INPUTS_$(1) := $$(call rwildcard,$$(dir $$(TOOL_SOURCE_$(1))),*.rs) -endef - -$(foreach crate,$(TOOLS),$(eval $(call RUST_TOOL,$(crate)))) - -CRATEFILE_libc := $(SREL)src/liblibc/src/lib.rs -RUSTFLAGS_libc := --cfg stdbuild diff --git a/mk/ctags.mk b/mk/ctags.mk deleted file mode 100644 index 1fcb0bb4deb..00000000000 --- a/mk/ctags.mk +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2012 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -###################################################################### -# TAGS file creation. No dependency tracking, just do it on demand. -# Requires Exuberant Ctags: http://ctags.sourceforge.net/index.html -###################################################################### - -.PHONY: TAGS.emacs TAGS.vi - -CTAGS_RUSTC_LOCATIONS=$(patsubst ${CFG_SRC_DIR}src/lib%test,, \ - $(wildcard ${CFG_SRC_DIR}src/lib*)) ${CFG_SRC_DIR}src/libtest -CTAGS_LOCATIONS=$(patsubst ${CFG_SRC_DIR}src/librust%,, \ - $(patsubst ${CFG_SRC_DIR}src/lib%test,, \ - $(wildcard ${CFG_SRC_DIR}src/lib*))) ${CFG_SRC_DIR}src/libtest -CTAGS_OPTS=--options="${CFG_SRC_DIR}src/etc/ctags.rust" --languages=Rust --recurse - -TAGS.rustc.emacs: - ctags -e -f $@ ${CTAGS_OPTS} ${CTAGS_RUSTC_LOCATIONS} - -TAGS.emacs: - ctags -e -f $@ ${CTAGS_OPTS} ${CTAGS_LOCATIONS} - -TAGS.rustc.vi: - ctags -f $@ ${CTAGS_OPTS} ${CTAGS_RUSTC_LOCATIONS} - -TAGS.vi: - ctags -f $@ ${CTAGS_OPTS} ${CTAGS_LOCATIONS} diff --git a/mk/debuggers.mk b/mk/debuggers.mk deleted file mode 100644 index fbf32dc1a39..00000000000 --- a/mk/debuggers.mk +++ /dev/null @@ -1,145 +0,0 @@ -# Copyright 2014 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -###################################################################### -# Copy debugger related scripts -###################################################################### - - -## GDB ## -DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB=gdb_load_rust_pretty_printers.py \ - gdb_rust_pretty_printing.py \ - debugger_pretty_printers_common.py -DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS=\ - $(foreach script,$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB), \ - $(CFG_SRC_DIR)src/etc/$(script)) - -DEBUGGER_BIN_SCRIPTS_GDB=rust-gdb -DEBUGGER_BIN_SCRIPTS_GDB_ABS=\ - $(foreach script,$(DEBUGGER_BIN_SCRIPTS_GDB), \ - $(CFG_SRC_DIR)src/etc/$(script)) - - -## LLDB ## -DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB=lldb_rust_formatters.py \ - debugger_pretty_printers_common.py -DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB_ABS=\ - $(foreach script,$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB), \ - $(CFG_SRC_DIR)src/etc/$(script)) - -DEBUGGER_BIN_SCRIPTS_LLDB=rust-lldb -DEBUGGER_BIN_SCRIPTS_LLDB_ABS=\ - $(foreach script,$(DEBUGGER_BIN_SCRIPTS_LLDB), \ - $(CFG_SRC_DIR)src/etc/$(script)) - - -## ALL ## -DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL=gdb_load_rust_pretty_printers.py \ - gdb_rust_pretty_printing.py \ - lldb_rust_formatters.py \ - debugger_pretty_printers_common.py -DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL_ABS=\ - $(foreach script,$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL), \ - $(CFG_SRC_DIR)src/etc/$(script)) -DEBUGGER_BIN_SCRIPTS_ALL=$(DEBUGGER_BIN_SCRIPTS_GDB) \ - $(DEBUGGER_BIN_SCRIPTS_LLDB) -DEBUGGER_BIN_SCRIPTS_ALL_ABS=$(DEBUGGER_BIN_SCRIPTS_GDB_ABS) \ - $(DEBUGGER_BIN_SCRIPTS_LLDB_ABS) - - -# $(1) - the stage to copy to -# $(2) - the host triple -define DEF_INSTALL_DEBUGGER_SCRIPTS_HOST - -tmp/install-debugger-scripts$(1)_H_$(2)-gdb.done: \ - $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS) \ - $$(DEBUGGER_BIN_SCRIPTS_GDB_ABS) - $(Q)touch $$@.start_time - $(Q)mkdir -p $$(HBIN$(1)_H_$(2)) - $(Q)mkdir -p $$(HLIB$(1)_H_$(2))/rustlib/etc - $(Q)install $$(DEBUGGER_BIN_SCRIPTS_GDB_ABS) $$(HBIN$(1)_H_$(2)) - $(Q)install $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS) $$(HLIB$(1)_H_$(2))/rustlib/etc - $(Q)touch -r $$@.start_time $$@ && rm $$@.start_time - -tmp/install-debugger-scripts$(1)_H_$(2)-lldb.done: \ - $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB_ABS) \ - $$(DEBUGGER_BIN_SCRIPTS_LLDB_ABS) - $(Q)touch $$@.start_time - $(Q)mkdir -p $$(HBIN$(1)_H_$(2)) - $(Q)mkdir -p $$(HLIB$(1)_H_$(2))/rustlib/etc - $(Q)install $$(DEBUGGER_BIN_SCRIPTS_LLDB_ABS) $$(HBIN$(1)_H_$(2)) - $(Q)install $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB_ABS) $$(HLIB$(1)_H_$(2))/rustlib/etc - $(Q)touch -r $$@.start_time $$@ && rm $$@.start_time - -tmp/install-debugger-scripts$(1)_H_$(2)-all.done: \ - $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL_ABS) \ - $$(DEBUGGER_BIN_SCRIPTS_ALL_ABS) - $(Q)touch $$@.start_time - $(Q)mkdir -p $$(HBIN$(1)_H_$(2)) - $(Q)mkdir -p $$(HLIB$(1)_H_$(2))/rustlib/etc - $(Q)install $$(DEBUGGER_BIN_SCRIPTS_ALL_ABS) $$(HBIN$(1)_H_$(2)) - $(Q)install $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL_ABS) $$(HLIB$(1)_H_$(2))/rustlib/etc - $(Q)touch -r $$@.start_time $$@ && rm $$@.start_time - -tmp/install-debugger-scripts$(1)_H_$(2)-none.done: - $(Q)touch $$@ - -endef - -# Expand host make-targets for all stages -$(foreach stage,$(STAGES), \ - $(foreach host,$(CFG_HOST), \ - $(eval $(call DEF_INSTALL_DEBUGGER_SCRIPTS_HOST,$(stage),$(host))))) - -# $(1) is the stage number -# $(2) is the target triple -# $(3) is the host triple -define DEF_INSTALL_DEBUGGER_SCRIPTS_TARGET - -tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3)-gdb.done: \ - $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS) \ - $$(DEBUGGER_BIN_SCRIPTS_GDB_ABS) - $(Q)touch $$@.start_time - $(Q)mkdir -p $$(TBIN$(1)_T_$(2)_H_$(3)) - $(Q)mkdir -p $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc - $(Q)install $(DEBUGGER_BIN_SCRIPTS_GDB_ABS) $$(TBIN$(1)_T_$(2)_H_$(3)) - $(Q)install $(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS) $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc - $(Q)touch -r $$@.start_time $$@ && rm $$@.start_time - -tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3)-lldb.done: \ - $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB_ABS) \ - $$(DEBUGGER_BIN_SCRIPTS_LLDB_ABS) - $(Q)touch $$@.start_time - $(Q)mkdir -p $$(TBIN$(1)_T_$(2)_H_$(3)) - $(Q)mkdir -p $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc - $(Q)install $(DEBUGGER_BIN_SCRIPTS_LLDB_ABS) $$(TBIN$(1)_T_$(2)_H_$(3)) - $(Q)install $(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB_ABS) $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc - $(Q)touch -r $$@.start_time $$@ && rm $$@.start_time - -tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3)-all.done: \ - $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL_ABS) \ - $$(DEBUGGER_BIN_SCRIPTS_ALL_ABS) - $(Q)touch $$@.start_time - $(Q)mkdir -p $$(TBIN$(1)_T_$(2)_H_$(3)) - $(Q)mkdir -p $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc - $(Q)install $(DEBUGGER_BIN_SCRIPTS_ALL_ABS) $$(TBIN$(1)_T_$(2)_H_$(3)) - $(Q)install $(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL_ABS) $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc - $(Q)touch -r $$@.start_time $$@ && rm $$@.start_time - -tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3)-none.done: - $(Q)touch $$@ - -endef - -# Expand target make-targets for all stages -$(foreach stage,$(STAGES), \ - $(foreach target,$(CFG_TARGET), \ - $(foreach host,$(CFG_HOST), \ - $(eval $(call DEF_INSTALL_DEBUGGER_SCRIPTS_TARGET,$(stage),$(target),$(host)))))) diff --git a/mk/dist.mk b/mk/dist.mk deleted file mode 100644 index 238ba8acee4..00000000000 --- a/mk/dist.mk +++ /dev/null @@ -1,382 +0,0 @@ -# Copyright 2014 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -###################################################################### -# Distribution -###################################################################### - -# Primary targets: -# -# * dist - make all distribution artifacts -# * distcheck - sanity check dist artifacts -# * dist-tar-src - source tarballs -# * dist-tar-bins - Ad-hoc Unix binary installers -# * dist-docs - Stage docs for upload - -PKG_NAME := $(CFG_PACKAGE_NAME) -STD_PKG_NAME := rust-std-$(CFG_PACKAGE_VERS) -DOC_PKG_NAME := rust-docs-$(CFG_PACKAGE_VERS) -MINGW_PKG_NAME := rust-mingw-$(CFG_PACKAGE_VERS) -SRC_PKG_NAME := rust-src-$(CFG_PACKAGE_VERS) - -# License suitable for displaying in a popup -LICENSE.txt: $(S)COPYRIGHT $(S)LICENSE-APACHE $(S)LICENSE-MIT - cat $^ > $@ - - -###################################################################### -# Source tarball -###################################################################### - -PKG_TAR = dist/$(PKG_NAME)-src.tar.gz - -PKG_GITMODULES := $(S)src/llvm $(S)src/compiler-rt \ - $(S)src/rt/hoedown $(S)src/jemalloc -PKG_FILES := \ - $(S)COPYRIGHT \ - $(S)LICENSE-APACHE \ - $(S)LICENSE-MIT \ - $(S)CONTRIBUTING.md \ - $(S)README.md \ - $(S)RELEASES.md \ - $(S)configure $(S)Makefile.in \ - $(S)man \ - $(addprefix $(S)src/, \ - bootstrap \ - build_helper \ - doc \ - driver \ - etc \ - $(foreach crate,$(CRATES),lib$(crate)) \ - libcollectionstest \ - libcoretest \ - libbacktrace \ - rt \ - rtstartup \ - rustllvm \ - rustc \ - stage0.txt \ - rust-installer \ - tools \ - test \ - vendor) \ - $(PKG_GITMODULES) \ - $(filter-out config.stamp, \ - $(MKFILES_FOR_TARBALL)) - -UNROOTED_PKG_FILES := $(patsubst $(S)%,./%,$(PKG_FILES)) - -tmp/dist/$$(SRC_PKG_NAME)-image: $(PKG_FILES) - @$(call E, making src image) - $(Q)rm -Rf tmp/dist/$(SRC_PKG_NAME)-image - $(Q)mkdir -p tmp/dist/$(SRC_PKG_NAME)-image/lib/rustlib/src/rust - $(Q)echo "$(CFG_VERSION)" > tmp/dist/$(SRC_PKG_NAME)-image/lib/rustlib/src/rust/version - $(Q)tar \ - -C $(S) \ - -f - \ - --exclude-vcs \ - --exclude=*~ \ - --exclude=*.pyc \ - --exclude=*/llvm/test/*/*.ll \ - --exclude=*/llvm/test/*/*.td \ - --exclude=*/llvm/test/*/*.s \ - --exclude=*/llvm/test/*/*/*.ll \ - --exclude=*/llvm/test/*/*/*.td \ - --exclude=*/llvm/test/*/*/*.s \ - -c $(UNROOTED_PKG_FILES) | tar -x -f - -C tmp/dist/$(SRC_PKG_NAME)-image/lib/rustlib/src/rust - -$(PKG_TAR): tmp/dist/$$(SRC_PKG_NAME)-image - @$(call E, making $@) - $(Q)tar -czf $(PKG_TAR) -C tmp/dist/$(SRC_PKG_NAME)-image/lib/rustlib/src rust --transform 's,^rust,$(PKG_NAME),S' - -dist-tar-src: $(PKG_TAR) - -distcheck-tar-src: dist-tar-src - $(Q)rm -Rf tmp/distcheck/$(PKG_NAME) - $(Q)rm -Rf tmp/distcheck/srccheck - $(Q)mkdir -p tmp/distcheck - @$(call E, unpacking $(PKG_TAR) in tmp/distcheck/$(PKG_NAME)) - $(Q)cd tmp/distcheck && tar -xzf ../../$(PKG_TAR) - @$(call E, configuring in tmp/distcheck/srccheck) - $(Q)mkdir -p tmp/distcheck/srccheck - $(Q)cd tmp/distcheck/srccheck && ../$(PKG_NAME)/configure - @$(call E, making 'check' in tmp/distcheck/srccheck) - $(Q)+make -C tmp/distcheck/srccheck check - @$(call E, making 'clean' in tmp/distcheck/srccheck) - $(Q)+make -C tmp/distcheck/srccheck clean - $(Q)rm -Rf tmp/distcheck/$(PKG_NAME) - $(Q)rm -Rf tmp/distcheck/srccheck - - -###################################################################### -# Unix binary installer tarballs -###################################################################### - -define DEF_START_INSTALLER -dist-install-dir-$(1)-%: PREPARE_DIR_CMD=$(DEFAULT_PREPARE_DIR_CMD) -dist-install-dir-$(1)-%: PREPARE_BIN_CMD=$(DEFAULT_PREPARE_BIN_CMD) -dist-install-dir-$(1)-%: PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD) -dist-install-dir-$(1)-%: PREPARE_MAN_CMD=$(DEFAULT_PREPARE_MAN_CMD) -dist-install-dir-$(1)-%: PREPARE_CLEAN=true - -$$(eval $$(call DEF_PREPARE,dir-$(1))) -endef - -$(foreach target,$(CFG_TARGET),\ - $(eval $(call DEF_START_INSTALLER,$(target)))) - -define DEF_INSTALLER - -dist-install-dir-$(1)-host: PREPARE_HOST=$(1) -dist-install-dir-$(1)-host: PREPARE_TARGETS=$(2) -dist-install-dir-$(1)-host: PREPARE_DEST_DIR=tmp/dist/$$(PKG_NAME)-$(1)-image -dist-install-dir-$(1)-host: prepare-base-dir-$(1)-host docs - $$(Q)mkdir -p $$(PREPARE_DEST_DIR)/share/doc/rust - $$(Q)$$(PREPARE_MAN_CMD) $$(S)COPYRIGHT $$(PREPARE_DEST_DIR)/share/doc/rust - $$(Q)$$(PREPARE_MAN_CMD) $$(S)LICENSE-APACHE $$(PREPARE_DEST_DIR)/share/doc/rust - $$(Q)$$(PREPARE_MAN_CMD) $$(S)LICENSE-MIT $$(PREPARE_DEST_DIR)/share/doc/rust - $$(Q)$$(PREPARE_MAN_CMD) $$(S)README.md $$(PREPARE_DEST_DIR)/share/doc/rust - -prepare-overlay-$(1): - $$(Q)rm -Rf tmp/dist/$$(PKG_NAME)-$(1)-overlay - $$(Q)mkdir -p tmp/dist/$$(PKG_NAME)-$(1)-overlay - $$(Q)cp $$(S)COPYRIGHT tmp/dist/$$(PKG_NAME)-$(1)-overlay/ - $$(Q)cp $$(S)LICENSE-APACHE tmp/dist/$$(PKG_NAME)-$(1)-overlay/ - $$(Q)cp $$(S)LICENSE-MIT tmp/dist/$$(PKG_NAME)-$(1)-overlay/ - $$(Q)cp $$(S)README.md tmp/dist/$$(PKG_NAME)-$(1)-overlay/ -# This tiny morsel of metadata is used by rust-packaging - $$(Q)echo "$(CFG_VERSION)" > tmp/dist/$$(PKG_NAME)-$(1)-overlay/version - -dist/$$(PKG_NAME)-$(1).tar.gz: dist-install-dir-$(1)-host prepare-overlay-$(1) - @$(call E, build: $$@) -# On a MinGW target we've got a few runtime DLL dependencies that we need -# to include. THe first argument to `make-win-dist` is where to put these DLLs -# (the image we're creating) and the second argument is a junk directory to -# ignore all the other MinGW stuff the script creates. -ifeq ($$(findstring pc-windows-gnu,$(1)),pc-windows-gnu) - $$(Q)rm -Rf tmp/dist/win-rust-gcc-$(1) - $$(Q)$$(CFG_PYTHON) $$(S)src/etc/make-win-dist.py \ - tmp/dist/$$(PKG_NAME)-$(1)-image \ - tmp/dist/win-rust-gcc-$(1) $(1) -endif -# On 32-bit MinGW we're always including a DLL which needs some extra licenses -# to distribute. On 64-bit MinGW we don't actually distribute anything requiring -# us to distribute a license but it's likely that the install will *also* -# include the rust-mingw package down below, which also need licenses, so to be -# safe we just inlude it here in all MinGW packages. -ifdef CFG_WINDOWSY_$(1) -ifeq ($$(findstring $(1),gnu),gnu) - $$(Q)cp -r $$(S)src/etc/third-party \ - tmp/dist/$$(PKG_NAME)-$(1)-image/share/doc/ -endif -endif - $$(Q)$$(S)src/rust-installer/gen-installer.sh \ - --product-name=Rust \ - --rel-manifest-dir=rustlib \ - --success-message=Rust-is-ready-to-roll. \ - --image-dir=tmp/dist/$$(PKG_NAME)-$(1)-image \ - --work-dir=tmp/dist \ - --output-dir=dist \ - --non-installed-overlay=tmp/dist/$$(PKG_NAME)-$(1)-overlay \ - --package-name=$$(PKG_NAME)-$(1) \ - --component-name=rustc \ - --legacy-manifest-dirs=rustlib,cargo - $$(Q)rm -R tmp/dist/$$(PKG_NAME)-$(1)-image - -dist-doc-install-dir-$(1): docs - $$(Q)mkdir -p tmp/dist/$$(DOC_PKG_NAME)-$(1)-image/share/doc/rust - $$(Q)cp -r doc tmp/dist/$$(DOC_PKG_NAME)-$(1)-image/share/doc/rust/html - -dist/$$(DOC_PKG_NAME)-$(1).tar.gz: dist-doc-install-dir-$(1) - @$(call E, build: $$@) - $$(Q)$$(S)src/rust-installer/gen-installer.sh \ - --product-name=Rust-Documentation \ - --rel-manifest-dir=rustlib \ - --success-message=Rust-documentation-is-installed. \ - --image-dir=tmp/dist/$$(DOC_PKG_NAME)-$(1)-image \ - --work-dir=tmp/dist \ - --output-dir=dist \ - --package-name=$$(DOC_PKG_NAME)-$(1) \ - --component-name=rust-docs \ - --legacy-manifest-dirs=rustlib,cargo \ - --bulk-dirs=share/doc/rust/html - $$(Q)rm -R tmp/dist/$$(DOC_PKG_NAME)-$(1)-image - -# Creates the rust-mingw package, and the first argument to make-win-dist is a -# "temporary directory" which is just thrown away (this contains the runtime -# DLLs included in the rustc package above) and the second argument is where to -# place all the MinGW components (which is what we want). -dist-mingw-install-dir-$(1): - $$(Q)mkdir -p tmp/dist/rust-mingw-tmp-$(1)-image - $$(Q)rm -Rf tmp/dist/$$(MINGW_PKG_NAME)-$(1)-image - $$(Q)$$(CFG_PYTHON) $$(S)src/etc/make-win-dist.py \ - tmp/dist/rust-mingw-tmp-$(1)-image \ - tmp/dist/$$(MINGW_PKG_NAME)-$(1)-image $(1) - -dist/$$(MINGW_PKG_NAME)-$(1).tar.gz: dist-mingw-install-dir-$(1) - @$(call E, build: $$@) - $$(Q)$$(S)src/rust-installer/gen-installer.sh \ - --product-name=Rust-MinGW \ - --rel-manifest-dir=rustlib \ - --success-message=Rust-MinGW-is-installed. \ - --image-dir=tmp/dist/$$(MINGW_PKG_NAME)-$(1)-image \ - --work-dir=tmp/dist \ - --output-dir=dist \ - --package-name=$$(MINGW_PKG_NAME)-$(1) \ - --component-name=rust-mingw \ - --legacy-manifest-dirs=rustlib,cargo - $$(Q)rm -R tmp/dist/$$(MINGW_PKG_NAME)-$(1)-image - -endef - -# $(1) - host -# $(2) - target -define DEF_INSTALLER_TARGETS - -dist-install-dir-$(2)-target: PREPARE_HOST=$(1) -dist-install-dir-$(2)-target: PREPARE_TARGETS=$(2) -dist-install-dir-$(2)-target: PREPARE_DEST_DIR=tmp/dist/$$(STD_PKG_NAME)-$(2)-image -dist-install-dir-$(2)-target: prepare-base-dir-$(2)-target - -dist/$$(STD_PKG_NAME)-$(2).tar.gz: dist-install-dir-$(2)-target - @$$(call E, build: $$@) - $$(Q)$$(S)src/rust-installer/gen-installer.sh \ - --product-name=Rust \ - --rel-manifest-dir=rustlib \ - --success-message=std-is-standing-at-the-ready. \ - --image-dir=tmp/dist/$$(STD_PKG_NAME)-$(2)-image \ - --work-dir=tmp/dist \ - --output-dir=dist \ - --package-name=$$(STD_PKG_NAME)-$(2) \ - --component-name=rust-std-$(2) \ - --legacy-manifest-dirs=rustlib,cargo - $$(Q)rm -R tmp/dist/$$(STD_PKG_NAME)-$(2)-image -endef - -$(foreach host,$(CFG_HOST),\ - $(eval $(call DEF_INSTALLER,$(host)))) - -dist/$(SRC_PKG_NAME).tar.gz: tmp/dist/$(SRC_PKG_NAME)-image - @$(call E, build: $@) - $(Q)$(S)src/rust-installer/gen-installer.sh \ - --product-name=Rust \ - --rel-manifest-dir=rustlib \ - --success-message=Awesome-Source. \ - --image-dir=tmp/dist/$(SRC_PKG_NAME)-image \ - --work-dir=tmp/dist \ - --output-dir=dist \ - --package-name=$(SRC_PKG_NAME) \ - --component-name=rust-src \ - --legacy-manifest-dirs=rustlib,cargo - -# When generating packages for the standard library, we've actually got a lot of -# artifacts to choose from. Each of the CFG_HOST compilers will have a copy of -# the standard library for each CFG_TARGET, but we only want to generate one -# standard library package. As a result, for each entry in CFG_TARGET we need to -# pick a CFG_HOST to get the standard library from. -# -# In theory it doesn't actually matter what host we choose as it should be the -# case that all hosts produce the same set of libraries for a target (regardless -# of the host itself). Currently there is a bug in the compiler, however, which -# means this is not the case (see #29228 and #29235). To solve the first of -# those bugs, we prefer to select a standard library from the host it was -# generated from, allowing plugins to work in more situations. -# -# For all CFG_TARGET entries in CFG_HOST, however, we just pick CFG_BUILD as the -# host we slurp up a standard library from. -$(foreach host,$(CFG_HOST),\ - $(eval $(call DEF_INSTALLER_TARGETS,$(host),$(host)))) -$(foreach target,$(filter-out $(CFG_HOST),$(CFG_TARGET)),\ - $(eval $(call DEF_INSTALLER_TARGETS,$(CFG_BUILD),$(target)))) - -ifdef CFG_WINDOWSY_$(CFG_BUILD) -define BUILD_MINGW_TARBALL -ifeq ($$(findstring gnu,$(1)),gnu) -MAYBE_MINGW_TARBALLS += dist/$(MINGW_PKG_NAME)-$(1).tar.gz -endif -endef - -$(foreach host,$(CFG_HOST),\ - $(eval $(call BUILD_MINGW_TARBALL,$(host)))) -endif - -ifeq ($(CFG_DISABLE_DOCS),) -MAYBE_DOC_TARBALLS=$(foreach host,$(CFG_HOST),dist/$(DOC_PKG_NAME)-$(host).tar.gz) -endif - -dist-tar-bins: \ - $(foreach host,$(CFG_HOST),dist/$(PKG_NAME)-$(host).tar.gz) \ - $(foreach target,$(CFG_TARGET),dist/$(STD_PKG_NAME)-$(target).tar.gz) \ - $(MAYBE_DOC_TARBALLS) $(MAYBE_MINGW_TARBALLS) - -# Just try to run the compiler for the build host -distcheck-tar-bins: dist-tar-bins - @$(call E, checking binary tarball) - $(Q)rm -Rf tmp/distcheck/$(PKG_NAME)-$(CFG_BUILD) - $(Q)rm -Rf tmp/distcheck/tarbininstall - $(Q)mkdir -p tmp/distcheck - $(Q)cd tmp/distcheck && tar -xzf ../../dist/$(PKG_NAME)-$(CFG_BUILD).tar.gz - $(Q)mkdir -p tmp/distcheck/tarbininstall - $(Q)sh tmp/distcheck/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix=tmp/distcheck/tarbininstall - $(Q)sh tmp/distcheck/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix=tmp/distcheck/tarbininstall --uninstall - $(Q)rm -Rf tmp/distcheck/$(PKG_NAME)-$(CFG_BUILD) - $(Q)rm -Rf tmp/distcheck/tarbininstall - -###################################################################### -# Docs -###################################################################### - -# Just copy the docs to a folder under dist with the appropriate name -# for uploading to S3 -dist-docs: docs - $(Q) rm -Rf dist/doc - $(Q) mkdir -p dist/doc/ - $(Q) cp -r doc dist/doc/$(CFG_PACKAGE_VERS) - -distcheck-docs: dist-docs - -###################################################################### -# Primary targets (dist, distcheck) -###################################################################### - -MAYBE_DIST_TAR_SRC=dist-tar-src dist/$(SRC_PKG_NAME).tar.gz -MAYBE_DISTCHECK_TAR_SRC=distcheck-tar-src dist/$(SRC_PKG_NAME).tar.gz - -# FIXME #13224: On OS X don't produce tarballs simply because --exclude-vcs don't work. -# This is a huge hack because I just don't have time to figure out another solution. -ifeq ($(CFG_OSTYPE), apple-darwin) -MAYBE_DIST_TAR_SRC= -MAYBE_DISTCHECK_TAR_SRC= -endif - -# Don't bother with source tarballs on windows just because we historically haven't. -ifeq ($(CFG_OSTYPE), pc-windows-gnu) -MAYBE_DIST_TAR_SRC= -MAYBE_DISTCHECK_TAR_SRC= -endif - -ifneq ($(CFG_DISABLE_DOCS),) -MAYBE_DIST_DOCS= -MAYBE_DISTCHECK_DOCS= -else -MAYBE_DIST_DOCS=dist-docs -MAYBE_DISTCHECK_DOCS=distcheck-docs -endif - -dist: $(MAYBE_DIST_TAR_SRC) dist-tar-bins $(MAYBE_DIST_DOCS) - -distcheck: $(MAYBE_DISTCHECK_TAR_SRC) distcheck-tar-bins $(MAYBE_DISTCHECK_DOCS) - $(Q)rm -Rf tmp/distcheck - @echo - @echo ----------------------------------------------- - @echo "Rust ready for distribution (see ./dist)" - @echo ----------------------------------------------- - -.PHONY: dist distcheck diff --git a/mk/docs.mk b/mk/docs.mk deleted file mode 100644 index 6c0be654e1f..00000000000 --- a/mk/docs.mk +++ /dev/null @@ -1,222 +0,0 @@ -# Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -###################################################################### -# The various pieces of standalone documentation. -# -# The DOCS variable is their names (with no file extension). -# -# RUSTDOC_FLAGS_xyz variables are extra arguments to pass to the -# rustdoc invocation for xyz. -# -# RUSTDOC_DEPS_xyz are extra dependencies for the rustdoc invocation -# on xyz. -# -# L10N_LANGS are the languages for which the docs have been -# translated. -###################################################################### -DOCS := index \ - complement-lang-faq complement-design-faq complement-project-faq \ - rustdoc reference grammar - -# Legacy guides, preserved for a while to reduce the number of 404s -DOCS += guide-crates guide-error-handling guide-ffi guide-macros guide \ - guide-ownership guide-plugins guide-pointers guide-strings guide-tasks \ - guide-testing tutorial intro - - -RUSTDOC_DEPS_reference := doc/full-toc.inc -RUSTDOC_FLAGS_reference := --html-in-header=doc/full-toc.inc - -L10N_LANGS := ja - -# Generally no need to edit below here. - -# The options are passed to the documentation generators. -RUSTDOC_HTML_OPTS_NO_CSS = --html-before-content=doc/version_info.html \ - --html-in-header=doc/favicon.inc \ - --html-after-content=doc/footer.inc \ - --markdown-playground-url='https://play.rust-lang.org/' - -RUSTDOC_HTML_OPTS = $(RUSTDOC_HTML_OPTS_NO_CSS) --markdown-css rust.css - -# The rustdoc executable... -RUSTDOC_EXE = $(HBIN2_H_$(CFG_BUILD))/rustdoc$(X_$(CFG_BUILD)) -# ...with rpath included in case --disable-rpath was provided to -# ./configure -RUSTDOC = $(RPATH_VAR2_T_$(CFG_BUILD)_H_$(CFG_BUILD)) $(RUSTDOC_EXE) - -# The rustbook executable... -RUSTBOOK_EXE = $(HBIN2_H_$(CFG_BUILD))/rustbook$(X_$(CFG_BUILD)) -# ...with rpath included in case --disable-rpath was provided to -# ./configure -RUSTBOOK = $(RPATH_VAR2_T_$(CFG_BUILD)_H_$(CFG_BUILD)) $(RUSTBOOK_EXE) - -# The error_index_generator executable... -ERR_IDX_GEN_EXE = $(HBIN2_H_$(CFG_BUILD))/error_index_generator$(X_$(CFG_BUILD)) -ERR_IDX_GEN = $(RPATH_VAR2_T_$(CFG_BUILD)_H_$(CFG_BUILD)) $(ERR_IDX_GEN_EXE) -ERR_IDX_GEN_MD = $(RPATH_VAR2_T_$(CFG_BUILD)_H_$(CFG_BUILD)) $(ERR_IDX_GEN_EXE) markdown - -D := $(S)src/doc - -DOC_TARGETS := book nomicon error-index -COMPILER_DOC_TARGETS := -DOC_L10N_TARGETS := - -# If NO_REBUILD is set then break the dependencies on rustdoc so we -# build the documentation without having to rebuild rustdoc. -ifeq ($(NO_REBUILD),) -HTML_DEPS := $(RUSTDOC_EXE) -else -HTML_DEPS := -endif - -###################################################################### -# Rust version -###################################################################### - -HTML_DEPS += doc/version_info.html -doc/version_info.html: $(D)/version_info.html.template $(MKFILE_DEPS) \ - $(wildcard $(D)/*.*) | doc/ - @$(call E, version-info: $@) - $(Q)sed -e "s/VERSION/$(CFG_RELEASE)/; \ - s/SHORT_HASH/$(CFG_SHORT_VER_HASH)/; \ - s/STAMP/$(CFG_VER_HASH)/;" $< >$@ - -GENERATED += doc/version_info.html - -###################################################################### -# Docs from rustdoc -###################################################################### - -doc/: - @mkdir -p $@ - -HTML_DEPS += doc/rust.css -doc/rust.css: $(D)/rust.css | doc/ - @$(call E, cp: $@) - $(Q)cp -PRp $< $@ 2> /dev/null - -HTML_DEPS += doc/favicon.inc -doc/favicon.inc: $(D)/favicon.inc | doc/ - @$(call E, cp: $@) - $(Q)cp -PRp $< $@ 2> /dev/null - -doc/full-toc.inc: $(D)/full-toc.inc | doc/ - @$(call E, cp: $@) - $(Q)cp -PRp $< $@ 2> /dev/null - -HTML_DEPS += doc/footer.inc -doc/footer.inc: $(D)/footer.inc | doc/ - @$(call E, cp: $@) - $(Q)cp -PRp $< $@ 2> /dev/null - -# The (english) documentation for each doc item. -DOC_TARGETS += doc/not_found.html -doc/not_found.html: $(D)/not_found.md $(HTML_DEPS) | doc/ - @$(call E, rustdoc: $@) - $(Q)$(RUSTDOC) $(RUSTDOC_HTML_OPTS_NO_CSS) \ - --markdown-no-toc \ - --markdown-css https://doc.rust-lang.org/rust.css $< - -define DEF_DOC - -# HTML (rustdoc) -DOC_TARGETS += doc/$(1).html -doc/$(1).html: $$(D)/$(1).md $$(HTML_DEPS) $$(RUSTDOC_DEPS_$(1)) | doc/ - @$$(call E, rustdoc: $$@) - $$(Q)$$(RUSTDOC) $$(RUSTDOC_HTML_OPTS) $$(RUSTDOC_FLAGS_$(1)) $$< - -endef - -$(foreach docname,$(DOCS),$(eval $(call DEF_DOC,$(docname)))) - - -###################################################################### -# Rustdoc (libstd/extra) -###################################################################### - - -# The library documenting macro -# -# $(1) - The crate name (std/extra) -# -# Passes --cfg stage2 to rustdoc because it uses the stage2 librustc. -define DEF_LIB_DOC - -# If NO_REBUILD is set then break the dependencies on rustdoc so we -# build crate documentation without having to rebuild rustdoc. -ifeq ($(NO_REBUILD),) -LIB_DOC_DEP_$(1) = \ - $$(CRATEFILE_$(1)) \ - $$(RSINPUTS_$(1)) \ - $$(RUSTDOC_EXE) \ - $$(foreach dep,$$(RUST_DEPS_$(1)_T_$(CFG_BUILD)), \ - $$(TLIB2_T_$(CFG_BUILD)_H_$(CFG_BUILD))/stamp.$$(dep)) \ - $$(foreach dep,$$(filter $$(DOC_CRATES), $$(RUST_DEPS_$(1)_T_$(CFG_BUILD))), \ - doc/$$(dep)/) -else -LIB_DOC_DEP_$(1) = $$(CRATEFILE_$(1)) $$(RSINPUTS_$(1)) -endif - -doc/$(1)/: - $$(Q)mkdir -p $$@ - -doc/$(1)/index.html: CFG_COMPILER_HOST_TRIPLE = $(CFG_TARGET) -doc/$(1)/index.html: $$(LIB_DOC_DEP_$(1)) doc/$(1)/ - @$$(call E, rustdoc: $$@) - $$(Q)CFG_LLVM_LINKAGE_FILE=$$(LLVM_LINKAGE_PATH_$(CFG_BUILD)) \ - $$(RUSTDOC) --cfg dox --cfg stage2 $$(RUSTFLAGS_$(1)) $$< -endef - -$(foreach crate,$(CRATES),$(eval $(call DEF_LIB_DOC,$(crate)))) - -COMPILER_DOC_TARGETS := $(CRATES:%=doc/%/index.html) -ifdef CFG_ENABLE_COMPILER_DOCS - DOC_TARGETS += $(COMPILER_DOC_TARGETS) -else - DOC_TARGETS += $(DOC_CRATES:%=doc/%/index.html) -endif - -ifdef CFG_DISABLE_DOCS - $(info cfg: disabling doc build (CFG_DISABLE_DOCS)) - DOC_TARGETS := - COMPILER_DOC_TARGETS := -endif - -docs: $(DOC_TARGETS) -doc: docs -compiler-docs: $(COMPILER_DOC_TARGETS) - -book: doc/book/index.html - -doc/book/index.html: $(RUSTBOOK_EXE) $(wildcard $(S)/src/doc/book/*.md) | doc/ - @$(call E, rustbook: $@) - $(Q)rm -rf doc/book - $(Q)$(RUSTBOOK) build $(S)src/doc/book doc/book - -nomicon: doc/nomicon/index.html - -doc/nomicon/index.html: $(RUSTBOOK_EXE) $(wildcard $(S)/src/doc/nomicon/*.md) | doc/ - @$(call E, rustbook: $@) - $(Q)rm -rf doc/nomicon - $(Q)$(RUSTBOOK) build $(S)src/doc/nomicon doc/nomicon - -error-index: doc/error-index.html - -# Metadata used to generate the index is created as a side effect of -# the build so this depends on every crate being up to date. -doc/error-index.html: $(ERR_IDX_GEN_EXE) $(CSREQ$(2)_T_$(CFG_BUILD)_H_$(CFG_BUILD)) | doc/ - $(Q)$(call E, error_index_generator: $@) - $(Q)$(ERR_IDX_GEN) - -doc/error-index.md: $(ERR_IDX_GEN_EXE) $(CSREQ$(2)_T_$(CFG_BUILD)_H_$(CFG_BUILD)) | doc/ - $(Q)$(call E, error_index_generator: $@) - $(Q)$(ERR_IDX_GEN_MD) diff --git a/mk/grammar.mk b/mk/grammar.mk deleted file mode 100644 index 1bd042adb21..00000000000 --- a/mk/grammar.mk +++ /dev/null @@ -1,117 +0,0 @@ -# Copyright 2014 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -BG = $(CFG_BUILD_DIR)/grammar/ -SG = $(S)src/grammar/ -B = $(CFG_BUILD_DIR)/$(CFG_BUILD)/stage2/ -L = $(B)lib/rustlib/$(CFG_BUILD)/lib -LD = $(CFG_BUILD)/stage2/lib/rustlib/$(CFG_BUILD)/lib/ -RUSTC = $(STAGE2_T_$(CFG_BUILD)_H_$(CFG_BUILD)) -ifeq ($(CFG_OSTYPE),apple-darwin) - FLEX_LDFLAGS=-ll -else - FLEX_LDFLAGS=-lfl -endif - -# Run the reference lexer against libsyntax and compare the tokens and spans. -# If "// ignore-lexer-test" is present in the file, it will be ignored. -# -# $(1) is the file to test. -define LEXER_TEST -grep "// ignore-lexer-test" $(1) ; \ - if [ $$? -eq 1 ]; then \ - CLASSPATH=$(B)grammar $(CFG_GRUN) RustLexer tokens -tokens < $(1) \ - | $(B)grammar/verify $(1) ; \ - fi -endef - -$(BG): - $(Q)mkdir -p $(BG) - -$(BG)RustLexer.class: $(BG) $(SG)RustLexer.g4 - $(Q)$(CFG_ANTLR4) -o $(BG) $(SG)RustLexer.g4 - $(Q)$(CFG_JAVAC) -d $(BG) -classpath $(CFG_ANTLR4_JAR) $(BG)RustLexer.java - -check-build-lexer-verifier: $(BG)verify - -ifeq ($(NO_REBUILD),) -VERIFY_DEPS := rustc-stage2-H-$(CFG_BUILD) $(LD)stamp.rustc -else -VERIFY_DEPS := -endif - -$(BG)verify: $(BG) $(SG)verify.rs $(VERIFY_DEPS) - $(Q)$(RUSTC) --out-dir $(BG) -L $(L) $(SG)verify.rs - -ifdef CFG_JAVAC -ifdef CFG_ANTLR4 -ifdef CFG_GRUN -check-lexer: $(BG) $(BG)RustLexer.class check-build-lexer-verifier - $(info Verifying libsyntax against the reference lexer ...) - $(Q)$(SG)check.sh $(S) "$(BG)" \ - "$(CFG_GRUN)" "$(BG)verify" "$(BG)RustLexer.tokens" -else -$(info cfg: lexer tooling not available, skipping lexer test...) -check-lexer: - -endif -else -$(info cfg: lexer tooling not available, skipping lexer test...) -check-lexer: - -endif -else -$(info cfg: lexer tooling not available, skipping lexer test...) -check-lexer: - -endif - -$(BG)lex.yy.c: $(SG)lexer.l $(BG) - @$(call E, flex: $@) - $(Q)$(CFG_FLEX) -o $@ $< - -$(BG)lexer-lalr.o: $(BG)lex.yy.c $(BG)parser-lalr.tab.h - @$(call E, cc: $@) - $(Q)$(CFG_CC) -include $(BG)parser-lalr.tab.h -c -o $@ $< - -$(BG)parser-lalr.tab.c $(BG)parser-lalr.tab.h: $(SG)parser-lalr.y - @$(call E, bison: $@) - $(Q)$(CFG_BISON) $< --output=$(BG)parser-lalr.tab.c --defines=$(BG)parser-lalr.tab.h \ - --name-prefix=rs --warnings=error=all - -$(BG)parser-lalr.o: $(BG)parser-lalr.tab.c - @$(call E, cc: $@) - $(Q)$(CFG_CC) -c -o $@ $< - -$(BG)parser-lalr-main.o: $(SG)parser-lalr-main.c - @$(call E, cc: $@) - $(Q)$(CFG_CC) -std=c99 -c -o $@ $< - -$(BG)parser-lalr: $(BG)parser-lalr.o $(BG)parser-lalr-main.o $(BG)lexer-lalr.o - @$(call E, cc: $@) - $(Q)$(CFG_CC) -o $@ $^ $(FLEX_LDFLAGS) - - -ifdef CFG_FLEX -ifdef CFG_BISON -check-grammar: $(BG) $(BG)parser-lalr - $(info Verifying grammar ...) - $(SG)testparser.py -p $(BG)parser-lalr -s $(S)src - -else -$(info cfg: bison not available, skipping parser test...) -check-grammar: - -endif -else -$(info cfg: flex not available, skipping parser test...) -check-grammar: - -endif diff --git a/mk/host.mk b/mk/host.mk deleted file mode 100644 index d17479bd894..00000000000 --- a/mk/host.mk +++ /dev/null @@ -1,84 +0,0 @@ -# Copyright 2012 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -# Generic rule for copying any target crate to a host crate. This rule will also -# promote any dependent rust crates up to their host locations as well -# -# $(1) - the stage to copy from -# $(2) - the stage to copy to -# $(3) - the host triple -# $(4) - the target triple (same as $(3)) -# $(5) - the name of the crate being processed -define CP_HOST_STAGE_N_CRATE - -ifeq ($$(ONLY_RLIB_$(5)),) -$$(HLIB$(2)_H_$(4))/stamp.$(5): \ - $$(TLIB$(1)_T_$(3)_H_$(4))/stamp.$(5) \ - $$(RUST_DEPS_$(5)_T_$(3):%=$$(HLIB$(2)_H_$(4))/stamp.%) \ - | $$(HLIB$(2)_H_$(4))/ - @$$(call E, cp: $$(@D)/lib$(5)) - $$(call REMOVE_ALL_OLD_GLOB_MATCHES, \ - $$(dir $$@)$$(call CFG_LIB_GLOB_$(3),$(5))) - $$(Q)cp $$< $$@ - $$(Q)cp -R $$(TLIB$(1)_T_$(3)_H_$(4))/$$(call CFG_LIB_GLOB_$(3),$(5)) \ - $$(HLIB$(2)_H_$(4)) - $$(call LIST_ALL_OLD_GLOB_MATCHES, \ - $$(dir $$@)$$(call CFG_LIB_GLOB_$(3),$(5))) -else -$$(HLIB$(2)_H_$(4))/stamp.$(5): - $$(Q)touch $$@ -endif - -endef - -# Same as the above macro, but for tools instead of crates -define CP_HOST_STAGE_N_TOOL - -$$(HBIN$(2)_H_$(4))/$(5)$$(X_$(3)): \ - $$(TBIN$(1)_T_$(3)_H_$(4))/$(5)$$(X_$(3)) \ - $$(TOOL_DEPS_$(5):%=$$(HLIB$(2)_H_$(4))/stamp.%) \ - | $$(HBIN$(2)_H_$(4))/ - @$$(call E, cp: $$@) - $$(Q)cp $$< $$@ - -endef - - -# Miscellaneous rules for just making a few directories. -# -# $(1) - the stage to copy from -# $(2) - the stage to copy to -# $(3) - the target triple -# $(4) - the host triple (same as $(3)) -define CP_HOST_STAGE_N - -ifneq ($(CFG_LIBDIR_RELATIVE),bin) -$$(HLIB$(2)_H_$(4))/: - @mkdir -p $$@ -endif - -endef - -$(foreach t,$(CFG_HOST), \ - $(eval $(call CP_HOST_STAGE_N,0,1,$(t),$(t))) \ - $(eval $(call CP_HOST_STAGE_N,1,2,$(t),$(t))) \ - $(eval $(call CP_HOST_STAGE_N,2,3,$(t),$(t)))) - -$(foreach crate,$(CRATES), \ - $(foreach t,$(CFG_HOST), \ - $(eval $(call CP_HOST_STAGE_N_CRATE,0,1,$(t),$(t),$(crate))) \ - $(eval $(call CP_HOST_STAGE_N_CRATE,1,2,$(t),$(t),$(crate))) \ - $(eval $(call CP_HOST_STAGE_N_CRATE,2,3,$(t),$(t),$(crate))))) - -$(foreach tool,$(TOOLS), \ - $(foreach t,$(CFG_HOST), \ - $(eval $(call CP_HOST_STAGE_N_TOOL,0,1,$(t),$(t),$(tool))) \ - $(eval $(call CP_HOST_STAGE_N_TOOL,1,2,$(t),$(t),$(tool))) \ - $(eval $(call CP_HOST_STAGE_N_TOOL,2,3,$(t),$(t),$(tool))))) diff --git a/mk/install.mk b/mk/install.mk deleted file mode 100644 index be212869f01..00000000000 --- a/mk/install.mk +++ /dev/null @@ -1,138 +0,0 @@ -# Copyright 2012 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -RUN_INSTALLER = cd tmp/empty_dir && \ - sh ../../tmp/dist/$(1)/install.sh \ - --prefix="$(DESTDIR)$(CFG_PREFIX)" \ - --libdir="$(DESTDIR)$(CFG_LIBDIR)" \ - --mandir="$(DESTDIR)$(CFG_MANDIR)" \ - --docdir="$(DESTDIR)$(CFG_DOCDIR)" - -install: -ifeq (root user, $(USER) $(patsubst %,user,$(SUDO_USER))) -# Build the dist as the original user - $(Q)sudo -u "$$SUDO_USER" $(MAKE) prepare_install -else - $(Q)$(MAKE) prepare_install -endif -ifeq ($(CFG_DISABLE_DOCS),) - $(Q)$(call RUN_INSTALLER,$(DOC_PKG_NAME)-$(CFG_BUILD)) --disable-ldconfig -endif - $(Q)$(foreach target,$(CFG_TARGET),\ - ($(call RUN_INSTALLER,$(STD_PKG_NAME)-$(target)) --disable-ldconfig);) - $(Q)$(call RUN_INSTALLER,$(PKG_NAME)-$(CFG_BUILD)) -# Remove tmp files because it's a decent amount of disk space - $(Q)rm -R tmp/dist - -prepare_install: dist-tar-bins | tmp/empty_dir - -uninstall: -ifeq (root user, $(USER) $(patsubst %,user,$(SUDO_USER))) -# Build the dist as the original user - $(Q)sudo -u "$$SUDO_USER" $(MAKE) prepare_uninstall -else - $(Q)$(MAKE) prepare_uninstall -endif -ifeq ($(CFG_DISABLE_DOCS),) - $(Q)$(call RUN_INSTALLER,$(DOC_PKG_NAME)-$(CFG_BUILD)) --uninstall -endif - $(Q)$(call RUN_INSTALLER,$(PKG_NAME)-$(CFG_BUILD)) --uninstall - $(Q)$(foreach target,$(CFG_TARGET),\ - ($(call RUN_INSTALLER,$(STD_PKG_NAME)-$(target)) --uninstall);) -# Remove tmp files because it's a decent amount of disk space - $(Q)rm -R tmp/dist - -prepare_uninstall: dist-tar-bins | tmp/empty_dir - -.PHONY: install prepare_install uninstall prepare_uninstall - -tmp/empty_dir: - mkdir -p $@ - -###################################################################### -# Android remote installation -###################################################################### - -# Android runtime setup -# FIXME: This probably belongs somewhere else - -# target platform specific variables for android -define DEF_ADB_DEVICE_STATUS -CFG_ADB_DEVICE_STATUS=$(1) -endef - -$(foreach target,$(CFG_TARGET), \ - $(if $(findstring android, $(target)), \ - $(if $(findstring adb,$(CFG_ADB)), \ - $(if $(findstring device,$(shell $(CFG_ADB) devices 2>/dev/null | grep -E '^[_A-Za-z0-9-]+[[:blank:]]+device')), \ - $(info install: install-runtime-target for $(target) enabled \ - $(info install: android device attached) \ - $(eval $(call DEF_ADB_DEVICE_STATUS, true))), \ - $(info install: install-runtime-target for $(target) disabled \ - $(info install: android device not attached) \ - $(eval $(call DEF_ADB_DEVICE_STATUS, false))) \ - ), \ - $(info install: install-runtime-target for $(target) disabled \ - $(info install: adb not found) \ - $(eval $(call DEF_ADB_DEVICE_STATUS, false))) \ - ), \ - ) \ -) - -ifeq (install-runtime-target,$(firstword $(MAKECMDGOALS))) -$(eval $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)):;@:) -L_TOKEN := $(word 2,$(MAKECMDGOALS)) -ifeq ($(L_TOKEN),) -CFG_RUNTIME_PUSH_DIR=/system/lib -else -CFG_RUNTIME_PUSH_DIR=$(L_TOKEN) -endif - -ifeq ($(CFG_ADB_DEVICE_STATUS),true) -ifdef VERBOSE - ADB = adb $(1) - ADB_PUSH = adb push $(1) $(2) - ADB_SHELL = adb shell $(1) $(2) -else - ADB = $(Q)$(call E, adb $(1)) && adb $(1) 1>/dev/null - ADB_PUSH = $(Q)$(call E, adb push $(1)) && adb push $(1) $(2) 1>/dev/null - ADB_SHELL = $(Q)$(call E, adb shell $(1) $(2)) && adb shell $(1) $(2) 1>/dev/null -endif - -define INSTALL_RUNTIME_TARGET_N -install-runtime-target-$(1)-host-$(2): $$(TSREQ$$(ISTAGE)_T_$(1)_H_$(2)) $$(SREQ$$(ISTAGE)_T_$(1)_H_$(2)) - $$(Q)$$(call ADB_SHELL,mkdir,$(CFG_RUNTIME_PUSH_DIR)) - $$(Q)$$(foreach crate,$$(TARGET_CRATES_$(1)), \ - $$(call ADB_PUSH,$$(TL$(1)$(2))/$$(call CFG_LIB_GLOB_$(1),$$(crate)), \ - $$(CFG_RUNTIME_PUSH_DIR));) -endef - -define INSTALL_RUNTIME_TARGET_CLEANUP_N -install-runtime-target-$(1)-cleanup: - $$(Q)$$(call ADB,remount) - $$(Q)$$(foreach crate,$$(TARGET_CRATES_$(1)), \ - $$(call ADB_SHELL,rm,$$(CFG_RUNTIME_PUSH_DIR)/$$(call CFG_LIB_GLOB_$(1),$$(crate)));) -endef - -$(foreach target,$(CFG_TARGET), \ - $(if $(findstring $(CFG_ADB_DEVICE_STATUS),"true"), \ - $(eval $(call INSTALL_RUNTIME_TARGET_N,$(taget),$(CFG_BUILD))) \ - $(eval $(call INSTALL_RUNTIME_TARGET_CLEANUP_N,$(target))) \ - )) - -install-runtime-target: \ - install-runtime-target-arm-linux-androideabi-cleanup \ - install-runtime-target-arm-linux-androideabi-host-$(CFG_BUILD) -else -install-runtime-target: - @echo "No device to install runtime library" - @echo -endif -endif diff --git a/mk/llvm.mk b/mk/llvm.mk deleted file mode 100644 index 76367e6f3a6..00000000000 --- a/mk/llvm.mk +++ /dev/null @@ -1,124 +0,0 @@ -# Copyright 2012 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - - -ifdef CFG_ENABLE_FAST_MAKE -LLVM_DEPS := $(S)/.gitmodules -else - -# This is just a rough approximation of LLVM deps -LLVM_DEPS_SRC=$(call rwildcard,$(CFG_LLVM_SRC_DIR)lib,*cpp *hpp) -LLVM_DEPS_INC=$(call rwildcard,$(CFG_LLVM_SRC_DIR)include,*cpp *hpp) -LLVM_DEPS=$(LLVM_DEPS_SRC) $(LLVM_DEPS_INC) -endif - -ifdef CFG_DISABLE_OPTIMIZE_LLVM -LLVM_BUILD_CONFIG_MODE := Debug -else ifdef CFG_ENABLE_LLVM_RELEASE_DEBUGINFO -LLVM_BUILD_CONFIG_MODE := RelWithDebInfo -else -LLVM_BUILD_CONFIG_MODE := Release -endif - -define DEF_LLVM_RULES - -ifeq ($(1),$$(CFG_BUILD)) -LLVM_DEPS_TARGET_$(1) := $$(LLVM_DEPS) -else -LLVM_DEPS_TARGET_$(1) := $$(LLVM_DEPS) $$(LLVM_CONFIG_$$(CFG_BUILD)) -endif - -# If CFG_LLVM_ROOT is defined then we don't build LLVM ourselves -ifeq ($(CFG_LLVM_ROOT),) - -LLVM_STAMP_$(1) = $(S)src/rustllvm/llvm-auto-clean-trigger -LLVM_DONE_$(1) = $$(CFG_LLVM_BUILD_DIR_$(1))/llvm-finished-building - -$$(LLVM_CONFIG_$(1)): $$(LLVM_DONE_$(1)) - -ifneq ($$(CFG_NINJA),) -BUILD_LLVM_$(1) := $$(CFG_NINJA) -C $$(CFG_LLVM_BUILD_DIR_$(1)) -else ifeq ($$(findstring msvc,$(1)),msvc) -BUILD_LLVM_$(1) := $$(CFG_CMAKE) --build $$(CFG_LLVM_BUILD_DIR_$(1)) \ - --config $$(LLVM_BUILD_CONFIG_MODE) -else -BUILD_LLVM_$(1) := $$(MAKE) -C $$(CFG_LLVM_BUILD_DIR_$(1)) -endif - -$$(LLVM_DONE_$(1)): $$(LLVM_DEPS_TARGET_$(1)) $$(LLVM_STAMP_$(1)) - @$$(call E, cmake: llvm) - $$(Q)if ! cmp $$(LLVM_STAMP_$(1)) $$(LLVM_DONE_$(1)); then \ - $$(MAKE) clean-llvm$(1); \ - $$(BUILD_LLVM_$(1)); \ - fi - $$(Q)cp $$(LLVM_STAMP_$(1)) $$@ - -ifneq ($$(CFG_NINJA),) -clean-llvm$(1): - @$$(call E, clean: llvm) - $$(Q)$$(CFG_NINJA) -C $$(CFG_LLVM_BUILD_DIR_$(1)) -t clean -else ifeq ($$(findstring msvc,$(1)),msvc) -clean-llvm$(1): - @$$(call E, clean: llvm) - $$(Q)$$(CFG_CMAKE) --build $$(CFG_LLVM_BUILD_DIR_$(1)) \ - --config $$(LLVM_BUILD_CONFIG_MODE) \ - --target clean -else -clean-llvm$(1): - @$$(call E, clean: llvm) - $$(Q)$$(MAKE) -C $$(CFG_LLVM_BUILD_DIR_$(1)) clean -endif - -else -clean-llvm$(1): -endif - -$$(LLVM_AR_$(1)): $$(LLVM_CONFIG_$(1)) - -ifeq ($$(CFG_ENABLE_LLVM_STATIC_STDCPP),1) -LLVM_STDCPP_RUSTFLAGS_$(1) = -L "$$(dir $$(shell $$(CC_$(1)) $$(CFG_GCCISH_CFLAGS_$(1)) \ - -print-file-name=lib$(CFG_STDCPP_NAME).a))" -else -LLVM_STDCPP_RUSTFLAGS_$(1) = -endif - - -# LLVM linkage: -# Note: Filter with llvm-config so that optional targets which aren't present -# don't cause errors (ie PNaCl's target is only present within PNaCl's LLVM -# fork). -LLVM_LINKAGE_PATH_$(1):=$$(abspath $$(RT_OUTPUT_DIR_$(1))/llvmdeps.rs) -$$(LLVM_LINKAGE_PATH_$(1)): $(S)src/etc/mklldeps.py $$(LLVM_CONFIG_$(1)) - $(Q)$(CFG_PYTHON) "$$<" "$$@" "$$(filter $$(shell \ - $$(LLVM_CONFIG_$(1)) --components), \ - $(LLVM_OPTIONAL_COMPONENTS)) $(LLVM_REQUIRED_COMPONENTS)" \ - "$$(CFG_ENABLE_LLVM_STATIC_STDCPP)" $$(LLVM_CONFIG_$(1)) \ - "$(CFG_STDCPP_NAME)" "$$(CFG_USING_LIBCPP)" -endef - -$(foreach host,$(CFG_HOST), \ - $(eval $(call DEF_LLVM_RULES,$(host)))) - -$(foreach host,$(CFG_HOST), \ - $(eval LLVM_CONFIGS := $(LLVM_CONFIGS) $(LLVM_CONFIG_$(host)))) - -# This can't be done in target.mk because it's included before this file. -define LLVM_LINKAGE_DEPS -$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.rustc_llvm: $$(LLVM_LINKAGE_PATH_$(2)) -RUSTFLAGS$(1)_rustc_llvm_T_$(2) += $$(shell echo $$(LLVM_ALL_COMPONENTS_$(2)) | tr '-' '_' |\ - sed -e 's/^ //;s/\([^ ]*\)/\-\-cfg "llvm_component=\\"\1\\""/g') -endef - -$(foreach source,$(CFG_HOST), \ - $(foreach target,$(CFG_TARGET), \ - $(eval $(call LLVM_LINKAGE_DEPS,0,$(target),$(source))) \ - $(eval $(call LLVM_LINKAGE_DEPS,1,$(target),$(source))) \ - $(eval $(call LLVM_LINKAGE_DEPS,2,$(target),$(source))) \ - $(eval $(call LLVM_LINKAGE_DEPS,3,$(target),$(source))))) diff --git a/mk/main.mk b/mk/main.mk deleted file mode 100644 index 6b409eebc74..00000000000 --- a/mk/main.mk +++ /dev/null @@ -1,641 +0,0 @@ -# Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -###################################################################### -# Version numbers and strings -###################################################################### - -# The version number -CFG_RELEASE_NUM=1.17.0 - -# An optional number to put after the label, e.g. '.2' -> '-beta.2' -# NB Make sure it starts with a dot to conform to semver pre-release -# versions (section 9) -CFG_PRERELEASE_VERSION=.1 - -ifeq ($(CFG_RELEASE_CHANNEL),stable) -# This is the normal semver version string, e.g. "0.12.0", "0.12.0-nightly" -CFG_RELEASE=$(CFG_RELEASE_NUM) -# This is the string used in dist artifact file names, e.g. "0.12.0", "nightly" -CFG_PACKAGE_VERS=$(CFG_RELEASE_NUM) -CFG_DISABLE_UNSTABLE_FEATURES=1 -endif -ifeq ($(CFG_RELEASE_CHANNEL),beta) -CFG_RELEASE=$(CFG_RELEASE_NUM)-beta$(CFG_PRERELEASE_VERSION) -# When building beta distributables just reuse the same "beta" name -# so when we upload we'll always override the previous beta. This -# doesn't actually impact the version reported by rustc - it's just -# for file naming. -CFG_PACKAGE_VERS=beta -CFG_DISABLE_UNSTABLE_FEATURES=1 -endif -ifeq ($(CFG_RELEASE_CHANNEL),nightly) -CFG_RELEASE=$(CFG_RELEASE_NUM)-nightly -# When building nightly distributables just reuse the same "nightly" name -# so when we upload we'll always override the previous nighly. This -# doesn't actually impact the version reported by rustc - it's just -# for file naming. -CFG_PACKAGE_VERS=nightly -endif -ifeq ($(CFG_RELEASE_CHANNEL),dev) -CFG_RELEASE=$(CFG_RELEASE_NUM)-dev -CFG_PACKAGE_VERS=$(CFG_RELEASE_NUM)-dev -endif - -# Append a version-dependent hash to each library, so we can install different -# versions in the same place -CFG_FILENAME_EXTRA=$(shell printf '%s' $(CFG_RELEASE)$(CFG_EXTRA_FILENAME) | $(CFG_HASH_COMMAND)) - -# If local-rust is the same major.minor as the current version, then force a local-rebuild -ifdef CFG_ENABLE_LOCAL_RUST -SEMVER_PREFIX=$(shell echo $(CFG_RELEASE_NUM) | grep -E -o '^[[:digit:]]+\.[[:digit:]]+') -LOCAL_RELEASE=$(shell $(S)src/etc/local_stage0.sh --print-rustc-release $(CFG_LOCAL_RUST_ROOT)) -ifneq (,$(filter $(SEMVER_PREFIX).%,$(LOCAL_RELEASE))) - CFG_INFO := $(info cfg: auto-detected local-rebuild using $(LOCAL_RELEASE)) - CFG_ENABLE_LOCAL_REBUILD = 1 -endif -endif - -# The name of the package to use for creating tarballs, installers etc. -CFG_PACKAGE_NAME=rustc-$(CFG_PACKAGE_VERS) - -# The version string plus commit information - this is what rustc reports -CFG_VERSION = $(CFG_RELEASE) -CFG_GIT_DIR := $(CFG_SRC_DIR).git -# since $(CFG_GIT) may contain spaces (especially on Windows), -# we need to escape them. (" " to r"\ ") -# Note that $(subst ...) ignores space after `subst`, -# so we use a hack: define $(SPACE) which contains space character. -SPACE := -SPACE += -ifneq ($(CFG_GIT),) -ifneq ($(wildcard $(subst $(SPACE),\$(SPACE),$(CFG_GIT_DIR))),) - CFG_VER_DATE = $(shell git --git-dir='$(CFG_GIT_DIR)' log -1 --date=short --pretty=format:'%cd') - CFG_VER_HASH = $(shell git --git-dir='$(CFG_GIT_DIR)' rev-parse HEAD) - CFG_SHORT_VER_HASH = $(shell git --git-dir='$(CFG_GIT_DIR)' rev-parse --short=9 HEAD) - CFG_VERSION += ($(CFG_SHORT_VER_HASH) $(CFG_VER_DATE)) -endif -endif - -# Windows exe's need numeric versions - don't use anything but -# numbers and dots here -CFG_VERSION_WIN = $(CFG_RELEASE_NUM) - -CFG_INFO := $(info cfg: version $(CFG_VERSION)) - -###################################################################### -# More configuration -###################################################################### - -MKFILE_DEPS := config.stamp $(call rwildcard,$(CFG_SRC_DIR)mk/,*) -MKFILES_FOR_TARBALL:=$(MKFILE_DEPS) -ifneq ($(NO_MKFILE_DEPS),) -MKFILE_DEPS := -endif -NON_BUILD_HOST = $(filter-out $(CFG_BUILD),$(CFG_HOST)) -NON_BUILD_TARGET = $(filter-out $(CFG_BUILD),$(CFG_TARGET)) - -ifneq ($(MAKE_RESTARTS),) -CFG_INFO := $(info cfg: make restarts: $(MAKE_RESTARTS)) -endif - -CFG_INFO := $(info cfg: build triple $(CFG_BUILD)) -CFG_INFO := $(info cfg: host triples $(CFG_HOST)) -CFG_INFO := $(info cfg: target triples $(CFG_TARGET)) - -ifneq ($(wildcard $(NON_BUILD_HOST)),) -CFG_INFO := $(info cfg: non-build host triples $(NON_BUILD_HOST)) -endif -ifneq ($(wildcard $(NON_BUILD_TARGET)),) -CFG_INFO := $(info cfg: non-build target triples $(NON_BUILD_TARGET)) -endif - -CFG_RUSTC_FLAGS := $(RUSTFLAGS) -CFG_GCCISH_CFLAGS := -CFG_GCCISH_LINK_FLAGS := - -CFG_JEMALLOC_FLAGS := - -ifdef CFG_DISABLE_OPTIMIZE - $(info cfg: disabling rustc optimization (CFG_DISABLE_OPTIMIZE)) - CFG_RUSTC_FLAGS += - CFG_JEMALLOC_FLAGS += --enable-debug -else - # The rtopt cfg turns off runtime sanity checks - CFG_RUSTC_FLAGS += -O --cfg rtopt -endif - -CFG_JEMALLOC_FLAGS += $(JEMALLOC_FLAGS) - -ifdef CFG_ENABLE_DEBUG_ASSERTIONS - $(info cfg: enabling debug assertions (CFG_ENABLE_DEBUG_ASSERTIONS)) - CFG_RUSTC_FLAGS += -C debug-assertions=on -endif - -ifdef CFG_ENABLE_DEBUGINFO - $(info cfg: enabling debuginfo (CFG_ENABLE_DEBUGINFO)) - CFG_RUSTC_FLAGS += -g -else ifdef CFG_ENABLE_DEBUGINFO_LINES - $(info cfg: enabling line number debuginfo (CFG_ENABLE_DEBUGINFO_LINES)) - CFG_RUSTC_FLAGS += -Cdebuginfo=1 -endif - -ifdef SAVE_TEMPS - CFG_RUSTC_FLAGS += -C save-temps -endif -ifdef ASM_COMMENTS - CFG_RUSTC_FLAGS += -Z asm-comments -endif -ifdef TIME_PASSES - CFG_RUSTC_FLAGS += -Z time-passes -endif -ifdef TIME_LLVM_PASSES - CFG_RUSTC_FLAGS += -Z time-llvm-passes -endif -ifdef TRACE - CFG_RUSTC_FLAGS += -Z trace -endif -ifndef CFG_DISABLE_RPATH -CFG_RUSTC_FLAGS += -C rpath -endif - -# The executables crated during this compilation process have no need to include -# static copies of libstd and libextra. We also generate dynamic versions of all -# libraries, so in the interest of space, prefer dynamic linking throughout the -# compilation process. -# -# Note though that these flags are omitted for the *bins* in stage2+. This means -# that the snapshot will be generated with a statically linked rustc so we only -# have to worry about the distribution of one file (with its native dynamic -# dependencies) -RUSTFLAGS_STAGE0 += -C prefer-dynamic -RUSTFLAGS_STAGE1 += -C prefer-dynamic -RUST_LIB_FLAGS_ST2 += -C prefer-dynamic -RUST_LIB_FLAGS_ST3 += -C prefer-dynamic - -# Landing pads require a lot of codegen. We can get through bootstrapping faster -# by not emitting them. - -ifdef CFG_DISABLE_STAGE0_LANDING_PADS - RUSTFLAGS_STAGE0 += -Z no-landing-pads -endif - -# platform-specific auto-configuration -include $(CFG_SRC_DIR)mk/platform.mk - -# Run the stage1/2 compilers under valgrind -ifdef VALGRIND_COMPILE - CFG_VALGRIND_COMPILE := $(CFG_VALGRIND) -else - CFG_VALGRIND_COMPILE := -endif - - -ifndef CFG_DISABLE_VALGRIND_RPASS - $(info cfg: enabling valgrind run-pass tests (CFG_ENABLE_VALGRIND_RPASS)) - $(info cfg: valgrind-rpass command set to $(CFG_VALGRIND)) - CFG_VALGRIND_RPASS :=$(CFG_VALGRIND) -else - $(info cfg: disabling valgrind run-pass tests) - CFG_VALGRIND_RPASS := -endif - - -ifdef CFG_ENABLE_VALGRIND - $(info cfg: enabling valgrind (CFG_ENABLE_VALGRIND)) - CFG_JEMALLOC_FLAGS += --enable-valgrind -else - CFG_VALGRIND := -endif - -###################################################################### -# Target-and-rule "utility variables" -###################################################################### - -define DEF_FOR_TARGET -X_$(1) := $(CFG_EXE_SUFFIX_$(1)) -ifndef CFG_LLVM_TARGET_$(1) -CFG_LLVM_TARGET_$(1) := $(1) -endif -endef -$(foreach target,$(CFG_TARGET), \ - $(eval $(call DEF_FOR_TARGET,$(target)))) - -# "Source" files we generate in builddir along the way. -GENERATED := - -# Delete the built-in rules. -.SUFFIXES: -%:: %,v -%:: RCS/%,v -%:: RCS/% -%:: s.% -%:: SCCS/s.% - - -###################################################################### -# Cleaning out old crates -###################################################################### - -# $(1) is the path for directory to match against -# $(2) is the glob to use in the match -# -# Note that a common bug is to accidentally construct the glob denoted -# by $(2) with a space character prefix, which invalidates the -# construction $(1)$(2). -define CHECK_FOR_OLD_GLOB_MATCHES - $(Q)MATCHES="$(wildcard $(1))"; if [ -n "$$MATCHES" ] ; then echo "warning: there are previous" \'$(notdir $(2))\' "libraries:" $$MATCHES; fi -endef - -# Same interface as above, but deletes rather than just listing the files. -ifdef VERBOSE -define REMOVE_ALL_OLD_GLOB_MATCHES - $(Q)MATCHES="$(wildcard $(1))"; if [ -n "$$MATCHES" ] ; then echo "warning: removing previous" \'$(notdir $(1))\' "libraries:" $$MATCHES; rm $$MATCHES ; fi -endef -else -define REMOVE_ALL_OLD_GLOB_MATCHES - $(Q)MATCHES="$(wildcard $(1))"; if [ -n "$$MATCHES" ] ; then rm $$MATCHES ; fi -endef -endif - -# We use a different strategy for LIST_ALL_OLD_GLOB_MATCHES_EXCEPT -# than in the macros above because it needs the result of running the -# `ls` command after other rules in the command list have run; the -# macro-expander for $(wildcard ...) would deliver its results too -# soon. (This is in contrast to the macros above, which are meant to -# be run at the outset of a command list in a rule.) -ifdef VERBOSE -define LIST_ALL_OLD_GLOB_MATCHES - @echo "info: now are following matches for" '$(notdir $(1))' "libraries:" - @( ls $(1) 2>/dev/null || true ) -endef -else -define LIST_ALL_OLD_GLOB_MATCHES -endef -endif - -###################################################################### -# LLVM macros -###################################################################### - -LLVM_OPTIONAL_COMPONENTS=x86 arm aarch64 mips powerpc pnacl systemz jsbackend msp430 sparc -LLVM_REQUIRED_COMPONENTS=ipo bitreader bitwriter linker asmparser mcjit \ - interpreter instrumentation - -ifneq ($(CFG_LLVM_ROOT),) -# Ensure we only try to link targets that the installed LLVM actually has: -LLVM_COMPONENTS := $(filter $(shell $(CFG_LLVM_ROOT)/bin/llvm-config$(X_$(CFG_BUILD)) --components),\ - $(LLVM_OPTIONAL_COMPONENTS)) $(LLVM_REQUIRED_COMPONENTS) -else -LLVM_COMPONENTS := $(LLVM_OPTIONAL_COMPONENTS) $(LLVM_REQUIRED_COMPONENTS) -endif - -# Only build these LLVM tools -LLVM_TOOLS=bugpoint llc llvm-ar llvm-as llvm-dis llvm-mc opt llvm-extract - -define DEF_LLVM_VARS -# The configure script defines these variables with the target triples -# separated by Z. This defines new ones with the expected format. -ifeq ($$(CFG_LLVM_ROOT),) -CFG_LLVM_BUILD_DIR_$(1):=$$(CFG_LLVM_BUILD_DIR_$(subst -,_,$(1))) -CFG_LLVM_INST_DIR_$(1):=$$(CFG_LLVM_INST_DIR_$(subst -,_,$(1))) -else -CFG_LLVM_INST_DIR_$(1):=$$(CFG_LLVM_ROOT) -endif - -# Any rules that depend on LLVM should depend on LLVM_CONFIG -LLVM_CONFIG_$(1):=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-config$$(X_$(1)) -LLVM_MC_$(1):=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-mc$$(X_$(1)) -LLVM_AR_$(1):=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-ar$$(X_$(1)) -LLVM_VERSION_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --version) -LLVM_BINDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --bindir) -LLVM_INCDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --includedir) -LLVM_LIBDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --libdir) -LLVM_LIBDIR_RUSTFLAGS_$(1)=-L native="$$(LLVM_LIBDIR_$(1))" -LLVM_LDFLAGS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --ldflags) -ifeq ($$(findstring freebsd,$(1)),freebsd) -# On FreeBSD, it may search wrong headers (that are for pre-installed LLVM), -# so we replace -I with -iquote to ensure that it searches bundled LLVM first. -LLVM_CXXFLAGS_$(1)=$$(subst -I, -iquote , $$(shell "$$(LLVM_CONFIG_$(1))" --cxxflags)) -else -LLVM_CXXFLAGS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --cxxflags) -endif -LLVM_HOST_TRIPLE_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --host-target) - -LLVM_AS_$(1)=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-as$$(X_$(1)) -LLC_$(1)=$$(CFG_LLVM_INST_DIR_$(1))/bin/llc$$(X_$(1)) - -LLVM_ALL_COMPONENTS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --components) -LLVM_VERSION_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --version) - -endef - -$(foreach host,$(CFG_HOST), \ - $(eval $(call DEF_LLVM_VARS,$(host)))) - -###################################################################### -# Exports for sub-utilities -###################################################################### - -# Note that any variable that re-configure should pick up needs to be -# exported - -export CFG_SRC_DIR -export CFG_SRC_DIR_RELATIVE -export CFG_BUILD_DIR -ifdef CFG_VER_DATE -export CFG_VER_DATE -endif -ifdef CFG_VER_HASH -export CFG_VER_HASH -endif -export CFG_VERSION -export CFG_VERSION_WIN -export CFG_RELEASE -export CFG_PACKAGE_NAME -export CFG_BUILD -export CFG_RELEASE_CHANNEL -export CFG_LLVM_ROOT -export CFG_PREFIX -export CFG_LIBDIR -export CFG_LIBDIR_RELATIVE -export CFG_DISABLE_INJECT_STD_VERSION -ifdef CFG_DISABLE_UNSTABLE_FEATURES -CFG_INFO := $(info cfg: disabling unstable features (CFG_DISABLE_UNSTABLE_FEATURES)) -# Turn on feature-staging -export CFG_DISABLE_UNSTABLE_FEATURES -# Subvert unstable feature lints to do the self-build -endif -ifdef CFG_MUSL_ROOT -export CFG_MUSL_ROOT -endif - -export RUSTC_BOOTSTRAP := 1 - -###################################################################### -# Per-stage targets and runner -###################################################################### - -# Valid setting-strings are 'all', 'none', 'gdb', 'lldb' -# This 'function' will determine which debugger scripts to copy based on a -# target triple. See debuggers.mk for more information. -TRIPLE_TO_DEBUGGER_SCRIPT_SETTING=\ - $(if $(findstring windows-msvc,$(1)),none,all) - -STAGES = 0 1 2 3 - -define SREQ -# $(1) is the stage number -# $(2) is the target triple -# $(3) is the host triple - -# Destinations of artifacts for the host compiler -HROOT$(1)_H_$(3) = $(3)/stage$(1) -HBIN$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/bin - -ifeq ($$(CFG_WINDOWSY_$(3)),1) -# On Windows we always store host runtime libraries in the 'bin' directory because -# there's no rpath. Target libraries go under $CFG_LIBDIR_RELATIVE (usually 'lib'). -HLIB_RELATIVE$(1)_H_$(3) = bin -TROOT$(1)_T_$(2)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR_RELATIVE)/rustlib/$(2) -# Remove the next 3 lines after a snapshot -ifeq ($(1),0) -RUSTFLAGS_STAGE0 += -L $$(TROOT$(1)_T_$(2)_H_$(3))/lib -endif - -else - -ifeq ($(1),0) -HLIB_RELATIVE$(1)_H_$(3) = lib -else -HLIB_RELATIVE$(1)_H_$(3) = $$(CFG_LIBDIR_RELATIVE) -endif -TROOT$(1)_T_$(2)_H_$(3) = $$(HLIB$(1)_H_$(3))/rustlib/$(2) - -endif -HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(HLIB_RELATIVE$(1)_H_$(3)) - -# Destinations of artifacts for target architectures -TBIN$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/bin -TLIB$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/lib - -# Preqrequisites for using the stageN compiler -ifeq ($(1),0) -HSREQ$(1)_H_$(3) = $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) -else -HSREQ$(1)_H_$(3) = \ - $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \ - $$(MKFILE_DEPS) \ - tmp/install-debugger-scripts$(1)_H_$(3)-$$(call TRIPLE_TO_DEBUGGER_SCRIPT_SETTING,$(3)).done -endif - -# Prerequisites for using the stageN compiler to build target artifacts -TSREQ$(1)_T_$(2)_H_$(3) = \ - $$(HSREQ$(1)_H_$(3)) \ - $$(foreach obj,$$(REQUIRED_OBJECTS_$(2)),\ - $$(TLIB$(1)_T_$(2)_H_$(3))/$$(obj)) - -# Prerequisites for a working stageN compiler and libraries, for a specific -# target -SREQ$(1)_T_$(2)_H_$(3) = \ - $$(TSREQ$(1)_T_$(2)_H_$(3)) \ - $$(foreach dep,$$(TARGET_CRATES_$(2)), \ - $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(dep)) \ - tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3)-$$(call TRIPLE_TO_DEBUGGER_SCRIPT_SETTING,$(2)).done - -# Prerequisites for a working stageN compiler and complete set of target -# libraries -CSREQ$(1)_T_$(2)_H_$(3) = \ - $$(TSREQ$(1)_T_$(2)_H_$(3)) \ - $$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \ - $$(foreach dep,$$(HOST_CRATES),$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(dep)) - -ifeq ($(1),0) -# Don't run the stage0 compiler under valgrind - that ship has sailed -CFG_VALGRIND_COMPILE$(1) = -else -CFG_VALGRIND_COMPILE$(1) = $$(CFG_VALGRIND_COMPILE) -endif - -# Add RUSTFLAGS_STAGEN values to the build command -EXTRAFLAGS_STAGE$(1) = $$(RUSTFLAGS_STAGE$(1)) - -CFGFLAG$(1)_T_$(2)_H_$(3) = stage$(1) - -endef - -# Same macro/variables as above, but defined in a separate loop so it can use -# all the variables above for all archs. The RPATH_VAR setup sometimes needs to -# reach across triples to get things in order. -# -# Defines (with the standard $(1)_T_$(2)_H_$(3) suffix): -# * `LD_LIBRARY_PATH_ENV_NAME`: the name for the key to use in the OS -# environment to access or extend the lookup path for dynamic -# libraries. Note on Windows, that key is `$PATH`, and thus not -# only conflates programs with dynamic libraries, but also often -# contains spaces which confuse make. -# * `LD_LIBRARY_PATH_ENV_HOSTDIR`: the entry to add to lookup path for the host -# * `LD_LIBRARY_PATH_ENV_TARGETDIR`: the entry to add to lookup path for target -# -# Below that, HOST_RPATH_VAR and TARGET_RPATH_VAR are defined in terms of the -# above settings. -# -define SREQ_CMDS - -ifeq ($$(OSTYPE_$(3)),apple-darwin) - LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3) := DYLD_LIBRARY_PATH -else -ifeq ($$(CFG_WINDOWSY_$(3)),1) - LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3) := PATH -else -ifeq ($$(OSTYPE_$(3)),unknown-haiku) - LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3) := LIBRARY_PATH -else - LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3) := LD_LIBRARY_PATH -endif -endif -endif - -LD_LIBRARY_PATH_ENV_HOSTDIR$(1)_T_$(2)_H_$(3) := \ - $$(CURDIR)/$$(HLIB$(1)_H_$(3)):$$(CFG_LLVM_INST_DIR_$(3))/lib -LD_LIBRARY_PATH_ENV_TARGETDIR$(1)_T_$(2)_H_$(3) := \ - $$(CURDIR)/$$(TLIB$(1)_T_$(2)_H_$(3)) - -HOST_RPATH_VAR$(1)_T_$(2)_H_$(3) := \ - $$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3))=$$(LD_LIBRARY_PATH_ENV_HOSTDIR$(1)_T_$(2)_H_$(3)):$$$$$$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3)) -TARGET_RPATH_VAR$(1)_T_$(2)_H_$(3) := \ - $$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3))=$$(LD_LIBRARY_PATH_ENV_TARGETDIR$(1)_T_$(2)_H_$(3)):$$$$$$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3)) - -RPATH_VAR$(1)_T_$(2)_H_$(3) := $$(HOST_RPATH_VAR$(1)_T_$(2)_H_$(3)) - -# Pass --cfg stage0 only for the build->host part of stage0; -# if you're building a cross config, the host->* parts are -# effectively stage1, since it uses the just-built stage0. -# -# Also be sure to use the right rpath because we're loading libraries from the -# CFG_BUILD's stage1 directory for our target, so switch this one instance of -# `RPATH_VAR` to get the bootstrap working. -ifeq ($(1),0) -ifneq ($(strip $(CFG_BUILD)),$(strip $(3))) -CFGFLAG$(1)_T_$(2)_H_$(3) = stage1 - -RPATH_VAR$(1)_T_$(2)_H_$(3) := $$(TARGET_RPATH_VAR1_T_$(2)_H_$$(CFG_BUILD)) -else -ifdef CFG_ENABLE_LOCAL_REBUILD -# Assume the local-rebuild rustc already has stage1 features too. -CFGFLAG$(1)_T_$(2)_H_$(3) = stage1 -endif -endif -endif - -STAGE$(1)_T_$(2)_H_$(3) := \ - $$(Q)$$(RPATH_VAR$(1)_T_$(2)_H_$(3)) \ - $$(call CFG_RUN_TARG_$(3),$(1), \ - $$(CFG_VALGRIND_COMPILE$(1)) \ - $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \ - --cfg $$(CFGFLAG$(1)_T_$(2)_H_$(3)) \ - $$(CFG_RUSTC_FLAGS) $$(EXTRAFLAGS_STAGE$(1)) --target=$(2)) \ - $$(RUSTC_FLAGS_$(2)) - -endef - -$(foreach build,$(CFG_HOST), \ - $(eval $(foreach target,$(CFG_TARGET), \ - $(eval $(foreach stage,$(STAGES), \ - $(eval $(call SREQ,$(stage),$(target),$(build)))))))) - -$(foreach build,$(CFG_HOST), \ - $(eval $(foreach target,$(CFG_TARGET), \ - $(eval $(foreach stage,$(STAGES), \ - $(eval $(call SREQ_CMDS,$(stage),$(target),$(build)))))))) - -###################################################################### -# rustc-H-targets -# -# Builds a functional Rustc for the given host. -###################################################################### - -define DEF_RUSTC_STAGE_TARGET -# $(1) == architecture -# $(2) == stage - -rustc-stage$(2)-H-$(1): \ - $$(foreach target,$$(CFG_TARGET),$$(SREQ$(2)_T_$$(target)_H_$(1))) - -endef - -$(foreach host,$(CFG_HOST), \ - $(eval $(foreach stage,1 2 3, \ - $(eval $(call DEF_RUSTC_STAGE_TARGET,$(host),$(stage)))))) - -rustc-stage1: rustc-stage1-H-$(CFG_BUILD) -rustc-stage2: rustc-stage2-H-$(CFG_BUILD) -rustc-stage3: rustc-stage3-H-$(CFG_BUILD) - -define DEF_RUSTC_TARGET -# $(1) == architecture - -rustc-H-$(1): rustc-stage2-H-$(1) -endef - -$(foreach host,$(CFG_TARGET), \ - $(eval $(call DEF_RUSTC_TARGET,$(host)))) - -rustc-stage1: rustc-stage1-H-$(CFG_BUILD) -rustc-stage2: rustc-stage2-H-$(CFG_BUILD) -rustc-stage3: rustc-stage3-H-$(CFG_BUILD) -rustc: rustc-H-$(CFG_BUILD) - -rustc-H-all: $(foreach host,$(CFG_HOST),rustc-H-$(host)) - -###################################################################### -# Entrypoint rule -###################################################################### - -.DEFAULT_GOAL := all - -define ALL_TARGET_N -ifneq ($$(findstring $(1),$$(CFG_HOST)),) -# This is a host -all-target-$(1)-host-$(2): $$(CSREQ2_T_$(1)_H_$(2)) -else -# This is a target only -all-target-$(1)-host-$(2): $$(SREQ2_T_$(1)_H_$(2)) -endif -endef - -$(foreach target,$(CFG_TARGET), \ - $(foreach host,$(CFG_HOST), \ - $(eval $(call ALL_TARGET_N,$(target),$(host))))) - -ALL_TARGET_RULES = $(foreach target,$(CFG_TARGET), \ - $(foreach host,$(CFG_HOST), \ - all-target-$(target)-host-$(host))) - -all-no-docs: $(ALL_TARGET_RULES) $(GENERATED) -all: all-no-docs docs - -###################################################################### -# Build system documentation -###################################################################### - -# $(1) is the name of the doc
in Makefile.in -# pick everything between tags | remove first line | remove last line -# | remove extra (?) line | strip leading `#` from lines -SHOW_DOCS = $(Q)awk '/<$(1)>/,/<\/$(1)>/' $(S)/Makefile.in | sed '1d' | sed '$$d' | sed 's/^\# \?//' - -help: - $(call SHOW_DOCS,help) - -tips: - $(call SHOW_DOCS,tips) - -nitty-gritty: - $(call SHOW_DOCS,nitty-gritty) diff --git a/mk/platform.mk b/mk/platform.mk deleted file mode 100644 index 6a7a20cbfdb..00000000000 --- a/mk/platform.mk +++ /dev/null @@ -1,250 +0,0 @@ -# Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - - -# Create variables HOST_ containing the host part -# of each target triple. For example, the triple i686-darwin-macos -# would create a variable HOST_i686-darwin-macos with the value -# i386. -define DEF_HOST_VAR - HOST_$(1) = $(patsubst i%86,i386,$(word 1,$(subst -, ,$(1)))) -endef -$(foreach t,$(CFG_TARGET),$(eval $(call DEF_HOST_VAR,$(t)))) -$(foreach t,$(CFG_TARGET),$(info cfg: host for $(t) is $(HOST_$(t)))) - -# Ditto for OSTYPE -define DEF_OSTYPE_VAR - OSTYPE_$(1) = $(subst $(firstword $(subst -, ,$(1)))-,,$(1)) -endef -$(foreach t,$(CFG_TARGET),$(eval $(call DEF_OSTYPE_VAR,$(t)))) -$(foreach t,$(CFG_TARGET),$(info cfg: os for $(t) is $(OSTYPE_$(t)))) - -# On Darwin, we need to run dsymutil so the debugging information ends -# up in the right place. On other platforms, it automatically gets -# embedded into the executable, so use a no-op command. -CFG_DSYMUTIL := true - -# Hack: not sure how to test if a file exists in make other than this -OS_SUPP = $(patsubst %,--suppressions=%, \ - $(wildcard $(CFG_SRC_DIR)src/etc/$(CFG_OSTYPE).supp*)) - -ifdef CFG_DISABLE_OPTIMIZE_CXX - $(info cfg: disabling C++ optimization (CFG_DISABLE_OPTIMIZE_CXX)) - CFG_GCCISH_CFLAGS += -O0 -else - CFG_GCCISH_CFLAGS += -O2 -endif - -# The soname thing is for supporting a statically linked jemalloc. -# see https://blog.mozilla.org/jseward/2012/06/05/valgrind-now-supports-jemalloc-builds-directly/ -ifdef CFG_VALGRIND - CFG_VALGRIND += --error-exitcode=100 \ - --fair-sched=try \ - --quiet \ - --soname-synonyms=somalloc=NONE \ - --suppressions=$(CFG_SRC_DIR)src/etc/x86.supp \ - $(OS_SUPP) - ifdef CFG_ENABLE_HELGRIND - CFG_VALGRIND += --tool=helgrind - else - CFG_VALGRIND += --tool=memcheck \ - --leak-check=full - endif -endif - -# If we actually want to run Valgrind on a given platform, set this variable -define DEF_GOOD_VALGRIND - ifeq ($(OSTYPE_$(1)),unknown-linux-gnu) - GOOD_VALGRIND_$(1) = 1 - endif - ifneq (,$(filter $(OSTYPE_$(1)),apple-darwin freebsd)) - ifeq ($(HOST_$(1)),x86_64) - GOOD_VALGRIND_$(1) = 1 - endif - endif - ifdef GOOD_VALGRIND_$(t) - $$(info cfg: have good valgrind for $(t)) - else - $$(info cfg: no good valgrind for $(t)) - endif -endef -$(foreach t,$(CFG_TARGET),$(eval $(call DEF_GOOD_VALGRIND,$(t)))) - -AR := ar - -define SET_FROM_CFG - ifdef CFG_$(1) - ifeq ($(origin $(1)),undefined) - $$(info cfg: using $(1)=$(CFG_$(1)) (CFG_$(1))) - $(1)=$(CFG_$(1)) - endif - ifeq ($(origin $(1)),default) - $$(info cfg: using $(1)=$(CFG_$(1)) (CFG_$(1))) - $(1)=$(CFG_$(1)) - endif - endif -endef - -$(foreach cvar,CC CXX CPP CFLAGS CXXFLAGS CPPFLAGS, \ - $(eval $(call SET_FROM_CFG,$(cvar)))) - -CFG_RLIB_GLOB=lib$(1)-*.rlib - -include $(wildcard $(CFG_SRC_DIR)mk/cfg/*.mk) - -define ADD_INSTALLED_OBJECTS - INSTALLED_OBJECTS_$(1) += $$(CFG_INSTALLED_OBJECTS_$(1)) - REQUIRED_OBJECTS_$(1) += $$(CFG_THIRD_PARTY_OBJECTS_$(1)) -endef - -$(foreach target,$(CFG_TARGET), \ - $(eval $(call ADD_INSTALLED_OBJECTS,$(target)))) - -define DEFINE_LINKER - ifndef LINK_$(1) - LINK_$(1) := $$(CC_$(1)) - endif -endef - -$(foreach target,$(CFG_TARGET), \ - $(eval $(call DEFINE_LINKER,$(target)))) - -define ADD_JEMALLOC_DEP - ifndef CFG_DISABLE_JEMALLOC_$(1) - ifndef CFG_DISABLE_JEMALLOC - RUST_DEPS_std_T_$(1) += alloc_jemalloc - TARGET_CRATES_$(1) += alloc_jemalloc - endif - endif -endef - -$(foreach target,$(CFG_TARGET), \ - $(eval $(call ADD_JEMALLOC_DEP,$(target)))) - -# The -Qunused-arguments sidesteps spurious warnings from clang -define FILTER_FLAGS - ifeq ($$(CFG_USING_CLANG),1) - ifneq ($(findstring clang,$$(shell $(CC_$(1)) -v)),) - CFG_GCCISH_CFLAGS_$(1) += -Qunused-arguments - CFG_GCCISH_CXXFLAGS_$(1) += -Qunused-arguments - endif - endif -endef - -$(foreach target,$(CFG_TARGET), \ - $(eval $(call FILTER_FLAGS,$(target)))) - -# Configure various macros to pass gcc or cl.exe style arguments -define CC_MACROS - CFG_CC_INCLUDE_$(1)=-I $$(1) - ifeq ($$(findstring msvc,$(1)),msvc) - CFG_CC_OUTPUT_$(1)=-Fo:$$(1) - CFG_CREATE_ARCHIVE_$(1)='$$(AR_$(1))' -OUT:$$(1) - else - CFG_CC_OUTPUT_$(1)=-o $$(1) - CFG_CREATE_ARCHIVE_$(1)=$$(AR_$(1)) crus $$(1) - endif -endef - -$(foreach target,$(CFG_TARGET), \ - $(eval $(call CC_MACROS,$(target)))) - - -ifeq ($(CFG_CCACHE_CPP2),1) - CCACHE_CPP2=1 - export CCACHE_CPP -endif - -ifdef CFG_CCACHE_BASEDIR - CCACHE_BASEDIR=$(CFG_CCACHE_BASEDIR) - export CCACHE_BASEDIR -endif - -FIND_COMPILER = $(strip $(1:ccache=)) - -define CFG_MAKE_TOOLCHAIN - # Prepend the tools with their prefix if cross compiling - ifneq ($(CFG_BUILD),$(1)) - ifneq ($$(findstring msvc,$(1)),msvc) - CC_$(1)=$(CROSS_PREFIX_$(1))$(CC_$(1)) - CXX_$(1)=$(CROSS_PREFIX_$(1))$(CXX_$(1)) - CPP_$(1)=$(CROSS_PREFIX_$(1))$(CPP_$(1)) - AR_$(1)=$(CROSS_PREFIX_$(1))$(AR_$(1)) - LINK_$(1)=$(CROSS_PREFIX_$(1))$(LINK_$(1)) - RUSTC_CROSS_FLAGS_$(1)=-C linker=$$(call FIND_COMPILER,$$(LINK_$(1))) \ - -C ar=$$(call FIND_COMPILER,$$(AR_$(1))) $(RUSTC_CROSS_FLAGS_$(1)) - - RUSTC_FLAGS_$(1)=$$(RUSTC_CROSS_FLAGS_$(1)) $(RUSTC_FLAGS_$(1)) - endif - endif - - CFG_COMPILE_C_$(1) = '$$(call FIND_COMPILER,$$(CC_$(1)))' \ - $$(CFLAGS) \ - $$(CFG_GCCISH_CFLAGS) \ - $$(CFG_GCCISH_CFLAGS_$(1)) \ - -c $$(call CFG_CC_OUTPUT_$(1),$$(1)) $$(2) - CFG_LINK_C_$(1) = $$(CC_$(1)) \ - $$(LDFLAGS) \ - $$(CFG_GCCISH_LINK_FLAGS) -o $$(1) \ - $$(CFG_GCCISH_LINK_FLAGS_$(1)) \ - $$(CFG_GCCISH_DEF_FLAG_$(1))$$(3) $$(2) \ - $$(call CFG_INSTALL_NAME_$(1),$$(4)) - CFG_COMPILE_CXX_$(1) = '$$(call FIND_COMPILER,$$(CXX_$(1)))' \ - $$(CXXFLAGS) \ - $$(CFG_GCCISH_CFLAGS) \ - $$(CFG_GCCISH_CXXFLAGS) \ - $$(CFG_GCCISH_CFLAGS_$(1)) \ - $$(CFG_GCCISH_CXXFLAGS_$(1)) \ - -c $$(call CFG_CC_OUTPUT_$(1),$$(1)) $$(2) - CFG_LINK_CXX_$(1) = $$(CXX_$(1)) \ - $$(LDFLAGS) \ - $$(CFG_GCCISH_LINK_FLAGS) -o $$(1) \ - $$(CFG_GCCISH_LINK_FLAGS_$(1)) \ - $$(CFG_GCCISH_DEF_FLAG_$(1))$$(3) $$(2) \ - $$(call CFG_INSTALL_NAME_$(1),$$(4)) - - ifeq ($$(findstring $(HOST_$(1)),arm aarch64 mips mipsel powerpc),) - - # On Bitrig, we need the relocation model to be PIC for everything - ifeq (,$(filter $(OSTYPE_$(1)),bitrig)) - LLVM_MC_RELOCATION_MODEL="pic" - else - LLVM_MC_RELOCATION_MODEL="default" - endif - - # LLVM changed this flag in 3.9 - ifdef CFG_LLVM_MC_HAS_RELOCATION_MODEL - LLVM_MC_RELOC_FLAG := -relocation-model=$$(LLVM_MC_RELOCATION_MODEL) - else - LLVM_MC_RELOC_FLAG := -position-independent - endif - - # We're using llvm-mc as our assembler because it supports - # .cfi pseudo-ops on mac - CFG_ASSEMBLE_$(1)=$$(CPP_$(1)) -E $$(2) | \ - $$(LLVM_MC_$$(CFG_BUILD)) \ - -assemble \ - $$(LLVM_MC_RELOC_FLAG) \ - -filetype=obj \ - -triple=$(1) \ - -o=$$(1) - else - - # For the ARM, AARCH64, MIPS and POWER crosses, use the toolchain assembler - # FIXME: We should be able to use the LLVM assembler - CFG_ASSEMBLE_$(1)=$$(CC_$(1)) $$(CFG_GCCISH_CFLAGS_$(1)) \ - $$(2) -c -o $$(1) - - endif - -endef - -$(foreach target,$(CFG_TARGET), \ - $(eval $(call CFG_MAKE_TOOLCHAIN,$(target)))) diff --git a/mk/prepare.mk b/mk/prepare.mk deleted file mode 100644 index 20e20e9b5df..00000000000 --- a/mk/prepare.mk +++ /dev/null @@ -1,251 +0,0 @@ -# Copyright 2014 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -# Basic support for producing installation images. -# -# The 'prepare' build target copies all release artifacts from the build -# directory to some other location, placing all binaries, libraries, and -# docs in their final locations relative to each other. -# -# It requires the following variables to be set: -# -# PREPARE_HOST - the host triple -# PREPARE_TARGETS - the target triples, space separated -# PREPARE_DEST_DIR - the directory to put the image - -PREPARE_STAGE=2 - -DEFAULT_PREPARE_DIR_CMD = umask 022 && mkdir -p -DEFAULT_PREPARE_BIN_CMD = install -m755 -DEFAULT_PREPARE_LIB_CMD = install -m644 -DEFAULT_PREPARE_MAN_CMD = install -m644 - -# Create a directory -# $(1) is the directory -# -# XXX: These defines are called to generate make steps. -# Adding blank lines means two steps from different defines will not end up on -# the same line. -define PREPARE_DIR - - @$(call E, prepare: $(1)) - $(Q)$(PREPARE_DIR_CMD) $(1) - -endef - -# Copy an executable -# $(1) is the filename/libname-glob -# -# See above for an explanation on the surrounding blank lines -define PREPARE_BIN - - @$(call E, prepare: $(PREPARE_DEST_BIN_DIR)/$(1)) - $(Q)$(PREPARE_BIN_CMD) $(PREPARE_SOURCE_BIN_DIR)/$(1) $(PREPARE_DEST_BIN_DIR)/$(1) - -endef - -# Copy a dylib or rlib -# $(1) is the filename/libname-glob -# -# See above for an explanation on the surrounding blank lines -define PREPARE_LIB - - @$(call E, prepare: $(PREPARE_WORKING_DEST_LIB_DIR)/$(1)) - $(Q)LIB_NAME="$(notdir $(lastword $(wildcard $(PREPARE_WORKING_SOURCE_LIB_DIR)/$(1))))"; \ - MATCHES="$(filter-out %$(notdir $(lastword $(wildcard $(PREPARE_WORKING_SOURCE_LIB_DIR)/$(1)))), \ - $(wildcard $(PREPARE_WORKING_DEST_LIB_DIR)/$(1)))"; \ - if [ -n "$$MATCHES" ]; then \ - echo "warning: one or libraries matching Rust library '$(1)'" && \ - echo " (other than '$$LIB_NAME' itself) already present" && \ - echo " at destination $(PREPARE_WORKING_DEST_LIB_DIR):" && \ - echo $$MATCHES ; \ - fi - $(Q)$(PREPARE_LIB_CMD) `ls -drt1 $(PREPARE_WORKING_SOURCE_LIB_DIR)/$(1)` $(PREPARE_WORKING_DEST_LIB_DIR)/ - -endef - -# Copy a man page -# $(1) - source dir -# -# See above for an explanation on the surrounding blank lines -define PREPARE_MAN - - @$(call E, prepare: $(PREPARE_DEST_MAN_DIR)/$(1)) - $(Q)$(PREPARE_MAN_CMD) $(PREPARE_SOURCE_MAN_DIR)/$(1) $(PREPARE_DEST_MAN_DIR)/$(1) - -endef - -PREPARE_TOOLS = $(filter-out compiletest rustbook error_index_generator, $(TOOLS)) - - -# $(1) is tool -# $(2) is stage -# $(3) is host -# $(4) tag -define DEF_PREPARE_HOST_TOOL -prepare-host-tool-$(1)-$(2)-$(3)-$(4): \ - PREPARE_SOURCE_BIN_DIR=$$(HBIN$(2)_H_$(3)) -prepare-host-tool-$(1)-$(2)-$(3)-$(4): prepare-maybe-clean-$(4) \ - $$(foreach dep,$$(TOOL_DEPS_$(1)),prepare-host-lib-$$(dep)-$(2)-$(3)-$(4)) \ - $$(HBIN$(2)_H_$(3))/$(1)$$(X_$(3)) \ - prepare-host-dirs-$(4) - $$(if $$(findstring $(2), $$(PREPARE_STAGE)), \ - $$(if $$(findstring $(3), $$(PREPARE_HOST)), \ - $$(call PREPARE_BIN,$(1)$$(X_$$(PREPARE_HOST))),),) - $$(if $$(findstring $(2), $$(PREPARE_STAGE)), \ - $$(if $$(findstring $(3), $$(PREPARE_HOST)), \ - $$(call PREPARE_MAN,$(1).1),),) -endef - -# Libraries are compiled using the --libdir provided to configure, but -# we store them in the tarball using just "lib" so that the install -# script can then rewrite them back to the correct path. -PREPARE_TAR_LIB_DIR = $(patsubst $(CFG_LIBDIR_RELATIVE)%,lib%,$(1)) - -# For host libraries only install dylibs, not rlibs since the host libs are only -# used to support rustc and rustc uses dynamic linking -# -# $(1) is tool -# $(2) is stage -# $(3) is host -# $(4) tag -define DEF_PREPARE_HOST_LIB -prepare-host-lib-$(1)-$(2)-$(3)-$(4): \ - PREPARE_WORKING_SOURCE_LIB_DIR=$$(HLIB$(2)_H_$(3)) -prepare-host-lib-$(1)-$(2)-$(3)-$(4): \ - PREPARE_WORKING_DEST_LIB_DIR=$$(PREPARE_DEST_DIR)/$$(call PREPARE_TAR_LIB_DIR,$$(HLIB_RELATIVE$(2)_H_$(3))) -prepare-host-lib-$(1)-$(2)-$(3)-$(4): prepare-maybe-clean-$(4) \ - $$(foreach dep,$$(RUST_DEPS_$(1)_T_$(3)),prepare-host-lib-$$(dep)-$(2)-$(3)-$(4)) \ - $$(HLIB$(2)_H_$(3))/stamp.$(1) \ - prepare-host-dirs-$(4) - $$(if $$(findstring $(2), $$(PREPARE_STAGE)), \ - $$(if $$(findstring $(3), $$(PREPARE_HOST)), \ - $$(if $$(findstring 1,$$(ONLY_RLIB_$(1))),, \ - $$(call PREPARE_LIB,$$(call CFG_LIB_GLOB_$$(PREPARE_HOST),$(1)))),),) -endef - - -# $(1) is stage -# $(2) is target -# $(3) is host -# $(4) tag -define DEF_PREPARE_TARGET_N -# Rebind PREPARE_*_LIB_DIR to point to rustlib, then install the libs for the targets -prepare-target-$(2)-host-$(3)-$(1)-$(4): \ - PREPARE_WORKING_SOURCE_LIB_DIR=$$(TLIB$(1)_T_$(2)_H_$(3)) -prepare-target-$(2)-host-$(3)-$(1)-$(4): \ - PREPARE_WORKING_DEST_LIB_DIR=$$(PREPARE_DEST_LIB_DIR)/rustlib/$(2)/lib -prepare-target-$(2)-host-$(3)-$(1)-$(4): \ - PREPARE_SOURCE_BIN_DIR=$$(TBIN$(1)_T_$(2)_H_$(3)) -prepare-target-$(2)-host-$(3)-$(1)-$(4): \ - PREPARE_DEST_BIN_DIR=$$(PREPARE_DEST_LIB_DIR)/rustlib/$(3)/bin -prepare-target-$(2)-host-$(3)-$(1)-$(4): prepare-maybe-clean-$(4) \ - $$(foreach crate,$$(TARGET_CRATES_$(2)), \ - $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(crate)) \ - $$(if $$(findstring $(2),$$(CFG_HOST)), \ - $$(foreach crate,$$(HOST_CRATES), \ - $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(crate)),) -# Only install if this host and target combo is being prepared. Also be sure to -# *not* install the rlibs for host crates because there's no need to statically -# link against most of them. They just produce a large amount of extra size -# bloat. - $$(if $$(findstring $(1), $$(PREPARE_STAGE)), \ - $$(if $$(findstring $(2), $$(PREPARE_TARGETS)), \ - $$(if $$(findstring $(3), $$(PREPARE_HOST)), \ - $$(call PREPARE_DIR,$$(PREPARE_WORKING_DEST_LIB_DIR)) \ - $$(call PREPARE_DIR,$$(PREPARE_DEST_BIN_DIR)) \ - $$(foreach crate,$$(TARGET_CRATES_$(2)), \ - $$(if $$(or $$(findstring 1, $$(ONLY_RLIB_$$(crate))),$$(findstring 1,$$(CFG_INSTALL_ONLY_RLIB_$(2)))),, \ - $$(call PREPARE_LIB,$$(call CFG_LIB_GLOB_$(2),$$(crate)))) \ - $$(call PREPARE_LIB,$$(call CFG_RLIB_GLOB,$$(crate)))) \ - $$(if $$(findstring $(2),$$(CFG_HOST)), \ - $$(foreach crate,$$(HOST_CRATES), \ - $$(call PREPARE_LIB,$$(call CFG_LIB_GLOB_$(2),$$(crate)))),) \ - $$(foreach object,$$(INSTALLED_OBJECTS_$(2)),\ - $$(call PREPARE_LIB,$$(object))) \ - $$(foreach bin,$$(INSTALLED_BINS_$(3)),\ - $$(call PREPARE_BIN,$$(bin))) \ - ,),),) -endef - -define INSTALL_GDB_DEBUGGER_SCRIPTS_COMMANDS - $(Q)$(PREPARE_BIN_CMD) $(DEBUGGER_BIN_SCRIPTS_GDB_ABS) $(PREPARE_DEST_BIN_DIR) - $(Q)$(PREPARE_LIB_CMD) $(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS) $(PREPARE_DEST_LIB_DIR)/rustlib/etc -endef - -define INSTALL_LLDB_DEBUGGER_SCRIPTS_COMMANDS - $(Q)$(PREPARE_BIN_CMD) $(DEBUGGER_BIN_SCRIPTS_LLDB_ABS) $(PREPARE_DEST_BIN_DIR) - $(Q)$(PREPARE_LIB_CMD) $(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB_ABS) $(PREPARE_DEST_LIB_DIR)/rustlib/etc -endef - -define INSTALL_NO_DEBUGGER_SCRIPTS_COMMANDS - $(Q)echo "No debugger scripts will be installed for host $(PREPARE_HOST)" -endef - -# $(1) is PREPARE_HOST -INSTALL_DEBUGGER_SCRIPT_COMMANDS=$(if $(findstring windows,$(1)),\ - $(INSTALL_NO_DEBUGGER_SCRIPTS_COMMANDS),\ - $(if $(findstring darwin,$(1)),\ - $(INSTALL_LLDB_DEBUGGER_SCRIPTS_COMMANDS),\ - $(INSTALL_GDB_DEBUGGER_SCRIPTS_COMMANDS))) - -define DEF_PREPARE - -prepare-base-$(1)-%: PREPARE_SOURCE_MAN_DIR=$$(S)/man -prepare-base-$(1)-%: PREPARE_DEST_BIN_DIR=$$(PREPARE_DEST_DIR)/bin -prepare-base-$(1)-%: PREPARE_DEST_LIB_DIR=$$(PREPARE_DEST_DIR)/$$(call PREPARE_TAR_LIB_DIR,$$(CFG_LIBDIR_RELATIVE)) -prepare-base-$(1)-%: PREPARE_DEST_MAN_DIR=$$(PREPARE_DEST_DIR)/share/man/man1 - -prepare-base-$(1)-target: prepare-target-$(1) -prepare-base-$(1)-host: prepare-host-$(1) prepare-debugger-scripts-$(1) - -prepare-host-$(1): prepare-host-tools-$(1) - -prepare-host-tools-$(1): \ - $$(foreach tool, $$(PREPARE_TOOLS), \ - $$(foreach host,$$(CFG_HOST), \ - prepare-host-tool-$$(tool)-$$(PREPARE_STAGE)-$$(host)-$(1))) - -prepare-host-dirs-$(1): prepare-maybe-clean-$(1) - $$(call PREPARE_DIR,$$(PREPARE_DEST_BIN_DIR)) - $$(call PREPARE_DIR,$$(PREPARE_DEST_LIB_DIR)) - $$(call PREPARE_DIR,$$(PREPARE_DEST_LIB_DIR)/rustlib/etc) - $$(call PREPARE_DIR,$$(PREPARE_DEST_MAN_DIR)) - -prepare-debugger-scripts-$(1): prepare-host-dirs-$(1) \ - $$(DEBUGGER_BIN_SCRIPTS_ALL_ABS) \ - $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL_ABS) - $$(call INSTALL_DEBUGGER_SCRIPT_COMMANDS,$$(PREPARE_HOST)) - -$$(foreach tool,$$(PREPARE_TOOLS), \ - $$(foreach host,$$(CFG_HOST), \ - $$(eval $$(call DEF_PREPARE_HOST_TOOL,$$(tool),$$(PREPARE_STAGE),$$(host),$(1))))) - -$$(foreach lib,$$(CRATES), \ - $$(foreach host,$$(CFG_HOST), \ - $$(eval $$(call DEF_PREPARE_HOST_LIB,$$(lib),$$(PREPARE_STAGE),$$(host),$(1))))) - -prepare-target-$(1): \ - $$(foreach host,$$(CFG_HOST), \ - $$(foreach target,$$(CFG_TARGET), \ - prepare-target-$$(target)-host-$$(host)-$$(PREPARE_STAGE)-$(1))) - -$$(foreach host,$$(CFG_HOST), \ - $$(foreach target,$$(CFG_TARGET), \ - $$(eval $$(call DEF_PREPARE_TARGET_N,$$(PREPARE_STAGE),$$(target),$$(host),$(1))))) - -prepare-maybe-clean-$(1): - $$(if $$(findstring true,$$(PREPARE_CLEAN)), \ - @$$(call E, cleaning destination $$(PREPARE_DEST_DIR)),) - $$(if $$(findstring true,$$(PREPARE_CLEAN)), \ - $$(Q)rm -rf $$(PREPARE_DEST_DIR),) - - -endef diff --git a/mk/reconfig.mk b/mk/reconfig.mk deleted file mode 100644 index b8f51097868..00000000000 --- a/mk/reconfig.mk +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright 2014 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -# Recursive wildcard function -# http://blog.jgc.org/2011/07/gnu-make-recursive-wildcard-function.html -rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) \ - $(filter $(subst *,%,$2),$d)) - -ifndef CFG_DISABLE_MANAGE_SUBMODULES -# This is a pretty expensive operation but I don't see any way to avoid it -# NB: This only looks for '+' status (wrong commit checked out), not '-' status -# (nothing checked out at all). `./configure --{llvm,jemalloc}-root` -# will explicitly deinitialize the corresponding submodules, and we don't -# want to force constant rebuilds in that case. -NEED_GIT_RECONFIG=$(shell cd "$(CFG_SRC_DIR)" && $(CFG_GIT) submodule status | grep -c '^+') -else -NEED_GIT_RECONFIG=0 -endif - -ifeq ($(NEED_GIT_RECONFIG),0) -else -# If the submodules have changed then always execute config.mk -.PHONY: config.stamp -endif - -Makefile config.mk: config.stamp - -ifeq ($(SREL),) -SREL_ROOT := ./ -else -SREL_ROOT := $(SREL) -endif - -config.stamp: $(S)configure $(S)Makefile.in $(S)src/stage0.txt - @$(call E, cfg: reconfiguring) - $(SREL_ROOT)configure $(CFG_CONFIGURE_ARGS) diff --git a/mk/rt.mk b/mk/rt.mk deleted file mode 100644 index f5149281d50..00000000000 --- a/mk/rt.mk +++ /dev/null @@ -1,721 +0,0 @@ -# Copyright 2014 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -################################################################################ -# Native libraries built as part of the rust build process -# -# This portion of the rust build system is meant to keep track of native -# dependencies and how to build them. It is currently required that all native -# dependencies are built as static libraries, as slinging around dynamic -# libraries isn't exactly the most fun thing to do. -# -# This section should need minimal modification to add new libraries. The -# relevant variables are: -# -# NATIVE_LIBS -# This is a list of all native libraries which are built as part of the -# build process. It will build all libraries into RT_OUTPUT_DIR with the -# appropriate name of static library as dictated by the target platform -# -# NATIVE_DEPS_ -# This is a list of files relative to the src/rt directory which are -# needed to build the native library. Each file will be compiled to an -# object file, and then all the object files will be assembled into an -# archive (static library). The list contains files of any extension -# -# If adding a new library, you should update the NATIVE_LIBS list, and then list -# the required files below it. The list of required files is a list of files -# that's per-target so you're allowed to conditionally add files based on the -# target. -################################################################################ -NATIVE_LIBS := hoedown miniz rust_test_helpers - -# A macro to add a generic implementation of intrinsics iff a arch optimized implementation is not -# already in the list. -# $(1) is the target -# $(2) is the intrinsic -define ADD_INTRINSIC - ifeq ($$(findstring X,$$(foreach intrinsic,$$(COMPRT_OBJS_$(1)),$$(if $$(findstring $(2),$$(intrinsic)),X,))),) - COMPRT_OBJS_$(1) += $(2) - endif -endef - -# $(1) is the target triple -define NATIVE_LIBRARIES - -NATIVE_DEPS_hoedown_$(1) := hoedown/src/autolink.c \ - hoedown/src/buffer.c \ - hoedown/src/document.c \ - hoedown/src/escape.c \ - hoedown/src/html.c \ - hoedown/src/html_blocks.c \ - hoedown/src/html_smartypants.c \ - hoedown/src/stack.c \ - hoedown/src/version.c -NATIVE_DEPS_miniz_$(1) = miniz.c -NATIVE_DEPS_rust_test_helpers_$(1) := rust_test_helpers.c - -################################################################################ -# You shouldn't find it that necessary to edit anything below this line. -################################################################################ - -# While we're defining the native libraries for each target, we define some -# common rules used to build files for various targets. - -RT_OUTPUT_DIR_$(1) := $(1)/rt - -$$(RT_OUTPUT_DIR_$(1))/%.o: $(S)src/rt/%.c $$(MKFILE_DEPS) - @mkdir -p $$(@D) - @$$(call E, compile: $$@) - $$(Q)$$(call CFG_COMPILE_C_$(1), $$@, \ - $$(call CFG_CC_INCLUDE_$(1),$$(S)src/rt/hoedown/src) \ - $$(call CFG_CC_INCLUDE_$(1),$$(S)src/rt) \ - $$(RUNTIME_CFLAGS_$(1))) $$< - -$$(RT_OUTPUT_DIR_$(1))/%.o: $(S)src/rt/%.S $$(MKFILE_DEPS) \ - $$(LLVM_CONFIG_$$(CFG_BUILD)) - @mkdir -p $$(@D) - @$$(call E, compile: $$@) - $$(Q)$$(call CFG_ASSEMBLE_$(1),$$@,$$<) - -# On MSVC targets the compiler's default include path (e.g. where to find system -# headers) is specified by the INCLUDE environment variable. This may not be set -# so the ./configure script scraped the relevant values and this is the location -# that we put them into cl.exe's environment. -ifeq ($$(findstring msvc,$(1)),msvc) -$$(RT_OUTPUT_DIR_$(1))/%.o: \ - export INCLUDE := $$(CFG_MSVC_INCLUDE_PATH_$$(HOST_$(1))) -$(1)/rustllvm/%.o: \ - export INCLUDE := $$(CFG_MSVC_INCLUDE_PATH_$$(HOST_$(1))) -endif -endef - -$(foreach target,$(CFG_TARGET),$(eval $(call NATIVE_LIBRARIES,$(target)))) - -# A macro for devining how to build third party libraries listed above (based -# on their dependencies). -# -# $(1) is the target -# $(2) is the lib name -define THIRD_PARTY_LIB - -OBJS_$(2)_$(1) := $$(NATIVE_DEPS_$(2)_$(1):%=$$(RT_OUTPUT_DIR_$(1))/%) -OBJS_$(2)_$(1) := $$(OBJS_$(2)_$(1):.c=.o) -OBJS_$(2)_$(1) := $$(OBJS_$(2)_$(1):.cpp=.o) -OBJS_$(2)_$(1) := $$(OBJS_$(2)_$(1):.S=.o) -NATIVE_$(2)_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),$(2)) -$$(RT_OUTPUT_DIR_$(1))/$$(NATIVE_$(2)_$(1)): $$(OBJS_$(2)_$(1)) - @$$(call E, link: $$@) - $$(Q)$$(call CFG_CREATE_ARCHIVE_$(1),$$@) $$^ - -endef - -$(foreach target,$(CFG_TARGET), \ - $(eval $(call RUNTIME_RULES,$(target)))) -$(foreach lib,$(NATIVE_LIBS), \ - $(foreach target,$(CFG_TARGET), \ - $(eval $(call THIRD_PARTY_LIB,$(target),$(lib))))) - - -################################################################################ -# Building third-party targets with external build systems -# -# This location is meant for dependencies which have external build systems. It -# is still assumed that the output of each of these steps is a static library -# in the correct location. -################################################################################ - -define DEF_THIRD_PARTY_TARGETS - -# $(1) is the target triple - -ifeq ($$(CFG_WINDOWSY_$(1)),1) - # A bit of history here, this used to be --enable-lazy-lock added in #14006 - # which was filed with jemalloc in jemalloc/jemalloc#83 which was also - # reported to MinGW: http://sourceforge.net/p/mingw-w64/bugs/395/ - # - # When updating jemalloc to 4.0, however, it was found that binaries would - # exit with the status code STATUS_RESOURCE_NOT_OWNED indicating that a thread - # was unlocking a mutex it never locked. Disabling this "lazy lock" option - # seems to fix the issue, but it was enabled by default for MinGW targets in - # 13473c7 for jemalloc. - # - # As a result of all that, force disabling lazy lock on Windows, and after - # reading some code it at least *appears* that the initialization of mutexes - # is otherwise ok in jemalloc, so shouldn't cause problems hopefully... - # - # tl;dr: make windows behave like other platforms by disabling lazy locking, - # but requires passing an option due to a historical default with - # jemalloc. - JEMALLOC_ARGS_$(1) := --disable-lazy-lock -else ifeq ($(OSTYPE_$(1)), apple-ios) - JEMALLOC_ARGS_$(1) := --disable-tls -else ifeq ($(findstring android, $(OSTYPE_$(1))), android) - # We force android to have prefixed symbols because apparently replacement of - # the libc allocator doesn't quite work. When this was tested (unprefixed - # symbols), it was found that the `realpath` function in libc would allocate - # with libc malloc (not jemalloc malloc), and then the standard library would - # free with jemalloc free, causing a segfault. - # - # If the test suite passes, however, without symbol prefixes then we should be - # good to go! - JEMALLOC_ARGS_$(1) := --disable-tls --with-jemalloc-prefix=je_ -else ifeq ($(findstring dragonfly, $(OSTYPE_$(1))), dragonfly) - JEMALLOC_ARGS_$(1) := --with-jemalloc-prefix=je_ -endif - -ifdef CFG_ENABLE_DEBUG_JEMALLOC - JEMALLOC_ARGS_$(1) += --enable-debug --enable-fill -endif - -################################################################################ -# jemalloc -################################################################################ - -ifdef CFG_ENABLE_FAST_MAKE -JEMALLOC_DEPS := $(S)/.gitmodules -else -JEMALLOC_DEPS := $(wildcard \ - $(S)src/jemalloc/* \ - $(S)src/jemalloc/*/* \ - $(S)src/jemalloc/*/*/* \ - $(S)src/jemalloc/*/*/*/*) -endif - -# See #17183 for details, this file is touched during the build process so we -# don't want to consider it as a dependency. -JEMALLOC_DEPS := $(filter-out $(S)src/jemalloc/VERSION,$(JEMALLOC_DEPS)) - -JEMALLOC_NAME_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),jemalloc) -ifeq ($$(CFG_WINDOWSY_$(1)),1) - JEMALLOC_REAL_NAME_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),jemalloc_s) -else - JEMALLOC_REAL_NAME_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),jemalloc_pic) -endif -JEMALLOC_LIB_$(1) := $$(RT_OUTPUT_DIR_$(1))/$$(JEMALLOC_NAME_$(1)) -JEMALLOC_BUILD_DIR_$(1) := $$(RT_OUTPUT_DIR_$(1))/jemalloc -JEMALLOC_LOCAL_$(1) := $$(JEMALLOC_BUILD_DIR_$(1))/lib/$$(JEMALLOC_REAL_NAME_$(1)) - -$$(JEMALLOC_LOCAL_$(1)): $$(JEMALLOC_DEPS) $$(MKFILE_DEPS) - @$$(call E, make: jemalloc) - cd "$$(JEMALLOC_BUILD_DIR_$(1))"; "$(S)src/jemalloc/configure" \ - $$(JEMALLOC_ARGS_$(1)) $(CFG_JEMALLOC_FLAGS) \ - --build=$$(CFG_GNU_TRIPLE_$(CFG_BUILD)) --host=$$(CFG_GNU_TRIPLE_$(1)) \ - CC="$$(CC_$(1)) $$(CFG_JEMALLOC_CFLAGS_$(1))" \ - AR="$$(AR_$(1))" \ - RANLIB="$$(AR_$(1)) s" \ - CPPFLAGS="-I $(S)src/rt/" \ - EXTRA_CFLAGS="-g1 -ffunction-sections -fdata-sections" - $$(Q)$$(MAKE) -C "$$(JEMALLOC_BUILD_DIR_$(1))" build_lib_static - -ifeq ($(1),$$(CFG_BUILD)) -ifneq ($$(CFG_JEMALLOC_ROOT),) -$$(JEMALLOC_LIB_$(1)): $$(CFG_JEMALLOC_ROOT)/libjemalloc_pic.a - @$$(call E, copy: jemalloc) - $$(Q)cp $$< $$@ -else -$$(JEMALLOC_LIB_$(1)): $$(JEMALLOC_LOCAL_$(1)) - $$(Q)cp $$< $$@ -endif -else -$$(JEMALLOC_LIB_$(1)): $$(JEMALLOC_LOCAL_$(1)) - $$(Q)cp $$< $$@ -endif - -################################################################################ -# compiler-rt -################################################################################ - -# Everything below is a manual compilation of compiler-rt, disregarding its -# build system. See comments in `src/bootstrap/native.rs` for more information. - -COMPRT_NAME_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),compiler-rt) -COMPRT_LIB_$(1) := $$(RT_OUTPUT_DIR_$(1))/$$(COMPRT_NAME_$(1)) -COMPRT_BUILD_DIR_$(1) := $$(RT_OUTPUT_DIR_$(1))/compiler-rt - -# We must avoid compiling both a generic implementation (e.g. `floatdidf.c) and an arch optimized -# implementation (e.g. `x86_64/floatdidf.S) of the same symbol (e.g. `floatdidf) because that causes -# linker errors. To avoid that, we first add all the arch optimized implementations and then add the -# generic implementations if and only if its arch optimized version is not already in the list. This -# last part is handled by the ADD_INTRINSIC macro. - -COMPRT_OBJS_$(1) := - -ifeq ($$(findstring msvc,$(1)),) -ifeq ($$(findstring x86_64,$(1)),x86_64) -COMPRT_OBJS_$(1) += \ - x86_64/chkstk.o \ - x86_64/chkstk2.o \ - x86_64/floatdidf.o \ - x86_64/floatdisf.o \ - x86_64/floatdixf.o \ - x86_64/floatundidf.o \ - x86_64/floatundisf.o \ - x86_64/floatundixf.o -endif - -ifeq ($$(findstring i686,$$(patsubts i%86,i686,$(1))),i686) -COMPRT_OBJS_$(1) += \ - i386/ashldi3.o \ - i386/ashrdi3.o \ - i386/chkstk.o \ - i386/chkstk2.o \ - i386/divdi3.o \ - i386/floatdidf.o \ - i386/floatdisf.o \ - i386/floatdixf.o \ - i386/floatundidf.o \ - i386/floatundisf.o \ - i386/floatundixf.o \ - i386/lshrdi3.o \ - i386/moddi3.o \ - i386/muldi3.o \ - i386/udivdi3.o \ - i386/umoddi3.o -endif - -else - -ifeq ($$(findstring x86_64,$(1)),x86_64) -COMPRT_OBJS_$(1) += \ - x86_64/floatdidf.o \ - x86_64/floatdisf.o \ - x86_64/floatdixf.o -endif - -endif - -# Generic ARM sources, nothing compiles on iOS though -ifeq ($$(findstring arm,$(1)),arm) -ifeq ($$(findstring ios,$(1)),) -COMPRT_OBJS_$(1) += \ - arm/aeabi_cdcmp.o \ - arm/aeabi_cdcmpeq_check_nan.o \ - arm/aeabi_cfcmp.o \ - arm/aeabi_cfcmpeq_check_nan.o \ - arm/aeabi_dcmp.o \ - arm/aeabi_div0.o \ - arm/aeabi_drsub.o \ - arm/aeabi_fcmp.o \ - arm/aeabi_frsub.o \ - arm/aeabi_idivmod.o \ - arm/aeabi_ldivmod.o \ - arm/aeabi_memcmp.o \ - arm/aeabi_memcpy.o \ - arm/aeabi_memmove.o \ - arm/aeabi_memset.o \ - arm/aeabi_uidivmod.o \ - arm/aeabi_uldivmod.o \ - arm/bswapdi2.o \ - arm/bswapsi2.o \ - arm/clzdi2.o \ - arm/clzsi2.o \ - arm/comparesf2.o \ - arm/divmodsi4.o \ - arm/divsi3.o \ - arm/modsi3.o \ - arm/switch16.o \ - arm/switch32.o \ - arm/switch8.o \ - arm/switchu8.o \ - arm/sync_synchronize.o \ - arm/udivmodsi4.o \ - arm/udivsi3.o \ - arm/umodsi3.o -endif -endif - -# Thumb sources -ifeq ($$(findstring armv7,$(1)),armv7) -COMPRT_OBJS_$(1) += \ - arm/sync_fetch_and_add_4.o \ - arm/sync_fetch_and_add_8.o \ - arm/sync_fetch_and_and_4.o \ - arm/sync_fetch_and_and_8.o \ - arm/sync_fetch_and_max_4.o \ - arm/sync_fetch_and_max_8.o \ - arm/sync_fetch_and_min_4.o \ - arm/sync_fetch_and_min_8.o \ - arm/sync_fetch_and_nand_4.o \ - arm/sync_fetch_and_nand_8.o \ - arm/sync_fetch_and_or_4.o \ - arm/sync_fetch_and_or_8.o \ - arm/sync_fetch_and_sub_4.o \ - arm/sync_fetch_and_sub_8.o \ - arm/sync_fetch_and_umax_4.o \ - arm/sync_fetch_and_umax_8.o \ - arm/sync_fetch_and_umin_4.o \ - arm/sync_fetch_and_umin_8.o \ - arm/sync_fetch_and_xor_4.o \ - arm/sync_fetch_and_xor_8.o -endif - -# VFP sources -ifeq ($$(findstring eabihf,$(1)),eabihf) -COMPRT_OBJS_$(1) += \ - arm/adddf3vfp.o \ - arm/addsf3vfp.o \ - arm/divdf3vfp.o \ - arm/divsf3vfp.o \ - arm/eqdf2vfp.o \ - arm/eqsf2vfp.o \ - arm/extendsfdf2vfp.o \ - arm/fixdfsivfp.o \ - arm/fixsfsivfp.o \ - arm/fixunsdfsivfp.o \ - arm/fixunssfsivfp.o \ - arm/floatsidfvfp.o \ - arm/floatsisfvfp.o \ - arm/floatunssidfvfp.o \ - arm/floatunssisfvfp.o \ - arm/gedf2vfp.o \ - arm/gesf2vfp.o \ - arm/gtdf2vfp.o \ - arm/gtsf2vfp.o \ - arm/ledf2vfp.o \ - arm/lesf2vfp.o \ - arm/ltdf2vfp.o \ - arm/ltsf2vfp.o \ - arm/muldf3vfp.o \ - arm/mulsf3vfp.o \ - arm/negdf2vfp.o \ - arm/negsf2vfp.o \ - arm/nedf2vfp.o \ - arm/nesf2vfp.o \ - arm/restore_vfp_d8_d15_regs.o \ - arm/save_vfp_d8_d15_regs.o \ - arm/subdf3vfp.o \ - arm/subsf3vfp.o \ - arm/truncdfsf2vfp.o \ - arm/unorddf2vfp.o \ - arm/unordsf2vfp.o -endif - -$(foreach intrinsic,absvdi2.o \ - absvsi2.o \ - adddf3.o \ - addsf3.o \ - addvdi3.o \ - addvsi3.o \ - apple_versioning.o \ - ashldi3.o \ - ashrdi3.o \ - clear_cache.o \ - clzdi2.o \ - clzsi2.o \ - cmpdi2.o \ - comparedf2.o \ - comparesf2.o \ - ctzdi2.o \ - ctzsi2.o \ - divdc3.o \ - divdf3.o \ - divdi3.o \ - divmoddi4.o \ - divmodsi4.o \ - divsc3.o \ - divsf3.o \ - divsi3.o \ - divxc3.o \ - extendsfdf2.o \ - extendhfsf2.o \ - ffsdi2.o \ - fixdfdi.o \ - fixdfsi.o \ - fixsfdi.o \ - fixsfsi.o \ - fixunsdfdi.o \ - fixunsdfsi.o \ - fixunssfdi.o \ - fixunssfsi.o \ - fixunsxfdi.o \ - fixunsxfsi.o \ - fixxfdi.o \ - floatdidf.o \ - floatdisf.o \ - floatdixf.o \ - floatsidf.o \ - floatsisf.o \ - floatundidf.o \ - floatundisf.o \ - floatundixf.o \ - floatunsidf.o \ - floatunsisf.o \ - int_util.o \ - lshrdi3.o \ - moddi3.o \ - modsi3.o \ - muldc3.o \ - muldf3.o \ - muldi3.o \ - mulodi4.o \ - mulosi4.o \ - muloti4.o \ - mulsc3.o \ - mulsf3.o \ - mulvdi3.o \ - mulvsi3.o \ - mulxc3.o \ - negdf2.o \ - negdi2.o \ - negsf2.o \ - negvdi2.o \ - negvsi2.o \ - paritydi2.o \ - paritysi2.o \ - popcountdi2.o \ - popcountsi2.o \ - powidf2.o \ - powisf2.o \ - powixf2.o \ - subdf3.o \ - subsf3.o \ - subvdi3.o \ - subvsi3.o \ - truncdfhf2.o \ - truncdfsf2.o \ - truncsfhf2.o \ - ucmpdi2.o \ - udivdi3.o \ - udivmoddi4.o \ - udivmodsi4.o \ - udivsi3.o \ - umoddi3.o \ - umodsi3.o, - $(call ADD_INTRINSIC,$(1),$(intrinsic))) - -ifeq ($$(findstring ios,$(1)),) -$(foreach intrinsic,absvti2.o \ - addtf3.o \ - addvti3.o \ - ashlti3.o \ - ashrti3.o \ - clzti2.o \ - cmpti2.o \ - ctzti2.o \ - divtf3.o \ - divti3.o \ - ffsti2.o \ - fixdfti.o \ - fixsfti.o \ - fixunsdfti.o \ - fixunssfti.o \ - fixunsxfti.o \ - fixxfti.o \ - floattidf.o \ - floattisf.o \ - floattixf.o \ - floatuntidf.o \ - floatuntisf.o \ - floatuntixf.o \ - lshrti3.o \ - modti3.o \ - multf3.o \ - multi3.o \ - mulvti3.o \ - negti2.o \ - negvti2.o \ - parityti2.o \ - popcountti2.o \ - powitf2.o \ - subtf3.o \ - subvti3.o \ - trampoline_setup.o \ - ucmpti2.o \ - udivmodti4.o \ - udivti3.o \ - umodti3.o, - $(call ADD_INTRINSIC,$(1),$(intrinsic))) -endif - -ifeq ($$(findstring apple,$(1)),apple) -$(foreach intrinsic,atomic_flag_clear.o \ - atomic_flag_clear_explicit.o \ - atomic_flag_test_and_set.o \ - atomic_flag_test_and_set_explicit.o \ - atomic_signal_fence.o \ - atomic_thread_fence.o, - $(call ADD_INTRINSIC,$(1),$(intrinsic))) -endif - -ifeq ($$(findstring windows,$(1)),) -$(call ADD_INTRINSIC,$(1),emutls.o) -endif - -ifeq ($$(findstring msvc,$(1)),) - -ifeq ($$(findstring freebsd,$(1)),) -ifeq ($$(findstring netbsd,$(1)),) -$(call ADD_INTRINSIC,$(1),gcc_personality_v0.o) -endif -endif -endif - -ifeq ($$(findstring aarch64,$(1)),aarch64) -$(foreach intrinsic,comparetf2.o \ - extenddftf2.o \ - extendsftf2.o \ - fixtfdi.o \ - fixtfsi.o \ - fixtfti.o \ - fixunstfdi.o \ - fixunstfsi.o \ - fixunstfti.o \ - floatditf.o \ - floatsitf.o \ - floatunditf.o \ - floatunsitf.o \ - multc3.o \ - trunctfdf2.o \ - trunctfsf2.o, - $(call ADD_INTRINSIC,$(1),$(intrinsic))) -endif - -ifeq ($$(findstring msvc,$(1)),msvc) -$$(COMPRT_BUILD_DIR_$(1))/%.o: CFLAGS += -Zl -D__func__=__FUNCTION__ -else -$$(COMPRT_BUILD_DIR_$(1))/%.o: CFLAGS += -fno-builtin -fvisibility=hidden \ - -fomit-frame-pointer -ffreestanding -endif - -COMPRT_OBJS_$(1) := $$(COMPRT_OBJS_$(1):%=$$(COMPRT_BUILD_DIR_$(1))/%) - -$$(COMPRT_BUILD_DIR_$(1))/%.o: $(S)src/compiler-rt/lib/builtins/%.c - @mkdir -p $$(@D) - @$$(call E, compile: $$@) - $$(Q)$$(call CFG_COMPILE_C_$(1),$$@,$$<) - -$$(COMPRT_BUILD_DIR_$(1))/%.o: $(S)src/compiler-rt/lib/builtins/%.S \ - $$(LLVM_CONFIG_$$(CFG_BUILD)) - @mkdir -p $$(@D) - @$$(call E, compile: $$@) - $$(Q)$$(call CFG_ASSEMBLE_$(1),$$@,$$<) - -ifeq ($$(findstring msvc,$(1)),msvc) -$$(COMPRT_BUILD_DIR_$(1))/%.o: \ - export INCLUDE := $$(CFG_MSVC_INCLUDE_PATH_$$(HOST_$(1))) -endif - -ifeq ($$(findstring emscripten,$(1)),emscripten) -# FIXME: emscripten doesn't use compiler-rt and can't build it without -# further hacks -COMPRT_OBJS_$(1) := -endif - -$$(COMPRT_LIB_$(1)): $$(COMPRT_OBJS_$(1)) - @$$(call E, link: $$@) - $$(Q)$$(call CFG_CREATE_ARCHIVE_$(1),$$@) $$^ - -################################################################################ -# libbacktrace -# -# We use libbacktrace on linux to get symbols in backtraces, but only on linux. -# Elsewhere we use other system utilities, so this library is only built on -# linux. -################################################################################ - -BACKTRACE_NAME_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),backtrace) -BACKTRACE_LIB_$(1) := $$(RT_OUTPUT_DIR_$(1))/$$(BACKTRACE_NAME_$(1)) -BACKTRACE_BUILD_DIR_$(1) := $$(RT_OUTPUT_DIR_$(1))/libbacktrace - -# We don't use this on platforms that aren't linux-based (with the exception of -# msys2/mingw builds on windows, which use it to read the dwarf debug -# information) so just make the file available, the compilation of libstd won't -# actually build it. -ifeq ($$(findstring darwin,$$(OSTYPE_$(1))),darwin) -# See comment above -$$(BACKTRACE_LIB_$(1)): - touch $$@ - -else ifeq ($$(findstring ios,$$(OSTYPE_$(1))),ios) -# See comment above -$$(BACKTRACE_LIB_$(1)): - touch $$@ -else ifeq ($$(findstring msvc,$(1)),msvc) -# See comment above -$$(BACKTRACE_LIB_$(1)): - touch $$@ -else ifeq ($$(findstring emscripten,$(1)),emscripten) -# FIXME: libbacktrace doesn't understand the emscripten triple -$$(BACKTRACE_LIB_$(1)): - touch $$@ -else - -ifdef CFG_ENABLE_FAST_MAKE -BACKTRACE_DEPS := $(S)/.gitmodules -else -BACKTRACE_DEPS := $(wildcard $(S)src/libbacktrace/*) -endif - -# We need to export CFLAGS because otherwise it doesn't pick up cross compile -# builds. If libbacktrace doesn't realize this, it will attempt to read 64-bit -# elf headers when compiled for a 32-bit system, yielding blank backtraces. -# -# This also removes the -Werror flag specifically to prevent errors during -# configuration. -# -# Down below you'll also see echos into the config.h generated by the -# ./configure script. This is done to force libbacktrace to *not* use the -# atomic/sync functionality because it pulls in unnecessary dependencies and we -# never use it anyway. -# -# We also use `env PWD=` to clear the PWD environment variable, and then -# execute the command in a new shell. This is necessary to workaround a -# buildbot/msys2 bug: the shell is launched with PWD set to a windows-style path, -# which results in all further uses of `pwd` also printing a windows-style path, -# which breaks libbacktrace's configure script. Clearing PWD within the same -# shell is not sufficient. - -$$(BACKTRACE_BUILD_DIR_$(1))/Makefile: $$(BACKTRACE_DEPS) $$(MKFILE_DEPS) - @$$(call E, configure: libbacktrace for $(1)) - $$(Q)rm -rf $$(BACKTRACE_BUILD_DIR_$(1)) - $$(Q)mkdir -p $$(BACKTRACE_BUILD_DIR_$(1)) - $$(Q)(cd $$(BACKTRACE_BUILD_DIR_$(1)) && env \ - PWD= \ - CC="$$(CC_$(1))" \ - AR="$$(AR_$(1))" \ - RANLIB="$$(AR_$(1)) s" \ - CFLAGS="$$(CFG_GCCISH_CFLAGS_$(1)) -Wno-error -fno-stack-protector" \ - $(S)src/libbacktrace/configure --build=$(CFG_GNU_TRIPLE_$(CFG_BUILD)) --host=$(CFG_GNU_TRIPLE_$(1))) - $$(Q)echo '#undef HAVE_ATOMIC_FUNCTIONS' >> \ - $$(BACKTRACE_BUILD_DIR_$(1))/config.h - $$(Q)echo '#undef HAVE_SYNC_FUNCTIONS' >> \ - $$(BACKTRACE_BUILD_DIR_$(1))/config.h - -$$(BACKTRACE_LIB_$(1)): $$(BACKTRACE_BUILD_DIR_$(1))/Makefile $$(MKFILE_DEPS) - @$$(call E, make: libbacktrace) - $$(Q)$$(MAKE) -C $$(BACKTRACE_BUILD_DIR_$(1)) \ - INCDIR=$(S)src/libbacktrace - $$(Q)cp $$(BACKTRACE_BUILD_DIR_$(1))/.libs/libbacktrace.a $$@ - -endif - -################################################################################ -# libc/libunwind for musl -# -# When we're building a musl-like target we're going to link libc/libunwind -# statically into the standard library and liblibc, so we need to make sure -# they're in a location that we can find -################################################################################ - -ifeq ($$(findstring musl,$(1)),musl) -$$(RT_OUTPUT_DIR_$(1))/%: $$(CFG_MUSL_ROOT)/lib/% - cp $$^ $$@ -else -# Ask gcc where it is -$$(RT_OUTPUT_DIR_$(1))/%: - cp $$(shell $$(CC_$(1)) -print-file-name=$$(@F)) $$@ -endif - -endef - -# Instantiate template for all stages/targets -$(foreach target,$(CFG_TARGET), \ - $(eval $(call DEF_THIRD_PARTY_TARGETS,$(target)))) diff --git a/mk/rustllvm.mk b/mk/rustllvm.mk deleted file mode 100644 index 2d63f69960f..00000000000 --- a/mk/rustllvm.mk +++ /dev/null @@ -1,71 +0,0 @@ -# Copyright 2012 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -###################################################################### -# rustc LLVM-extensions (C++) library variables and rules -###################################################################### - -define DEF_RUSTLLVM_TARGETS - -# FIXME: Lately, on windows, llvm-config --includedir is not enough -# to find the llvm includes (probably because we're not actually installing -# llvm, but using it straight out of the build directory) -ifdef CFG_WINDOWSY_$(1) -LLVM_EXTRA_INCDIRS_$(1)= $$(call CFG_CC_INCLUDE_$(1),$(S)src/llvm/include) \ - $$(call CFG_CC_INCLUDE_$(1),\ - $$(CFG_LLVM_BUILD_DIR_$(1))/include) -endif - -RUSTLLVM_OBJS_CS_$(1) := $$(addprefix rustllvm/, \ - RustWrapper.cpp PassWrapper.cpp \ - ArchiveWrapper.cpp) - -RUSTLLVM_INCS_$(1) = $$(LLVM_EXTRA_INCDIRS_$(1)) \ - $$(call CFG_CC_INCLUDE_$(1),$$(LLVM_INCDIR_$(1))) \ - $$(call CFG_CC_INCLUDE_$(1),$$(S)src/rustllvm/include) -RUSTLLVM_OBJS_OBJS_$(1) := $$(RUSTLLVM_OBJS_CS_$(1):rustllvm/%.cpp=$(1)/rustllvm/%.o) - -# Flag that we are building with Rust's llvm fork -ifeq ($(CFG_LLVM_ROOT),) -RUSTLLVM_CXXFLAGS_$(1) := -DLLVM_RUSTLLVM -endif - -# Note that we appease `cl.exe` and its need for some sort of exception -# handling flag with the `EHsc` argument here as well. -ifeq ($$(findstring msvc,$(1)),msvc) -EXTRA_RUSTLLVM_CXXFLAGS_$(1) := //EHsc -endif - -$$(RT_OUTPUT_DIR_$(1))/$$(call CFG_STATIC_LIB_NAME_$(1),rustllvm): \ - $$(RUSTLLVM_OBJS_OBJS_$(1)) - @$$(call E, link: $$@) - $$(Q)$$(call CFG_CREATE_ARCHIVE_$(1),$$@) $$^ - -RUSTLLVM_COMPONENTS_$(1) = $$(shell echo $$(LLVM_ALL_COMPONENTS_$(1)) |\ - tr 'a-z-' 'A-Z_'| sed -e 's/^ //;s/\([^ ]*\)/\-DLLVM_COMPONENT_\1/g') - -# On MSVC we need to double-escape arguments that llvm-config printed which -# start with a '/'. The shell we're running in will auto-translate the argument -# `/foo` to `C:/msys64/foo` but we really want it to be passed through as `/foo` -# so the argument passed to our shell must be `//foo`. -$(1)/rustllvm/%.o: $(S)src/rustllvm/%.cpp $$(MKFILE_DEPS) $$(LLVM_CONFIG_$(1)) - @$$(call E, compile: $$@) - $$(Q)$$(call CFG_COMPILE_CXX_$(1), $$@,) \ - $$(subst /,//,$$(LLVM_CXXFLAGS_$(1))) \ - $$(RUSTLLVM_COMPONENTS_$(1)) \ - $$(RUSTLLVM_CXXFLAGS_$(1)) \ - $$(EXTRA_RUSTLLVM_CXXFLAGS_$(1)) \ - $$(RUSTLLVM_INCS_$(1)) \ - $$< -endef - -# Instantiate template for all stages -$(foreach host,$(CFG_HOST), \ - $(eval $(call DEF_RUSTLLVM_TARGETS,$(host)))) diff --git a/mk/stage0.mk b/mk/stage0.mk deleted file mode 100644 index 8a2bf2ebbde..00000000000 --- a/mk/stage0.mk +++ /dev/null @@ -1,49 +0,0 @@ -# Extract the snapshot host compiler - -$(HBIN0_H_$(CFG_BUILD))/: - mkdir -p $@ - -# On windows these two are the same, so cause a redifinition warning -ifneq ($(HBIN0_H_$(CFG_BUILD)),$(HLIB0_H_$(CFG_BUILD))) -$(HLIB0_H_$(CFG_BUILD))/: - mkdir -p $@ -endif - -$(SNAPSHOT_RUSTC_POST_CLEANUP): \ - $(S)src/stage0.txt \ - $(S)src/etc/local_stage0.sh \ - $(S)src/etc/get-stage0.py $(MKFILE_DEPS) \ - | $(HBIN0_H_$(CFG_BUILD))/ - @$(call E, fetch: $@) -ifdef CFG_ENABLE_LOCAL_RUST - $(Q)$(S)src/etc/local_stage0.sh $(CFG_BUILD) $(CFG_LOCAL_RUST_ROOT) rustlib -else - $(Q)$(CFG_PYTHON) $(S)src/etc/get-stage0.py $(CFG_BUILD) -endif - $(Q)if [ -e "$@" ]; then touch "$@"; else echo "ERROR: snapshot $@ not found"; exit 1; fi - -# For other targets, let the host build the target: - -define BOOTSTRAP_STAGE0 - # $(1) target to bootstrap - # $(2) stage to bootstrap from - # $(3) target to bootstrap from - -$(HBIN0_H_$(1))/: - mkdir -p $@ - -$(HLIB0_H_$(1))/: - mkdir -p $@ - -$$(HBIN0_H_$(1))/rustc$$(X_$(1)): \ - $$(TBIN$(2)_T_$(1)_H_$(3))/rustc$$(X_$(1)) \ - | $(HBIN0_H_$(1))/ - @$$(call E, cp: $$@) - $$(Q)cp $$< $$@ - -endef - -# Use stage1 to build other architectures: then you don't have to wait -# for stage2, but you get the latest updates to the compiler source. -$(foreach t,$(NON_BUILD_HOST), \ - $(eval $(call BOOTSTRAP_STAGE0,$(t),1,$(CFG_BUILD)))) diff --git a/mk/target.mk b/mk/target.mk deleted file mode 100644 index 1b139909ab4..00000000000 --- a/mk/target.mk +++ /dev/null @@ -1,209 +0,0 @@ -# Copyright 2012 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -# This is the compile-time target-triple for the compiler. For the compiler at -# runtime, this should be considered the host-triple. More explanation for why -# this exists can be found on issue #2400 -export CFG_COMPILER_HOST_TRIPLE - -# Used as defaults for the runtime ar and cc tools -export CFG_DEFAULT_LINKER -export CFG_DEFAULT_AR - -# Macro that generates the full list of dependencies for a crate at a particular -# stage/target/host tuple. -# -# $(1) - stage -# $(2) - target -# $(3) - host -# $(4) crate -define RUST_CRATE_FULLDEPS -CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4) := \ - $$(CRATEFILE_$(4)) \ - $$(RSINPUTS_$(4)) \ - $$(foreach dep,$$(RUST_DEPS_$(4)_T_$(2)), \ - $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(dep)) \ - $$(foreach dep,$$(NATIVE_DEPS_$(4)), \ - $$(RT_OUTPUT_DIR_$(2))/$$(call CFG_STATIC_LIB_NAME_$(2),$$(dep))) \ - $$(foreach dep,$$(NATIVE_DEPS_$(4)_T_$(2)), \ - $$(RT_OUTPUT_DIR_$(2))/$$(dep)) -endef - -$(foreach host,$(CFG_HOST), \ - $(foreach target,$(CFG_TARGET), \ - $(foreach stage,$(STAGES), \ - $(foreach crate,$(CRATES), \ - $(eval $(call RUST_CRATE_FULLDEPS,$(stage),$(target),$(host),$(crate))))))) - -# RUST_TARGET_STAGE_N template: This defines how target artifacts are built -# for all stage/target architecture combinations. This is one giant rule which -# works as follows: -# -# 1. The immediate dependencies are the rust source files -# 2. Each rust crate dependency is listed (based on their stamp files), -# as well as all native dependencies (listed in RT_OUTPUT_DIR) -# 3. The stage (n-1) compiler is required through the TSREQ dependency -# 4. When actually executing the rule, the first thing we do is to clean out -# old libs and rlibs via the REMOVE_ALL_OLD_GLOB_MATCHES macro -# 5. Finally, we get around to building the actual crate. It's just one -# "small" invocation of the previous stage rustc. We use -L to -# RT_OUTPUT_DIR so all the native dependencies are picked up. -# Additionally, we pass in the llvm dir so rustc can link against it. -# 6. Some cleanup is done (listing what was just built) if verbose is turned -# on. -# -# $(1) is the stage -# $(2) is the target triple -# $(3) is the host triple -# $(4) is the crate name -define RUST_TARGET_STAGE_N - -$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$(4): CFG_COMPILER_HOST_TRIPLE = $(2) -$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$(4): \ - $$(CRATEFILE_$(4)) \ - $$(CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4)) \ - $$(LLVM_CONFIG_$(2)) \ - $$(TSREQ$(1)_T_$(2)_H_$(3)) \ - | $$(TLIB$(1)_T_$(2)_H_$(3))/ - @$$(call E, rustc: $$(@D)/lib$(4)) - @touch $$@.start_time - $$(call REMOVE_ALL_OLD_GLOB_MATCHES, \ - $$(dir $$@)$$(call CFG_LIB_GLOB_$(2),$(4))) - $$(call REMOVE_ALL_OLD_GLOB_MATCHES, \ - $$(dir $$@)$$(call CFG_RLIB_GLOB,$(4))) - $(Q)CFG_LLVM_LINKAGE_FILE=$$(LLVM_LINKAGE_PATH_$(2)) \ - $$(subst @,,$$(STAGE$(1)_T_$(2)_H_$(3))) \ - $$(RUST_LIB_FLAGS_ST$(1)) \ - -L "$$(RT_OUTPUT_DIR_$(2))" \ - $$(LLVM_LIBDIR_RUSTFLAGS_$(2)) \ - $$(LLVM_STDCPP_RUSTFLAGS_$(2)) \ - $$(RUSTFLAGS_$(4)) \ - $$(RUSTFLAGS$(1)_$(4)) \ - $$(RUSTFLAGS$(1)_$(4)_T_$(2)) \ - --out-dir $$(@D) \ - -C extra-filename=-$$(CFG_FILENAME_EXTRA) \ - -C metadata=$$(CFG_FILENAME_EXTRA) \ - $$< - @touch -r $$@.start_time $$@ && rm $$@.start_time - $$(call LIST_ALL_OLD_GLOB_MATCHES, \ - $$(dir $$@)$$(call CFG_LIB_GLOB_$(2),$(4))) - $$(call LIST_ALL_OLD_GLOB_MATCHES, \ - $$(dir $$@)$$(call CFG_RLIB_GLOB,$(4))) - -endef - -# Macro for building any tool as part of the rust compilation process. Each -# tool is defined in crates.mk with a list of library dependencies as well as -# the source file for the tool. Building each tool will also be passed '--cfg -# ' for usage in driver.rs -# -# This build rule is similar to the one found above, just tweaked for -# locations and things. -# -# $(1) - stage -# $(2) - target triple -# $(3) - host triple -# $(4) - name of the tool being built -define TARGET_TOOL - -$$(TBIN$(1)_T_$(2)_H_$(3))/$(4)$$(X_$(2)): \ - $$(TOOL_SOURCE_$(4)) \ - $$(TOOL_INPUTS_$(4)) \ - $$(foreach dep,$$(TOOL_DEPS_$(4)), \ - $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(dep)) \ - $$(TSREQ$(1)_T_$(2)_H_$(3)) \ - | $$(TBIN$(1)_T_$(2)_H_$(3))/ - @$$(call E, rustc: $$@) - $$(STAGE$(1)_T_$(2)_H_$(3)) \ - $$(LLVM_LIBDIR_RUSTFLAGS_$(2)) \ - -o $$@ $$< --cfg $(4) - -endef - -# Macro for building runtime startup/shutdown object files; -# these are Rust's equivalent of crti.o, crtn.o -# -# $(1) - stage -# $(2) - target triple -# $(3) - host triple -# $(4) - object basename -define TARGET_RUSTRT_STARTUP_OBJ - -$$(TLIB$(1)_T_$(2)_H_$(3))/$(4).o: \ - $(S)src/rtstartup/$(4).rs \ - $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.core \ - $$(HSREQ$(1)_T_$(2)_H_$(3)) \ - | $$(TBIN$(1)_T_$(2)_H_$(3))/ - @$$(call E, rustc: $$@) - $$(STAGE$(1)_T_$(2)_H_$(3)) --emit=obj -o $$@ $$< - -ifeq ($$(CFG_RUSTRT_HAS_STARTUP_OBJS_$(2)), 1) -# Add dependencies on Rust startup objects to all crates that depend on core. -# This ensures that they are built after core (since they depend on it), -# but before everything else (since they are needed for linking dylib crates). -$$(foreach crate, $$(TARGET_CRATES_$(2)), \ - $$(if $$(findstring core,$$(DEPS_$$(crate))), \ - $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(crate))) : $$(TLIB$(1)_T_$(2)_H_$(3))/$(4).o -endif - -endef - -# Every recipe in RUST_TARGET_STAGE_N outputs to $$(TLIB$(1)_T_$(2)_H_$(3), -# a directory that can be cleaned out during the middle of a run of -# the get-snapshot.py script. Therefore, every recipe needs to have -# an order-only dependency either on $(SNAPSHOT_RUSTC_POST_CLEANUP) or -# on $$(TSREQ$(1)_T_$(2)_H_$(3)), to ensure that no products will be -# put into the target area until after the get-snapshot.py script has -# had its chance to clean it out; otherwise the other products will be -# inadvertently included in the clean out. -SNAPSHOT_RUSTC_POST_CLEANUP=$(HBIN0_H_$(CFG_BUILD))/rustc$(X_$(CFG_BUILD)) - -define TARGET_HOST_RULES - -$$(TLIB$(1)_T_$(2)_H_$(3))/: $$(SNAPSHOT_RUSTC_POST_CLEANUP) - mkdir -p $$@ - -$$(TBIN$(1)_T_$(2)_H_$(3))/: $$(SNAPSHOT_RUSTC_POST_CLEANUP) - mkdir -p $$@ - -$$(TLIB$(1)_T_$(2)_H_$(3))/%: $$(RT_OUTPUT_DIR_$(2))/% \ - $$(SNAPSHOT_RUSTC_POST_CLEANUP) \ - | $$(TLIB$(1)_T_$(2)_H_$(3))/ - @$$(call E, cp: $$@) - $$(Q)cp $$< $$@ -endef - -$(foreach source,$(CFG_HOST), \ - $(foreach target,$(CFG_TARGET), \ - $(eval $(call TARGET_HOST_RULES,0,$(target),$(source))) \ - $(eval $(call TARGET_HOST_RULES,1,$(target),$(source))) \ - $(eval $(call TARGET_HOST_RULES,2,$(target),$(source))) \ - $(eval $(call TARGET_HOST_RULES,3,$(target),$(source))))) - -# In principle, each host can build each target for both libs and tools -$(foreach crate,$(CRATES), \ - $(foreach source,$(CFG_HOST), \ - $(foreach target,$(CFG_TARGET), \ - $(eval $(call RUST_TARGET_STAGE_N,0,$(target),$(source),$(crate))) \ - $(eval $(call RUST_TARGET_STAGE_N,1,$(target),$(source),$(crate))) \ - $(eval $(call RUST_TARGET_STAGE_N,2,$(target),$(source),$(crate))) \ - $(eval $(call RUST_TARGET_STAGE_N,3,$(target),$(source),$(crate)))))) - -$(foreach host,$(CFG_HOST), \ - $(foreach target,$(CFG_TARGET), \ - $(foreach stage,$(STAGES), \ - $(foreach tool,$(TOOLS), \ - $(eval $(call TARGET_TOOL,$(stage),$(target),$(host),$(tool))))))) - -$(foreach host,$(CFG_HOST), \ - $(foreach target,$(CFG_TARGET), \ - $(foreach stage,$(STAGES), \ - $(foreach obj,rsbegin rsend, \ - $(eval $(call TARGET_RUSTRT_STARTUP_OBJ,$(stage),$(target),$(host),$(obj))))))) diff --git a/mk/tests.mk b/mk/tests.mk deleted file mode 100644 index 3317688f042..00000000000 --- a/mk/tests.mk +++ /dev/null @@ -1,1057 +0,0 @@ -# Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - - -###################################################################### -# Test variables -###################################################################### - -# The names of crates that must be tested - -# libcore/libstd_unicode tests are in a separate crate -DEPS_coretest := -$(eval $(call RUST_CRATE,coretest)) - -DEPS_collectionstest := -$(eval $(call RUST_CRATE,collectionstest)) - -TEST_TARGET_CRATES = $(filter-out core std_unicode alloc_system libc \ - alloc_jemalloc panic_unwind \ - panic_abort,$(TARGET_CRATES)) \ - collectionstest coretest -TEST_DOC_CRATES = $(DOC_CRATES) arena flate fmt_macros getopts graphviz \ - log rand serialize syntax term test -TEST_HOST_CRATES = $(filter-out rustc_typeck rustc_borrowck rustc_resolve \ - rustc_trans rustc_lint,\ - $(HOST_CRATES)) -TEST_CRATES = $(TEST_TARGET_CRATES) $(TEST_HOST_CRATES) - -###################################################################### -# Environment configuration -###################################################################### - -# The arguments to all test runners -ifdef TESTNAME - TESTARGS += $(TESTNAME) -endif - -ifdef CHECK_IGNORED - TESTARGS += --ignored -endif - -# Arguments to the cfail/rfail/rpass tests -ifdef CFG_VALGRIND - CTEST_RUNTOOL = --runtool "$(CFG_VALGRIND)" -endif - -CTEST_TESTARGS := $(TESTARGS) - -# --bench is only relevant for crate tests, not for the compile tests -ifdef PLEASE_BENCH - TESTARGS += --bench -endif - -ifdef VERBOSE - CTEST_TESTARGS += --verbose -endif - -# Setting locale ensures that gdb's output remains consistent. -# This prevents tests from failing with some locales (fixes #17423). -export LC_ALL=C - -TEST_LOG_FILE=tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).log -TEST_OK_FILE=tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).ok - -define DEF_TARGET_COMMANDS - -ifdef CFG_UNIXY_$(1) - CFG_RUN_TEST_$(1)=$$(TARGET_RPATH_VAR$$(2)_T_$$(3)_H_$$(4)) \ - $$(call CFG_RUN_$(1),,$$(CFG_VALGRIND) $$(1)) -endif - -ifdef CFG_WINDOWSY_$(1) - CFG_TESTLIB_$(1)=$$(CFG_BUILD_DIR)$$(2)/$$(strip \ - $$(if $$(findstring stage0,$$(1)), \ - stage0/$$(CFG_LIBDIR_RELATIVE), \ - $$(if $$(findstring stage1,$$(1)), \ - stage1/$$(CFG_LIBDIR_RELATIVE), \ - $$(if $$(findstring stage2,$$(1)), \ - stage2/$$(CFG_LIBDIR_RELATIVE), \ - $$(if $$(findstring stage3,$$(1)), \ - stage3/$$(CFG_LIBDIR_RELATIVE), \ - )))))/rustlib/$$(CFG_BUILD)/lib - CFG_RUN_TEST_$(1)=$$(TARGET_RPATH_VAR$$(2)_T_$$(3)_H_$$(4)) \ - $$(call CFG_RUN_$(1),$$(call CFG_TESTLIB_$(1),$$(1),$$(4)),$$(1)) -endif - -# Run the compiletest runner itself under valgrind -ifdef CTEST_VALGRIND -CFG_RUN_CTEST_$(1)=$$(RPATH_VAR$$(1)_T_$$(3)_H_$$(3)) \ - $$(call CFG_RUN_TEST_$$(CFG_BUILD),$$(3),$$(4)) -else -CFG_RUN_CTEST_$(1)=$$(RPATH_VAR$$(1)_T_$$(3)_H_$$(3)) \ - $$(call CFG_RUN_$$(CFG_BUILD),$$(TLIB$$(1)_T_$$(3)_H_$$(3)),$$(2)) -endif - -endef - -$(foreach target,$(CFG_TARGET), \ - $(eval $(call DEF_TARGET_COMMANDS,$(target)))) - -# Target platform specific variables for android -define DEF_ADB_DEVICE_STATUS -CFG_ADB_DEVICE_STATUS=$(1) -endef - -$(foreach target,$(CFG_TARGET), \ - $(if $(findstring android, $(target)), \ - $(if $(findstring adb,$(CFG_ADB)), \ - $(if $(findstring device,$(shell $(CFG_ADB) devices 2>/dev/null | grep -E '^[:_A-Za-z0-9-]+[[:blank:]]+device')), \ - $(info check: android device attached) \ - $(eval $(call DEF_ADB_DEVICE_STATUS, true)), \ - $(info check: android device not attached) \ - $(eval $(call DEF_ADB_DEVICE_STATUS, false)) \ - ), \ - $(info check: adb not found) \ - $(eval $(call DEF_ADB_DEVICE_STATUS, false)) \ - ), \ - ) \ -) - -ifeq ($(CFG_ADB_DEVICE_STATUS),true) -CFG_ADB_TEST_DIR=/data/tmp - -$(info check: android device test dir $(CFG_ADB_TEST_DIR) ready \ - $(shell $(CFG_ADB) remount 1>/dev/null) \ - $(shell $(CFG_ADB) shell rm -r $(CFG_ADB_TEST_DIR) >/dev/null) \ - $(shell $(CFG_ADB) shell mkdir $(CFG_ADB_TEST_DIR)) \ - $(shell $(CFG_ADB) push $(S)src/etc/adb_run_wrapper.sh $(CFG_ADB_TEST_DIR) 1>/dev/null) \ - $(foreach target,$(CFG_TARGET), \ - $(if $(findstring android, $(target)), \ - $(shell $(CFG_ADB) shell mkdir $(CFG_ADB_TEST_DIR)/$(target)) \ - $(foreach crate,$(TARGET_CRATES_$(target)), \ - $(shell $(CFG_ADB) push $(TLIB2_T_$(target)_H_$(CFG_BUILD))/$(call CFG_LIB_GLOB_$(target),$(crate)) \ - $(CFG_ADB_TEST_DIR)/$(target))), \ - ))) -else -CFG_ADB_TEST_DIR= -endif - -# $(1) - name of doc test -# $(2) - file of the test -define DOCTEST -DOC_NAMES := $$(DOC_NAMES) $(1) -DOCFILE_$(1) := $(2) -endef - -$(foreach doc,$(DOCS), \ - $(eval $(call DOCTEST,md-$(doc),$(S)src/doc/$(doc).md))) -$(foreach file,$(wildcard $(S)src/doc/book/*.md), \ - $(eval $(call DOCTEST,$(file:$(S)src/doc/book/%.md=book-%),$(file)))) -$(foreach file,$(wildcard $(S)src/doc/nomicon/*.md), \ - $(eval $(call DOCTEST,$(file:$(S)src/doc/nomicon/%.md=nomicon-%),$(file)))) -###################################################################### -# Main test targets -###################################################################### - -# The main testing target. Tests lots of stuff. -check: check-sanitycheck cleantmptestlogs cleantestlibs all check-stage2 tidy - $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log - -# As above but don't bother running tidy. -check-notidy: check-sanitycheck cleantmptestlogs cleantestlibs all check-stage2 - $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log - -# A slightly smaller set of tests for smoke testing. -check-lite: check-sanitycheck cleantestlibs cleantmptestlogs \ - $(foreach crate,$(TEST_TARGET_CRATES),check-stage2-$(crate)) \ - check-stage2-rpass check-stage2-rpass-valgrind \ - check-stage2-rfail check-stage2-cfail check-stage2-pfail check-stage2-rmake - $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log - -# Only check the 'reference' tests: rpass/cfail/rfail/rmake. -check-ref: check-sanitycheck cleantestlibs cleantmptestlogs check-stage2-rpass \ - check-stage2-rpass-valgrind check-stage2-rfail check-stage2-cfail check-stage2-pfail \ - check-stage2-rmake - $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log - -# Only check the docs. -check-docs: check-sanitycheck cleantestlibs cleantmptestlogs check-stage2-docs - $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log - -# Some less critical tests that are not prone to breakage. -# Not run as part of the normal test suite, but tested by bors on checkin. -check-secondary: check-build-compiletest check-build-lexer-verifier check-lexer check-pretty - -.PHONY: check-sanitycheck - -check-sanitycheck: - $(Q)$(CFG_PYTHON) $(S)src/etc/check-sanitycheck.py - -# check + check-secondary. -# -# Issue #17883: build check-secondary first so hidden dependencies in -# e.g. building compiletest are exercised (resolve those by adding -# deps to rules that need them; not by putting `check` first here). -check-all: check-secondary check - -# Pretty-printing tests. -check-pretty: check-stage2-T-$(CFG_BUILD)-H-$(CFG_BUILD)-pretty-exec - -define DEF_CHECK_BUILD_COMPILETEST_FOR_STAGE -check-stage$(1)-build-compiletest: $$(HBIN$(1)_H_$(CFG_BUILD))/compiletest$$(X_$(CFG_BUILD)) -endef - -$(foreach stage,$(STAGES), \ - $(eval $(call DEF_CHECK_BUILD_COMPILETEST_FOR_STAGE,$(stage)))) - -check-build-compiletest: \ - check-stage1-build-compiletest \ - check-stage2-build-compiletest - -.PHONY: cleantmptestlogs cleantestlibs - -cleantmptestlogs: - $(Q)rm -f tmp/*.log - -cleantestlibs: - $(Q)find $(CFG_BUILD)/test \ - -name '*.[odasS]' -o \ - -name '*.so' -o \ - -name '*.dylib' -o \ - -name '*.dll' -o \ - -name '*.def' -o \ - -name '*.bc' -o \ - -name '*.dSYM' -o \ - -name '*.libaux' -o \ - -name '*.out' -o \ - -name '*.err' -o \ - -name '*.debugger.script' \ - | xargs rm -rf - - -###################################################################### -# Tidy -###################################################################### - -.PHONY: tidy -tidy: $(HBIN0_H_$(CFG_BUILD))/tidy$(X_$(CFG_BUILD)) \ - $(SNAPSHOT_RUSTC_POST_CLEANUP) - $(TARGET_RPATH_VAR0_T_$(CFG_BUILD)_H_$(CFG_BUILD)) $< $(S)src - -$(HBIN0_H_$(CFG_BUILD))/tidy$(X_$(CFG_BUILD)): \ - $(TSREQ0_T_$(CFG_BUILD)_H_$(CFG_BUILD)) \ - $(TLIB0_T_$(CFG_BUILD)_H_$(CFG_BUILD))/stamp.std \ - $(call rwildcard,$(S)src/tools/tidy/src,*.rs) \ - $(SNAPSHOT_RUSTC_POST_CLEANUP) | \ - $(TLIB0_T_$(CFG_BUILD)_H_$(CFG_BUILD)) - $(STAGE0_T_$(CFG_BUILD)_H_$(CFG_BUILD)) $(S)src/tools/tidy/src/main.rs \ - --out-dir $(@D) --crate-name tidy - -###################################################################### -# Sets of tests -###################################################################### - -define DEF_TEST_SETS - -check-stage$(1)-T-$(2)-H-$(3)-exec: \ - check-stage$(1)-T-$(2)-H-$(3)-rpass-exec \ - check-stage$(1)-T-$(2)-H-$(3)-rfail-exec \ - check-stage$(1)-T-$(2)-H-$(3)-cfail-exec \ - check-stage$(1)-T-$(2)-H-$(3)-pfail-exec \ - check-stage$(1)-T-$(2)-H-$(3)-rpass-valgrind-exec \ - check-stage$(1)-T-$(2)-H-$(3)-rmake-exec \ - check-stage$(1)-T-$(2)-H-$(3)-rustdocck-exec \ - check-stage$(1)-T-$(2)-H-$(3)-crates-exec \ - check-stage$(1)-T-$(2)-H-$(3)-doc-crates-exec \ - check-stage$(1)-T-$(2)-H-$(3)-debuginfo-gdb-exec \ - check-stage$(1)-T-$(2)-H-$(3)-debuginfo-lldb-exec \ - check-stage$(1)-T-$(2)-H-$(3)-incremental-exec \ - check-stage$(1)-T-$(2)-H-$(3)-ui-exec \ - check-stage$(1)-T-$(2)-H-$(3)-doc-exec \ - check-stage$(1)-T-$(2)-H-$(3)-doc-error-index-exec \ - check-stage$(1)-T-$(2)-H-$(3)-pretty-exec \ - check-stage$(1)-T-$(2)-H-$(3)-mir-opt-exec - -ifndef CFG_DISABLE_CODEGEN_TESTS -check-stage$(1)-T-$(2)-H-$(3)-exec: \ - check-stage$(1)-T-$(2)-H-$(3)-codegen-exec \ - check-stage$(1)-T-$(2)-H-$(3)-codegen-units-exec -endif - -# Only test the compiler-dependent crates when the target is -# able to build a compiler (when the target triple is in the set of host triples) -ifneq ($$(findstring $(2),$$(CFG_HOST)),) - -check-stage$(1)-T-$(2)-H-$(3)-exec: \ - check-stage$(1)-T-$(2)-H-$(3)-rpass-full-exec \ - check-stage$(1)-T-$(2)-H-$(3)-rfail-full-exec \ - check-stage$(1)-T-$(2)-H-$(3)-cfail-full-exec - -check-stage$(1)-T-$(2)-H-$(3)-pretty-exec: \ - check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-full-exec \ - check-stage$(1)-T-$(2)-H-$(3)-pretty-rfail-full-exec - -check-stage$(1)-T-$(2)-H-$(3)-crates-exec: \ - $$(foreach crate,$$(TEST_CRATES), \ - check-stage$(1)-T-$(2)-H-$(3)-$$(crate)-exec) - -else - -check-stage$(1)-T-$(2)-H-$(3)-crates-exec: \ - $$(foreach crate,$$(TEST_TARGET_CRATES), \ - check-stage$(1)-T-$(2)-H-$(3)-$$(crate)-exec) - -endif - -check-stage$(1)-T-$(2)-H-$(3)-doc-crates-exec: \ - $$(foreach crate,$$(TEST_DOC_CRATES), \ - check-stage$(1)-T-$(2)-H-$(3)-doc-crate-$$(crate)-exec) - -check-stage$(1)-T-$(2)-H-$(3)-doc-exec: \ - $$(foreach docname,$$(DOC_NAMES), \ - check-stage$(1)-T-$(2)-H-$(3)-doc-$$(docname)-exec) \ - -check-stage$(1)-T-$(2)-H-$(3)-pretty-exec: \ - check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-exec \ - check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-valgrind-exec \ - check-stage$(1)-T-$(2)-H-$(3)-pretty-rfail-exec \ - check-stage$(1)-T-$(2)-H-$(3)-pretty-pretty-exec - -endef - -$(foreach host,$(CFG_HOST), \ - $(foreach target,$(CFG_TARGET), \ - $(foreach stage,$(STAGES), \ - $(eval $(call DEF_TEST_SETS,$(stage),$(target),$(host)))))) - - -###################################################################### -# Crate testing -###################################################################### - -define TEST_RUNNER - -# If NO_REBUILD is set then break the dependencies on everything but -# the source files so we can test crates without rebuilding any of the -# parent crates. -ifeq ($(NO_REBUILD),) -TESTDEP_$(1)_$(2)_$(3)_$(4) = $$(SREQ$(1)_T_$(2)_H_$(3)) \ - $$(foreach crate,$$(TARGET_CRATES_$(2)), \ - $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(crate)) \ - $$(CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4)) - -else -TESTDEP_$(1)_$(2)_$(3)_$(4) = $$(RSINPUTS_$(4)) -endif - -$(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2)): CFG_COMPILER_HOST_TRIPLE = $(2) -$(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2)): \ - $$(CRATEFILE_$(4)) \ - $$(TESTDEP_$(1)_$(2)_$(3)_$(4)) - @$$(call E, rustc: $$@) - $(Q)CFG_LLVM_LINKAGE_FILE=$$(LLVM_LINKAGE_PATH_$(2)) \ - $$(subst @,,$$(STAGE$(1)_T_$(2)_H_$(3))) -o $$@ $$< --test \ - -Cmetadata="test-crate" -L "$$(RT_OUTPUT_DIR_$(2))" \ - $$(LLVM_LIBDIR_RUSTFLAGS_$(2)) \ - $$(RUSTFLAGS_$(4)) - -endef - -$(foreach host,$(CFG_HOST), \ - $(eval $(foreach target,$(CFG_TARGET), \ - $(eval $(foreach stage,$(STAGES), \ - $(eval $(foreach crate,$(TEST_CRATES), \ - $(eval $(call TEST_RUNNER,$(stage),$(target),$(host),$(crate)))))))))) - -define DEF_TEST_CRATE_RULES -check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)) - -$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \ - $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2)) - @$$(call E, run: $$<) - $$(Q)touch $$@.start_time - $$(Q)$$(call CFG_RUN_TEST_$(2),$$<,$(1),$(2),$(3)) $$(TESTARGS) \ - --logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \ - $$(call CRATE_TEST_EXTRA_ARGS,$(1),$(2),$(3),$(4)) \ - && touch -r $$@.start_time $$@ && rm $$@.start_time -endef - -define DEF_TEST_CRATE_RULES_android -check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)) - -$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \ - $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2)) - @$$(call E, run: $$< via adb) - $$(Q)touch $$@.start_time - $$(Q)$(CFG_ADB) push $$< $(CFG_ADB_TEST_DIR) - $$(Q)$(CFG_ADB) shell '(cd $(CFG_ADB_TEST_DIR); LD_LIBRARY_PATH=./$(2) \ - ./$$(notdir $$<) \ - --logfile $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log \ - $$(call CRATE_TEST_EXTRA_ARGS,$(1),$(2),$(3),$(4)) $(TESTARGS))' \ - > tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp - $$(Q)cat tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp - $$(Q)touch tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).log - $$(Q)$(CFG_ADB) pull $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log tmp/ - $$(Q)$(CFG_ADB) shell rm $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log - @if grep -q "result: ok" tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \ - then \ - rm tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \ - touch -r $$@.start_time $$@ && rm $$@.start_time; \ - else \ - rm tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \ - exit 101; \ - fi -endef - -define DEF_TEST_CRATE_RULES_null -check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)) - -$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \ - $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2)) - @$$(call E, failing: no device for $$< ) - false -endef - -$(foreach host,$(CFG_HOST), \ - $(foreach target,$(CFG_TARGET), \ - $(foreach stage,$(STAGES), \ - $(foreach crate, $(TEST_CRATES), \ - $(if $(findstring $(target),$(CFG_BUILD)), \ - $(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate))), \ - $(if $(findstring android, $(target)), \ - $(if $(findstring $(CFG_ADB_DEVICE_STATUS),"true"), \ - $(eval $(call DEF_TEST_CRATE_RULES_android,$(stage),$(target),$(host),$(crate))), \ - $(eval $(call DEF_TEST_CRATE_RULES_null,$(stage),$(target),$(host),$(crate))) \ - ), \ - $(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate))) \ - )))))) - -###################################################################### -# Rules for the compiletest tests (rpass, rfail, etc.) -###################################################################### - -RPASS_RS := $(call rwildcard,$(S)src/test/run-pass/,*.rs) -RPASS_VALGRIND_RS := $(call rwildcard,$(S)src/test/run-pass-valgrind/,*.rs) -RPASS_FULL_RS := $(call rwildcard,$(S)src/test/run-pass-fulldeps/,*.rs) -RFAIL_FULL_RS := $(call rwildcard,$(S)src/test/run-fail-fulldeps/,*.rs) -CFAIL_FULL_RS := $(call rwildcard,$(S)src/test/compile-fail-fulldeps/,*.rs) -RFAIL_RS := $(call rwildcard,$(S)src/test/run-fail/,*.rs) -RFAIL_RS := $(call rwildcard,$(S)src/test/run-fail/,*.rs) -CFAIL_RS := $(call rwildcard,$(S)src/test/compile-fail/,*.rs) -PFAIL_RS := $(call rwildcard,$(S)src/test/parse-fail/,*.rs) -PRETTY_RS := $(call rwildcard,$(S)src/test/pretty/,*.rs) -DEBUGINFO_GDB_RS := $(call rwildcard,$(S)src/test/debuginfo/,*.rs) -DEBUGINFO_LLDB_RS := $(call rwildcard,$(S)src/test/debuginfo/,*.rs) -CODEGEN_RS := $(call rwildcard,$(S)src/test/codegen/,*.rs) -CODEGEN_CC := $(call rwildcard,$(S)src/test/codegen/,*.cc) -CODEGEN_UNITS_RS := $(call rwildcard,$(S)src/test/codegen-units/,*.rs) -INCREMENTAL_RS := $(call rwildcard,$(S)src/test/incremental/,*.rs) -RMAKE_RS := $(wildcard $(S)src/test/run-make/*/Makefile) -UI_RS := $(call rwildcard,$(S)src/test/ui/,*.rs) \ - $(call rwildcard,$(S)src/test/ui/,*.stdout) \ - $(call rwildcard,$(S)src/test/ui/,*.stderr) -RUSTDOCCK_RS := $(call rwildcard,$(S)src/test/rustdoc/,*.rs) -MIR_OPT_RS := $(call rwildcard,$(S)src/test/mir-opt/,*.rs) - -RPASS_TESTS := $(RPASS_RS) -RPASS_VALGRIND_TESTS := $(RPASS_VALGRIND_RS) -RPASS_FULL_TESTS := $(RPASS_FULL_RS) -RFAIL_FULL_TESTS := $(RFAIL_FULL_RS) -CFAIL_FULL_TESTS := $(CFAIL_FULL_RS) -RFAIL_TESTS := $(RFAIL_RS) -CFAIL_TESTS := $(CFAIL_RS) -PFAIL_TESTS := $(PFAIL_RS) -PRETTY_TESTS := $(PRETTY_RS) -DEBUGINFO_GDB_TESTS := $(DEBUGINFO_GDB_RS) -DEBUGINFO_LLDB_TESTS := $(DEBUGINFO_LLDB_RS) -CODEGEN_TESTS := $(CODEGEN_RS) $(CODEGEN_CC) -CODEGEN_UNITS_TESTS := $(CODEGEN_UNITS_RS) -INCREMENTAL_TESTS := $(INCREMENTAL_RS) -RMAKE_TESTS := $(RMAKE_RS) -UI_TESTS := $(UI_RS) -MIR_OPT_TESTS := $(MIR_OPT_RS) -RUSTDOCCK_TESTS := $(RUSTDOCCK_RS) - -CTEST_SRC_BASE_rpass = run-pass -CTEST_BUILD_BASE_rpass = run-pass -CTEST_MODE_rpass = run-pass -CTEST_RUNTOOL_rpass = $(CTEST_RUNTOOL) - -CTEST_SRC_BASE_rpass-valgrind = run-pass-valgrind -CTEST_BUILD_BASE_rpass-valgrind = run-pass-valgrind -CTEST_MODE_rpass-valgrind = run-pass-valgrind -CTEST_RUNTOOL_rpass-valgrind = $(CTEST_RUNTOOL) - -CTEST_SRC_BASE_rpass-full = run-pass-fulldeps -CTEST_BUILD_BASE_rpass-full = run-pass-fulldeps -CTEST_MODE_rpass-full = run-pass -CTEST_RUNTOOL_rpass-full = $(CTEST_RUNTOOL) - -CTEST_SRC_BASE_rfail-full = run-fail-fulldeps -CTEST_BUILD_BASE_rfail-full = run-fail-fulldeps -CTEST_MODE_rfail-full = run-fail -CTEST_RUNTOOL_rfail-full = $(CTEST_RUNTOOL) - -CTEST_SRC_BASE_cfail-full = compile-fail-fulldeps -CTEST_BUILD_BASE_cfail-full = compile-fail-fulldeps -CTEST_MODE_cfail-full = compile-fail -CTEST_RUNTOOL_cfail-full = $(CTEST_RUNTOOL) - -CTEST_SRC_BASE_rfail = run-fail -CTEST_BUILD_BASE_rfail = run-fail -CTEST_MODE_rfail = run-fail -CTEST_RUNTOOL_rfail = $(CTEST_RUNTOOL) - -CTEST_SRC_BASE_cfail = compile-fail -CTEST_BUILD_BASE_cfail = compile-fail -CTEST_MODE_cfail = compile-fail -CTEST_RUNTOOL_cfail = $(CTEST_RUNTOOL) - -CTEST_SRC_BASE_pfail = parse-fail -CTEST_BUILD_BASE_pfail = parse-fail -CTEST_MODE_pfail = parse-fail -CTEST_RUNTOOL_pfail = $(CTEST_RUNTOOL) - -CTEST_SRC_BASE_debuginfo-gdb = debuginfo -CTEST_BUILD_BASE_debuginfo-gdb = debuginfo-gdb -CTEST_MODE_debuginfo-gdb = debuginfo-gdb -CTEST_RUNTOOL_debuginfo-gdb = $(CTEST_RUNTOOL) - -CTEST_SRC_BASE_debuginfo-lldb = debuginfo -CTEST_BUILD_BASE_debuginfo-lldb = debuginfo-lldb -CTEST_MODE_debuginfo-lldb = debuginfo-lldb -CTEST_RUNTOOL_debuginfo-lldb = $(CTEST_RUNTOOL) - -CTEST_SRC_BASE_codegen = codegen -CTEST_BUILD_BASE_codegen = codegen -CTEST_MODE_codegen = codegen -CTEST_RUNTOOL_codegen = $(CTEST_RUNTOOL) - -CTEST_SRC_BASE_codegen-units = codegen-units -CTEST_BUILD_BASE_codegen-units = codegen-units -CTEST_MODE_codegen-units = codegen-units -CTEST_RUNTOOL_codegen-units = $(CTEST_RUNTOOL) - -CTEST_SRC_BASE_incremental = incremental -CTEST_BUILD_BASE_incremental = incremental -CTEST_MODE_incremental = incremental -CTEST_RUNTOOL_incremental = $(CTEST_RUNTOOL) - -CTEST_SRC_BASE_rmake = run-make -CTEST_BUILD_BASE_rmake = run-make -CTEST_MODE_rmake = run-make -CTEST_RUNTOOL_rmake = $(CTEST_RUNTOOL) - -CTEST_SRC_BASE_ui = ui -CTEST_BUILD_BASE_ui = ui -CTEST_MODE_ui = ui -CTEST_RUNTOOL_ui = $(CTEST_RUNTOOL) - -CTEST_SRC_BASE_mir-opt = mir-opt -CTEST_BUILD_BASE_mir-opt = mir-opt -CTEST_MODE_mir-opt = mir-opt -CTEST_RUNTOOL_mir-opt = $(CTEST_RUNTOOL) - -CTEST_SRC_BASE_rustdocck = rustdoc -CTEST_BUILD_BASE_rustdocck = rustdoc -CTEST_MODE_rustdocck = rustdoc -CTEST_RUNTOOL_rustdocck = $(CTEST_RUNTOOL) - -# CTEST_DISABLE_$(TEST_GROUP), if set, will cause the test group to be -# disabled and the associated message to be printed as a warning -# during attempts to run those tests. - -ifeq ($(CFG_GDB),) -CTEST_DISABLE_debuginfo-gdb = "no gdb found" -endif - -ifeq ($(CFG_LLDB),) -CTEST_DISABLE_debuginfo-lldb = "no lldb found" -endif - -ifneq ($(CFG_OSTYPE),apple-darwin) -CTEST_DISABLE_debuginfo-lldb = "lldb tests are only run on darwin" -endif - -ifeq ($(CFG_OSTYPE),apple-darwin) -CTEST_DISABLE_debuginfo-gdb = "gdb on darwin needs root" -endif - -ifeq ($(findstring android, $(CFG_TARGET)), android) -CTEST_DISABLE_debuginfo-gdb = -CTEST_DISABLE_debuginfo-lldb = "lldb tests are disabled on android" -endif - -ifeq ($(findstring msvc,$(CFG_TARGET)),msvc) -CTEST_DISABLE_debuginfo-gdb = "gdb tests are disabled on MSVC" -endif - -# CTEST_DISABLE_NONSELFHOST_$(TEST_GROUP), if set, will cause that -# test group to be disabled *unless* the target is able to build a -# compiler (i.e. when the target triple is in the set of host -# triples). The associated message will be printed as a warning -# during attempts to run those tests. - -define DEF_CTEST_VARS - -# All the per-stage build rules you might want to call from the -# command line. -# -# $(1) is the stage number -# $(2) is the target triple to test -# $(3) is the host triple to test - -# Prerequisites for compiletest tests -TEST_SREQ$(1)_T_$(2)_H_$(3) = \ - $$(HBIN$(1)_H_$(3))/compiletest$$(X_$(3)) \ - $$(SREQ$(1)_T_$(2)_H_$(3)) - -# Rules for the cfail/rfail/rpass test runner - -# The tests select when to use debug configuration on their own; -# remove directive, if present, from CFG_RUSTC_FLAGS (issue #7898). -CTEST_RUSTC_FLAGS := $$(subst -C debug-assertions,,$$(subst -C debug-assertions=on,,$$(CFG_RUSTC_FLAGS))) - -# The tests cannot be optimized while the rest of the compiler is optimized, so -# filter out the optimization (if any) from rustc and then figure out if we need -# to be optimized -CTEST_RUSTC_FLAGS := $$(subst -O,,$$(CTEST_RUSTC_FLAGS)) -ifndef CFG_DISABLE_OPTIMIZE_TESTS -CTEST_RUSTC_FLAGS += -O -endif - -# Analogously to the above, whether to pass `-g` when compiling tests -# is a separate choice from whether to pass `-g` when building the -# compiler and standard library themselves. -CTEST_RUSTC_FLAGS := $$(subst -g,,$$(CTEST_RUSTC_FLAGS)) -CTEST_RUSTC_FLAGS := $$(subst -Cdebuginfo=1,,$$(CTEST_RUSTC_FLAGS)) -ifdef CFG_ENABLE_DEBUGINFO_TESTS -CTEST_RUSTC_FLAGS += -g -endif - -CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) = \ - --compile-lib-path $$(HLIB$(1)_H_$(3)) \ - --run-lib-path $$(TLIB$(1)_T_$(2)_H_$(3)) \ - --rustc-path $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \ - --rustdoc-path $$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \ - --llvm-filecheck $(CFG_LLVM_INST_DIR_$(CFG_BUILD))/bin/FileCheck \ - --stage-id stage$(1)-$(2) \ - --target $(2) \ - --host $(3) \ - --docck-python $$(CFG_PYTHON) \ - --lldb-python $$(CFG_LLDB_PYTHON) \ - --gdb="$(CFG_GDB)" \ - --lldb-version="$(CFG_LLDB_VERSION)" \ - --llvm-version="$$(LLVM_VERSION_$(3))" \ - --android-cross-path=$(CFG_ARM_LINUX_ANDROIDEABI_NDK) \ - --adb-path=$(CFG_ADB) \ - --adb-test-dir=$(CFG_ADB_TEST_DIR) \ - --host-rustcflags "$(RUSTC_FLAGS_$(3)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(3))" \ - --lldb-python-dir=$(CFG_LLDB_PYTHON_DIR) \ - --target-rustcflags "$(RUSTC_FLAGS_$(2)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(2))" \ - --cc '$$(call FIND_COMPILER,$$(CC_$(2)))' \ - --cxx '$$(call FIND_COMPILER,$$(CXX_$(2)))' \ - --cflags "$$(CFG_GCCISH_CFLAGS_$(2))" \ - --llvm-components "$$(LLVM_ALL_COMPONENTS_$(2))" \ - --llvm-cxxflags "$$(LLVM_CXXFLAGS_$(2))" \ - $$(CTEST_TESTARGS) - -ifdef CFG_VALGRIND_RPASS -ifdef GOOD_VALGRIND_$(2) -CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) += --valgrind-path "$(CFG_VALGRIND_RPASS)" -endif -endif - -ifndef CFG_DISABLE_VALGRIND_RPASS -ifdef GOOD_VALGRIND_$(2) -CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) += --force-valgrind -endif -endif - -CTEST_DEPS_rpass_$(1)-T-$(2)-H-$(3) = $$(RPASS_TESTS) -CTEST_DEPS_rpass-valgrind_$(1)-T-$(2)-H-$(3) = $$(RPASS_VALGRIND_TESTS) -CTEST_DEPS_rpass-full_$(1)-T-$(2)-H-$(3) = $$(RPASS_FULL_TESTS) $$(CSREQ$(1)_T_$(3)_H_$(3)) $$(SREQ$(1)_T_$(2)_H_$(3)) -CTEST_DEPS_rfail-full_$(1)-T-$(2)-H-$(3) = $$(RFAIL_FULL_TESTS) $$(CSREQ$(1)_T_$(3)_H_$(3)) $$(SREQ$(1)_T_$(2)_H_$(3)) -CTEST_DEPS_cfail-full_$(1)-T-$(2)-H-$(3) = $$(CFAIL_FULL_TESTS) $$(CSREQ$(1)_T_$(3)_H_$(3)) $$(SREQ$(1)_T_$(2)_H_$(3)) -CTEST_DEPS_rfail_$(1)-T-$(2)-H-$(3) = $$(RFAIL_TESTS) -CTEST_DEPS_cfail_$(1)-T-$(2)-H-$(3) = $$(CFAIL_TESTS) -CTEST_DEPS_pfail_$(1)-T-$(2)-H-$(3) = $$(PFAIL_TESTS) -CTEST_DEPS_debuginfo-gdb_$(1)-T-$(2)-H-$(3) = $$(DEBUGINFO_GDB_TESTS) -CTEST_DEPS_debuginfo-lldb_$(1)-T-$(2)-H-$(3) = $$(DEBUGINFO_LLDB_TESTS) \ - $(S)src/etc/lldb_batchmode.py \ - $(S)src/etc/lldb_rust_formatters.py -CTEST_DEPS_codegen_$(1)-T-$(2)-H-$(3) = $$(CODEGEN_TESTS) -CTEST_DEPS_codegen-units_$(1)-T-$(2)-H-$(3) = $$(CODEGEN_UNITS_TESTS) -CTEST_DEPS_incremental_$(1)-T-$(2)-H-$(3) = $$(INCREMENTAL_TESTS) -CTEST_DEPS_rmake_$(1)-T-$(2)-H-$(3) = $$(RMAKE_TESTS) \ - $$(CSREQ$(1)_T_$(3)_H_$(3)) $$(SREQ$(1)_T_$(2)_H_$(3)) -CTEST_DEPS_ui_$(1)-T-$(2)-H-$(3) = $$(UI_TESTS) -CTEST_DEPS_mir-opt_$(1)-T-$(2)-H-$(3) = $$(MIR_OPT_TESTS) -CTEST_DEPS_rustdocck_$(1)-T-$(2)-H-$(3) = $$(RUSTDOCCK_TESTS) \ - $$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \ - $$(CSREQ$(1)_T_$(3)_H_$(3)) \ - $$(SREQ$(1)_T_$(3)_H_$(3)) \ - $(S)src/etc/htmldocck.py - -endef - -$(foreach host,$(CFG_HOST), \ - $(eval $(foreach target,$(CFG_TARGET), \ - $(eval $(foreach stage,$(STAGES), \ - $(eval $(call DEF_CTEST_VARS,$(stage),$(target),$(host)))))))) - -define DEF_RUN_COMPILETEST - -CTEST_ARGS$(1)-T-$(2)-H-$(3)-$(4) = \ - $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \ - --src-base $$(S)src/test/$$(CTEST_SRC_BASE_$(4))/ \ - --build-base $(3)/test/$$(CTEST_BUILD_BASE_$(4))/ \ - --mode $$(CTEST_MODE_$(4)) \ - $$(CTEST_RUNTOOL_$(4)) - -check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)) - -# CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4) -# Goal: leave this variable as empty string if we should run the test. -# Otherwise, set it to the reason we are not running the test. -# (Encoded as a separate variable because GNU make does not have a -# good way to express OR on ifeq commands) - -ifneq ($$(CTEST_DISABLE_$(4)),) -# Test suite is disabled for all configured targets. -CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4) := $$(CTEST_DISABLE_$(4)) -else -# else, check if non-self-hosted target (i.e. target not-in hosts) ... -ifeq ($$(findstring $(2),$$(CFG_HOST)),) -# ... if so, then check if this test suite is disabled for non-selfhosts. -ifneq ($$(CTEST_DISABLE_NONSELFHOST_$(4)),) -# Test suite is disabled for this target. -CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4) := $$(CTEST_DISABLE_NONSELFHOST_$(4)) -endif -endif -# Neither DISABLE nor DISABLE_NONSELFHOST is set ==> okay, run the test. -endif - -ifeq ($$(CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4)),) -$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \ - export INCLUDE := $$(CFG_MSVC_INCLUDE_PATH_$$(HOST_$(3))) -$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \ - export LIB := $$(CFG_MSVC_LIB_PATH_$$(HOST_$(3))) -$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \ - $$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \ - $$(CTEST_DEPS_$(4)_$(1)-T-$(2)-H-$(3)) - @$$(call E, run $(4) [$(2)]: $$<) - $$(Q)touch $$@.start_time - $$(Q)$$(call CFG_RUN_CTEST_$(2),$(1),$$<,$(3)) \ - $$(CTEST_ARGS$(1)-T-$(2)-H-$(3)-$(4)) \ - --logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \ - && touch -r $$@.start_time $$@ && rm $$@.start_time - -else - -$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): - @$$(call E, run $(4) [$(2)]: $$<) - @$$(call E, warning: tests disabled: $$(CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4))) - touch $$@ - -endif - -endef - -CTEST_NAMES = rpass rpass-valgrind rpass-full rfail-full cfail-full rfail cfail pfail \ - debuginfo-gdb debuginfo-lldb codegen codegen-units rustdocck incremental \ - rmake ui mir-opt - -$(foreach host,$(CFG_HOST), \ - $(eval $(foreach target,$(CFG_TARGET), \ - $(eval $(foreach stage,$(STAGES), \ - $(eval $(foreach name,$(CTEST_NAMES), \ - $(eval $(call DEF_RUN_COMPILETEST,$(stage),$(target),$(host),$(name)))))))))) - -PRETTY_NAMES = pretty-rpass pretty-rpass-valgrind pretty-rpass-full pretty-rfail-full pretty-rfail \ - pretty-pretty -PRETTY_DEPS_pretty-rpass = $(RPASS_TESTS) -PRETTY_DEPS_pretty-rpass-valgrind = $(RPASS_VALGRIND_TESTS) -PRETTY_DEPS_pretty-rpass-full = $(RPASS_FULL_TESTS) -PRETTY_DEPS_pretty-rfail-full = $(RFAIL_FULL_TESTS) -PRETTY_DEPS_pretty-rfail = $(RFAIL_TESTS) -PRETTY_DEPS_pretty-pretty = $(PRETTY_TESTS) -PRETTY_DIRNAME_pretty-rpass = run-pass -PRETTY_DIRNAME_pretty-rpass-valgrind = run-pass-valgrind -PRETTY_DIRNAME_pretty-rpass-full = run-pass-fulldeps -PRETTY_DIRNAME_pretty-rfail-full = run-fail-fulldeps -PRETTY_DIRNAME_pretty-rfail = run-fail -PRETTY_DIRNAME_pretty-pretty = pretty - -define DEF_PRETTY_FULLDEPS -PRETTY_DEPS$(1)_T_$(2)_H_$(3)_pretty-rpass-full = $$(CSREQ$(1)_T_$(3)_H_$(3)) -PRETTY_DEPS$(1)_T_$(2)_H_$(3)_pretty-rfail-full = $$(CSREQ$(1)_T_$(3)_H_$(3)) -endef - -$(foreach host,$(CFG_HOST), \ - $(foreach target,$(CFG_TARGET), \ - $(foreach stage,$(STAGES), \ - $(eval $(call DEF_PRETTY_FULLDEPS,$(stage),$(target),$(host)))))) - -define DEF_RUN_PRETTY_TEST - -PRETTY_ARGS$(1)-T-$(2)-H-$(3)-$(4) = \ - $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \ - --src-base $$(S)src/test/$$(PRETTY_DIRNAME_$(4))/ \ - --build-base $(3)/test/$$(PRETTY_DIRNAME_$(4))/ \ - --mode pretty - -check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)) - -$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \ - $$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \ - $$(PRETTY_DEPS_$(4)) \ - $$(PRETTY_DEPS$(1)_T_$(2)_H_$(3)_$(4)) - @$$(call E, run pretty-rpass [$(2)]: $$<) - $$(Q)touch $$@.start_time - $$(Q)$$(call CFG_RUN_CTEST_$(2),$(1),$$<,$(3)) \ - $$(PRETTY_ARGS$(1)-T-$(2)-H-$(3)-$(4)) \ - --logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \ - && touch -r $$@.start_time $$@ && rm $$@.start_time - -endef - -$(foreach host,$(CFG_HOST), \ - $(foreach target,$(CFG_TARGET), \ - $(foreach stage,$(STAGES), \ - $(foreach pretty-name,$(PRETTY_NAMES), \ - $(eval $(call DEF_RUN_PRETTY_TEST,$(stage),$(target),$(host),$(pretty-name))))))) - - -###################################################################### -# Crate & freestanding documentation tests -###################################################################### - -define DEF_RUSTDOC -RUSTDOC_EXE_$(1)_T_$(2)_H_$(3) := $$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) -RUSTDOC_$(1)_T_$(2)_H_$(3) := $$(RPATH_VAR$(1)_T_$(2)_H_$(3)) $$(RUSTDOC_EXE_$(1)_T_$(2)_H_$(3)) -endef - -$(foreach host,$(CFG_HOST), \ - $(foreach target,$(CFG_TARGET), \ - $(foreach stage,$(STAGES), \ - $(eval $(call DEF_RUSTDOC,$(stage),$(target),$(host)))))) - -# Freestanding - -define DEF_DOC_TEST - -check-stage$(1)-T-$(2)-H-$(3)-doc-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4)) - -# If NO_REBUILD is set then break the dependencies on everything but -# the source files so we can test documentation without rebuilding -# rustdoc etc. -ifeq ($(NO_REBUILD),) -DOCTESTDEP_$(1)_$(2)_$(3)_$(4) = \ - $$(DOCFILE_$(4)) \ - $$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \ - $$(RUSTDOC_EXE_$(1)_T_$(2)_H_$(3)) -else -DOCTESTDEP_$(1)_$(2)_$(3)_$(4) = $$(DOCFILE_$(4)) -endif - -ifeq ($(2),$$(CFG_BUILD)) -$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4)): $$(DOCTESTDEP_$(1)_$(2)_$(3)_$(4)) - @$$(call E, run doc-$(4) [$(2)]) - $$(Q)touch $$@.start_time - $$(Q)$$(RUSTDOC_$(1)_T_$(2)_H_$(3)) --cfg dox --test $$< \ - --test-args "$$(TESTARGS)" && \ - touch -r $$@.start_time $$@ && rm $$@.start_time -else -$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4)): - touch $$@ -endif -endef - -$(foreach host,$(CFG_HOST), \ - $(foreach target,$(CFG_TARGET), \ - $(foreach stage,$(STAGES), \ - $(foreach docname,$(DOC_NAMES), \ - $(eval $(call DEF_DOC_TEST,$(stage),$(target),$(host),$(docname))))))) - -# Crates - -define DEF_CRATE_DOC_TEST - -# If NO_REBUILD is set then break the dependencies on everything but -# the source files so we can test crate documentation without -# rebuilding any of the parent crates. -ifeq ($(NO_REBUILD),) -CRATEDOCTESTDEP_$(1)_$(2)_$(3)_$(4) = \ - $$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \ - $$(CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4)) \ - $$(RUSTDOC_EXE_$(1)_T_$(2)_H_$(3)) -else -CRATEDOCTESTDEP_$(1)_$(2)_$(3)_$(4) = $$(RSINPUTS_$(4)) -endif - -check-stage$(1)-T-$(2)-H-$(3)-doc-crate-$(4)-exec: \ - $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4)) - -ifeq ($(2),$$(CFG_BUILD)) -$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4)): $$(CRATEDOCTESTDEP_$(1)_$(2)_$(3)_$(4)) - @$$(call E, run doc-crate-$(4) [$(2)]) - $$(Q)touch $$@.start_time - $$(Q)CFG_LLVM_LINKAGE_FILE=$$(LLVM_LINKAGE_PATH_$(2)) \ - $$(RUSTDOC_$(1)_T_$(2)_H_$(3)) --test --cfg dox \ - $$(CRATEFILE_$(4)) --test-args "$$(TESTARGS)" && \ - touch -r $$@.start_time $$@ && rm $$@.start_time -else -$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4)): - touch $$@ -endif - -endef - -$(foreach host,$(CFG_HOST), \ - $(foreach target,$(CFG_TARGET), \ - $(foreach stage,$(STAGES), \ - $(foreach crate,$(TEST_DOC_CRATES), \ - $(eval $(call DEF_CRATE_DOC_TEST,$(stage),$(target),$(host),$(crate))))))) - -define DEF_DOC_TEST_ERROR_INDEX - -check-stage$(1)-T-$(2)-H-$(3)-doc-error-index-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-error-index) - -ifeq ($(2),$$(CFG_BUILD)) -$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-error-index): \ - $$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \ - doc/error-index.md - $$(Q)touch $$@.start_time - $$(RUSTDOC_$(1)_T_$(2)_H_$(3)) --test doc/error-index.md - $$(Q)touch -r $$@.start_time $$@ && rm $$@.start_time -else -$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-error-index): - $$(Q)touch $$@ -endif -endef - -$(foreach host,$(CFG_HOST), \ - $(foreach target,$(CFG_TARGET), \ - $(foreach stage,$(STAGES), \ - $(eval $(call DEF_DOC_TEST_ERROR_INDEX,$(stage),$(target),$(host)))))) - -###################################################################### -# Shortcut rules -###################################################################### - -TEST_GROUPS = \ - crates \ - $(foreach crate,$(TEST_CRATES),$(crate)) \ - $(foreach crate,$(TEST_DOC_CRATES),doc-crate-$(crate)) \ - rpass \ - rpass-valgrind \ - rpass-full \ - rfail-full \ - cfail-full \ - rfail \ - cfail \ - pfail \ - rmake \ - rustdocck \ - debuginfo-gdb \ - debuginfo-lldb \ - codegen \ - codegen-units \ - incremental \ - ui \ - doc \ - $(foreach docname,$(DOC_NAMES),doc-$(docname)) \ - pretty \ - pretty-rpass \ - pretty-rpass-valgrind \ - pretty-rpass-full \ - pretty-rfail-full \ - pretty-rfail \ - pretty-pretty \ - mir-opt \ - $(NULL) - -define DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST -check-stage$(1)-T-$(2)-H-$(3): check-stage$(1)-T-$(2)-H-$(3)-exec -endef - -$(foreach stage,$(STAGES), \ - $(foreach target,$(CFG_TARGET), \ - $(foreach host,$(CFG_HOST), \ - $(eval $(call DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST,$(stage),$(target),$(host)))))) - -define DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST_AND_GROUP -check-stage$(1)-T-$(2)-H-$(3)-$(4): check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec -endef - -$(foreach stage,$(STAGES), \ - $(foreach target,$(CFG_TARGET), \ - $(foreach host,$(CFG_HOST), \ - $(foreach group,$(TEST_GROUPS), \ - $(eval $(call DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST_AND_GROUP,$(stage),$(target),$(host),$(group))))))) - -define DEF_CHECK_FOR_STAGE -check-stage$(1): check-stage$(1)-H-$$(CFG_BUILD) -check-stage$(1)-H-all: $$(foreach target,$$(CFG_TARGET), \ - check-stage$(1)-H-$$(target)) -endef - -$(foreach stage,$(STAGES), \ - $(eval $(call DEF_CHECK_FOR_STAGE,$(stage)))) - -define DEF_CHECK_FOR_STAGE_AND_GROUP -check-stage$(1)-$(2): check-stage$(1)-H-$$(CFG_BUILD)-$(2) -check-stage$(1)-H-all-$(2): $$(foreach target,$$(CFG_TARGET), \ - check-stage$(1)-H-$$(target)-$(2)) -endef - -$(foreach stage,$(STAGES), \ - $(foreach group,$(TEST_GROUPS), \ - $(eval $(call DEF_CHECK_FOR_STAGE_AND_GROUP,$(stage),$(group))))) - - -define DEF_CHECK_FOR_STAGE_AND_HOSTS -check-stage$(1)-H-$(2): $$(foreach target,$$(CFG_TARGET), \ - check-stage$(1)-T-$$(target)-H-$(2)) -endef - -$(foreach stage,$(STAGES), \ - $(foreach host,$(CFG_HOST), \ - $(eval $(call DEF_CHECK_FOR_STAGE_AND_HOSTS,$(stage),$(host))))) - -define DEF_CHECK_FOR_STAGE_AND_HOSTS_AND_GROUP -check-stage$(1)-H-$(2)-$(3): $$(foreach target,$$(CFG_TARGET), \ - check-stage$(1)-T-$$(target)-H-$(2)-$(3)) -endef - -$(foreach stage,$(STAGES), \ - $(foreach host,$(CFG_HOST), \ - $(foreach group,$(TEST_GROUPS), \ - $(eval $(call DEF_CHECK_FOR_STAGE_AND_HOSTS_AND_GROUP,$(stage),$(host),$(group)))))) - -define DEF_CHECK_DOC_FOR_STAGE -check-stage$(1)-docs: $$(foreach docname,$$(DOC_NAMES), \ - check-stage$(1)-T-$$(CFG_BUILD)-H-$$(CFG_BUILD)-doc-$$(docname)) \ - $$(foreach crate,$$(TEST_DOC_CRATES), \ - check-stage$(1)-T-$$(CFG_BUILD)-H-$$(CFG_BUILD)-doc-crate-$$(crate)) \ - check-stage$(1)-T-$$(CFG_BUILD)-H-$$(CFG_BUILD)-doc-error-index-exec -endef - -$(foreach stage,$(STAGES), \ - $(eval $(call DEF_CHECK_DOC_FOR_STAGE,$(stage)))) - -define DEF_CHECK_CRATE -check-$(1): check-stage2-T-$$(CFG_BUILD)-H-$$(CFG_BUILD)-$(1)-exec -endef - -$(foreach crate,$(TEST_CRATES), \ - $(eval $(call DEF_CHECK_CRATE,$(crate)))) diff --git a/mk/util.mk b/mk/util.mk deleted file mode 100644 index 918484ac463..00000000000 --- a/mk/util.mk +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright 2014 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -ifdef VERBOSE - Q := - E = -else - Q := @ - E = echo $(1) -endif - -print-%: - @echo $*=$($*) - -S := $(CFG_SRC_DIR) -SREL := $(CFG_SRC_DIR_RELATIVE) From 9b0e6af11026ea2e4bd9464d83382ac0b5fe0bba Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 23 Jan 2017 15:47:43 -0800 Subject: [PATCH 35/70] Delete swaths of the configure script This commit deletes swaths of the configure script related to the old build system which are now no longer needed when using rustbuild. --- configure | 858 +----------------------------------------------------- 1 file changed, 2 insertions(+), 856 deletions(-) diff --git a/configure b/configure index 4ce80a5e849..4790ce66044 100755 --- a/configure +++ b/configure @@ -993,191 +993,12 @@ then putvar CFG_LOCAL_RUST_ROOT fi -# Force bitrig to build with clang; gcc doesn't like us there -if [ $CFG_OSTYPE = unknown-bitrig ] -then - step_msg "on Bitrig, forcing use of clang" - CFG_ENABLE_CLANG=1 -fi - -# default gcc version under OpenBSD maybe too old, try using egcc, which is a -# gcc version from ports -if [ $CFG_OSTYPE = unknown-openbsd ] -then - if [ $("$CFG_GCC" --version 2>&1 | grep -c ' 4\.[0-6]') -ne 0 ]; then - step_msg "older GCC found, try with egcc instead" - - # probe again but using egcc - probe CFG_GCC egcc - - # and use egcc/eg++ for CC/CXX too if it was found - # (but user setting has priority) - if [ -n "$CFG_GCC" ]; then - CC="${CC:-egcc}" - CXX="${CXX:-eg++}" - fi - fi -fi - -# OS X 10.9, gcc is actually clang. This can cause some confusion in the build -# system, so if we find that gcc is clang, we should just use clang directly. -if [ $CFG_OSTYPE = apple-darwin -a -z "$CFG_ENABLE_CLANG" ] -then - CFG_OSX_GCC_VERSION=$("$CFG_GCC" --version 2>&1 | grep "Apple LLVM version") - if [ $? -eq 0 ] - then - step_msg "on OS X >=10.9, forcing use of clang" - CFG_ENABLE_CLANG=1 - else - if [ $("$CFG_GCC" --version 2>&1 | grep -c ' 4\.[0-6]') -ne 0 ]; then - step_msg "older GCC found, using clang instead" - CFG_ENABLE_CLANG=1 - else - # on OS X, with xcode 5 and newer, certain developers may have - # cc, gcc and g++ point to a mixture of clang and gcc - # if so, this will create very strange build errors - # this last stanza is to detect some such problems and save the future rust - # contributor some time solving that issue. - # this detection could be generalized to other OSes aside from OS X - # but the issue seems most likely to happen on OS X - - chk_cc () { - $1 --version 2> /dev/null | grep -q $2 - } - # check that gcc, cc and g++ all point to the same compiler. - # note that for xcode 5, g++ points to clang, not clang++ - if !((chk_cc gcc clang && chk_cc g++ clang) || - (chk_cc gcc gcc &&( chk_cc g++ g++ || chk g++ gcc))); then - err "the gcc and g++ in your path point to different compilers. - Check which versions are in your path with gcc --version and g++ --version. - To resolve this problem, either fix your PATH or run configure with --enable-clang" - fi - - fi - fi -fi - -# If the clang isn't already enabled, check for GCC, and if it is missing, turn -# on clang as a backup. -if [ -z "$CFG_ENABLE_CLANG" ] -then - CFG_GCC_VERSION=$("$CFG_GCC" --version 2>&1) - if [ $? -ne 0 ] - then - step_msg "GCC not installed, will try using Clang" - CFG_ENABLE_CLANG=1 - fi -fi - -# Okay, at this point, we have made up our minds about whether we are -# going to force CFG_ENABLE_CLANG or not; save the setting if so. -if [ -n "$CFG_ENABLE_CLANG" ] -then - putvar CFG_ENABLE_CLANG -fi - -if [ -z "$CFG_DISABLE_LIBCPP" -a -n "$CFG_ENABLE_CLANG" ] -then - CFG_USING_LIBCPP="1" -else - CFG_USING_LIBCPP="0" -fi - # Same with jemalloc. save the setting here. if [ -n "$CFG_DISABLE_JEMALLOC" ] then putvar CFG_DISABLE_JEMALLOC fi -if [ -n "$CFG_LLVM_ROOT" -a -z "$CFG_DISABLE_LLVM_VERSION_CHECK" -a -e "$CFG_LLVM_ROOT/bin/llvm-config" ] -then - step_msg "using custom LLVM at $CFG_LLVM_ROOT" - - LLVM_CONFIG="$CFG_LLVM_ROOT/bin/llvm-config" - LLVM_VERSION=$($LLVM_CONFIG --version) - - case $LLVM_VERSION in - (3.[7-9]*) - msg "found ok version of LLVM: $LLVM_VERSION" - ;; - (*) - err "bad LLVM version: $LLVM_VERSION, need >=3.7" - ;; - esac - - if "$CFG_LLVM_ROOT/bin/llvm-mc" -help | grep -- "-relocation-model"; then - msg "found older llvm-mc" - CFG_LLVM_MC_HAS_RELOCATION_MODEL=1 - putvar CFG_LLVM_MC_HAS_RELOCATION_MODEL - fi -fi - -# Even when the user overrides the choice of CC, still try to detect -# clang to disable some clang-specific warnings. We here draw a -# distinction between: -# -# CFG_ENABLE_CLANG : passed --enable-clang, or host "requires" clang, -# CFG_USING_CLANG : compiler (clang / gcc / $CC) looks like clang. -# -# This distinction is important because there are some safeguards we -# would prefer to skip when merely CFG_USING_CLANG is set; but when -# CFG_ENABLE_CLANG is set, that indicates that we are opting into -# running such safeguards. - -if [ -n "$CC" ] -then - msg "skipping compiler inference steps; using provided CC=$CC" - CFG_CC="$CC" - - CFG_OSX_CC_VERSION=$("$CFG_CC" --version 2>&1 | grep "clang") - if [ $? -eq 0 ] - then - step_msg "note, user-provided CC looks like clang; CC=$CC." - CFG_USING_CLANG=1 - putvar CFG_USING_CLANG - fi -else - if [ -n "$CFG_ENABLE_CLANG" ] - then - if [ -z "$CFG_CLANG" ] - then - err "clang requested but not found" - fi - CFG_CC="$CFG_CLANG" - CFG_USING_CLANG=1 - putvar CFG_USING_CLANG - else - CFG_CC="gcc" - fi -fi - -if [ -n "$CFG_ENABLE_CLANG" ] -then - case "$CC" in - (''|*clang) - if [ -z "$CC" ] - then - CFG_CC="clang" - CFG_CXX="clang++" - fi - esac -fi - -if [ -n "$CFG_ENABLE_CCACHE" ] -then - if [ -z "$CFG_CCACHE" ] - then - err "ccache requested but not found" - fi - - CFG_CC="ccache $CFG_CC" -fi - -if [ -z "$CC" -a -z "$CFG_ENABLE_CLANG" -a -z "$CFG_GCC" ] -then - err "either clang or gcc is required" -fi - # All safeguards based on $CFG_ENABLE_CLANG should occur before this # point in the script; after this point, script logic should inspect # $CFG_USING_CLANG rather than $CFG_ENABLE_CLANG. @@ -1190,12 +1011,6 @@ envopt CFLAGS envopt CXXFLAGS envopt LDFLAGS -# stdc++ name in use -# used to manage non-standard name (on OpenBSD for example) -program_transform_name=$($CFG_CC -v 2>&1 | sed -n "s/.*--program-transform-name='\([^']*\)'.*/\1/p") -CFG_STDCPP_NAME=$(echo "stdc++" | sed "${program_transform_name}") -putvar CFG_STDCPP_NAME - # a little post-processing of various config values CFG_PREFIX=${CFG_PREFIX%/} CFG_MANDIR=${CFG_MANDIR%/} @@ -1223,651 +1038,6 @@ do done CFG_TARGET=$V_TEMP -# check target-specific tool-chains -for i in $CFG_TARGET -do - L_CHECK=false - for j in $CFG_SUPPORTED_TARGET - do - if [ $i = $j ] - then - L_CHECK=true - fi - done - - if [ $L_CHECK = false ] - then - err "unsupported target triples \"$i\" found" - fi - - case $i in - *android*) - case $i in - armv7-linux-androideabi) - cmd_prefix="arm-linux-androideabi" - ;; - *) - cmd_prefix=$i - ;; - esac - - upper_snake_target=$(echo "$i" | tr '[:lower:]' '[:upper:]' | tr '\-' '\_') - eval ndk=\$"CFG_${upper_snake_target}_NDK" - if [ -z "$ndk" ] - then - ndk=$CFG_ANDROID_CROSS_PATH - eval "CFG_${upper_snake_target}_NDK"=$CFG_ANDROID_CROSS_PATH - warn "generic/default Android NDK option is deprecated (use --$i-ndk option instead)" - fi - - # Perform a basic sanity check of the NDK - for android_ndk_tool in "$ndk/bin/$cmd_prefix-gcc" "$ndk/bin/$cmd_prefix-g++" "$ndk/bin/$cmd_prefix-ar" - do - if [ ! -f $android_ndk_tool ] - then - err "NDK tool $android_ndk_tool not found (bad or missing --$i-ndk option?)" - fi - done - ;; - *-unknown-nacl) - if [ -z "$CFG_NACL_CROSS_PATH" ] - then - err "I need the NaCl SDK path! (use --nacl-cross-path)" - fi - ;; - arm-apple-darwin) - if [ $CFG_OSTYPE != apple-darwin ] - then - err "The iOS target is only supported on Mac OS X" - fi - ;; - - *-msvc) - # There are three builds of cmake on windows: MSVC, MinGW and Cygwin - # The Cygwin build does not have generators for Visual Studio, so - # detect that here and error. - if ! "$CFG_CMAKE" --help | sed -n '/^Generators/,$p' | grep 'Visual Studio' > /dev/null - then - err " - -cmake does not support Visual Studio generators. - -This is likely due to it being an msys/cygwin build of cmake, \ -rather than the required windows version, built using MinGW \ -or Visual Studio. - -If you are building under msys2 try installing the mingw-w64-x86_64-cmake \ -package instead of cmake: - -$ pacman -R cmake && pacman -S mingw-w64-x86_64-cmake -" - fi - - # Use the REG program to figure out where VS is installed - # We need to figure out where cl.exe and link.exe are, so we do some - # munging and some probing here. We also look for the default - # INCLUDE and LIB variables for MSVC so we can set those in the - # build system as well. - install=$(cmd //c reg QUERY \ - 'HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0' \ - -v InstallDir) - if [ -z "$install" ]; then - install=$(cmd //c reg QUERY \ - 'HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\12.0' \ - -v InstallDir) - fi - need_ok "couldn't find visual studio install root" - CFG_MSVC_ROOT=$(echo "$install" | grep InstallDir | sed 's/.*REG_SZ[ ]*//') - CFG_MSVC_ROOT=$(dirname "$CFG_MSVC_ROOT") - CFG_MSVC_ROOT=$(dirname "$CFG_MSVC_ROOT") - putvar CFG_MSVC_ROOT - - case $i in - x86_64-*) - bits=x86_64 - msvc_part=amd64 - ;; - i*86-*) - bits=i386 - msvc_part= - ;; - *) - err "can only target x86 targets for MSVC" - ;; - esac - bindir="${CFG_MSVC_ROOT}/VC/bin" - if [ -n "$msvc_part" ]; then - bindir="$bindir/$msvc_part" - fi - eval CFG_MSVC_BINDIR_$bits="\"$bindir\"" - eval CFG_MSVC_CL_$bits="\"$bindir/cl.exe\"" - eval CFG_MSVC_LIB_$bits="\"$bindir/lib.exe\"" - eval CFG_MSVC_LINK_$bits="\"$bindir/link.exe\"" - - vcvarsall="${CFG_MSVC_ROOT}/VC/vcvarsall.bat" - include_path=$(cmd //V:ON //c "$vcvarsall" $msvc_part \& echo !INCLUDE!) - need_ok "failed to learn about MSVC's INCLUDE" - lib_path=$(cmd //V:ON //c "$vcvarsall" $msvc_part \& echo !LIB!) - need_ok "failed to learn about MSVC's LIB" - - eval CFG_MSVC_INCLUDE_PATH_${bits}="\"$include_path\"" - eval CFG_MSVC_LIB_PATH_${bits}="\"$lib_path\"" - - putvar CFG_MSVC_BINDIR_${bits} - putvar CFG_MSVC_CL_${bits} - putvar CFG_MSVC_LIB_${bits} - putvar CFG_MSVC_LINK_${bits} - putvar CFG_MSVC_INCLUDE_PATH_${bits} - putvar CFG_MSVC_LIB_PATH_${bits} - ;; - - *) - ;; - esac -done - -if [ "$CFG_OSTYPE" = "pc-windows-gnu" ] || [ "$CFG_OSTYPE" = "pc-windows-msvc" ] -then - # There are some MSYS python builds which will auto-translate - # windows-style paths to MSYS-style paths in Python itself. - # Unfortunately this breaks LLVM's build system as somewhere along - # the line LLVM prints a path into a file from Python and then CMake - # later tries to interpret that path. If Python prints a MSYS path - # and CMake tries to use it as a Windows path, you're gonna have a - # Bad Time. - # - # Consequently here we try to detect when that happens and print an - # error if it does. - if $CFG_PYTHON -c 'import sys; print sys.argv[1]' `pwd` | grep '^/' > /dev/null - then - err " - -python is silently translating windows paths to MSYS paths \ -and the build will fail if this python is used. - -Either an official python install must be used or an \ -alternative python package in MinGW must be used. - -If you are building under msys2 try installing the mingw-w64-x86_64-python2 \ -package instead of python2: - -$ pacman -S mingw-w64-x86_64-python2 -" - fi -fi - -if [ -n "$CFG_PERF" ] -then - HAVE_PERF_LOGFD=`$CFG_PERF stat --log-fd 2>&1 | grep 'unknown option'` - if [ -z "$HAVE_PERF_LOGFD" ]; - then - CFG_PERF_WITH_LOGFD=1 - putvar CFG_PERF_WITH_LOGFD - fi -fi - -if [ -n "$CFG_DISABLE_RUSTBUILD" ]; then - - step_msg "making directories" - - for i in \ - doc doc/std doc/extra \ - dl tmp dist - do - make_dir $i - done - - for t in $CFG_HOST - do - make_dir $t/llvm - done - - for t in $CFG_HOST - do - make_dir $t/rustllvm - done - - for t in $CFG_TARGET - do - make_dir $t/rt - for s in 0 1 2 3 - do - make_dir $t/rt/stage$s - make_dir $t/rt/jemalloc - make_dir $t/rt/compiler-rt - for i in \ - isaac sync test \ - arch/i386 arch/x86_64 arch/arm arch/aarch64 arch/mips arch/powerpc - do - make_dir $t/rt/stage$s/$i - done - done - done - - for h in $CFG_HOST - do - for t in $CFG_TARGET - do - # host bin dir stage0 - make_dir $h/stage0/bin - - # host lib dir stage0 - make_dir $h/stage0/lib - - # host test dir stage0 - make_dir $h/stage0/test - - # target bin dir stage0 - make_dir $h/stage0/lib/rustlib/$t/bin - - # target lib dir stage0 - make_dir $h/stage0/lib/rustlib/$t/lib - - for i in 1 2 3 - do - # host bin dir - make_dir $h/stage$i/bin - - # host lib dir - make_dir $h/stage$i/$CFG_LIBDIR_RELATIVE - - # host test dir - make_dir $h/stage$i/test - - # target bin dir - make_dir $h/stage$i/$CFG_LIBDIR_RELATIVE/rustlib/$t/bin - - # target lib dir - make_dir $h/stage$i/$CFG_LIBDIR_RELATIVE/rustlib/$t/lib - done - done - - make_dir $h/test/run-pass - make_dir $h/test/run-pass-valgrind - make_dir $h/test/run-pass-fulldeps - make_dir $h/test/run-fail - make_dir $h/test/run-fail-fulldeps - make_dir $h/test/compile-fail - make_dir $h/test/parse-fail - make_dir $h/test/compile-fail-fulldeps - make_dir $h/test/bench - make_dir $h/test/perf - make_dir $h/test/pretty - make_dir $h/test/debuginfo-gdb - make_dir $h/test/debuginfo-lldb - make_dir $h/test/codegen - make_dir $h/test/codegen-units - make_dir $h/test/rustdoc - done - -fi - -# Configure submodules -step_msg "configuring submodules" - -# Have to be in the top of src directory for this -if [ -z "$CFG_DISABLE_MANAGE_SUBMODULES" ] && [ -n "$CFG_DISABLE_RUSTBUILD" ] -then - cd ${CFG_SRC_DIR} - - msg "git: submodule sync" - "${CFG_GIT}" submodule sync - - msg "git: submodule init" - "${CFG_GIT}" submodule init - - # Disable submodules that we're not using - if [ -n "${CFG_LLVM_ROOT}" ]; then - msg "git: submodule deinit src/llvm" - "${CFG_GIT}" submodule deinit src/llvm - fi - if [ -n "${CFG_JEMALLOC_ROOT}" ]; then - msg "git: submodule deinit src/jemalloc" - "${CFG_GIT}" submodule deinit src/jemalloc - fi - - msg "git: submodule update" - "${CFG_GIT}" submodule update - need_ok "git failed" - - msg "git: submodule foreach sync" - "${CFG_GIT}" submodule foreach --recursive 'if test -e .gitmodules; then git submodule sync; fi' - need_ok "git failed" - - msg "git: submodule foreach update" - "${CFG_GIT}" submodule update --recursive - need_ok "git failed" - - # NB: this is just for the sake of getting the submodule SHA1 values - # and status written into the build log. - msg "git: submodule status" - "${CFG_GIT}" submodule status --recursive - - msg "git: submodule clobber" - "${CFG_GIT}" submodule foreach --recursive git clean -dxf - need_ok "git failed" - "${CFG_GIT}" submodule foreach --recursive git checkout . - need_ok "git failed" - - cd ${CFG_BUILD_DIR} -fi - -# Do a sanity check that the submodule source exists. Because GitHub -# automatically publishes broken tarballs that can't be disabled, and -# people download them and try to use them. -if [ ! -e "${CFG_SRC_DIR}/src/liblibc" ]; then - err "some submodules are missing. Is this a broken tarball? - -If you downloaded this tarball from the GitHub release pages at -https://github.com/rust-lang/rust/releases, -then please delete it and instead download the source from -https://www.rust-lang.org/downloads.html" - -fi - -# Configure llvm, only if necessary -step_msg "looking at LLVM" -CFG_LLVM_SRC_DIR=${CFG_SRC_DIR}src/llvm/ -for t in $CFG_HOST -do - do_reconfigure=1 - is_msvc=0 - case "$t" in - (*-msvc) - is_msvc=1 - ;; - esac - - if [ -z "$CFG_DISABLE_RUSTBUILD" ] - then - msg "not configuring LLVM, rustbuild in use" - do_reconfigure=0 - elif [ -z "$CFG_LLVM_ROOT" ] - then - LLVM_BUILD_DIR=${CFG_BUILD_DIR}$t/llvm - LLVM_INST_DIR=$LLVM_BUILD_DIR - # For some weird reason the MSVC output dir is different than Unix - if [ ${is_msvc} -ne 0 ]; then - if [ -n "$CFG_DISABLE_OPTIMIZE_LLVM" ] - then - # Just use LLVM straight from its build directory to - # avoid 'make install' time - LLVM_INST_DIR=$LLVM_BUILD_DIR/Debug - else - LLVM_INST_DIR=$LLVM_BUILD_DIR/Release - fi - fi - else - msg "not reconfiguring LLVM, external LLVM root" - # The user is using their own LLVM - LLVM_BUILD_DIR= - LLVM_INST_DIR=$CFG_LLVM_ROOT - do_reconfigure=0 - # Check that LLVm FileCheck is available. Needed for the tests - if [ -z "$CFG_DISABLE_CODEGEN_TESTS" ]; then - need_cmd $LLVM_INST_DIR/bin/FileCheck - fi - fi - - if [ ${do_reconfigure} -ne 0 ] - then - # because git is hilarious, it might have put the module index - # in a couple places. - index1="${CFG_SRC_DIR}.git/modules/src/llvm/index" - index2="${CFG_SRC_DIR}src/llvm/.git/index" - for index in ${index1} ${index2} - do - config_status="${LLVM_BUILD_DIR}/config.status" - if test -e ${index} -a \ - -e ${config_status} -a \ - ${config_status} -nt ${index} - then - msg "not reconfiguring LLVM, config.status is fresh" - do_reconfigure=0 - fi - done - fi - - # We need the generator later on for compiler-rt even if LLVM's not built - if [ -n "$CFG_NINJA" ] - then - generator="Ninja" - elif [ ${is_msvc} -ne 0 ] - then - case "$CFG_MSVC_ROOT" in - *14.0*) - generator="Visual Studio 14 2015" - ;; - *12.0*) - generator="Visual Studio 12 2013" - ;; - *) - err "can't determine generator for LLVM cmake" - ;; - esac - case "$t" in - x86_64-*) - generator="$generator Win64" - ;; - i686-*) - ;; - *) - err "can only build LLVM for x86 platforms" - ;; - esac - else - generator="Unix Makefiles" - fi - CFG_CMAKE_GENERATOR=$generator - putvar CFG_CMAKE_GENERATOR - - msg "configuring LLVM for $t" - - LLVM_CFLAGS_32="" - LLVM_CXXFLAGS_32="" - LLVM_LDFLAGS_32="" - LLVM_CFLAGS_64="" - LLVM_CXXFLAGS_64="" - LLVM_LDFLAGS_64="" - - case "$CFG_CC" in - ("ccache clang") - LLVM_CXX_32="ccache" - LLVM_CC_32="ccache" - LLVM_CXX_32_ARG1="clang++" - LLVM_CC_32_ARG1="clang" - LLVM_CFLAGS_32="-Qunused-arguments" - LLVM_CXXFLAGS_32="-Qunused-arguments" - - LLVM_CXX_64="ccache" - LLVM_CC_64="ccache" - LLVM_CXX_64_ARG1="clang++" - LLVM_CC_64_ARG1="clang" - LLVM_CFLAGS_64="-Qunused-arguments" - LLVM_CXXFLAGS_64="-Qunused-arguments" - ;; - ("clang") - LLVM_CXX_32="clang++" - LLVM_CC_32="clang" - LLVM_CFLAGS_32="-Qunused-arguments" - LLVM_CXXFLAGS_32="-Qunused-arguments" - - LLVM_CXX_64="clang++" - LLVM_CC_64="clang" - LLVM_CFLAGS_64="-Qunused-arguments" - LLVM_CXXFLAGS_64="-Qunused-arguments" - ;; - ("ccache gcc") - LLVM_CXX_32="ccache" - LLVM_CC_32="ccache" - LLVM_CXX_32_ARG1="g++" - LLVM_CC_32_ARG1="gcc" - - LLVM_CXX_64="ccache" - LLVM_CC_64="ccache" - LLVM_CXX_64_ARG1="g++" - LLVM_CC_64_ARG1="gcc" - ;; - ("gcc") - if [ -z "$CFG_ENABLE_SCCACHE" ]; then - LLVM_CXX_32="g++" - LLVM_CC_32="gcc" - - LLVM_CXX_64="g++" - LLVM_CC_64="gcc" - else - LLVM_CXX_32="sccache" - LLVM_CC_32="sccache" - LLVM_CXX_32_ARG1="g++" - LLVM_CC_32_ARG1="gcc" - - LLVM_CXX_64="sccache" - LLVM_CC_64="sccache" - LLVM_CXX_64_ARG1="g++" - LLVM_CC_64_ARG1="gcc" - fi - ;; - - (*) - msg "inferring LLVM_CXX/CC from CXX/CC = $CXX/$CC" - if [ -n "$CFG_ENABLE_CCACHE" ] - then - if [ -z "$CFG_CCACHE" ] - then - err "ccache requested but not found" - fi - - LLVM_CXX_32="ccache" - LLVM_CC_32="ccache" - LLVM_CXX_32_ARG1="$CXX" - LLVM_CC_32_ARG1="$CC" - - LLVM_CXX_64="ccache" - LLVM_CC_64="ccache" - LLVM_CXX_64_ARG1="$CXX" - LLVM_CC_64_ARG1="$CC" - else - LLVM_CXX_32="$CXX" - LLVM_CC_32="$CC" - - LLVM_CXX_64="$CXX" - LLVM_CC_64="$CC" - fi - - ;; - esac - - case "$CFG_CPUTYPE" in - (x86*) - LLVM_CFLAGS_32="$LLVM_CFLAGS_32 -m32" - LLVM_CXXFLAGS_32="$LLVM_CXXFLAGS_32 -m32" - LLVM_LDFLAGS_32="$LLVM_LDFLAGS_32 -m32" - ;; - esac - - if echo $t | grep -q x86_64 - then - LLVM_CXX=$LLVM_CXX_64 - LLVM_CC=$LLVM_CC_64 - LLVM_CXX_ARG1=$LLVM_CXX_64_ARG1 - LLVM_CC_ARG1=$LLVM_CC_64_ARG1 - LLVM_CFLAGS=$LLVM_CFLAGS_64 - LLVM_CXXFLAGS=$LLVM_CXXFLAGS_64 - LLVM_LDFLAGS=$LLVM_LDFLAGS_64 - else - LLVM_CXX=$LLVM_CXX_32 - LLVM_CC=$LLVM_CC_32 - LLVM_CXX_ARG1=$LLVM_CXX_32_ARG1 - LLVM_CC_ARG1=$LLVM_CC_32_ARG1 - LLVM_CFLAGS=$LLVM_CFLAGS_32 - LLVM_CXXFLAGS=$LLVM_CXXFLAGS_32 - LLVM_LDFLAGS=$LLVM_LDFLAGS_32 - fi - - if [ "$CFG_USING_LIBCPP" != "0" ]; then - CMAKE_ARGS="$CMAKE_ARGS -DLLVM_ENABLE_LIBCXX=ON" - fi - - # Turn off things we don't need - CMAKE_ARGS="$CMAKE_ARGS -DLLVM_INCLUDE_TESTS=OFF" - CMAKE_ARGS="$CMAKE_ARGS -DLLVM_INCLUDE_EXAMPLES=OFF" - CMAKE_ARGS="$CMAKE_ARGS -DLLVM_INCLUDE_DOCS=OFF" - CMAKE_ARGS="$CMAKE_ARGS -DLLVM_ENABLE_ZLIB=OFF" - CMAKE_ARGS="$CMAKE_ARGS -DWITH_POLY=OFF" - CMAKE_ARGS="$CMAKE_ARGS -DLLVM_ENABLE_TERMINFO=OFF" - CMAKE_ARGS="$CMAKE_ARGS -DLLVM_ENABLE_LIBEDIT=OFF" - - arch="$(echo "$t" | cut -d - -f 1)" - - if [ "$arch" = i686 ]; then - CMAKE_ARGS="$CMAKE_ARGS -DLLVM_BUILD_32_BITS=ON" - fi - - if [ "$t" != "$CFG_BUILD" ]; then - # see http://llvm.org/docs/HowToCrossCompileLLVM.html - CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_CROSSCOMPILING=True" - CMAKE_ARGS="$CMAKE_ARGS -DLLVM_TARGET_ARCH=$arch" - CMAKE_ARGS="$CMAKE_ARGS -DLLVM_TABLEGEN=$CFG_BUILD_DIR/$CFG_BUILD/llvm/bin/llvm-tblgen" - CMAKE_ARGS="$CMAKE_ARGS -DLLVM_DEFAULT_TARGET_TRIPLE=$t" - fi - - # MSVC handles compiler business itself - if [ ${is_msvc} -eq 0 ]; then - CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_C_COMPILER=$LLVM_CC" - CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_CXX_COMPILER=$LLVM_CXX" - CMAKE_ARGS="$CMAKE_ARGS '-DCMAKE_C_FLAGS=$LLVM_CFLAGS'" - CMAKE_ARGS="$CMAKE_ARGS '-DCMAKE_CXX_FLAGS=$LLVM_CXXFLAGS'" - if [ -n "$LLVM_CC_ARG1" ]; then - CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_C_COMPILER_ARG1=$LLVM_CC_ARG1" - fi - if [ -n "$LLVM_CXX_ARG1" ]; then - CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_CXX_COMPILER_ARG1=$LLVM_CXX_ARG1" - fi - # FIXME: What about LDFLAGS? - fi - - if [ -n "$CFG_DISABLE_OPTIMIZE_LLVM" ]; then - CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_BUILD_TYPE=Debug" - elif [ -n "$CFG_ENABLE_LLVM_RELEASE_DEBUGINFO" ]; then - CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_BUILD_TYPE=RelWithDebInfo" - else - CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release" - fi - if [ -z "$CFG_ENABLE_LLVM_ASSERTIONS" ] - then - CMAKE_ARGS="$CMAKE_ARGS -DLLVM_ENABLE_ASSERTIONS=OFF" - else - CMAKE_ARGS="$CMAKE_ARGS -DLLVM_ENABLE_ASSERTIONS=ON" - fi - - CMAKE_ARGS="$CMAKE_ARGS -DLLVM_TARGETS_TO_BUILD='X86;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc'" - CMAKE_ARGS="$CMAKE_ARGS -G '$CFG_CMAKE_GENERATOR'" - CMAKE_ARGS="$CMAKE_ARGS $CFG_LLVM_SRC_DIR" - - if [ ${do_reconfigure} -ne 0 ] - then - msg "configuring LLVM for $t with cmake" - - msg "configuring LLVM with:" - msg "$CMAKE_ARGS" - - (cd $LLVM_BUILD_DIR && eval "\"$CFG_CMAKE\"" $CMAKE_ARGS) - need_ok "LLVM cmake configure failed" - fi - - # Construct variables for LLVM build and install directories for - # each target. These will be named - # CFG_LLVM_BUILD_DIR_${target_triple} but all the hyphens in - # target_triple will be converted to underscore, because bash - # variables can't contain hyphens. The makefile will then have to - # convert back. - CFG_LLVM_BUILD_DIR=$(echo CFG_LLVM_BUILD_DIR_${t} | tr - _) - CFG_LLVM_INST_DIR=$(echo CFG_LLVM_INST_DIR_${t} | tr - _) - eval ${CFG_LLVM_BUILD_DIR}="'$LLVM_BUILD_DIR'" - eval ${CFG_LLVM_INST_DIR}="'$LLVM_INST_DIR'" -done - - step_msg "writing configuration" putvar CFG_SRC_DIR @@ -1915,15 +1085,8 @@ do putvar $CFG_LLVM_INST_DIR done -if [ -z "$CFG_DISABLE_RUSTBUILD" ] -then - INPUT_MAKEFILE=src/bootstrap/mk/Makefile.in -else - INPUT_MAKEFILE=Makefile.in -fi - msg -copy_if_changed ${CFG_SRC_DIR}${INPUT_MAKEFILE} ./Makefile +copy_if_changed ${CFG_SRC_DIR}src/bootstrap/mk/Makefile.in ./Makefile move_if_changed config.tmp config.mk rm -f config.tmp touch config.stamp @@ -1940,22 +1103,5 @@ else X_PY=${CFG_SRC_DIR_RELATIVE}x.py fi -if [ -z "$CFG_DISABLE_RUSTBUILD" ]; then - msg "NOTE you have now configured rust to use a rewritten build system" - msg " called rustbuild, and as a result this may have bugs that " - msg " you did not see before. If you experience any issues you can" - msg " go back to the old build system with --disable-rustbuild and" - msg " please feel free to report any bugs!" - msg "" - msg "run \`python ${X_PY} --help\`" -else - warn "the makefile-based build system is deprecated in favor of rustbuild" - msg "" - msg "It is recommended you avoid passing --disable-rustbuild to get your" - msg "build working as the makefiles will be deleted on 2017-02-02. If you" - msg "encounter bugs with rustbuild please file issues against rust-lang/rust" - msg "" - msg "run \`make help\`" -fi - +msg "run \`python ${X_PY} --help\`" msg From ce4abc35150425ac5ddf460b5a7b444da2140009 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 23 Jan 2017 15:48:25 -0800 Subject: [PATCH 36/70] Delete Travis/AppVeyor makefile builders We no longer need these builders as we're no longer testing the old build system. --- .travis.yml | 8 -------- appveyor.yml | 12 ----------- src/ci/docker/x86_64-gnu-make/Dockerfile | 26 ------------------------ 3 files changed, 46 deletions(-) delete mode 100644 src/ci/docker/x86_64-gnu-make/Dockerfile diff --git a/.travis.yml b/.travis.yml index ea405413e78..250650a1005 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,7 +32,6 @@ matrix: - env: IMAGE=x86_64-gnu-aux - env: IMAGE=x86_64-gnu-debug - env: IMAGE=x86_64-gnu-nopt - - env: IMAGE=x86_64-gnu-make - env: IMAGE=x86_64-gnu-llvm-3.7 ALLOW_PR=1 RUST_BACKTRACE=1 - env: IMAGE=x86_64-gnu-distcheck - env: IMAGE=x86_64-gnu-incremental @@ -56,13 +55,6 @@ matrix: os: osx osx_image: xcode8.2 install: *osx_install_sccache - - env: > - RUST_CHECK_TARGET=check - RUST_CONFIGURE_ARGS=--build=x86_64-apple-darwin --disable-rustbuild - SRC=. - os: osx - osx_image: xcode8.2 - install: *osx_install_sccache - env: > RUST_CHECK_TARGET=dist RUST_CONFIGURE_ARGS="--target=aarch64-apple-ios,armv7-apple-ios,armv7s-apple-ios,i386-apple-ios,x86_64-apple-ios --enable-extended" diff --git a/appveyor.yml b/appveyor.yml index c617ac8a4e3..2183d8da95f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -15,11 +15,6 @@ environment: SCRIPT: python x.py test --host i686-pc-windows-msvc --target i686-pc-windows-msvc && python x.py dist DEPLOY: 1 - # MSVC makefiles - - MSYS_BITS: 64 - RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --disable-rustbuild - RUST_CHECK_TARGET: check - # MSVC cargotest - MSYS_BITS: 64 NO_VENDOR: 1 @@ -58,13 +53,6 @@ environment: MINGW_DIR: mingw32 DEPLOY: 1 - - MSYS_BITS: 32 - RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu --disable-rustbuild - RUST_CHECK_TARGET: check - MINGW_URL: https://s3.amazonaws.com/rust-lang-ci - MINGW_ARCHIVE: i686-4.9.2-release-win32-dwarf-rt_v4-rev4.7z - MINGW_DIR: mingw32 - - MSYS_BITS: 64 SCRIPT: python x.py test && python x.py dist RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-extended diff --git a/src/ci/docker/x86_64-gnu-make/Dockerfile b/src/ci/docker/x86_64-gnu-make/Dockerfile deleted file mode 100644 index c6071d704f5..00000000000 --- a/src/ci/docker/x86_64-gnu-make/Dockerfile +++ /dev/null @@ -1,26 +0,0 @@ -FROM ubuntu:16.04 - -RUN apt-get update && apt-get install -y --no-install-recommends \ - g++ \ - make \ - file \ - curl \ - ca-certificates \ - python2.7 \ - git \ - cmake \ - sudo \ - gdb \ - xz-utils - -ENV SCCACHE_DIGEST=7237e38e029342fa27b7ac25412cb9d52554008b12389727320bd533fd7f05b6a96d55485f305caf95e5c8f5f97c3313e10012ccad3e752aba2518f3522ba783 -RUN curl -L https://api.pub.build.mozilla.org/tooltool/sha512/$SCCACHE_DIGEST | \ - tar xJf - -C /usr/local/bin --strip-components=1 - -RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \ - dpkg -i dumb-init_*.deb && \ - rm dumb-init_*.deb -ENTRYPOINT ["/usr/bin/dumb-init", "--"] - -ENV RUST_CONFIGURE_ARGS --build=x86_64-unknown-linux-gnu --disable-rustbuild -ENV RUST_CHECK_TARGET check From 77c3bfa7429abf87b76ba84108df018d9e9d90e2 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 23 Jan 2017 15:55:35 -0800 Subject: [PATCH 37/70] std: Remove cfg(cargobuild) annotations These are all now no longer needed that we've only got rustbuild in tree. --- CONTRIBUTING.md | 5 -- src/liballoc_jemalloc/build.rs | 1 - src/liballoc_jemalloc/lib.rs | 16 ------ src/libflate/build.rs | 1 - src/libflate/lib.rs | 4 -- src/libpanic_unwind/gcc.rs | 4 -- src/librustc_llvm/build.rs | 2 - src/librustc_llvm/lib.rs | 10 ---- src/librustdoc/build.rs | 1 - src/librustdoc/html/markdown.rs | 5 -- src/libstd/build.rs | 1 - src/libstd/lib.rs | 3 - src/libstd/panicking.rs | 6 +- src/libstd/rtdeps.rs | 68 ----------------------- src/libstd/sys/unix/args.rs | 5 -- src/libstd/sys/unix/mod.rs | 2 +- src/libstd/sys/unix/rand.rs | 4 -- src/libstd/sys/windows/c.rs | 7 --- src/libstd/sys_common/gnu/libbacktrace.rs | 3 - src/libstd/sys_common/mod.rs | 4 +- src/libunwind/build.rs | 2 - src/libunwind/libunwind.rs | 31 ----------- src/tools/compiletest/Cargo.toml | 1 - src/tools/compiletest/build.rs | 13 ----- src/tools/compiletest/src/main.rs | 13 +---- 25 files changed, 7 insertions(+), 205 deletions(-) delete mode 100644 src/libstd/rtdeps.rs delete mode 100644 src/tools/compiletest/build.rs diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cdbabeaddfb..429996126f9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -93,11 +93,6 @@ system internals, try asking in [`#rust-internals`][pound-rust-internals]. [bootstrap]: https://github.com/rust-lang/rust/tree/master/src/bootstrap/ -> **Note**: the build system was recently rewritten from a jungle of makefiles -> to the current incarnation you'll see in `src/bootstrap`. If you experience -> bugs you can temporarily revert back to the makefiles with -> `--disable-rustbuild` passed to `./configure`. - ### Configuration Before you can start building the compiler you need to configure the build for diff --git a/src/liballoc_jemalloc/build.rs b/src/liballoc_jemalloc/build.rs index cb7852995f3..a3402bf3994 100644 --- a/src/liballoc_jemalloc/build.rs +++ b/src/liballoc_jemalloc/build.rs @@ -21,7 +21,6 @@ use std::process::Command; use build_helper::{run, rerun_if_changed_anything_in_dir, up_to_date}; fn main() { - println!("cargo:rustc-cfg=cargobuild"); println!("cargo:rerun-if-changed=build.rs"); // FIXME: This is a hack to support building targets that don't diff --git a/src/liballoc_jemalloc/lib.rs b/src/liballoc_jemalloc/lib.rs index fc8a5455d1d..8d81a09f5af 100644 --- a/src/liballoc_jemalloc/lib.rs +++ b/src/liballoc_jemalloc/lib.rs @@ -30,22 +30,6 @@ pub use imp::*; mod imp { use libc::{c_int, c_void, size_t}; - // Linkage directives to pull in jemalloc and its dependencies. - // - // On some platforms we need to be sure to link in `pthread` which jemalloc - // depends on, and specifically on android we need to also link to libgcc. - // Currently jemalloc is compiled with gcc which will generate calls to - // intrinsics that are libgcc specific (e.g. those intrinsics aren't present in - // libcompiler-rt), so link that in to get that support. - #[link(name = "jemalloc", kind = "static")] - #[cfg_attr(target_os = "android", link(name = "gcc"))] - #[cfg_attr(all(not(windows), - not(target_os = "android"), - not(target_env = "musl")), - link(name = "pthread"))] - #[cfg(not(cargobuild))] - extern "C" {} - // Note that the symbols here are prefixed by default on OSX and Windows (we // don't explicitly request it), and on Android and DragonFly we explicitly // request it as unprefixing cause segfaults (mismatches in allocators). diff --git a/src/libflate/build.rs b/src/libflate/build.rs index 245c705dfcc..12016980a2c 100644 --- a/src/libflate/build.rs +++ b/src/libflate/build.rs @@ -11,7 +11,6 @@ extern crate gcc; fn main() { - println!("cargo:rustc-cfg=cargobuild"); gcc::Config::new() .file("../rt/miniz.c") .compile("libminiz.a"); diff --git a/src/libflate/lib.rs b/src/libflate/lib.rs index 8365e9db2a9..dedec7b1609 100644 --- a/src/libflate/lib.rs +++ b/src/libflate/lib.rs @@ -74,10 +74,6 @@ impl Drop for Bytes { } } -#[link(name = "miniz", kind = "static")] -#[cfg(not(cargobuild))] -extern "C" {} - extern "C" { /// Raw miniz compression function. fn tdefl_compress_mem_to_heap(psrc_buf: *const c_void, diff --git a/src/libpanic_unwind/gcc.rs b/src/libpanic_unwind/gcc.rs index e8b3a9a42c2..84abc6bc4a5 100644 --- a/src/libpanic_unwind/gcc.rs +++ b/src/libpanic_unwind/gcc.rs @@ -301,10 +301,6 @@ unsafe extern "C" fn rust_eh_unwind_resume(panic_ctx: *mut u8) -> ! { // with any GCC runtime. #[cfg(all(target_os="windows", target_arch = "x86", target_env="gnu"))] pub mod eh_frame_registry { - #[link(name = "gcc_eh")] - #[cfg(not(cargobuild))] - extern "C" {} - extern "C" { fn __register_frame_info(eh_frame_begin: *const u8, object: *mut u8); fn __deregister_frame_info(eh_frame_begin: *const u8, object: *mut u8); diff --git a/src/librustc_llvm/build.rs b/src/librustc_llvm/build.rs index 2ee4cc49435..c74a9308e4e 100644 --- a/src/librustc_llvm/build.rs +++ b/src/librustc_llvm/build.rs @@ -47,8 +47,6 @@ fn detect_llvm_link(llvm_config: &Path) -> (&'static str, Option<&'static str>) } fn main() { - println!("cargo:rustc-cfg=cargobuild"); - let target = env::var("TARGET").expect("TARGET was not set"); let llvm_config = env::var_os("LLVM_CONFIG") .map(PathBuf::from) diff --git a/src/librustc_llvm/lib.rs b/src/librustc_llvm/lib.rs index b1615b9e38b..f300bf16145 100644 --- a/src/librustc_llvm/lib.rs +++ b/src/librustc_llvm/lib.rs @@ -422,13 +422,3 @@ impl Drop for OperandBundleDef { } } } - -// The module containing the native LLVM dependencies, generated by the build system -// Note that this must come after the rustllvm extern declaration so that -// parts of LLVM that rustllvm depends on aren't thrown away by the linker. -// Works to the above fix for #15460 to ensure LLVM dependencies that -// are only used by rustllvm don't get stripped by the linker. -#[cfg(not(cargobuild))] -mod llvmdeps { - include! { env!("CFG_LLVM_LINKAGE_FILE") } -} diff --git a/src/librustdoc/build.rs b/src/librustdoc/build.rs index 171954f325a..fcb7af11dce 100644 --- a/src/librustdoc/build.rs +++ b/src/librustdoc/build.rs @@ -11,7 +11,6 @@ extern crate gcc; fn main() { - println!("cargo:rustc-cfg=cargobuild"); let mut cfg = gcc::Config::new(); cfg.file("../rt/hoedown/src/autolink.c") .file("../rt/hoedown/src/buffer.c") diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index e8ff8930bdd..a0f4a3a8743 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -162,11 +162,6 @@ struct hoedown_buffer { unit: libc::size_t, } -// hoedown FFI -#[link(name = "hoedown", kind = "static")] -#[cfg(not(cargobuild))] -extern {} - extern { fn hoedown_html_renderer_new(render_flags: libc::c_uint, nesting_level: libc::c_int) diff --git a/src/libstd/build.rs b/src/libstd/build.rs index a0844821709..0fca374f6e6 100644 --- a/src/libstd/build.rs +++ b/src/libstd/build.rs @@ -21,7 +21,6 @@ use std::process::Command; use build_helper::{run, rerun_if_changed_anything_in_dir, up_to_date}; fn main() { - println!("cargo:rustc-cfg=cargobuild"); println!("cargo:rerun-if-changed=build.rs"); let target = env::var("TARGET").expect("TARGET was not set"); diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 9bcecebf693..4279db7754a 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -463,9 +463,6 @@ mod panicking; mod rand; mod memchr; -// This module just defines per-platform native library dependencies -mod rtdeps; - // The runtime entry point and a few unstable public functions used by the // compiler pub mod rt; diff --git a/src/libstd/panicking.rs b/src/libstd/panicking.rs index e5edea241e1..d76e8816ca4 100644 --- a/src/libstd/panicking.rs +++ b/src/libstd/panicking.rs @@ -311,12 +311,12 @@ impl<'a> Location<'a> { } fn default_hook(info: &PanicInfo) { - #[cfg(any(not(cargobuild), feature = "backtrace"))] + #[cfg(feature = "backtrace")] use sys_common::backtrace; // If this is a double panic, make sure that we print a backtrace // for this panic. Otherwise only print it if logging is enabled. - #[cfg(any(not(cargobuild), feature = "backtrace"))] + #[cfg(feature = "backtrace")] let log_backtrace = { let panics = update_panic_count(0); @@ -341,7 +341,7 @@ fn default_hook(info: &PanicInfo) { let _ = writeln!(err, "thread '{}' panicked at '{}', {}:{}", name, msg, file, line); - #[cfg(any(not(cargobuild), feature = "backtrace"))] + #[cfg(feature = "backtrace")] { use sync::atomic::{AtomicBool, Ordering}; diff --git a/src/libstd/rtdeps.rs b/src/libstd/rtdeps.rs deleted file mode 100644 index 5dc6ee2bc8c..00000000000 --- a/src/libstd/rtdeps.rs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! This module contains the linkage attributes to all runtime dependencies of -//! the standard library This varies per-platform, but these libraries are -//! necessary for running libstd. - -#![cfg(not(cargobuild))] - -// LLVM implements the `frem` instruction as a call to `fmod`, which lives in -// libm. Hence, we must explicitly link to it. -// -// On Linux, librt and libdl are indirect dependencies via std, -// and binutils 2.22+ won't add them automatically -#[cfg(all(target_os = "linux", not(target_env = "musl")))] -#[link(name = "dl")] -#[link(name = "pthread")] -extern {} - -#[cfg(target_os = "android")] -#[link(name = "dl")] -#[link(name = "log")] -extern {} - -#[cfg(target_os = "freebsd")] -#[link(name = "execinfo")] -#[link(name = "pthread")] -extern {} - -#[cfg(any(target_os = "dragonfly", - target_os = "bitrig", - target_os = "netbsd", - target_os = "openbsd"))] -#[link(name = "pthread")] -extern {} - -#[cfg(target_os = "solaris")] -#[link(name = "socket")] -#[link(name = "posix4")] -#[link(name = "pthread")] -extern {} - -// For PNaCl targets, nacl_io is a Pepper wrapper for some IO functions -// missing (ie always error) in Newlib. -#[cfg(all(target_os = "nacl", not(test)))] -#[link(name = "nacl_io", kind = "static")] -#[link(name = "c++", kind = "static")] // for `nacl_io` and EH. -#[link(name = "pthread", kind = "static")] -extern {} - -#[cfg(target_os = "macos")] -#[link(name = "System")] -extern {} - -#[cfg(target_os = "ios")] -#[link(name = "System")] -extern {} - -#[cfg(target_os = "haiku")] -#[link(name = "network")] -extern {} diff --git a/src/libstd/sys/unix/args.rs b/src/libstd/sys/unix/args.rs index 0f447ff4ec4..6e35a472792 100644 --- a/src/libstd/sys/unix/args.rs +++ b/src/libstd/sys/unix/args.rs @@ -189,11 +189,6 @@ mod imp { fn objc_msgSend_ul(obj: NsId, sel: Sel, ...) -> NsId; } - #[link(name = "Foundation", kind = "framework")] - #[link(name = "objc")] - #[cfg(not(cargobuild))] - extern {} - type Sel = *const libc::c_void; type NsId = *const libc::c_void; diff --git a/src/libstd/sys/unix/mod.rs b/src/libstd/sys/unix/mod.rs index fd7dc17cccd..c57751a01d7 100644 --- a/src/libstd/sys/unix/mod.rs +++ b/src/libstd/sys/unix/mod.rs @@ -33,7 +33,7 @@ pub mod weak; pub mod args; pub mod android; -#[cfg(any(not(cargobuild), feature = "backtrace"))] +#[cfg(feature = "backtrace")] pub mod backtrace; pub mod condvar; pub mod env; diff --git a/src/libstd/sys/unix/rand.rs b/src/libstd/sys/unix/rand.rs index 9b1cf6ffd0e..77ebad4e344 100644 --- a/src/libstd/sys/unix/rand.rs +++ b/src/libstd/sys/unix/rand.rs @@ -257,10 +257,6 @@ mod imp { #[allow(non_upper_case_globals)] const kSecRandomDefault: *const SecRandom = ptr::null(); - #[link(name = "Security", kind = "framework")] - #[cfg(not(cargobuild))] - extern {} - extern { fn SecRandomCopyBytes(rnd: *const SecRandom, count: size_t, bytes: *mut u8) -> c_int; diff --git a/src/libstd/sys/windows/c.rs b/src/libstd/sys/windows/c.rs index 850d6f49612..e5010ca3564 100644 --- a/src/libstd/sys/windows/c.rs +++ b/src/libstd/sys/windows/c.rs @@ -833,13 +833,6 @@ pub struct CONSOLE_READCONSOLE_CONTROL { } pub type PCONSOLE_READCONSOLE_CONTROL = *mut CONSOLE_READCONSOLE_CONTROL; -#[link(name = "ws2_32")] -#[link(name = "userenv")] -#[link(name = "shell32")] -#[link(name = "advapi32")] -#[cfg(not(cargobuild))] -extern {} - extern "system" { pub fn WSAStartup(wVersionRequested: WORD, lpWSAData: LPWSADATA) -> c_int; diff --git a/src/libstd/sys_common/gnu/libbacktrace.rs b/src/libstd/sys_common/gnu/libbacktrace.rs index d464a13ad1d..0bdbeddb112 100644 --- a/src/libstd/sys_common/gnu/libbacktrace.rs +++ b/src/libstd/sys_common/gnu/libbacktrace.rs @@ -39,9 +39,6 @@ pub fn print(w: &mut Write, idx: isize, addr: *mut libc::c_void, msg: *const libc::c_char, errnum: libc::c_int); enum backtrace_state {} - #[link(name = "backtrace", kind = "static")] - #[cfg(all(not(test), not(cargobuild)))] - extern {} extern { fn backtrace_create_state(filename: *const libc::c_char, diff --git a/src/libstd/sys_common/mod.rs b/src/libstd/sys_common/mod.rs index 634d6258885..d4d3365dc01 100644 --- a/src/libstd/sys_common/mod.rs +++ b/src/libstd/sys_common/mod.rs @@ -29,7 +29,7 @@ use sync::Once; use sys; pub mod at_exit_imp; -#[cfg(any(not(cargobuild), feature = "backtrace"))] +#[cfg(feature = "backtrace")] pub mod backtrace; pub mod condvar; pub mod io; @@ -50,7 +50,7 @@ pub use sys::net; #[cfg(not(target_os = "redox"))] pub mod net; -#[cfg(any(not(cargobuild), feature = "backtrace"))] +#[cfg(feature = "backtrace")] #[cfg(any(all(unix, not(any(target_os = "macos", target_os = "ios", target_os = "emscripten"))), all(windows, target_env = "gnu")))] pub mod gnu; diff --git a/src/libunwind/build.rs b/src/libunwind/build.rs index db41a368a16..f18b694d3d0 100644 --- a/src/libunwind/build.rs +++ b/src/libunwind/build.rs @@ -11,8 +11,6 @@ use std::env; fn main() { - println!("cargo:rustc-cfg=cargobuild"); - let target = env::var("TARGET").expect("TARGET was not set"); if target.contains("linux") { diff --git a/src/libunwind/libunwind.rs b/src/libunwind/libunwind.rs index 269c2d65b63..7fb58373251 100644 --- a/src/libunwind/libunwind.rs +++ b/src/libunwind/libunwind.rs @@ -240,34 +240,3 @@ if #[cfg(not(all(target_os = "ios", target_arch = "arm")))] { } } } // cfg_if! - -#[cfg_attr(any(all(target_os = "linux", not(target_env = "musl")), - target_os = "freebsd", - target_os = "solaris", - target_os = "haiku", - all(target_os = "linux", - target_env = "musl", - not(target_arch = "x86"), - not(target_arch = "x86_64"))), - link(name = "gcc_s"))] -#[cfg_attr(all(target_os = "linux", - target_env = "musl", - any(target_arch = "x86", target_arch = "x86_64"), - not(test)), - link(name = "unwind", kind = "static"))] -#[cfg_attr(target_os = "fuchsia", - link(name = "unwind"))] -#[cfg_attr(any(target_os = "android", target_os = "openbsd"), - link(name = "gcc"))] -#[cfg_attr(all(target_os = "netbsd", not(target_vendor = "rumprun")), - link(name = "gcc"))] -#[cfg_attr(all(target_os = "netbsd", target_vendor = "rumprun"), - link(name = "unwind"))] -#[cfg_attr(target_os = "dragonfly", - link(name = "gcc_pic"))] -#[cfg_attr(target_os = "bitrig", - link(name = "c++abi"))] -#[cfg_attr(all(target_os = "windows", target_env = "gnu"), - link(name = "gcc_eh"))] -#[cfg(not(cargobuild))] -extern "C" {} diff --git a/src/tools/compiletest/Cargo.toml b/src/tools/compiletest/Cargo.toml index 2982f29f931..3049875e86e 100644 --- a/src/tools/compiletest/Cargo.toml +++ b/src/tools/compiletest/Cargo.toml @@ -2,7 +2,6 @@ authors = ["The Rust Project Developers"] name = "compiletest" version = "0.0.0" -build = "build.rs" [dependencies] log = "0.3" diff --git a/src/tools/compiletest/build.rs b/src/tools/compiletest/build.rs deleted file mode 100644 index d5164b9b759..00000000000 --- a/src/tools/compiletest/build.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -fn main() { - println!("cargo:rustc-cfg=cargobuild"); -} diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs index 43d02479fb1..c2997c8c160 100644 --- a/src/tools/compiletest/src/main.rs +++ b/src/tools/compiletest/src/main.rs @@ -21,16 +21,9 @@ extern crate libc; extern crate test; extern crate getopts; - -#[cfg(cargobuild)] extern crate rustc_serialize; -#[cfg(not(cargobuild))] -extern crate serialize as rustc_serialize; - #[macro_use] extern crate log; - -#[cfg(cargobuild)] extern crate env_logger; use std::env; @@ -58,11 +51,7 @@ mod raise_fd_limit; mod uidiff; fn main() { - #[cfg(cargobuild)] - fn log_init() { env_logger::init().unwrap(); } - #[cfg(not(cargobuild))] - fn log_init() {} - log_init(); + env_logger::init().unwrap(); let config = parse_config(env::args().collect()); From ffd3070cc9ea6d845865f11d70c220da40720d7e Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 23 Jan 2017 15:59:41 -0800 Subject: [PATCH 38/70] Clean our src/etc of old files Some of these have long since expired, some are no longer in use now that we've jettisoned the makefiles, but none of them should be needed any more. --- src/etc/Dockerfile | 27 --------- src/etc/apple-darwin.supp | 75 ----------------------- src/etc/check-sanitycheck.py | 58 ------------------ src/etc/check-summary.py | 57 ------------------ src/etc/get-stage0.py | 46 -------------- src/etc/local_stage0.sh | 79 ------------------------ src/etc/mklldeps.py | 113 ----------------------------------- src/etc/x86.supp | 65 -------------------- 8 files changed, 520 deletions(-) delete mode 100644 src/etc/Dockerfile delete mode 100644 src/etc/apple-darwin.supp delete mode 100644 src/etc/check-sanitycheck.py delete mode 100755 src/etc/check-summary.py delete mode 100644 src/etc/get-stage0.py delete mode 100755 src/etc/local_stage0.sh delete mode 100644 src/etc/mklldeps.py delete mode 100644 src/etc/x86.supp diff --git a/src/etc/Dockerfile b/src/etc/Dockerfile deleted file mode 100644 index 83d54789ff3..00000000000 --- a/src/etc/Dockerfile +++ /dev/null @@ -1,27 +0,0 @@ -FROM ubuntu:xenial - -# curl -# Download stage0, see src/bootstrap/bootstrap.py -# g++ -# Compile LLVM binding in src/rustllvm -# gdb -# Used to run tests in src/test/debuginfo -# git -# Get commit hash and commit date in version string -# make -# Run build scripts in mk -# libedit-dev zlib1g-dev -# LLVM dependencies as packaged in Ubuntu -# (They are optional, but Ubuntu package enables them) -# llvm-3.7-dev (installed by llvm-3.7-tools) -# LLVM -# llvm-3.7-tools -# FileCheck is used to run tests in src/test/codegen - -RUN apt-get update && apt-get -y install \ - curl g++ gdb git make \ - libedit-dev zlib1g-dev \ - llvm-3.7-tools cmake - -RUN mkdir /build -WORKDIR /build diff --git a/src/etc/apple-darwin.supp b/src/etc/apple-darwin.supp deleted file mode 100644 index 50e30caa2b3..00000000000 --- a/src/etc/apple-darwin.supp +++ /dev/null @@ -1,75 +0,0 @@ -{ - osx-frameworks.rs-fails-otherwise-1 - Memcheck:Leak - match-leak-kinds: definite,possible - fun:malloc - ... - fun:__CFInitialize - ... -} - -{ - osx-frameworks.rs-fails-otherwise-2 - Memcheck:Leak - match-leak-kinds: possible - fun:malloc_zone_calloc - ... - fun:__CFInitialize - fun:_ZN16ImageLoaderMachO11doImageInitERKN11ImageLoader11LinkContextE -} - -{ - osx-frameworks.rs-fails-otherwise-3 - Memcheck:Leak - match-leak-kinds: possible - fun:realloc - ... - fun:_read_images - fun:map_images_nolock - ... - fun:_ZN4dyldL18notifyBatchPartialE17dyld_image_statesbPFPKcS0_jPK15dyld_image_infoE - fun:_ZN4dyld36registerImageStateBatchChangeHandlerE17dyld_image_statesPFPKcS0_jPK15dyld_image_infoE - fun:dyld_register_image_state_change_handler - fun:_objc_init - fun:_os_object_init -} - -{ - osx-frameworks.rs-fails-otherwise-4 - Memcheck:Leak - match-leak-kinds: definite,possible - fun:calloc - ... - fun:__CFInitialize - fun:_ZN16ImageLoaderMachO11doImageInitERKN11ImageLoader11LinkContextE - fun:_ZN16ImageLoaderMachO16doInitializationERKN11ImageLoader11LinkContextE - fun:_ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEjRNS_21InitializerTimingListERNS_15UninitedUpwardsE -} - -{ - osx-frameworks.rs-fails-otherwise-5 - Memcheck:Leak - match-leak-kinds: definite,possible - fun:malloc_zone_malloc - ... - fun:__CFInitialize - ... -} - -{ - fails-since-xcode-7.2 - Memcheck:Leak - match-leak-kinds: possible - fun:malloc_zone_malloc - fun:_objc_copyClassNamesForImage - fun:_ZL9protocolsv - fun:_Z9readClassP10objc_classbb - fun:gc_init - fun:_ZL33objc_initializeClassPair_internalP10objc_classPKcS0_S0_ - fun:layout_string_create - fun:_ZL12realizeClassP10objc_class - fun:_ZL22copySwiftV1MangledNamePKcb - fun:_ZL22copySwiftV1MangledNamePKcb - fun:_ZL22copySwiftV1MangledNamePKcb - fun:_ZL22copySwiftV1MangledNamePKcb -} diff --git a/src/etc/check-sanitycheck.py b/src/etc/check-sanitycheck.py deleted file mode 100644 index 0e103fbcffb..00000000000 --- a/src/etc/check-sanitycheck.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -import os -import subprocess -import sys -import functools - -STATUS = 0 - -def error_unless_permitted(env_var, message): - global STATUS - if not os.getenv(env_var): - sys.stderr.write(message) - STATUS = 1 - -def only_on(platforms): - def decorator(func): - @functools.wraps(func) - def inner(): - if any(map(lambda x: sys.platform.startswith(x), platforms)): - func() - return inner - return decorator - -@only_on(['linux', 'darwin', 'freebsd', 'openbsd']) -def check_rlimit_core(): - import resource - soft, hard = resource.getrlimit(resource.RLIMIT_CORE) - if soft > 0: - error_unless_permitted('ALLOW_NONZERO_RLIMIT_CORE', """\ -RLIMIT_CORE is set to a nonzero value (%d). During debuginfo, the test suite -will segfault many rustc's, creating many potentially large core files. -set ALLOW_NONZERO_RLIMIT_CORE to ignore this warning -""" % (soft)) - -@only_on(['win32']) -def check_console_code_page(): - if '65001' not in subprocess.check_output(['cmd', '/c', 'chcp']): - sys.stderr.write('Warning: the console output code page is not UTF-8, \ -some tests may fail. Use `cmd /c "chcp 65001"` to setup UTF-8 code page.\n') - -def main(): - check_console_code_page() - check_rlimit_core() - -if __name__ == '__main__': - main() - sys.exit(STATUS) diff --git a/src/etc/check-summary.py b/src/etc/check-summary.py deleted file mode 100755 index 9312b685c14..00000000000 --- a/src/etc/check-summary.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -import glob -import sys - -if __name__ == '__main__': - summaries = [] - - def summarise(fname): - summary = {} - with open(fname) as fd: - for line in fd: - splitline = line.strip().split(' ') - if len(splitline) == 1: - continue - status = splitline[0] - test = splitline[-1] - # track bench runs - if splitline[1] == 'ns/iter': - status = 'bench' - if status not in summary: - summary[status] = [] - summary[status].append(test) - summaries.append((fname, summary)) - - def count(t): - return sum(map(lambda f: len(f[1].get(t, [])), summaries)) - - logfiles = sys.argv[1:] - for files in map(glob.glob, logfiles): - map(summarise, files) - ok = count('ok') - failed = count('failed') - ignored = count('ignored') - measured = count('bench') - print("summary of %d test runs: %d passed; %d failed; %d ignored; %d measured" % - (len(logfiles), ok, failed, ignored, measured)) - print("") - - if failed > 0: - print("failed tests:") - for f, s in summaries: - failures = s.get('failed', []) - if len(failures) > 0: - print(" %s:" % (f)) - for test in failures: - print(" %s" % (test)) diff --git a/src/etc/get-stage0.py b/src/etc/get-stage0.py deleted file mode 100644 index 127251cc802..00000000000 --- a/src/etc/get-stage0.py +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2016 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -import os -import sys - -path = os.path.abspath(os.path.join(os.path.dirname(__file__), "../bootstrap")) -sys.path.append(path) - -import bootstrap - -def main(triple): - src_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "../..")) - data = bootstrap.stage0_data(src_root) - - channel, date = data['rustc'].split('-', 1) - - dl_dir = 'dl' - if not os.path.exists(dl_dir): - os.makedirs(dl_dir) - - filename = 'rustc-{}-{}.tar.gz'.format(channel, triple) - url = 'https://static.rust-lang.org/dist/{}/{}'.format(date, filename) - dst = dl_dir + '/' + filename - bootstrap.get(url, dst) - - stage0_dst = triple + '/stage0' - if os.path.exists(stage0_dst): - for root, _, files in os.walk(stage0_dst): - for f in files: - os.unlink(os.path.join(root, f)) - else: - os.makedirs(stage0_dst) - bootstrap.unpack(dst, stage0_dst, match='rustc', verbose=True) - -if __name__ == '__main__': - main(sys.argv[1]) diff --git a/src/etc/local_stage0.sh b/src/etc/local_stage0.sh deleted file mode 100755 index ee77206640e..00000000000 --- a/src/etc/local_stage0.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/sh -# Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -TARG_DIR=$1 -PREFIX=$2 -RUSTLIBDIR=$3 - -LIB_DIR=lib -LIB_PREFIX=lib - -OS=`uname -s` -case $OS in - ("Linux"|"FreeBSD"|"DragonFly"|"Bitrig"|"OpenBSD"|"SunOS"|"Haiku") - BIN_SUF= - LIB_SUF=.so - ;; - ("Darwin") - BIN_SUF= - LIB_SUF=.dylib - ;; - (*) - BIN_SUF=.exe - LIB_SUF=.dll - LIB_DIR=bin - LIB_PREFIX= - ;; -esac - -if [ -z $PREFIX ]; then - echo "No local rust specified." - exit 1 -fi - -if [ ! -e ${PREFIX}/bin/rustc${BIN_SUF} ]; then - echo "No local rust installed at ${PREFIX}" - exit 1 -fi - -if [ -z $TARG_DIR ]; then - echo "No target directory specified." - exit 1 -fi - -case "$TARG_DIR" in ---print-rustc-release) - # not actually copying to TARG_DIR, just print the local rustc version and exit - ${PREFIX}/bin/rustc${BIN_SUF} --version --verbose | sed -ne 's/^release: //p' -;; -*) - -cp ${PREFIX}/bin/rustc${BIN_SUF} ${TARG_DIR}/stage0/bin/ -cp ${PREFIX}/${LIB_DIR}/${RUSTLIBDIR}/${TARG_DIR}/${LIB_DIR}/* ${TARG_DIR}/stage0/${LIB_DIR}/ -cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}arena*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/ -cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}extra*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/ -cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}rust*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/ -cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}std*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/ -cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}syntax*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/ -cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}flate*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/ -cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}fmt_macros*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/ -cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}getopts*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/ -cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}graphviz*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/ -cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}log*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/ -cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}rbml*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/ -cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}serialize*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/ -cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}term*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/ -cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}proc_macro*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/ - -# do not fail if one of the above fails, as all we need is a working rustc! -exit 0 - -esac diff --git a/src/etc/mklldeps.py b/src/etc/mklldeps.py deleted file mode 100644 index 24b007576aa..00000000000 --- a/src/etc/mklldeps.py +++ /dev/null @@ -1,113 +0,0 @@ -# Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -import os -import sys -import subprocess - -f = open(sys.argv[1], 'wb') - -components = sys.argv[2].split() # splits on whitespace -enable_static = sys.argv[3] -llvm_config = sys.argv[4] -stdcpp_name = sys.argv[5] -use_libcpp = sys.argv[6] - -f.write("""// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// WARNING: THIS IS A GENERATED FILE, DO NOT MODIFY -// take a look at src/etc/mklldeps.py if you're interested -""") - - -def run(args): - proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - out, err = proc.communicate() - - if err: - print("failed to run llvm_config: args = `{}`".format(args)) - print(err) - sys.exit(1) - return out - -def runErr(args): - proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - out, err = proc.communicate() - - if err: - return False, out - else: - return True, out - -f.write("\n") - -args = [llvm_config, '--shared-mode'] -args.extend(components) -llvm_shared, out = runErr(args) -if llvm_shared: - llvm_shared = 'shared' in out - -# LLVM libs -args = [llvm_config, '--libs', '--system-libs'] -args.extend(components) -out = run(args) -for lib in out.strip().replace("\n", ' ').split(' '): - if len(lib) == 0: - continue - # in some cases we get extra spaces in between libs so ignore those - if len(lib) == 1 and lib == ' ': - continue - # not all libs strictly follow -lfoo, on Bitrig, there is -pthread - if lib[0:2] == '-l': - lib = lib.strip()[2:] - elif lib[0] == '-': - lib = lib.strip()[1:] - # If this actually points at a literal file then we're on MSVC which now - # prints full paths, so get just the name of the library and strip off the - # trailing ".lib" - elif os.path.exists(lib): - lib = os.path.basename(lib)[:-4] - elif lib[-4:] == '.lib': - lib = lib[:-4] - f.write("#[link(name = \"" + lib + "\"") - if not llvm_shared and 'LLVM' in lib: - f.write(", kind = \"static\"") - f.write(")]\n") - -# LLVM ldflags -out = run([llvm_config, '--ldflags']) -for lib in out.strip().split(' '): - if lib[:2] == "-l": - f.write("#[link(name = \"" + lib[2:] + "\")]\n") - -# C++ runtime library -out = run([llvm_config, '--cxxflags']) -if enable_static == '1': - assert('stdlib=libc++' not in out) - f.write("#[link(name = \"" + stdcpp_name + "\", kind = \"static\")]\n") -else: - # Note that we use `cfg_attr` here because on MSVC the C++ standard library - # is not c++ or stdc++, but rather the linker takes care of linking the - # right standard library. - if use_libcpp != "0" or 'stdlib=libc++' in out: - f.write("#[cfg_attr(not(target_env = \"msvc\"), link(name = \"c++\"))]\n") - else: - f.write("#[cfg_attr(not(target_env = \"msvc\"), link(name = \"" + stdcpp_name + "\"))]\n") - -# Attach everything to an extern block -f.write("extern {}\n") diff --git a/src/etc/x86.supp b/src/etc/x86.supp deleted file mode 100644 index 6e409af79ae..00000000000 --- a/src/etc/x86.supp +++ /dev/null @@ -1,65 +0,0 @@ -{ - goddammit-llvm-why-u-no-valgrind - Memcheck:Cond - fun:* - ... -} - -{ - down-with-thread-dtors.rs-fails-otherwise-1 - Memcheck:Addr1 - ... - fun:tlv_finalize - fun:_pthread_tsd_cleanup - fun:_pthread_exit - ... - fun:_pthread_start - fun:thread_start -} - -{ - down-with-thread-dtors.rs-fails-otherwise-2 - Memcheck:Addr2 - ... - fun:tlv_finalize - fun:_pthread_tsd_cleanup - fun:_pthread_exit - ... - fun:_pthread_start - fun:thread_start -} - -{ - down-with-thread-dtors.rs-fails-otherwise-3 - Memcheck:Addr4 - ... - fun:tlv_finalize - fun:_pthread_tsd_cleanup - fun:_pthread_exit - ... - fun:_pthread_start - fun:thread_start -} - -{ - down-with-thread-dtors.rs-fails-otherwise-4 - Memcheck:Addr8 - ... - fun:tlv_finalize - fun:_pthread_tsd_cleanup - fun:_pthread_exit - ... - fun:_pthread_start - fun:thread_start -} - -{ - down-with-thread-dtors.rs-fails-otherwise-5 - Memcheck:Leak - match-leak-kinds: definite - fun:malloc - fun:tlv_allocate_and_initialize_for_key - fun:tlv_get_addr - ... - fun:start -} From 9ad13c8d0204fb7cd9a3988a5a73f60efce39481 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 27 Jan 2017 14:48:48 -0800 Subject: [PATCH 39/70] rustbuild: Fix a few locations with makefiles gone * Add version info to channel.rs as main.mk is no longer available * Update `Makefile.in` used with bootstrap to not try to require `mk/util.mk` * Update the `dist` target to avoid the makefile pieces --- src/bootstrap/channel.rs | 40 ++++++++++++++---------------------- src/bootstrap/dist.rs | 2 -- src/bootstrap/mk/Makefile.in | 3 ++- 3 files changed, 17 insertions(+), 28 deletions(-) diff --git a/src/bootstrap/channel.rs b/src/bootstrap/channel.rs index 585d9f51b92..81e745bc76c 100644 --- a/src/bootstrap/channel.rs +++ b/src/bootstrap/channel.rs @@ -15,55 +15,45 @@ //! `package_vers`, and otherwise indicating to the compiler what it should //! print out as part of its version information. -use std::fs::File; -use std::io::prelude::*; use std::process::Command; use build_helper::output; use Build; -pub fn collect(build: &mut Build) { - // Currently the canonical source for the release number (e.g. 1.10.0) and - // the prerelease version (e.g. `.1`) is in `mk/main.mk`. We "parse" that - // here to learn about those numbers. - let mut main_mk = String::new(); - t!(t!(File::open(build.src.join("mk/main.mk"))).read_to_string(&mut main_mk)); - let mut release_num = ""; - let mut prerelease_version = ""; - for line in main_mk.lines() { - if line.starts_with("CFG_RELEASE_NUM") { - release_num = line.split('=').skip(1).next().unwrap().trim(); - } - if line.starts_with("CFG_PRERELEASE_VERSION") { - prerelease_version = line.split('=').skip(1).next().unwrap().trim(); - } - } +// The version number +const CFG_RELEASE_NUM: &'static str = "1.17.0"; - build.release_num = release_num.to_string(); - build.prerelease_version = release_num.to_string(); +// An optional number to put after the label, e.g. '.2' -> '-beta.2' +// Be sure to make this starts with a dot to conform to semver pre-release +// versions (section 9) +const CFG_PRERELEASE_VERSION: &'static str = ".1"; + +pub fn collect(build: &mut Build) { + build.release_num = CFG_RELEASE_NUM.to_string(); + build.prerelease_version = CFG_RELEASE_NUM.to_string(); // Depending on the channel, passed in `./configure --release-channel`, // determine various properties of the build. match &build.config.channel[..] { "stable" => { - build.release = release_num.to_string(); + build.release = CFG_RELEASE_NUM.to_string(); build.package_vers = build.release.clone(); build.unstable_features = false; } "beta" => { - build.release = format!("{}-beta{}", release_num, - prerelease_version); + build.release = format!("{}-beta{}", CFG_RELEASE_NUM, + CFG_PRERELEASE_VERSION); build.package_vers = "beta".to_string(); build.unstable_features = false; } "nightly" => { - build.release = format!("{}-nightly", release_num); + build.release = format!("{}-nightly", CFG_RELEASE_NUM); build.package_vers = "nightly".to_string(); build.unstable_features = true; } _ => { - build.release = format!("{}-dev", release_num); + build.release = format!("{}-dev", CFG_RELEASE_NUM); build.package_vers = build.release.clone(); build.unstable_features = true; } diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 9327cc0cf7f..1c3901bf2a1 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -381,13 +381,11 @@ pub fn rust_src(build: &Build) { "README.md", "RELEASES.md", "configure", - "Makefile.in", "x.py", ]; let src_dirs = [ "man", "src", - "mk" ]; let filter_fn = move |path: &Path| { diff --git a/src/bootstrap/mk/Makefile.in b/src/bootstrap/mk/Makefile.in index d6f6a7772c9..536095503e0 100644 --- a/src/bootstrap/mk/Makefile.in +++ b/src/bootstrap/mk/Makefile.in @@ -9,11 +9,12 @@ # except according to those terms. include config.mk -include $(CFG_SRC_DIR)mk/util.mk ifdef VERBOSE +Q := BOOTSTRAP_ARGS := -v else +Q := @ BOOTSTRAP_ARGS := endif From c8e0d04878f38e8a91e7a6196fb18878da208887 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 31 Jan 2017 19:16:45 -0800 Subject: [PATCH 40/70] compiletest: Add caching of test results Don't re-run tests in compiletest if all the inputs haven't changed, manage stamp files in the output directory. --- src/Cargo.lock | 1 + src/tools/compiletest/Cargo.toml | 1 + src/tools/compiletest/src/header.rs | 6 +++++ src/tools/compiletest/src/main.rs | 40 +++++++++++++++++++++++++++- src/tools/compiletest/src/runtest.rs | 2 ++ 5 files changed, 49 insertions(+), 1 deletion(-) diff --git a/src/Cargo.lock b/src/Cargo.lock index 06cf32ad0f6..79e75dc70f9 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -99,6 +99,7 @@ name = "compiletest" version = "0.0.0" dependencies = [ "env_logger 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/src/tools/compiletest/Cargo.toml b/src/tools/compiletest/Cargo.toml index 3049875e86e..1fc98a78a7c 100644 --- a/src/tools/compiletest/Cargo.toml +++ b/src/tools/compiletest/Cargo.toml @@ -7,3 +7,4 @@ version = "0.0.0" log = "0.3" env_logger = { version = "0.3.5", default-features = false } rustc-serialize = "0.3" +filetime = "0.1" diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 71d8d62c75b..522cd222c26 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -25,6 +25,7 @@ use extract_gdb_version; pub struct EarlyProps { pub ignore: bool, pub should_fail: bool, + pub aux: Vec, } impl EarlyProps { @@ -32,6 +33,7 @@ impl EarlyProps { let mut props = EarlyProps { ignore: false, should_fail: false, + aux: Vec::new(), }; iter_header(testfile, @@ -50,6 +52,10 @@ impl EarlyProps { ignore_lldb(config, ln) || ignore_llvm(config, ln); + if let Some(s) = parse_aux_build(ln) { + props.aux.push(s); + } + props.should_fail = props.should_fail || parse_name_directive(ln, "should-fail"); }); diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs index c2997c8c160..6c63661d7fb 100644 --- a/src/tools/compiletest/src/main.rs +++ b/src/tools/compiletest/src/main.rs @@ -25,6 +25,7 @@ extern crate rustc_serialize; #[macro_use] extern crate log; extern crate env_logger; +extern crate filetime; use std::env; use std::ffi::OsString; @@ -32,6 +33,7 @@ use std::fs; use std::io; use std::path::{Path, PathBuf}; use std::process::Command; +use filetime::FileTime; use getopts::{optopt, optflag, reqopt}; use common::Config; use common::{Pretty, DebugInfoGdb, DebugInfoLldb, Mode}; @@ -457,7 +459,7 @@ pub fn make_test(config: &Config, testpaths: &TestPaths) -> test::TestDescAndFn }; // Debugging emscripten code doesn't make sense today - let mut ignore = early_props.ignore; + let mut ignore = early_props.ignore || !up_to_date(config, testpaths, &early_props); if (config.mode == DebugInfoGdb || config.mode == DebugInfoLldb) && config.target.contains("emscripten") { ignore = true; @@ -473,6 +475,42 @@ pub fn make_test(config: &Config, testpaths: &TestPaths) -> test::TestDescAndFn } } +fn stamp(config: &Config, testpaths: &TestPaths) -> PathBuf { + let stamp_name = format!("{}-H-{}-T-{}-S-{}.stamp", + testpaths.file.file_name().unwrap() + .to_str().unwrap(), + config.host, + config.target, + config.stage_id); + config.build_base.canonicalize() + .unwrap_or(config.build_base.clone()) + .join(stamp_name) +} + +fn up_to_date(config: &Config, testpaths: &TestPaths, props: &EarlyProps) -> bool { + let stamp = mtime(&stamp(config, testpaths)); + let mut inputs = vec![ + mtime(&testpaths.file), + mtime(&config.rustc_path), + ]; + for aux in props.aux.iter() { + inputs.push(mtime(&testpaths.file.parent().unwrap() + .join("auxiliary") + .join(aux))); + } + for lib in config.run_lib_path.read_dir().unwrap() { + let lib = lib.unwrap(); + inputs.push(mtime(&lib.path())); + } + inputs.iter().any(|input| *input > stamp) +} + +fn mtime(path: &Path) -> FileTime { + fs::metadata(path).map(|f| { + FileTime::from_last_modification_time(&f) + }).unwrap_or(FileTime::zero()) +} + pub fn make_test_name(config: &Config, testpaths: &TestPaths) -> test::TestName { // Convert a complete path to something like // diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index a8c46722e16..10d5f0d979f 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -80,6 +80,8 @@ pub fn run(config: Config, testpaths: &TestPaths) { } base_cx.complete_all(); + + File::create(::stamp(&config, &testpaths)).unwrap(); } struct TestCx<'test> { From 05eef36fa5ff9235ea8124a6396c7973015b4b8b Mon Sep 17 00:00:00 2001 From: Oliver Middleton Date: Mon, 6 Feb 2017 17:50:30 +0000 Subject: [PATCH 41/70] rustdoc: Improve impl disambiguation * Don't disambiguate if there are multiple impls for the same type. * Disambiguate for impls of &Foo and &mut Foo. * Don't try to disambiguate generic types. --- src/librustdoc/html/format.rs | 6 ++-- src/librustdoc/html/render.rs | 32 ++++++++++++++------ src/test/rustdoc/impl-disambiguation.rs | 40 +++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 11 deletions(-) create mode 100644 src/test/rustdoc/impl-disambiguation.rs diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 60dae19d876..c591c09bf20 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -671,9 +671,11 @@ fn fmt_type(t: &clean::Type, f: &mut fmt::Formatter, use_absolute: bool) -> fmt: } _ => { if f.alternate() { - write!(f, "&{}{}{:#}", lt, m, **ty) + write!(f, "&{}{}", lt, m)?; + fmt_type(&ty, f, use_absolute) } else { - write!(f, "&{}{}{}", lt, m, **ty) + write!(f, "&{}{}", lt, m)?; + fmt_type(&ty, f, use_absolute) } } } diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 40eb7e5ab78..6234d890244 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -2132,10 +2132,23 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
    ")?; if let Some(implementors) = cache.implementors.get(&it.def_id) { - let mut implementor_count: FxHashMap<&str, usize> = FxHashMap(); + // The DefId is for the first Type found with that name. The bool is + // if any Types with the same name but different DefId have been found. + let mut implementor_dups: FxHashMap<&str, (DefId, bool)> = FxHashMap(); for implementor in implementors { - if let clean::Type::ResolvedPath {ref path, ..} = implementor.impl_.for_ { - *implementor_count.entry(path.last_name()).or_insert(0) += 1; + match implementor.impl_.for_ { + clean::ResolvedPath { ref path, did, is_generic: false, .. } | + clean::BorrowedRef { + type_: box clean::ResolvedPath { ref path, did, is_generic: false, .. }, + .. + } => { + let &mut (prev_did, ref mut has_duplicates) = + implementor_dups.entry(path.last_name()).or_insert((did, false)); + if prev_did != did { + *has_duplicates = true; + } + } + _ => {} } } @@ -2143,12 +2156,13 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, write!(w, "
  • ")?; // If there's already another implementor that has the same abbridged name, use the // full path, for example in `std::iter::ExactSizeIterator` - let use_absolute = if let clean::Type::ResolvedPath { - ref path, .. - } = implementor.impl_.for_ { - implementor_count[path.last_name()] > 1 - } else { - false + let use_absolute = match implementor.impl_.for_ { + clean::ResolvedPath { ref path, is_generic: false, .. } | + clean::BorrowedRef { + type_: box clean::ResolvedPath { ref path, is_generic: false, .. }, + .. + } => implementor_dups[path.last_name()].1, + _ => false, }; fmt_impl_for_trait_page(&implementor.impl_, w, use_absolute)?; writeln!(w, "
  • ")?; diff --git a/src/test/rustdoc/impl-disambiguation.rs b/src/test/rustdoc/impl-disambiguation.rs new file mode 100644 index 00000000000..afe1daf5983 --- /dev/null +++ b/src/test/rustdoc/impl-disambiguation.rs @@ -0,0 +1,40 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_name = "foo"] + +pub trait Foo {} + +pub struct Bar { field: T } + +// @has foo/trait.Foo.html '//*[@class="item-list"]//code' \ +// "impl Foo for Bar" +impl Foo for Bar {} +// @has foo/trait.Foo.html '//*[@class="item-list"]//code' \ +// "impl Foo for Bar" +impl Foo for Bar {} +// @has foo/trait.Foo.html '//*[@class="item-list"]//code' \ +// "impl<'a> Foo for &'a Bar" +impl<'a> Foo for &'a Bar {} + +pub mod mod1 { + pub struct Baz {} +} + +pub mod mod2 { + pub enum Baz {} +} + +// @has foo/trait.Foo.html '//*[@class="item-list"]//code' \ +// "impl Foo for foo::mod1::Baz" +impl Foo for mod1::Baz {} +// @has foo/trait.Foo.html '//*[@class="item-list"]//code' \ +// "impl<'a> Foo for &'a foo::mod2::Baz" +impl<'a> Foo for &'a mod2::Baz {} From 1ee88e516c367660f263f4db354602c5b848a2ca Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Sun, 5 Feb 2017 09:44:49 +0100 Subject: [PATCH 42/70] A few documentation improvements for `syntax::print::pp` * Moved algorithm explanation to module docs * Added ``` before and after the examples * Explanation of the `rbox`, `ibox` and `cbox` names * Added docs about the breaking types to `Breaks` --- src/libsyntax/print/pp.rs | 167 ++++++++++++++++++++------------------ 1 file changed, 89 insertions(+), 78 deletions(-) diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs index 792239e7219..1d67c2a2c2b 100644 --- a/src/libsyntax/print/pp.rs +++ b/src/libsyntax/print/pp.rs @@ -60,11 +60,95 @@ //! by two zero-length breaks. The algorithm will try its best to fit it on a //! line (which it can't) and so naturally place the content on its own line to //! avoid combining it with other lines and making matters even worse. +//! +//! # Explanation +//! +//! In case you do not have the paper, here is an explanation of what's going +//! on. +//! +//! There is a stream of input tokens flowing through this printer. +//! +//! The printer buffers up to 3N tokens inside itself, where N is linewidth. +//! Yes, linewidth is chars and tokens are multi-char, but in the worst +//! case every token worth buffering is 1 char long, so it's ok. +//! +//! Tokens are String, Break, and Begin/End to delimit blocks. +//! +//! Begin tokens can carry an offset, saying "how far to indent when you break +//! inside here", as well as a flag indicating "consistent" or "inconsistent" +//! breaking. Consistent breaking means that after the first break, no attempt +//! will be made to flow subsequent breaks together onto lines. Inconsistent +//! is the opposite. Inconsistent breaking example would be, say: +//! +//! ``` +//! foo(hello, there, good, friends) +//! ``` +//! +//! breaking inconsistently to become +//! +//! ``` +//! foo(hello, there +//! good, friends); +//! ``` +//! +//! whereas a consistent breaking would yield: +//! +//! ``` +//! foo(hello, +//! there +//! good, +//! friends); +//! ``` +//! +//! That is, in the consistent-break blocks we value vertical alignment +//! more than the ability to cram stuff onto a line. But in all cases if it +//! can make a block a one-liner, it'll do so. +//! +//! Carrying on with high-level logic: +//! +//! The buffered tokens go through a ring-buffer, 'tokens'. The 'left' and +//! 'right' indices denote the active portion of the ring buffer as well as +//! describing hypothetical points-in-the-infinite-stream at most 3N tokens +//! apart (i.e. "not wrapped to ring-buffer boundaries"). The paper will switch +//! between using 'left' and 'right' terms to denote the wrapped-to-ring-buffer +//! and point-in-infinite-stream senses freely. +//! +//! There is a parallel ring buffer, 'size', that holds the calculated size of +//! each token. Why calculated? Because for Begin/End pairs, the "size" +//! includes everything between the pair. That is, the "size" of Begin is +//! actually the sum of the sizes of everything between Begin and the paired +//! End that follows. Since that is arbitrarily far in the future, 'size' is +//! being rewritten regularly while the printer runs; in fact most of the +//! machinery is here to work out 'size' entries on the fly (and give up when +//! they're so obviously over-long that "infinity" is a good enough +//! approximation for purposes of line breaking). +//! +//! The "input side" of the printer is managed as an abstract process called +//! SCAN, which uses 'scan_stack', to manage calculating 'size'. SCAN is, in +//! other words, the process of calculating 'size' entries. +//! +//! The "output side" of the printer is managed by an abstract process called +//! PRINT, which uses 'print_stack', 'margin' and 'space' to figure out what to +//! do with each token/size pair it consumes as it goes. It's trying to consume +//! the entire buffered window, but can't output anything until the size is >= +//! 0 (sizes are set to negative while they're pending calculation). +//! +//! So SCAN takes input and buffers tokens and pending calculations, while +//! PRINT gobbles up completed calculations and tokens from the buffer. The +//! theory is that the two can never get more than 3N tokens apart, because +//! once there's "obviously" too much data to fit on a line, in a size +//! calculation, SCAN will write "infinity" to the size and let PRINT consume +//! it. +//! +//! In this implementation (following the paper, again) the SCAN process is +//! the method called `Printer::pretty_print`, and the 'PRINT' process is the method +//! called `Printer::print`. use std::collections::VecDeque; use std::fmt; use std::io; +/// How to break. Described in more detail in the module docs. #[derive(Clone, Copy, PartialEq)] pub enum Breaks { Consistent, @@ -177,81 +261,6 @@ pub fn mk_printer<'a>(out: Box, linewidth: usize) -> Printer<'a> { } } - -/// In case you do not have the paper, here is an explanation of what's going -/// on. -/// -/// There is a stream of input tokens flowing through this printer. -/// -/// The printer buffers up to 3N tokens inside itself, where N is linewidth. -/// Yes, linewidth is chars and tokens are multi-char, but in the worst -/// case every token worth buffering is 1 char long, so it's ok. -/// -/// Tokens are String, Break, and Begin/End to delimit blocks. -/// -/// Begin tokens can carry an offset, saying "how far to indent when you break -/// inside here", as well as a flag indicating "consistent" or "inconsistent" -/// breaking. Consistent breaking means that after the first break, no attempt -/// will be made to flow subsequent breaks together onto lines. Inconsistent -/// is the opposite. Inconsistent breaking example would be, say: -/// -/// foo(hello, there, good, friends) -/// -/// breaking inconsistently to become -/// -/// foo(hello, there -/// good, friends); -/// -/// whereas a consistent breaking would yield: -/// -/// foo(hello, -/// there -/// good, -/// friends); -/// -/// That is, in the consistent-break blocks we value vertical alignment -/// more than the ability to cram stuff onto a line. But in all cases if it -/// can make a block a one-liner, it'll do so. -/// -/// Carrying on with high-level logic: -/// -/// The buffered tokens go through a ring-buffer, 'tokens'. The 'left' and -/// 'right' indices denote the active portion of the ring buffer as well as -/// describing hypothetical points-in-the-infinite-stream at most 3N tokens -/// apart (i.e. "not wrapped to ring-buffer boundaries"). The paper will switch -/// between using 'left' and 'right' terms to denote the wrapped-to-ring-buffer -/// and point-in-infinite-stream senses freely. -/// -/// There is a parallel ring buffer, 'size', that holds the calculated size of -/// each token. Why calculated? Because for Begin/End pairs, the "size" -/// includes everything between the pair. That is, the "size" of Begin is -/// actually the sum of the sizes of everything between Begin and the paired -/// End that follows. Since that is arbitrarily far in the future, 'size' is -/// being rewritten regularly while the printer runs; in fact most of the -/// machinery is here to work out 'size' entries on the fly (and give up when -/// they're so obviously over-long that "infinity" is a good enough -/// approximation for purposes of line breaking). -/// -/// The "input side" of the printer is managed as an abstract process called -/// SCAN, which uses 'scan_stack', to manage calculating 'size'. SCAN is, in -/// other words, the process of calculating 'size' entries. -/// -/// The "output side" of the printer is managed by an abstract process called -/// PRINT, which uses 'print_stack', 'margin' and 'space' to figure out what to -/// do with each token/size pair it consumes as it goes. It's trying to consume -/// the entire buffered window, but can't output anything until the size is >= -/// 0 (sizes are set to negative while they're pending calculation). -/// -/// So SCAN takes input and buffers tokens and pending calculations, while -/// PRINT gobbles up completed calculations and tokens from the buffer. The -/// theory is that the two can never get more than 3N tokens apart, because -/// once there's "obviously" too much data to fit on a line, in a size -/// calculation, SCAN will write "infinity" to the size and let PRINT consume -/// it. -/// -/// In this implementation (following the paper, again) the SCAN process is -/// the method called 'pretty_print', and the 'PRINT' process is the method -/// called 'print'. pub struct Printer<'a> { pub out: Box, buf_len: usize, @@ -292,7 +301,7 @@ impl<'a> Printer<'a> { pub fn last_token(&mut self) -> Token { self.buf[self.right].token.clone() } - // be very careful with this! + /// be very careful with this! pub fn replace_last_token(&mut self, t: Token) { self.buf[self.right].token = t; } @@ -571,8 +580,8 @@ impl<'a> Printer<'a> { } // Convenience functions to talk to the printer. -// -// "raw box" + +/// "raw box" pub fn rbox(p: &mut Printer, indent: usize, b: Breaks) -> io::Result<()> { p.pretty_print(Token::Begin(BeginToken { offset: indent as isize, @@ -580,10 +589,12 @@ pub fn rbox(p: &mut Printer, indent: usize, b: Breaks) -> io::Result<()> { })) } +/// Inconsistent breaking box pub fn ibox(p: &mut Printer, indent: usize) -> io::Result<()> { rbox(p, indent, Breaks::Inconsistent) } +/// Consistent breaking box pub fn cbox(p: &mut Printer, indent: usize) -> io::Result<()> { rbox(p, indent, Breaks::Consistent) } From bfa264271c7c20ca71b7cbb5c918ff264294653c Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 6 Feb 2017 10:39:14 -0800 Subject: [PATCH 43/70] Revert "Add 128-bit atomics" This reverts commit 9903975003276cc42a1ed5f21eee292b7c62c331. --- src/libcore/sync/atomic.rs | 18 ------------------ .../atomic-lock-free/atomic_lock_free.rs | 10 +--------- 2 files changed, 1 insertion(+), 27 deletions(-) diff --git a/src/libcore/sync/atomic.rs b/src/libcore/sync/atomic.rs index 58cd0af7ee3..743e3c41170 100644 --- a/src/libcore/sync/atomic.rs +++ b/src/libcore/sync/atomic.rs @@ -1318,24 +1318,6 @@ atomic_int! { unstable(feature = "integer_atomics", issue = "32976"), u64 AtomicU64 ATOMIC_U64_INIT } -#[cfg(not(stage0))] -#[cfg(target_has_atomic = "128")] -atomic_int! { - unstable(feature = "i128", issue = "35118"), - unstable(feature = "i128", issue = "35118"), - unstable(feature = "i128", issue = "35118"), - unstable(feature = "i128", issue = "35118"), - i128 AtomicI128 ATOMIC_I128_INIT -} -#[cfg(not(stage0))] -#[cfg(target_has_atomic = "128")] -atomic_int! { - unstable(feature = "i128", issue = "35118"), - unstable(feature = "i128", issue = "35118"), - unstable(feature = "i128", issue = "35118"), - unstable(feature = "i128", issue = "35118"), - u128 AtomicU128 ATOMIC_U128_INIT -} #[cfg(target_has_atomic = "ptr")] atomic_int!{ stable(feature = "rust1", since = "1.0.0"), diff --git a/src/test/run-make/atomic-lock-free/atomic_lock_free.rs b/src/test/run-make/atomic-lock-free/atomic_lock_free.rs index 5ac50e04b8d..023f2218b87 100644 --- a/src/test/run-make/atomic-lock-free/atomic_lock_free.rs +++ b/src/test/run-make/atomic-lock-free/atomic_lock_free.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(cfg_target_has_atomic, no_core, intrinsics, lang_items, i128_type)] +#![feature(cfg_target_has_atomic, no_core, intrinsics, lang_items)] #![crate_type="rlib"] #![no_core] @@ -54,14 +54,6 @@ pub unsafe fn atomic_u64(x: *mut u64) { pub unsafe fn atomic_i64(x: *mut i64) { atomic_xadd(x, 1); } -#[cfg(target_has_atomic = "128")] -pub unsafe fn atomic_u128(x: *mut u128) { - atomic_xadd(x, 1); -} -#[cfg(target_has_atomic = "128")] -pub unsafe fn atomic_i128(x: *mut i128) { - atomic_xadd(x, 1); -} #[cfg(target_has_atomic = "ptr")] pub unsafe fn atomic_usize(x: *mut usize) { atomic_xadd(x, 1); From acd84c2f82e303fbc135e69f0d4e2c68d7218f1d Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Mon, 6 Feb 2017 15:05:37 -0500 Subject: [PATCH 44/70] Re-write the doc index page Clarify and reorganize. Add the section for the bookshelf. More to come here in the near future! Part of #39588 --- src/doc/index.md | 52 +++++++++++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/src/doc/index.md b/src/doc/index.md index 71dfcf0b067..0533f8d7518 100644 --- a/src/doc/index.md +++ b/src/doc/index.md @@ -6,32 +6,44 @@ nav { } -This is an index of the documentation included with the Rust -compiler. For more comprehensive documentation see [the -website](https://www.rust-lang.org). +This page is an overview of the documentation included with your Rust install. +Other unofficial documentation may exist elsewhere; for example, the [Rust +Learning] project collects documentation from the community, and [Docs.rs] +builds documentation for individual Rust packages. -[**The Rust Programming Language**][book]. Also known as "The Book", -The Rust Programming Language is the most comprehensive resource for -all topics related to Rust, and is the primary official document of -the language. +## API Documentation -[**The Rust Reference**][ref]. While Rust does not have a -specification, the reference tries to describe its working in -detail. It is accurate, but not necessarily complete. +Rust provides a standard library with a number of features; you can browse +its documentation [here][api]. -[**Standard Library API Reference**][api]. Documentation for the -standard library. +## Reference Documentation -[**The Rustonomicon**][nomicon]. An entire book dedicated to -explaining how to write unsafe Rust code. It is for advanced Rust -programmers. +Rust does not yet have a formal specification, but we have a reference document +[ref][ref]. It is guaranteed to be accurate, but not complete. We now have a +policy that all new features must be included in the reference before +stabilization; however, we are still back-filling things that landed before +then. That work is being tracked [here][38643]. -[**Compiler Error Index**][err]. Extended explanations of -the errors produced by the Rust compiler. +## Extended Error Documentation -[book]: book/index.html -[ref]: reference.html +All of Rust's errors code with error codes, and you can request extended +diagnostics from the compiler on those errors. We also produce those +diagnostics on the web [here][err], if you prefer to read them that way. + +## The Rust Bookshelf + +Rust provides a number of book-length sets of documentation, collectively +nicknamed 'The Rust Bookshelf.' + +* [The Rust Programming Language][book] teaches you how to program in Rust. +* [The Rustinomicon][nomicon] is your guidebook to the dark arts of unsafe Rust. + +[Rust Learning]: https://github.com/ctjhoa/rust-learning +[Docs.rs]: https://docs.rs/ [api]: std/index.html -[nomicon]: nomicon/index.html +[ref]: reference.html +[38643]: https://github.com/rust-lang/rust/issues/38643 [err]: error-index.html +[book]: book/index.html +[nomicon]: nomicon/index.html From b0803d4aedc06504cb4cb86f63beb6650ff67a8e Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 6 Feb 2017 22:11:03 +0100 Subject: [PATCH 45/70] Display correct filename with --test option --- src/librustdoc/html/markdown.rs | 8 ++++--- src/librustdoc/markdown.rs | 6 +++--- src/librustdoc/test.rs | 37 +++++++++++++++++++-------------- 3 files changed, 29 insertions(+), 22 deletions(-) diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index e8ff8930bdd..e70030912db 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -35,6 +35,7 @@ use std::fmt::{self, Write}; use std::slice; use std::str; use syntax::feature_gate::UnstableFeatures; +use syntax::codemap::Span; use html::render::derive_id; use html::toc::TocBuilder; @@ -429,7 +430,7 @@ pub fn render(w: &mut fmt::Formatter, } } -pub fn find_testable_code(doc: &str, tests: &mut ::test::Collector, start_line: usize) { +pub fn find_testable_code(doc: &str, tests: &mut ::test::Collector, position: Span) { extern fn block(_ob: *mut hoedown_buffer, text: *const hoedown_buffer, lang: *const hoedown_buffer, @@ -454,11 +455,12 @@ pub fn find_testable_code(doc: &str, tests: &mut ::test::Collector, start_line: }); let text = lines.collect::>().join("\n"); let line = tests.get_line() + line; + let filename = tests.get_filename(); tests.add_test(text.to_owned(), block_info.should_panic, block_info.no_run, block_info.ignore, block_info.test_harness, block_info.compile_fail, block_info.error_codes, - line); + line, filename); } } @@ -479,7 +481,7 @@ pub fn find_testable_code(doc: &str, tests: &mut ::test::Collector, start_line: } } - tests.set_line(start_line); + tests.set_position(position); unsafe { let ob = hoedown_buffer_new(DEF_OUNIT); let renderer = hoedown_html_renderer_new(0, 0); diff --git a/src/librustdoc/markdown.rs b/src/librustdoc/markdown.rs index 49497957be9..70ef7c597e4 100644 --- a/src/librustdoc/markdown.rs +++ b/src/librustdoc/markdown.rs @@ -18,6 +18,7 @@ use getopts; use testing; use rustc::session::search_paths::SearchPaths; use rustc::session::config::Externs; +use syntax::codemap::DUMMY_SP; use externalfiles::{ExternalHtml, LoadStringError, load_string}; @@ -154,9 +155,8 @@ pub fn test(input: &str, cfgs: Vec, libs: SearchPaths, externs: Externs, let mut opts = TestOptions::default(); opts.no_crate_inject = true; let mut collector = Collector::new(input.to_string(), cfgs, libs, externs, - true, opts, maybe_sysroot, "input".to_string(), - None); - find_testable_code(&input_str, &mut collector, 0); + true, opts, maybe_sysroot, None); + find_testable_code(&input_str, &mut collector, DUMMY_SP); test_args.insert(0, "rustdoctest".to_string()); testing::test_main(&test_args, collector.tests); 0 diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index 6f38da4f24b..930cf401e74 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -37,7 +37,7 @@ use rustc_trans::back::link; use syntax::ast; use syntax::codemap::CodeMap; use syntax::feature_gate::UnstableFeatures; -use syntax_pos::{BytePos, DUMMY_SP, Pos}; +use syntax_pos::{BytePos, DUMMY_SP, Pos, Span}; use errors; use errors::emitter::ColorConfig; @@ -97,7 +97,6 @@ pub fn run(input: &str, link::find_crate_name(None, &hir_forest.krate().attrs, &input) }); let opts = scrape_test_config(hir_forest.krate()); - let filename = input_path.to_str().unwrap_or("").to_owned(); let mut collector = Collector::new(crate_name, cfgs, libs, @@ -105,7 +104,6 @@ pub fn run(input: &str, false, opts, maybe_sysroot, - filename, Some(codemap)); { @@ -391,15 +389,14 @@ pub struct Collector { cratename: String, opts: TestOptions, maybe_sysroot: Option, - filename: String, - start_line: usize, + position: Span, codemap: Option>, } impl Collector { pub fn new(cratename: String, cfgs: Vec, libs: SearchPaths, externs: Externs, use_headers: bool, opts: TestOptions, maybe_sysroot: Option, - filename: String, codemap: Option>) -> Collector { + codemap: Option>) -> Collector { Collector { tests: Vec::new(), names: Vec::new(), @@ -412,8 +409,7 @@ impl Collector { cratename: cratename, opts: opts, maybe_sysroot: maybe_sysroot, - filename: filename, - start_line: 0, + position: DUMMY_SP, codemap: codemap, } } @@ -421,8 +417,8 @@ impl Collector { pub fn add_test(&mut self, test: String, should_panic: bool, no_run: bool, should_ignore: bool, as_test_harness: bool, compile_fail: bool, error_codes: Vec, - line: usize) { - let name = format!("{} - line {}", self.filename, line); + line: usize, filename: String) { + let name = format!("{} - line {}", filename, line); self.cnt += 1; let cfgs = self.cfgs.clone(); let libs = self.libs.clone(); @@ -467,16 +463,25 @@ impl Collector { } pub fn get_line(&self) -> usize { - if let Some(ref codemap) = self.codemap{ - let line = codemap.lookup_char_pos(BytePos(self.start_line as u32)).line; + if let Some(ref codemap) = self.codemap { + let line = self.position.lo.to_usize(); + let line = codemap.lookup_char_pos(BytePos(line as u32)).line; if line > 0 { line - 1 } else { line } } else { - self.start_line + 0 } } - pub fn set_line(&mut self, start_line: usize) { - self.start_line = start_line; + pub fn set_position(&mut self, position: Span) { + self.position = position; + } + + pub fn get_filename(&self) -> String { + if let Some(ref codemap) = self.codemap { + codemap.span_to_filename(self.position) + } else { + "".to_owned() + } } pub fn register_header(&mut self, name: &str, level: u32) { @@ -520,7 +525,7 @@ impl<'a, 'hir> HirCollector<'a, 'hir> { if let Some(doc) = attrs.doc_value() { self.collector.cnt = 0; markdown::find_testable_code(doc, self.collector, - attrs.span.unwrap_or(DUMMY_SP).lo.to_usize()); + attrs.span.unwrap_or(DUMMY_SP)); } nested(self); From 19bbd855ef73c28b381fd98553aedb0a7423efc4 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sat, 4 Feb 2017 16:53:17 -0800 Subject: [PATCH 46/70] Fix branch name Cargo's downloaded from This landed on beta in #39546 and this is bringing the patch back to master. --- src/bootstrap/dist.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 9327cc0cf7f..9878d1c08ba 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -517,9 +517,7 @@ pub fn cargo(build: &Build, stage: u32, target: &str) { let branch = match &build.config.channel[..] { "stable" | - "beta" => { - build.release.split(".").take(2).collect::>().join(".") - } + "beta" => format!("rust-{}", build.release_num), _ => "master".to_string(), }; From bf126d244e28ba9bb6ce56127ebe6d5703d87a39 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 6 Feb 2017 13:33:03 -0800 Subject: [PATCH 47/70] Fix a manifest-generation bug on beta Right now all Cargo release tarballs are 'nightly', they're not on the standard channels yet. --- src/tools/build-manifest/src/main.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index 8c15a6630a3..3eaac82d9fa 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -317,6 +317,8 @@ impl Builder { fn filename(&self, component: &str, target: &str) -> String { if component == "rust-src" { format!("rust-src-{}.tar.gz", self.channel) + } else if component == "cargo" { + format!("cargo-nightly-{}.tar.gz", target) } else { format!("{}-{}-{}.tar.gz", component, self.channel, target) } From 2a345bbcc1e6332241883f784896ea93d2a7ccb3 Mon Sep 17 00:00:00 2001 From: Jack O'Connor Date: Fri, 3 Feb 2017 17:39:41 -0500 Subject: [PATCH 48/70] make Child::try_wait return io::Result> This is much nicer for callers who want to short-circuit real I/O errors with `?`, because they can write this if let Some(status) = foo.try_wait()? { ... } else { ... } instead of this match foo.try_wait() { Ok(status) => { ... } Err(err) if err.kind() == io::ErrorKind::WouldBlock => { ... } Err(err) => return Err(err), } The original design of `try_wait` was patterned after the `Read` and `Write` traits, which support both blocking and non-blocking implementations in a single API. But since `try_wait` is never blocking, it makes sense to optimize for the non-blocking case. Tracking issue: https://github.com/rust-lang/rust/issues/38903 --- src/libstd/process.rs | 15 +++++++-------- src/libstd/sys/redox/process.rs | 8 ++++---- .../sys/unix/process/process_fuchsia.rs | 6 +++--- src/libstd/sys/unix/process/process_unix.rs | 8 ++++---- src/libstd/sys/windows/process.rs | 6 +++--- src/test/run-pass/try-wait.rs | 19 +++++++++---------- 6 files changed, 30 insertions(+), 32 deletions(-) diff --git a/src/libstd/process.rs b/src/libstd/process.rs index c16b97ebda5..4ff35738b50 100644 --- a/src/libstd/process.rs +++ b/src/libstd/process.rs @@ -844,9 +844,9 @@ impl Child { /// guaranteed to repeatedly return a successful exit status so long as the /// child has already exited. /// - /// If the child has exited, then `Ok(status)` is returned. If the exit - /// status is not available at this time then an error is returned with the - /// error kind `WouldBlock`. If an error occurs, then that error is returned. + /// If the child has exited, then `Ok(Some(status))` is returned. If the + /// exit status is not available at this time then `Ok(None)` is returned. + /// If an error occurs, then that error is returned. /// /// Note that unlike `wait`, this function will not attempt to drop stdin. /// @@ -857,14 +857,13 @@ impl Child { /// ```no_run /// #![feature(process_try_wait)] /// - /// use std::io; /// use std::process::Command; /// /// let mut child = Command::new("ls").spawn().unwrap(); /// /// match child.try_wait() { - /// Ok(status) => println!("exited with: {}", status), - /// Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => { + /// Ok(Some(status)) => println!("exited with: {}", status), + /// Ok(None) => { /// println!("status not ready yet, let's really wait"); /// let res = child.wait(); /// println!("result: {:?}", res); @@ -873,8 +872,8 @@ impl Child { /// } /// ``` #[unstable(feature = "process_try_wait", issue = "38903")] - pub fn try_wait(&mut self) -> io::Result { - self.handle.try_wait().map(ExitStatus) + pub fn try_wait(&mut self) -> io::Result> { + Ok(self.handle.try_wait()?.map(ExitStatus)) } /// Simultaneously waits for the child to exit and collect all remaining diff --git a/src/libstd/sys/redox/process.rs b/src/libstd/sys/redox/process.rs index 50dcd44b42e..60dc03fcf47 100644 --- a/src/libstd/sys/redox/process.rs +++ b/src/libstd/sys/redox/process.rs @@ -502,17 +502,17 @@ impl Process { Ok(ExitStatus(status as i32)) } - pub fn try_wait(&mut self) -> io::Result { + pub fn try_wait(&mut self) -> io::Result> { if let Some(status) = self.status { - return Ok(status) + return Ok(Some(status)) } let mut status = 0; let pid = cvt(syscall::waitpid(self.pid, &mut status, syscall::WNOHANG))?; if pid == 0 { - Err(io::Error::from_raw_os_error(syscall::EWOULDBLOCK)) + Ok(None) } else { self.status = Some(ExitStatus(status as i32)); - Ok(ExitStatus(status as i32)) + Ok(Some(ExitStatus(status as i32))) } } } diff --git a/src/libstd/sys/unix/process/process_fuchsia.rs b/src/libstd/sys/unix/process/process_fuchsia.rs index 87acb0ed9b9..0bb2e0c1a83 100644 --- a/src/libstd/sys/unix/process/process_fuchsia.rs +++ b/src/libstd/sys/unix/process/process_fuchsia.rs @@ -165,7 +165,7 @@ impl Process { Ok(ExitStatus::new(proc_info.rec.return_code)) } - pub fn try_wait(&mut self) -> io::Result { + pub fn try_wait(&mut self) -> io::Result> { use default::Default; use sys::process::magenta::*; @@ -179,7 +179,7 @@ impl Process { match status { 0 => { }, // Success x if x == ERR_TIMED_OUT => { - return Err(io::Error::from(io::ErrorKind::WouldBlock)); + return Ok(None); }, _ => { panic!("Failed to wait on process handle: {}", status); }, } @@ -192,7 +192,7 @@ impl Process { return Err(io::Error::new(io::ErrorKind::InvalidData, "Failed to get exit status of process")); } - Ok(ExitStatus::new(proc_info.rec.return_code)) + Ok(Some(ExitStatus::new(proc_info.rec.return_code))) } } diff --git a/src/libstd/sys/unix/process/process_unix.rs b/src/libstd/sys/unix/process/process_unix.rs index 0dc1739c1a1..bbc987209e3 100644 --- a/src/libstd/sys/unix/process/process_unix.rs +++ b/src/libstd/sys/unix/process/process_unix.rs @@ -249,19 +249,19 @@ impl Process { Ok(ExitStatus::new(status)) } - pub fn try_wait(&mut self) -> io::Result { + pub fn try_wait(&mut self) -> io::Result> { if let Some(status) = self.status { - return Ok(status) + return Ok(Some(status)) } let mut status = 0 as c_int; let pid = cvt(unsafe { libc::waitpid(self.pid, &mut status, libc::WNOHANG) })?; if pid == 0 { - Err(io::Error::from_raw_os_error(libc::EWOULDBLOCK)) + Ok(None) } else { self.status = Some(ExitStatus::new(status)); - Ok(ExitStatus::new(status)) + Ok(Some(ExitStatus::new(status))) } } } diff --git a/src/libstd/sys/windows/process.rs b/src/libstd/sys/windows/process.rs index d2ad81023e7..1afb3728c9d 100644 --- a/src/libstd/sys/windows/process.rs +++ b/src/libstd/sys/windows/process.rs @@ -340,18 +340,18 @@ impl Process { } } - pub fn try_wait(&mut self) -> io::Result { + pub fn try_wait(&mut self) -> io::Result> { unsafe { match c::WaitForSingleObject(self.handle.raw(), 0) { c::WAIT_OBJECT_0 => {} c::WAIT_TIMEOUT => { - return Err(io::Error::from_raw_os_error(c::WSAEWOULDBLOCK)) + return Ok(None); } _ => return Err(io::Error::last_os_error()), } let mut status = 0; cvt(c::GetExitCodeProcess(self.handle.raw(), &mut status))?; - Ok(ExitStatus(status)) + Ok(Some(ExitStatus(status))) } } diff --git a/src/test/run-pass/try-wait.rs b/src/test/run-pass/try-wait.rs index d9826373cce..be87b7b3c87 100644 --- a/src/test/run-pass/try-wait.rs +++ b/src/test/run-pass/try-wait.rs @@ -13,7 +13,6 @@ #![feature(process_try_wait)] use std::env; -use std::io; use std::process::Command; use std::thread; use std::time::Duration; @@ -32,17 +31,17 @@ fn main() { .arg("sleep") .spawn() .unwrap(); - let err = me.try_wait().unwrap_err(); - assert_eq!(err.kind(), io::ErrorKind::WouldBlock); - let err = me.try_wait().unwrap_err(); - assert_eq!(err.kind(), io::ErrorKind::WouldBlock); + let maybe_status = me.try_wait().unwrap(); + assert!(maybe_status.is_none()); + let maybe_status = me.try_wait().unwrap(); + assert!(maybe_status.is_none()); me.kill().unwrap(); me.wait().unwrap(); - let status = me.try_wait().unwrap(); + let status = me.try_wait().unwrap().unwrap(); assert!(!status.success()); - let status = me.try_wait().unwrap(); + let status = me.try_wait().unwrap().unwrap(); assert!(!status.success()); let mut me = Command::new(env::current_exe().unwrap()) @@ -51,17 +50,17 @@ fn main() { .unwrap(); loop { match me.try_wait() { - Ok(res) => { + Ok(Some(res)) => { assert!(res.success()); break } - Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => { + Ok(None) => { thread::sleep(Duration::from_millis(1)); } Err(e) => panic!("error in try_wait: {}", e), } } - let status = me.try_wait().unwrap(); + let status = me.try_wait().unwrap().unwrap(); assert!(status.success()); } From b74e668ded0baf4fb6bdb9c3aaa67f8d0c4b27c7 Mon Sep 17 00:00:00 2001 From: Jordi Polo Date: Sun, 5 Feb 2017 08:54:41 +0900 Subject: [PATCH 49/70] Change deprecation warning to indicate custom derive support was removed from the current compiler version --- src/libsyntax/feature_gate.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 52ef2a05fcf..a78c192a120 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -957,12 +957,11 @@ pub const EXPLAIN_ALLOW_INTERNAL_UNSTABLE: &'static str = "allow_internal_unstable side-steps feature gating and stability checks"; pub const EXPLAIN_CUSTOM_DERIVE: &'static str = - "`#[derive]` for custom traits is not stable enough for use. It is deprecated and will \ - be removed in v1.15"; + "`#[derive]` for custom traits is deprecated and will be removed in the future."; pub const EXPLAIN_DEPR_CUSTOM_DERIVE: &'static str = - "`#[derive]` for custom traits is deprecated and will be removed in v1.15. Prefer using \ - procedural macro custom derive"; + "`#[derive]` for custom traits is deprecated and will be removed in the future. \ + Prefer using procedural macro custom derive."; pub const EXPLAIN_DERIVE_UNDERSCORE: &'static str = "attributes of the form `#[derive_*]` are reserved for the compiler"; From ffea076f1b7358b189d36c7090cd90715969c336 Mon Sep 17 00:00:00 2001 From: Gheorghe Anghelescu Date: Tue, 7 Feb 2017 19:47:48 +0200 Subject: [PATCH 50/70] add missing comma --- src/doc/book/lifetimes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/book/lifetimes.md b/src/doc/book/lifetimes.md index 546e66fc8ac..2bf2beb8b74 100644 --- a/src/doc/book/lifetimes.md +++ b/src/doc/book/lifetimes.md @@ -108,7 +108,7 @@ fn skip_prefix<'a, 'b>(line: &'a str, prefix: &'b str) -> &'a str { Let's examine the changes without going too deep into the syntax for now - we'll get to that later. The first change was adding the `<'a, 'b>` after the -method name. This introduces two lifetime parameters: `'a` and `'b`. Next each +method name. This introduces two lifetime parameters: `'a` and `'b`. Next, each reference in the function signature was associated with one of the lifetime parameters by adding the lifetime name after the `&`. This tells the compiler how the lifetimes between different references are related. From 78dd2ec2c28e8238770d1a04a419b8193a7567c1 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Tue, 7 Feb 2017 13:04:57 -0500 Subject: [PATCH 51/70] review nits --- src/doc/index.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/doc/index.md b/src/doc/index.md index 0533f8d7518..144b786f58d 100644 --- a/src/doc/index.md +++ b/src/doc/index.md @@ -13,22 +13,22 @@ builds documentation for individual Rust packages. ## API Documentation -Rust provides a standard library with a number of features; you can browse -its documentation [here][api]. +Rust provides a standard library with a number of features; [we host its +documentation here][api]. ## Reference Documentation -Rust does not yet have a formal specification, but we have a reference document -[ref][ref]. It is guaranteed to be accurate, but not complete. We now have a +Rust does not yet have a formal specification, but we have [a reference document +][ref]. It is guaranteed to be accurate, but not complete. We now have a policy that all new features must be included in the reference before stabilization; however, we are still back-filling things that landed before then. That work is being tracked [here][38643]. ## Extended Error Documentation -All of Rust's errors code with error codes, and you can request extended -diagnostics from the compiler on those errors. We also produce those -diagnostics on the web [here][err], if you prefer to read them that way. +Many of Rust's errors come with error codes, and you can request extended +diagnostics from the compiler on those errors. We also [have the text of those +extended errors on the web][err], if you prefer to read them that way. ## The Rust Bookshelf @@ -36,7 +36,7 @@ Rust provides a number of book-length sets of documentation, collectively nicknamed 'The Rust Bookshelf.' * [The Rust Programming Language][book] teaches you how to program in Rust. -* [The Rustinomicon][nomicon] is your guidebook to the dark arts of unsafe Rust. +* [The Rustonomicon][nomicon] is your guidebook to the dark arts of unsafe Rust. [Rust Learning]: https://github.com/ctjhoa/rust-learning [Docs.rs]: https://docs.rs/ From d0378089dec20c823d44cf8a0833d880f5dc0aa4 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 7 Feb 2017 19:43:22 +0100 Subject: [PATCH 52/70] Add missing urls for current_dir --- src/libstd/env.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libstd/env.rs b/src/libstd/env.rs index 29f2ac6ab44..e2641539294 100644 --- a/src/libstd/env.rs +++ b/src/libstd/env.rs @@ -24,16 +24,19 @@ use path::{Path, PathBuf}; use sys; use sys::os as os_imp; -/// Returns the current working directory as a `PathBuf`. +/// Returns the current working directory as a [`PathBuf`]. /// /// # Errors /// -/// Returns an `Err` if the current working directory value is invalid. +/// Returns an [`Err`] if the current working directory value is invalid. /// Possible cases: /// /// * Current directory does not exist. /// * There are insufficient permissions to access the current directory. /// +/// [`PathBuf`]: ../../std/path/struct.PathBuf.html +/// [`Err`]: ../../std/result/enum.Result.html#method.err +/// /// # Examples /// /// ``` From 37887fce118cf568bb6d3956c76a868bdd098023 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 7 Feb 2017 11:39:42 -0800 Subject: [PATCH 53/70] rustbuild: Clean build/dist on `make clean` Prevents stale artifacts from sticking around by accident! --- src/bootstrap/clean.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bootstrap/clean.rs b/src/bootstrap/clean.rs index e7655458aed..a66ed46fe46 100644 --- a/src/bootstrap/clean.rs +++ b/src/bootstrap/clean.rs @@ -24,6 +24,7 @@ use Build; pub fn clean(build: &Build) { rm_rf(build, "tmp".as_ref()); rm_rf(build, &build.out.join("tmp")); + rm_rf(build, &build.out.join("dist")); for host in build.config.host.iter() { let entries = match build.out.join(host).read_dir() { From 7916e00f2bc343baa665f380084f0b0d8792afa4 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Tue, 7 Feb 2017 19:48:16 +0000 Subject: [PATCH 54/70] Bump stable release date --- RELEASES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASES.md b/RELEASES.md index f26c0b6b611..2df1a83db81 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,4 +1,4 @@ -Version 1.15.1 (2017-02-07) +Version 1.15.1 (2017-02-08) =========================== * [Fix IntoIter::as_mut_slice's signature][39466] From 620074df6a790495621e0a37913d6a5a3221ab32 Mon Sep 17 00:00:00 2001 From: Alex Burka Date: Sat, 28 Jan 2017 16:53:06 -0500 Subject: [PATCH 55/70] reference: clarify #[cfg] section --- src/doc/reference.md | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/doc/reference.md b/src/doc/reference.md index dfdfe328820..97ff1c7598f 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -2114,10 +2114,15 @@ Sometimes one wants to have different compiler outputs from the same code, depending on build target, such as targeted operating system, or to enable release builds. -There are two kinds of configuration options, one that is either defined or not -(`#[cfg(foo)]`), and the other that contains a string that can be checked -against (`#[cfg(bar = "baz")]`). Currently, only compiler-defined configuration -options can have the latter form. +Configuration options are boolean (on or off) and are named either with a +single identifier (e.g. `foo`) or an identifier and a string (e.g. `foo = "bar"`; +the quotes are required and spaces around the `=` are unimportant). Note that +similarly-named options, such as `foo`, `foo="bar"` and `foo="baz"` may each be set +or unset independently. + +Configuration options are either provided by the compiler or passed in on the +command line using `--cfg` (e.g. `rustc main.rs --cfg foo --cfg 'bar="baz"'`). +Rust code then checks for their presence using the `#[cfg(...)]` attribute: ``` // The function is only included in the build when compiling for OSX @@ -2196,7 +2201,10 @@ You can also set another attribute based on a `cfg` variable with `cfg_attr`: #[cfg_attr(a, b)] ``` -Will be the same as `#[b]` if `a` is set by `cfg`, and nothing otherwise. +This is the same as `#[b]` if `a` is set by `cfg`, and nothing otherwise. + +Lastly, configuration options can be used in expressions by invoking the `cfg!` +macro: `cfg!(a)` evaluates to `true` if `a` is set, and `false` otherwise. ### Lint check attributes From e53eaa385ea3eb53d15711f9ce5914f0485a0ddf Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 7 Feb 2017 15:47:03 -0800 Subject: [PATCH 56/70] Rename manifest_version to manifest-version The current manifests encode this with a dash in the name, so we should preserve that! --- src/tools/build-manifest/src/main.rs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index 8c15a6630a3..548a11439f5 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -11,7 +11,7 @@ extern crate toml; extern crate rustc_serialize; -use std::collections::HashMap; +use std::collections::{BTreeMap, HashMap}; use std::env; use std::fs::File; use std::io::{self, Read, Write}; @@ -95,7 +95,6 @@ static MINGW: &'static [&'static str] = &[ "x86_64-pc-windows-gnu", ]; -#[derive(RustcEncodable)] struct Manifest { manifest_version: String, date: String, @@ -171,8 +170,18 @@ impl Builder { self.cargo_version = self.version("cargo", "x86_64-unknown-linux-gnu"); self.digest_and_sign(); - let manifest = self.build_manifest(); - let manifest = toml::encode(&manifest).to_string(); + let Manifest { manifest_version, date, pkg } = self.build_manifest(); + + // Unfortunately we can't use derive(RustcEncodable) here because the + // version field is called `manifest-version`, not `manifest_version`. + // In lieu of that just create the table directly here with a `BTreeMap` + // and wrap it up in a `Value::Table`. + let mut manifest = BTreeMap::new(); + manifest.insert("manifest-version".to_string(), + toml::encode(&manifest_version)); + manifest.insert("date".to_string(), toml::encode(&date)); + manifest.insert("pkg".to_string(), toml::encode(&pkg)); + let manifest = toml::Value::Table(manifest).to_string(); let filename = format!("channel-rust-{}.toml", self.channel); self.write_manifest(&manifest, &filename); From d2f8abf2549304b3b67ac6e837d046ddf02c2cd6 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 6 Feb 2017 23:28:31 +0100 Subject: [PATCH 57/70] Add more test for rustdoc --test --- src/test/rustdoc/test_option_check/bar.rs | 19 +++++ src/test/rustdoc/test_option_check/test.rs | 2 + src/tools/compiletest/src/runtest.rs | 83 +++++++++++++++------- 3 files changed, 79 insertions(+), 25 deletions(-) create mode 100644 src/test/rustdoc/test_option_check/bar.rs diff --git a/src/test/rustdoc/test_option_check/bar.rs b/src/test/rustdoc/test_option_check/bar.rs new file mode 100644 index 00000000000..51daa807526 --- /dev/null +++ b/src/test/rustdoc/test_option_check/bar.rs @@ -0,0 +1,19 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags: --test +// check-test-line-numbers-match + +/// This looks like another awesome test! +/// +/// ``` +/// println!("foo?"); +/// ``` +pub fn foooo() {} diff --git a/src/test/rustdoc/test_option_check/test.rs b/src/test/rustdoc/test_option_check/test.rs index b2afe43204d..a9578c5f434 100644 --- a/src/test/rustdoc/test_option_check/test.rs +++ b/src/test/rustdoc/test_option_check/test.rs @@ -11,6 +11,8 @@ // compile-flags: --test // check-test-line-numbers-match +pub mod bar; + /// This is a Foo; /// /// ``` diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index a8c46722e16..4e527661df7 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -30,6 +30,7 @@ use std::io::{self, BufReader}; use std::path::{Path, PathBuf}; use std::process::{Command, Output, ExitStatus}; use std::str; +use std::collections::HashMap; use extract_gdb_version; @@ -1902,17 +1903,28 @@ actual:\n\ } } - fn check_rustdoc_test_option(&self, res: ProcRes) { - let mut file = fs::File::open(&self.testpaths.file) + fn get_lines>(&self, path: &P, + mut other_files: Option<&mut Vec>) -> Vec { + let mut file = fs::File::open(path) .expect("markdown_test_output_check_entry File::open failed"); let mut content = String::new(); file.read_to_string(&mut content) .expect("markdown_test_output_check_entry read_to_string failed"); let mut ignore = false; - let mut v: Vec = - content.lines() - .enumerate() - .filter_map(|(line_nb, line)| { + content.lines() + .enumerate() + .filter_map(|(line_nb, line)| { + if (line.trim_left().starts_with("pub mod ") || + line.trim_left().starts_with("mod ")) && + line.ends_with(";") { + if let Some(ref mut other_files) = other_files { + other_files.push(line.rsplit("mod ") + .next() + .unwrap() + .replace(";", "")); + } + None + } else { let sline = line.split("///").last().unwrap_or(""); let line = sline.trim_left(); if line.starts_with("```") { @@ -1926,8 +1938,21 @@ actual:\n\ } else { None } - }) - .collect(); + } + }) + .collect() + } + + fn check_rustdoc_test_option(&self, res: ProcRes) { + let mut other_files = Vec::new(); + let mut files: HashMap> = HashMap::new(); + files.insert(self.testpaths.file.to_str().unwrap().to_owned(), + self.get_lines(&self.testpaths.file, Some(&mut other_files))); + for other_file in other_files { + let mut path = self.testpaths.file.clone(); + path.set_file_name(&format!("{}.rs", other_file)); + files.insert(path.to_str().unwrap().to_owned(), self.get_lines(&path, None)); + } let mut tested = 0; for _ in res.stdout.split("\n") @@ -1935,27 +1960,35 @@ actual:\n\ .inspect(|s| { let tmp: Vec<&str> = s.split(" - line ").collect(); if tmp.len() == 2 { - tested += 1; - let line = tmp[1].split(" ...") - .next() - .unwrap_or("0") - .parse() - .unwrap_or(0); - if let Ok(pos) = v.binary_search(&line) { - v.remove(pos); - } else { - self.fatal_proc_rec( - &format!("Not found doc test: \"{}\" in {:?}", s, v), - &res); + let path = tmp[0].rsplit("test ").next().unwrap(); + if let Some(ref mut v) = files.get_mut(path) { + tested += 1; + let line = tmp[1].split(" ...") + .next() + .unwrap_or("0") + .parse() + .unwrap_or(0); + if let Ok(pos) = v.binary_search(&line) { + v.remove(pos); + } else { + self.fatal_proc_rec( + &format!("Not found doc test: \"{}\" in \"{}\":{:?}", + s, path, v), + &res); + } } } }) {} if tested == 0 { - self.fatal_proc_rec("No test has been found", &res); - } else if v.len() != 0 { - self.fatal_proc_rec(&format!("Not found test at line{} {:?}", - if v.len() > 1 { "s" } else { "" }, v), - &res); + self.fatal_proc_rec(&format!("No test has been found... {:?}", files), &res); + } else { + for (entry, v) in &files { + if v.len() != 0 { + self.fatal_proc_rec(&format!("Not found test at line{} \"{}\":{:?}", + if v.len() > 1 { "s" } else { "" }, entry, v), + &res); + } + } } } From 52a887e12b2d5eaaedfee6843826960f4eee42a8 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Wed, 8 Feb 2017 10:56:42 +0100 Subject: [PATCH 58/70] Remove some leftover makefiles. --- mk/cfg/aarch64-unknown-freebsd.mk | 1 - mk/cfg/i686-unknown-netbsd.mk | 1 - 2 files changed, 2 deletions(-) delete mode 100644 mk/cfg/aarch64-unknown-freebsd.mk delete mode 100644 mk/cfg/i686-unknown-netbsd.mk diff --git a/mk/cfg/aarch64-unknown-freebsd.mk b/mk/cfg/aarch64-unknown-freebsd.mk deleted file mode 100644 index 34aee77ae21..00000000000 --- a/mk/cfg/aarch64-unknown-freebsd.mk +++ /dev/null @@ -1 +0,0 @@ -# rustbuild-only target diff --git a/mk/cfg/i686-unknown-netbsd.mk b/mk/cfg/i686-unknown-netbsd.mk deleted file mode 100644 index 34aee77ae21..00000000000 --- a/mk/cfg/i686-unknown-netbsd.mk +++ /dev/null @@ -1 +0,0 @@ -# rustbuild-only target From 4096dd684c5f11dea5bd231a97adfb7205a82213 Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Wed, 8 Feb 2017 14:30:31 -0500 Subject: [PATCH 59/70] Add more examples, get everything passing at last. --- src/doc/reference.md | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/src/doc/reference.md b/src/doc/reference.md index dd3ccb82211..4910313af93 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -1271,10 +1271,12 @@ guaranteed to refer to the same memory address. Constant values must not have destructors, and otherwise permit most forms of data. Constants may refer to the address of other constants, in which case the -address will have the `static` lifetime. (See below on [static lifetime -elision](#static-lifetime-elision).) The compiler is, however, still at -liberty to translate the constant many times, so the address referred to may not -be stable. +address will have elided lifetimes where applicable, otherwise – in most cases – +defaulting to the `static` lifetime. (See below on [static lifetime elision].) +The compiler is, however, still at liberty to translate the constant many times, +so the address referred to may not be stable. + +[static lifetime elision]: #static-lifetime-elision Constants must be explicitly typed. The type may be `bool`, `char`, a number, or a type derived from those primitive types. The derived types are references with @@ -1298,6 +1300,8 @@ const BITS_N_STRINGS: BitsNStrings<'static> = BitsNStrings { }; ``` + + ### Static items A *static item* is similar to a *constant*, except that it represents a precise @@ -1364,7 +1368,7 @@ such, the constant declarations involving `'static` above may be written without the lifetimes. Returning to our previous example: ```rust -#[feature(static_in_const)] +# #![feature(static_in_const)] const BIT1: u32 = 1 << 0; const BIT2: u32 = 1 << 1; @@ -1382,6 +1386,27 @@ const BITS_N_STRINGS: BitsNStrings = BitsNStrings { }; ``` +Note that if the `static` or `const` items include function or closure +references, which themselves include references, the compiler will first try the +standard elision rules ([see discussion in the nomicon][elision-nomicon]). If it +is unable to resolve the lifetimes by its usual rules, it will default to using +the `'static` lifetime. By way of example: + +[elision-nomicon]: https://doc.rust-lang.org/nomicon/lifetime-elision.html + +```rust,ignore +// Resolved as `fn<'a>(&'a str) -> &'a str`. +const RESOLVED_SINGLE: fn(&str) -> &str = .. + +// Resolved as `Fn<'a, 'b, 'c>(&'a Foo, &'b Bar, &'c Baz) -> usize`. +const RESOLVED_MULTIPLE: Fn(&Foo, &Bar, &Baz) -> usize = .. + +// There is insufficient information to bound the return reference lifetime +// relative to the argument lifetimes, so the signature is resolved as +// `Fn(&'static Foo, &'static Bar) -> &'static Baz`. +const RESOLVED_STATIC: Fn(&Foo, &Bar) -> &Baz = .. +``` + ### Traits A _trait_ describes an abstract interface that types can @@ -2079,7 +2104,9 @@ macro scope. ### Miscellaneous attributes -- `deprecated` - mark the item as deprecated; the full attribute is `#[deprecated(since = "crate version", note = "...")`, where both arguments are optional. +- `deprecated` - mark the item as deprecated; the full attribute is + `#[deprecated(since = "crate version", note = "...")`, where both arguments + are optional. - `export_name` - on statics and functions, this determines the name of the exported symbol. - `link_section` - on statics and functions, this specifies the section of the From ab3da976150726fe88a05b65e8fca96e37d3e82a Mon Sep 17 00:00:00 2001 From: Jan Zerebecki Date: Wed, 8 Feb 2017 21:50:29 +0100 Subject: [PATCH 60/70] Add test for #27433 --- src/test/compile-fail/issue-27433.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/test/compile-fail/issue-27433.rs diff --git a/src/test/compile-fail/issue-27433.rs b/src/test/compile-fail/issue-27433.rs new file mode 100644 index 00000000000..78d96398b95 --- /dev/null +++ b/src/test/compile-fail/issue-27433.rs @@ -0,0 +1,15 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + let foo = 42u32; + const FOO : u32 = foo; + //~^ ERROR attempt to use a non-constant value in a constant +} From 3022614ec3c602a5812286c855633ea34683b038 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 8 Feb 2017 18:42:01 +0100 Subject: [PATCH 61/70] Add missing urls on join_paths --- src/libstd/env.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/libstd/env.rs b/src/libstd/env.rs index e2641539294..1ef2cb4ed15 100644 --- a/src/libstd/env.rs +++ b/src/libstd/env.rs @@ -400,15 +400,19 @@ pub struct JoinPathsError { inner: os_imp::JoinPathsError } -/// Joins a collection of `Path`s appropriately for the `PATH` +/// Joins a collection of [`Path`]s appropriately for the `PATH` /// environment variable. /// -/// Returns an `OsString` on success. +/// Returns an [`OsString`] on success. /// -/// Returns an `Err` (containing an error message) if one of the input -/// `Path`s contains an invalid character for constructing the `PATH` +/// Returns an [`Err`][err] (containing an error message) if one of the input +/// [`Path`]s contains an invalid character for constructing the `PATH` /// variable (a double quote on Windows or a colon on Unix). /// +/// [`Path`]: ../../std/path/struct.Path.html +/// [`OsString`]: ../../std/ffi/struct.OsString.html +/// [err]: ../../std/result/enum.Result.html#variant.Err +/// /// # Examples /// /// ``` From 9af6aa38895d3c1d263c52984666893b9ca22fe1 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Thu, 29 Dec 2016 23:28:11 -0500 Subject: [PATCH 62/70] sanitizer support --- src/Cargo.lock | 40 ++++++++++++ src/bootstrap/check.rs | 5 +- src/bootstrap/compile.rs | 12 ++++ src/bootstrap/config.rs | 3 + src/bootstrap/lib.rs | 7 +- src/compiler-rt | 2 +- src/librustc/middle/cstore.rs | 2 + src/librustc/session/config.rs | 25 +++++++- src/librustc_asan/Cargo.toml | 16 +++++ src/librustc_asan/build.rs | 50 +++++++++++++++ src/librustc_asan/lib.rs | 20 ++++++ src/librustc_llvm/ffi.rs | 3 + src/librustc_lsan/Cargo.toml | 16 +++++ src/librustc_lsan/build.rs | 50 +++++++++++++++ src/librustc_lsan/lib.rs | 20 ++++++ src/librustc_metadata/creader.rs | 64 ++++++++++++++++++- src/librustc_metadata/cstore.rs | 5 ++ src/librustc_metadata/cstore_impl.rs | 4 ++ src/librustc_msan/Cargo.toml | 16 +++++ src/librustc_msan/build.rs | 50 +++++++++++++++ src/librustc_msan/lib.rs | 20 ++++++ src/librustc_trans/back/link.rs | 33 ++++++++++ src/librustc_trans/back/write.rs | 18 +++++- src/librustc_trans/declare.rs | 16 +++++ src/librustc_tsan/Cargo.toml | 16 +++++ src/librustc_tsan/build.rs | 50 +++++++++++++++ src/librustc_tsan/lib.rs | 20 ++++++ src/libstd/Cargo.toml | 10 +++ src/libsyntax/feature_gate.rs | 10 +++ src/rustc/std_shim/Cargo.toml | 4 ++ src/rustllvm/RustWrapper.cpp | 6 ++ src/rustllvm/rustllvm.h | 3 + .../feature-gate-sanitizer-runtime.rs | 13 ++++ src/test/run-make/sanitizer-address/Makefile | 21 ++++++ .../run-make/sanitizer-address/overflow.rs | 14 ++++ src/test/run-make/sanitizer-dylib/Makefile | 4 ++ src/test/run-make/sanitizer-dylib/hello.rs | 13 ++++ .../sanitizer-invalid-target/Makefile | 4 ++ .../sanitizer-invalid-target/hello.rs | 13 ++++ src/test/run-make/sanitizer-leak/Makefile | 23 +++++++ src/test/run-make/sanitizer-leak/leak.rs | 16 +++++ src/test/run-make/sanitizer-memory/Makefile | 21 ++++++ src/test/run-make/sanitizer-memory/uninit.rs | 16 +++++ src/test/run-make/sanitizer-thread/Makefile | 21 ++++++ src/test/run-make/sanitizer-thread/racy.rs | 21 ++++++ 45 files changed, 810 insertions(+), 6 deletions(-) create mode 100644 src/librustc_asan/Cargo.toml create mode 100644 src/librustc_asan/build.rs create mode 100644 src/librustc_asan/lib.rs create mode 100644 src/librustc_lsan/Cargo.toml create mode 100644 src/librustc_lsan/build.rs create mode 100644 src/librustc_lsan/lib.rs create mode 100644 src/librustc_msan/Cargo.toml create mode 100644 src/librustc_msan/build.rs create mode 100644 src/librustc_msan/lib.rs create mode 100644 src/librustc_tsan/Cargo.toml create mode 100644 src/librustc_tsan/build.rs create mode 100644 src/librustc_tsan/lib.rs create mode 100644 src/test/compile-fail/feature-gate-sanitizer-runtime.rs create mode 100644 src/test/run-make/sanitizer-address/Makefile create mode 100644 src/test/run-make/sanitizer-address/overflow.rs create mode 100644 src/test/run-make/sanitizer-dylib/Makefile create mode 100644 src/test/run-make/sanitizer-dylib/hello.rs create mode 100644 src/test/run-make/sanitizer-invalid-target/Makefile create mode 100644 src/test/run-make/sanitizer-invalid-target/hello.rs create mode 100644 src/test/run-make/sanitizer-leak/Makefile create mode 100644 src/test/run-make/sanitizer-leak/leak.rs create mode 100644 src/test/run-make/sanitizer-memory/Makefile create mode 100644 src/test/run-make/sanitizer-memory/uninit.rs create mode 100644 src/test/run-make/sanitizer-thread/Makefile create mode 100644 src/test/run-make/sanitizer-thread/racy.rs diff --git a/src/Cargo.lock b/src/Cargo.lock index 06cf32ad0f6..8e987ba3b7f 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -268,6 +268,15 @@ name = "rustc-serialize" version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "rustc_asan" +version = "0.0.0" +dependencies = [ + "alloc_system 0.0.0", + "cmake 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "core 0.0.0", +] + [[package]] name = "rustc_back" version = "0.0.0" @@ -401,6 +410,15 @@ dependencies = [ "rustc_bitflags 0.0.0", ] +[[package]] +name = "rustc_lsan" +version = "0.0.0" +dependencies = [ + "alloc_system 0.0.0", + "cmake 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "core 0.0.0", +] + [[package]] name = "rustc_metadata" version = "0.0.0" @@ -435,6 +453,15 @@ dependencies = [ "syntax_pos 0.0.0", ] +[[package]] +name = "rustc_msan" +version = "0.0.0" +dependencies = [ + "alloc_system 0.0.0", + "cmake 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "core 0.0.0", +] + [[package]] name = "rustc_passes" version = "0.0.0" @@ -516,6 +543,15 @@ dependencies = [ "syntax_pos 0.0.0", ] +[[package]] +name = "rustc_tsan" +version = "0.0.0" +dependencies = [ + "alloc_system 0.0.0", + "cmake 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "core 0.0.0", +] + [[package]] name = "rustc_typeck" version = "0.0.0" @@ -577,6 +613,10 @@ dependencies = [ "panic_abort 0.0.0", "panic_unwind 0.0.0", "rand 0.0.0", + "rustc_asan 0.0.0", + "rustc_lsan 0.0.0", + "rustc_msan 0.0.0", + "rustc_tsan 0.0.0", "std_unicode 0.0.0", "unwind 0.0.0", ] diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs index 19aac0f36bb..573d0df0cee 100644 --- a/src/bootstrap/check.rs +++ b/src/bootstrap/check.rs @@ -332,7 +332,10 @@ pub fn krate(build: &Build, krate: Option<&str>) { let (name, path, features, root) = match mode { Mode::Libstd => { - ("libstd", "src/rustc/std_shim", build.std_features(), "std_shim") + ("libstd", + "src/rustc/std_shim", + build.std_features(), + "std_shim") } Mode::Libtest => { ("libtest", "src/rustc/test_shim", String::new(), "test_shim") diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 776b91028a1..3e29339a75b 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -51,6 +51,18 @@ pub fn std(build: &Build, target: &str, compiler: &Compiler) { if compiler.stage == 0 && build.local_rebuild && !build.config.use_jemalloc { features.push_str(" force_alloc_system"); } + + if compiler.stage != 0 && !build.system_llvm(target) { + // This variable is used by the sanitizer runtime crates, e.g. + // rustc_lsan, to build the sanitizer runtime from C code + // When this variable is missing, those crates won't compile the C code, + // so we don't set this variable during stage0 where llvm-config is + // missing + // We also don't build the runtimes when compiling against system llvm + // because some distributions ship llvm packages that have a directory + // layout different from the one that the runtime's build system expects + cargo.env("LLVM_CONFIG", build.llvm_config(target)); + } cargo.arg("--features").arg(features) .arg("--manifest-path") .arg(build.src.join("src/rustc/std_shim/Cargo.toml")); diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index 6e077691b3a..b171c89c20a 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -108,6 +108,8 @@ pub struct Config { /// Per-target configuration stored in the global configuration structure. #[derive(Default)] pub struct Target { + // `true` if compiling against system LLVM or a pre-built LLVM + pub system_llvm: bool, pub llvm_config: Option, pub jemalloc: Option, pub cc: Option, @@ -512,6 +514,7 @@ impl Config { .or_insert(Target::default()); let root = parse_configure_path(value); target.llvm_config = Some(push_exe_path(root, &["bin", "llvm-config"])); + target.system_llvm = true; } "CFG_JEMALLOC_ROOT" if value.len() > 0 => { let target = self.target_config.entry(self.build.clone()) diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index df1218752d1..21dd4b1520a 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -599,7 +599,8 @@ impl Build { /// Get the space-separated set of activated features for the standard /// library. fn std_features(&self) -> String { - let mut features = "panic-unwind".to_string(); + let mut features = "panic-unwind asan lsan msan tsan".to_string(); + if self.config.debug_jemalloc { features.push_str(" debug-jemalloc"); } @@ -716,6 +717,10 @@ impl Build { } } + fn system_llvm(&self, target: &str) -> bool { + self.config.target_config.get(target).map(|t| t.system_llvm).unwrap_or(false) + } + /// Returns the path to `FileCheck` binary for the specified target fn llvm_filecheck(&self, target: &str) -> PathBuf { let target_config = self.config.target_config.get(target); diff --git a/src/compiler-rt b/src/compiler-rt index a8fc4c169fa..d30da544a8a 160000 --- a/src/compiler-rt +++ b/src/compiler-rt @@ -1 +1 @@ -Subproject commit a8fc4c169fac43a5dc204d4fd56ddb1739f8c178 +Subproject commit d30da544a8afc5d78391dee270bdf40e74a215d3 diff --git a/src/librustc/middle/cstore.rs b/src/librustc/middle/cstore.rs index 6537cc1adce..2d80fc32c46 100644 --- a/src/librustc/middle/cstore.rs +++ b/src/librustc/middle/cstore.rs @@ -229,6 +229,7 @@ pub trait CrateStore<'tcx> { fn is_allocator(&self, cnum: CrateNum) -> bool; fn is_panic_runtime(&self, cnum: CrateNum) -> bool; fn is_compiler_builtins(&self, cnum: CrateNum) -> bool; + fn is_sanitizer_runtime(&self, cnum: CrateNum) -> bool; fn panic_strategy(&self, cnum: CrateNum) -> PanicStrategy; fn extern_crate(&self, cnum: CrateNum) -> Option; /// The name of the crate as it is referred to in source code of the current @@ -390,6 +391,7 @@ impl<'tcx> CrateStore<'tcx> for DummyCrateStore { fn is_allocator(&self, cnum: CrateNum) -> bool { bug!("is_allocator") } fn is_panic_runtime(&self, cnum: CrateNum) -> bool { bug!("is_panic_runtime") } fn is_compiler_builtins(&self, cnum: CrateNum) -> bool { bug!("is_compiler_builtins") } + fn is_sanitizer_runtime(&self, cnum: CrateNum) -> bool { bug!("is_sanitizer_runtime") } fn panic_strategy(&self, cnum: CrateNum) -> PanicStrategy { bug!("panic_strategy") } diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index d41c2ba93b9..24615f2fa69 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -51,6 +51,14 @@ pub struct Config { pub uint_type: UintTy, } +#[derive(Clone)] +pub enum Sanitizer { + Address, + Leak, + Memory, + Thread, +} + #[derive(Clone, Copy, PartialEq, Hash)] pub enum OptLevel { No, // -O0 @@ -626,11 +634,13 @@ macro_rules! options { Some("a number"); pub const parse_panic_strategy: Option<&'static str> = Some("either `panic` or `abort`"); + pub const parse_sanitizer: Option<&'static str> = + Some("one of: `address`, `leak`, `memory` or `thread`"); } #[allow(dead_code)] mod $mod_set { - use super::{$struct_name, Passes, SomePasses, AllPasses}; + use super::{$struct_name, Passes, SomePasses, AllPasses, Sanitizer}; use rustc_back::PanicStrategy; $( @@ -751,6 +761,17 @@ macro_rules! options { } true } + + fn parse_sanitizer(slote: &mut Option, v: Option<&str>) -> bool { + match v { + Some("address") => *slote = Some(Sanitizer::Address), + Some("leak") => *slote = Some(Sanitizer::Leak), + Some("memory") => *slote = Some(Sanitizer::Memory), + Some("thread") => *slote = Some(Sanitizer::Thread), + _ => return false, + } + true + } } ) } @@ -949,6 +970,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, "encode MIR of all functions into the crate metadata"), osx_rpath_install_name: bool = (false, parse_bool, [TRACKED], "pass `-install_name @rpath/...` to the OSX linker"), + sanitizer: Option = (None, parse_sanitizer, [UNTRACKED], + "Use a sanitizer"), } pub fn default_lib_output() -> CrateType { diff --git a/src/librustc_asan/Cargo.toml b/src/librustc_asan/Cargo.toml new file mode 100644 index 00000000000..abbd7cc0966 --- /dev/null +++ b/src/librustc_asan/Cargo.toml @@ -0,0 +1,16 @@ +[package] +authors = ["The Rust Project Developers"] +build = "build.rs" +name = "rustc_asan" +version = "0.0.0" + +[lib] +name = "rustc_asan" +path = "lib.rs" + +[build-dependencies] +cmake = "0.1.18" + +[dependencies] +alloc_system = { path = "../liballoc_system" } +core = { path = "../libcore" } diff --git a/src/librustc_asan/build.rs b/src/librustc_asan/build.rs new file mode 100644 index 00000000000..3e33efcadb8 --- /dev/null +++ b/src/librustc_asan/build.rs @@ -0,0 +1,50 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate cmake; + +use std::path::PathBuf; +use std::env; + +use cmake::Config; + +fn main() { + if let Some(llvm_config) = env::var_os("LLVM_CONFIG") { + let dst = Config::new("../compiler-rt") + .define("COMPILER_RT_BUILD_SANITIZERS", "ON") + .define("COMPILER_RT_BUILD_BUILTINS", "OFF") + .define("COMPILER_RT_BUILD_XRAY", "OFF") + .define("LLVM_CONFIG_PATH", llvm_config) + .build_target("asan") + .build(); + + println!("cargo:rustc-link-search=native={}", + dst.join("build/lib/linux").display()); + println!("cargo:rustc-link-lib=static=clang_rt.asan-x86_64"); + + let src_dir = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap()); + let mut stack = src_dir.join("../compiler-rt") + .read_dir() + .unwrap() + .map(|e| e.unwrap()) + .filter(|e| &*e.file_name() != ".git") + .collect::>(); + while let Some(entry) = stack.pop() { + let path = entry.path(); + if entry.file_type().unwrap().is_dir() { + stack.extend(path.read_dir().unwrap().map(|e| e.unwrap())); + } else { + println!("cargo:rerun-if-changed={}", path.display()); + } + } + } + + println!("cargo:rerun-if-changed=build.rs"); +} diff --git a/src/librustc_asan/lib.rs b/src/librustc_asan/lib.rs new file mode 100644 index 00000000000..71a166b91eb --- /dev/null +++ b/src/librustc_asan/lib.rs @@ -0,0 +1,20 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![cfg_attr(not(stage0), feature(sanitizer_runtime))] +#![cfg_attr(not(stage0), sanitizer_runtime)] +#![feature(alloc_system)] +#![feature(staged_api)] +#![no_std] +#![unstable(feature = "sanitizer_runtime_lib", + reason = "internal implementation detail of sanitizers", + issue = "0")] + +extern crate alloc_system; diff --git a/src/librustc_llvm/ffi.rs b/src/librustc_llvm/ffi.rs index 8510b9f523c..6c9976ca3f8 100644 --- a/src/librustc_llvm/ffi.rs +++ b/src/librustc_llvm/ffi.rs @@ -126,6 +126,9 @@ pub enum Attribute { UWTable = 17, ZExt = 18, InReg = 19, + SanitizeThread = 20, + SanitizeAddress = 21, + SanitizeMemory = 22, } /// LLVMIntPredicate diff --git a/src/librustc_lsan/Cargo.toml b/src/librustc_lsan/Cargo.toml new file mode 100644 index 00000000000..ac53f3fe73a --- /dev/null +++ b/src/librustc_lsan/Cargo.toml @@ -0,0 +1,16 @@ +[package] +authors = ["The Rust Project Developers"] +build = "build.rs" +name = "rustc_lsan" +version = "0.0.0" + +[lib] +name = "rustc_lsan" +path = "lib.rs" + +[build-dependencies] +cmake = "0.1.18" + +[dependencies] +alloc_system = { path = "../liballoc_system" } +core = { path = "../libcore" } diff --git a/src/librustc_lsan/build.rs b/src/librustc_lsan/build.rs new file mode 100644 index 00000000000..f13928d2bd4 --- /dev/null +++ b/src/librustc_lsan/build.rs @@ -0,0 +1,50 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate cmake; + +use std::path::PathBuf; +use std::env; + +use cmake::Config; + +fn main() { + if let Some(llvm_config) = env::var_os("LLVM_CONFIG") { + let dst = Config::new("../compiler-rt") + .define("COMPILER_RT_BUILD_SANITIZERS", "ON") + .define("COMPILER_RT_BUILD_BUILTINS", "OFF") + .define("COMPILER_RT_BUILD_XRAY", "OFF") + .define("LLVM_CONFIG_PATH", llvm_config) + .build_target("lsan") + .build(); + + println!("cargo:rustc-link-search=native={}", + dst.join("build/lib/linux").display()); + println!("cargo:rustc-link-lib=static=clang_rt.lsan-x86_64"); + + let src_dir = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap()); + let mut stack = src_dir.join("../compiler-rt") + .read_dir() + .unwrap() + .map(|e| e.unwrap()) + .filter(|e| &*e.file_name() != ".git") + .collect::>(); + while let Some(entry) = stack.pop() { + let path = entry.path(); + if entry.file_type().unwrap().is_dir() { + stack.extend(path.read_dir().unwrap().map(|e| e.unwrap())); + } else { + println!("cargo:rerun-if-changed={}", path.display()); + } + } + } + + println!("cargo:rerun-if-changed=build.rs"); +} diff --git a/src/librustc_lsan/lib.rs b/src/librustc_lsan/lib.rs new file mode 100644 index 00000000000..71a166b91eb --- /dev/null +++ b/src/librustc_lsan/lib.rs @@ -0,0 +1,20 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![cfg_attr(not(stage0), feature(sanitizer_runtime))] +#![cfg_attr(not(stage0), sanitizer_runtime)] +#![feature(alloc_system)] +#![feature(staged_api)] +#![no_std] +#![unstable(feature = "sanitizer_runtime_lib", + reason = "internal implementation detail of sanitizers", + issue = "0")] + +extern crate alloc_system; diff --git a/src/librustc_metadata/creader.rs b/src/librustc_metadata/creader.rs index 81a4f7c93b6..55dc5aa2876 100644 --- a/src/librustc_metadata/creader.rs +++ b/src/librustc_metadata/creader.rs @@ -17,7 +17,8 @@ use schema::CrateRoot; use rustc::hir::def_id::{CrateNum, DefIndex}; use rustc::hir::svh::Svh; use rustc::middle::cstore::DepKind; -use rustc::session::{config, Session}; +use rustc::session::Session; +use rustc::session::config::{Sanitizer, self}; use rustc_back::PanicStrategy; use rustc::session::search_paths::PathKind; use rustc::middle; @@ -786,6 +787,64 @@ impl<'a> CrateLoader<'a> { &|data| data.needs_panic_runtime()); } + fn inject_sanitizer_runtime(&mut self) { + if let Some(ref sanitizer) = self.sess.opts.debugging_opts.sanitizer { + // Sanitizers can only be used with x86_64 Linux executables linked + // to `std` + if self.sess.target.target.llvm_target != "x86_64-unknown-linux-gnu" { + self.sess.err(&format!("Sanitizers only work with the \ + `x86_64-unknown-linux-gnu` target.")); + return + } + + if !self.sess.crate_types.borrow().iter().all(|ct| { + match *ct { + // Link the runtime + config::CrateTypeExecutable => true, + // This crate will be compiled with the required + // instrumentation pass + config::CrateTypeRlib => false, + _ => { + self.sess.err(&format!("Only executables and rlibs can be \ + compiled with `-Z sanitizer`")); + false + } + } + }) { + return + } + + let mut uses_std = false; + self.cstore.iter_crate_data(|_, data| { + if data.name == "std" { + uses_std = true; + } + }); + + if uses_std { + let name = match *sanitizer { + Sanitizer::Address => "rustc_asan", + Sanitizer::Leak => "rustc_lsan", + Sanitizer::Memory => "rustc_msan", + Sanitizer::Thread => "rustc_tsan", + }; + info!("loading sanitizer: {}", name); + + let symbol = Symbol::intern(name); + let dep_kind = DepKind::Implicit; + let (_, data) = + self.resolve_crate(&None, symbol, symbol, None, DUMMY_SP, + PathKind::Crate, dep_kind); + + // Sanity check the loaded crate to ensure it is indeed a sanitizer runtime + if !data.is_sanitizer_runtime() { + self.sess.err(&format!("the crate `{}` is not a sanitizer runtime", + name)); + } + } + } + } + fn inject_allocator_crate(&mut self) { // Make sure that we actually need an allocator, if none of our // dependencies need one then we definitely don't! @@ -982,6 +1041,9 @@ impl<'a> CrateLoader<'a> { impl<'a> middle::cstore::CrateLoader for CrateLoader<'a> { fn postprocess(&mut self, krate: &ast::Crate) { + // inject the sanitizer runtime before the allocator runtime because all + // sanitizers force the use of the `alloc_system` allocator + self.inject_sanitizer_runtime(); self.inject_allocator_crate(); self.inject_panic_runtime(krate); diff --git a/src/librustc_metadata/cstore.rs b/src/librustc_metadata/cstore.rs index beba5faf3d0..4709ca6101c 100644 --- a/src/librustc_metadata/cstore.rs +++ b/src/librustc_metadata/cstore.rs @@ -297,6 +297,11 @@ impl CrateMetadata { attr::contains_name(&attrs, "compiler_builtins") } + pub fn is_sanitizer_runtime(&self) -> bool { + let attrs = self.get_item_attrs(CRATE_DEF_INDEX); + attr::contains_name(&attrs, "sanitizer_runtime") + } + pub fn is_no_builtins(&self) -> bool { let attrs = self.get_item_attrs(CRATE_DEF_INDEX); attr::contains_name(&attrs, "no_builtins") diff --git a/src/librustc_metadata/cstore_impl.rs b/src/librustc_metadata/cstore_impl.rs index 39581a46960..7b0177bfd23 100644 --- a/src/librustc_metadata/cstore_impl.rs +++ b/src/librustc_metadata/cstore_impl.rs @@ -297,6 +297,10 @@ impl<'tcx> CrateStore<'tcx> for cstore::CStore { self.get_crate_data(cnum).is_compiler_builtins() } + fn is_sanitizer_runtime(&self, cnum: CrateNum) -> bool { + self.get_crate_data(cnum).is_sanitizer_runtime() + } + fn panic_strategy(&self, cnum: CrateNum) -> PanicStrategy { self.get_crate_data(cnum).panic_strategy() } diff --git a/src/librustc_msan/Cargo.toml b/src/librustc_msan/Cargo.toml new file mode 100644 index 00000000000..628746ac232 --- /dev/null +++ b/src/librustc_msan/Cargo.toml @@ -0,0 +1,16 @@ +[package] +authors = ["The Rust Project Developers"] +build = "build.rs" +name = "rustc_msan" +version = "0.0.0" + +[lib] +name = "rustc_msan" +path = "lib.rs" + +[build-dependencies] +cmake = "0.1.18" + +[dependencies] +alloc_system = { path = "../liballoc_system" } +core = { path = "../libcore" } diff --git a/src/librustc_msan/build.rs b/src/librustc_msan/build.rs new file mode 100644 index 00000000000..bf630c7844a --- /dev/null +++ b/src/librustc_msan/build.rs @@ -0,0 +1,50 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate cmake; + +use std::path::PathBuf; +use std::env; + +use cmake::Config; + +fn main() { + if let Some(llvm_config) = env::var_os("LLVM_CONFIG") { + let dst = Config::new("../compiler-rt") + .define("COMPILER_RT_BUILD_SANITIZERS", "ON") + .define("COMPILER_RT_BUILD_BUILTINS", "OFF") + .define("COMPILER_RT_BUILD_XRAY", "OFF") + .define("LLVM_CONFIG_PATH", llvm_config) + .build_target("msan") + .build(); + + println!("cargo:rustc-link-search=native={}", + dst.join("build/lib/linux").display()); + println!("cargo:rustc-link-lib=static=clang_rt.msan-x86_64"); + + let src_dir = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap()); + let mut stack = src_dir.join("../compiler-rt") + .read_dir() + .unwrap() + .map(|e| e.unwrap()) + .filter(|e| &*e.file_name() != ".git") + .collect::>(); + while let Some(entry) = stack.pop() { + let path = entry.path(); + if entry.file_type().unwrap().is_dir() { + stack.extend(path.read_dir().unwrap().map(|e| e.unwrap())); + } else { + println!("cargo:rerun-if-changed={}", path.display()); + } + } + } + + println!("cargo:rerun-if-changed=build.rs"); +} diff --git a/src/librustc_msan/lib.rs b/src/librustc_msan/lib.rs new file mode 100644 index 00000000000..71a166b91eb --- /dev/null +++ b/src/librustc_msan/lib.rs @@ -0,0 +1,20 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![cfg_attr(not(stage0), feature(sanitizer_runtime))] +#![cfg_attr(not(stage0), sanitizer_runtime)] +#![feature(alloc_system)] +#![feature(staged_api)] +#![no_std] +#![unstable(feature = "sanitizer_runtime_lib", + reason = "internal implementation detail of sanitizers", + issue = "0")] + +extern crate alloc_system; diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs index 4ddf8a883bc..1cbfa26b705 100644 --- a/src/librustc_trans/back/link.rs +++ b/src/librustc_trans/back/link.rs @@ -1031,6 +1031,9 @@ fn add_upstream_rust_crates(cmd: &mut Linker, // symbols from the dylib. let src = sess.cstore.used_crate_source(cnum); match data[cnum.as_usize() - 1] { + _ if sess.cstore.is_sanitizer_runtime(cnum) => { + link_sanitizer_runtime(cmd, sess, tmpdir, cnum); + } // compiler-builtins are always placed last to ensure that they're // linked correctly. _ if sess.cstore.is_compiler_builtins(cnum) => { @@ -1048,6 +1051,8 @@ fn add_upstream_rust_crates(cmd: &mut Linker, } } + // compiler-builtins are always placed last to ensure that they're + // linked correctly. // We must always link the `compiler_builtins` crate statically. Even if it // was already "included" in a dylib (e.g. `libstd` when `-C prefer-dynamic` // is used) @@ -1064,6 +1069,34 @@ fn add_upstream_rust_crates(cmd: &mut Linker, } } + // We must link the sanitizer runtime using -Wl,--whole-archive but since + // it's packed in a .rlib, it contains stuff that are not objects that will + // make the linker error. So we must remove those bits from the .rlib before + // linking it. + fn link_sanitizer_runtime(cmd: &mut Linker, + sess: &Session, + tmpdir: &Path, + cnum: CrateNum) { + let src = sess.cstore.used_crate_source(cnum); + let cratepath = &src.rlib.unwrap().0; + let dst = tmpdir.join(cratepath.file_name().unwrap()); + let cfg = archive_config(sess, &dst, Some(cratepath)); + let mut archive = ArchiveBuilder::new(cfg); + archive.update_symbols(); + + for f in archive.src_files() { + if f.ends_with("bytecode.deflate") || + f == sess.cstore.metadata_filename() { + archive.remove_file(&f); + continue + } + } + + archive.build(); + + cmd.link_whole_rlib(&dst); + } + // Adds the static "rlib" versions of all crates to the command line. // There's a bit of magic which happens here specifically related to LTO and // dynamic libraries. Specifically: diff --git a/src/librustc_trans/back/write.rs b/src/librustc_trans/back/write.rs index b3a2d66a07c..8e71c571095 100644 --- a/src/librustc_trans/back/write.rs +++ b/src/librustc_trans/back/write.rs @@ -12,7 +12,7 @@ use back::lto; use back::link::{get_linker, remove}; use back::symbol_export::ExportedSymbols; use rustc_incremental::{save_trans_partition, in_incr_comp_dir}; -use session::config::{OutputFilenames, OutputTypes, Passes, SomePasses, AllPasses}; +use session::config::{OutputFilenames, OutputTypes, Passes, SomePasses, AllPasses, Sanitizer}; use session::Session; use session::config::{self, OutputType}; use llvm; @@ -678,6 +678,22 @@ pub fn run_passes(sess: &Session, let mut modules_config = ModuleConfig::new(tm, sess.opts.cg.passes.clone()); let mut metadata_config = ModuleConfig::new(tm, vec![]); + if let Some(ref sanitizer) = sess.opts.debugging_opts.sanitizer { + match *sanitizer { + Sanitizer::Address => { + modules_config.passes.push("asan".to_owned()); + modules_config.passes.push("asan-module".to_owned()); + } + Sanitizer::Memory => { + modules_config.passes.push("msan".to_owned()) + } + Sanitizer::Thread => { + modules_config.passes.push("tsan".to_owned()) + } + _ => {} + } + } + modules_config.opt_level = Some(get_llvm_opt_level(sess.opts.optimize)); modules_config.opt_size = Some(get_llvm_opt_size(sess.opts.optimize)); diff --git a/src/librustc_trans/declare.rs b/src/librustc_trans/declare.rs index bf7a02eb0f1..7ac482459ee 100644 --- a/src/librustc_trans/declare.rs +++ b/src/librustc_trans/declare.rs @@ -23,6 +23,7 @@ use llvm::{self, ValueRef}; use llvm::AttributePlace::Function; use rustc::ty; +use rustc::session::config::Sanitizer; use abi::{Abi, FnType}; use attributes; use context::CrateContext; @@ -72,6 +73,21 @@ fn declare_raw_fn(ccx: &CrateContext, name: &str, callconv: llvm::CallConv, ty: llvm::Attribute::NoRedZone.apply_llfn(Function, llfn); } + if let Some(ref sanitizer) = ccx.tcx().sess.opts.debugging_opts.sanitizer { + match *sanitizer { + Sanitizer::Address => { + llvm::Attribute::SanitizeAddress.apply_llfn(Function, llfn); + }, + Sanitizer::Memory => { + llvm::Attribute::SanitizeMemory.apply_llfn(Function, llfn); + }, + Sanitizer::Thread => { + llvm::Attribute::SanitizeThread.apply_llfn(Function, llfn); + }, + _ => {} + } + } + // If we're compiling the compiler-builtins crate, e.g. the equivalent of // compiler-rt, then we want to implicitly compile everything with hidden // visibility as we're going to link this object all over the place but diff --git a/src/librustc_tsan/Cargo.toml b/src/librustc_tsan/Cargo.toml new file mode 100644 index 00000000000..2af0ae3f734 --- /dev/null +++ b/src/librustc_tsan/Cargo.toml @@ -0,0 +1,16 @@ +[package] +authors = ["The Rust Project Developers"] +build = "build.rs" +name = "rustc_tsan" +version = "0.0.0" + +[lib] +name = "rustc_tsan" +path = "lib.rs" + +[build-dependencies] +cmake = "0.1.18" + +[dependencies] +alloc_system = { path = "../liballoc_system" } +core = { path = "../libcore" } diff --git a/src/librustc_tsan/build.rs b/src/librustc_tsan/build.rs new file mode 100644 index 00000000000..2ba5866ab9d --- /dev/null +++ b/src/librustc_tsan/build.rs @@ -0,0 +1,50 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate cmake; + +use std::path::PathBuf; +use std::env; + +use cmake::Config; + +fn main() { + if let Some(llvm_config) = env::var_os("LLVM_CONFIG") { + let dst = Config::new("../compiler-rt") + .define("COMPILER_RT_BUILD_SANITIZERS", "ON") + .define("COMPILER_RT_BUILD_BUILTINS", "OFF") + .define("COMPILER_RT_BUILD_XRAY", "OFF") + .define("LLVM_CONFIG_PATH", llvm_config) + .build_target("tsan") + .build(); + + println!("cargo:rustc-link-search=native={}", + dst.join("build/lib/linux").display()); + println!("cargo:rustc-link-lib=static=clang_rt.tsan-x86_64"); + + let src_dir = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap()); + let mut stack = src_dir.join("../compiler-rt") + .read_dir() + .unwrap() + .map(|e| e.unwrap()) + .filter(|e| &*e.file_name() != ".git") + .collect::>(); + while let Some(entry) = stack.pop() { + let path = entry.path(); + if entry.file_type().unwrap().is_dir() { + stack.extend(path.read_dir().unwrap().map(|e| e.unwrap())); + } else { + println!("cargo:rerun-if-changed={}", path.display()); + } + } + } + + println!("cargo:rerun-if-changed=build.rs"); +} diff --git a/src/librustc_tsan/lib.rs b/src/librustc_tsan/lib.rs new file mode 100644 index 00000000000..71a166b91eb --- /dev/null +++ b/src/librustc_tsan/lib.rs @@ -0,0 +1,20 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![cfg_attr(not(stage0), feature(sanitizer_runtime))] +#![cfg_attr(not(stage0), sanitizer_runtime)] +#![feature(alloc_system)] +#![feature(staged_api)] +#![no_std] +#![unstable(feature = "sanitizer_runtime_lib", + reason = "internal implementation detail of sanitizers", + issue = "0")] + +extern crate alloc_system; diff --git a/src/libstd/Cargo.toml b/src/libstd/Cargo.toml index 8146e7fb1ed..2ba7517d3d2 100644 --- a/src/libstd/Cargo.toml +++ b/src/libstd/Cargo.toml @@ -23,13 +23,23 @@ compiler_builtins = { path = "../libcompiler_builtins" } std_unicode = { path = "../libstd_unicode" } unwind = { path = "../libunwind" } +[target.x86_64-unknown-linux-gnu.dependencies] +rustc_asan = { path = "../librustc_asan", optional = true } +rustc_lsan = { path = "../librustc_lsan", optional = true } +rustc_msan = { path = "../librustc_msan", optional = true } +rustc_tsan = { path = "../librustc_tsan", optional = true } + [build-dependencies] build_helper = { path = "../build_helper" } gcc = "0.3.27" [features] +asan = ["rustc_asan"] backtrace = [] debug-jemalloc = ["alloc_jemalloc/debug"] jemalloc = ["alloc_jemalloc"] force_alloc_system = [] +lsan = ["rustc_lsan"] +msan = ["rustc_msan"] panic-unwind = ["panic_unwind"] +tsan = ["rustc_tsan"] diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 52ef2a05fcf..6a16a0ef353 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -328,6 +328,10 @@ declare_features! ( // `extern "msp430-interrupt" fn()` (active, abi_msp430_interrupt, "1.16.0", Some(38487)), + + // Used to identify crates that contain sanitizer runtimes + // rustc internal + (active, sanitizer_runtime, "1.17.0", None), ); declare_features! ( @@ -647,6 +651,12 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG contains compiler-rt intrinsics and will never be \ stable", cfg_fn!(compiler_builtins))), + ("sanitizer_runtime", Whitelisted, Gated(Stability::Unstable, + "sanitizer_runtime", + "the `#[sanitizer_runtime]` attribute is used to \ + identify crates that contain the runtime of a \ + sanitizer and will never be stable", + cfg_fn!(sanitizer_runtime))), ("allow_internal_unstable", Normal, Gated(Stability::Unstable, "allow_internal_unstable", diff --git a/src/rustc/std_shim/Cargo.toml b/src/rustc/std_shim/Cargo.toml index 14c9c5544b1..db96079d3e9 100644 --- a/src/rustc/std_shim/Cargo.toml +++ b/src/rustc/std_shim/Cargo.toml @@ -35,8 +35,12 @@ core = { path = "../../libcore" } # Reexport features from std [features] +asan = ["std/asan"] backtrace = ["std/backtrace"] debug-jemalloc = ["std/debug-jemalloc"] jemalloc = ["std/jemalloc"] force_alloc_system = ["std/force_alloc_system"] +lsan = ["std/lsan"] +msan = ["std/msan"] panic-unwind = ["std/panic-unwind"] +tsan = ["std/tsan"] diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp index c7bcd255818..58dfe0a3d38 100644 --- a/src/rustllvm/RustWrapper.cpp +++ b/src/rustllvm/RustWrapper.cpp @@ -148,6 +148,12 @@ static Attribute::AttrKind fromRust(LLVMRustAttribute Kind) { return Attribute::ZExt; case InReg: return Attribute::InReg; + case SanitizeThread: + return Attribute::SanitizeThread; + case SanitizeAddress: + return Attribute::SanitizeAddress; + case SanitizeMemory: + return Attribute::SanitizeMemory; } llvm_unreachable("bad AttributeKind"); } diff --git a/src/rustllvm/rustllvm.h b/src/rustllvm/rustllvm.h index a30fa3133e2..0baf5528e93 100644 --- a/src/rustllvm/rustllvm.h +++ b/src/rustllvm/rustllvm.h @@ -98,6 +98,9 @@ enum LLVMRustAttribute { UWTable = 17, ZExt = 18, InReg = 19, + SanitizeThread = 20, + SanitizeAddress = 21, + SanitizeMemory = 22, }; typedef struct OpaqueRustString *RustStringRef; diff --git a/src/test/compile-fail/feature-gate-sanitizer-runtime.rs b/src/test/compile-fail/feature-gate-sanitizer-runtime.rs new file mode 100644 index 00000000000..a18641d8246 --- /dev/null +++ b/src/test/compile-fail/feature-gate-sanitizer-runtime.rs @@ -0,0 +1,13 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![sanitizer_runtime] //~ ERROR the `#[sanitizer_runtime]` attribute is + +fn main() {} diff --git a/src/test/run-make/sanitizer-address/Makefile b/src/test/run-make/sanitizer-address/Makefile new file mode 100644 index 00000000000..c490f490cdf --- /dev/null +++ b/src/test/run-make/sanitizer-address/Makefile @@ -0,0 +1,21 @@ +-include ../tools.mk + +# NOTE the address sanitizer only supports x86_64 linux +ifndef IS_WINDOWS +ifeq ($(shell uname),Linux) +ifeq ($(shell uname -m),x86_64) +all: + $(RUSTC) -g -Z sanitizer=address -Z print-link-args overflow.rs | grep -q librustc_asan + $(TMPDIR)/overflow 2>&1 | grep -q stack-buffer-overflow +else +all: + +endif +else +all: + +endif +else +all: + +endif diff --git a/src/test/run-make/sanitizer-address/overflow.rs b/src/test/run-make/sanitizer-address/overflow.rs new file mode 100644 index 00000000000..e35c3873f7e --- /dev/null +++ b/src/test/run-make/sanitizer-address/overflow.rs @@ -0,0 +1,14 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + let xs = [0, 1, 2, 3]; + let y = unsafe { *xs.as_ptr().offset(4) }; +} diff --git a/src/test/run-make/sanitizer-dylib/Makefile b/src/test/run-make/sanitizer-dylib/Makefile new file mode 100644 index 00000000000..70a8254a6a6 --- /dev/null +++ b/src/test/run-make/sanitizer-dylib/Makefile @@ -0,0 +1,4 @@ +-include ../tools.mk + +all: + $(RUSTC) -Z sanitizer=leak --crate-type dylib hello.rs 2>&1 | grep -q 'Only executables and rlibs can be compiled with `-Z sanitizer`' diff --git a/src/test/run-make/sanitizer-dylib/hello.rs b/src/test/run-make/sanitizer-dylib/hello.rs new file mode 100644 index 00000000000..41782851a1a --- /dev/null +++ b/src/test/run-make/sanitizer-dylib/hello.rs @@ -0,0 +1,13 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + println!("Hello, world!"); +} diff --git a/src/test/run-make/sanitizer-invalid-target/Makefile b/src/test/run-make/sanitizer-invalid-target/Makefile new file mode 100644 index 00000000000..6a1ce8bab2f --- /dev/null +++ b/src/test/run-make/sanitizer-invalid-target/Makefile @@ -0,0 +1,4 @@ +-include ../tools.mk + +all: + $(RUSTC) -Z sanitizer=leak --target i686-unknown-linux-gnu hello.rs 2>&1 | grep -q 'Sanitizers only work with the `x86_64-unknown-linux-gnu` target' diff --git a/src/test/run-make/sanitizer-invalid-target/hello.rs b/src/test/run-make/sanitizer-invalid-target/hello.rs new file mode 100644 index 00000000000..e9e46b7702a --- /dev/null +++ b/src/test/run-make/sanitizer-invalid-target/hello.rs @@ -0,0 +1,13 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(no_core)] +#![no_core] +#![no_main] diff --git a/src/test/run-make/sanitizer-leak/Makefile b/src/test/run-make/sanitizer-leak/Makefile new file mode 100644 index 00000000000..492e328fab2 --- /dev/null +++ b/src/test/run-make/sanitizer-leak/Makefile @@ -0,0 +1,23 @@ +-include ../tools.mk + +# NOTE the leak sanitizer only supports x86_64 linux +# Also, this particular sanitizer sometimes doesn't work so we are not going to +# run the binary +ifndef IS_WINDOWS +ifeq ($(shell uname),Linux) +ifeq ($(shell uname -m),x86_64) +all: + $(RUSTC) -C opt-level=1 -g -Z sanitizer=leak -Z print-link-args leak.rs | grep -q librustc_lsan + $(TMPDIR)/leak 2>&1 | grep -q 'detected memory leaks' +else +all: + +endif +else +all: + +endif +else +all: + +endif diff --git a/src/test/run-make/sanitizer-leak/leak.rs b/src/test/run-make/sanitizer-leak/leak.rs new file mode 100644 index 00000000000..279da6aaae7 --- /dev/null +++ b/src/test/run-make/sanitizer-leak/leak.rs @@ -0,0 +1,16 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::mem; + +fn main() { + let xs = vec![1, 2, 3, 4]; + mem::forget(xs); +} diff --git a/src/test/run-make/sanitizer-memory/Makefile b/src/test/run-make/sanitizer-memory/Makefile new file mode 100644 index 00000000000..f8960992a0d --- /dev/null +++ b/src/test/run-make/sanitizer-memory/Makefile @@ -0,0 +1,21 @@ +-include ../tools.mk + +# NOTE the memory sanitizer only supports x86_64 linux +ifndef IS_WINDOWS +ifeq ($(shell uname),Linux) +ifeq ($(shell uname -m),x86_64) +all: + $(RUSTC) -g -Z sanitizer=memory -Z print-link-args uninit.rs | grep -q librustc_msan + $(TMPDIR)/uninit 2>&1 | grep -q use-of-uninitialized-value +else +all: + +endif +else +all: + +endif +else +all: + +endif diff --git a/src/test/run-make/sanitizer-memory/uninit.rs b/src/test/run-make/sanitizer-memory/uninit.rs new file mode 100644 index 00000000000..8350c7de3ac --- /dev/null +++ b/src/test/run-make/sanitizer-memory/uninit.rs @@ -0,0 +1,16 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::mem; + +fn main() { + let xs: [u8; 4] = unsafe { mem::uninitialized() }; + let y = xs[0] + xs[1]; +} diff --git a/src/test/run-make/sanitizer-thread/Makefile b/src/test/run-make/sanitizer-thread/Makefile new file mode 100644 index 00000000000..e32247c4a9b --- /dev/null +++ b/src/test/run-make/sanitizer-thread/Makefile @@ -0,0 +1,21 @@ +-include ../tools.mk + +# NOTE the leak sanitizer only supports x86_64 linux +ifndef IS_WINDOWS +ifeq ($(shell uname),Linux) +ifeq ($(shell uname -m),x86_64) +all: + $(RUSTC) -g -Z sanitizer=thread -Z print-link-args racy.rs | grep -q librustc_tsan + $(TMPDIR)/racy 2>&1 | grep -q 'data race' +else +all: + +endif +else +all: + +endif +else +all: + +endif diff --git a/src/test/run-make/sanitizer-thread/racy.rs b/src/test/run-make/sanitizer-thread/racy.rs new file mode 100644 index 00000000000..dc929e004a4 --- /dev/null +++ b/src/test/run-make/sanitizer-thread/racy.rs @@ -0,0 +1,21 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::thread; + +static mut ANSWER: i32 = 0; + +fn main() { + let t1 = thread::spawn(|| unsafe { ANSWER = 42 }); + unsafe { + ANSWER = 24; + } + t1.join().ok(); +} From 775a93646cb6db5affff24f2260fb60a7723deba Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Fri, 3 Feb 2017 18:58:47 -0500 Subject: [PATCH 63/70] build/test the sanitizers only when --enable-sanitizers is used --- configure | 1 + src/bootstrap/check.rs | 9 +++++---- src/bootstrap/compile.rs | 7 +++---- src/bootstrap/config.rs | 7 ++++--- src/bootstrap/config.toml.example | 3 +++ src/bootstrap/lib.rs | 4 ---- src/librustc_llvm/ffi.rs | 2 +- src/test/run-make/sanitizer-address/Makefile | 12 +----------- src/test/run-make/sanitizer-leak/Makefile | 15 +-------------- src/test/run-make/sanitizer-memory/Makefile | 13 +------------ src/test/run-make/sanitizer-thread/Makefile | 13 +------------ 11 files changed, 21 insertions(+), 65 deletions(-) diff --git a/configure b/configure index 4ce80a5e849..0904143a7b5 100755 --- a/configure +++ b/configure @@ -649,6 +649,7 @@ opt codegen-tests 1 "run the src/test/codegen tests" opt option-checking 1 "complain about unrecognized options in this configure script" opt ninja 0 "build LLVM using the Ninja generator (for MSVC, requires building in the correct environment)" opt vendor 0 "enable usage of vendored Rust crates" +opt sanitizers 0 "build the sanitizer runtimes (asan, lsan, msan, tsan)" # Optimization and debugging options. These may be overridden by the release channel, etc. opt_nosave optimize 1 "build optimized rust code" diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs index 573d0df0cee..32cce45e067 100644 --- a/src/bootstrap/check.rs +++ b/src/bootstrap/check.rs @@ -236,6 +236,10 @@ pub fn compiletest(build: &Build, cmd.env("RUSTC_BOOTSTRAP", "1"); build.add_rust_test_threads(&mut cmd); + if build.config.sanitizers { + cmd.env("SANITIZER_SUPPORT", "1"); + } + cmd.arg("--adb-path").arg("adb"); cmd.arg("--adb-test-dir").arg(ADB_TEST_DIR); if target.contains("android") { @@ -332,10 +336,7 @@ pub fn krate(build: &Build, krate: Option<&str>) { let (name, path, features, root) = match mode { Mode::Libstd => { - ("libstd", - "src/rustc/std_shim", - build.std_features(), - "std_shim") + ("libstd", "src/rustc/std_shim", build.std_features(), "std_shim") } Mode::Libtest => { ("libtest", "src/rustc/test_shim", String::new(), "test_shim") diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 3e29339a75b..d329f9c0690 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -52,15 +52,14 @@ pub fn std(build: &Build, target: &str, compiler: &Compiler) { features.push_str(" force_alloc_system"); } - if compiler.stage != 0 && !build.system_llvm(target) { + if compiler.stage != 0 && build.config.sanitizers { // This variable is used by the sanitizer runtime crates, e.g. // rustc_lsan, to build the sanitizer runtime from C code // When this variable is missing, those crates won't compile the C code, // so we don't set this variable during stage0 where llvm-config is // missing - // We also don't build the runtimes when compiling against system llvm - // because some distributions ship llvm packages that have a directory - // layout different from the one that the runtime's build system expects + // We also only build the runtimes when --enable-sanitizers (or its + // config.toml equivalent) is used cargo.env("LLVM_CONFIG", build.llvm_config(target)); } cargo.arg("--features").arg(features) diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index b171c89c20a..a31b202a0ae 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -48,6 +48,7 @@ pub struct Config { pub target_config: HashMap, pub full_bootstrap: bool, pub extended: bool, + pub sanitizers: bool, // llvm codegen options pub llvm_assertions: bool, @@ -108,8 +109,6 @@ pub struct Config { /// Per-target configuration stored in the global configuration structure. #[derive(Default)] pub struct Target { - // `true` if compiling against system LLVM or a pre-built LLVM - pub system_llvm: bool, pub llvm_config: Option, pub jemalloc: Option, pub cc: Option, @@ -150,6 +149,7 @@ struct Build { python: Option, full_bootstrap: Option, extended: Option, + sanitizers: Option, } /// TOML representation of various global install decisions. @@ -294,6 +294,7 @@ impl Config { set(&mut config.vendor, build.vendor); set(&mut config.full_bootstrap, build.full_bootstrap); set(&mut config.extended, build.extended); + set(&mut config.sanitizers, build.sanitizers); if let Some(ref install) = toml.install { config.prefix = install.prefix.clone().map(PathBuf::from); @@ -437,6 +438,7 @@ impl Config { ("VENDOR", self.vendor), ("FULL_BOOTSTRAP", self.full_bootstrap), ("EXTENDED", self.extended), + ("SANITIZERS", self.sanitizers), } match key { @@ -514,7 +516,6 @@ impl Config { .or_insert(Target::default()); let root = parse_configure_path(value); target.llvm_config = Some(push_exe_path(root, &["bin", "llvm-config"])); - target.system_llvm = true; } "CFG_JEMALLOC_ROOT" if value.len() > 0 => { let target = self.target_config.entry(self.build.clone()) diff --git a/src/bootstrap/config.toml.example b/src/bootstrap/config.toml.example index a53419ad7fd..025fe990f91 100644 --- a/src/bootstrap/config.toml.example +++ b/src/bootstrap/config.toml.example @@ -124,6 +124,9 @@ # disabled by default. #extended = false +# Build the sanitizer runtimes +#sanitizers = false + # ============================================================================= # General install configuration options # ============================================================================= diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 21dd4b1520a..1d01b8773ce 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -717,10 +717,6 @@ impl Build { } } - fn system_llvm(&self, target: &str) -> bool { - self.config.target_config.get(target).map(|t| t.system_llvm).unwrap_or(false) - } - /// Returns the path to `FileCheck` binary for the specified target fn llvm_filecheck(&self, target: &str) -> PathBuf { let target_config = self.config.target_config.get(target); diff --git a/src/librustc_llvm/ffi.rs b/src/librustc_llvm/ffi.rs index 6c9976ca3f8..bd24f7657e7 100644 --- a/src/librustc_llvm/ffi.rs +++ b/src/librustc_llvm/ffi.rs @@ -127,7 +127,7 @@ pub enum Attribute { ZExt = 18, InReg = 19, SanitizeThread = 20, - SanitizeAddress = 21, + SanitizeAddress = 21, SanitizeMemory = 22, } diff --git a/src/test/run-make/sanitizer-address/Makefile b/src/test/run-make/sanitizer-address/Makefile index c490f490cdf..5931145f3a4 100644 --- a/src/test/run-make/sanitizer-address/Makefile +++ b/src/test/run-make/sanitizer-address/Makefile @@ -1,9 +1,7 @@ -include ../tools.mk # NOTE the address sanitizer only supports x86_64 linux -ifndef IS_WINDOWS -ifeq ($(shell uname),Linux) -ifeq ($(shell uname -m),x86_64) +ifdef SANITIZER_SUPPORT all: $(RUSTC) -g -Z sanitizer=address -Z print-link-args overflow.rs | grep -q librustc_asan $(TMPDIR)/overflow 2>&1 | grep -q stack-buffer-overflow @@ -11,11 +9,3 @@ else all: endif -else -all: - -endif -else -all: - -endif diff --git a/src/test/run-make/sanitizer-leak/Makefile b/src/test/run-make/sanitizer-leak/Makefile index 492e328fab2..f02d948fdc8 100644 --- a/src/test/run-make/sanitizer-leak/Makefile +++ b/src/test/run-make/sanitizer-leak/Makefile @@ -1,11 +1,6 @@ -include ../tools.mk -# NOTE the leak sanitizer only supports x86_64 linux -# Also, this particular sanitizer sometimes doesn't work so we are not going to -# run the binary -ifndef IS_WINDOWS -ifeq ($(shell uname),Linux) -ifeq ($(shell uname -m),x86_64) +ifdef SANITIZER_SUPPORT all: $(RUSTC) -C opt-level=1 -g -Z sanitizer=leak -Z print-link-args leak.rs | grep -q librustc_lsan $(TMPDIR)/leak 2>&1 | grep -q 'detected memory leaks' @@ -13,11 +8,3 @@ else all: endif -else -all: - -endif -else -all: - -endif diff --git a/src/test/run-make/sanitizer-memory/Makefile b/src/test/run-make/sanitizer-memory/Makefile index f8960992a0d..08682e5975e 100644 --- a/src/test/run-make/sanitizer-memory/Makefile +++ b/src/test/run-make/sanitizer-memory/Makefile @@ -1,9 +1,6 @@ -include ../tools.mk -# NOTE the memory sanitizer only supports x86_64 linux -ifndef IS_WINDOWS -ifeq ($(shell uname),Linux) -ifeq ($(shell uname -m),x86_64) +ifdef SANITIZER_SUPPORT all: $(RUSTC) -g -Z sanitizer=memory -Z print-link-args uninit.rs | grep -q librustc_msan $(TMPDIR)/uninit 2>&1 | grep -q use-of-uninitialized-value @@ -11,11 +8,3 @@ else all: endif -else -all: - -endif -else -all: - -endif diff --git a/src/test/run-make/sanitizer-thread/Makefile b/src/test/run-make/sanitizer-thread/Makefile index e32247c4a9b..8bb89a241cb 100644 --- a/src/test/run-make/sanitizer-thread/Makefile +++ b/src/test/run-make/sanitizer-thread/Makefile @@ -1,9 +1,6 @@ -include ../tools.mk -# NOTE the leak sanitizer only supports x86_64 linux -ifndef IS_WINDOWS -ifeq ($(shell uname),Linux) -ifeq ($(shell uname -m),x86_64) +ifdef SANITIZER_SUPPORT all: $(RUSTC) -g -Z sanitizer=thread -Z print-link-args racy.rs | grep -q librustc_tsan $(TMPDIR)/racy 2>&1 | grep -q 'data race' @@ -11,11 +8,3 @@ else all: endif -else -all: - -endif -else -all: - -endif From 22097e6827b726f517e94c31df0728b481f57245 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Sat, 4 Feb 2017 20:10:29 -0500 Subject: [PATCH 64/70] use helper function in the rebuild logic of the rustc_*san crates --- src/Cargo.lock | 4 ++++ src/librustc_asan/Cargo.toml | 1 + src/librustc_asan/build.rs | 19 ++++--------------- src/librustc_lsan/Cargo.toml | 1 + src/librustc_lsan/build.rs | 19 ++++--------------- src/librustc_msan/Cargo.toml | 1 + src/librustc_msan/build.rs | 19 ++++--------------- src/librustc_tsan/Cargo.toml | 1 + src/librustc_tsan/build.rs | 19 ++++--------------- 9 files changed, 24 insertions(+), 60 deletions(-) diff --git a/src/Cargo.lock b/src/Cargo.lock index 8e987ba3b7f..c1222dc444a 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -273,6 +273,7 @@ name = "rustc_asan" version = "0.0.0" dependencies = [ "alloc_system 0.0.0", + "build_helper 0.1.0", "cmake 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", "core 0.0.0", ] @@ -415,6 +416,7 @@ name = "rustc_lsan" version = "0.0.0" dependencies = [ "alloc_system 0.0.0", + "build_helper 0.1.0", "cmake 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", "core 0.0.0", ] @@ -458,6 +460,7 @@ name = "rustc_msan" version = "0.0.0" dependencies = [ "alloc_system 0.0.0", + "build_helper 0.1.0", "cmake 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", "core 0.0.0", ] @@ -548,6 +551,7 @@ name = "rustc_tsan" version = "0.0.0" dependencies = [ "alloc_system 0.0.0", + "build_helper 0.1.0", "cmake 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", "core 0.0.0", ] diff --git a/src/librustc_asan/Cargo.toml b/src/librustc_asan/Cargo.toml index abbd7cc0966..2d4872b1fc9 100644 --- a/src/librustc_asan/Cargo.toml +++ b/src/librustc_asan/Cargo.toml @@ -9,6 +9,7 @@ name = "rustc_asan" path = "lib.rs" [build-dependencies] +build_helper = { path = "../build_helper" } cmake = "0.1.18" [dependencies] diff --git a/src/librustc_asan/build.rs b/src/librustc_asan/build.rs index 3e33efcadb8..015be14bd49 100644 --- a/src/librustc_asan/build.rs +++ b/src/librustc_asan/build.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +extern crate build_helper; extern crate cmake; use std::path::PathBuf; @@ -29,21 +30,9 @@ fn main() { dst.join("build/lib/linux").display()); println!("cargo:rustc-link-lib=static=clang_rt.asan-x86_64"); - let src_dir = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap()); - let mut stack = src_dir.join("../compiler-rt") - .read_dir() - .unwrap() - .map(|e| e.unwrap()) - .filter(|e| &*e.file_name() != ".git") - .collect::>(); - while let Some(entry) = stack.pop() { - let path = entry.path(); - if entry.file_type().unwrap().is_dir() { - stack.extend(path.read_dir().unwrap().map(|e| e.unwrap())); - } else { - println!("cargo:rerun-if-changed={}", path.display()); - } - } + build_helper::rerun_if_changed_anything_in_dir(&PathBuf::from(env::var("CARGO_MANIFEST_DIR") + .unwrap()) + .join("../compiler-rt")); } println!("cargo:rerun-if-changed=build.rs"); diff --git a/src/librustc_lsan/Cargo.toml b/src/librustc_lsan/Cargo.toml index ac53f3fe73a..bc1f2ead768 100644 --- a/src/librustc_lsan/Cargo.toml +++ b/src/librustc_lsan/Cargo.toml @@ -9,6 +9,7 @@ name = "rustc_lsan" path = "lib.rs" [build-dependencies] +build_helper = { path = "../build_helper" } cmake = "0.1.18" [dependencies] diff --git a/src/librustc_lsan/build.rs b/src/librustc_lsan/build.rs index f13928d2bd4..5773777d1f8 100644 --- a/src/librustc_lsan/build.rs +++ b/src/librustc_lsan/build.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +extern crate build_helper; extern crate cmake; use std::path::PathBuf; @@ -29,21 +30,9 @@ fn main() { dst.join("build/lib/linux").display()); println!("cargo:rustc-link-lib=static=clang_rt.lsan-x86_64"); - let src_dir = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap()); - let mut stack = src_dir.join("../compiler-rt") - .read_dir() - .unwrap() - .map(|e| e.unwrap()) - .filter(|e| &*e.file_name() != ".git") - .collect::>(); - while let Some(entry) = stack.pop() { - let path = entry.path(); - if entry.file_type().unwrap().is_dir() { - stack.extend(path.read_dir().unwrap().map(|e| e.unwrap())); - } else { - println!("cargo:rerun-if-changed={}", path.display()); - } - } + build_helper::rerun_if_changed_anything_in_dir(&PathBuf::from(env::var("CARGO_MANIFEST_DIR") + .unwrap()) + .join("../compiler-rt")); } println!("cargo:rerun-if-changed=build.rs"); diff --git a/src/librustc_msan/Cargo.toml b/src/librustc_msan/Cargo.toml index 628746ac232..45cc6b9839f 100644 --- a/src/librustc_msan/Cargo.toml +++ b/src/librustc_msan/Cargo.toml @@ -9,6 +9,7 @@ name = "rustc_msan" path = "lib.rs" [build-dependencies] +build_helper = { path = "../build_helper" } cmake = "0.1.18" [dependencies] diff --git a/src/librustc_msan/build.rs b/src/librustc_msan/build.rs index bf630c7844a..7a4c8f70739 100644 --- a/src/librustc_msan/build.rs +++ b/src/librustc_msan/build.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +extern crate build_helper; extern crate cmake; use std::path::PathBuf; @@ -29,21 +30,9 @@ fn main() { dst.join("build/lib/linux").display()); println!("cargo:rustc-link-lib=static=clang_rt.msan-x86_64"); - let src_dir = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap()); - let mut stack = src_dir.join("../compiler-rt") - .read_dir() - .unwrap() - .map(|e| e.unwrap()) - .filter(|e| &*e.file_name() != ".git") - .collect::>(); - while let Some(entry) = stack.pop() { - let path = entry.path(); - if entry.file_type().unwrap().is_dir() { - stack.extend(path.read_dir().unwrap().map(|e| e.unwrap())); - } else { - println!("cargo:rerun-if-changed={}", path.display()); - } - } + build_helper::rerun_if_changed_anything_in_dir(&PathBuf::from(env::var("CARGO_MANIFEST_DIR") + .unwrap()) + .join("../compiler-rt")); } println!("cargo:rerun-if-changed=build.rs"); diff --git a/src/librustc_tsan/Cargo.toml b/src/librustc_tsan/Cargo.toml index 2af0ae3f734..66d6236361e 100644 --- a/src/librustc_tsan/Cargo.toml +++ b/src/librustc_tsan/Cargo.toml @@ -9,6 +9,7 @@ name = "rustc_tsan" path = "lib.rs" [build-dependencies] +build_helper = { path = "../build_helper" } cmake = "0.1.18" [dependencies] diff --git a/src/librustc_tsan/build.rs b/src/librustc_tsan/build.rs index 2ba5866ab9d..84326ae8a71 100644 --- a/src/librustc_tsan/build.rs +++ b/src/librustc_tsan/build.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +extern crate build_helper; extern crate cmake; use std::path::PathBuf; @@ -29,21 +30,9 @@ fn main() { dst.join("build/lib/linux").display()); println!("cargo:rustc-link-lib=static=clang_rt.tsan-x86_64"); - let src_dir = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap()); - let mut stack = src_dir.join("../compiler-rt") - .read_dir() - .unwrap() - .map(|e| e.unwrap()) - .filter(|e| &*e.file_name() != ".git") - .collect::>(); - while let Some(entry) = stack.pop() { - let path = entry.path(); - if entry.file_type().unwrap().is_dir() { - stack.extend(path.read_dir().unwrap().map(|e| e.unwrap())); - } else { - println!("cargo:rerun-if-changed={}", path.display()); - } - } + build_helper::rerun_if_changed_anything_in_dir(&PathBuf::from(env::var("CARGO_MANIFEST_DIR") + .unwrap()) + .join("../compiler-rt")); } println!("cargo:rerun-if-changed=build.rs"); From 72058e4f4cff46daf5c60cbd7c7978734ecb13cc Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Sat, 4 Feb 2017 20:15:20 -0500 Subject: [PATCH 65/70] enable sanitizers on x86_64-linux releases --- src/ci/docker/dist-x86-linux/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ci/docker/dist-x86-linux/Dockerfile b/src/ci/docker/dist-x86-linux/Dockerfile index 4e4f5dd6f1e..7238888a4af 100644 --- a/src/ci/docker/dist-x86-linux/Dockerfile +++ b/src/ci/docker/dist-x86-linux/Dockerfile @@ -76,5 +76,5 @@ RUN curl -L https://api.pub.build.mozilla.org/tooltool/sha512/$SCCACHE_DIGEST | ENV HOSTS=i686-unknown-linux-gnu ENV HOSTS=$HOSTS,x86_64-unknown-linux-gnu -ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended +ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended --enable-sanitizers ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS From 47ae2393e63e0d78118262b70245d34b8c8ba929 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Sun, 5 Feb 2017 19:09:32 -0500 Subject: [PATCH 66/70] enable sanitizers on build job that tests x86_64 linux --- src/ci/docker/x86_64-gnu/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ci/docker/x86_64-gnu/Dockerfile b/src/ci/docker/x86_64-gnu/Dockerfile index 6919487e17c..e903b6ddc64 100644 --- a/src/ci/docker/x86_64-gnu/Dockerfile +++ b/src/ci/docker/x86_64-gnu/Dockerfile @@ -22,5 +22,5 @@ RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-ini rm dumb-init_*.deb ENTRYPOINT ["/usr/bin/dumb-init", "--"] -ENV RUST_CONFIGURE_ARGS --build=x86_64-unknown-linux-gnu +ENV RUST_CONFIGURE_ARGS --build=x86_64-unknown-linux-gnu --enable-sanitizers ENV SCRIPT python2.7 ../x.py test && python2.7 ../x.py dist From 1914c8e0aca19b844b14a8b8032bc9376c6d37f0 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Mon, 6 Feb 2017 14:12:56 -0500 Subject: [PATCH 67/70] dist-x86-linux: install newer kernel headers --- src/ci/docker/dist-x86-linux/Dockerfile | 5 ++++ src/ci/docker/dist-x86-linux/build-headers.sh | 25 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100755 src/ci/docker/dist-x86-linux/build-headers.sh diff --git a/src/ci/docker/dist-x86-linux/Dockerfile b/src/ci/docker/dist-x86-linux/Dockerfile index 7238888a4af..a06e47c3bc9 100644 --- a/src/ci/docker/dist-x86-linux/Dockerfile +++ b/src/ci/docker/dist-x86-linux/Dockerfile @@ -63,6 +63,11 @@ RUN ./build-git.sh COPY build-cmake.sh /tmp/ RUN ./build-cmake.sh +# for sanitizers, we need kernel headers files newer than the ones CentOS ships +# with so we install newer ones here +COPY build-headers.sh /tmp/ +RUN ./build-headers.sh + RUN curl -Lo /rustroot/dumb-init \ https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64 && \ chmod +x /rustroot/dumb-init diff --git a/src/ci/docker/dist-x86-linux/build-headers.sh b/src/ci/docker/dist-x86-linux/build-headers.sh new file mode 100755 index 00000000000..4ce38fd9205 --- /dev/null +++ b/src/ci/docker/dist-x86-linux/build-headers.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Copyright 2017 The Rust Project Developers. See the COPYRIGHT +# file at the top-level directory of this distribution and at +# http://rust-lang.org/COPYRIGHT. +# +# Licensed under the Apache License, Version 2.0 or the MIT license +# , at your +# option. This file may not be copied, modified, or distributed +# except according to those terms. + +set -ex +source shared.sh + +curl https://cdn.kernel.org/pub/linux/kernel/v3.x/linux-3.2.84.tar.xz | unxz | tar x + +cd linux-3.2.84 +hide_output make mrproper +hide_output make INSTALL_HDR_PATH=dest headers_install + +find dest/include \( -name .install -o -name ..install.cmd \) -delete +yes | cp -fr dest/include/* /usr/include + +cd .. +rm -rf linux-3.2.84 From 78a11f1b97f3ab3fa8c9e225f800489051777bc4 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Tue, 7 Feb 2017 22:47:03 -0500 Subject: [PATCH 68/70] fix the sanitizer-dylib test on non x86_64 linux hosts --- src/test/run-make/sanitizer-dylib/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/run-make/sanitizer-dylib/Makefile b/src/test/run-make/sanitizer-dylib/Makefile index 70a8254a6a6..34fdf3b9709 100644 --- a/src/test/run-make/sanitizer-dylib/Makefile +++ b/src/test/run-make/sanitizer-dylib/Makefile @@ -1,4 +1,4 @@ -include ../tools.mk all: - $(RUSTC) -Z sanitizer=leak --crate-type dylib hello.rs 2>&1 | grep -q 'Only executables and rlibs can be compiled with `-Z sanitizer`' + $(RUSTC) -Z sanitizer=leak --crate-type dylib --target x86_64-unknown-linux-gnu hello.rs 2>&1 | grep -q 'Only executables and rlibs can be compiled with `-Z sanitizer`' From 8fc0b37428e23dd031af5209bc8a22b9657ec66f Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 8 Feb 2017 17:13:46 -0800 Subject: [PATCH 69/70] travis: Fix build order of dist-x86-linux I just tried to build this container locally but it looks like connecting to ftp.gnu.org requires SNI, so let's build curl/OpenSSL first to ensure that we've got an SNI-capable client to download gcc/binutils with. --- src/ci/docker/dist-x86-linux/Dockerfile | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/ci/docker/dist-x86-linux/Dockerfile b/src/ci/docker/dist-x86-linux/Dockerfile index 4e4f5dd6f1e..d5bb8ea77e3 100644 --- a/src/ci/docker/dist-x86-linux/Dockerfile +++ b/src/ci/docker/dist-x86-linux/Dockerfile @@ -21,17 +21,7 @@ RUN yum upgrade -y && yum install -y \ ENV PATH=/rustroot/bin:$PATH ENV LD_LIBRARY_PATH=/rustroot/lib64:/rustroot/lib WORKDIR /tmp - -# binutils < 2.22 has a bug where the 32-bit executables it generates -# immediately segfault in Rust, so we need to install our own binutils. -# -# See https://github.com/rust-lang/rust/issues/20440 for more info COPY shared.sh build-binutils.sh /tmp/ -RUN ./build-binutils.sh - -# Need a newer version of gcc than centos has to compile LLVM nowadays -COPY build-gcc.sh /tmp/ -RUN ./build-gcc.sh # We need a build of openssl which supports SNI to download artifacts from # static.rust-lang.org. This'll be used to link into libcurl below (and used @@ -49,6 +39,16 @@ RUN ./build-openssl.sh COPY build-curl.sh /tmp/ RUN ./build-curl.sh +# binutils < 2.22 has a bug where the 32-bit executables it generates +# immediately segfault in Rust, so we need to install our own binutils. +# +# See https://github.com/rust-lang/rust/issues/20440 for more info +RUN ./build-binutils.sh + +# Need a newer version of gcc than centos has to compile LLVM nowadays +COPY build-gcc.sh /tmp/ +RUN ./build-gcc.sh + # CentOS 5.5 has Python 2.4 by default, but LLVM needs 2.7+ COPY build-python.sh /tmp/ RUN ./build-python.sh From e180dd541a8ae48e4aaf8934765f67955932252f Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Wed, 8 Feb 2017 22:58:53 -0500 Subject: [PATCH 70/70] sanitizer-dylib: only run where std for x86_64-linux is available --- src/test/run-make/sanitizer-dylib/Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/test/run-make/sanitizer-dylib/Makefile b/src/test/run-make/sanitizer-dylib/Makefile index 34fdf3b9709..835d5b0d9d8 100644 --- a/src/test/run-make/sanitizer-dylib/Makefile +++ b/src/test/run-make/sanitizer-dylib/Makefile @@ -1,4 +1,8 @@ -include ../tools.mk +ifeq ($(TARGET),x86_64-unknown-linux-gnu) all: - $(RUSTC) -Z sanitizer=leak --crate-type dylib --target x86_64-unknown-linux-gnu hello.rs 2>&1 | grep -q 'Only executables and rlibs can be compiled with `-Z sanitizer`' + $(RUSTC) -Z sanitizer=leak --crate-type dylib --target $(TARGET) hello.rs 2>&1 | grep -q 'Only executables and rlibs can be compiled with `-Z sanitizer`' +else +all: +endif