-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Rust: extract declarations of builtin types #19421
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
base: main
Are you sure you want to change the base?
Conversation
21aab9e
to
c4aa719
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements the extraction of built-in type declarations in Rust and updates related build configurations and the extractor.
- Added a new file (types.rs) with declarations for built-in types.
- Updated Bazel BUILD files to include the new builtins sources.
- Extended the extractor to process the builtins directory during extraction.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
rust/tools/builtins/types.rs | Added declarations for built-in types. |
rust/tools/builtins/BUILD.bazel | Defined a Bazel target for built-ins sources. |
rust/extractor/src/main.rs | Enhanced extractor to include builtins in extraction. |
rust/BUILD.bazel | Updated tools file group to reference built-ins. |
rust/tools/builtins/types.rs
Outdated
struct bool; | ||
// Textual types | ||
struct char; | ||
struct str; | ||
// Integer types | ||
struct i8; | ||
struct i16; | ||
struct i32; | ||
struct i64; | ||
struct i128; | ||
struct u8; | ||
struct u16; | ||
struct u32; | ||
struct u64; | ||
struct u128; | ||
// Machine-dependent integer types | ||
struct usize; | ||
struct isize; | ||
// floating-point types | ||
struct f32; | ||
struct f64; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If these built-in type declarations are intended for use outside their module, consider adding public visibility (e.g., 'pub struct bool;') to ensure they are accessible where needed.
struct bool; | |
// Textual types | |
struct char; | |
struct str; | |
// Integer types | |
struct i8; | |
struct i16; | |
struct i32; | |
struct i64; | |
struct i128; | |
struct u8; | |
struct u16; | |
struct u32; | |
struct u64; | |
struct u128; | |
// Machine-dependent integer types | |
struct usize; | |
struct isize; | |
// floating-point types | |
struct f32; | |
struct f64; | |
pub struct bool; | |
// Textual types | |
pub struct char; | |
pub struct str; | |
// Integer types | |
pub struct i8; | |
pub struct i16; | |
pub struct i32; | |
pub struct i64; | |
pub struct i128; | |
pub struct u8; | |
pub struct u16; | |
pub struct u32; | |
pub struct u64; | |
pub struct u128; | |
// Machine-dependent integer types | |
pub struct usize; | |
pub struct isize; | |
// floating-point types | |
pub struct f32; | |
pub struct f64; |
Copilot uses AI. Check for mistakes.
@@ -276,5 +277,13 @@ fn main() -> anyhow::Result<()> { | |||
} | |||
} | |||
} | |||
let builtins_dir = env::var("CODEQL_EXTRACTOR_RUST_ROOT") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] When iterating over the builtins directory, consider filtering for Rust source files (e.g., files ending with '.rs') to prevent the processing of unrelated files in case extra files are present.
Copilot uses AI. Check for mistakes.
c4aa719
to
e8797ed
Compare
e8797ed
to
8a02f98
Compare
This pull request adds extraction of declarations of built-in types.