Skip to content

Commit 915b16a

Browse files
committed
---
yaml --- r: 272881 b: refs/heads/beta c: 4352a85 h: refs/heads/master i: 272879: 2dc961f
1 parent 5b7a21f commit 915b16a

File tree

30 files changed

+262
-32
lines changed

30 files changed

+262
-32
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: 660bbf4f6f4ce7a3d9e4fa7fdfc5e7c87145e049
26+
refs/heads/beta: 4352a8554f3765b98d27c1a0b1a170414f82b199
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ build.
7777
7878
Download [MinGW from
7979
here](http://mingw-w64.org/doku.php/download/mingw-builds), and choose the
80-
`threads=win32,exceptions=dwarf/seh` flavor when installing. After installing,
80+
`threads=win32,exceptions=dwarf/seh` flavor when installing. Also, make sure to install to a path without spaces in it. After installing,
8181
add its `bin` directory to your `PATH`. This is due to [#28260](https://github.com/rust-lang/rust/issues/28260), in the future,
8282
installing from pacman should be just fine.
8383

branches/beta/mk/rt.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ COMPRT_AR_$(1) := $$(AR_$(1))
253253
# We chomp -Werror here because GCC warns about the type signature of
254254
# builtins not matching its own and the build fails. It's a bit hacky,
255255
# but what can we do, we're building libclang-rt using GCC ......
256-
COMPRT_CFLAGS_$(1) := $$(filter-out -Werror -Werror=*,$$(CFG_GCCISH_CFLAGS_$(1))) -std=c99
256+
COMPRT_CFLAGS_$(1) := $$(CFG_GCCISH_CFLAGS_$(1)) -Wno-error -std=c99
257257

258258
# FreeBSD Clang's packaging is problematic; it doesn't copy unwind.h to
259259
# the standard include directory. This should really be in our changes to
@@ -361,7 +361,7 @@ $$(BACKTRACE_BUILD_DIR_$(1))/Makefile: $$(BACKTRACE_DEPS) $$(MKFILE_DEPS)
361361
CC="$$(CC_$(1))" \
362362
AR="$$(AR_$(1))" \
363363
RANLIB="$$(AR_$(1)) s" \
364-
CFLAGS="$$(CFG_GCCISH_CFLAGS_$(1):-Werror=) -fno-stack-protector" \
364+
CFLAGS="$$(CFG_GCCISH_CFLAGS_$(1)) -Wno-error -fno-stack-protector" \
365365
$(S)src/libbacktrace/configure --build=$(CFG_GNU_TRIPLE_$(CFG_BUILD)) --host=$(CFG_GNU_TRIPLE_$(1)))
366366
$$(Q)echo '#undef HAVE_ATOMIC_FUNCTIONS' >> \
367367
$$(BACKTRACE_BUILD_DIR_$(1))/config.h

branches/beta/src/bootstrap/build/compile.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,19 @@ pub fn std_link(build: &Build,
8383
libdir.join(staticlib("compiler-rt", target))));
8484
}
8585
add_to_sysroot(&out_dir, &libdir);
86+
87+
if target.contains("musl") && (target.contains("x86_64") || target.contains("i686")) {
88+
copy_third_party_objects(build, target, &libdir);
89+
}
90+
}
91+
92+
/// Copies the crt(1,i,n).o startup objects
93+
///
94+
/// Only required for musl targets that statically link to libc
95+
fn copy_third_party_objects(build: &Build, target: &str, into: &Path) {
96+
for &obj in &["crt1.o", "crti.o", "crtn.o"] {
97+
t!(fs::copy(compiler_file(build.cc(target), obj), into.join(obj)));
98+
}
8699
}
87100

88101
/// Build and prepare startup objects like rsbegin.o and rsend.o

branches/beta/src/bootstrap/build/sanity.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ pub fn check(build: &mut Build) {
7979
}
8080

8181
// Make sure musl-root is valid if specified
82-
if target.contains("musl") && target.contains("x86_64") {
82+
if target.contains("musl") && (target.contains("x86_64") || target.contains("i686")) {
8383
match build.config.musl_root {
8484
Some(ref root) => {
8585
if fs::metadata(root.join("lib/libc.a")).is_err() {

branches/beta/src/doc/reference.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,10 @@ Examples of integer literals of various forms:
379379
0usize; // type usize
380380
```
381381

382+
Note that the Rust syntax considers `-1i8` as an application of the [unary minus
383+
operator](#unary-operator-expressions) to an integer literal `1i8`, rather than
384+
a single integer literal.
385+
382386
##### Floating-point literals
383387

384388
A _floating-point literal_ has one of two forms:
@@ -2776,7 +2780,9 @@ Rust defines the following unary operators. They are all written as prefix opera
27762780
before the expression they apply to.
27772781

27782782
* `-`
2779-
: Negation. May only be applied to numeric types.
2783+
: Negation. Signed integer types and floating-point types support negation. It
2784+
is an error to apply negation to unsigned types; for example, the compiler
2785+
rejects `-1u32`.
27802786
* `*`
27812787
: Dereference. When applied to a [pointer](#pointer-types) it denotes the
27822788
pointed-to location. For pointers to mutable locations, the resulting

branches/beta/src/etc/platform-intrinsics/generator.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ def parse_args():
691691
parser.add_argument('-o', '--out', type=argparse.FileType('w'), default=sys.stdout,
692692
help = 'File to output to (default stdout).')
693693
parser.add_argument('-i', '--info', type=argparse.FileType('r'),
694-
help = 'File containing platform specific information to merge into'
694+
help = 'File containing platform specific information to merge into '
695695
'the input files\' header.')
696696
parser.add_argument('in_', metavar="FILE", type=argparse.FileType('r'), nargs='+',
697697
help = 'JSON files to load')
@@ -735,12 +735,12 @@ def open(self, platform):
735735
736736
use {{Intrinsic, i, i_, u, u_, f, v, v_, agg, p, void}};
737737
use IntrinsicDef::Named;
738-
use rustc::middle::ty;
738+
use rustc::middle::ty::TyCtxt;
739739
740740
// The default inlining settings trigger a pathological behaviour in
741741
// LLVM, which causes makes compilation very slow. See #28273.
742742
#[inline(never)]
743-
pub fn find<'tcx>(_tcx: &ty::ctxt<'tcx>, name: &str) -> Option<Intrinsic> {{
743+
pub fn find<'tcx>(_tcx: &TyCtxt<'tcx>, name: &str) -> Option<Intrinsic> {{
744744
if !name.starts_with("{0}") {{ return None }}
745745
Some(match &name["{0}".len()..] {{'''.format(platform.intrinsic_prefix())
746746

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"llvm_prefix": "llvm.x86.fma.",
3+
"intrinsics": [
4+
{
5+
"intrinsic": "{0.width_mm}_fmadd_{0.data_type}",
6+
"width": [128, 256],
7+
"llvm": "vfmadd.{0.data_type_short}{0.width_suffix}",
8+
"ret": "f(32-64)",
9+
"args": ["0", "0", "0"]
10+
},
11+
{
12+
"intrinsic": "{0.width_mm}_fmaddsub_{0.data_type}",
13+
"width": [128, 256],
14+
"llvm": "vfmaddsub.{0.data_type_short}{0.width_suffix}",
15+
"ret": "f(32-64)",
16+
"args": ["0", "0", "0"]
17+
},
18+
{
19+
"intrinsic": "{0.width_mm}_fmsub_{0.data_type}",
20+
"width": [128, 256],
21+
"llvm": "vfmsub.{0.data_type_short}{0.width_suffix}",
22+
"ret": "f(32-64)",
23+
"args": ["0", "0", "0"]
24+
},
25+
{
26+
"intrinsic": "{0.width_mm}_fmsubadd_{0.data_type}",
27+
"width": [128, 256],
28+
"llvm": "vfmsubadd.{0.data_type_short}{0.width_suffix}",
29+
"ret": "f(32-64)",
30+
"args": ["0", "0", "0"]
31+
},
32+
{
33+
"intrinsic": "{0.width_mm}_fnmadd_{0.data_type}",
34+
"width": [128, 256],
35+
"llvm": "vfnmadd.{0.data_type_short}{0.width_suffix}",
36+
"ret": "f(32-64)",
37+
"args": ["0", "0", "0"]
38+
},
39+
{
40+
"intrinsic": "{0.width_mm}_fnmsub_{0.data_type}",
41+
"width": [128, 256],
42+
"llvm": "vfnmsub.{0.data_type_short}{0.width_suffix}",
43+
"ret": "f(32-64)",
44+
"args": ["0", "0", "0"]
45+
}
46+
]
47+
}

branches/beta/src/liballoc_jemalloc/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ fn main() {
111111
println!("cargo:rustc-link-search=native={}/lib", build_dir.display());
112112
if target.contains("android") {
113113
println!("cargo:rustc-link-lib=gcc");
114-
} else if !target.contains("windows") {
114+
} else if !target.contains("windows") && !target.contains("musl") {
115115
println!("cargo:rustc-link-lib=pthread");
116116
}
117117
}

branches/beta/src/libcollections/str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//! Unicode string slices
11+
//! Unicode string slices.
1212
//!
1313
//! *[See also the `str` primitive type](../primitive.str.html).*
1414

branches/beta/src/libcollectionstest/str.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,26 @@ fn test_slice_fail() {
346346
&"中华Việt Nam"[0..2];
347347
}
348348

349+
const LOREM_PARAGRAPH: &'static str = "\
350+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse quis lorem sit amet dolor \
351+
ultricies condimentum. Praesent iaculis purus elit, ac malesuada quam malesuada in. Duis sed orci \
352+
eros. Suspendisse sit amet magna mollis, mollis nunc luctus, imperdiet mi. Integer fringilla non \
353+
sem ut lacinia. Fusce varius tortor a risus porttitor hendrerit. Morbi mauris dui, ultricies nec \
354+
tempus vel, gravida nec quam.";
355+
356+
// check the panic includes the prefix of the sliced string
357+
#[test]
358+
#[should_panic(expected="Lorem ipsum dolor sit amet")]
359+
fn test_slice_fail_truncated_1() {
360+
&LOREM_PARAGRAPH[..1024];
361+
}
362+
// check the truncation in the panic message
363+
#[test]
364+
#[should_panic(expected="luctus, im`[...] do not lie on character boundary")]
365+
fn test_slice_fail_truncated_2() {
366+
&LOREM_PARAGRAPH[..1024];
367+
}
368+
349369
#[test]
350370
fn test_slice_from() {
351371
assert_eq!(&"abcd"[0..], "abcd");

branches/beta/src/libcore/clone.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//! The `Clone` trait for types that cannot be 'implicitly copied'
11+
//! The `Clone` trait for types that cannot be 'implicitly copied'.
1212
//!
1313
//! In Rust, some simple types are "implicitly copyable" and when you
1414
//! assign them or pass them as arguments, the receiver will get a copy,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//! Utilities for formatting and printing strings
11+
//! Utilities for formatting and printing strings.
1212
1313
#![stable(feature = "rust1", since = "1.0.0")]
1414

branches/beta/src/libcore/iter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//! Composable external iteration
11+
//! Composable external iteration.
1212
//!
1313
//! If you've found yourself with a collection of some kind, and needed to
1414
//! perform an operation on the elements of said collection, you'll quickly run

branches/beta/src/libcore/mem.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//! Basic functions for dealing with memory
11+
//! Basic functions for dealing with memory.
1212
//!
1313
//! This module contains functions for querying the size and alignment of
1414
//! types, initializing and manipulating memory.

branches/beta/src/libcore/ops.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//! Overloadable operators
11+
//! Overloadable operators.
1212
//!
1313
//! Implementing these traits allows you to get an effect similar to
1414
//! overloading operators.

branches/beta/src/libcore/option.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//! Optional values
11+
//! Optional values.
1212
//!
1313
//! Type `Option` represents an optional value: every `Option`
1414
//! is either `Some` and contains a value, or `None`, and

branches/beta/src/libcore/ptr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// FIXME: talk about offset, copy_memory, copy_nonoverlapping_memory
1212

13-
//! Raw, unsafe pointers, `*const T`, and `*mut T`
13+
//! Raw, unsafe pointers, `*const T`, and `*mut T`.
1414
//!
1515
//! *[See also the pointer primitive types](../../std/primitive.pointer.html).*
1616

branches/beta/src/libcore/result.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//! Error handling with the `Result` type
11+
//! Error handling with the `Result` type.
1212
//!
1313
//! `Result<T, E>` is the type used for returning and propagating
1414
//! errors. It is an enum with the variants, `Ok(T)`, representing

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

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1645,12 +1645,30 @@ pub trait StrExt {
16451645
fn parse<T: FromStr>(&self) -> Result<T, T::Err>;
16461646
}
16471647

1648+
// truncate `&str` to length at most equal to `max`
1649+
// return `true` if it were truncated, and the new str.
1650+
fn truncate_to_char_boundary(s: &str, mut max: usize) -> (bool, &str) {
1651+
if max >= s.len() {
1652+
(false, s)
1653+
} else {
1654+
while !s.is_char_boundary(max) {
1655+
max -= 1;
1656+
}
1657+
(true, &s[..max])
1658+
}
1659+
}
1660+
16481661
#[inline(never)]
16491662
#[cold]
16501663
fn slice_error_fail(s: &str, begin: usize, end: usize) -> ! {
1651-
assert!(begin <= end);
1652-
panic!("index {} and/or {} in `{}` do not lie on character boundary",
1653-
begin, end, s);
1664+
const MAX_DISPLAY_LENGTH: usize = 256;
1665+
let (truncated, s) = truncate_to_char_boundary(s, MAX_DISPLAY_LENGTH);
1666+
let ellipsis = if truncated { "[...]" } else { "" };
1667+
1668+
assert!(begin <= end, "begin <= end ({} <= {}) when slicing `{}`{}",
1669+
begin, end, s, ellipsis);
1670+
panic!("index {} and/or {} in `{}`{} do not lie on character boundary",
1671+
begin, end, s, ellipsis);
16541672
}
16551673

16561674
#[stable(feature = "core", since = "1.6.0")]

0 commit comments

Comments
 (0)