Skip to content
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

rustc: Use rust strings for failure arguments #14451

Merged
merged 1 commit into from
May 29, 2014

Conversation

alexcrichton
Copy link
Member

This avoids having to perform conversions from *u8 to &'static str which can
suck in a good deal of code.

Closes #14442

begin_unwind(args, file, line);
}, "{}", expr);

loop {}
Copy link
Member

Choose a reason for hiding this comment

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

Would this be better using the abort intrinsic?

@alexcrichton
Copy link
Member Author

Updated to use abort

Store(bcx, s, slot);

// The type of C_str_slice is { i8*, i64 }, but the type of the &str is
// %str_slice, so we do a bitcast here to the right type.
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible to construct a %str_slice directly?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not that I could find easily, but I'm also quite unfamiliar with trans so I'm likely doing something wrong here...

@huonw
Copy link
Member

huonw commented May 27, 2014

How much difference does this make for the empty application @bharrisau mentions in #14442?

@bharrisau
Copy link
Contributor

I'll build it and give it a go tonight.

This avoids having to perform conversions from `*u8` to `&'static str` which can
suck in a good deal of code.

Closes rust-lang#14442
@bharrisau
Copy link
Contributor

Or maybe I'll spend all night arguing with btrfs about what experimental means.

@bharrisau
Copy link
Contributor

Size is improved from 7576 bytes to 7000 bytes. The format_args! is still pulling in char::char.Char::encode_utf8 plus some StrSlice methods which increase the size. If the format_args! arguments are removed and the string is made zero length the size drops to 1984 bytes.

So this is definitely solving half the problem.

Edit: ~1.3kB of the remaining size is from the failure strings and arguments (file names, etc). ~3.7kB is from secret_show and the string handling stuff. I'm not sure what is pulling in the secret_show, it isn't called from the failure functions (digging through the asm). I'm still chasing that down.

bors added a commit that referenced this pull request May 29, 2014
This avoids having to perform conversions from `*u8` to `&'static str` which can
suck in a good deal of code.

Closes #14442
@bors bors closed this May 29, 2014
@bors bors merged commit 5c1a70d into rust-lang:master May 29, 2014
@alexcrichton alexcrichton deleted the issue-14442 branch May 30, 2014 05:31
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 5, 2023
minor: Bump smol_str

Should slightly improve compile times by it now not depending on serde (rowan and syntax in turn not either)
flip1995 added a commit to flip1995/rust that referenced this pull request Apr 3, 2025
This PR enables the new ability to collapse `if` statements containing
comments (without losing them) in Clippy sources, excluding tests and
lintcheck, where the default behaviour (no collapsing in presence of
comments) is preserved.

To be applied after rust-lang#14231. When it is applied, rust-lang#14455 will be marked as
ready for review, then rust-lang#14228 afterwards.

changelog: none

r? ghost
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.

Support smaller failure in libcore
5 participants