Skip to content

Commit 0682158

Browse files
authored
add backdate_admonition to depwarn=error (#58266)
This is close to the expected behavior after deprecations are removed (other than that the b->globalref->mod in the printed message here will be the source module instead of the destination module, which may sometimes cause confusing printing here, but probably rarely). I also needed this recently to find a place this warning occurred, so I think it should be merged now and get feedback later. Closes #57969
1 parent 7157407 commit 0682158

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/module.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -845,12 +845,15 @@ JL_DLLEXPORT jl_module_t *jl_get_module_of_binding(jl_module_t *m, jl_sym_t *var
845845

846846
static NOINLINE void print_backdate_admonition(jl_binding_t *b) JL_NOTSAFEPOINT
847847
{
848+
if (jl_options.depwarn == JL_OPTIONS_DEPWARN_ERROR)
849+
jl_undefined_var_error(b->globalref->name, (jl_value_t*)b->globalref->mod);
848850
jl_safe_printf(
849851
"WARNING: Detected access to binding `%s.%s` in a world prior to its definition world.\n"
850852
" Julia 1.12 has introduced more strict world age semantics for global bindings.\n"
851853
" !!! This code may malfunction under Revise.\n"
852854
" !!! This code will error in future versions of Julia.\n"
853-
"Hint: Add an appropriate `invokelatest` around the access to this binding.\n",
855+
"Hint: Add an appropriate `invokelatest` around the access to this binding.\n"
856+
"To make this warning an error, and hence obtain a stack trace, use `julia --depwarn=error`.\n",
854857
jl_symbol_name(b->globalref->mod->name), jl_symbol_name(b->globalref->name));
855858
}
856859

0 commit comments

Comments
 (0)