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 10 pull requests #73231

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
72a2d35
fix is_const_context
lcnr May 20, 2020
ecb5933
refactor check_for_cast
lcnr May 20, 2020
6da17d2
`is_const_context` -> `is_inside_const_context`
lcnr May 20, 2020
c183c3f
Clean up E0642 explanation
GuillaumeGomez Jun 4, 2020
2650c5f
doc/rustdoc: Fix incorrect external_doc feature flag
Jun 7, 2020
bd949ed
Check associated opaque types in check_opaque_types
matthewjasper May 10, 2020
627b469
Make pretty printing `TyKind::Def` do something
matthewjasper May 10, 2020
973e572
Stop special casing top level TAIT
matthewjasper May 10, 2020
556fa95
Remove associated opaque types
matthewjasper May 10, 2020
9489d32
Forbid lifetime elision in let position impl Trait
matthewjasper May 10, 2020
aef9b1a
Add more tests for type alias impl Trait
matthewjasper May 10, 2020
10441a2
Remove ImplItemKind::OpaqueTy from clippy
matthewjasper May 10, 2020
4696907
Rename `TyKind::Def` to `OpaqueDef`
matthewjasper Jun 7, 2020
ea998cb
Allow all impl trait types to capture bound lifetimes
matthewjasper Jun 7, 2020
51a6550
Document some opaque types code
matthewjasper Jun 7, 2020
c9f2cbf
Automatically prioritize unsoundness issues
LeSeulArtichaut Jun 9, 2020
fff822f
Migrate to numeric associated consts
tesuji Jun 2, 2020
50a42fe
Create new error code E0762 for unterminated char literals
GuillaumeGomez Jun 10, 2020
7bd87cf
Add tests for E0762
GuillaumeGomez Jun 10, 2020
5859f6e
Fix doctest template
qm3ster Jun 10, 2020
f507748
x.py: with --json-output, forward cargo's JSON
RalfJung Jun 10, 2020
c29b3fa
On recursive ADT, provide indirection structured suggestion
estebank May 29, 2020
7cde07e
review comments: only suggest one substitution
estebank May 31, 2020
03552ec
fix rebase
estebank Jun 10, 2020
7dc19b0
Update src/libcore/num/mod.rs
Amanieu Jun 11, 2020
7328cf5
Rollup merge of #72080 - matthewjasper:uniform-impl-trait, r=nikomats…
RalfJung Jun 11, 2020
a40834a
Rollup merge of #72380 - lcnr:const_context, r=estebank
RalfJung Jun 11, 2020
fdf36ff
Rollup merge of #72740 - estebank:recursive-indirection, r=matthewjasper
RalfJung Jun 11, 2020
fc6f8d4
Rollup merge of #72906 - lzutao:migrate-numeric-assoc-consts, r=dtolnay
RalfJung Jun 11, 2020
63f3721
Rollup merge of #72976 - GuillaumeGomez:cleanup-e0642, r=Dylan-DPC
RalfJung Jun 11, 2020
2d8ef1c
Rollup merge of #73080 - ertos-rs:sean.wilson/devel/external_doc-ref-…
RalfJung Jun 11, 2020
43dbdbc
Rollup merge of #73164 - GuillaumeGomez:add-e0761, r=petrochenkov
RalfJung Jun 11, 2020
fef63df
Rollup merge of #73181 - LeSeulArtichaut:patch-1, r=spastorino
RalfJung Jun 11, 2020
a0c75a6
Rollup merge of #73208 - qm3ster:patch-1, r=Amanieu
RalfJung Jun 11, 2020
ef5de43
Rollup merge of #73219 - RalfJung:cargo-json, r=Mark-Simulacrum
RalfJung Jun 11, 2020
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
8 changes: 7 additions & 1 deletion src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,13 @@ pub fn stream_cargo(
for line in stdout.lines() {
let line = t!(line);
match serde_json::from_str::<CargoMessage<'_>>(&line) {
Ok(msg) => cb(msg),
Ok(msg) => {
if builder.config.json_output {
// Forward JSON to stdout.
println!("{}", line);
}
cb(msg)
}
// If this was informational, just print it out and continue
Err(_) => println!("{}", line),
}
Expand Down
2 changes: 1 addition & 1 deletion src/doc/rustdoc/src/documentation-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ without including it in your main documentation. For example, you could write th
`lib.rs` to test your README as part of your doctests:

```rust,ignore
#![feature(extern_doc)]
#![feature(external_doc)]

#[doc(include="../README.md")]
#[cfg(doctest)]
Expand Down
4 changes: 2 additions & 2 deletions src/liballoc/rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2034,7 +2034,7 @@ trait RcBoxPtr<T: ?Sized> {
// The reference count will never be zero when this is called;
// nevertheless, we insert an abort here to hint LLVM at
// an otherwise missed optimization.
if strong == 0 || strong == usize::max_value() {
if strong == 0 || strong == usize::MAX {
abort();
}
self.inner().strong.set(strong + 1);
Expand All @@ -2058,7 +2058,7 @@ trait RcBoxPtr<T: ?Sized> {
// The reference count will never be zero when this is called;
// nevertheless, we insert an abort here to hint LLVM at
// an otherwise missed optimization.
if weak == 0 || weak == usize::max_value() {
if weak == 0 || weak == usize::MAX {
abort();
}
self.inner().weak.set(weak + 1);
Expand Down
4 changes: 2 additions & 2 deletions src/liballoc/rc/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,14 +407,14 @@ fn test_from_vec() {
fn test_downcast() {
use std::any::Any;

let r1: Rc<dyn Any> = Rc::new(i32::max_value());
let r1: Rc<dyn Any> = Rc::new(i32::MAX);
let r2: Rc<dyn Any> = Rc::new("abc");

assert!(r1.clone().downcast::<u32>().is_err());

let r1i32 = r1.downcast::<i32>();
assert!(r1i32.is_ok());
assert_eq!(r1i32.unwrap(), Rc::new(i32::max_value()));
assert_eq!(r1i32.unwrap(), Rc::new(i32::MAX));

assert!(r2.clone().downcast::<i32>().is_err());

Expand Down
4 changes: 2 additions & 2 deletions src/liballoc/sync/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -465,14 +465,14 @@ fn test_from_vec() {
fn test_downcast() {
use std::any::Any;

let r1: Arc<dyn Any + Send + Sync> = Arc::new(i32::max_value());
let r1: Arc<dyn Any + Send + Sync> = Arc::new(i32::MAX);
let r2: Arc<dyn Any + Send + Sync> = Arc::new("abc");

assert!(r1.clone().downcast::<u32>().is_err());

let r1i32 = r1.downcast::<i32>();
assert!(r1i32.is_ok());
assert_eq!(r1i32.unwrap(), Arc::new(i32::max_value()));
assert_eq!(r1i32.unwrap(), Arc::new(i32::MAX));

assert!(r2.clone().downcast::<i32>().is_err());

Expand Down
4 changes: 2 additions & 2 deletions src/liballoc/tests/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -566,13 +566,13 @@ mod slice_index {
data: "hello";
// note: using 0 specifically ensures that the result of overflowing is 0..0,
// so that `get` doesn't simply return None for the wrong reason.
bad: data[0..=usize::max_value()];
bad: data[0..=usize::MAX];
message: "maximum usize";
}

in mod rangetoinclusive {
data: "hello";
bad: data[..=usize::max_value()];
bad: data[..=usize::MAX];
message: "maximum usize";
}
}
Expand Down
18 changes: 9 additions & 9 deletions src/liballoc/tests/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ fn test_reserve() {

#[test]
fn test_zst_capacity() {
assert_eq!(Vec::<()>::new().capacity(), usize::max_value());
assert_eq!(Vec::<()>::new().capacity(), usize::MAX);
}

#[test]
Expand Down Expand Up @@ -563,19 +563,19 @@ fn test_drain_inclusive_range() {

#[test]
fn test_drain_max_vec_size() {
let mut v = Vec::<()>::with_capacity(usize::max_value());
let mut v = Vec::<()>::with_capacity(usize::MAX);
unsafe {
v.set_len(usize::max_value());
v.set_len(usize::MAX);
}
for _ in v.drain(usize::max_value() - 1..) {}
assert_eq!(v.len(), usize::max_value() - 1);
for _ in v.drain(usize::MAX - 1..) {}
assert_eq!(v.len(), usize::MAX - 1);

let mut v = Vec::<()>::with_capacity(usize::max_value());
let mut v = Vec::<()>::with_capacity(usize::MAX);
unsafe {
v.set_len(usize::max_value());
v.set_len(usize::MAX);
}
for _ in v.drain(usize::max_value() - 1..=usize::max_value() - 1) {}
assert_eq!(v.len(), usize::max_value() - 1);
for _ in v.drain(usize::MAX - 1..=usize::MAX - 1) {}
assert_eq!(v.len(), usize::MAX - 1);
}

#[test]
Expand Down
10 changes: 5 additions & 5 deletions src/libcore/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1163,16 +1163,16 @@ impl<'b> BorrowRef<'b> {
// Incrementing borrow can result in a non-reading value (<= 0) in these cases:
// 1. It was < 0, i.e. there are writing borrows, so we can't allow a read borrow
// due to Rust's reference aliasing rules
// 2. It was isize::max_value() (the max amount of reading borrows) and it overflowed
// into isize::min_value() (the max amount of writing borrows) so we can't allow
// 2. It was isize::MAX (the max amount of reading borrows) and it overflowed
// into isize::MIN (the max amount of writing borrows) so we can't allow
// an additional read borrow because isize can't represent so many read borrows
// (this can only happen if you mem::forget more than a small constant amount of
// `Ref`s, which is not good practice)
None
} else {
// Incrementing borrow can result in a reading value (> 0) in these cases:
// 1. It was = 0, i.e. it wasn't borrowed, and we are taking the first read borrow
// 2. It was > 0 and < isize::max_value(), i.e. there were read borrows, and isize
// 2. It was > 0 and < isize::MAX, i.e. there were read borrows, and isize
// is large enough to represent having one more read borrow
borrow.set(b);
Some(BorrowRef { borrow })
Expand All @@ -1198,7 +1198,7 @@ impl Clone for BorrowRef<'_> {
debug_assert!(is_reading(borrow));
// Prevent the borrow counter from overflowing into
// a writing borrow.
assert!(borrow != isize::max_value());
assert!(borrow != isize::MAX);
self.borrow.set(borrow + 1);
BorrowRef { borrow: self.borrow }
}
Expand Down Expand Up @@ -1489,7 +1489,7 @@ impl<'b> BorrowRefMut<'b> {
let borrow = self.borrow.get();
debug_assert!(is_writing(borrow));
// Prevent the borrow counter from underflowing.
assert!(borrow != isize::min_value());
assert!(borrow != isize::MIN);
self.borrow.set(borrow - 1);
BorrowRefMut { borrow: self.borrow }
}
Expand Down
6 changes: 3 additions & 3 deletions src/libcore/convert/num.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ macro_rules! try_from_upper_bounded {
/// is outside of the range of the target type.
#[inline]
fn try_from(u: $source) -> Result<Self, Self::Error> {
if u > (Self::max_value() as $source) {
if u > (Self::MAX as $source) {
Err(TryFromIntError(()))
} else {
Ok(u as Self)
Expand All @@ -239,8 +239,8 @@ macro_rules! try_from_both_bounded {
/// is outside of the range of the target type.
#[inline]
fn try_from(u: $source) -> Result<Self, Self::Error> {
let min = Self::min_value() as $source;
let max = Self::max_value() as $source;
let min = Self::MIN as $source;
let max = Self::MAX as $source;
if u < min || u > max {
Err(TryFromIntError(()))
} else {
Expand Down
Loading