Skip to content

Conversation

sanxiyn
Copy link
Contributor

@sanxiyn sanxiyn commented Nov 19, 2013

No description provided.

@alexcrichton
Copy link
Member

Out of curiosity, was this done to reduce memory usage? If so, do you have numbers for before/after?

@sanxiyn
Copy link
Contributor Author

sanxiyn commented Nov 19, 2013

I get 1410 MiB before and 1397 MiB after for librustc compile, so 13 MiB less on x86-64 Linux. Not a lot, but the patch is tiny.

@brson
Copy link
Contributor

brson commented Nov 19, 2013

@sanxiyn Can you add a comment explaining why u32 is picked there to prevent anybody from changing it back?

@bill-myers
Copy link
Contributor

What if the file is larger than 4GB (e.g. it contains lots of static data), which can happen on 32-bit platforms too? Shouldn't it be u64 instead?

@sanxiyn
Copy link
Contributor Author

sanxiyn commented Nov 20, 2013

@brson A comment added. @bill-myers I don't think anyone will compile 4 GiB compilation unit soon.

@huonw
Copy link
Contributor

huonw commented Nov 20, 2013

And, if one is trying to compile a 4+GB file, the resulting internal compiler datastructures will certainly be much larger than 4GB, i.e. not possible on 32-bit anyway. (E.g. there's 3MB of Rust source in librustc, which becomes 1400MB during compilation.)

@bors bors closed this Nov 21, 2013
@bors bors merged commit f4c1f49 into rust-lang:master Nov 21, 2013
@sanxiyn sanxiyn deleted the bytepos branch November 21, 2013 09:59
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jun 30, 2023
…derscore, r=dswij

Emit `unnecessary_cast` on raw pointers as well

Supersedes(?) rust-lang#10782, since this and rust-lang#10567 will cover the original issue.
Does not lint on type aliases or inferred types.

changelog: [`unnecessary_cast`]: Also emit on casts between raw pointers with the same type and constness
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.

6 participants