Skip to content

Commit fc0439b

Browse files
committed
---
yaml --- r: 234245 b: refs/heads/beta c: 3887ca2 h: refs/heads/master i: 234243: 361ab3c v: v3
1 parent edef59c commit fc0439b

Some content is hidden

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

100 files changed

+9128
-8643
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: 2eafd19dfadd035214ae7b17a91436650730a28e
26+
refs/heads/beta: 3887ca27f16771b960b57e1c80997b2482ba5b76
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/libcore/clone.rs

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -86,45 +86,3 @@ 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/num/mod.rs

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

540-
let mut prev_base = self;
541-
let mut base_oflo = false;
542-
while exp > 0 {
540+
while exp > 1 {
543541
if (exp & 1) == 1 {
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-
}
542+
acc = acc * base;
552543
}
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;
557544
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;
558553
}
554+
559555
acc
560556
}
561557

branches/beta/src/libcore/ptr.rs

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

311-
// Equality for extern "C" fn pointers
312-
mod externfnpointers {
313-
use cmp::PartialEq;
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+
}
314322

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_
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+
}
322329
}
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-
}
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+
}
349+
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+
}
362+
}
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)
335368
}
336369
}
337370
}
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 }
343371
}
344372

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+
345389
// Comparison for pointers
346390
#[stable(feature = "rust1", since = "1.0.0")]
347391
impl<T: ?Sized> Ord for *const T {

branches/beta/src/librustc/lib.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ pub mod front {
107107
pub mod middle {
108108
pub mod astconv_util;
109109
pub mod astencode;
110-
pub mod cast;
111110
pub mod cfg;
112111
pub mod check_const;
113112
pub mod check_static_recursion;
@@ -124,15 +123,13 @@ pub mod middle {
124123
pub mod effect;
125124
pub mod entry;
126125
pub mod expr_use_visitor;
127-
pub mod fast_reject;
128126
pub mod free_region;
129127
pub mod intrinsicck;
130128
pub mod infer;
131129
pub mod implicator;
132130
pub mod lang_items;
133131
pub mod liveness;
134132
pub mod mem_categorization;
135-
pub mod outlives;
136133
pub mod pat_util;
137134
pub mod privacy;
138135
pub mod reachable;
@@ -143,11 +140,6 @@ pub mod middle {
143140
pub mod subst;
144141
pub mod traits;
145142
pub mod ty;
146-
pub mod ty_fold;
147-
pub mod ty_match;
148-
pub mod ty_relate;
149-
pub mod ty_walk;
150-
pub mod wf;
151143
pub mod weak_lang_items;
152144
}
153145

branches/beta/src/librustc/metadata/csearch.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,11 @@ pub fn get_impl_polarity<'tcx>(tcx: &ty::ctxt<'tcx>,
247247
decoder::get_impl_polarity(&*cdata, def.node)
248248
}
249249

250-
pub fn get_custom_coerce_unsized_kind<'tcx>(tcx: &ty::ctxt<'tcx>,
251-
def: DefId)
252-
-> Option<ty::CustomCoerceUnsized> {
250+
pub fn get_custom_coerce_unsized_kind<'tcx>(
251+
tcx: &ty::ctxt<'tcx>,
252+
def: DefId)
253+
-> Option<ty::adjustment::CustomCoerceUnsized>
254+
{
253255
let cstore = &tcx.sess.cstore;
254256
let cdata = cstore.get_crate_data(def.krate);
255257
decoder::get_custom_coerce_unsized_kind(&*cdata, def.node)

branches/beta/src/librustc/metadata/decoder.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -540,9 +540,11 @@ pub fn get_impl_polarity<'tcx>(cdata: Cmd,
540540
}
541541
}
542542

543-
pub fn get_custom_coerce_unsized_kind<'tcx>(cdata: Cmd,
544-
id: ast::NodeId)
545-
-> Option<ty::CustomCoerceUnsized> {
543+
pub fn get_custom_coerce_unsized_kind<'tcx>(
544+
cdata: Cmd,
545+
id: ast::NodeId)
546+
-> Option<ty::adjustment::CustomCoerceUnsized>
547+
{
546548
let item_doc = cdata.lookup_item(id);
547549
reader::maybe_get_doc(item_doc, tag_impl_coerce_unsized_kind).map(|kind_doc| {
548550
let mut decoder = reader::Decoder::new(kind_doc);

0 commit comments

Comments
 (0)