Skip to content
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

Rollup of 13 pull requests #56451

Merged
merged 31 commits into from
Dec 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
0591ff7
OsString: mention storage form in discussion
jnqnfe Nov 10, 2018
a1e9c7f
OsStr: clarify `len()` method documentation
jnqnfe Nov 10, 2018
aa5a4ef
Removed feature gate.
alexreg Nov 30, 2018
7bc1255
Removed chapter from Unstable Book.
alexreg Nov 30, 2018
d609fdf
Updated ui tests.
alexreg Nov 30, 2018
f4cde5b
stabilize std::dbg!(...)
Centril Dec 1, 2018
4c2c523
Move VecDeque::resize_with out of the impl<T:Clone> block
scottmcm Dec 1, 2018
a3b7a21
Improve the unstable book example for `#[marker]`
scottmcm Dec 1, 2018
df0ab06
Update tracking issue for `extern_crate_self`
petrochenkov Dec 1, 2018
08a6cf3
Remove unneeded body class selector
GuillaumeGomez Dec 1, 2018
12c9b79
Fix failing tidy (line endings on Windows)
petrochenkov Dec 1, 2018
e7e9692
remove some uses of try!
mark-i-m Dec 1, 2018
1e18cc9
Update issue number of `shrink_to` methods to point the tracking issue
ordovicia Dec 2, 2018
70371fd
Add description about `crate` for parse_visibility's comment
yui-knk Dec 2, 2018
172ec72
Fix "line longer than 100 chars"
yui-knk Dec 2, 2018
d605e1d
explicitly control compiler_builts/c feature from libstd
RalfJung Dec 2, 2018
bd20718
make the C part of compiler-builtins opt-out
RalfJung Dec 2, 2018
96bf06b
Remove not used `DotEq` token
yui-knk Dec 2, 2018
e9a8055
Rollup merge of #56141 - jnqnfe:osstr_len_clarity, r=nagisa
kennytm Dec 3, 2018
bf96a7b
Rollup merge of #56366 - alexreg:stabilise-self_in_typedefs, r=Centril
kennytm Dec 3, 2018
441aaf8
Rollup merge of #56395 - Centril:stabilize-dbg-macro, r=SimonSapin
kennytm Dec 3, 2018
2cbcd36
Rollup merge of #56401 - scottmcm:vecdeque-resize-with, r=dtolnay
kennytm Dec 3, 2018
65e6702
Rollup merge of #56402 - scottmcm:better-marker-trait-example, r=Centril
kennytm Dec 3, 2018
81752fd
Rollup merge of #56412 - petrochenkov:extself, r=Centril
kennytm Dec 3, 2018
17f6fc7
Rollup merge of #56416 - GuillaumeGomez:css-body, r=QuietMisdreavus
kennytm Dec 3, 2018
71d76be
Rollup merge of #56418 - petrochenkov:wintidy, r=nagisa
kennytm Dec 3, 2018
ca98bce
Rollup merge of #56419 - mark-i-m:remove-try, r=Centril
kennytm Dec 3, 2018
52a4fc8
Rollup merge of #56432 - ordovicia:shrink-to-issue, r=Centril
kennytm Dec 3, 2018
a498a6d
Rollup merge of #56433 - yui-knk:update_comment_of_parse_visibility, …
kennytm Dec 3, 2018
21433f2
Rollup merge of #56435 - RalfJung:libstd-without-c, r=alexcrichton
kennytm Dec 3, 2018
ac363d8
Rollup merge of #56438 - yui-knk:remove_not_used_DotEq_token, r=petro…
kennytm Dec 3, 2018
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
6 changes: 3 additions & 3 deletions src/bootstrap/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -915,13 +915,13 @@ fn symlink_dir_force(config: &Config, src: &Path, dst: &Path) -> io::Result<()>
}
if let Ok(m) = fs::symlink_metadata(dst) {
if m.file_type().is_dir() {
try!(fs::remove_dir_all(dst));
fs::remove_dir_all(dst)?;
} else {
// handle directory junctions on windows by falling back to
// `remove_dir`.
try!(fs::remove_file(dst).or_else(|_| {
fs::remove_file(dst).or_else(|_| {
fs::remove_dir(dst)
}));
})?;
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/bootstrap/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,11 @@ pub fn symlink_dir(config: &Config, src: &Path, dest: &Path) -> io::Result<()> {
// We're using low-level APIs to create the junction, and these are more
// picky about paths. For example, forward slashes cannot be used as a
// path separator, so we should try to canonicalize the path first.
let target = try!(fs::canonicalize(target));
let target = fs::canonicalize(target)?;

try!(fs::create_dir(junction));
fs::create_dir(junction)?;

let path = try!(to_u16s(junction));
let path = to_u16s(junction)?;

unsafe {
let h = CreateFileW(path.as_ptr(),
Expand Down
2 changes: 1 addition & 1 deletion src/doc/edition-guide
2 changes: 1 addition & 1 deletion src/doc/rustc-guide
14 changes: 8 additions & 6 deletions src/doc/unstable-book/src/language-features/marker-trait-attr.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,17 @@ when they'd need to do the same thing for every type anyway).
```rust
#![feature(marker_trait_attr)]

use std::fmt::{Debug, Display};
#[marker] trait CheapToClone: Clone {}

#[marker] trait MyMarker {}
impl<T: Copy> CheapToClone for T {}

impl<T: Debug> MyMarker for T {}
impl<T: Display> MyMarker for T {}
// These could potentally overlap with the blanket implementation above,
// so are only allowed because CheapToClone is a marker trait.
impl<T: CheapToClone, U: CheapToClone> CheapToClone for (T, U) {}
impl<T: CheapToClone> CheapToClone for std::ops::Range<T> {}

fn foo<T: MyMarker>(t: T) -> T {
t
fn cheap_clone<T: CheapToClone>(t: T) -> T {
t.clone()
}
```

Expand Down
24 changes: 0 additions & 24 deletions src/doc/unstable-book/src/language-features/self-in-typedefs.md

This file was deleted.

2 changes: 1 addition & 1 deletion src/liballoc/collections/binary_heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ impl<T: Ord> BinaryHeap<T> {
/// assert!(heap.capacity() >= 10);
/// ```
#[inline]
#[unstable(feature = "shrink_to", reason = "new API", issue="0")]
#[unstable(feature = "shrink_to", reason = "new API", issue="56431")]
pub fn shrink_to(&mut self, min_capacity: usize) {
self.data.shrink_to(min_capacity)
}
Expand Down
62 changes: 28 additions & 34 deletions src/liballoc/collections/vec_deque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

use core::cmp::Ordering;
use core::fmt;
use core::iter::{repeat, repeat_with, FromIterator, FusedIterator};
use core::iter::{repeat_with, FromIterator, FusedIterator};
use core::mem;
use core::ops::Bound::{Excluded, Included, Unbounded};
use core::ops::{Index, IndexMut, RangeBounds};
Expand Down Expand Up @@ -701,7 +701,7 @@ impl<T> VecDeque<T> {
/// buf.shrink_to(0);
/// assert!(buf.capacity() >= 4);
/// ```
#[unstable(feature = "shrink_to", reason = "new API", issue="0")]
#[unstable(feature = "shrink_to", reason = "new API", issue="56431")]
pub fn shrink_to(&mut self, min_capacity: usize) {
assert!(self.capacity() >= min_capacity, "Tried to shrink to a larger capacity");

Expand Down Expand Up @@ -1886,16 +1886,16 @@ impl<T> VecDeque<T> {
debug_assert!(!self.is_full());
}
}
}

impl<T: Clone> VecDeque<T> {
/// Modifies the `VecDeque` in-place so that `len()` is equal to new_len,
/// either by removing excess elements from the back or by appending clones of `value`
/// to the back.
/// Modifies the `VecDeque` in-place so that `len()` is equal to `new_len`,
/// either by removing excess elements from the back or by appending
/// elements generated by calling `generator` to the back.
///
/// # Examples
///
/// ```
/// #![feature(vec_resize_with)]
///
/// use std::collections::VecDeque;
///
/// let mut buf = VecDeque::new();
Expand All @@ -1904,32 +1904,36 @@ impl<T: Clone> VecDeque<T> {
/// buf.push_back(15);
/// assert_eq!(buf, [5, 10, 15]);
///
/// buf.resize(2, 0);
/// buf.resize_with(5, Default::default);
/// assert_eq!(buf, [5, 10, 15, 0, 0]);
///
/// buf.resize_with(2, || unreachable!());
/// assert_eq!(buf, [5, 10]);
///
/// buf.resize(5, 20);
/// assert_eq!(buf, [5, 10, 20, 20, 20]);
/// let mut state = 100;
/// buf.resize_with(5, || { state += 1; state });
/// assert_eq!(buf, [5, 10, 101, 102, 103]);
/// ```
#[stable(feature = "deque_extras", since = "1.16.0")]
pub fn resize(&mut self, new_len: usize, value: T) {
#[unstable(feature = "vec_resize_with", issue = "41758")]
pub fn resize_with(&mut self, new_len: usize, generator: impl FnMut()->T) {
let len = self.len();

if new_len > len {
self.extend(repeat(value).take(new_len - len))
self.extend(repeat_with(generator).take(new_len - len))
} else {
self.truncate(new_len);
}
}
}

/// Modifies the `VecDeque` in-place so that `len()` is equal to `new_len`,
/// either by removing excess elements from the back or by appending
/// elements generated by calling `generator` to the back.
impl<T: Clone> VecDeque<T> {
/// Modifies the `VecDeque` in-place so that `len()` is equal to new_len,
/// either by removing excess elements from the back or by appending clones of `value`
/// to the back.
///
/// # Examples
///
/// ```
/// #![feature(vec_resize_with)]
///
/// use std::collections::VecDeque;
///
/// let mut buf = VecDeque::new();
Expand All @@ -1938,25 +1942,15 @@ impl<T: Clone> VecDeque<T> {
/// buf.push_back(15);
/// assert_eq!(buf, [5, 10, 15]);
///
/// buf.resize_with(5, Default::default);
/// assert_eq!(buf, [5, 10, 15, 0, 0]);
///
/// buf.resize_with(2, || unreachable!());
/// buf.resize(2, 0);
/// assert_eq!(buf, [5, 10]);
///
/// let mut state = 100;
/// buf.resize_with(5, || { state += 1; state });
/// assert_eq!(buf, [5, 10, 101, 102, 103]);
/// buf.resize(5, 20);
/// assert_eq!(buf, [5, 10, 20, 20, 20]);
/// ```
#[unstable(feature = "vec_resize_with", issue = "41758")]
pub fn resize_with(&mut self, new_len: usize, generator: impl FnMut()->T) {
let len = self.len();

if new_len > len {
self.extend(repeat_with(generator).take(new_len - len))
} else {
self.truncate(new_len);
}
#[stable(feature = "deque_extras", since = "1.16.0")]
pub fn resize(&mut self, new_len: usize, value: T) {
self.resize_with(new_len, || value.clone());
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/liballoc/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,7 @@ impl String {
/// assert!(s.capacity() >= 3);
/// ```
#[inline]
#[unstable(feature = "shrink_to", reason = "new API", issue="0")]
#[unstable(feature = "shrink_to", reason = "new API", issue="56431")]
pub fn shrink_to(&mut self, min_capacity: usize) {
self.vec.shrink_to(min_capacity)
}
Expand Down
2 changes: 1 addition & 1 deletion src/liballoc/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ impl<T> Vec<T> {
/// vec.shrink_to(0);
/// assert!(vec.capacity() >= 3);
/// ```
#[unstable(feature = "shrink_to", reason = "new API", issue="0")]
#[unstable(feature = "shrink_to", reason = "new API", issue="56431")]
pub fn shrink_to(&mut self, min_capacity: usize) {
self.buf.shrink_to_fit(cmp::max(self.len, min_capacity));
}
Expand Down
10 changes: 5 additions & 5 deletions src/libcore/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,14 +278,14 @@ macro_rules! debug_assert_ne {
///
/// // The previous method of quick returning Errors
/// fn write_to_file_using_try() -> Result<(), MyError> {
/// let mut file = try!(File::create("my_best_friends.txt"));
/// try!(file.write_all(b"This is a list of my best friends."));
/// let mut file = r#try!(File::create("my_best_friends.txt"));
/// r#try!(file.write_all(b"This is a list of my best friends."));
/// Ok(())
/// }
///
/// // This is equivalent to:
/// fn write_to_file_using_match() -> Result<(), MyError> {
/// let mut file = try!(File::create("my_best_friends.txt"));
/// let mut file = r#try!(File::create("my_best_friends.txt"));
/// match file.write_all(b"This is a list of my best friends.") {
/// Ok(v) => v,
/// Err(e) => return Err(From::from(e)),
Expand All @@ -296,14 +296,14 @@ macro_rules! debug_assert_ne {
#[macro_export]
#[stable(feature = "rust1", since = "1.0.0")]
#[doc(alias = "?")]
macro_rules! try {
macro_rules! r#try {
($expr:expr) => (match $expr {
$crate::result::Result::Ok(val) => val,
$crate::result::Result::Err(err) => {
return $crate::result::Result::Err($crate::convert::From::from(err))
}
});
($expr:expr,) => (try!($expr));
($expr:expr,) => (r#try!($expr));
}

/// Write formatted data into a buffer.
Expand Down
1 change: 0 additions & 1 deletion src/librustc/ich/impls_syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,6 @@ fn hash_token<'a, 'gcx, W: StableHasherResult>(
token::Token::DotDot |
token::Token::DotDotDot |
token::Token::DotDotEq |
token::Token::DotEq |
token::Token::Comma |
token::Token::Semi |
token::Token::Colon |
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_incremental/persist/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ pub fn garbage_collect_session_directories(sess: &Session) -> io::Result<()> {
let mut session_directories = FxHashSet::default();
let mut lock_files = FxHashSet::default();

for dir_entry in try!(crate_directory.read_dir()) {
for dir_entry in crate_directory.read_dir()? {
let dir_entry = match dir_entry {
Ok(dir_entry) => dir_entry,
_ => {
Expand Down Expand Up @@ -887,7 +887,7 @@ fn all_except_most_recent(deletion_candidates: Vec<(SystemTime, PathBuf, Option<
/// into the '\\?\' format, which supports much longer paths.
fn safe_remove_dir_all(p: &Path) -> io::Result<()> {
if p.exists() {
let canonicalized = try!(p.canonicalize());
let canonicalized = p.canonicalize()?;
std_fs::remove_dir_all(canonicalized)
} else {
Ok(())
Expand All @@ -896,7 +896,7 @@ fn safe_remove_dir_all(p: &Path) -> io::Result<()> {

fn safe_remove_file(p: &Path) -> io::Result<()> {
if p.exists() {
let canonicalized = try!(p.canonicalize());
let canonicalized = p.canonicalize()?;
std_fs::remove_file(canonicalized)
} else {
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/dataflow/move_paths/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ impl<'b, 'a, 'gcx, 'tcx> Gatherer<'b, 'a, 'gcx, 'tcx> {
proj: &PlaceProjection<'tcx>)
-> Result<MovePathIndex, MoveError<'tcx>>
{
let base = try!(self.move_path_for(&proj.base));
let base = self.move_path_for(&proj.base)?;
let mir = self.builder.mir;
let tcx = self.builder.tcx;
let place_ty = proj.base.ty(mir, tcx).to_ty(tcx);
Expand Down
20 changes: 4 additions & 16 deletions src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2373,13 +2373,9 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
self.with_current_self_item(item, |this| {
this.with_type_parameter_rib(HasTypeParameters(generics, ItemRibKind), |this| {
let item_def_id = this.definitions.local_def_id(item.id);
if this.session.features_untracked().self_in_typedefs {
this.with_self_rib(Def::SelfTy(None, Some(item_def_id)), |this| {
visit::walk_item(this, item);
});
} else {
this.with_self_rib(Def::SelfTy(None, Some(item_def_id)), |this| {
visit::walk_item(this, item);
}
});
});
});
}
Expand Down Expand Up @@ -3185,16 +3181,8 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
if is_self_type(path, ns) {
__diagnostic_used!(E0411);
err.code(DiagnosticId::Error("E0411".into()));
let available_in = if this.session.features_untracked().self_in_typedefs {
"impls, traits, and type definitions"
} else {
"traits and impls"
};
err.span_label(span, format!("`Self` is only available in {}", available_in));
if this.current_self_item.is_some() && nightly_options::is_nightly_build() {
err.help("add #![feature(self_in_typedefs)] to the crate attributes \
to enable");
}
err.span_label(span, format!("`Self` is only available in impls, traits, \
and type definitions"));
return (err, Vec::new());
}
if is_self_value(path, ns) {
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_target/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,7 @@ impl Target {

key!(is_builtin, bool);
key!(linker, optional);
try!(key!(lld_flavor, LldFlavor));
key!(lld_flavor, LldFlavor)?;
key!(pre_link_args, link_args);
key!(pre_link_args_crt, link_args);
key!(pre_link_objects_exe, list);
Expand Down Expand Up @@ -1038,7 +1038,7 @@ impl Target {
key!(no_default_libraries, bool);
key!(position_independent_executables, bool);
key!(needs_plt, bool);
try!(key!(relro_level, RelroLevel));
key!(relro_level, RelroLevel)?;
key!(archive_format);
key!(allow_asm, bool);
key!(custom_unwind_resume, bool);
Expand All @@ -1048,7 +1048,7 @@ impl Target {
key!(max_atomic_width, Option<u64>);
key!(min_atomic_width, Option<u64>);
key!(atomic_cas, bool);
try!(key!(panic_strategy, PanicStrategy));
key!(panic_strategy, PanicStrategy)?;
key!(crt_static_allows_dylibs, bool);
key!(crt_static_default, bool);
key!(crt_static_respected, bool);
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/highlight.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ impl<'a> Classifier<'a> {
token::Lifetime(..) => Class::Lifetime,

token::Eof | token::Interpolated(..) |
token::Tilde | token::At | token::DotEq | token::SingleQuote => Class::None,
token::Tilde | token::At| token::SingleQuote => Class::None,
};

// Anything that didn't return above is the simple case where we the
Expand Down
Loading