Skip to content

transpile: Import num_traits::Float for method calls on f128#1695

Open
Rua wants to merge 1 commit intoimmunant:masterfrom
Rua:num-traits-float
Open

transpile: Import num_traits::Float for method calls on f128#1695
Rua wants to merge 1 commit intoimmunant:masterfrom
Rua:num-traits-float

Conversation

@Rua
Copy link
Contributor

@Rua Rua commented Mar 25, 2026

@Rua Rua force-pushed the num-traits-float branch from c865f6b to fae082f Compare March 25, 2026 18:06

match arg_type_kind {
CTypeKind::LongDouble | CTypeKind::Float128 => {
self.use_crate(ExternCrate::NumTraits);
Copy link
Contributor

Choose a reason for hiding this comment

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

Was this not needed before because there's a cast after? Or how did this work before?

Copy link
Contributor Author

@Rua Rua Mar 26, 2026

Choose a reason for hiding this comment

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

I'm not sure it ever worked. These methods are not inherent methods of f128, they are provided by the Float trait. So without importing that, you just get a compile error.

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.

C2Rust generates calls to f128 float methods without importing required traits

2 participants