Skip to content

Commit f0c7733

Browse files
Apply suggestions from review
1 parent beeacdb commit f0c7733

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

src/librustc_middle/ty/query/mod.rs

+20-14
Original file line numberDiff line numberDiff line change
@@ -190,22 +190,28 @@ pub(crate) fn try_load_from_on_disk_cache<'tcx>(tcx: TyCtxt<'tcx>, dep_node: &De
190190
rustc_dep_node_try_load_from_on_disk_cache!(dep_node, tcx)
191191
}
192192

193-
/// An analogue of the `Into` trait that's intended only for query paramaters.
194-
///
195-
/// This exists to allow queries to accept either `DefId` or `LocalDefId` while requiring that the
196-
/// user call `to_def_id` to convert between them everywhere else.
197-
pub trait IntoQueryParam<P> {
198-
fn into_query_param(self) -> P;
199-
}
193+
mod sealed {
194+
use super::{DefId, LocalDefId};
195+
196+
/// An analogue of the `Into` trait that's intended only for query paramaters.
197+
///
198+
/// This exists to allow queries to accept either `DefId` or `LocalDefId` while requiring that the
199+
/// user call `to_def_id` to convert between them everywhere else.
200+
pub trait IntoQueryParam<P> {
201+
fn into_query_param(self) -> P;
202+
}
200203

201-
impl<P> IntoQueryParam<P> for P {
202-
fn into_query_param(self) -> P {
203-
self
204+
impl<P> IntoQueryParam<P> for P {
205+
fn into_query_param(self) -> P {
206+
self
207+
}
204208
}
205-
}
206209

207-
impl IntoQueryParam<DefId> for LocalDefId {
208-
fn into_query_param(self) -> DefId {
209-
self.to_def_id()
210+
impl IntoQueryParam<DefId> for LocalDefId {
211+
fn into_query_param(self) -> DefId {
212+
self.to_def_id()
213+
}
210214
}
211215
}
216+
217+
use sealed::IntoQueryParam;

src/librustc_span/def_id.rs

-6
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,6 @@ impl fmt::Debug for LocalDefId {
237237
}
238238
}
239239

240-
impl From<LocalDefId> for DefId {
241-
fn from(v: LocalDefId) -> Self {
242-
v.to_def_id()
243-
}
244-
}
245-
246240
impl rustc_serialize::UseSpecializedEncodable for LocalDefId {}
247241
impl rustc_serialize::UseSpecializedDecodable for LocalDefId {}
248242

0 commit comments

Comments
 (0)