summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/bytecomp.el
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2021-09-23 12:43:41 +0200
committerMattias EngdegÄrd <mattiase@acm.org>2021-09-25 20:25:01 +0200
commited02b88bbae18caad650d76876940ffb58cab554 (patch)
tree36512b017e92a76a37c63606821274bd35366924 /lisp/emacs-lisp/bytecomp.el
parent80fddff5d64ff915651eb751685b7430de00c536 (diff)
downloademacs-ed02b88bbae18caad650d76876940ffb58cab554.tar.gz
emacs-ed02b88bbae18caad650d76876940ffb58cab554.tar.bz2
emacs-ed02b88bbae18caad650d76876940ffb58cab554.zip
Renege on anonymous &rest (bug#50268, bug#50720)
Allowing &rest without a variable name following turned out not to be very useful, and it never worked properly. Disallow it. * lisp/emacs-lisp/bytecomp.el (byte-compile-check-lambda-list): * src/eval.c (funcall_lambda): Signal error for &rest without variable name. * doc/lispref/functions.texi (Argument List): Adjust manual. * etc/NEWS (file): Announce. * test/src/eval-tests.el (eval-tests--bugs-24912-and-24913): Extend test, also checking with and without lexical binding. (eval-tests-accept-empty-optional-rest): Reduce to... (eval-tests-accept-empty-optional): ...this, again checking with and without lexical binding.
Diffstat (limited to 'lisp/emacs-lisp/bytecomp.el')
-rw-r--r--lisp/emacs-lisp/bytecomp.el2
1 files changed, 2 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index be74195778b..d7da7a2149a 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -2930,6 +2930,8 @@ If FORM is a lambda or a macro, byte-compile it as a function."
(macroexp--const-symbol-p arg t))
(error "Invalid lambda variable %s" arg))
((eq arg '&rest)
+ (unless (cdr list)
+ (error "&rest without variable name"))
(when (cddr list)
(error "Garbage following &rest VAR in lambda-list"))
(when (memq (cadr list) '(&optional &rest))