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 12 pull requests #68034

Merged
merged 35 commits into from
Jan 9, 2020
Merged
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
097e14d
Treat extern statics just like statics in the "const pointer to stati…
oli-obk Dec 26, 2019
3458aba
Fix incremental builds of core by allowing unused attribute.
anp Jan 5, 2020
0a6cdc2
slice patterns: harden match-based borrowck tests
Centril Jan 7, 2020
f720469
Use matches macro in libcore and libstd
popzxc Jan 7, 2020
c524f3c
Display more informative ICE
JohnTitor Jan 7, 2020
326994d
Improve E0184 explanation
GuillaumeGomez Jan 8, 2020
c9a55fe
Spell check librustc_error_codes
wcampbell0x2a Jan 8, 2020
ac3d4cc
Explain that associated types and consts can't be accessed directly o…
estebank Dec 31, 2019
b3b206f
move code to method outside of happy path
estebank Jan 8, 2020
41a93cb
Remove `-Z continue-parse-after-error`
petrochenkov Jan 8, 2020
bcb98bd
canonicalize imports in map::block
Centril Jan 7, 2020
adaa521
collector: extract upstream_crates
Centril Jan 7, 2020
3eb83f2
collector: use impl Trait
Centril Jan 7, 2020
41453d2
collector: clarify dependencies
Centril Jan 7, 2020
3f13ba8
hir::map: elide & simplify
Centril Jan 7, 2020
4b08c7e
NestedVisitorMap: reduce visibilities
Centril Jan 7, 2020
62e9ccb
intravisit: .expect_item -> .item
Centril Jan 7, 2020
8351667
intravisit: abstract over HIR Map
Centril Jan 7, 2020
37d76dc
{rustc::hir -> rustc_hir}::intravisit
Centril Jan 7, 2020
922f8b7
intravisit: use walk_list! more
Centril Jan 7, 2020
0997388
normalize rustc::hir::intravisit imports
Centril Jan 7, 2020
74ea108
Small improvements in lexical_region_resolve
llogiq Jan 8, 2020
7de174b
Fix Typo on cannot "substract"
FSciammarella Jan 8, 2020
60bef14
Rollup merge of #67630 - oli-obk:extern_ptr_dangling, r=spastorino
Centril Jan 8, 2020
1a0b2a5
Rollup merge of #67747 - estebank:bare-assoc-const, r=Centril
Centril Jan 8, 2020
11f0013
Rollup merge of #67884 - anp:allow-unused-const-attr, r=oli-obk
Centril Jan 8, 2020
5ea6978
Rollup merge of #67966 - popzxc:core-std-matches, r=Centril
Centril Jan 8, 2020
0b3ef24
Rollup merge of #67979 - Centril:hir-cleanup, r=Zoxc
Centril Jan 8, 2020
ea9a03d
Rollup merge of #67986 - JohnTitor:fix-ice-rust-call, r=varkor
Centril Jan 8, 2020
916a7d3
Rollup merge of #67990 - Centril:slice-pats-move-tests-match, r=matth…
Centril Jan 8, 2020
91d5fba
Rollup merge of #68005 - GuillaumeGomez:explanation-e0184, r=Dylan-DPC
Centril Jan 8, 2020
1355fb5
Rollup merge of #68009 - wcampbell0x2a:spellcheck-librustc_error_code…
Centril Jan 8, 2020
d2922e5
Rollup merge of #68023 - FSciammarella:master, r=Centril,varkor
Centril Jan 8, 2020
5e6eeb0
Rollup merge of #68024 - petrochenkov:recoverall, r=Centril
Centril Jan 8, 2020
b24de8f
Rollup merge of #68026 - llogiq:ch-ch-ch-ch-changes, r=varkor
Centril Jan 8, 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
20 changes: 4 additions & 16 deletions src/libcore/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -821,10 +821,7 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
fn lt(&self, other: &Rhs) -> bool {
match self.partial_cmp(other) {
Some(Less) => true,
_ => false,
}
matches!(self.partial_cmp(other), Some(Less))
}

/// This method tests less than or equal to (for `self` and `other`) and is used by the `<=`
Expand All @@ -843,10 +840,7 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
fn le(&self, other: &Rhs) -> bool {
match self.partial_cmp(other) {
Some(Less) | Some(Equal) => true,
_ => false,
}
matches!(self.partial_cmp(other), Some(Less) | Some(Equal))
}

/// This method tests greater than (for `self` and `other`) and is used by the `>` operator.
Expand All @@ -864,10 +858,7 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
fn gt(&self, other: &Rhs) -> bool {
match self.partial_cmp(other) {
Some(Greater) => true,
_ => false,
}
matches!(self.partial_cmp(other), Some(Greater))
}

/// This method tests greater than or equal to (for `self` and `other`) and is used by the `>=`
Expand All @@ -886,10 +877,7 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
fn ge(&self, other: &Rhs) -> bool {
match self.partial_cmp(other) {
Some(Greater) | Some(Equal) => true,
_ => false,
}
matches!(self.partial_cmp(other), Some(Greater) | Some(Equal))
}
}

Expand Down
10 changes: 2 additions & 8 deletions src/libcore/iter/traits/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2968,10 +2968,7 @@ pub trait Iterator {
Self::Item: PartialOrd<I::Item>,
Self: Sized,
{
match self.partial_cmp(other) {
Some(Ordering::Less) | Some(Ordering::Equal) => true,
_ => false,
}
matches!(self.partial_cmp(other), Some(Ordering::Less) | Some(Ordering::Equal))
}

/// Determines if the elements of this `Iterator` are lexicographically
Expand Down Expand Up @@ -3011,10 +3008,7 @@ pub trait Iterator {
Self::Item: PartialOrd<I::Item>,
Self: Sized,
{
match self.partial_cmp(other) {
Some(Ordering::Greater) | Some(Ordering::Equal) => true,
_ => false,
}
matches!(self.partial_cmp(other), Some(Ordering::Greater) | Some(Ordering::Equal))
}

/// Checks if the elements of this iterator are sorted.
Expand Down
53 changes: 13 additions & 40 deletions src/libcore/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1416,6 +1416,7 @@ $EndFeature, "
```"),
#[stable(feature = "no_panic_abs", since = "1.13.0")]
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
#[allow(unused_attributes)]
#[allow_internal_unstable(const_if_match)]
#[inline]
pub const fn wrapping_abs(self) -> Self {
Expand Down Expand Up @@ -1709,6 +1710,7 @@ assert_eq!(", stringify!($SelfT), "::MIN.overflowing_neg(), (", stringify!($Self
#[inline]
#[stable(feature = "wrapping", since = "1.7.0")]
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
#[allow(unused_attributes)]
#[allow_internal_unstable(const_if_match)]
pub const fn overflowing_neg(self) -> (Self, bool) {
if self == Self::min_value() {
Expand Down Expand Up @@ -1997,6 +1999,7 @@ $EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
#[allow(unused_attributes)]
#[allow_internal_unstable(const_if_match)]
#[inline]
#[rustc_inherit_overflow_checks]
Expand Down Expand Up @@ -4283,10 +4286,7 @@ impl u8 {
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
#[inline]
pub fn is_ascii_alphabetic(&self) -> bool {
match *self {
b'A'..=b'Z' | b'a'..=b'z' => true,
_ => false,
}
matches!(*self, b'A'..=b'Z' | b'a'..=b'z')
}

/// Checks if the value is an ASCII uppercase character:
Expand Down Expand Up @@ -4318,10 +4318,7 @@ impl u8 {
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
#[inline]
pub fn is_ascii_uppercase(&self) -> bool {
match *self {
b'A'..=b'Z' => true,
_ => false,
}
matches!(*self, b'A'..=b'Z')
}

/// Checks if the value is an ASCII lowercase character:
Expand Down Expand Up @@ -4353,10 +4350,7 @@ impl u8 {
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
#[inline]
pub fn is_ascii_lowercase(&self) -> bool {
match *self {
b'a'..=b'z' => true,
_ => false,
}
matches!(*self, b'a'..=b'z')
}

/// Checks if the value is an ASCII alphanumeric character:
Expand Down Expand Up @@ -4391,10 +4385,7 @@ impl u8 {
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
#[inline]
pub fn is_ascii_alphanumeric(&self) -> bool {
match *self {
b'0'..=b'9' | b'A'..=b'Z' | b'a'..=b'z' => true,
_ => false,
}
matches!(*self, b'0'..=b'9' | b'A'..=b'Z' | b'a'..=b'z')
}

/// Checks if the value is an ASCII decimal digit:
Expand Down Expand Up @@ -4426,10 +4417,7 @@ impl u8 {
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
#[inline]
pub fn is_ascii_digit(&self) -> bool {
match *self {
b'0'..=b'9' => true,
_ => false,
}
matches!(*self, b'0'..=b'9')
}

/// Checks if the value is an ASCII hexadecimal digit:
Expand Down Expand Up @@ -4464,10 +4452,7 @@ impl u8 {
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
#[inline]
pub fn is_ascii_hexdigit(&self) -> bool {
match *self {
b'0'..=b'9' | b'A'..=b'F' | b'a'..=b'f' => true,
_ => false,
}
matches!(*self, b'0'..=b'9' | b'A'..=b'F' | b'a'..=b'f')
}

/// Checks if the value is an ASCII punctuation character:
Expand Down Expand Up @@ -4503,10 +4488,7 @@ impl u8 {
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
#[inline]
pub fn is_ascii_punctuation(&self) -> bool {
match *self {
b'!'..=b'/' | b':'..=b'@' | b'['..=b'`' | b'{'..=b'~' => true,
_ => false,
}
matches!(*self, b'!'..=b'/' | b':'..=b'@' | b'['..=b'`' | b'{'..=b'~')
}

/// Checks if the value is an ASCII graphic character:
Expand Down Expand Up @@ -4538,10 +4520,7 @@ impl u8 {
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
#[inline]
pub fn is_ascii_graphic(&self) -> bool {
match *self {
b'!'..=b'~' => true,
_ => false,
}
matches!(*self, b'!'..=b'~')
}

/// Checks if the value is an ASCII whitespace character:
Expand Down Expand Up @@ -4590,10 +4569,7 @@ impl u8 {
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
#[inline]
pub fn is_ascii_whitespace(&self) -> bool {
match *self {
b'\t' | b'\n' | b'\x0C' | b'\r' | b' ' => true,
_ => false,
}
matches!(*self, b'\t' | b'\n' | b'\x0C' | b'\r' | b' ')
}

/// Checks if the value is an ASCII control character:
Expand Down Expand Up @@ -4627,10 +4603,7 @@ impl u8 {
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
#[inline]
pub fn is_ascii_control(&self) -> bool {
match *self {
b'\0'..=b'\x1F' | b'\x7F' => true,
_ => false,
}
matches!(*self, b'\0'..=b'\x1F' | b'\x7F')
}
}

Expand Down
5 changes: 1 addition & 4 deletions src/libcore/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,7 @@ impl<T> Option<T> {
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn is_some(&self) -> bool {
match *self {
Some(_) => true,
None => false,
}
matches!(*self, Some(_))
}

/// Returns `true` if the option is a [`None`] value.
Expand Down
5 changes: 1 addition & 4 deletions src/libcore/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,7 @@ impl<T, E> Result<T, E> {
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
pub const fn is_ok(&self) -> bool {
match *self {
Ok(_) => true,
Err(_) => false,
}
matches!(*self, Ok(_))
}

/// Returns `true` if the result is [`Err`].
Expand Down
10 changes: 2 additions & 8 deletions src/libcore/str/pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@ pub trait Pattern<'a>: Sized {
/// Checks whether the pattern matches at the front of the haystack
#[inline]
fn is_prefix_of(self, haystack: &'a str) -> bool {
match self.into_searcher(haystack).next() {
SearchStep::Match(0, _) => true,
_ => false,
}
matches!(self.into_searcher(haystack).next(), SearchStep::Match(0, _))
}

/// Checks whether the pattern matches at the back of the haystack
Expand All @@ -58,10 +55,7 @@ pub trait Pattern<'a>: Sized {
where
Self::Searcher: ReverseSearcher<'a>,
{
match self.into_searcher(haystack).next_back() {
SearchStep::Match(_, j) if haystack.len() == j => true,
_ => false,
}
matches!(self.into_searcher(haystack).next_back(), SearchStep::Match(_, j) if haystack.len() == j)
}
}

Expand Down
5 changes: 1 addition & 4 deletions src/libcore/task/poll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@ impl<T> Poll<T> {
#[inline]
#[stable(feature = "futures_api", since = "1.36.0")]
pub fn is_ready(&self) -> bool {
match *self {
Poll::Ready(_) => true,
Poll::Pending => false,
}
matches!(*self, Poll::Ready(_))
}

/// Returns `true` if this is `Poll::Pending`
Expand Down
7 changes: 5 additions & 2 deletions src/librustc/hir/check_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! conflicts between multiple such attributes attached to the same
//! item.

use crate::hir::intravisit::{self, NestedVisitorMap, Visitor};
use crate::hir::map::Map;
use crate::lint::builtin::UNUSED_ATTRIBUTES;
use crate::ty::query::Providers;
use crate::ty::TyCtxt;
Expand All @@ -13,6 +13,7 @@ use errors::struct_span_err;
use rustc_error_codes::*;
use rustc_hir as hir;
use rustc_hir::def_id::DefId;
use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
use rustc_hir::DUMMY_HIR_ID;
use rustc_hir::{self, HirId, Item, ItemKind, TraitItem, TraitItemKind};
use rustc_span::symbol::sym;
Expand Down Expand Up @@ -519,7 +520,9 @@ impl CheckAttrVisitor<'tcx> {
}

impl Visitor<'tcx> for CheckAttrVisitor<'tcx> {
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
type Map = Map<'tcx>;

fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, Self::Map> {
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
}

Expand Down
Loading