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

Issue 1403: Warn if int or uint is used in native fn declarations #1539

Closed
wants to merge 3 commits into from

Conversation

lht
Copy link
Contributor

@lht lht commented Jan 16, 2012

Please refer discussion of #1403.

Commit 37a2985 implements the check;
Commit 8926d5e fixes all occurrences in the current code base.

Is warn enough, or should we report errors?

I may not have used proper English for the warning message. Please help me correct that, if so. :)

@brson
Copy link
Contributor

brson commented Jan 16, 2012

I'm ok with taking this as-is for now, but also a little wary of sprinkling little chunks of lint-style analysis all over the compiler.

@lht
Copy link
Contributor Author

lht commented Jan 17, 2012

Thanks Brian! I'll rebase & merge this in a day or two if there was no objection raised.

@graydon
Copy link
Contributor

graydon commented Jan 17, 2012

I wonder how much this patch is, in reality, an argument for adopting LP64-style definition of int, to match C as much as possible by platform.

@lht
Copy link
Contributor Author

lht commented Jan 18, 2012

This patch only uses types defined in ctypes. I think it should be the job of ctypes to decide which data model to use.
I should remove all the assumptions of data width in number initializations.

@nikomatsakis
Copy link
Contributor

@graydon yes, I was about to pull this patch, but then I was wondering the same... maybe it would be better to just make "int and uint" be defined as "whatever type C int and unsigned are"? If we don't do that, however, I think we definitely need to make some kind of warnings because it will be a common misunderstanding.

@lht
Copy link
Contributor Author

lht commented Jan 18, 2012

Rebase and committed as:

f03eb96 rustc: Warn when int or uint is used in a native type decl
dde4186 Use ctypes in native function declarations
04882d7 rustc: Use integer from ctypes consistently
7b1724f libstd: Revert an integer type casting

Maybe we need to file another issue for discussing adopting LP64?

@lht lht closed this Jan 18, 2012
celinval pushed a commit to celinval/rust-dev that referenced this pull request Jun 4, 2024
…ust-lang#1539)

* feat: update any bool func

* tests: added more paths to exe-trace tests that use bool
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.

4 participants