Skip to content

Commit 63164ba

Browse files
committed
---
yaml --- r: 210426 b: refs/heads/try c: 7132092 h: refs/heads/master v: v3
1 parent ee4489c commit 63164ba

File tree

45 files changed

+208
-286
lines changed

Some content is hidden

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

45 files changed

+208
-286
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 3e561f05c00cd180ec02db4ccab2840a4aba93d2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: ba0e1cd8147d452c356aacb29fb87568ca26f111
5-
refs/heads/try: dd59b1fb4c66089c10b7e189975aeb171085312e
5+
refs/heads/try: 7132092ce6e954eb58d490fa886d0865c5cfba38
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/src/libcollections/vec.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ use core::intrinsics::assume;
6767
use core::iter::{repeat, FromIterator};
6868
use core::marker::PhantomData;
6969
use core::mem;
70-
use core::ops::{Index, IndexMut, Deref, Add};
70+
use core::ops::{Index, IndexMut, Deref};
7171
use core::ops;
7272
use core::ptr;
7373
use core::ptr::Unique;
@@ -1622,17 +1622,6 @@ impl<T: Ord> Ord for Vec<T> {
16221622
}
16231623
}
16241624

1625-
#[stable(feature = "rust1", since = "1.0.0")]
1626-
impl<'a, T: Clone> Add<&'a [T]> for Vec<T> {
1627-
type Output = Vec<T>;
1628-
1629-
#[inline]
1630-
fn add(mut self, rhs: &[T]) -> Vec<T> {
1631-
self.push_all(rhs);
1632-
self
1633-
}
1634-
}
1635-
16361625
#[stable(feature = "rust1", since = "1.0.0")]
16371626
impl<T> Drop for Vec<T> {
16381627
fn drop(&mut self) {

branches/try/src/libcore/slice.rs

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -631,8 +631,14 @@ fn size_from_ptr<T>(_: *const T) -> usize {
631631
}
632632

633633

634-
// Use macro to be generic over const/mut
635-
macro_rules! slice_offset {
634+
// Use macros to be generic over const/mut
635+
//
636+
// They require non-negative `$by` because otherwise the expression
637+
// `(ptr as usize + $by)` would interpret `-1` as `usize::MAX` (and
638+
// thus trigger a panic when overflow checks are on).
639+
640+
// Use this to do `$ptr + $by`, where `$by` is non-negative.
641+
macro_rules! slice_add_offset {
636642
($ptr:expr, $by:expr) => {{
637643
let ptr = $ptr;
638644
if size_from_ptr(ptr) == 0 {
@@ -643,6 +649,18 @@ macro_rules! slice_offset {
643649
}};
644650
}
645651

652+
// Use this to do `$ptr - $by`, where `$by` is non-negative.
653+
macro_rules! slice_sub_offset {
654+
($ptr:expr, $by:expr) => {{
655+
let ptr = $ptr;
656+
if size_from_ptr(ptr) == 0 {
657+
transmute(ptr as usize - $by)
658+
} else {
659+
ptr.offset(-$by)
660+
}
661+
}};
662+
}
663+
646664
macro_rules! slice_ref {
647665
($ptr:expr) => {{
648666
let ptr = $ptr;
@@ -672,7 +690,7 @@ macro_rules! iterator {
672690
None
673691
} else {
674692
let old = self.ptr;
675-
self.ptr = slice_offset!(self.ptr, 1);
693+
self.ptr = slice_add_offset!(self.ptr, 1);
676694
Some(slice_ref!(old))
677695
}
678696
}
@@ -714,7 +732,7 @@ macro_rules! iterator {
714732
if self.end == self.ptr {
715733
None
716734
} else {
717-
self.end = slice_offset!(self.end, -1);
735+
self.end = slice_sub_offset!(self.end, 1);
718736
Some(slice_ref!(self.end))
719737
}
720738
}
@@ -776,7 +794,7 @@ impl<'a, T> Iter<'a, T> {
776794
fn iter_nth(&mut self, n: usize) -> Option<&'a T> {
777795
match self.as_slice().get(n) {
778796
Some(elem_ref) => unsafe {
779-
self.ptr = slice_offset!(elem_ref as *const _, 1);
797+
self.ptr = slice_add_offset!(elem_ref as *const _, 1);
780798
Some(slice_ref!(elem_ref))
781799
},
782800
None => {
@@ -849,7 +867,7 @@ impl<'a, T> IterMut<'a, T> {
849867
fn iter_nth(&mut self, n: usize) -> Option<&'a mut T> {
850868
match make_mut_slice!(T => &'a mut [T]: self.ptr, self.end).get_mut(n) {
851869
Some(elem_ref) => unsafe {
852-
self.ptr = slice_offset!(elem_ref as *mut _, 1);
870+
self.ptr = slice_add_offset!(elem_ref as *mut _, 1);
853871
Some(slice_ref!(elem_ref))
854872
},
855873
None => {

branches/try/src/librustc/middle/traits/error_reporting.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,12 @@ pub fn report_projection_error<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
5656
{
5757
let predicate =
5858
infcx.resolve_type_vars_if_possible(&obligation.predicate);
59-
if !predicate.references_error() {
59+
// The ty_err created by normalize_to_error can end up being unified
60+
// into all obligations: for example, if our obligation is something
61+
// like `$X = <() as Foo<$X>>::Out` and () does not implement Foo<_>,
62+
// then $X will be unified with ty_err, but the error still needs to be
63+
// reported.
64+
if !infcx.tcx.sess.has_errors() || !predicate.references_error() {
6065
span_err!(infcx.tcx.sess, obligation.cause.span, E0271,
6166
"type mismatch resolving `{}`: {}",
6267
predicate.user_string(infcx.tcx),
@@ -183,7 +188,8 @@ pub fn report_selection_error<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
183188
let trait_predicate =
184189
infcx.resolve_type_vars_if_possible(trait_predicate);
185190

186-
if !trait_predicate.references_error() {
191+
if !infcx.tcx.sess.has_errors() ||
192+
!trait_predicate.references_error() {
187193
let trait_ref = trait_predicate.to_poly_trait_ref();
188194
span_err!(infcx.tcx.sess, obligation.cause.span, E0277,
189195
"the trait `{}` is not implemented for the type `{}`",

branches/try/src/librustc/middle/traits/project.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,10 @@ fn opt_normalize_projection_type<'a,'b,'tcx>(
408408
}
409409

410410
/// in various error cases, we just set ty_err and return an obligation
411-
/// that, when fulfilled, will lead to an error
411+
/// that, when fulfilled, will lead to an error.
412+
///
413+
/// FIXME: the ty_err created here can enter the obligation we create,
414+
/// leading to error messages involving ty_err.
412415
fn normalize_to_error<'a,'tcx>(selcx: &mut SelectionContext<'a,'tcx>,
413416
projection_ty: ty::ProjectionTy<'tcx>,
414417
cause: ObligationCause<'tcx>,

branches/try/src/librustdoc/html/render.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1460,7 +1460,9 @@ impl<'a> fmt::Display for Item<'a> {
14601460
try!(write!(fmt, "<span class='out-of-band'>"));
14611461
try!(write!(fmt,
14621462
r##"<span id='render-detail'>
1463-
<a id="toggle-all-docs" href="#" title="collapse all docs">[&minus;]</a>
1463+
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
1464+
[<span class='inner'>&#x2212;</span>]
1465+
</a>
14641466
</span>"##));
14651467

14661468
// Write `src` tag

branches/try/src/librustdoc/html/static/main.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ pre.rust { position: relative; }
581581

582582
.collapse-toggle > .inner {
583583
display: inline-block;
584-
width: 1ch;
584+
width: 1.2ch;
585585
text-align: center;
586586
}
587587

branches/try/src/librustdoc/html/static/main.js

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -806,22 +806,35 @@
806806
window.location = $('.srclink').attr('href');
807807
}
808808

809+
function labelForToggleButton(sectionIsCollapsed) {
810+
if (sectionIsCollapsed) {
811+
// button will expand the section
812+
return "+";
813+
} else {
814+
// button will collapse the section
815+
// note that this text is also set in the HTML template in render.rs
816+
return "\u2212"; // "\u2212" is '−' minus sign
817+
}
818+
}
819+
809820
$("#toggle-all-docs").on("click", function() {
810821
var toggle = $("#toggle-all-docs");
811-
if (toggle.html() == "[&minus;]") {
812-
toggle.html("[&plus;]");
813-
toggle.attr("title", "expand all docs");
814-
$(".docblock").hide();
815-
$(".toggle-label").show();
816-
$(".toggle-wrapper").addClass("collapsed");
817-
$(".collapse-toggle").children(".inner").html("&plus;");
818-
} else {
819-
toggle.html("[&minus;]");
822+
if (toggle.hasClass("will-expand")) {
823+
toggle.removeClass("will-expand");
824+
toggle.children(".inner").text(labelForToggleButton(false));
820825
toggle.attr("title", "collapse all docs");
821826
$(".docblock").show();
822827
$(".toggle-label").hide();
823828
$(".toggle-wrapper").removeClass("collapsed");
824-
$(".collapse-toggle").children(".inner").html("&minus;");
829+
$(".collapse-toggle").children(".inner").text(labelForToggleButton(false));
830+
} else {
831+
toggle.addClass("will-expand");
832+
toggle.children(".inner").text(labelForToggleButton(true));
833+
toggle.attr("title", "expand all docs");
834+
$(".docblock").hide();
835+
$(".toggle-label").show();
836+
$(".toggle-wrapper").addClass("collapsed");
837+
$(".collapse-toggle").children(".inner").text(labelForToggleButton(true));
825838
}
826839
});
827840

@@ -835,20 +848,21 @@
835848
if (relatedDoc.is(":visible")) {
836849
relatedDoc.slideUp({duration:'fast', easing:'linear'});
837850
toggle.parent(".toggle-wrapper").addClass("collapsed");
838-
toggle.children(".inner").html("&plus;");
851+
toggle.children(".inner").text(labelForToggleButton(true));
839852
toggle.children(".toggle-label").fadeIn();
840853
} else {
841854
relatedDoc.slideDown({duration:'fast', easing:'linear'});
842855
toggle.parent(".toggle-wrapper").removeClass("collapsed");
843-
toggle.children(".inner").html("&minus;");
856+
toggle.children(".inner").text(labelForToggleButton(false));
844857
toggle.children(".toggle-label").hide();
845858
}
846859
}
847860
});
848861

849862
$(function() {
850863
var toggle = $("<a/>", {'href': 'javascript:void(0)', 'class': 'collapse-toggle'})
851-
.html("[<span class='inner'>&minus;</span>]");
864+
.html("[<span class='inner'></span>]");
865+
toggle.children(".inner").text(labelForToggleButton(false));
852866

853867
$(".method").each(function() {
854868
if ($(this).next().is(".docblock") ||

branches/try/src/libstd/fs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use fmt;
2323
use ffi::OsString;
2424
use io::{self, Error, ErrorKind, SeekFrom, Seek, Read, Write};
2525
use path::{Path, PathBuf};
26-
use sys::fs2 as fs_imp;
26+
use sys::fs as fs_imp;
2727
use sys_common::{AsInnerMut, FromInner, AsInner};
2828
use vec::Vec;
2929

branches/try/src/libstd/net/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use prelude::v1::*;
1616

1717
use io::{self, Error, ErrorKind};
18-
use sys_common::net2 as net_imp;
18+
use sys_common::net as net_imp;
1919

2020
pub use self::ip::{IpAddr, Ipv4Addr, Ipv6Addr, Ipv6MulticastScope};
2121
pub use self::addr::{SocketAddr, SocketAddrV4, SocketAddrV6, ToSocketAddrs};

branches/try/src/libstd/net/tcp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use io::prelude::*;
1717
use fmt;
1818
use io;
1919
use net::{ToSocketAddrs, SocketAddr, Shutdown};
20-
use sys_common::net2 as net_imp;
20+
use sys_common::net as net_imp;
2121
use sys_common::{AsInner, FromInner};
2222

2323
/// A structure which represents a TCP stream between a local socket and a

branches/try/src/libstd/net/udp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use prelude::v1::*;
1616
use fmt;
1717
use io::{self, Error, ErrorKind};
1818
use net::{ToSocketAddrs, SocketAddr, IpAddr};
19-
use sys_common::net2 as net_imp;
19+
use sys_common::net as net_imp;
2020
use sys_common::{AsInner, FromInner};
2121

2222
/// A User Datagram Protocol socket.

branches/try/src/libstd/os/android/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
pub mod raw;
1616

1717
pub mod fs {
18-
pub use sys::fs2::MetadataExt;
18+
pub use sys::fs::MetadataExt;
1919
}

branches/try/src/libstd/os/bitrig/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
pub mod raw;
1616

1717
pub mod fs {
18-
pub use sys::fs2::MetadataExt;
18+
pub use sys::fs::MetadataExt;
1919
}

branches/try/src/libstd/os/dragonfly/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
pub mod raw;
1616

1717
pub mod fs {
18-
pub use sys::fs2::MetadataExt;
18+
pub use sys::fs::MetadataExt;
1919
}

branches/try/src/libstd/os/freebsd/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
pub mod raw;
1616

1717
pub mod fs {
18-
pub use sys::fs2::MetadataExt;
18+
pub use sys::fs::MetadataExt;
1919
}

branches/try/src/libstd/os/ios/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
pub mod raw;
1616

1717
pub mod fs {
18-
pub use sys::fs2::MetadataExt;
18+
pub use sys::fs::MetadataExt;
1919
}

branches/try/src/libstd/os/linux/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
pub mod raw;
1616

1717
pub mod fs {
18-
pub use sys::fs2::MetadataExt;
18+
pub use sys::fs::MetadataExt;
1919
}

branches/try/src/libstd/os/macos/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
pub mod raw;
1616

1717
pub mod fs {
18-
pub use sys::fs2::MetadataExt;
18+
pub use sys::fs::MetadataExt;
1919
}

branches/try/src/libstd/os/nacl/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
pub mod raw;
1616

1717
pub mod fs {
18-
pub use sys::fs2::MetadataExt;
18+
pub use sys::fs::MetadataExt;
1919
}

branches/try/src/libstd/os/openbsd/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
pub mod raw;
1616

1717
pub mod fs {
18-
pub use sys::fs2::MetadataExt;
18+
pub use sys::fs::MetadataExt;
1919
}

branches/try/src/libstd/process.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ use fmt;
2121
use io::{self, Error, ErrorKind};
2222
use path;
2323
use sync::mpsc::{channel, Receiver};
24-
use sys::pipe2::{self, AnonPipe};
25-
use sys::process2::Command as CommandImp;
26-
use sys::process2::Process as ProcessImp;
27-
use sys::process2::ExitStatus as ExitStatusImp;
28-
use sys::process2::Stdio as StdioImp2;
24+
use sys::pipe::{self, AnonPipe};
25+
use sys::process::Command as CommandImp;
26+
use sys::process::Process as ProcessImp;
27+
use sys::process::ExitStatus as ExitStatusImp;
28+
use sys::process::Stdio as StdioImp2;
2929
use sys_common::{AsInner, AsInnerMut};
3030
use thread;
3131

@@ -334,7 +334,7 @@ fn setup_io(io: &StdioImp, readable: bool)
334334
Null => (StdioImp2::None, None),
335335
Inherit => (StdioImp2::Inherit, None),
336336
Piped => {
337-
let (reader, writer) = try!(pipe2::anon_pipe());
337+
let (reader, writer) = try!(pipe::anon_pipe());
338338
if readable {
339339
(StdioImp2::Piped(reader), Some(writer))
340340
} else {

0 commit comments

Comments
 (0)