Proposal: Move codegen libraries into rustc libdir subfolder

Currently codegen libraries are placed in sysroot libdir which have some disadvantages like complex path calculation leads to https://github.com/rust-lang/rust/issues/57014 and https://github.com/rust-lang/rust/issues/62496. Also it places codegen libraries into target dir while rustc loads these libraries itself.

I propose to place them into rustc libdir subfolder. This allows to make path calculation simpler and more unified between OSs.

1 Like

Mostly orthogonal, but I wish we have the similar separation in the sources in rust-lang/rust itself. I imagine something like src/runtime for libstd, libcore, libtest, and src/compiler for various rustc bits.

I would also prefer if llvm and other huge repost would be in a different place than the directory where all the sources of the Rust compiler are. I have to use ripgrep+.ignore file to grep for anything in the rust sources because otherwise it tries to go through all LLVM sources which are huge.

Telling a beginner to search for something in the src/ directory isn't as simple as suggesting them to just grep for it. You need to tell them to get ripgrep, add an ignore file, and only then can they properly search the compiler source code..

2 Likes

FWIW I’ve been using rg foo src/lib* to search the standard library and rustc and filter out LLVM. (This not to argue against a change in the directory structure.)

(In this case for searching, git grep works out of the box and won't recurse into submodules.)

How is this happened, that the thread about binaries layout became a thread about sources layout?

1 Like

cc @nikomatsakis this seems like a proposal-in-the-works for a steering meeting?

Splitting up stdlib, sanitizers, and compiler seems like a good idea.