Skip to content

warn when int or uint is used in a native type decl #1403

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
nikomatsakis opened this issue Dec 31, 2011 · 3 comments
Closed

warn when int or uint is used in a native type decl #1403

nikomatsakis opened this issue Dec 31, 2011 · 3 comments
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@nikomatsakis
Copy link
Contributor

Perhaps we should issue a warning---or even an error?---when int or uint is used in a native type declaration? It is a very common mistake to assume they are the same as the C types int and unsigned. We could suggest the use of ctypes::c_int or ctypes::long etc.

@jckarter
Copy link

You'd want to make sure the warning doesn't trigger when referring to Rust int by the ctypes::ptrint_t alias.

@nikomatsakis
Copy link
Contributor Author

Yes, I would only trigger the warning if the user literally typed int or uint. In other words, base the warning on the ast::ty (AST), not on the ty::t (resolved type).

@lht
Copy link
Contributor

lht commented Jan 18, 2012

Closed by commits:

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

@lht lht closed this as completed Jan 18, 2012
bjorn3 added a commit to bjorn3/rust that referenced this issue Oct 29, 2023
…assembler

Support and stabilize inline asm on all platforms
bjorn3 added a commit to bjorn3/rust that referenced this issue Nov 10, 2023
rust-lang#1403 extended support to all targets supported by cg_clif
celinval pushed a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
* Added jq for json querying.

* Added clippy to regression.

* Added error ignore and todo to kani-compiler.

* Added clippy todo to cprover_bindings.

* Forced failure on warnings (Werror for clippy).

* Added clippy todo to compiletest.

* Clippy supression for bookrunner.

* Resolved metadata warnings with publish = false.

* Clippy todo for kani library.

* Clippy todos and publish fix for kani_macros.

* Cargo fmt.

* Temporally turned off clippy fail.

* Moved clippy to format checks.

* Moved clippy to the format check.

* Added missing dependency.

* Fixed yaml overwrite problem.

* Gather stats on clippy warnings.

* jq install for osx not needed.

* Moved clippy control to a central config file.

* Fixed clippy warnings under library/

* Adjusted actions to print stats by removing lint supression.

* Ignored 3 clippy warnings that regressed after merge.

* Forgot to remove manual -A

* got rid of redundant allowed lints.

* Moved jq install to workflow side.

* removed .cargo from gitignore
jieyouxu added a commit to jieyouxu/rust that referenced this issue Feb 28, 2025
…obzol

Bump `rustc_{codegen_ssa,llvm}` `cc` to 1.2.16 to fix `x86` Windows jobs on newest Windows SDK

Part of rust-lang#137733.

Bump `rustc_{codegen_ssa,llvm}` `cc` to 1.2.16 which contains rust-lang/cc-rs#1425 to help with rust-lang#137733. Previously tested in rust-lang#137724.

#### `cc` changelog between 1.2.13 and 1.2.16

<details>
<summary>`cc` changes since 1.2.13 up to and including 1.2.16</summary>

##### [1.2.16](rust-lang/cc-rs@cc-v1.2.15...cc-v1.2.16) - 2025-02-28

###### Fixed

- force windows compiler to run in `out_dir` to prevent artifacts in cwd (rust-lang#1415)

###### Other

- use `/arch:SSE2` for `x86` target arch (rust-lang#1425)
- Regenerate windows-sys binding ([rust-lang#1422](rust-lang/cc-rs#1422))
- Regenerate target info ([rust-lang#1418](rust-lang/cc-rs#1418))
- Add LIB var when compiling flag_check (rust-lang#1417)
- Change flag ordering ([rust-lang#1403](rust-lang/cc-rs#1403))
- Fix archiver detection for musl cross compilation ([rust-lang#1404](rust-lang/cc-rs#1404))

##### [1.2.15](rust-lang/cc-rs@cc-v1.2.14...cc-v1.2.15) - 2025-02-21

###### Other

- Regenerate target info ([rust-lang#1406](rust-lang/cc-rs#1406))
- Always read from all `CFLAGS`-style flags ([rust-lang#1401](rust-lang/cc-rs#1401))
- Simplify the error output on failed `Command` invocation ([rust-lang#1397](rust-lang/cc-rs#1397))

##### [1.2.14](rust-lang/cc-rs@cc-v1.2.13...cc-v1.2.14) - 2025-02-14

###### Other

- Regenerate target info ([rust-lang#1398](rust-lang/cc-rs#1398))
- Add support for setting `-gdwarf-{version}` based on RUSTFLAGS ([rust-lang#1395](rust-lang/cc-rs#1395))
- Add support for alternative network stack io-sock on QNX 7.1 aarch64 and x86_64 ([rust-lang#1312](rust-lang/cc-rs#1312))

</details>

r? `@Kobzol`
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Feb 28, 2025
Rollup merge of rust-lang#137788 - jieyouxu:bump-compiler-cc, r=lqd,Kobzol

Bump `rustc_{codegen_ssa,llvm}` `cc` to 1.2.16 to fix `x86` Windows jobs on newest Windows SDK

Part of rust-lang#137733.

Bump `rustc_{codegen_ssa,llvm}` `cc` to 1.2.16 which contains rust-lang/cc-rs#1425 to help with rust-lang#137733. Previously tested in rust-lang#137724.

#### `cc` changelog between 1.2.13 and 1.2.16

<details>
<summary>`cc` changes since 1.2.13 up to and including 1.2.16</summary>

##### [1.2.16](rust-lang/cc-rs@cc-v1.2.15...cc-v1.2.16) - 2025-02-28

###### Fixed

- force windows compiler to run in `out_dir` to prevent artifacts in cwd (rust-lang#1415)

###### Other

- use `/arch:SSE2` for `x86` target arch (rust-lang#1425)
- Regenerate windows-sys binding ([rust-lang#1422](rust-lang/cc-rs#1422))
- Regenerate target info ([rust-lang#1418](rust-lang/cc-rs#1418))
- Add LIB var when compiling flag_check (rust-lang#1417)
- Change flag ordering ([rust-lang#1403](rust-lang/cc-rs#1403))
- Fix archiver detection for musl cross compilation ([rust-lang#1404](rust-lang/cc-rs#1404))

##### [1.2.15](rust-lang/cc-rs@cc-v1.2.14...cc-v1.2.15) - 2025-02-21

###### Other

- Regenerate target info ([rust-lang#1406](rust-lang/cc-rs#1406))
- Always read from all `CFLAGS`-style flags ([rust-lang#1401](rust-lang/cc-rs#1401))
- Simplify the error output on failed `Command` invocation ([rust-lang#1397](rust-lang/cc-rs#1397))

##### [1.2.14](rust-lang/cc-rs@cc-v1.2.13...cc-v1.2.14) - 2025-02-14

###### Other

- Regenerate target info ([rust-lang#1398](rust-lang/cc-rs#1398))
- Add support for setting `-gdwarf-{version}` based on RUSTFLAGS ([rust-lang#1395](rust-lang/cc-rs#1395))
- Add support for alternative network stack io-sock on QNX 7.1 aarch64 and x86_64 ([rust-lang#1312](rust-lang/cc-rs#1312))

</details>

r? `@Kobzol`
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

No branches or pull requests

3 participants