@@ -156,7 +156,7 @@ pub struct TranslationCtx<'tcx> {
156156 laws : OnceMap < DefId , Box < Vec < DefId > > > ,
157157 /// Maps the [`DefId`] of a program function `f` with a `#[has_logical_alias(f')]`
158158 /// attribute to the logical function `f'`
159- logical_aliases : HashMap < DefId , DefId > ,
159+ logical_aliases : HashMap < DefId , ( Span , DefId ) > ,
160160 fmir_body : OnceMap < BodyId , Box < fmir:: Body < ' tcx > > > ,
161161 terms : OnceMap < DefId , Box < Option < ScopedTerm < ' tcx > > > > ,
162162 trait_impl : OnceMap < DefId , Box < TraitImpl < ' tcx > > > ,
@@ -237,23 +237,24 @@ impl<'tcx> TranslationCtx<'tcx> {
237237 /// Get the _logical alias_ of the given program function, if any.
238238 ///
239239 /// Logical aliases are defined with the `#[has_logical_alias(...)]` attribute.
240- pub ( crate ) fn logical_alias ( & self , def_id : DefId ) -> Option < DefId > {
240+ ///
241+ /// The returned span is the span of the attribute.
242+ pub ( crate ) fn logical_alias ( & self , def_id : DefId ) -> Option < ( Span , DefId ) > {
241243 self . logical_aliases . get ( & def_id) . copied ( )
242244 }
243245
244246 pub ( crate ) fn load_logical_aliases ( & mut self ) -> Result < ( ) , CannotFetchThir > {
245247 // FIXME: what about functions from another crate?
246- // FIXME: ensure here that the functions have the correct purity (program & logical)
247248 let mut err = None ;
248249 for def_id in self . tcx . hir ( ) . body_owners ( ) {
249250 match function_has_logical_alias ( self , def_id. to_def_id ( ) ) {
250- Ok ( Some ( aliased) ) => {
251+ Ok ( Some ( ( span , aliased) ) ) => {
251252 trace ! (
252253 "`{}` is an alias for `{}`" ,
253254 self . def_path_str( def_id) ,
254255 self . def_path_str( aliased) ,
255256 ) ;
256- self . logical_aliases . insert ( def_id. to_def_id ( ) , aliased) ;
257+ self . logical_aliases . insert ( def_id. to_def_id ( ) , ( span , aliased) ) ;
257258 }
258259 Ok ( None ) => { }
259260 Err ( e) => CannotFetchThir :: merge_opt ( & mut err, e) ,
0 commit comments