Skip to content

Conversation

vtjnash
Copy link
Member

@vtjnash vtjnash commented Apr 29, 2025

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

@vtjnash vtjnash added deprecation This change introduces or involves a deprecation error messages Better, more actionable error messages backport 1.12 Change should be backported to release-1.12 merge me PR is reviewed. Merge when all tests are passing labels Apr 29, 2025
@KristofferC KristofferC mentioned this pull request Apr 29, 2025
53 tasks
@topolarity
Copy link
Member

I also needed this recently to find a place this warning occurred, so I think it should be merged now and get feedback later.

I think a majority of our users don't know --depwarn exists, so we probably still need another solution here

@gbaraldi
Copy link
Member

tests run with depwarn by default in Pkg

@topolarity
Copy link
Member

tests run with depwarn by default in Pkg

Isn't that --depwarn=yes and not --depwarn=error?

I think it would save users a lot of trouble if the warning took a short backtrace and reported the file + line number from the first frame

@IanButterworth
Copy link
Member

IanButterworth commented Apr 29, 2025

I think it would save users a lot of trouble if the warning took a short backtrace and reported the file + line number from the first frame

Related: #48282

{
if (jl_options.depwarn == JL_OPTIONS_DEPWARN_ERROR)
jl_undefined_var_error(b->globalref->name, (jl_value_t*)b->globalref->mod);
jl_safe_printf(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should maybe mention --depwarn=error in this warning so that people know how to turn it on

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I'll steal the message from Vararg{T} where T

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).

Closes #57969
@vtjnash vtjnash force-pushed the jn/57969-depwarn branch from 74bd8a9 to efd734e Compare May 2, 2025 17:15
@Keno Keno merged commit 0682158 into master May 3, 2025
4 of 7 checks passed
@Keno Keno deleted the jn/57969-depwarn branch May 3, 2025 16:33
KristofferC pushed a commit that referenced this pull request May 5, 2025
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)
@giordano giordano removed the merge me PR is reviewed. Merge when all tests are passing label May 5, 2025
@KristofferC KristofferC removed the backport 1.12 Change should be backported to release-1.12 label May 9, 2025
charleskawczynski pushed a commit to charleskawczynski/julia that referenced this pull request May 12, 2025
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 JuliaLang#57969
Keno added a commit that referenced this pull request Jun 6, 2025
This makes two changes to the backdate-warning-turned-error (#58266):
1. Fix a bug where the error would only trigger the first time. We do only want
   to print once per process, but of course, we do want to error every time if
   enabled.
2. If we are in speculative execution context (generators and speculatively run
   functions during inference), always use the UndefVarError. Effects from these
   functions are not supposed to be observable, and it's very confusing if the
   printed warning goes away when depwarns are enabled. This is marginally more
   breaking, but the burden is on generated function authors (which already have
   to be world-age aware and are somewhat more regularly broken) and is consistent
   with other things that are stronger errors in pure context.

Fixes #58648
Keno added a commit that referenced this pull request Jun 6, 2025
This makes two changes to the backdate-warning-turned-error (#58266):
1. Fix a bug where the error would only trigger the first time. We do only want
   to print once per process, but of course, we do want to error every time if
   enabled.
2. If we are in speculative execution context (generators and speculatively run
   functions during inference), always use the UndefVarError. Effects from these
   functions are not supposed to be observable, and it's very confusing if the
   printed warning goes away when depwarns are enabled. This is marginally more
   breaking, but the burden is on generated function authors (which already have
   to be world-age aware and are somewhat more regularly broken) and is consistent
   with other things that are stronger errors in pure context.

Fixes #58648
Keno added a commit that referenced this pull request Jun 6, 2025
This makes two changes to the backdate-warning-turned-error (#58266):
1. Fix a bug where the error would only trigger the first time. We do
only want to print once per process, but of course, we do want to error
every time if enabled.
2. If we are in speculative execution context (generators and
speculatively run functions during inference), always use the
UndefVarError. Effects from these functions are not supposed to be
observable, and it's very confusing if the printed warning goes away
when depwarns are enabled. This is marginally more breaking, but the
burden is on generated function authors (which already have to be
world-age aware and are somewhat more regularly broken) and is
consistent with other things that are stronger errors in pure context.

Fixes #58648
KristofferC pushed a commit that referenced this pull request Jun 6, 2025
This makes two changes to the backdate-warning-turned-error (#58266):
1. Fix a bug where the error would only trigger the first time. We do
only want to print once per process, but of course, we do want to error
every time if enabled.
2. If we are in speculative execution context (generators and
speculatively run functions during inference), always use the
UndefVarError. Effects from these functions are not supposed to be
observable, and it's very confusing if the printed warning goes away
when depwarns are enabled. This is marginally more breaking, but the
burden is on generated function authors (which already have to be
world-age aware and are somewhat more regularly broken) and is
consistent with other things that are stronger errors in pure context.

Fixes #58648

(cherry picked from commit d2cc061)
nilesh646 pushed a commit to nilesh646/julia that referenced this pull request Jun 17, 2025
This makes two changes to the backdate-warning-turned-error (JuliaLang#58266):
1. Fix a bug where the error would only trigger the first time. We do
only want to print once per process, but of course, we do want to error
every time if enabled.
2. If we are in speculative execution context (generators and
speculatively run functions during inference), always use the
UndefVarError. Effects from these functions are not supposed to be
observable, and it's very confusing if the printed warning goes away
when depwarns are enabled. This is marginally more breaking, but the
burden is on generated function authors (which already have to be
world-age aware and are somewhat more regularly broken) and is
consistent with other things that are stronger errors in pure context.

Fixes JuliaLang#58648
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecation This change introduces or involves a deprecation error messages Better, more actionable error messages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

print_backdate_admonition may need a backtrace
7 participants