Skip to content

Commit 0fee59b

Browse files
committed
---
yaml --- r: 234246 b: refs/heads/beta c: 3dc780e h: refs/heads/master v: v3
1 parent fc0439b commit 0fee59b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+280
-573
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: 3887ca27f16771b960b57e1c80997b2482ba5b76
26+
refs/heads/beta: 3dc780ed6fb3100cf60e035537710f8a645bac33
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: 370fe2786109360f7c35b8ba552b83b773dd71d6
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/src/doc/trpl/advanced-linking.md

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -80,30 +80,33 @@ $ mkdir musldist
8080
$ PREFIX=$(pwd)/musldist
8181
$
8282
$ # Build musl
83-
$ curl -O http://www.musl-libc.org/releases/musl-1.1.10.tar.gz
83+
$ wget http://www.musl-libc.org/releases/musl-1.1.10.tar.gz
84+
[...]
8485
$ tar xf musl-1.1.10.tar.gz
8586
$ cd musl-1.1.10/
8687
musl-1.1.10 $ ./configure --disable-shared --prefix=$PREFIX
88+
[...]
8789
musl-1.1.10 $ make
90+
[...]
8891
musl-1.1.10 $ make install
92+
[...]
8993
musl-1.1.10 $ cd ..
9094
$ du -h musldist/lib/libc.a
9195
2.2M musldist/lib/libc.a
9296
$
9397
$ # Build libunwind.a
94-
$ curl -O http://llvm.org/releases/3.7.0/llvm-3.7.0.src.tar.xz
95-
$ tar xf llvm-3.7.0.src.tar.xz
96-
$ cd llvm-3.7.0.src/projects/
97-
llvm-3.7.0.src/projects $ curl http://llvm.org/releases/3.7.0/libcxxabi-3.7.0.src.tar.xz | tar xJf -
98-
llvm-3.7.0.src/projects $ mv libcxxabi-3.7.0.src libcxxabi
99-
llvm-3.7.0.src/projects $ curl http://llvm.org/releases/3.7.0/libunwind-3.7.0.src.tar.xz | tar xJf -
100-
llvm-3.7.0.src/projects $ mv libunwind-3.7.0.src libunwind
101-
llvm-3.7.0.src/projects $ mkdir libunwind/build
102-
llvm-3.7.0.src/projects $ cd libunwind/build
103-
llvm-3.7.0.src/projects/libunwind/build $ cmake -DLLVM_PATH=../../.. -DLIBUNWIND_ENABLE_SHARED=0 ..
104-
llvm-3.7.0.src/projects/libunwind/build $ make
105-
llvm-3.7.0.src/projects/libunwind/build $ cp lib/libunwind.a $PREFIX/lib/
106-
llvm-3.7.0.src/projects/libunwind/build $ cd ../../../../
98+
$ wget http://llvm.org/releases/3.6.1/llvm-3.6.1.src.tar.xz
99+
$ tar xf llvm-3.6.1.src.tar.xz
100+
$ cd llvm-3.6.1.src/projects/
101+
llvm-3.6.1.src/projects $ svn co http://llvm.org/svn/llvm-project/libcxxabi/trunk/ libcxxabi
102+
llvm-3.6.1.src/projects $ svn co http://llvm.org/svn/llvm-project/libunwind/trunk/ libunwind
103+
llvm-3.6.1.src/projects $ sed -i 's#^\(include_directories\).*$#\0\n\1(../libcxxabi/include)#' libunwind/CMakeLists.txt
104+
llvm-3.6.1.src/projects $ mkdir libunwind/build
105+
llvm-3.6.1.src/projects $ cd libunwind/build
106+
llvm-3.6.1.src/projects/libunwind/build $ cmake -DLLVM_PATH=../../.. -DLIBUNWIND_ENABLE_SHARED=0 ..
107+
llvm-3.6.1.src/projects/libunwind/build $ make
108+
llvm-3.6.1.src/projects/libunwind/build $ cp lib/libunwind.a $PREFIX/lib/
109+
llvm-3.6.1.src/projects/libunwind/build $ cd cd ../../../../
107110
$ du -h musldist/lib/libunwind.a
108111
164K musldist/lib/libunwind.a
109112
$

branches/beta/src/libcore/clone.rs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,45 @@ clone_impl! { f64 }
8686
clone_impl! { () }
8787
clone_impl! { bool }
8888
clone_impl! { char }
89+
90+
macro_rules! extern_fn_clone {
91+
($($A:ident),*) => (
92+
#[stable(feature = "rust1", since = "1.0.0")]
93+
impl<$($A,)* ReturnType> Clone for extern "Rust" fn($($A),*) -> ReturnType {
94+
/// Returns a copy of a function pointer.
95+
#[inline]
96+
fn clone(&self) -> extern "Rust" fn($($A),*) -> ReturnType { *self }
97+
}
98+
99+
#[stable(feature = "rust1", since = "1.0.0")]
100+
impl<$($A,)* ReturnType> Clone for extern "C" fn($($A),*) -> ReturnType {
101+
/// Returns a copy of a function pointer.
102+
#[inline]
103+
fn clone(&self) -> extern "C" fn($($A),*) -> ReturnType { *self }
104+
}
105+
106+
#[stable(feature = "rust1", since = "1.0.0")]
107+
impl<$($A,)* ReturnType> Clone for unsafe extern "Rust" fn($($A),*) -> ReturnType {
108+
/// Returns a copy of a function pointer.
109+
#[inline]
110+
fn clone(&self) -> unsafe extern "Rust" fn($($A),*) -> ReturnType { *self }
111+
}
112+
113+
#[stable(feature = "rust1", since = "1.0.0")]
114+
impl<$($A,)* ReturnType> Clone for unsafe extern "C" fn($($A),*) -> ReturnType {
115+
/// Returns a copy of a function pointer.
116+
#[inline]
117+
fn clone(&self) -> unsafe extern "C" fn($($A),*) -> ReturnType { *self }
118+
}
119+
)
120+
}
121+
122+
extern_fn_clone! {}
123+
extern_fn_clone! { A }
124+
extern_fn_clone! { A, B }
125+
extern_fn_clone! { A, B, C }
126+
extern_fn_clone! { A, B, C, D }
127+
extern_fn_clone! { A, B, C, D, E }
128+
extern_fn_clone! { A, B, C, D, E, F }
129+
extern_fn_clone! { A, B, C, D, E, F, G }
130+
extern_fn_clone! { A, B, C, D, E, F, G, H }

branches/beta/src/libcore/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@
7979
#![feature(optin_builtin_traits)]
8080
#![feature(reflect)]
8181
#![feature(rustc_attrs)]
82-
#![feature(unwind_attributes)]
8382
#![cfg_attr(stage0, feature(simd))]
8483
#![cfg_attr(not(stage0), feature(repr_simd, platform_intrinsics))]
8584
#![feature(staged_api)]

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

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -537,21 +537,25 @@ macro_rules! int_impl {
537537
let mut base = self;
538538
let mut acc = Self::one();
539539

540-
while exp > 1 {
540+
let mut prev_base = self;
541+
let mut base_oflo = false;
542+
while exp > 0 {
541543
if (exp & 1) == 1 {
542-
acc = acc * base;
544+
if base_oflo {
545+
// ensure overflow occurs in the same manner it
546+
// would have otherwise (i.e. signal any exception
547+
// it would have otherwise).
548+
acc = acc * (prev_base * prev_base);
549+
} else {
550+
acc = acc * base;
551+
}
543552
}
553+
prev_base = base;
554+
let (new_base, new_base_oflo) = base.overflowing_mul(base);
555+
base = new_base;
556+
base_oflo = new_base_oflo;
544557
exp /= 2;
545-
base = base * base;
546-
}
547-
548-
// Deal with the final bit of the exponent separately, since
549-
// squaring the base afterwards is not necessary and may cause a
550-
// needless overflow.
551-
if exp == 1 {
552-
acc = acc * base;
553558
}
554-
555559
acc
556560
}
557561

branches/beta/src/libcore/panicking.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ pub fn panic_fmt(fmt: fmt::Arguments, file_line: &(&'static str, u32)) -> ! {
6262
#[allow(improper_ctypes)]
6363
extern {
6464
#[lang = "panic_fmt"]
65-
#[unwind]
6665
fn panic_impl(fmt: fmt::Arguments, file: &'static str, line: u32) -> !;
6766
}
6867
let (file, line) = *file_line;

branches/beta/src/libcore/ptr.rs

Lines changed: 27 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ use clone::Clone;
2020
use intrinsics;
2121
use ops::Deref;
2222
use fmt;
23-
use hash;
2423
use option::Option::{self, Some, None};
2524
use marker::{PhantomData, Send, Sized, Sync};
2625
use mem;
@@ -309,83 +308,40 @@ impl<T: ?Sized> Clone for *mut T {
309308
}
310309
}
311310

312-
// Impls for function pointers
313-
macro_rules! fnptr_impls_safety_abi {
314-
($FnTy: ty, $($Arg: ident),*) => {
315-
#[stable(feature = "rust1", since = "1.0.0")]
316-
impl<Ret, $($Arg),*> Clone for $FnTy {
317-
#[inline]
318-
fn clone(&self) -> Self {
319-
*self
320-
}
321-
}
322-
323-
#[stable(feature = "fnptr_impls", since = "1.4.0")]
324-
impl<Ret, $($Arg),*> PartialEq for $FnTy {
325-
#[inline]
326-
fn eq(&self, other: &Self) -> bool {
327-
*self as usize == *other as usize
328-
}
329-
}
330-
331-
#[stable(feature = "fnptr_impls", since = "1.4.0")]
332-
impl<Ret, $($Arg),*> Eq for $FnTy {}
333-
334-
#[stable(feature = "fnptr_impls", since = "1.4.0")]
335-
impl<Ret, $($Arg),*> PartialOrd for $FnTy {
336-
#[inline]
337-
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
338-
(*self as usize).partial_cmp(&(*other as usize))
339-
}
340-
}
341-
342-
#[stable(feature = "fnptr_impls", since = "1.4.0")]
343-
impl<Ret, $($Arg),*> Ord for $FnTy {
344-
#[inline]
345-
fn cmp(&self, other: &Self) -> Ordering {
346-
(*self as usize).cmp(&(*other as usize))
347-
}
348-
}
311+
// Equality for extern "C" fn pointers
312+
mod externfnpointers {
313+
use cmp::PartialEq;
349314

350-
#[stable(feature = "fnptr_impls", since = "1.4.0")]
351-
impl<Ret, $($Arg),*> hash::Hash for $FnTy {
352-
fn hash<HH: hash::Hasher>(&self, state: &mut HH) {
353-
state.write_usize(*self as usize)
354-
}
355-
}
356-
357-
#[stable(feature = "fnptr_impls", since = "1.4.0")]
358-
impl<Ret, $($Arg),*> fmt::Pointer for $FnTy {
359-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
360-
fmt::Pointer::fmt(&(*self as *const ()), f)
361-
}
315+
#[stable(feature = "rust1", since = "1.0.0")]
316+
impl<_R> PartialEq for extern "C" fn() -> _R {
317+
#[inline]
318+
fn eq(&self, other: &extern "C" fn() -> _R) -> bool {
319+
let self_ = *self as usize;
320+
let other_ = *other as usize;
321+
self_ == other_
362322
}
363-
364-
#[stable(feature = "fnptr_impls", since = "1.4.0")]
365-
impl<Ret, $($Arg),*> fmt::Debug for $FnTy {
366-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
367-
fmt::Pointer::fmt(&(*self as *const ()), f)
323+
}
324+
macro_rules! fnptreq {
325+
($($p:ident),*) => {
326+
#[stable(feature = "rust1", since = "1.0.0")]
327+
impl<_R,$($p),*> PartialEq for extern "C" fn($($p),*) -> _R {
328+
#[inline]
329+
fn eq(&self, other: &extern "C" fn($($p),*) -> _R) -> bool {
330+
let self_ = *self as usize;
331+
332+
let other_ = *other as usize;
333+
self_ == other_
334+
}
368335
}
369336
}
370337
}
338+
fnptreq! { A }
339+
fnptreq! { A,B }
340+
fnptreq! { A,B,C }
341+
fnptreq! { A,B,C,D }
342+
fnptreq! { A,B,C,D,E }
371343
}
372344

373-
macro_rules! fnptr_impls_args {
374-
($($Arg: ident),*) => {
375-
fnptr_impls_safety_abi! { extern "Rust" fn($($Arg),*) -> Ret, $($Arg),* }
376-
fnptr_impls_safety_abi! { extern "C" fn($($Arg),*) -> Ret, $($Arg),* }
377-
fnptr_impls_safety_abi! { unsafe extern "Rust" fn($($Arg),*) -> Ret, $($Arg),* }
378-
fnptr_impls_safety_abi! { unsafe extern "C" fn($($Arg),*) -> Ret, $($Arg),* }
379-
}
380-
}
381-
382-
fnptr_impls_args! { }
383-
fnptr_impls_args! { A }
384-
fnptr_impls_args! { A, B }
385-
fnptr_impls_args! { A, B, C }
386-
fnptr_impls_args! { A, B, C, D }
387-
fnptr_impls_args! { A, B, C, D, E }
388-
389345
// Comparison for pointers
390346
#[stable(feature = "rust1", since = "1.0.0")]
391347
impl<T: ?Sized> Ord for *const T {

branches/beta/src/librustc/diagnostics.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1895,7 +1895,6 @@ register_diagnostics! {
18951895
// E0006 // merged with E0005
18961896
// E0134,
18971897
// E0135,
1898-
E0229, // associated type bindings are not allowed here
18991898
E0264, // unknown external lang item
19001899
E0278, // requirement is not satisfied
19011900
E0279, // requirement is not satisfied

branches/beta/src/librustc/middle/astconv_util.rs

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,40 +16,36 @@
1616

1717
use middle::def;
1818
use middle::ty::{self, Ty};
19-
20-
use syntax::codemap::Span;
2119
use rustc_front::hir as ast;
2220

23-
pub fn prohibit_type_params(tcx: &ty::ctxt, segments: &[ast::PathSegment]) {
21+
pub const NO_REGIONS: usize = 1;
22+
pub const NO_TPS: usize = 2;
23+
24+
pub fn check_path_args(tcx: &ty::ctxt, segments: &[ast::PathSegment], flags: usize) {
2425
for segment in segments {
25-
for typ in segment.parameters.types() {
26-
span_err!(tcx.sess, typ.span, E0109,
27-
"type parameters are not allowed on this type");
28-
break;
29-
}
30-
for lifetime in segment.parameters.lifetimes() {
31-
span_err!(tcx.sess, lifetime.span, E0110,
32-
"lifetime parameters are not allowed on this type");
33-
break;
26+
if (flags & NO_TPS) != 0 {
27+
for typ in segment.parameters.types() {
28+
span_err!(tcx.sess, typ.span, E0109,
29+
"type parameters are not allowed on this type");
30+
break;
31+
}
3432
}
35-
for binding in segment.parameters.bindings() {
36-
prohibit_projection(tcx, binding.span);
37-
break;
33+
34+
if (flags & NO_REGIONS) != 0 {
35+
for lifetime in segment.parameters.lifetimes() {
36+
span_err!(tcx.sess, lifetime.span, E0110,
37+
"lifetime parameters are not allowed on this type");
38+
break;
39+
}
3840
}
3941
}
4042
}
4143

42-
pub fn prohibit_projection(tcx: &ty::ctxt, span: Span)
43-
{
44-
span_err!(tcx.sess, span, E0229,
45-
"associated type bindings are not allowed here");
46-
}
47-
4844
pub fn prim_ty_to_ty<'tcx>(tcx: &ty::ctxt<'tcx>,
4945
segments: &[ast::PathSegment],
5046
nty: ast::PrimTy)
5147
-> Ty<'tcx> {
52-
prohibit_type_params(tcx, segments);
48+
check_path_args(tcx, segments, NO_TPS | NO_REGIONS);
5349
match nty {
5450
ast::TyBool => tcx.types.bool,
5551
ast::TyChar => tcx.types.char,

0 commit comments

Comments
 (0)