René's URL Explorer Experiment


Title: Fix std::array default initializer generating empty Vec instead of sized Vec by Copilot · Pull Request #337 · Cpp2Rust/cpp2rust · GitHub

Open Graph Title: Fix std::array default initializer generating empty Vec instead of sized Vec by Copilot · Pull Request #337 · Cpp2Rust/cpp2rust

X Title: Fix std::array default initializer generating empty Vec instead of sized Vec by Copilot · Pull Request #337 · Cpp2Rust/cpp2rust

Description: std::array v = {}; incorrectly generated vec![] (0 elements) instead of a 3-element vector with default values. Root Cause Clang represents an empty-brace std::array initializer as an ImplicitValueInitExpr rather than a nested InitListExpr. The std::array handling in VisitInitListExpr only special-cased the nested-InitListExpr case and fell back to hardcoding an empty [] for anything else, silently dropping the array size. Changes Converter::VisitInitListExpr (cpp2rust/converter/converter.cpp): when the initializer for std::array isn't an InitListExpr, emit GetArrayDefaultAsString(qual_type) instead of a hardcoded []. This reuses the existing helper that already correctly resolves the array's template size argument. ConverterRefCount::VisitInitListExpr (cpp2rust/converter/models/converter_refcount.cpp): same fix applied to the refcount model variant. Test fixtures: updated tests/unit/out/{unsafe,refcount}/empty_array_init.rs to reflect the corrected output. Example std::array v = {}; Before: let mut v: Vec = vec![]; After: let mut v: Vec = std::array::from_fn::<_, 3, _>(|_| Default::default()).to_vec(); Fixes #313

Open Graph Description: std::array<int, 3> v = {}; incorrectly generated vec![] (0 elements) instead of a 3-element vector with default values. Root Cause Clang represents an empty-brace std::array initializer as an...

X Description: std::array&lt;int, 3&gt; v = {}; incorrectly generated vec![] (0 elements) instead of a 3-element vector with default values. Root Cause Clang represents an empty-brace std::array initializ...

Opengraph URL: https://github.com/Cpp2Rust/cpp2rust/pull/337

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:e01a4e80-bae3-0204-cd90-122670cb2b62
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idD9F8:2C69FC:24DA380:30A549C:6B025DA0
html-safe-nonce8f5595decc0580528055046d00fbc9a8d08a8484010d4b9b6100c37f3741cbb0
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOUY4OjJDNjlGQzoyNERBMzgwOjMwQTU0OUM6NkIwMjVEQTAiLCJ2aXNpdG9yX2lkIjoiNDEzMzI1OTE4OTIzNTYzNzY2NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac49744974458894e06e8b0a03e63a5a2c87ef612c170ad61a61f0d8fda29cc3ce
hovercard-subject-tagpull_request:4472156340
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/Cpp2Rust/cpp2rust/pull/337/files
twitter:imagehttps://avatars.githubusercontent.com/in/1143301?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/in/1143301?s=400&v=4
og:image:altstd::array<int, 3> v = {}; incorrectly generated vec![] (0 elements) instead of a 3-element vector with default values. Root Cause Clang represents an empty-brace std::array initializer as an...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/Cpp2Rust/cpp2rust git https://github.com/Cpp2Rust/cpp2rust.git
octolytics-dimension-user_id197474191
octolytics-dimension-user_loginCpp2Rust
octolytics-dimension-repository_id1183095779
octolytics-dimension-repository_nwoCpp2Rust/cpp2rust
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1183095779
octolytics-dimension-repository_network_root_nwoCpp2Rust/cpp2rust
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/Cpp2Rust/cpp2rust/pull/337/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FCpp2Rust%2Fcpp2rust%2Fpull%2F337%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FCpp2Rust%2Fcpp2rust%2Fpull%2F337%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=Cpp2Rust%2Fcpp2rust
Reloadhttps://github.com/Cpp2Rust/cpp2rust/pull/337/files
Reloadhttps://github.com/Cpp2Rust/cpp2rust/pull/337/files
Reloadhttps://github.com/Cpp2Rust/cpp2rust/pull/337/files
Cpp2Rusthttps://github.com/Cpp2Rust
cpp2rusthttps://github.com/Cpp2Rust/cpp2rust
Codehttps://github.com/Cpp2Rust/cpp2rust
Issues21 (21)https://github.com/Cpp2Rust/cpp2rust/issues
Pull requestshttps://github.com/Cpp2Rust/cpp2rust/pulls
Actionshttps://github.com/Cpp2Rust/cpp2rust/actions
Security and qualityhttps://github.com/Cpp2Rust/cpp2rust/security
Insightshttps://github.com/Cpp2Rust/cpp2rust/insights
Sign up for GitHub https://github.com/signup?return_to=%2FCpp2Rust%2Fcpp2rust%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2FCpp2Rust%2Fcpp2rust%2Fissues%2Fnew%2Fchoose
nunoplopeshttps://github.com/nunoplopes
masterhttps://github.com/Cpp2Rust/cpp2rust/tree/master
copilot/fix-std-array-default-initializerhttps://github.com/Cpp2Rust/cpp2rust/tree/copilot/fix-std-array-default-initializer
Conversation 0 https://github.com/Cpp2Rust/cpp2rust/pull/337
Commits 3 https://github.com/Cpp2Rust/cpp2rust/pull/337/commits
Checks 9 https://github.com/Cpp2Rust/cpp2rust/pull/337/checks
Files changed https://github.com/Cpp2Rust/cpp2rust/pull/337/files
Please reload this pagehttps://github.com/Cpp2Rust/cpp2rust/pull/337/files
Fix std::array default initializer generating empty Vec instead of sized Vec https://github.com/Cpp2Rust/cpp2rust/pull/337/files#top
Show all changes 3 commits https://github.com/Cpp2Rust/cpp2rust/pull/337/files
1702d66 Initial plan Copilot Sep 8, 2026 https://github.com/Cpp2Rust/cpp2rust/pull/337/commits/1702d66a93edf5ffdf80b5bb749aa734bad2fa2e
f4264d4 Fix std::array empty-brace default initializer size Copilot Sep 8, 2026 https://github.com/Cpp2Rust/cpp2rust/pull/337/commits/f4264d4b989cda9b3e1bdf78af80f278a8f328c1
9735d52 Update expected test outputs for std::array default init fix Copilot Sep 8, 2026 https://github.com/Cpp2Rust/cpp2rust/pull/337/commits/9735d5257fb5a51de95b407479339f315ed95ed4
Clear filters https://github.com/Cpp2Rust/cpp2rust/pull/337/files
Please reload this pagehttps://github.com/Cpp2Rust/cpp2rust/pull/337/files
Please reload this pagehttps://github.com/Cpp2Rust/cpp2rust/pull/337/files
converter.cpp https://github.com/Cpp2Rust/cpp2rust/pull/337/files#diff-87f37877b158de5c88f4955ff97b30bfebd1e30d15052089259f15f0bff6ad9d
converter_refcount.cpp https://github.com/Cpp2Rust/cpp2rust/pull/337/files#diff-086dd5a19fe4ea5036115bfcb7eb45e4917c9e89ef6adacdc381aa4bff56e98a
empty_array_init.rs https://github.com/Cpp2Rust/cpp2rust/pull/337/files#diff-dd911db47d80941dbf4a7cb088d026d4a1c9f1963633156a2230a8b69d1040da
empty_array_init.rs https://github.com/Cpp2Rust/cpp2rust/pull/337/files#diff-dbfb639ac2067bad146b1d7bd6380e68c0a43b80cb693ef8bf95d7f0895b0a0e
cpp2rust/converter/converter.cpphttps://github.com/Cpp2Rust/cpp2rust/pull/337/files#diff-87f37877b158de5c88f4955ff97b30bfebd1e30d15052089259f15f0bff6ad9d
View file https://github.com/Cpp2Rust/cpp2rust/blob/9735d5257fb5a51de95b407479339f315ed95ed4/cpp2rust/converter/converter.cpp
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/Cpp2Rust/cpp2rust/pull/337/{{ revealButtonHref }}
https://github.com/Cpp2Rust/cpp2rust/pull/337/files#diff-87f37877b158de5c88f4955ff97b30bfebd1e30d15052089259f15f0bff6ad9d
https://github.com/Cpp2Rust/cpp2rust/pull/337/files#diff-87f37877b158de5c88f4955ff97b30bfebd1e30d15052089259f15f0bff6ad9d
cpp2rust/converter/models/converter_refcount.cpphttps://github.com/Cpp2Rust/cpp2rust/pull/337/files#diff-086dd5a19fe4ea5036115bfcb7eb45e4917c9e89ef6adacdc381aa4bff56e98a
View file https://github.com/Cpp2Rust/cpp2rust/blob/9735d5257fb5a51de95b407479339f315ed95ed4/cpp2rust/converter/models/converter_refcount.cpp
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/Cpp2Rust/cpp2rust/pull/337/{{ revealButtonHref }}
https://github.com/Cpp2Rust/cpp2rust/pull/337/files#diff-086dd5a19fe4ea5036115bfcb7eb45e4917c9e89ef6adacdc381aa4bff56e98a
https://github.com/Cpp2Rust/cpp2rust/pull/337/files#diff-086dd5a19fe4ea5036115bfcb7eb45e4917c9e89ef6adacdc381aa4bff56e98a
tests/unit/out/refcount/empty_array_init.rshttps://github.com/Cpp2Rust/cpp2rust/pull/337/files#diff-dd911db47d80941dbf4a7cb088d026d4a1c9f1963633156a2230a8b69d1040da
View file https://github.com/Cpp2Rust/cpp2rust/blob/9735d5257fb5a51de95b407479339f315ed95ed4/tests/unit/out/refcount/empty_array_init.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/Cpp2Rust/cpp2rust/pull/337/{{ revealButtonHref }}
https://github.com/Cpp2Rust/cpp2rust/pull/337/files#diff-dd911db47d80941dbf4a7cb088d026d4a1c9f1963633156a2230a8b69d1040da
tests/unit/out/unsafe/empty_array_init.rshttps://github.com/Cpp2Rust/cpp2rust/pull/337/files#diff-dbfb639ac2067bad146b1d7bd6380e68c0a43b80cb693ef8bf95d7f0895b0a0e
View file https://github.com/Cpp2Rust/cpp2rust/blob/9735d5257fb5a51de95b407479339f315ed95ed4/tests/unit/out/unsafe/empty_array_init.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/Cpp2Rust/cpp2rust/pull/337/{{ revealButtonHref }}
https://github.com/Cpp2Rust/cpp2rust/pull/337/files#diff-dbfb639ac2067bad146b1d7bd6380e68c0a43b80cb693ef8bf95d7f0895b0a0e
Please reload this pagehttps://github.com/Cpp2Rust/cpp2rust/pull/337/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.