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

Allow passing index as :ident in set_general_handler macro #384

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions src/structures/idt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1170,6 +1170,9 @@ macro_rules! set_general_handler {
($idt:expr, $handler:ident, $idx:literal) => {
$crate::set_general_handler!($idt, $handler, $idx..=$idx);
};
($idt:expr, $handler:ident, $idx:ident) => {
$crate::set_general_handler!($idt, $handler, $idx..=$idx);
};
Comment on lines +1173 to +1175
Copy link
Member

Choose a reason for hiding this comment

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

This match arm would overlap with match arm just below this, wouldn't it? We can match literals in the case above this because there's now way to construct a range from a single literal, so a literal always has to be a single index, but the same is not true for idents which can be individual indices as well as ranges.

($idt:expr, $handler:ident, $range:expr) => {{
/// This constant is used to avoid spamming the same compilation error ~200 times
/// when the handler's signature is wrong.
Expand Down