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 9 pull requests #54969

Merged
merged 24 commits into from
Oct 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
9568ec6
Move conditional configuration related UI tests into their own directory
Havvy Sep 12, 2018
1a867dc
cfg_attr_multi: Basic implementation
Havvy Sep 10, 2018
35e6c65
cfg_attr_multi: Feature gate
Havvy Oct 4, 2018
b7248d5
Fix internal compiler error on malformed match arm pattern.
dsciarra Oct 6, 2018
91b71f5
Identify borrows captured by trait objects.
davidtwco Oct 5, 2018
72911fb
Update logic to search for casts.
davidtwco Oct 5, 2018
bbe832d
cfg-attr-multi: Change issue number to actual tracking issue
Havvy Oct 8, 2018
8c01c22
Stabilize the `Option::replace` method
Kerollmops Oct 8, 2018
c232ea1
Bump the `Option::replace` stabilize version to 1.31.0
Kerollmops Oct 8, 2018
663002f
Pass around interned refs to goals and not goals
scalexm Oct 6, 2018
96ff827
Add chalk rules related to associated type defs
scalexm Oct 8, 2018
282559c
Compute flags for `ty::UnnormalizedProjection`
scalexm Oct 8, 2018
dc2343c
Update feature-gate listing
flip1995 Oct 2, 2018
5e9084c
Remove `feature(tool_lints)` from tests
flip1995 Oct 2, 2018
a249981
Remove feature-gate tests
flip1995 Oct 2, 2018
ac231d4
Remove feature-gate code
flip1995 Oct 2, 2018
6328850
Remove unstable-book documentation
flip1995 Oct 2, 2018
ffe1527
Remove nightly check for tool_lints warning
flip1995 Oct 2, 2018
a267b3a
Rollup merge of #54848 - davidtwco:issue-52663-trait-object, r=nikoma…
Manishearth Oct 10, 2018
8ebc6d6
Rollup merge of #54862 - Havvy:cfg_attr_multi, r=petrochenkov
Manishearth Oct 10, 2018
50e410c
Rollup merge of #54870 - flip1995:stabilize_tool_lints, r=Manishearth
Manishearth Oct 10, 2018
e1e628e
Rollup merge of #54893 - dsciarra:issue-54379, r=pnkfelix
Manishearth Oct 10, 2018
ff3e4d9
Rollup merge of #54904 - Kerollmops:stabilize-option-replace, r=Centril
Manishearth Oct 10, 2018
be64bf3
Rollup merge of #54909 - scalexm:finish-rules, r=nikomatsakis
Manishearth Oct 10, 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
8 changes: 4 additions & 4 deletions src/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "chalk-engine"
version = "0.7.0"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"chalk-macros 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
Expand Down Expand Up @@ -1898,7 +1898,7 @@ dependencies = [
"backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"chalk-engine 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"chalk-engine 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"flate2 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"fmt_macros 0.0.0",
"graphviz 0.0.0",
Expand Down Expand Up @@ -2434,7 +2434,7 @@ name = "rustc_traits"
version = "0.0.0"
dependencies = [
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"chalk-engine 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"chalk-engine 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"graphviz 0.0.0",
"log 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc 0.0.0",
Expand Down Expand Up @@ -3195,7 +3195,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum cargo_metadata 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d6809b327f87369e6f3651efd2c5a96c49847a3ed2559477ecba79014751ee1"
"checksum cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "f159dfd43363c4d08055a07703eb7a3406b0dac4d0584d96965a3262db3c9d16"
"checksum cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0c4e7bb64a8ebb0d856483e1e682ea3422f883c5f5615a90d51a2c82fe87fdd3"
"checksum chalk-engine 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "25ce2f28f55ed544a2a3756b7acf41dd7d6f27acffb2086439950925506af7d0"
"checksum chalk-engine 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6749eb72e7d4355d944a99f15fbaea701b978c18c5e184a025fcde942b0c9779"
"checksum chalk-macros 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "295635afd6853aa9f20baeb7f0204862440c0fe994c5a253d5f479dac41d047e"
"checksum chrono 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6962c635d530328acc53ac6a955e83093fedc91c5809dfac1fa60fa470830a37"
"checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e"
Expand Down
20 changes: 20 additions & 0 deletions src/doc/unstable-book/src/language-features/cfg-attr-multi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# `cfg_attr_multi`

The tracking issue for this feature is: [#54881]
The RFC for this feature is: [#2539]

[#54881]: https://github.com/rust-lang/rust/issues/54881
[#2539]: https://github.com/rust-lang/rfcs/pull/2539

------------------------

This feature flag lets you put multiple attributes into a `cfg_attr` attribute.

Example:

```rust,ignore
#[cfg_attr(all(), must_use, optimize)]
```

Because `cfg_attr` resolves before procedural macros, this does not affect
macro resolution at all.
35 changes: 0 additions & 35 deletions src/doc/unstable-book/src/language-features/tool-lints.md

This file was deleted.

4 changes: 1 addition & 3 deletions src/libcore/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -867,8 +867,6 @@ impl<T> Option<T> {
/// # Examples
///
/// ```
/// #![feature(option_replace)]
///
/// let mut x = Some(2);
/// let old = x.replace(5);
/// assert_eq!(x, Some(5));
Expand All @@ -880,7 +878,7 @@ impl<T> Option<T> {
/// assert_eq!(old, None);
/// ```
#[inline]
#[unstable(feature = "option_replace", issue = "51998")]
#[stable(feature = "option_replace", since = "1.31.0")]
pub fn replace(&mut self, value: T) -> Option<T> {
mem::replace(self, Some(value))
}
Expand Down
1 change: 0 additions & 1 deletion src/libcore/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#![feature(reverse_bits)]
#![feature(inner_deref)]
#![feature(slice_internals)]
#![feature(option_replace)]
#![feature(slice_partition_dedup)]
#![feature(copy_within)]

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ syntax_pos = { path = "../libsyntax_pos" }
backtrace = "0.3.3"
parking_lot = "0.6"
byteorder = { version = "1.1", features = ["i128"]}
chalk-engine = { version = "0.7.0", default-features=false }
chalk-engine = { version = "0.8.0", default-features=false }
rustc_fs_util = { path = "../librustc_fs_util" }
smallvec = { version = "0.6.5", features = ["union"] }

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ich/impls_ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1370,7 +1370,7 @@ impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for traits::Goal<'tcx> {
fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a>,
hasher: &mut StableHasher<W>) {
use traits::Goal::*;
use traits::GoalKind::*;

mem::discriminant(self).hash_stable(hcx, hasher);
match self {
Expand Down
27 changes: 3 additions & 24 deletions src/librustc/lint/levels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ use lint::context::CheckLintNameResult;
use lint::{self, Lint, LintId, Level, LintSource};
use rustc_data_structures::stable_hasher::{HashStable, ToStableHashKey,
StableHasher, StableHasherResult};
use session::{config::nightly_options, Session};
use session::Session;
use syntax::ast;
use syntax::attr;
use syntax::source_map::MultiSpan;
use syntax::feature_gate;
use syntax::symbol::Symbol;
use util::nodemap::FxHashMap;

Expand Down Expand Up @@ -228,28 +227,14 @@ impl<'a> LintLevelsBuilder<'a> {
}
};
let tool_name = if let Some(lint_tool) = word.is_scoped() {
let gate_feature = !self.sess.features_untracked().tool_lints;
let known_tool = attr::is_known_lint_tool(lint_tool);
if gate_feature {
feature_gate::emit_feature_err(
&sess.parse_sess,
"tool_lints",
word.span,
feature_gate::GateIssue::Language,
&format!("scoped lint `{}` is experimental", word.ident),
);
}
if !known_tool {
if !attr::is_known_lint_tool(lint_tool) {
span_err!(
sess,
lint_tool.span,
E0710,
"an unknown tool name found in scoped lint: `{}`",
word.ident
);
}

if gate_feature || !known_tool {
continue;
}

Expand Down Expand Up @@ -299,13 +284,7 @@ impl<'a> LintLevelsBuilder<'a> {
"change it to",
new_lint_name.to_string(),
Applicability::MachineApplicable,
);

if nightly_options::is_nightly_build() {
err.emit();
} else {
err.cancel();
}
).emit();

let src = LintSource::Node(Symbol::intern(&new_lint_name), li.span);
for id in ids {
Expand Down
22 changes: 12 additions & 10 deletions src/librustc/traits/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,31 +318,33 @@ pub enum QuantifierKind {
}

#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
pub enum Goal<'tcx> {
Implies(Clauses<'tcx>, &'tcx Goal<'tcx>),
And(&'tcx Goal<'tcx>, &'tcx Goal<'tcx>),
Not(&'tcx Goal<'tcx>),
pub enum GoalKind<'tcx> {
Implies(Clauses<'tcx>, Goal<'tcx>),
And(Goal<'tcx>, Goal<'tcx>),
Not(Goal<'tcx>),
DomainGoal(DomainGoal<'tcx>),
Quantified(QuantifierKind, ty::Binder<&'tcx Goal<'tcx>>),
Quantified(QuantifierKind, ty::Binder<Goal<'tcx>>),
CannotProve,
}

pub type Goal<'tcx> = &'tcx GoalKind<'tcx>;

pub type Goals<'tcx> = &'tcx List<Goal<'tcx>>;

impl<'tcx> DomainGoal<'tcx> {
pub fn into_goal(self) -> Goal<'tcx> {
Goal::DomainGoal(self)
pub fn into_goal(self) -> GoalKind<'tcx> {
GoalKind::DomainGoal(self)
}
}

impl<'tcx> Goal<'tcx> {
impl<'tcx> GoalKind<'tcx> {
pub fn from_poly_domain_goal<'a>(
domain_goal: PolyDomainGoal<'tcx>,
tcx: TyCtxt<'a, 'tcx, 'tcx>,
) -> Goal<'tcx> {
) -> GoalKind<'tcx> {
match domain_goal.no_late_bound_regions() {
Some(p) => p.into_goal(),
None => Goal::Quantified(
None => GoalKind::Quantified(
QuantifierKind::Universal,
domain_goal.map_bound(|p| tcx.mk_goal(p.into_goal()))
),
Expand Down
34 changes: 17 additions & 17 deletions src/librustc/traits/structural_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ impl fmt::Display for traits::QuantifierKind {

impl<'tcx> fmt::Display for traits::Goal<'tcx> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
use traits::Goal::*;
use traits::GoalKind::*;

match self {
Implies(hypotheses, goal) => {
Expand Down Expand Up @@ -598,25 +598,25 @@ CloneTypeFoldableAndLiftImpls! {
}

EnumTypeFoldableImpl! {
impl<'tcx> TypeFoldable<'tcx> for traits::Goal<'tcx> {
(traits::Goal::Implies)(hypotheses, goal),
(traits::Goal::And)(goal1, goal2),
(traits::Goal::Not)(goal),
(traits::Goal::DomainGoal)(domain_goal),
(traits::Goal::Quantified)(qkind, goal),
(traits::Goal::CannotProve),
impl<'tcx> TypeFoldable<'tcx> for traits::GoalKind<'tcx> {
(traits::GoalKind::Implies)(hypotheses, goal),
(traits::GoalKind::And)(goal1, goal2),
(traits::GoalKind::Not)(goal),
(traits::GoalKind::DomainGoal)(domain_goal),
(traits::GoalKind::Quantified)(qkind, goal),
(traits::GoalKind::CannotProve),
}
}

EnumLiftImpl! {
impl<'a, 'tcx> Lift<'tcx> for traits::Goal<'a> {
type Lifted = traits::Goal<'tcx>;
(traits::Goal::Implies)(hypotheses, goal),
(traits::Goal::And)(goal1, goal2),
(traits::Goal::Not)(goal),
(traits::Goal::DomainGoal)(domain_goal),
(traits::Goal::Quantified)(kind, goal),
(traits::Goal::CannotProve),
impl<'a, 'tcx> Lift<'tcx> for traits::GoalKind<'a> {
type Lifted = traits::GoalKind<'tcx>;
(traits::GoalKind::Implies)(hypotheses, goal),
(traits::GoalKind::And)(goal1, goal2),
(traits::GoalKind::Not)(goal),
(traits::GoalKind::DomainGoal)(domain_goal),
(traits::GoalKind::Quantified)(kind, goal),
(traits::GoalKind::CannotProve),
}
}

Expand All @@ -633,7 +633,7 @@ impl<'tcx> TypeFoldable<'tcx> for &'tcx ty::List<traits::Goal<'tcx>> {
}
}

impl<'tcx> TypeFoldable<'tcx> for &'tcx traits::Goal<'tcx> {
impl<'tcx> TypeFoldable<'tcx> for traits::Goal<'tcx> {
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self {
let v = (**self).fold_with(folder);
folder.tcx().mk_goal(v)
Expand Down
29 changes: 17 additions & 12 deletions src/librustc/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use mir::interpret::Allocation;
use ty::subst::{CanonicalSubsts, Kind, Substs, Subst};
use ty::ReprOptions;
use traits;
use traits::{Clause, Clauses, Goal, Goals};
use traits::{Clause, Clauses, GoalKind, Goal, Goals};
use ty::{self, Ty, TypeAndMut};
use ty::{TyS, TyKind, List};
use ty::{AdtKind, AdtDef, ClosureSubsts, GeneratorSubsts, Region, Const};
Expand Down Expand Up @@ -143,7 +143,8 @@ pub struct CtxtInterners<'tcx> {
predicates: InternedSet<'tcx, List<Predicate<'tcx>>>,
const_: InternedSet<'tcx, Const<'tcx>>,
clauses: InternedSet<'tcx, List<Clause<'tcx>>>,
goals: InternedSet<'tcx, List<Goal<'tcx>>>,
goal: InternedSet<'tcx, GoalKind<'tcx>>,
goal_list: InternedSet<'tcx, List<Goal<'tcx>>>,
}

impl<'gcx: 'tcx, 'tcx> CtxtInterners<'tcx> {
Expand All @@ -159,7 +160,8 @@ impl<'gcx: 'tcx, 'tcx> CtxtInterners<'tcx> {
predicates: Default::default(),
const_: Default::default(),
clauses: Default::default(),
goals: Default::default(),
goal: Default::default(),
goal_list: Default::default(),
}
}

Expand Down Expand Up @@ -1731,9 +1733,9 @@ impl<'a, 'tcx> Lift<'tcx> for Region<'a> {
}
}

impl<'a, 'tcx> Lift<'tcx> for &'a Goal<'a> {
type Lifted = &'tcx Goal<'tcx>;
fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<&'tcx Goal<'tcx>> {
impl<'a, 'tcx> Lift<'tcx> for Goal<'a> {
type Lifted = Goal<'tcx>;
fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<Goal<'tcx>> {
if tcx.interners.arena.in_arena(*self as *const _) {
return Some(unsafe { mem::transmute(*self) });
}
Expand Down Expand Up @@ -2304,6 +2306,12 @@ impl<'tcx> Borrow<RegionKind> for Interned<'tcx, RegionKind> {
}
}

impl<'tcx: 'lcx, 'lcx> Borrow<GoalKind<'lcx>> for Interned<'tcx, GoalKind<'tcx>> {
fn borrow<'a>(&'a self) -> &'a GoalKind<'lcx> {
&self.0
}
}

impl<'tcx: 'lcx, 'lcx> Borrow<[ExistentialPredicate<'lcx>]>
for Interned<'tcx, List<ExistentialPredicate<'tcx>>> {
fn borrow<'a>(&'a self) -> &'a [ExistentialPredicate<'lcx>] {
Expand Down Expand Up @@ -2419,7 +2427,8 @@ pub fn keep_local<'tcx, T: ty::TypeFoldable<'tcx>>(x: &T) -> bool {

direct_interners!('tcx,
region: mk_region(|r: &RegionKind| r.keep_in_local_tcx()) -> RegionKind,
const_: mk_const(|c: &Const<'_>| keep_local(&c.ty) || keep_local(&c.val)) -> Const<'tcx>
const_: mk_const(|c: &Const<'_>| keep_local(&c.ty) || keep_local(&c.val)) -> Const<'tcx>,
goal: mk_goal(|c: &GoalKind<'_>| keep_local(c)) -> GoalKind<'tcx>
);

macro_rules! slice_interners {
Expand All @@ -2438,7 +2447,7 @@ slice_interners!(
type_list: _intern_type_list(Ty),
substs: _intern_substs(Kind),
clauses: _intern_clauses(Clause),
goals: _intern_goals(Goal)
goal_list: _intern_goals(Goal)
);

// This isn't a perfect fit: CanonicalVarInfo slices are always
Expand Down Expand Up @@ -2818,10 +2827,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
iter.intern_with(|xs| self.intern_goals(xs))
}

pub fn mk_goal(self, goal: Goal<'tcx>) -> &'tcx Goal<'_> {
&self.intern_goals(&[goal])[0]
}

pub fn lint_hir<S: Into<MultiSpan>>(self,
lint: &'static Lint,
hir_id: HirId,
Expand Down
5 changes: 4 additions & 1 deletion src/librustc/ty/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,10 @@ impl FlagComputation {
self.add_projection_ty(data);
}

&ty::UnnormalizedProjection(..) => bug!("only used with chalk-engine"),
&ty::UnnormalizedProjection(ref data) => {
self.add_flags(TypeFlags::HAS_PROJECTION);
self.add_projection_ty(data);
},

&ty::Opaque(_, substs) => {
self.add_flags(TypeFlags::HAS_PROJECTION);
Expand Down
Loading