Skip to content

Commit 85a6b92

Browse files
committed
Rollup merge of #48477 - Manishearth:dyn-trait-fixes, r=nmatsakis
Fixes #47311. r? @nrc
2 parents e8af0f4 + 40f218f commit 85a6b92

File tree

35 files changed

+94
-94
lines changed

35 files changed

+94
-94
lines changed

src/librustc/dep_graph/debug.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ pub struct EdgeFilter {
5454
}
5555

5656
impl EdgeFilter {
57-
pub fn new(test: &str) -> Result<EdgeFilter, Box<Error>> {
57+
pub fn new(test: &str) -> Result<EdgeFilter, Box<dyn Error>> {
5858
let parts: Vec<_> = test.split("->").collect();
5959
if parts.len() != 2 {
6060
Err(format!("expected a filter like `a&b -> c&d`, not `{}`", test).into())

src/librustc/hir/lowering.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,13 @@ pub struct LoweringContext<'a> {
8080
// Use to assign ids to hir nodes that do not directly correspond to an ast node
8181
sess: &'a Session,
8282

83-
cstore: &'a CrateStore,
83+
cstore: &'a dyn CrateStore,
8484

8585
// As we walk the AST we must keep track of the current 'parent' def id (in
8686
// the form of a DefIndex) so that if we create a new node which introduces
8787
// a definition, then we can properly create the def id.
8888
parent_def: Option<DefIndex>,
89-
resolver: &'a mut Resolver,
89+
resolver: &'a mut dyn Resolver,
9090
name_map: FxHashMap<Ident, Name>,
9191

9292
/// The items being lowered are collected here.
@@ -177,10 +177,10 @@ enum ImplTraitContext {
177177
}
178178

179179
pub fn lower_crate(sess: &Session,
180-
cstore: &CrateStore,
180+
cstore: &dyn CrateStore,
181181
dep_graph: &DepGraph,
182182
krate: &Crate,
183-
resolver: &mut Resolver)
183+
resolver: &mut dyn Resolver)
184184
-> hir::Crate {
185185
// We're constructing the HIR here; we don't care what we will
186186
// read, since we haven't even constructed the *input* to

src/librustc/hir/map/collector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
123123

124124
pub(super) fn finalize_and_compute_crate_hash(self,
125125
crate_disambiguator: CrateDisambiguator,
126-
cstore: &CrateStore,
126+
cstore: &dyn CrateStore,
127127
codemap: &CodeMap,
128128
commandline_args_hash: u64)
129129
-> (Vec<MapEntry<'hir>>, Svh) {

src/librustc/hir/map/def_collector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub struct DefCollector<'a> {
2626
definitions: &'a mut Definitions,
2727
parent_def: Option<DefIndex>,
2828
expansion: Mark,
29-
pub visit_macro_invoc: Option<&'a mut FnMut(MacroInvocationData)>,
29+
pub visit_macro_invoc: Option<&'a mut dyn FnMut(MacroInvocationData)>,
3030
}
3131

3232
pub struct MacroInvocationData {

src/librustc/hir/map/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ use dep_graph::{DepGraph, DepNode, DepKind, DepNodeIndex};
1919

2020
use hir::def_id::{CRATE_DEF_INDEX, DefId, LocalDefId, DefIndexAddressSpace};
2121

22+
use middle::cstore::CrateStore;
23+
2224
use syntax::abi::Abi;
2325
use syntax::ast::{self, Name, NodeId, CRATE_NODE_ID};
2426
use syntax::codemap::Spanned;
@@ -1136,8 +1138,9 @@ impl Named for StructField { fn name(&self) -> Name { self.name } }
11361138
impl Named for TraitItem { fn name(&self) -> Name { self.name } }
11371139
impl Named for ImplItem { fn name(&self) -> Name { self.name } }
11381140

1141+
11391142
pub fn map_crate<'hir>(sess: &::session::Session,
1140-
cstore: &::middle::cstore::CrateStore,
1143+
cstore: &dyn CrateStore,
11411144
forest: &'hir mut Forest,
11421145
definitions: &'hir Definitions)
11431146
-> Map<'hir> {

src/librustc/hir/print.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ pub trait PpAnn {
6262

6363
pub struct NoAnn;
6464
impl PpAnn for NoAnn {}
65-
pub const NO_ANN: &'static PpAnn = &NoAnn;
65+
pub const NO_ANN: &'static dyn PpAnn = &NoAnn;
6666

6767
impl PpAnn for hir::Crate {
6868
fn nested(&self, state: &mut State, nested: Nested) -> io::Result<()> {
@@ -83,7 +83,7 @@ pub struct State<'a> {
8383
literals: Peekable<vec::IntoIter<comments::Literal>>,
8484
cur_cmnt: usize,
8585
boxes: Vec<pp::Breaks>,
86-
ann: &'a (PpAnn + 'a),
86+
ann: &'a (dyn PpAnn + 'a),
8787
}
8888

8989
impl<'a> PrintState<'a> for State<'a> {
@@ -126,9 +126,9 @@ pub fn print_crate<'a>(cm: &'a CodeMap,
126126
sess: &ParseSess,
127127
krate: &hir::Crate,
128128
filename: FileName,
129-
input: &mut Read,
130-
out: Box<Write + 'a>,
131-
ann: &'a PpAnn,
129+
input: &mut dyn Read,
130+
out: Box<dyn Write + 'a>,
131+
ann: &'a dyn PpAnn,
132132
is_expanded: bool)
133133
-> io::Result<()> {
134134
let mut s = State::new_from_input(cm, sess, filename, input, out, ann, is_expanded);
@@ -145,9 +145,9 @@ impl<'a> State<'a> {
145145
pub fn new_from_input(cm: &'a CodeMap,
146146
sess: &ParseSess,
147147
filename: FileName,
148-
input: &mut Read,
149-
out: Box<Write + 'a>,
150-
ann: &'a PpAnn,
148+
input: &mut dyn Read,
149+
out: Box<dyn Write + 'a>,
150+
ann: &'a dyn PpAnn,
151151
is_expanded: bool)
152152
-> State<'a> {
153153
let (cmnts, lits) = comments::gather_comments_and_literals(sess, filename, input);
@@ -167,8 +167,8 @@ impl<'a> State<'a> {
167167
}
168168

169169
pub fn new(cm: &'a CodeMap,
170-
out: Box<Write + 'a>,
171-
ann: &'a PpAnn,
170+
out: Box<dyn Write + 'a>,
171+
ann: &'a dyn PpAnn,
172172
comments: Option<Vec<comments::Comment>>,
173173
literals: Option<Vec<comments::Literal>>)
174174
-> State<'a> {
@@ -184,7 +184,7 @@ impl<'a> State<'a> {
184184
}
185185
}
186186

187-
pub fn to_string<F>(ann: &PpAnn, f: F) -> String
187+
pub fn to_string<F>(ann: &dyn PpAnn, f: F) -> String
188188
where F: FnOnce(&mut State) -> io::Result<()>
189189
{
190190
let mut wr = Vec::new();

src/librustc/ich/hcx.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pub fn compute_ignored_attr_names() -> FxHashSet<Symbol> {
4949
pub struct StableHashingContext<'gcx> {
5050
sess: &'gcx Session,
5151
definitions: &'gcx Definitions,
52-
cstore: &'gcx CrateStore,
52+
cstore: &'gcx dyn CrateStore,
5353
body_resolver: BodyResolver<'gcx>,
5454
hash_spans: bool,
5555
hash_bodies: bool,
@@ -88,7 +88,7 @@ impl<'gcx> StableHashingContext<'gcx> {
8888
pub fn new(sess: &'gcx Session,
8989
krate: &'gcx hir::Crate,
9090
definitions: &'gcx Definitions,
91-
cstore: &'gcx CrateStore)
91+
cstore: &'gcx dyn CrateStore)
9292
-> Self {
9393
let hash_spans_initial = !sess.opts.debugging_opts.incremental_ignore_spans;
9494

src/librustc/infer/region_constraints/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,7 @@ impl<'a, 'gcx, 'tcx> GenericKind<'tcx> {
896896
}
897897

898898
impl<'a, 'gcx, 'tcx> VerifyBound<'tcx> {
899-
fn for_each_region(&self, f: &mut FnMut(ty::Region<'tcx>)) {
899+
fn for_each_region(&self, f: &mut dyn FnMut(ty::Region<'tcx>)) {
900900
match self {
901901
&VerifyBound::AnyRegion(ref rs) | &VerifyBound::AllRegions(ref rs) => for &r in rs {
902902
f(r);

src/librustc/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@
4141
html_root_url = "https://doc.rust-lang.org/nightly/")]
4242
#![deny(warnings)]
4343

44-
#![cfg_attr(not(stage0), allow(bare_trait_object))]
45-
4644
#![feature(box_patterns)]
4745
#![feature(box_syntax)]
4846
#![feature(conservative_impl_trait)]

src/librustc/lint/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,8 @@ pub trait EarlyLintPass: LintPass {
280280
}
281281

282282
/// A lint pass boxed up as a trait object.
283-
pub type EarlyLintPassObject = Box<EarlyLintPass + 'static>;
284-
pub type LateLintPassObject = Box<for<'a, 'tcx> LateLintPass<'a, 'tcx> + 'static>;
283+
pub type EarlyLintPassObject = Box<dyn EarlyLintPass + 'static>;
284+
pub type LateLintPassObject = Box<dyn for<'a, 'tcx> LateLintPass<'a, 'tcx> + 'static>;
285285

286286
/// Identifies a lint known to the compiler.
287287
#[derive(Clone, Copy, Debug)]

0 commit comments

Comments
 (0)