Subject: bug#77914: 31.0.50; treesit-font-lock-level set to 4 cause rust-ts-mode lost all color

From: Eli Zaretskii <[email-masked]>
Date: Sun, 20 Apr 2025 12:29:07 +0300

> Date: Sun, 20 Apr 2025 15:19:20 +0800
> From: Eval Exec <[email-masked]>
> 
> Oh! In the reproduce step, I write a typo, the bug can be reproduced by 
> setting different `treesit-font-lock-level`, wen 
> `treesit-font-lock-level` is 3, all colors are good, when 
> treesit-font-lock-level is 4, all colors are lost.
> To reproduce this: use this rust file:
> 
> Then eval:
> 1. (progn  (setq treesit-font-lock-level 4) (revert-buffer))
> all color are lost.
> 
> 2. (progn  (setq treesit-font-lock-level 3) (revert-buffer))
> colors are good. !Important, level 3 is good, but level 4 lost colors.
> 
> 3. (progn  (setq treesit-font-lock-level 4) (revert-buffer))
> all color are lost again.

Don't use setq, use setopt.  treesit-font-lock-level is a defcustom,
and it has a setter function.