Skip to content

Commit 72b8474

Browse files
vtjnashKristofferC
authored andcommitted
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 (cherry picked from commit 0682158)
1 parent 79c45b8 commit 72b8474

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
@@ -843,12 +843,15 @@ JL_DLLEXPORT jl_module_t *jl_get_module_of_binding(jl_module_t *m, jl_sym_t *var
843843

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

0 commit comments

Comments
 (0)