Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
override: true

- name: Downgrade phf to a version compatible with the MSRV
run: cargo update --package phf:0.11.0 --precise 0.10.1
run: cargo update --package phf --precise 0.10.1
if: matrix.toolchain == '1.40.0'

- name: Cargo build
Expand Down
4 changes: 4 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,9 @@ fn main() {
println!("cargo:rustc-cfg=rustc_has_pr45225")
}

if std::mem::size_of::<std::borrow::Cow<'static, str>>() == 24 {
println!("cargo:rustc-cfg=rustc_has_better_cow_layout")
}

codegen::main();
}
12 changes: 9 additions & 3 deletions src/size_of_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ macro_rules! size_of_test {

// Some of these assume 64-bit
size_of_test!(token, Token, 32);
size_of_test!(std_cow_str, Cow<'static, str>, 32);
size_of_test!(std_cow_str, Cow<'static, str>, if cfg!(rustc_has_better_cow_layout) { 24 } else { 32 });
size_of_test!(cow_rc_str, CowRcStr, 16);

size_of_test!(tokenizer, crate::tokenizer::Tokenizer, 72);
Expand All @@ -51,9 +51,15 @@ size_of_test!(parser, crate::parser::Parser, 16);
size_of_test!(source_position, crate::SourcePosition, 8);
size_of_test!(parser_state, crate::ParserState, 24);

size_of_test!(basic_parse_error, crate::BasicParseError, 48);
size_of_test!(basic_parse_error, crate::BasicParseError, if cfg!(rustc_has_better_cow_layout) { 40 } else { 48 });
size_of_test!(
parse_error_lower_bound,
crate::ParseError<()>,
if cfg!(rustc_has_pr45225) { 48 } else { 56 }
if cfg!(rustc_has_better_cow_layout) {
40
} else if cfg!(rustc_has_pr45225) {
48
} else {
56
}
);