Skip to content

[beta] backports #42161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/bootstrap/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub const CFG_RELEASE_NUM: &'static str = "1.18.0";
// An optional number to put after the label, e.g. '.2' -> '-beta.2'
// Be sure to make this starts with a dot to conform to semver pre-release
// versions (section 9)
pub const CFG_PRERELEASE_VERSION: &'static str = ".2";
pub const CFG_PRERELEASE_VERSION: &'static str = ".3";

pub struct GitInfo {
inner: Option<Info>,
Expand Down
4 changes: 0 additions & 4 deletions src/doc/unstable-book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@
- [alloc](library-features/alloc.md)
- [as_c_str](library-features/as-c-str.md)
- [ascii_ctype](library-features/ascii-ctype.md)
- [binary_heap_peek_mut_pop](library-features/binary-heap-peek-mut-pop.md)
- [box_heap](library-features/box-heap.md)
- [c_void_variant](library-features/c-void-variant.md)
- [char_escape_debug](library-features/char-escape-debug.md)
Expand Down Expand Up @@ -172,17 +171,14 @@
- [panic_abort](library-features/panic-abort.md)
- [panic_unwind](library-features/panic-unwind.md)
- [pattern](library-features/pattern.md)
- [peek](library-features/peek.md)
- [placement_in](library-features/placement-in.md)
- [placement_new_protocol](library-features/placement-new-protocol.md)
- [print](library-features/print.md)
- [proc_macro_internals](library-features/proc-macro-internals.md)
- [process_try_wait](library-features/process-try-wait.md)
- [question_mark_carrier](library-features/question-mark-carrier.md)
- [rand](library-features/rand.md)
- [range_contains](library-features/range-contains.md)
- [raw](library-features/raw.md)
- [retain_hash_collection](library-features/retain-hash-collection.md)
- [reverse_cmp_key](library-features/reverse-cmp-key.md)
- [rt](library-features/rt.md)
- [rustc_private](library-features/rustc-private.md)
Expand Down

This file was deleted.

7 changes: 0 additions & 7 deletions src/doc/unstable-book/src/library-features/peek.md

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion src/libcollections/binary_heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ impl<'a, T: Ord> DerefMut for PeekMut<'a, T> {

impl<'a, T: Ord> PeekMut<'a, T> {
/// Removes the peeked value from the heap and returns it.
#[unstable(feature = "binary_heap_peek_mut_pop", issue = "38863")]
#[stable(feature = "binary_heap_peek_mut_pop", since = "1.18.0")]
pub fn pop(mut this: PeekMut<'a, T>) -> T {
let value = this.heap.pop().unwrap();
this.sift = false;
Expand Down
1 change: 0 additions & 1 deletion src/libcollections/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

#![deny(warnings)]

#![feature(binary_heap_peek_mut_pop)]
#![feature(box_syntax)]
#![feature(inclusive_range_syntax)]
#![feature(collection_placement)]
Expand Down
3 changes: 1 addition & 2 deletions src/libstd/collections/hash/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1231,14 +1231,13 @@ impl<K, V, S> HashMap<K, V, S>
/// # Examples
///
/// ```
/// #![feature(retain_hash_collection)]
/// use std::collections::HashMap;
///
/// let mut map: HashMap<isize, isize> = (0..8).map(|x|(x, x*10)).collect();
/// map.retain(|&k, _| k % 2 == 0);
/// assert_eq!(map.len(), 4);
/// ```
#[unstable(feature = "retain_hash_collection", issue = "36648")]
#[stable(feature = "retain_hash_collection", since = "1.18.0")]
pub fn retain<F>(&mut self, mut f: F)
where F: FnMut(&K, &mut V) -> bool
{
Expand Down
53 changes: 21 additions & 32 deletions src/libstd/collections/hash/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,6 @@ use super::map::{self, HashMap, Keys, RandomState};
/// [`HashMap`]: struct.HashMap.html
/// [`PartialEq`]: ../../std/cmp/trait.PartialEq.html
/// [`RefCell`]: ../../std/cell/struct.RefCell.html


#[derive(Clone)]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct HashSet<T, S = RandomState> {
Expand Down Expand Up @@ -658,15 +656,14 @@ impl<T, S> HashSet<T, S>
/// # Examples
///
/// ```
/// #![feature(retain_hash_collection)]
/// use std::collections::HashSet;
///
/// let xs = [1,2,3,4,5,6];
/// let mut set: HashSet<isize> = xs.iter().cloned().collect();
/// set.retain(|&k| k % 2 == 0);
/// assert_eq!(set.len(), 3);
/// ```
#[unstable(feature = "retain_hash_collection", issue = "36648")]
#[stable(feature = "retain_hash_collection", since = "1.18.0")]
pub fn retain<F>(&mut self, mut f: F)
where F: FnMut(&T) -> bool
{
Expand Down Expand Up @@ -1041,9 +1038,7 @@ impl<'a, K> FusedIterator for Iter<'a, K> {}
#[stable(feature = "std_debug", since = "1.16.0")]
impl<'a, K: fmt::Debug> fmt::Debug for Iter<'a, K> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_list()
.entries(self.clone())
.finish()
f.debug_list().entries(self.clone()).finish()
}
}

Expand All @@ -1070,10 +1065,11 @@ impl<K> FusedIterator for IntoIter<K> {}
#[stable(feature = "std_debug", since = "1.16.0")]
impl<K: fmt::Debug> fmt::Debug for IntoIter<K> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let entries_iter = self.iter.inner.iter().map(|(k, _)| k);
f.debug_list()
.entries(entries_iter)
.finish()
let entries_iter = self.iter
.inner
.iter()
.map(|(k, _)| k);
f.debug_list().entries(entries_iter).finish()
}
}

Expand All @@ -1100,10 +1096,11 @@ impl<'a, K> FusedIterator for Drain<'a, K> {}
#[stable(feature = "std_debug", since = "1.16.0")]
impl<'a, K: fmt::Debug> fmt::Debug for Drain<'a, K> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let entries_iter = self.iter.inner.iter().map(|(k, _)| k);
f.debug_list()
.entries(entries_iter)
.finish()
let entries_iter = self.iter
.inner
.iter()
.map(|(k, _)| k);
f.debug_list().entries(entries_iter).finish()
}
}

Expand Down Expand Up @@ -1143,12 +1140,10 @@ impl<'a, T, S> Iterator for Intersection<'a, T, S>
#[stable(feature = "std_debug", since = "1.16.0")]
impl<'a, T, S> fmt::Debug for Intersection<'a, T, S>
where T: fmt::Debug + Eq + Hash,
S: BuildHasher,
S: BuildHasher
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_list()
.entries(self.clone())
.finish()
f.debug_list().entries(self.clone()).finish()
}
}

Expand Down Expand Up @@ -1202,12 +1197,10 @@ impl<'a, T, S> FusedIterator for Difference<'a, T, S>
#[stable(feature = "std_debug", since = "1.16.0")]
impl<'a, T, S> fmt::Debug for Difference<'a, T, S>
where T: fmt::Debug + Eq + Hash,
S: BuildHasher,
S: BuildHasher
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_list()
.entries(self.clone())
.finish()
f.debug_list().entries(self.clone()).finish()
}
}

Expand Down Expand Up @@ -1243,12 +1236,10 @@ impl<'a, T, S> FusedIterator for SymmetricDifference<'a, T, S>
#[stable(feature = "std_debug", since = "1.16.0")]
impl<'a, T, S> fmt::Debug for SymmetricDifference<'a, T, S>
where T: fmt::Debug + Eq + Hash,
S: BuildHasher,
S: BuildHasher
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_list()
.entries(self.clone())
.finish()
f.debug_list().entries(self.clone()).finish()
}
}

Expand All @@ -1269,12 +1260,10 @@ impl<'a, T, S> FusedIterator for Union<'a, T, S>
#[stable(feature = "std_debug", since = "1.16.0")]
impl<'a, T, S> fmt::Debug for Union<'a, T, S>
where T: fmt::Debug + Eq + Hash,
S: BuildHasher,
S: BuildHasher
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_list()
.entries(self.clone())
.finish()
f.debug_list().entries(self.clone()).finish()
}
}

Expand Down Expand Up @@ -1698,7 +1687,7 @@ mod test_set {

#[test]
fn test_retain() {
let xs = [1,2,3,4,5,6];
let xs = [1, 2, 3, 4, 5, 6];
let mut set: HashSet<isize> = xs.iter().cloned().collect();
set.retain(|&k| k % 2 == 0);
assert_eq!(set.len(), 3);
Expand Down
3 changes: 1 addition & 2 deletions src/libstd/net/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,15 +337,14 @@ impl TcpStream {
/// # Examples
///
/// ```no_run
/// #![feature(peek)]
/// use std::net::TcpStream;
///
/// let stream = TcpStream::connect("127.0.0.1:8000")
/// .expect("couldn't bind to address");
/// let mut buf = [0; 10];
/// let len = stream.peek(&mut buf).expect("peek failed");
/// ```
#[unstable(feature = "peek", issue = "38980")]
#[stable(feature = "peek", since = "1.18.0")]
pub fn peek(&self, buf: &mut [u8]) -> io::Result<usize> {
self.0.peek(buf)
}
Expand Down
6 changes: 2 additions & 4 deletions src/libstd/net/udp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,14 @@ impl UdpSocket {
/// # Examples
///
/// ```no_run
/// #![feature(peek)]
/// use std::net::UdpSocket;
///
/// let socket = UdpSocket::bind("127.0.0.1:34254").expect("couldn't bind to address");
/// let mut buf = [0; 10];
/// let (number_of_bytes, src_addr) = socket.peek_from(&mut buf)
/// .expect("Didn't receive data");
/// ```
#[unstable(feature = "peek", issue = "38980")]
#[stable(feature = "peek", since = "1.18.0")]
pub fn peek_from(&self, buf: &mut [u8]) -> io::Result<(usize, SocketAddr)> {
self.0.peek_from(buf)
}
Expand Down Expand Up @@ -638,7 +637,6 @@ impl UdpSocket {
/// # Examples
///
/// ```no_run
/// #![feature(peek)]
/// use std::net::UdpSocket;
///
/// let socket = UdpSocket::bind("127.0.0.1:34254").expect("couldn't bind to address");
Expand All @@ -649,7 +647,7 @@ impl UdpSocket {
/// Err(e) => println!("peek function failed: {:?}", e),
/// }
/// ```
#[unstable(feature = "peek", issue = "38980")]
#[stable(feature = "peek", since = "1.18.0")]
pub fn peek(&self, buf: &mut [u8]) -> io::Result<usize> {
self.0.peek(buf)
}
Expand Down
4 changes: 1 addition & 3 deletions src/libstd/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -903,8 +903,6 @@ impl Child {
/// Basic usage:
///
/// ```no_run
/// #![feature(process_try_wait)]
///
/// use std::process::Command;
///
/// let mut child = Command::new("ls").spawn().unwrap();
Expand All @@ -919,7 +917,7 @@ impl Child {
/// Err(e) => println!("error attempting to wait: {}", e),
/// }
/// ```
#[unstable(feature = "process_try_wait", issue = "38903")]
#[stable(feature = "process_try_wait", since = "1.18.0")]
pub fn try_wait(&mut self) -> io::Result<Option<ExitStatus>> {
Ok(self.handle.try_wait()?.map(ExitStatus))
}
Expand Down
4 changes: 2 additions & 2 deletions src/libsyntax/ext/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ impl<'a> ExtCtxt<'a> {
/// Returns span for the macro which originally caused the current expansion to happen.
///
/// Stops backtracing at include! boundary.
pub fn expansion_cause(&self) -> Span {
pub fn expansion_cause(&self) -> Option<Span> {
let mut ctxt = self.backtrace();
let mut last_macro = None;
loop {
Expand All @@ -711,7 +711,7 @@ impl<'a> ExtCtxt<'a> {
break
}
}
last_macro.expect("missing expansion backtrace")
last_macro
}

pub fn struct_span_warn(&self,
Expand Down
6 changes: 3 additions & 3 deletions src/libsyntax/ext/source_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub fn expand_line(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree])
-> Box<base::MacResult+'static> {
base::check_zero_tts(cx, sp, tts, "line!");

let topmost = cx.expansion_cause();
let topmost = cx.expansion_cause().unwrap_or(sp);
let loc = cx.codemap().lookup_char_pos(topmost.lo);

base::MacEager::expr(cx.expr_u32(topmost, loc.line as u32))
Expand All @@ -46,7 +46,7 @@ pub fn expand_column(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree])
-> Box<base::MacResult+'static> {
base::check_zero_tts(cx, sp, tts, "column!");

let topmost = cx.expansion_cause();
let topmost = cx.expansion_cause().unwrap_or(sp);
let loc = cx.codemap().lookup_char_pos(topmost.lo);

base::MacEager::expr(cx.expr_u32(topmost, loc.col.to_usize() as u32))
Expand All @@ -59,7 +59,7 @@ pub fn expand_file(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree])
-> Box<base::MacResult+'static> {
base::check_zero_tts(cx, sp, tts, "file!");

let topmost = cx.expansion_cause();
let topmost = cx.expansion_cause().unwrap_or(sp);
let loc = cx.codemap().lookup_char_pos(topmost.lo);
base::MacEager::expr(cx.expr_str(topmost, Symbol::intern(&loc.file.name)))
}
Expand Down
13 changes: 13 additions & 0 deletions src/test/compile-fail/issue-41776.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

fn main() {
include!(line!()); //~ ERROR argument must be a string literal
}