Skip to content

Commit 74f9a11

Browse files
committed
Auto merge of #54969 - Manishearth:rollup, r=Manishearth
Rollup of 9 pull requests Successful merges: - #54747 (codegen_llvm: verify that inline assembly operands are scalars) - #54848 (Better Diagnostic for Trait Object Capture) - #54850 (Fix #54707 - parse_trait_item_ now handles interpolated blocks as function body decls) - #54858 (second round of refactorings for universes) - #54862 (Implement RFC 2539: cfg_attr with multiple attributes) - #54869 (Fix mobile docs) - #54870 (Stabilize tool lints) - #54893 (Fix internal compiler error on malformed match arm pattern.) - #54904 (Stabilize the `Option::replace` method) Failed merges: - #54909 ( Add chalk rules related to associated type defs) r? @ghost
2 parents f42c510 + be64bf3 commit 74f9a11

File tree

75 files changed

+821
-277
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+821
-277
lines changed

src/Cargo.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
270270

271271
[[package]]
272272
name = "chalk-engine"
273-
version = "0.7.0"
273+
version = "0.8.0"
274274
source = "registry+https://github.com/rust-lang/crates.io-index"
275275
dependencies = [
276276
"chalk-macros 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1898,7 +1898,7 @@ dependencies = [
18981898
"backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
18991899
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
19001900
"byteorder 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
1901-
"chalk-engine 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
1901+
"chalk-engine 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
19021902
"flate2 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
19031903
"fmt_macros 0.0.0",
19041904
"graphviz 0.0.0",
@@ -2434,7 +2434,7 @@ name = "rustc_traits"
24342434
version = "0.0.0"
24352435
dependencies = [
24362436
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
2437-
"chalk-engine 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
2437+
"chalk-engine 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
24382438
"graphviz 0.0.0",
24392439
"log 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
24402440
"rustc 0.0.0",
@@ -3195,7 +3195,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
31953195
"checksum cargo_metadata 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d6809b327f87369e6f3651efd2c5a96c49847a3ed2559477ecba79014751ee1"
31963196
"checksum cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "f159dfd43363c4d08055a07703eb7a3406b0dac4d0584d96965a3262db3c9d16"
31973197
"checksum cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0c4e7bb64a8ebb0d856483e1e682ea3422f883c5f5615a90d51a2c82fe87fdd3"
3198-
"checksum chalk-engine 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "25ce2f28f55ed544a2a3756b7acf41dd7d6f27acffb2086439950925506af7d0"
3198+
"checksum chalk-engine 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6749eb72e7d4355d944a99f15fbaea701b978c18c5e184a025fcde942b0c9779"
31993199
"checksum chalk-macros 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "295635afd6853aa9f20baeb7f0204862440c0fe994c5a253d5f479dac41d047e"
32003200
"checksum chrono 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6962c635d530328acc53ac6a955e83093fedc91c5809dfac1fa60fa470830a37"
32013201
"checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# `cfg_attr_multi`
2+
3+
The tracking issue for this feature is: [#54881]
4+
The RFC for this feature is: [#2539]
5+
6+
[#54881]: https://github.com/rust-lang/rust/issues/54881
7+
[#2539]: https://github.com/rust-lang/rfcs/pull/2539
8+
9+
------------------------
10+
11+
This feature flag lets you put multiple attributes into a `cfg_attr` attribute.
12+
13+
Example:
14+
15+
```rust,ignore
16+
#[cfg_attr(all(), must_use, optimize)]
17+
```
18+
19+
Because `cfg_attr` resolves before procedural macros, this does not affect
20+
macro resolution at all.

src/doc/unstable-book/src/language-features/tool-lints.md

-35
This file was deleted.

src/libcore/option.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -867,8 +867,6 @@ impl<T> Option<T> {
867867
/// # Examples
868868
///
869869
/// ```
870-
/// #![feature(option_replace)]
871-
///
872870
/// let mut x = Some(2);
873871
/// let old = x.replace(5);
874872
/// assert_eq!(x, Some(5));
@@ -880,7 +878,7 @@ impl<T> Option<T> {
880878
/// assert_eq!(old, None);
881879
/// ```
882880
#[inline]
883-
#[unstable(feature = "option_replace", issue = "51998")]
881+
#[stable(feature = "option_replace", since = "1.31.0")]
884882
pub fn replace(&mut self, value: T) -> Option<T> {
885883
mem::replace(self, Some(value))
886884
}

src/libcore/tests/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
#![feature(reverse_bits)]
4040
#![feature(inner_deref)]
4141
#![feature(slice_internals)]
42-
#![feature(option_replace)]
4342
#![feature(slice_partition_dedup)]
4443
#![feature(copy_within)]
4544

src/librustc/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ syntax_pos = { path = "../libsyntax_pos" }
3131
backtrace = "0.3.3"
3232
parking_lot = "0.6"
3333
byteorder = { version = "1.1", features = ["i128"]}
34-
chalk-engine = { version = "0.7.0", default-features=false }
34+
chalk-engine = { version = "0.8.0", default-features=false }
3535
rustc_fs_util = { path = "../librustc_fs_util" }
3636
smallvec = { version = "0.6.5", features = ["union"] }
3737

src/librustc/ich/impls_ty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1370,7 +1370,7 @@ impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for traits::Goal<'tcx> {
13701370
fn hash_stable<W: StableHasherResult>(&self,
13711371
hcx: &mut StableHashingContext<'a>,
13721372
hasher: &mut StableHasher<W>) {
1373-
use traits::Goal::*;
1373+
use traits::GoalKind::*;
13741374

13751375
mem::discriminant(self).hash_stable(hcx, hasher);
13761376
match self {

src/librustc/lint/levels.rs

+3-24
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,10 @@ use lint::context::CheckLintNameResult;
1818
use lint::{self, Lint, LintId, Level, LintSource};
1919
use rustc_data_structures::stable_hasher::{HashStable, ToStableHashKey,
2020
StableHasher, StableHasherResult};
21-
use session::{config::nightly_options, Session};
21+
use session::Session;
2222
use syntax::ast;
2323
use syntax::attr;
2424
use syntax::source_map::MultiSpan;
25-
use syntax::feature_gate;
2625
use syntax::symbol::Symbol;
2726
use util::nodemap::FxHashMap;
2827

@@ -228,28 +227,14 @@ impl<'a> LintLevelsBuilder<'a> {
228227
}
229228
};
230229
let tool_name = if let Some(lint_tool) = word.is_scoped() {
231-
let gate_feature = !self.sess.features_untracked().tool_lints;
232-
let known_tool = attr::is_known_lint_tool(lint_tool);
233-
if gate_feature {
234-
feature_gate::emit_feature_err(
235-
&sess.parse_sess,
236-
"tool_lints",
237-
word.span,
238-
feature_gate::GateIssue::Language,
239-
&format!("scoped lint `{}` is experimental", word.ident),
240-
);
241-
}
242-
if !known_tool {
230+
if !attr::is_known_lint_tool(lint_tool) {
243231
span_err!(
244232
sess,
245233
lint_tool.span,
246234
E0710,
247235
"an unknown tool name found in scoped lint: `{}`",
248236
word.ident
249237
);
250-
}
251-
252-
if gate_feature || !known_tool {
253238
continue;
254239
}
255240

@@ -299,13 +284,7 @@ impl<'a> LintLevelsBuilder<'a> {
299284
"change it to",
300285
new_lint_name.to_string(),
301286
Applicability::MachineApplicable,
302-
);
303-
304-
if nightly_options::is_nightly_build() {
305-
err.emit();
306-
} else {
307-
err.cancel();
308-
}
287+
).emit();
309288

310289
let src = LintSource::Node(Symbol::intern(&new_lint_name), li.span);
311290
for id in ids {

src/librustc/traits/mod.rs

+12-10
Original file line numberDiff line numberDiff line change
@@ -318,31 +318,33 @@ pub enum QuantifierKind {
318318
}
319319

320320
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
321-
pub enum Goal<'tcx> {
322-
Implies(Clauses<'tcx>, &'tcx Goal<'tcx>),
323-
And(&'tcx Goal<'tcx>, &'tcx Goal<'tcx>),
324-
Not(&'tcx Goal<'tcx>),
321+
pub enum GoalKind<'tcx> {
322+
Implies(Clauses<'tcx>, Goal<'tcx>),
323+
And(Goal<'tcx>, Goal<'tcx>),
324+
Not(Goal<'tcx>),
325325
DomainGoal(DomainGoal<'tcx>),
326-
Quantified(QuantifierKind, ty::Binder<&'tcx Goal<'tcx>>),
326+
Quantified(QuantifierKind, ty::Binder<Goal<'tcx>>),
327327
CannotProve,
328328
}
329329

330+
pub type Goal<'tcx> = &'tcx GoalKind<'tcx>;
331+
330332
pub type Goals<'tcx> = &'tcx List<Goal<'tcx>>;
331333

332334
impl<'tcx> DomainGoal<'tcx> {
333-
pub fn into_goal(self) -> Goal<'tcx> {
334-
Goal::DomainGoal(self)
335+
pub fn into_goal(self) -> GoalKind<'tcx> {
336+
GoalKind::DomainGoal(self)
335337
}
336338
}
337339

338-
impl<'tcx> Goal<'tcx> {
340+
impl<'tcx> GoalKind<'tcx> {
339341
pub fn from_poly_domain_goal<'a>(
340342
domain_goal: PolyDomainGoal<'tcx>,
341343
tcx: TyCtxt<'a, 'tcx, 'tcx>,
342-
) -> Goal<'tcx> {
344+
) -> GoalKind<'tcx> {
343345
match domain_goal.no_late_bound_regions() {
344346
Some(p) => p.into_goal(),
345-
None => Goal::Quantified(
347+
None => GoalKind::Quantified(
346348
QuantifierKind::Universal,
347349
domain_goal.map_bound(|p| tcx.mk_goal(p.into_goal()))
348350
),

src/librustc/traits/structural_impls.rs

+17-17
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ impl fmt::Display for traits::QuantifierKind {
469469

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

474474
match self {
475475
Implies(hypotheses, goal) => {
@@ -598,25 +598,25 @@ CloneTypeFoldableAndLiftImpls! {
598598
}
599599

600600
EnumTypeFoldableImpl! {
601-
impl<'tcx> TypeFoldable<'tcx> for traits::Goal<'tcx> {
602-
(traits::Goal::Implies)(hypotheses, goal),
603-
(traits::Goal::And)(goal1, goal2),
604-
(traits::Goal::Not)(goal),
605-
(traits::Goal::DomainGoal)(domain_goal),
606-
(traits::Goal::Quantified)(qkind, goal),
607-
(traits::Goal::CannotProve),
601+
impl<'tcx> TypeFoldable<'tcx> for traits::GoalKind<'tcx> {
602+
(traits::GoalKind::Implies)(hypotheses, goal),
603+
(traits::GoalKind::And)(goal1, goal2),
604+
(traits::GoalKind::Not)(goal),
605+
(traits::GoalKind::DomainGoal)(domain_goal),
606+
(traits::GoalKind::Quantified)(qkind, goal),
607+
(traits::GoalKind::CannotProve),
608608
}
609609
}
610610

611611
EnumLiftImpl! {
612-
impl<'a, 'tcx> Lift<'tcx> for traits::Goal<'a> {
613-
type Lifted = traits::Goal<'tcx>;
614-
(traits::Goal::Implies)(hypotheses, goal),
615-
(traits::Goal::And)(goal1, goal2),
616-
(traits::Goal::Not)(goal),
617-
(traits::Goal::DomainGoal)(domain_goal),
618-
(traits::Goal::Quantified)(kind, goal),
619-
(traits::Goal::CannotProve),
612+
impl<'a, 'tcx> Lift<'tcx> for traits::GoalKind<'a> {
613+
type Lifted = traits::GoalKind<'tcx>;
614+
(traits::GoalKind::Implies)(hypotheses, goal),
615+
(traits::GoalKind::And)(goal1, goal2),
616+
(traits::GoalKind::Not)(goal),
617+
(traits::GoalKind::DomainGoal)(domain_goal),
618+
(traits::GoalKind::Quantified)(kind, goal),
619+
(traits::GoalKind::CannotProve),
620620
}
621621
}
622622

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

636-
impl<'tcx> TypeFoldable<'tcx> for &'tcx traits::Goal<'tcx> {
636+
impl<'tcx> TypeFoldable<'tcx> for traits::Goal<'tcx> {
637637
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self {
638638
let v = (**self).fold_with(folder);
639639
folder.tcx().mk_goal(v)

src/librustc/ty/context.rs

+17-12
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ use mir::interpret::Allocation;
3636
use ty::subst::{CanonicalSubsts, Kind, Substs, Subst};
3737
use ty::ReprOptions;
3838
use traits;
39-
use traits::{Clause, Clauses, Goal, Goals};
39+
use traits::{Clause, Clauses, GoalKind, Goal, Goals};
4040
use ty::{self, Ty, TypeAndMut};
4141
use ty::{TyS, TyKind, List};
4242
use ty::{AdtKind, AdtDef, ClosureSubsts, GeneratorSubsts, Region, Const};
@@ -143,7 +143,8 @@ pub struct CtxtInterners<'tcx> {
143143
predicates: InternedSet<'tcx, List<Predicate<'tcx>>>,
144144
const_: InternedSet<'tcx, Const<'tcx>>,
145145
clauses: InternedSet<'tcx, List<Clause<'tcx>>>,
146-
goals: InternedSet<'tcx, List<Goal<'tcx>>>,
146+
goal: InternedSet<'tcx, GoalKind<'tcx>>,
147+
goal_list: InternedSet<'tcx, List<Goal<'tcx>>>,
147148
}
148149

149150
impl<'gcx: 'tcx, 'tcx> CtxtInterners<'tcx> {
@@ -159,7 +160,8 @@ impl<'gcx: 'tcx, 'tcx> CtxtInterners<'tcx> {
159160
predicates: Default::default(),
160161
const_: Default::default(),
161162
clauses: Default::default(),
162-
goals: Default::default(),
163+
goal: Default::default(),
164+
goal_list: Default::default(),
163165
}
164166
}
165167

@@ -1731,9 +1733,9 @@ impl<'a, 'tcx> Lift<'tcx> for Region<'a> {
17311733
}
17321734
}
17331735

1734-
impl<'a, 'tcx> Lift<'tcx> for &'a Goal<'a> {
1735-
type Lifted = &'tcx Goal<'tcx>;
1736-
fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<&'tcx Goal<'tcx>> {
1736+
impl<'a, 'tcx> Lift<'tcx> for Goal<'a> {
1737+
type Lifted = Goal<'tcx>;
1738+
fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<Goal<'tcx>> {
17371739
if tcx.interners.arena.in_arena(*self as *const _) {
17381740
return Some(unsafe { mem::transmute(*self) });
17391741
}
@@ -2304,6 +2306,12 @@ impl<'tcx> Borrow<RegionKind> for Interned<'tcx, RegionKind> {
23042306
}
23052307
}
23062308

2309+
impl<'tcx: 'lcx, 'lcx> Borrow<GoalKind<'lcx>> for Interned<'tcx, GoalKind<'tcx>> {
2310+
fn borrow<'a>(&'a self) -> &'a GoalKind<'lcx> {
2311+
&self.0
2312+
}
2313+
}
2314+
23072315
impl<'tcx: 'lcx, 'lcx> Borrow<[ExistentialPredicate<'lcx>]>
23082316
for Interned<'tcx, List<ExistentialPredicate<'tcx>>> {
23092317
fn borrow<'a>(&'a self) -> &'a [ExistentialPredicate<'lcx>] {
@@ -2419,7 +2427,8 @@ pub fn keep_local<'tcx, T: ty::TypeFoldable<'tcx>>(x: &T) -> bool {
24192427

24202428
direct_interners!('tcx,
24212429
region: mk_region(|r: &RegionKind| r.keep_in_local_tcx()) -> RegionKind,
2422-
const_: mk_const(|c: &Const<'_>| keep_local(&c.ty) || keep_local(&c.val)) -> Const<'tcx>
2430+
const_: mk_const(|c: &Const<'_>| keep_local(&c.ty) || keep_local(&c.val)) -> Const<'tcx>,
2431+
goal: mk_goal(|c: &GoalKind<'_>| keep_local(c)) -> GoalKind<'tcx>
24232432
);
24242433

24252434
macro_rules! slice_interners {
@@ -2438,7 +2447,7 @@ slice_interners!(
24382447
type_list: _intern_type_list(Ty),
24392448
substs: _intern_substs(Kind),
24402449
clauses: _intern_clauses(Clause),
2441-
goals: _intern_goals(Goal)
2450+
goal_list: _intern_goals(Goal)
24422451
);
24432452

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

2821-
pub fn mk_goal(self, goal: Goal<'tcx>) -> &'tcx Goal<'_> {
2822-
&self.intern_goals(&[goal])[0]
2823-
}
2824-
28252830
pub fn lint_hir<S: Into<MultiSpan>>(self,
28262831
lint: &'static Lint,
28272832
hir_id: HirId,

src/librustc/ty/flags.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,10 @@ impl FlagComputation {
148148
self.add_projection_ty(data);
149149
}
150150

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

153156
&ty::Opaque(_, substs) => {
154157
self.add_flags(TypeFlags::HAS_PROJECTION);

0 commit comments

Comments
 (0)