Skip to content

Commit 5bcc1ec

Browse files
committed
---
yaml --- r: 273387 b: refs/heads/beta c: 6c4b1f1 h: refs/heads/master i: 273385: 3cedd1c 273383: cd300b8
1 parent 041be6a commit 5bcc1ec

File tree

17 files changed

+132
-65
lines changed

17 files changed

+132
-65
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: c0d989ed6b4b840a290a80ec0cdbc8edbce2ee57
26+
refs/heads/beta: 6c4b1f18f3c2a2de17c3562d6557a445b627bcc1
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/src/libcore/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
authors = ["The Rust Project Developers"]
33
name = "core"
44
version = "0.0.0"
5+
build = "build.rs"
56

67
[lib]
78
name = "core"

branches/beta/src/libcore/build.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn main() {
12+
// Remove this whenever snapshots and rustbuild nightlies are synced.
13+
println!("cargo:rustc-cfg=cargobuild");
14+
}

branches/beta/src/libcore/intrinsics.rs

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -53,53 +53,44 @@ extern "rust-intrinsic" {
5353
// NB: These intrinsics take raw pointers because they mutate aliased
5454
// memory, which is not valid for either `&` or `&mut`.
5555

56-
#[cfg(stage0)]
56+
#[cfg(all(stage0, not(cargobuild)))]
5757
pub fn atomic_cxchg<T>(dst: *mut T, old: T, src: T) -> T;
58-
#[cfg(stage0)]
58+
#[cfg(all(stage0, not(cargobuild)))]
5959
pub fn atomic_cxchg_acq<T>(dst: *mut T, old: T, src: T) -> T;
60-
#[cfg(stage0)]
60+
#[cfg(all(stage0, not(cargobuild)))]
6161
pub fn atomic_cxchg_rel<T>(dst: *mut T, old: T, src: T) -> T;
62-
#[cfg(stage0)]
62+
#[cfg(all(stage0, not(cargobuild)))]
6363
pub fn atomic_cxchg_acqrel<T>(dst: *mut T, old: T, src: T) -> T;
64-
#[cfg(stage0)]
64+
#[cfg(all(stage0, not(cargobuild)))]
6565
pub fn atomic_cxchg_relaxed<T>(dst: *mut T, old: T, src: T) -> T;
6666

67-
#[cfg(not(stage0))]
67+
#[cfg(any(not(stage0), cargobuild))]
6868
pub fn atomic_cxchg<T>(dst: *mut T, old: T, src: T) -> (T, bool);
69-
#[cfg(not(stage0))]
69+
#[cfg(any(not(stage0), cargobuild))]
7070
pub fn atomic_cxchg_acq<T>(dst: *mut T, old: T, src: T) -> (T, bool);
71-
#[cfg(not(stage0))]
71+
#[cfg(any(not(stage0), cargobuild))]
7272
pub fn atomic_cxchg_rel<T>(dst: *mut T, old: T, src: T) -> (T, bool);
73-
#[cfg(not(stage0))]
73+
#[cfg(any(not(stage0), cargobuild))]
7474
pub fn atomic_cxchg_acqrel<T>(dst: *mut T, old: T, src: T) -> (T, bool);
75-
#[cfg(not(stage0))]
75+
#[cfg(any(not(stage0), cargobuild))]
7676
pub fn atomic_cxchg_relaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
77-
#[cfg(not(stage0))]
77+
#[cfg(any(not(stage0), cargobuild))]
7878
pub fn atomic_cxchg_failrelaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
79-
#[cfg(not(stage0))]
79+
#[cfg(any(not(stage0), cargobuild))]
8080
pub fn atomic_cxchg_failacq<T>(dst: *mut T, old: T, src: T) -> (T, bool);
81-
#[cfg(not(stage0))]
81+
#[cfg(any(not(stage0), cargobuild))]
8282
pub fn atomic_cxchg_acq_failrelaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
83-
#[cfg(not(stage0))]
83+
#[cfg(any(not(stage0), cargobuild))]
8484
pub fn atomic_cxchg_acqrel_failrelaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
8585

86-
#[cfg(not(stage0))]
8786
pub fn atomic_cxchgweak<T>(dst: *mut T, old: T, src: T) -> (T, bool);
88-
#[cfg(not(stage0))]
8987
pub fn atomic_cxchgweak_acq<T>(dst: *mut T, old: T, src: T) -> (T, bool);
90-
#[cfg(not(stage0))]
9188
pub fn atomic_cxchgweak_rel<T>(dst: *mut T, old: T, src: T) -> (T, bool);
92-
#[cfg(not(stage0))]
9389
pub fn atomic_cxchgweak_acqrel<T>(dst: *mut T, old: T, src: T) -> (T, bool);
94-
#[cfg(not(stage0))]
9590
pub fn atomic_cxchgweak_relaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
96-
#[cfg(not(stage0))]
9791
pub fn atomic_cxchgweak_failrelaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
98-
#[cfg(not(stage0))]
9992
pub fn atomic_cxchgweak_failacq<T>(dst: *mut T, old: T, src: T) -> (T, bool);
100-
#[cfg(not(stage0))]
10193
pub fn atomic_cxchgweak_acq_failrelaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
102-
#[cfg(not(stage0))]
10394
pub fn atomic_cxchgweak_acqrel_failrelaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
10495

10596
pub fn atomic_load<T>(src: *const T) -> T;

branches/beta/src/libcore/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
#![feature(const_fn)]
6565
#![feature(custom_attribute)]
6666
#![feature(fundamental)]
67+
#![feature(inclusive_range_syntax)]
6768
#![feature(intrinsics)]
6869
#![feature(lang_items)]
6970
#![feature(no_core)]

branches/beta/src/libcore/num/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,7 @@ macro_rules! int_impl {
10081008
/// ```
10091009
#[stable(feature = "rust1", since = "1.0.0")]
10101010
#[inline]
1011-
#[cfg_attr(not(stage0), rustc_no_mir)] // FIXME #29769 MIR overflow checking is TBD.
1011+
#[rustc_no_mir] // FIXME #29769 MIR overflow checking is TBD.
10121012
pub fn pow(self, mut exp: u32) -> Self {
10131013
let mut base = self;
10141014
let mut acc = Self::one();
@@ -1050,7 +1050,7 @@ macro_rules! int_impl {
10501050
/// ```
10511051
#[stable(feature = "rust1", since = "1.0.0")]
10521052
#[inline]
1053-
#[cfg_attr(not(stage0), rustc_no_mir)] // FIXME #29769 MIR overflow checking is TBD.
1053+
#[rustc_no_mir] // FIXME #29769 MIR overflow checking is TBD.
10541054
pub fn abs(self) -> Self {
10551055
if self.is_negative() {
10561056
// Note that the #[inline] above means that the overflow
@@ -2015,7 +2015,7 @@ macro_rules! uint_impl {
20152015
/// ```
20162016
#[stable(feature = "rust1", since = "1.0.0")]
20172017
#[inline]
2018-
#[cfg_attr(not(stage0), rustc_no_mir)] // FIXME #29769 MIR overflow checking is TBD.
2018+
#[rustc_no_mir] // FIXME #29769 MIR overflow checking is TBD.
20192019
pub fn pow(self, mut exp: u32) -> Self {
20202020
let mut base = self;
20212021
let mut acc = Self::one();

branches/beta/src/libcore/ops.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,7 +1448,6 @@ pub trait IndexMut<Idx: ?Sized>: Index<Idx> {
14481448

14491449
/// An unbounded range.
14501450
#[derive(Copy, Clone, PartialEq, Eq)]
1451-
#[cfg_attr(stage0, lang = "range_full")] // FIXME remove attribute after next snapshot
14521451
#[stable(feature = "rust1", since = "1.0.0")]
14531452
pub struct RangeFull;
14541453

@@ -1461,7 +1460,6 @@ impl fmt::Debug for RangeFull {
14611460

14621461
/// A (half-open) range which is bounded at both ends.
14631462
#[derive(Clone, PartialEq, Eq)]
1464-
#[cfg_attr(stage0, lang = "range")] // FIXME remove attribute after next snapshot
14651463
#[stable(feature = "rust1", since = "1.0.0")]
14661464
pub struct Range<Idx> {
14671465
/// The lower bound of the range (inclusive).
@@ -1481,7 +1479,6 @@ impl<Idx: fmt::Debug> fmt::Debug for Range<Idx> {
14811479

14821480
/// A range which is only bounded below.
14831481
#[derive(Clone, PartialEq, Eq)]
1484-
#[cfg_attr(stage0, lang = "range_from")] // FIXME remove attribute after next snapshot
14851482
#[stable(feature = "rust1", since = "1.0.0")]
14861483
pub struct RangeFrom<Idx> {
14871484
/// The lower bound of the range (inclusive).
@@ -1498,7 +1495,6 @@ impl<Idx: fmt::Debug> fmt::Debug for RangeFrom<Idx> {
14981495

14991496
/// A range which is only bounded above.
15001497
#[derive(Copy, Clone, PartialEq, Eq)]
1501-
#[cfg_attr(stage0, lang = "range_to")] // FIXME remove attribute after next snapshot
15021498
#[stable(feature = "rust1", since = "1.0.0")]
15031499
pub struct RangeTo<Idx> {
15041500
/// The upper bound of the range (exclusive).

branches/beta/src/libcore/slice.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -632,8 +632,7 @@ impl<T> ops::Index<ops::RangeToInclusive<usize>> for [T] {
632632

633633
#[inline]
634634
fn index(&self, index: ops::RangeToInclusive<usize>) -> &[T] {
635-
// SNAP 4d3eebf change this to `0...index.end`
636-
self.index(ops::RangeInclusive::NonEmpty { start: 0, end: index.end })
635+
self.index(0...index.end)
637636
}
638637
}
639638

@@ -723,8 +722,7 @@ impl<T> ops::IndexMut<ops::RangeInclusive<usize>> for [T] {
723722
impl<T> ops::IndexMut<ops::RangeToInclusive<usize>> for [T] {
724723
#[inline]
725724
fn index_mut(&mut self, index: ops::RangeToInclusive<usize>) -> &mut [T] {
726-
// SNAP 4d3eebf change this to `0...index.end`
727-
self.index_mut(ops::RangeInclusive::NonEmpty { start: 0, end: index.end })
725+
self.index_mut(0...index.end)
728726
}
729727
}
730728

branches/beta/src/libcore/str/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1524,8 +1524,7 @@ mod traits {
15241524

15251525
#[inline]
15261526
fn index(&self, index: ops::RangeToInclusive<usize>) -> &str {
1527-
// SNAP 4d3eebf change this to `0...index.end`
1528-
self.index(ops::RangeInclusive::NonEmpty { start: 0, end: index.end })
1527+
self.index(0...index.end)
15291528
}
15301529
}
15311530

@@ -1550,8 +1549,7 @@ mod traits {
15501549
impl ops::IndexMut<ops::RangeToInclusive<usize>> for str {
15511550
#[inline]
15521551
fn index_mut(&mut self, index: ops::RangeToInclusive<usize>) -> &mut str {
1553-
// SNAP 4d3eebf change this to `0...index.end`
1554-
self.index_mut(ops::RangeInclusive::NonEmpty { start: 0, end: index.end })
1552+
self.index_mut(0...index.end)
15551553
}
15561554
}
15571555
}

branches/beta/src/libcore/sync/atomic.rs

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,7 +1380,7 @@ unsafe fn atomic_sub<T>(dst: *mut T, val: T, order: Ordering) -> T {
13801380
}
13811381

13821382
#[inline]
1383-
#[cfg(not(stage0))]
1383+
#[cfg(any(not(stage0), cargobuild))]
13841384
unsafe fn atomic_compare_exchange<T>(dst: *mut T,
13851385
old: T,
13861386
new: T,
@@ -1408,7 +1408,7 @@ unsafe fn atomic_compare_exchange<T>(dst: *mut T,
14081408
}
14091409

14101410
#[inline]
1411-
#[cfg(stage0)]
1411+
#[cfg(all(stage0, not(cargobuild)))]
14121412
unsafe fn atomic_compare_exchange<T>(dst: *mut T,
14131413
old: T,
14141414
new: T,
@@ -1431,7 +1431,6 @@ unsafe fn atomic_compare_exchange<T>(dst: *mut T,
14311431
}
14321432

14331433
#[inline]
1434-
#[cfg(not(stage0))]
14351434
unsafe fn atomic_compare_exchange_weak<T>(dst: *mut T,
14361435
old: T,
14371436
new: T,
@@ -1458,18 +1457,6 @@ unsafe fn atomic_compare_exchange_weak<T>(dst: *mut T,
14581457
}
14591458
}
14601459

1461-
#[inline]
1462-
#[cfg(stage0)]
1463-
unsafe fn atomic_compare_exchange_weak<T>(dst: *mut T,
1464-
old: T,
1465-
new: T,
1466-
success: Ordering,
1467-
failure: Ordering) -> Result<T, T>
1468-
where T: ::cmp::Eq + ::marker::Copy
1469-
{
1470-
atomic_compare_exchange(dst, old, new, success, failure)
1471-
}
1472-
14731460
#[inline]
14741461
unsafe fn atomic_and<T>(dst: *mut T, val: T, order: Ordering) -> T {
14751462
match order {

branches/beta/src/librustc/middle/ty/util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ impl<'a, 'tcx> ParameterEnvironment<'a, 'tcx> {
133133
let infcx = infer::new_infer_ctxt(tcx,
134134
&tcx.tables,
135135
Some(self.clone()),
136-
ProjectionMode::AnyFinal);
136+
ProjectionMode::Topmost);
137137

138138
let adt = match self_type.sty {
139139
ty::TyStruct(struct_def, substs) => {
@@ -548,7 +548,7 @@ impl<'tcx> ty::TyS<'tcx> {
548548
let infcx = infer::new_infer_ctxt(tcx,
549549
&tcx.tables,
550550
Some(param_env.clone()),
551-
ProjectionMode::AnyFinal);
551+
ProjectionMode::Topmost);
552552

553553
let is_impld = traits::type_known_to_meet_builtin_bound(&infcx,
554554
self, bound, span);

branches/beta/src/librustc_back/target/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
//! this module defines the format the JSON file should take, though each
4141
//! underscore in the field names should be replaced with a hyphen (`-`) in the
4242
//! JSON file. Some fields are required in every target specification, such as
43-
//! `data-layout`, `llvm-target`, `target-endian`, `target-pointer-width`, and
44-
//! `arch`. In general, options passed to rustc with `-C` override the target's
43+
//! `llvm-target`, `target-endian`, `target-pointer-width`, `arch`, and
44+
//! `os`. In general, options passed to rustc with `-C` override the target's
4545
//! settings, though `target-feature` and `link-args` will *add* to the list
4646
//! specified by the target, rather than replace.
4747

branches/beta/src/librustc_trans/trans/adt.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,15 @@ fn represent_type_uncached<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
396396
}
397397
}
398398
}
399+
400+
// If the alignment is smaller than the chosen discriminant size, don't use the
401+
// alignment as the final size.
402+
let min_ty = ll_inttype(&cx, min_ity);
403+
let min_size = machine::llsize_of_real(cx, min_ty);
404+
if (align as u64) < min_size {
405+
use_align = false;
406+
}
407+
399408
let ity = if use_align {
400409
// Use the overall alignment
401410
match align {
@@ -813,11 +822,11 @@ fn generic_type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
813822
// FIXME #10604: this breaks when vector types are present.
814823
let (size, align) = union_size_and_align(&sts[..]);
815824
let align_s = align as u64;
816-
assert_eq!(size % align_s, 0);
817-
let align_units = size / align_s - 1;
818-
819825
let discr_ty = ll_inttype(cx, ity);
820826
let discr_size = machine::llsize_of_alloc(cx, discr_ty);
827+
let padded_discr_size = roundup(discr_size, align);
828+
assert_eq!(size % align_s, 0); // Ensure division in align_units comes out evenly
829+
let align_units = (size - padded_discr_size) / align_s;
821830
let fill_ty = match align_s {
822831
1 => Type::array(&Type::i8(cx), align_units),
823832
2 => Type::array(&Type::i16(cx), align_units),
@@ -829,10 +838,10 @@ fn generic_type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
829838
_ => panic!("unsupported enum alignment: {}", align)
830839
};
831840
assert_eq!(machine::llalign_of_min(cx, fill_ty), align);
832-
assert_eq!(align_s % discr_size, 0);
841+
assert_eq!(padded_discr_size % discr_size, 0); // Ensure discr_ty can fill pad evenly
833842
let mut fields: Vec<Type> =
834843
[discr_ty,
835-
Type::array(&discr_ty, align_s / discr_size - 1),
844+
Type::array(&discr_ty, (padded_discr_size - discr_size)/discr_size),
836845
fill_ty].iter().cloned().collect();
837846
if delay_drop_flag && dtor_needed {
838847
fields.pop();

branches/beta/src/nightlies.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
rustc: 2016-02-17
1+
rustc: 2016-03-20
22
cargo: 2016-03-11

branches/beta/src/snapshots.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
S 2016-03-18 235d774
2+
linux-i386 0e0e4448b80d0a12b75485795244bb3857a0a7ef
3+
linux-x86_64 1273b6b6aed421c9e40c59f366d0df6092ec0397
4+
macos-i386 9f9c0b4a2db09acbce54b792fb8839a735585565
5+
macos-x86_64 52570f6fd915b0210a9be98cfc933148e16a75f8
6+
winnt-i386 7703869608cc4192b8f1943e51b19ba1a03c0110
7+
winnt-x86_64 8512b5ecc0c53a2cd3552e4f5688577de95cd978
8+
19
S 2016-02-17 4d3eebf
210
linux-i386 5f194aa7628c0703f0fd48adc4ec7f3cc64b98c7
311
linux-x86_64 d29b7607d13d64078b6324aec82926fb493f59ba

branches/beta/src/test/run-pass/enum-discrim-manual-sizing.rs

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111

12-
use std::mem::size_of;
12+
use std::mem::{size_of, align_of};
1313

1414
#[repr(i8)]
1515
enum Ei8 {
@@ -71,6 +71,24 @@ enum Euint {
7171
Buint = 1
7272
}
7373

74+
#[repr(u8)]
75+
enum Eu8NonCLike<T> {
76+
_None,
77+
_Some(T),
78+
}
79+
80+
#[repr(i64)]
81+
enum Ei64NonCLike<T> {
82+
_None,
83+
_Some(T),
84+
}
85+
86+
#[repr(u64)]
87+
enum Eu64NonCLike<T> {
88+
_None,
89+
_Some(T),
90+
}
91+
7492
pub fn main() {
7593
assert_eq!(size_of::<Ei8>(), 1);
7694
assert_eq!(size_of::<Eu8>(), 1);
@@ -82,4 +100,17 @@ pub fn main() {
82100
assert_eq!(size_of::<Eu64>(), 8);
83101
assert_eq!(size_of::<Eint>(), size_of::<isize>());
84102
assert_eq!(size_of::<Euint>(), size_of::<usize>());
103+
assert_eq!(size_of::<Eu8NonCLike<()>>(), 1);
104+
assert_eq!(size_of::<Ei64NonCLike<()>>(), 8);
105+
assert_eq!(size_of::<Eu64NonCLike<()>>(), 8);
106+
let u8_expected_size = round_up(9, align_of::<Eu64NonCLike<u8>>());
107+
assert_eq!(size_of::<Eu64NonCLike<u8>>(), u8_expected_size);
108+
let array_expected_size = round_up(28, align_of::<Eu64NonCLike<[u32; 5]>>());
109+
assert_eq!(size_of::<Eu64NonCLike<[u32; 5]>>(), array_expected_size);
110+
assert_eq!(size_of::<Eu64NonCLike<[u32; 6]>>(), 32);
111+
}
112+
113+
// Rounds x up to the next multiple of a
114+
fn round_up(x: usize, a: usize) -> usize {
115+
((x + (a - 1)) / a) * a
85116
}

0 commit comments

Comments
 (0)