Skip to content

Commit 0ea5a8e

Browse files
committed
Switch repository layout to use a virtual manifest
The current setup has the `Cargo.toml` for `compiler-builtins` at the repository root, which means all support crates and other files are located within the package root. This works for now but is not the cleanest setup since files that should or shouldn't be included in the package need to be configured in `Cargo.toml`. If we eventually merge `libm` development into this repository, it would be nice to make this separation more straightforward. Begin cleaning things up by moving the crate source to a new `compiler-builtins` directory and adding a virtual manifest. For now the `libm` submodule is also moved, but in the future it can likely move back to the top level (ideally `compiler-builtins/src` would contain a symlink to `libm/src/math`, but unfortunately it seems like Cargo does not like something about the submodule + symlink combination).
1 parent db1dca0 commit 0ea5a8e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+95
-91
lines changed

compiler-builtins/.github/workflows/main.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on: [push, pull_request]
44
env:
55
RUSTDOCFLAGS: -Dwarnings
66
RUSTFLAGS: -Dwarnings
7-
RUST_COMPILER_RT_ROOT: ./compiler-rt
87

98
jobs:
109
test:
@@ -133,6 +132,8 @@ jobs:
133132
if: steps.cache-compiler-rt.outputs.cache-hit != 'true'
134133
run: ./ci/download-compiler-rt.sh
135134
shell: bash
135+
- run: echo "RUST_COMPILER_RT_ROOT=$(realpath ./compiler-rt)" >> "$GITHUB_ENV"
136+
shell: bash
136137

137138
# Non-linux tests just use our raw script
138139
- run: ./ci/run.sh ${{ matrix.target }}

compiler-builtins/.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Install Rust (rustup)
2323
run: rustup update nightly --no-self-update && rustup default nightly
2424
- name: Publish `libm` as part of builtins, rather than its own crate
25-
run: rm libm/Cargo.toml
25+
run: rm compiler-builtins/libm/Cargo.toml
2626
- name: Run release-plz
2727
uses: MarcoIeni/[email protected]
2828
env:

compiler-builtins/.gitmodules

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
[submodule "libm"]
2-
path = libm
1+
[submodule "compiler-builtins/libm"]
2+
path = compiler-builtins/libm
33
url = https://github.com/rust-lang/libm.git

compiler-builtins/Cargo.toml

Lines changed: 4 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,16 @@
1-
[package]
2-
authors = ["Jorge Aparicio <[email protected]>"]
3-
name = "compiler_builtins"
4-
version = "0.1.151"
5-
license = "MIT AND Apache-2.0 WITH LLVM-exception AND (MIT OR Apache-2.0)"
6-
readme = "README.md"
7-
repository = "https://github.com/rust-lang/compiler-builtins"
8-
homepage = "https://github.com/rust-lang/compiler-builtins"
9-
documentation = "https://docs.rs/compiler_builtins"
10-
edition = "2021"
11-
description = """
12-
Compiler intrinsics used by the Rust compiler. Also available for other targets
13-
if necessary!
14-
"""
15-
include = [
16-
'/Cargo.toml',
17-
'/build.rs',
18-
'/configure.rs',
19-
'/src/*',
20-
'/examples/*',
21-
'/LICENSE.txt',
22-
'/README.md',
23-
'/compiler-rt/*',
24-
'/libm/src/math/*',
25-
]
26-
links = 'compiler-rt'
27-
28-
[lib]
29-
test = false
30-
31-
[dependencies]
32-
# For more information on this dependency see
33-
# https://github.com/rust-lang/rust/tree/master/library/rustc-std-workspace-core
34-
core = { version = "1.0.0", optional = true, package = 'rustc-std-workspace-core' }
35-
36-
[build-dependencies]
37-
cc = { optional = true, version = "1.0" }
38-
39-
[dev-dependencies]
40-
panic-handler = { path = 'crates/panic-handler' }
41-
42-
[features]
43-
default = ["compiler-builtins"]
44-
45-
# Enable compilation of C code in compiler-rt, filling in some more optimized
46-
# implementations and also filling in unimplemented intrinsics
47-
c = ["cc"]
48-
49-
# Workaround for the Cranelift codegen backend. Disables any implementations
50-
# which use inline assembly and fall back to pure Rust versions (if avalible).
51-
no-asm = []
52-
53-
# Workaround for codegen backends which haven't yet implemented `f16` and
54-
# `f128` support. Disabled any intrinsics which use those types.
55-
no-f16-f128 = []
56-
57-
# Flag this library as the unstable compiler-builtins lib
58-
compiler-builtins = []
59-
60-
# Generate memory-related intrinsics like memcpy
61-
mem = []
62-
63-
# Mangle all names so this can be linked in with other versions or other
64-
# compiler-rt implementations. Also used for testing
65-
mangled-names = []
66-
67-
# Only used in the compiler's build system
68-
rustc-dep-of-std = ['compiler-builtins', 'core']
69-
70-
# This makes certain traits and function specializations public that
71-
# are not normally public but are required by the `testcrate`
72-
public-test-deps = []
73-
741
[workspace]
75-
resolver = "2"
2+
resolver = "3"
763
members = [
77-
# Note that builtins-test-intrinsics cannot be a default member because it
4+
# Note that builtins-test-intrinsics cannot be a default member because it
785
# needs the `mangled-names` feature disabled, while `testcrate` needs it
796
# enabled.
807
"builtins-test-intrinsics",
8+
"compiler-builtins",
819
"testcrate",
8210
]
8311

8412
default-members = [
85-
".",
13+
"compiler-builtins",
8614
"testcrate",
8715
]
8816

compiler-builtins/builtins-test-intrinsics/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ edition = "2021"
55
publish = false
66

77
[dependencies]
8-
compiler_builtins = { path = "../", features = ["compiler-builtins"]}
8+
compiler_builtins = { path = "../compiler-builtins", features = ["compiler-builtins"]}
99
panic-handler = { path = '../crates/panic-handler' }
1010

1111
[features]

compiler-builtins/builtins-test-intrinsics/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
mod builtins_configure {
2-
include!("../configure.rs");
2+
include!("../compiler-builtins/configure.rs");
33
}
44

55
fn main() {

compiler-builtins/ci/run-docker.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ run() {
3838
fi
3939

4040
if [ -d compiler-rt ]; then
41-
export RUST_COMPILER_RT_ROOT=./compiler-rt
41+
export RUST_COMPILER_RT_ROOT="/checkout/compiler-rt"
4242
fi
4343

4444
if [ "${GITHUB_ACTIONS:-}" = "true" ]; then

compiler-builtins/ci/run.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fi
2323
if [ "${NO_STD:-}" = "1" ]; then
2424
echo "nothing to do for no_std"
2525
else
26-
run="cargo test --manifest-path testcrate/Cargo.toml --no-fail-fast --target $target"
26+
run="cargo test --package testcrate --no-fail-fast --target $target"
2727
$run
2828
$run --release
2929
$run --features c
@@ -38,7 +38,7 @@ fi
3838

3939
if [ "${TEST_VERBATIM:-}" = "1" ]; then
4040
verb_path=$(cmd.exe //C echo \\\\?\\%cd%\\testcrate\\target2)
41-
cargo build --manifest-path testcrate/Cargo.toml \
41+
cargo build --package testcrate \
4242
--target "$target" --target-dir "$verb_path" --features c
4343
fi
4444

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
[package]
2+
authors = ["Jorge Aparicio <[email protected]>"]
3+
name = "compiler_builtins"
4+
version = "0.1.151"
5+
license = "MIT AND Apache-2.0 WITH LLVM-exception AND (MIT OR Apache-2.0)"
6+
readme = "../README.md"
7+
repository = "https://github.com/rust-lang/compiler-builtins"
8+
homepage = "https://github.com/rust-lang/compiler-builtins"
9+
documentation = "https://docs.rs/compiler_builtins"
10+
edition = "2021"
11+
description = """
12+
Compiler intrinsics used by the Rust compiler. Also available for other targets
13+
if necessary!
14+
"""
15+
include = [
16+
'/Cargo.toml',
17+
'/build.rs',
18+
'/configure.rs',
19+
'/src/*',
20+
'../LICENSE.txt',
21+
'../README.md',
22+
'../compiler-rt/*',
23+
'libm/src/math/*',
24+
]
25+
links = 'compiler-rt'
26+
27+
[lib]
28+
test = false
29+
bench = false
30+
31+
[dependencies]
32+
# For more information on this dependency see
33+
# https://github.com/rust-lang/rust/tree/master/library/rustc-std-workspace-core
34+
core = { version = "1.0.0", optional = true, package = 'rustc-std-workspace-core' }
35+
36+
[build-dependencies]
37+
cc = { optional = true, version = "1.0" }
38+
39+
[dev-dependencies]
40+
panic-handler = { path = '../crates/panic-handler' }
41+
42+
[features]
43+
default = ["compiler-builtins"]
44+
45+
# Enable compilation of C code in compiler-rt, filling in some more optimized
46+
# implementations and also filling in unimplemented intrinsics
47+
c = ["cc"]
48+
49+
# Workaround for the Cranelift codegen backend. Disables any implementations
50+
# which use inline assembly and fall back to pure Rust versions (if avalible).
51+
no-asm = []
52+
53+
# Workaround for codegen backends which haven't yet implemented `f16` and
54+
# `f128` support. Disabled any intrinsics which use those types.
55+
no-f16-f128 = []
56+
57+
# Flag this library as the unstable compiler-builtins lib
58+
compiler-builtins = []
59+
60+
# Generate memory-related intrinsics like memcpy
61+
mem = []
62+
63+
# Mangle all names so this can be linked in with other versions or other
64+
# compiler-rt implementations. Also used for testing
65+
mangled-names = []
66+
67+
# Only used in the compiler's build system
68+
rustc-dep-of-std = ['compiler-builtins', 'core']
69+
70+
# This makes certain traits and function specializations public that
71+
# are not normally public but are required by the `testcrate`
72+
public-test-deps = []

compiler-builtins/build.rs renamed to compiler-builtins/compiler-builtins/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
use std::{collections::BTreeMap, env, path::PathBuf, sync::atomic::Ordering};
2-
31
mod configure;
42

3+
use std::{collections::BTreeMap, env, path::PathBuf, sync::atomic::Ordering};
4+
55
use configure::{configure_aliases, configure_f16_f128, Target};
66

77
fn main() {
File renamed without changes.

compiler-builtins/src/lib.rs renamed to compiler-builtins/compiler-builtins/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ pub mod int;
4444
pub mod math;
4545
pub mod mem;
4646

47-
// `libm` expects its `support` module to be available in the crate root. This config can be
48-
// cleaned up once `libm` is made always available.
47+
// `libm` expects its `support` module to be available in the crate root.
4948
use math::libm::support;
5049

5150
#[cfg(target_arch = "arm")]

compiler-builtins/crates/panic-handler/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,8 @@ authors = ["Alex Crichton <[email protected]>"]
55
edition = "2024"
66
publish = false
77

8+
[lib]
9+
test = false
10+
bench = false
11+
812
[dependencies]

compiler-builtins/testcrate/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ rand_xoshiro = "0.6"
1818
rustc_apfloat = "0.2.1"
1919

2020
[dependencies.compiler_builtins]
21-
path = ".."
21+
path = "../compiler-builtins"
2222
default-features = false
2323
features = ["public-test-deps"]
2424

compiler-builtins/testcrate/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::collections::HashSet;
22

33
mod builtins_configure {
4-
include!("../configure.rs");
4+
include!("../compiler-builtins/configure.rs");
55
}
66

77
/// Features to enable

0 commit comments

Comments
 (0)