Skip to content

Commit 2774179

Browse files
Rollup merge of #52247 - ljedrz:dyn_librustc, r=oli-obk
Deny bare trait objects in in src/librustc Enforce `#![deny(bare_trait_objects)]` in `src/librustc`.
2 parents b41105b + 48e501f commit 2774179

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/librustc/hir/lowering.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ pub struct LoweringContext<'a> {
8282
// Use to assign ids to hir nodes that do not directly correspond to an ast node
8383
sess: &'a Session,
8484

85-
cstore: &'a CrateStore,
85+
cstore: &'a dyn CrateStore,
8686

87-
resolver: &'a mut Resolver,
87+
resolver: &'a mut dyn Resolver,
8888

8989
/// The items being lowered are collected here.
9090
items: BTreeMap<NodeId, hir::Item>,
@@ -199,10 +199,10 @@ impl<'a> ImplTraitContext<'a> {
199199

200200
pub fn lower_crate(
201201
sess: &Session,
202-
cstore: &CrateStore,
202+
cstore: &dyn CrateStore,
203203
dep_graph: &DepGraph,
204204
krate: &Crate,
205-
resolver: &mut Resolver,
205+
resolver: &mut dyn Resolver,
206206
) -> hir::Crate {
207207
// We're constructing the HIR here; we don't care what we will
208208
// read, since we haven't even constructed the *input* to

src/librustc/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
//!
3737
//! This API is completely unstable and subject to change.
3838
39+
#![deny(bare_trait_objects)]
40+
3941
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
4042
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
4143
html_root_url = "https://doc.rust-lang.org/nightly/")]

src/librustc/middle/cstore.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ pub trait CrateStore {
257257
fn metadata_encoding_version(&self) -> &[u8];
258258
}
259259

260-
pub type CrateStoreDyn = CrateStore + sync::Sync;
260+
pub type CrateStoreDyn = dyn CrateStore + sync::Sync;
261261

262262
// FIXME: find a better place for this?
263263
pub fn validate_crate_name(sess: Option<&Session>, s: &str, sp: Option<Span>) {

0 commit comments

Comments
 (0)