Skip to content

Commit de2c37a

Browse files
authored
gf: make method overwrite/delete an error during precompile (#50578)
Previously, this was only a WARNING message, which was often missed during CI runs. Closes #50451
1 parent bd8734f commit de2c37a

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/gf.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,8 +1568,8 @@ static void method_overwrite(jl_typemap_entry_t *newentry, jl_method_t *oldvalue
15681568
jl_printf(s, ".\n");
15691569
jl_uv_flush(s);
15701570
}
1571-
if (jl_options.incremental && jl_generating_output())
1572-
jl_printf(JL_STDERR, " ** incremental compilation may be fatally broken for this module **\n\n");
1571+
if (jl_generating_output())
1572+
jl_error("Method overwriting is not permitted during Module precompile.");
15731573
}
15741574

15751575
static void update_max_args(jl_methtable_t *mt, jl_value_t *type)
@@ -1860,6 +1860,8 @@ static jl_typemap_entry_t *do_typemap_search(jl_methtable_t *mt JL_PROPAGATES_RO
18601860

18611861
static void jl_method_table_invalidate(jl_methtable_t *mt, jl_typemap_entry_t *methodentry, size_t max_world)
18621862
{
1863+
if (jl_options.incremental && jl_generating_output())
1864+
jl_error("Method deletion is not possible during Module precompile.");
18631865
jl_method_t *method = methodentry->func.method;
18641866
assert(!method->is_for_opaque_closure);
18651867
method->deleted_world = methodentry->max_world = max_world;
@@ -1911,9 +1913,6 @@ static void jl_method_table_invalidate(jl_methtable_t *mt, jl_typemap_entry_t *m
19111913

19121914
JL_DLLEXPORT void jl_method_table_disable(jl_methtable_t *mt, jl_method_t *method)
19131915
{
1914-
if (jl_options.incremental && jl_generating_output())
1915-
jl_printf(JL_STDERR, "WARNING: method deletion during Module precompile may lead to undefined behavior"
1916-
"\n ** incremental compilation may be fatally broken for this module **\n\n");
19171916
jl_typemap_entry_t *methodentry = do_typemap_search(mt, method);
19181917
JL_LOCK(&mt->writelock);
19191918
// Narrow the world age on the method to make it uncallable

0 commit comments

Comments
 (0)