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 8 pull requests #67853

Merged
merged 25 commits into from
Jan 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
368ac73
no longer promote non-pattern const functions
RalfJung Dec 22, 2019
8d189ed
Suggest calling method when first argument is `self`
VirrageS Nov 30, 2019
8e5b2c8
Add more detailed suggestion
VirrageS Dec 9, 2019
0918539
Add arguments to suggestion method call
VirrageS Dec 21, 2019
7353afd
Extend suggestion span to whole method call
VirrageS Dec 22, 2019
2168c0b
Extract checking for self arg to separate method
VirrageS Dec 23, 2019
7b91ef8
Simplify match expr
VirrageS Dec 23, 2019
cfab634
Add a test for #37333
michalt Jan 1, 2020
23f5431
Cleanup linkchecker whitelist
ollie27 Jan 1, 2020
75e4783
Normalize `syntax::source_map` imports.
Centril Jan 1, 2020
4ff12ce
Normalize `syntax::symbol` imports.
Centril Jan 1, 2020
b1aad76
Normalize `syntax::edition` imports.
Centril Jan 1, 2020
bebdb44
syntax::map_in_place: leave fixme
Centril Jan 1, 2020
6e4ea14
fix src/test fallout
Centril Jan 1, 2020
485e98a
Implement uncommon_codepoints lint.
crlf0710 Jan 2, 2020
7fd014d
tweak wording of mismatched delimiter errors
euclio Jan 3, 2020
ae002c1
Also remove const-hack for abs
jumbatm Jan 3, 2020
a436293
Rollup merge of #66913 - VirrageS:help-self, r=varkor,Centril
Centril Jan 4, 2020
85277ff
Rollup merge of #67531 - RalfJung:tame-promotion, r=nikomatsakis
Centril Jan 4, 2020
93ff897
Rollup merge of #67773 - michalt:issue-37333-test, r=nikomatsakis
Centril Jan 4, 2020
814e3af
Rollup merge of #67786 - Centril:canon-span, r=petrochenkov
Centril Jan 4, 2020
e72a214
Rollup merge of #67789 - ollie27:linkchecker_whitelist, r=nikomatsakis
Centril Jan 4, 2020
b32dc91
Rollup merge of #67810 - crlf0710:uncommon_codepoints_lint, r=Manishe…
Centril Jan 4, 2020
689e29f
Rollup merge of #67835 - euclio:delimiter-wording, r=Centril
Centril Jan 4, 2020
745f771
Rollup merge of #67845 - jumbatm:also-unconst-hack-abs, r=oli-obk
Centril Jan 4, 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
16 changes: 16 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3642,6 +3642,7 @@ dependencies = [
"rustc_span",
"rustc_target",
"syntax",
"unicode-security",
]

[[package]]
Expand Down Expand Up @@ -4940,6 +4941,21 @@ dependencies = [
"smallvec 1.0.0",
]

[[package]]
name = "unicode-script"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b2c5c29e805da6817f5af6a627d65adb045cebf05cccd5a3493d6109454391c"

[[package]]
name = "unicode-security"
version = "0.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c49d35967fa037b881acc34ef717c38c4b5560eba10e3685271b3f530bb19634"
dependencies = [
"unicode-script",
]

[[package]]
name = "unicode-segmentation"
version = "1.6.0"
Expand Down
24 changes: 6 additions & 18 deletions src/libcore/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1997,27 +1997,15 @@ $EndFeature, "
```"),
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
#[allow_internal_unstable(const_if_match)]
#[inline]
#[rustc_inherit_overflow_checks]
pub const fn abs(self) -> Self {
// Note that the #[inline] above means that the overflow
// semantics of the subtraction depend on the crate we're being
// inlined into.

// sign is -1 (all ones) for negative numbers, 0 otherwise.
let sign = self >> ($BITS - 1);
// For positive self, sign == 0 so the expression is simply
// (self ^ 0) - 0 == self == abs(self).
//
// For negative self, self ^ sign == self ^ all_ones.
// But all_ones ^ self == all_ones - self == -1 - self.
// So for negative numbers, (self ^ sign) - sign is
// (-1 - self) - -1 == -self == abs(self).
//
// The subtraction overflows when self is min_value(), because
// (-1 - min_value()) - -1 is max_value() - -1 which overflows.
// This is exactly when we want self.abs() to overflow.
(self ^ sign) - sign
if self.is_negative() {
-self
} else {
self
}
}
}

Expand Down
3 changes: 0 additions & 3 deletions src/libcore/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ impl Duration {
/// ```
#[stable(feature = "duration", since = "1.3.0")]
#[inline]
#[rustc_promotable]
#[rustc_const_stable(feature = "duration_consts", since = "1.32.0")]
pub const fn from_millis(millis: u64) -> Duration {
Duration {
Expand All @@ -195,7 +194,6 @@ impl Duration {
/// ```
#[stable(feature = "duration_from_micros", since = "1.27.0")]
#[inline]
#[rustc_promotable]
#[rustc_const_stable(feature = "duration_consts", since = "1.32.0")]
pub const fn from_micros(micros: u64) -> Duration {
Duration {
Expand All @@ -218,7 +216,6 @@ impl Duration {
/// ```
#[stable(feature = "duration_extras", since = "1.27.0")]
#[inline]
#[rustc_promotable]
#[rustc_const_stable(feature = "duration_consts", since = "1.32.0")]
pub const fn from_nanos(nanos: u64) -> Duration {
Duration {
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/arena.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ macro_rules! arena_types {
>
>,
[few] diagnostic_items: rustc_data_structures::fx::FxHashMap<
syntax::symbol::Symbol,
rustc_span::symbol::Symbol,
rustc::hir::def_id::DefId,
>,
[few] resolve_lifetimes: rustc::middle::resolve_lifetime::ResolveLifetimes,
Expand All @@ -105,7 +105,7 @@ macro_rules! arena_types {
[few] privacy_access_levels: rustc::middle::privacy::AccessLevels,
[few] target_features_whitelist: rustc_data_structures::fx::FxHashMap<
String,
Option<syntax::symbol::Symbol>
Option<rustc_span::symbol::Symbol>
>,
[few] wasm_import_module_map: rustc_data_structures::fx::FxHashMap<
rustc::hir::def_id::DefId,
Expand Down
7 changes: 4 additions & 3 deletions src/librustc/hir/check_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ use crate::lint::builtin::UNUSED_ATTRIBUTES;
use crate::ty::query::Providers;
use crate::ty::TyCtxt;

use rustc_error_codes::*;
use rustc_span::symbol::sym;
use rustc_span::Span;
use std::fmt::{self, Display};
use syntax::{attr, symbol::sym};
use syntax::attr;

use rustc_error_codes::*;
use std::fmt::{self, Display};

#[derive(Copy, Clone, PartialEq)]
pub(crate) enum MethodKind {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/hir/map/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ use crate::session::Session;
use crate::util::nodemap::FxHashMap;
use rustc_data_structures::svh::Svh;
use rustc_index::vec::IndexVec;
use rustc_span::source_map::SourceMap;
use rustc_span::Span;
use std::iter::repeat;
use syntax::ast::NodeId;
use syntax::source_map::SourceMap;

use crate::ich::StableHashingContext;
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/hir/map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ use crate::util::nodemap::FxHashMap;
use rustc_data_structures::svh::Svh;
use rustc_index::vec::IndexVec;
use rustc_span::hygiene::MacroKind;
use rustc_span::source_map::Spanned;
use rustc_span::{Span, DUMMY_SP};
use rustc_target::spec::abi::Abi;
use syntax::ast::{self, Name, NodeId};
use syntax::source_map::Spanned;

pub mod blocks;
mod collector;
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/hir/print.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use rustc_span::source_map::{SourceMap, Spanned};
use rustc_span::symbol::kw;
use rustc_span::{self, BytePos, FileName};
use rustc_target::spec::abi::Abi;
use syntax::ast;
use syntax::print::pp::Breaks::{Consistent, Inconsistent};
use syntax::print::pp::{self, Breaks};
use syntax::print::pprust::{self, Comments, PrintState};
use syntax::sess::ParseSess;
use syntax::source_map::{SourceMap, Spanned};
use syntax::symbol::kw;
use syntax::util::parser::{self, AssocOp, Fixity};

use crate::hir;
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/ich/hcx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ use crate::ty::{fast_reject, TyCtxt};

use std::cmp::Ord;

use rustc_span::source_map::SourceMap;
use rustc_span::symbol::Symbol;
use rustc_span::{BytePos, SourceFile};
use syntax::ast;
use syntax::source_map::SourceMap;
use syntax::symbol::Symbol;

use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey};
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ich/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ pub use self::hcx::{
hash_stable_trait_impls, NodeIdHashingMode, StableHashingContext, StableHashingContextProvider,
};
crate use rustc_data_structures::fingerprint::Fingerprint;
use rustc_span::symbol::{sym, Symbol};
pub use rustc_span::CachingSourceMapView;
use syntax::symbol::{sym, Symbol};

mod hcx;

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/infer/canonical/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ use crate::ty::{self, BoundVar, List, Region, TyCtxt};
use rustc_index::vec::IndexVec;
use rustc_macros::HashStable;
use rustc_serialize::UseSpecializedDecodable;
use rustc_span::source_map::Span;
use smallvec::SmallVec;
use std::ops::Index;
use syntax::source_map::Span;

mod canonicalizer;

Expand Down
4 changes: 2 additions & 2 deletions src/librustc/infer/error_reporting/need_type_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ use crate::infer::InferCtxt;
use crate::ty::print::Print;
use crate::ty::{self, DefIdTree, Infer, Ty, TyVar};
use errors::{Applicability, DiagnosticBuilder};
use rustc_span::source_map::DesugaringKind;
use rustc_span::symbol::kw;
use rustc_span::Span;
use std::borrow::Cow;
use syntax::source_map::DesugaringKind;
use syntax::symbol::kw;

use rustc_error_codes::*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::infer::InferCtxt;
use crate::ty::{self, TyCtxt};
use crate::util::common::ErrorReported;
use errors::DiagnosticBuilder;
use syntax::source_map::Span;
use rustc_span::source_map::Span;

mod different_lifetimes;
mod find_anon_type;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/infer/type_variable.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::hir::def_id::DefId;
use crate::ty::{self, Ty, TyVid};
use rustc_span::symbol::Symbol;
use rustc_span::Span;
use syntax::symbol::Symbol;

use rustc_data_structures::snapshot_vec as sv;
use rustc_data_structures::unify as ut;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/infer/unify_key.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::ty::{self, FloatVarValue, InferConst, IntVarValue, Ty, TyCtxt};
use rustc_data_structures::unify::InPlace;
use rustc_data_structures::unify::{EqUnifyValue, NoError, UnificationTable, UnifyKey, UnifyValue};
use rustc_span::symbol::Symbol;
use rustc_span::{Span, DUMMY_SP};
use syntax::symbol::Symbol;

use std::cell::RefMut;
use std::cmp;
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/lint/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ use crate::middle::stability;
use crate::session::Session;
use errors::{pluralize, Applicability, DiagnosticBuilder};
use rustc_session::declare_lint;
use rustc_span::edition::Edition;
use rustc_span::source_map::Span;
use rustc_span::symbol::Symbol;
use syntax::ast;
use syntax::early_buffered_lints::{ILL_FORMED_ATTRIBUTE_INPUT, META_VARIABLE_MISUSE};
use syntax::edition::Edition;
use syntax::source_map::Span;
use syntax::symbol::Symbol;

declare_lint! {
pub EXCEEDING_BITSHIFTS,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/lint/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use crate::lint::{
use errors::Applicability;
use rustc_data_structures::fx::FxHashMap;
use rustc_session::declare_tool_lint;
use rustc_span::symbol::{sym, Symbol};
use syntax::ast::{Ident, Item, ItemKind};
use syntax::symbol::{sym, Symbol};

declare_tool_lint! {
pub rustc::DEFAULT_HASH_TYPES,
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/lint/levels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ use crate::session::Session;
use crate::util::nodemap::FxHashMap;
use errors::{Applicability, DiagnosticBuilder};
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use rustc_span::source_map::MultiSpan;
use rustc_span::symbol::{sym, Symbol};
use syntax::ast;
use syntax::attr;
use syntax::feature_gate;
use syntax::print::pprust;
use syntax::source_map::MultiSpan;
use syntax::symbol::{sym, Symbol};

use rustc_error_codes::*;

Expand Down
4 changes: 2 additions & 2 deletions src/librustc/lint/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ use crate::ty::TyCtxt;
use crate::util::nodemap::NodeMap;
use errors::{DiagnosticBuilder, DiagnosticId};
use rustc_span::hygiene::MacroKind;
use rustc_span::source_map::{DesugaringKind, ExpnKind, MultiSpan};
use rustc_span::symbol::Symbol;
use rustc_span::Span;
use syntax::ast;
use syntax::source_map::{DesugaringKind, ExpnKind, MultiSpan};
use syntax::symbol::Symbol;

pub use crate::lint::context::{
check_ast_crate, check_crate, late_lint_mod, BufferedEarlyLint, CheckLintNameResult,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/cstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ use rustc_data_structures::svh::Svh;

use rustc_data_structures::sync::{self, MetadataRef};
use rustc_macros::HashStable;
use rustc_span::symbol::Symbol;
use rustc_span::Span;
use rustc_target::spec::Target;
use std::any::Any;
use std::path::{Path, PathBuf};
use syntax::ast;
use syntax::expand::allocator::AllocatorKind;
use syntax::symbol::Symbol;

pub use self::NativeLibraryKind::*;
pub use rustc_session::utils::NativeLibraryKind;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/lang_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ use crate::util::nodemap::FxHashMap;
use crate::hir;
use crate::hir::itemlikevisit::ItemLikeVisitor;
use rustc_macros::HashStable;
use rustc_span::symbol::{sym, Symbol};
use rustc_span::Span;
use syntax::ast;
use syntax::symbol::{sym, Symbol};

use rustc_error_codes::*;

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pub mod free_region;
pub mod lang_items;
pub mod lib_features {
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use syntax::symbol::Symbol;
use rustc_span::symbol::Symbol;

#[derive(HashStable)]
pub struct LibFeatures {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/recursion_limit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
// just peeks and looks for that attribute.

use crate::session::Session;
use rustc_span::symbol::{sym, Symbol};
use syntax::ast;
use syntax::symbol::{sym, Symbol};

use rustc_data_structures::sync::Once;

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ use crate::ty::{self, TyCtxt};
use crate::util::nodemap::{FxHashMap, FxHashSet};
use errors::DiagnosticBuilder;
use rustc_feature::GateIssue;
use rustc_span::symbol::{sym, Symbol};
use rustc_span::{MultiSpan, Span};
use syntax::ast::CRATE_NODE_ID;
use syntax::attr::{self, ConstStability, Deprecation, RustcDeprecation, Stability};
use syntax::errors::Applicability;
use syntax::feature_gate::feature_err_issue;
use syntax::symbol::{sym, Symbol};

use std::num::NonZeroU32;

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/weak_lang_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ use crate::hir::intravisit;
use crate::hir::intravisit::{NestedVisitorMap, Visitor};
use crate::ty::TyCtxt;
use rustc_data_structures::fx::FxHashSet;
use rustc_span::symbol::{sym, Symbol};
use rustc_span::Span;
use rustc_target::spec::PanicStrategy;
use syntax::ast;
use syntax::symbol::{sym, Symbol};

use rustc_error_codes::*;

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/mir/interpret/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ use backtrace::Backtrace;
use errors::DiagnosticBuilder;
use hir::GeneratorKind;
use rustc_macros::HashStable;
use rustc_span::symbol::Symbol;
use rustc_span::{Pos, Span};
use rustc_target::spec::abi::Abi;
use std::{any::Any, env, fmt};
use syntax::symbol::Symbol;

use rustc_error_codes::*;

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use rustc_index::bit_set::BitMatrix;
use rustc_index::vec::{Idx, IndexVec};
use rustc_macros::HashStable;
use rustc_serialize::{Decodable, Encodable};
use rustc_span::symbol::Symbol;
use rustc_span::{Span, DUMMY_SP};
use smallvec::SmallVec;
use std::borrow::Cow;
Expand All @@ -36,7 +37,6 @@ use std::slice;
use std::{iter, mem, option, u32};
pub use syntax::ast::Mutability;
use syntax::ast::Name;
use syntax::symbol::Symbol;

pub use crate::mir::cache::{BodyAndCache, ReadOnlyBodyAndCache};
pub use crate::mir::interpret::AssertMessage;
Expand Down
Loading