Skip to content

Commit

Permalink
Pin memchr to 2.5.0 in the library rather than rustc_ast
Browse files Browse the repository at this point in the history
The latest versions of `memchr` experience LTO-related issues when
compiling for windows-gnu [1], so needs to be pinned. The issue is
present in the standard library.

`memchr` has been pinned in `rustc_ast`, but since the workspace was
recently split, this pin no longer has any effect on library crates.

Resolve this by adding `memchr` as an _unused_ dependency in `std`,
pinned to 2.5. Additionally, remove the pin in `rustc_ast` to allow
non-library crates to upgrade to the latest version.

Link: #127890 [1]
  • Loading branch information
tgross35 committed Sep 24, 2024
1 parent 11e760b commit af33373
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 1 addition & 2 deletions compiler/rustc_ast/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ version = "0.0.0"
edition = "2021"

[dependencies]
# FIXME: bumping memchr to 2.7.1 causes linker errors in MSVC thin-lto
# tidy-alphabetical-start
bitflags = "2.4.1"
memchr = "=2.5.0"
memchr = "2.7.4"
rustc_ast_ir = { path = "../rustc_ast_ir" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_index = { path = "../rustc_index" }
Expand Down
4 changes: 4 additions & 0 deletions library/std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ unwind = { path = "../unwind" }
hashbrown = { version = "0.14", default-features = false, features = [
'rustc-dep-of-std',
] }
# FIXME(#127890): `object` depends on `memchr`, but `memchr` > v2.5 causes
# issues with LTO. This dependency is not used directly, but pin it here so
# it is resolved 2.5. To be removed once rust-lang/rust#127890 is fixed.
memchr = { version = "=2.5.0", default-features = false, features = ["rustc-dep-of-std"] }
std_detect = { path = "../stdarch/crates/std_detect", default-features = false, features = [
'rustc-dep-of-std',
] }
Expand Down

0 comments on commit af33373

Please sign in to comment.