Skip to content

Commit 0939882

Browse files
Move trait into attr so it's greppable
1 parent 7995139 commit 0939882

File tree

31 files changed

+91
-80
lines changed

31 files changed

+91
-80
lines changed

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
191191
}
192192
}
193193

194-
#[extension]
195-
impl ResolverAstLoweringExt for ResolverAstLowering {
194+
#[extension(trait ResolverAstLoweringExt)]
195+
impl ResolverAstLowering {
196196
fn legacy_const_generic_args(&self, expr: &Expr) -> Option<Vec<usize>> {
197197
if let ExprKind::Path(None, path) = &expr.kind {
198198
// Don't perform legacy const generics rewriting if the path already

compiler/rustc_borrowck/src/facts.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ impl polonius_engine::FactTypes for RustcFacts {
2525

2626
pub type AllFacts = PoloniusFacts<RustcFacts>;
2727

28-
#[extension]
29-
pub(crate) impl AllFactsExt for AllFacts {
28+
#[extension(pub(crate) trait AllFactsExt)]
29+
impl AllFacts {
3030
/// Returns `true` if there is a need to gather `AllFacts` given the
3131
/// current `-Z` flags.
3232
fn enabled(tcx: TyCtxt<'_>) -> bool {

compiler/rustc_borrowck/src/place_ext.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use rustc_middle::mir::ProjectionElem;
55
use rustc_middle::mir::{Body, Mutability, Place};
66
use rustc_middle::ty::{self, TyCtxt};
77

8-
#[extension]
9-
pub impl<'tcx> PlaceExt<'tcx> for Place<'tcx> {
8+
#[extension(pub trait PlaceExt<'tcx>)]
9+
impl<'tcx> Place<'tcx> {
1010
/// Returns `true` if we can safely ignore borrows of this place.
1111
/// This is true whenever there is no action that the user can do
1212
/// to the place `self` that would invalidate the borrow. This is true

compiler/rustc_borrowck/src/region_infer/opaque_types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@ impl<'tcx> RegionInferenceContext<'tcx> {
226226
}
227227
}
228228

229-
#[extension]
230-
pub impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
229+
#[extension(pub trait InferCtxtExt<'tcx>)]
230+
impl<'tcx> InferCtxt<'tcx> {
231231
/// Given the fully resolved, instantiated type for an opaque
232232
/// type, i.e., the value of an inference variable like C1 or C2
233233
/// (*), computes the "definition type" for an opaque type

compiler/rustc_borrowck/src/universal_regions.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -797,8 +797,8 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
797797
}
798798
}
799799

800-
#[extension]
801-
impl<'cx, 'tcx> InferCtxtExt<'tcx> for BorrowckInferCtxt<'cx, 'tcx> {
800+
#[extension(trait InferCtxtExt<'tcx>)]
801+
impl<'cx, 'tcx> BorrowckInferCtxt<'cx, 'tcx> {
802802
#[instrument(skip(self), level = "debug")]
803803
fn replace_free_regions_with_nll_infer_vars<T>(
804804
&self,

compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ use std::fmt;
2828

2929
use crate::errors;
3030

31-
#[extension]
32-
impl RegionExt for ResolvedArg {
31+
#[extension(trait RegionExt)]
32+
impl ResolvedArg {
3333
fn early(param: &GenericParam<'_>) -> (LocalDefId, ResolvedArg) {
3434
debug!("ResolvedArg::early: def_id={:?}", param.def_id);
3535
(param.def_id, ResolvedArg::EarlyBound(param.def_id.to_def_id()))

compiler/rustc_infer/src/infer/canonical/instantiate.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ use rustc_middle::ty::{self, TyCtxt};
1313

1414
/// FIXME(-Znext-solver): This or public because it is shared with the
1515
/// new trait solver implementation. We should deduplicate canonicalization.
16-
#[extension]
17-
pub impl<'tcx, V> CanonicalExt<'tcx, V> for Canonical<'tcx, V> {
16+
#[extension(pub trait CanonicalExt<'tcx, V>)]
17+
impl<'tcx, V> Canonical<'tcx, V> {
1818
/// Instantiate the wrapped value, replacing each canonical value
1919
/// with the value given in `var_values`.
2020
fn instantiate(&self, tcx: TyCtxt<'tcx>, var_values: &CanonicalVarValues<'tcx>) -> V

compiler/rustc_infer/src/infer/error_reporting/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2796,8 +2796,8 @@ pub enum FailureCode {
27962796
Error0644,
27972797
}
27982798

2799-
#[extension]
2800-
pub impl<'tcx> ObligationCauseExt<'tcx> for ObligationCause<'tcx> {
2799+
#[extension(pub trait ObligationCauseExt<'tcx>)]
2800+
impl<'tcx> ObligationCause<'tcx> {
28012801
fn as_failure_code(&self, terr: TypeError<'tcx>) -> FailureCode {
28022802
use self::FailureCode::*;
28032803
use crate::traits::ObligationCauseCode::*;

compiler/rustc_infer/src/infer/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,8 +626,8 @@ pub struct InferCtxtBuilder<'tcx> {
626626
next_trait_solver: bool,
627627
}
628628

629-
#[extension]
630-
pub impl<'tcx> TyCtxtInferExt<'tcx> for TyCtxt<'tcx> {
629+
#[extension(pub trait TyCtxtInferExt<'tcx>)]
630+
impl<'tcx> TyCtxt<'tcx> {
631631
fn infer_ctxt(self) -> InferCtxtBuilder<'tcx> {
632632
InferCtxtBuilder {
633633
tcx: self,

compiler/rustc_infer/src/traits/engine.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ pub trait TraitEngine<'tcx>: 'tcx {
5252
) -> Vec<PredicateObligation<'tcx>>;
5353
}
5454

55-
#[extension]
56-
pub impl<'tcx, T: ?Sized + TraitEngine<'tcx>> TraitEngineExt<'tcx> for T {
55+
#[extension(pub trait TraitEngineExt<'tcx>)]
56+
impl<'tcx, T: ?Sized + TraitEngine<'tcx>> T {
5757
fn register_predicate_obligations(
5858
&mut self,
5959
infcx: &InferCtxt<'tcx>,

0 commit comments

Comments
 (0)