Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/byte-compile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Byte-compile

on:
push:
branches:
- master
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
byte-compile:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
emacs-version:
- "26.1"
- "30.1"
- snapshot
steps:
- uses: actions/checkout@v5
- uses: purcell/setup-emacs@master
with:
version: ${{ matrix.emacs-version }}
- name: Byte-compile with warnings as errors
run: |
emacs -Q --batch -L . \
--eval '(setq byte-compile-error-on-warn t)' \
--eval '(let ((files (list "rust-cargo.el" "rust-common.el"
"rust-compile.el" "rust-mode.el"
"rust-playpen.el" "rust-prog-mode.el"
"rust-rustfmt.el" "rust-utils.el"))
(ok t))
(when (version<= "29.1" emacs-version)
(setq files
(append files (list "rust-mode-treesitter.el"))))
(dolist (f files)
(unless (byte-compile-file f)
(setq ok nil)))
(unless ok (kill-emacs 1)))'
1 change: 1 addition & 0 deletions rust-cargo.el
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
;;; Code:

(require 'json)
(require 'subr-x)

;;; Options

Expand Down
2 changes: 1 addition & 1 deletion rust-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
;; Author: Mozilla <rust-mode@noreply.github.com>
;; Url: https://github.com/rust-lang/rust-mode
;; Keywords: languages
;; Package-Requires: ((emacs "25.1"))
;; Package-Requires: ((emacs "26.1"))

;; This file is distributed under the terms of both the MIT license and the
;; Apache License (version 2.0).
Expand Down
39 changes: 21 additions & 18 deletions rust-prog-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -922,11 +922,12 @@ and end."
(defun rust-string-interpolation-matcher (limit)
"Match next Rust interpolation marker before LIMIT and set match data if found.
Returns nil if not within a Rust string."
(when-let (((rust-in-str))
(match (rust-next-string-interpolation limit)))
(set-match-data match)
(goto-char (cadr match))
match))
(when (rust-in-str)
(let ((match (rust-next-string-interpolation limit)))
(when match
(set-match-data match)
(goto-char (cadr match))
match))))

(defun rust-syntax-class-before-point ()
(when (> (point) 1)
Expand All @@ -950,18 +951,19 @@ Returns nil if not within a Rust string."
;; we're looking back at this, we want to end up just after "Fn".
((member (char-before) '(?\] ?\) ))
(let ((is-paren (rust-looking-back-str ")")))
(when-let ((dest (save-excursion
(let ((dest (save-excursion
(backward-sexp)
(rust-rewind-irrelevant)
(or
(when (rust-looking-back-str "->")
(backward-char 2)
(rust-rewind-irrelevant)
(when (rust-looking-back-str ")")
(backward-sexp)
(rust-rewind-irrelevant)
(or
(when (rust-looking-back-str "->")
(backward-char 2)
(rust-rewind-irrelevant)
(when (rust-looking-back-str ")")
(backward-sexp)
(point)))
(and is-paren (point))))))
(goto-char dest))))))
(point)))
(and is-paren (point))))))
(when dest
(goto-char dest)))))))

(defun rust-rewind-to-decl-name ()
"Return the point at the beginning of the name in a declaration.
Expand Down Expand Up @@ -1548,8 +1550,9 @@ whichever comes first."
(defun rust-syntax-propertize (start end)
"A `syntax-propertize-function' to apply properties from START to END."
(goto-char start)
(when-let ((str-start (rust-in-str-or-cmnt)))
(rust--syntax-propertize-raw-string str-start end))
(let ((str-start (rust-in-str-or-cmnt)))
(when str-start
(rust--syntax-propertize-raw-string str-start end)))
(funcall
(syntax-propertize-rules
;; Character literals.
Expand Down
Loading