Skip to content

Key rules on enum parameters - #560

Merged
nunoplopes merged 6 commits into
Cpp2Rust:masterfrom
lucic71:9-class-of-fallbacks
Oct 21, 2026
Merged

nunoplopes merged 6 commits into
Cpp2Rust:masterfrom
lucic71:9-class-of-fallbacks

Conversation

@lucic71

@lucic71 lucic71 commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

std::byte îs an enum

@lucic71 lucic71 changed the title Key rules on plain record and enum parameters Key rules on enum parameters Oct 21, 2026
Comment thread rules/cstddef/tgt_unsafe.rs Outdated
}

fn f5<T1: Into<i64>>(a0: u8, a1: T1) -> u8 {
a0 << Into::<i64>::into(a1)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this rule is very weird. why do you need this into?? The other rules don't have that.
The result is a u8 anyway.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

f5 is a template so a1 is generic. a0 << a1 does not type check if a1 is generic. Calling into constraints the possible a1's

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The other rules use unsigned. Generating this Into in the code is really not the right approach. A sign extend there is not helpful and can hurt performance.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's a0 << a1 now.

@nunoplopes
nunoplopes merged commit 26ff6db into Cpp2Rust:master Oct 21, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants