Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch repository layout to use a virtual manifest #702

Merged
merged 1 commit into from
Mar 19, 2025
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
3 changes: 2 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on: [push, pull_request]
env:
RUSTDOCFLAGS: -Dwarnings
RUSTFLAGS: -Dwarnings
RUST_COMPILER_RT_ROOT: ./compiler-rt

jobs:
test:
Expand Down Expand Up @@ -133,6 +132,8 @@ jobs:
if: steps.cache-compiler-rt.outputs.cache-hit != 'true'
run: ./ci/download-compiler-rt.sh
shell: bash
- run: echo "RUST_COMPILER_RT_ROOT=$(realpath ./compiler-rt)" >> "$GITHUB_ENV"
shell: bash

# Non-linux tests just use our raw script
- run: ./ci/run.sh ${{ matrix.target }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Install Rust (rustup)
run: rustup update nightly --no-self-update && rustup default nightly
- name: Publish `libm` as part of builtins, rather than its own crate
run: rm libm/Cargo.toml
run: rm compiler-builtins/libm/Cargo.toml
- name: Run release-plz
uses: MarcoIeni/[email protected]
env:
Expand Down
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "libm"]
path = libm
[submodule "compiler-builtins/libm"]
path = compiler-builtins/libm
url = https://github.com/rust-lang/libm.git
80 changes: 4 additions & 76 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,88 +1,16 @@
[package]
authors = ["Jorge Aparicio <[email protected]>"]
name = "compiler_builtins"
version = "0.1.151"
license = "MIT AND Apache-2.0 WITH LLVM-exception AND (MIT OR Apache-2.0)"
readme = "README.md"
repository = "https://github.com/rust-lang/compiler-builtins"
homepage = "https://github.com/rust-lang/compiler-builtins"
documentation = "https://docs.rs/compiler_builtins"
edition = "2021"
description = """
Compiler intrinsics used by the Rust compiler. Also available for other targets
if necessary!
"""
include = [
'/Cargo.toml',
'/build.rs',
'/configure.rs',
'/src/*',
'/examples/*',
'/LICENSE.txt',
'/README.md',
'/compiler-rt/*',
'/libm/src/math/*',
]
links = 'compiler-rt'

[lib]
test = false

[dependencies]
# For more information on this dependency see
# https://github.com/rust-lang/rust/tree/master/library/rustc-std-workspace-core
core = { version = "1.0.0", optional = true, package = 'rustc-std-workspace-core' }

[build-dependencies]
cc = { optional = true, version = "1.0" }

[dev-dependencies]
panic-handler = { path = 'crates/panic-handler' }

[features]
default = ["compiler-builtins"]

# Enable compilation of C code in compiler-rt, filling in some more optimized
# implementations and also filling in unimplemented intrinsics
c = ["cc"]

# Workaround for the Cranelift codegen backend. Disables any implementations
# which use inline assembly and fall back to pure Rust versions (if avalible).
no-asm = []

# Workaround for codegen backends which haven't yet implemented `f16` and
# `f128` support. Disabled any intrinsics which use those types.
no-f16-f128 = []

# Flag this library as the unstable compiler-builtins lib
compiler-builtins = []

# Generate memory-related intrinsics like memcpy
mem = []

# Mangle all names so this can be linked in with other versions or other
# compiler-rt implementations. Also used for testing
mangled-names = []

# Only used in the compiler's build system
rustc-dep-of-std = ['compiler-builtins', 'core']

# This makes certain traits and function specializations public that
# are not normally public but are required by the `testcrate`
public-test-deps = []

[workspace]
resolver = "2"
resolver = "3"
members = [
# Note that builtins-test-intrinsics cannot be a default member because it
# Note that builtins-test-intrinsics cannot be a default member because it
# needs the `mangled-names` feature disabled, while `testcrate` needs it
# enabled.
"builtins-test-intrinsics",
"compiler-builtins",
"testcrate",
]

default-members = [
".",
"compiler-builtins",
"testcrate",
]

Expand Down
2 changes: 1 addition & 1 deletion builtins-test-intrinsics/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2021"
publish = false

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

[features]
Expand Down
2 changes: 1 addition & 1 deletion builtins-test-intrinsics/build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mod builtins_configure {
include!("../configure.rs");
include!("../compiler-builtins/configure.rs");
}

fn main() {
Expand Down
2 changes: 1 addition & 1 deletion ci/run-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ run() {
fi

if [ -d compiler-rt ]; then
export RUST_COMPILER_RT_ROOT=./compiler-rt
export RUST_COMPILER_RT_ROOT="/checkout/compiler-rt"
fi

if [ "${GITHUB_ACTIONS:-}" = "true" ]; then
Expand Down
4 changes: 2 additions & 2 deletions ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fi
if [ "${NO_STD:-}" = "1" ]; then
echo "nothing to do for no_std"
else
run="cargo test --manifest-path testcrate/Cargo.toml --no-fail-fast --target $target"
run="cargo test --package testcrate --no-fail-fast --target $target"
$run
$run --release
$run --features c
Expand All @@ -38,7 +38,7 @@ fi

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

Expand Down
72 changes: 72 additions & 0 deletions compiler-builtins/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
[package]
authors = ["Jorge Aparicio <[email protected]>"]
name = "compiler_builtins"
version = "0.1.151"
license = "MIT AND Apache-2.0 WITH LLVM-exception AND (MIT OR Apache-2.0)"
readme = "../README.md"
repository = "https://github.com/rust-lang/compiler-builtins"
homepage = "https://github.com/rust-lang/compiler-builtins"
documentation = "https://docs.rs/compiler_builtins"
edition = "2021"
description = """
Compiler intrinsics used by the Rust compiler. Also available for other targets
if necessary!
"""
include = [
'/Cargo.toml',
'/build.rs',
'/configure.rs',
'/src/*',
'../LICENSE.txt',
'../README.md',
'../compiler-rt/*',
'libm/src/math/*',
]
links = 'compiler-rt'

[lib]
test = false
bench = false

[dependencies]
# For more information on this dependency see
# https://github.com/rust-lang/rust/tree/master/library/rustc-std-workspace-core
core = { version = "1.0.0", optional = true, package = 'rustc-std-workspace-core' }

[build-dependencies]
cc = { optional = true, version = "1.0" }

[dev-dependencies]
panic-handler = { path = '../crates/panic-handler' }

[features]
default = ["compiler-builtins"]

# Enable compilation of C code in compiler-rt, filling in some more optimized
# implementations and also filling in unimplemented intrinsics
c = ["cc"]

# Workaround for the Cranelift codegen backend. Disables any implementations
# which use inline assembly and fall back to pure Rust versions (if avalible).
no-asm = []

# Workaround for codegen backends which haven't yet implemented `f16` and
# `f128` support. Disabled any intrinsics which use those types.
no-f16-f128 = []

# Flag this library as the unstable compiler-builtins lib
compiler-builtins = []

# Generate memory-related intrinsics like memcpy
mem = []

# Mangle all names so this can be linked in with other versions or other
# compiler-rt implementations. Also used for testing
mangled-names = []

# Only used in the compiler's build system
rustc-dep-of-std = ['compiler-builtins', 'core']

# This makes certain traits and function specializations public that
# are not normally public but are required by the `testcrate`
public-test-deps = []
4 changes: 2 additions & 2 deletions build.rs → compiler-builtins/build.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::{collections::BTreeMap, env, path::PathBuf, sync::atomic::Ordering};

mod configure;

use std::{collections::BTreeMap, env, path::PathBuf, sync::atomic::Ordering};

use configure::{configure_aliases, configure_f16_f128, Target};

fn main() {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 1 addition & 2 deletions src/lib.rs → compiler-builtins/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ pub mod int;
pub mod math;
pub mod mem;

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

#[cfg(target_arch = "arm")]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions crates/panic-handler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@ authors = ["Alex Crichton <[email protected]>"]
edition = "2024"
publish = false

[lib]
test = false
bench = false

[dependencies]
2 changes: 1 addition & 1 deletion testcrate/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ rand_xoshiro = "0.6"
rustc_apfloat = "0.2.1"

[dependencies.compiler_builtins]
path = ".."
path = "../compiler-builtins"
default-features = false
features = ["public-test-deps"]

Expand Down
2 changes: 1 addition & 1 deletion testcrate/build.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::collections::HashSet;

mod builtins_configure {
include!("../configure.rs");
include!("../compiler-builtins/configure.rs");
}

/// Features to enable
Expand Down