Skip to content

Commit 7df82ce

Browse files
committed
Remove check for std::borrow::Cow optimization
1 parent 7838555 commit 7df82ce

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

build.rs

-4
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,5 @@ fn main() {
4242
println!("cargo:rustc-cfg=rustc_has_pr45225")
4343
}
4444

45-
if std::mem::size_of::<std::borrow::Cow<'static, str>>() == 24 {
46-
println!("cargo:rustc-cfg=rustc_has_better_cow_layout")
47-
}
48-
4945
codegen::main();
5046
}

src/size_of_tests.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
* License, v. 2.0. If a copy of the MPL was not distributed with this
33
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
44

5-
use crate::cow_rc_str::CowRcStr;
65
use crate::tokenizer::Token;
7-
use std::borrow::Cow;
86

97
macro_rules! size_of_test {
108
($testname: ident, $t: ty, $expected_size: expr) => {
@@ -38,8 +36,6 @@ macro_rules! size_of_test {
3836

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

4440
size_of_test!(tokenizer, crate::tokenizer::Tokenizer, 72);
4541
size_of_test!(
@@ -51,14 +47,12 @@ size_of_test!(parser, crate::parser::Parser, 16);
5147
size_of_test!(source_position, crate::SourcePosition, 8);
5248
size_of_test!(parser_state, crate::ParserState, 24);
5349

54-
size_of_test!(basic_parse_error, crate::BasicParseError, if cfg!(rustc_has_better_cow_layout) { 40 } else { 48 });
50+
size_of_test!(basic_parse_error, crate::BasicParseError, 40);
5551
size_of_test!(
5652
parse_error_lower_bound,
5753
crate::ParseError<()>,
58-
if cfg!(rustc_has_better_cow_layout) {
54+
if cfg!(rustc_has_pr45225) {
5955
40
60-
} else if cfg!(rustc_has_pr45225) {
61-
48
6256
} else {
6357
56
6458
}

0 commit comments

Comments
 (0)