Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails with recent master branch of Emacs #405

Closed
yasuhirokimura opened this issue Jun 17, 2023 · 3 comments
Closed

Build fails with recent master branch of Emacs #405

yasuhirokimura opened this issue Jun 17, 2023 · 3 comments
Labels
bug Existing behavior is incorrect
Milestone

Comments

@yasuhirokimura
Copy link

After 96eaba0 is committed, Build fails with recent master branch of Emacs as following.

yasu@rolling[1016]% make
emacs -Q -batch -L . -eval '(setq byte-compile-error-on-warn t)' -f batch-byte-compile dash.el
emacs -Q -batch -L . -eval '(setq byte-compile-error-on-warn t)' -f batch-byte-compile dev/dash-defs.el
emacs -Q -batch -L . -eval '(setq byte-compile-error-on-warn t)' -f batch-byte-compile dev/examples.el

In toplevel form:
dev/examples.el: Error: `setcar' on constant list (arg 1)
make: *** [Makefile:69: dev/examples.elc] Error 1
yasu@rolling[1017]%

The failure doesn't happen with Emacs 28.2

@basil-conto
Copy link
Collaborator

Thank you for reporting this.
I noticed this as well, but while fixing it noticed what I thought was a bug in Emacs, then ran out of time. I'll have a look again now.

@basil-conto
Copy link
Collaborator

while fixing it noticed what I thought was a bug in Emacs

Now reported as https://bugs.gnu.org/64127.

@basil-conto basil-conto added the upstream Issue lies with Emacs itself label Jun 17, 2023
basil-conto added a commit that referenced this issue Jun 17, 2023
Functions that guarantee a fresh return value should not be pure,
since their return value is likely to be mutated destructively:
https://bugs.gnu.org/64127

* NEWS.md (2.20.0): List affected functions.
* dash.el (-non-nil, -cons*, -snoc, -slice, -take, -take-last)
(-drop-last, -split-at, -interpose, -interleave, -repeat, -iota)
(-clone): No longer mark as pure.
* dev/examples.el (-powerset): Avoid mutating constant.

Fixes #405.
@basil-conto
Copy link
Collaborator

while fixing it noticed what I thought was a bug in Emacs

Now reported as https://bugs.gnu.org/64127.

Turns out it was my misunderstanding of what marking a function as pure implies: since pure function calls with constant arguments are evaluated at compile time, it is no longer safe to mutate their return value in the general case.

@basil-conto basil-conto added bug Existing behavior is incorrect and removed upstream Issue lies with Emacs itself labels Jun 17, 2023
@basil-conto basil-conto added this to the 2.20.0 milestone Jun 17, 2023
@basil-conto basil-conto added this to Done in Release 2.20.0 Jun 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Existing behavior is incorrect
Projects
Development

No branches or pull requests

2 participants