Skip to content

Conversation

@ahomescu
Copy link
Contributor

@ahomescu ahomescu commented Oct 7, 2025

Add an extra step to reorganize_definitions that checks for every path if it is already imported into the current module, and uses the short import instead of the fully qualified path. E.g.

use crate::foo::Bar;
// Was: fn foo(x: crate::foo::Bar) {}
fn foo(x: Bar) {}

@ahomescu ahomescu requested a review from fw-immunant October 7, 2025 22:50
@ahomescu ahomescu force-pushed the ahomescu/reorganize_shorten_paths branch from 6aa13a0 to 21dd85a Compare October 8, 2025 23:03
@ahomescu ahomescu force-pushed the ahomescu/fix_reorganize_definitions branch from 6d527b1 to 8edb5f0 Compare October 8, 2025 23:03
@ahomescu ahomescu force-pushed the ahomescu/reorganize_shorten_paths branch from 21dd85a to 734be7a Compare October 8, 2025 23:10
@ahomescu ahomescu force-pushed the ahomescu/fix_reorganize_definitions branch from 8edb5f0 to b6d2c9e Compare October 8, 2025 23:10
@ahomescu ahomescu force-pushed the ahomescu/reorganize_shorten_paths branch from 734be7a to 92dd2e9 Compare October 8, 2025 23:13
@ahomescu ahomescu force-pushed the ahomescu/fix_reorganize_definitions branch 2 times, most recently from cd518be to 9804b07 Compare October 8, 2025 23:20
@ahomescu ahomescu force-pushed the ahomescu/reorganize_shorten_paths branch from 92dd2e9 to 7752cc3 Compare October 8, 2025 23:20
@ahomescu ahomescu force-pushed the ahomescu/reorganize_shorten_paths branch from 7752cc3 to f5a88e8 Compare October 14, 2025 21:01
@ahomescu ahomescu force-pushed the ahomescu/fix_reorganize_definitions branch from 9804b07 to 9b5ba1b Compare October 14, 2025 21:01
Base automatically changed from ahomescu/fix_reorganize_definitions to master October 14, 2025 22:34
Copy link
Contributor

@fw-immunant fw-immunant left a comment

Choose a reason for hiding this comment

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

Needs a rebase. Changes in the only commit not on master look good, but I agree with @kkysen that it would be nice to have this in a separate pass.

@ahomescu ahomescu force-pushed the ahomescu/reorganize_shorten_paths branch from f5a88e8 to 2501630 Compare October 28, 2025 02:22
@ahomescu
Copy link
Contributor Author

I agree with @kkysen that it would be nice to have this in a separate pass.

I'm not against splitting it, I just have to figure out how to do that. The current implementation uses a lot of internal state from reorganize_definitions.

Copy link
Contributor

@kkysen kkysen left a comment

Choose a reason for hiding this comment

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

@ahomescu, did you see my earlier comment here #1408 (comment)?

@fw-immunant
Copy link
Contributor

While this would be really useful as its own transform, since it appears that would be a substantial effort I'd vote in favor of going ahead and merging as-is this to benefit from it as part of reorganize_definitions in the meantime.

@ahomescu
Copy link
Contributor Author

@ahomescu, did you see my earlier comment here #1408 (comment)?

Sorry, I missed it until now. Do we still want to try that?

@kkysen kkysen force-pushed the ahomescu/reorganize_shorten_paths branch from 2501630 to cd18999 Compare December 7, 2025 20:58
Copy link
Contributor

@kkysen kkysen left a comment

Choose a reason for hiding this comment

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

This doesn't seem to be working in CI. I still see plenty of ::core::ffi::c_uints instead of use ::core::ffi::c_uint;, c_uint.

@ahomescu
Copy link
Contributor Author

Most recent offline discussion: @kkysen and I agreed that it makes sense to split this off into a separate transform, which would also fix some bugs with scoping and aliases.

@ahomescu ahomescu force-pushed the ahomescu/reorganize_shorten_paths branch from cd18999 to 66debbf Compare December 18, 2025 06:17
@ahomescu
Copy link
Contributor Author

I moved this to a separate transform.

@ahomescu ahomescu force-pushed the ahomescu/reorganize_shorten_paths branch from 66debbf to db5542c Compare December 18, 2025 06:23
@ahomescu ahomescu force-pushed the ahomescu/reorganize_shorten_paths branch from db5542c to 5b24f4e Compare December 18, 2025 06:31
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