Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rust-lang/cc-rs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: cc-v1.2.6
Choose a base ref
...
head repository: rust-lang/cc-rs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: cc-v1.2.7
Choose a head ref
  • 9 commits
  • 7 files changed
  • 4 contributors

Commits on Dec 28, 2024

  1. CI: Fix caching (#1334)

    * CI: Fix caching
    
    Create lockfile before invoking rust-cache to make sure it is invalidated when new versions of dependencies have released
    
    * Fix main.yml
    NobodyXu authored Dec 28, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    accf141 View commit details

Commits on Dec 29, 2024

  1. Allow using Visual Studio target names in find_tool (#1335)

    * Allow using VS target names in find_tool
    
    Also fix a bug in vs15plus_vc_paths due to shadowing of the `target` variable.
    
    * code review update
    ChrisDenton authored Dec 29, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    e758ed1 View commit details

Commits on Dec 31, 2024

  1. Fix is_flag_supported on msvc (#1336)

    ChrisDenton authored Dec 31, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    05a529c View commit details

Commits on Jan 1, 2025

  1. Make is_flag_supported_inner take an &Tool (#1337)

    ChrisDenton authored Jan 1, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    cfa61d1 View commit details
  2. Document new supported architecture names in windows::find

    madsmtm committed Jan 1, 2025
    Copy the full SHA
    6f884fd View commit details
  3. Merge pull request #1338 from madsmtm/docs-windows-find

    Document new supported architecture names in `windows_registry::find`
    madsmtm authored Jan 1, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    973597d View commit details

Commits on Jan 2, 2025

  1. CI: Add "test-pass" job (#1340)

    NobodyXu authored Jan 2, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    45d7db7 View commit details

Commits on Jan 3, 2025

  1. Regenerate target info (#1342)

    github-actions[bot] authored Jan 3, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    9f99437 View commit details
  2. chore: release v1.2.7 (#1341)

    github-actions[bot] authored Jan 3, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    1881acb View commit details
Showing with 169 additions and 153 deletions.
  1. +26 −0 .github/workflows/main.yml
  2. +10 −0 CHANGELOG.md
  3. +1 −1 Cargo.toml
  4. +5 −12 src/flags.rs
  5. +13 −10 src/lib.rs
  6. +6 −6 src/target/generated.rs
  7. +108 −124 src/windows/find_tools.rs
26 changes: 26 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -133,6 +133,7 @@ jobs:
- name: setup dev environment
uses: ilammy/msvc-dev-cmd@v1
if: startsWith(matrix.build, 'windows-clang')
- run: cargo update
- uses: Swatinem/rust-cache@v2
- run: cargo test ${{ matrix.no_run }} --workspace --target ${{ matrix.target }}
- run: cargo test ${{ matrix.no_run }} --workspace --target ${{ matrix.target }} --release
@@ -170,6 +171,7 @@ jobs:
rustup component add rust-src --toolchain ${{ matrix.rust }}
rustup default ${{ matrix.rust }}
shell: bash
- run: cargo update
- uses: Swatinem/rust-cache@v2
- run: cargo test -Z build-std=std ${{ matrix.no_run }} --workspace --target ${{ matrix.target }}
- run: cargo test -Z build-std=std ${{ matrix.no_run }} --workspace --target ${{ matrix.target }} --release
@@ -187,6 +189,7 @@ jobs:
run: |
rustup target add ${{ matrix.target }}
shell: bash
- run: cargo update
- uses: Swatinem/rust-cache@v2
- run: cargo test --no-run --target ${{ matrix.target }}
- run: cargo test --no-run --target ${{ matrix.target }} --release
@@ -227,6 +230,7 @@ jobs:
echo "WASI_SDK_PATH=$WASI_SDK_PATH" >> "$GITHUB_ENV"
echo "CC=$CC" >> "$GITHUB_ENV"
- run: cargo update
- uses: Swatinem/rust-cache@v2
with:
env-vars: "WASI_TOOLCHAIN_VERSION"
@@ -248,6 +252,7 @@ jobs:
sudo dpkg -i cuda-keyring_1.0-1_all.deb
sudo apt-get update
sudo apt-get -y install cuda-minimal-build-11-8
- run: cargo update
- uses: Swatinem/rust-cache@v2
- name: Test 'cudart' feature
shell: bash
@@ -311,3 +316,24 @@ jobs:
uses: actions/checkout@v4
- name: Check semver
uses: obi1kenobi/cargo-semver-checks-action@v2

# Dummy job to have a stable name for the "all tests pass" requirement
tests-pass:
name: Tests pass
needs:
- test
- check-tvos
- check-wasm
- test-wasm32-wasip1-thread
- cuda
- msrv
- clippy
- rustfmt
- semver-checks
if: always() # always run even if dependencies fail
runs-on: ubuntu-latest
steps:
# fail if ANY dependency has failed or cancelled
- if: "contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')"
run: exit 1
- run: exit 0
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -6,6 +6,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.2.7](https://github.com/rust-lang/cc-rs/compare/cc-v1.2.6...cc-v1.2.7) - 2025-01-03

### Other

- Regenerate target info ([#1342](https://github.com/rust-lang/cc-rs/pull/1342))
- Document new supported architecture names in windows::find
- Make is_flag_supported_inner take an &Tool ([#1337](https://github.com/rust-lang/cc-rs/pull/1337))
- Fix is_flag_supported on msvc ([#1336](https://github.com/rust-lang/cc-rs/pull/1336))
- Allow using Visual Studio target names in `find_tool` ([#1335](https://github.com/rust-lang/cc-rs/pull/1335))

## [1.2.6](https://github.com/rust-lang/cc-rs/compare/cc-v1.2.5...cc-v1.2.6) - 2024-12-27

### Other
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cc"
version = "1.2.6"
version = "1.2.7"
authors = ["Alex Crichton <alex@alexcrichton.com>"]
license = "MIT OR Apache-2.0"
repository = "https://github.com/rust-lang/cc-rs"
17 changes: 5 additions & 12 deletions src/flags.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use crate::target::TargetInfo;
use crate::{Build, Error, ErrorKind, ToolFamily};
use crate::{Build, Error, ErrorKind, Tool, ToolFamily};
use std::borrow::Cow;
use std::ffi::OsString;
use std::path::Path;

#[derive(Debug, PartialEq, Default)]
pub(crate) struct RustcCodegenFlags<'a> {
@@ -158,21 +157,15 @@ impl<'this> RustcCodegenFlags<'this> {
}

// Rust and clang/cc don't agree on what equivalent flags should look like.
pub(crate) fn cc_flags(
&self,
build: &Build,
path: &Path,
family: ToolFamily,
target: &TargetInfo,
flags: &mut Vec<OsString>,
) {
pub(crate) fn cc_flags(&self, build: &Build, tool: &mut Tool, target: &TargetInfo) {
let family = tool.family;
// Push `flag` to `flags` if it is supported by the currently used CC
let mut push_if_supported = |flag: OsString| {
if build
.is_flag_supported_inner(&flag, path, target)
.is_flag_supported_inner(&flag, tool, target)
.unwrap_or(false)
{
flags.push(flag);
tool.args.push(flag);
} else {
build.cargo_output.print_warning(&format!(
"Inherited flag {:?} is not supported by the currently used CC",
23 changes: 13 additions & 10 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -645,19 +645,19 @@ impl Build {
pub fn is_flag_supported(&self, flag: impl AsRef<OsStr>) -> Result<bool, Error> {
self.is_flag_supported_inner(
flag.as_ref(),
self.get_base_compiler()?.path(),
&self.get_base_compiler()?,
&self.get_target()?,
)
}

fn is_flag_supported_inner(
&self,
flag: &OsStr,
compiler_path: &Path,
tool: &Tool,
target: &TargetInfo<'_>,
) -> Result<bool, Error> {
let compiler_flag = CompilerFlag {
compiler: compiler_path.into(),
compiler: tool.path().into(),
flag: flag.into(),
};

@@ -679,7 +679,7 @@ impl Build {
let mut compiler = {
let mut cfg = Build::new();
cfg.flag(flag)
.compiler(compiler_path)
.compiler(tool.path())
.cargo_metadata(self.cargo_output.metadata)
.opt_level(0)
.debug(false)
@@ -727,6 +727,13 @@ impl Build {

cmd.arg(&src);

// On MSVC skip the CRT by setting the entry point to `main`.
// This way we don't need to add the default library paths.
if compiler.is_like_msvc() {
// Flags from _LINK_ are appended to the linker arguments.
cmd.env("_LINK_", "-entry:main");
}

let output = cmd.output()?;
let is_supported = output.status.success() && output.stderr.is_empty();

@@ -1950,7 +1957,7 @@ impl Build {

for flag in self.flags_supported.iter() {
if self
.is_flag_supported_inner(flag, &cmd.path, &target)
.is_flag_supported_inner(flag, &cmd, &target)
.unwrap_or(false)
{
cmd.push_cc_arg((**flag).into());
@@ -2431,13 +2438,9 @@ impl Build {
None => return Ok(()),
};

let Tool {
family, path, args, ..
} = cmd;

let env = env_os.to_string_lossy();
let codegen_flags = RustcCodegenFlags::parse(&env)?;
codegen_flags.cc_flags(self, path, *family, target, args);
codegen_flags.cc_flags(self, cmd, target);
Ok(())
}

12 changes: 6 additions & 6 deletions src/target/generated.rs
Original file line number Diff line number Diff line change
@@ -517,7 +517,7 @@ pub(crate) const LIST: &[(&str, TargetInfo<'static>)] = &[
os: "linux",
env: "musl",
abi: "eabi",
unversioned_llvm_target: "arm-unknown-linux-gnueabi",
unversioned_llvm_target: "arm-unknown-linux-musleabi",
},
),
(
@@ -529,7 +529,7 @@ pub(crate) const LIST: &[(&str, TargetInfo<'static>)] = &[
os: "linux",
env: "musl",
abi: "eabihf",
unversioned_llvm_target: "arm-unknown-linux-gnueabihf",
unversioned_llvm_target: "arm-unknown-linux-musleabihf",
},
),
(
@@ -685,7 +685,7 @@ pub(crate) const LIST: &[(&str, TargetInfo<'static>)] = &[
os: "linux",
env: "musl",
abi: "eabi",
unversioned_llvm_target: "armv5te-unknown-linux-gnueabi",
unversioned_llvm_target: "armv5te-unknown-linux-musleabi",
},
),
(
@@ -829,7 +829,7 @@ pub(crate) const LIST: &[(&str, TargetInfo<'static>)] = &[
os: "linux",
env: "musl",
abi: "eabi",
unversioned_llvm_target: "armv7-unknown-linux-gnueabi",
unversioned_llvm_target: "armv7-unknown-linux-musleabi",
},
),
(
@@ -841,7 +841,7 @@ pub(crate) const LIST: &[(&str, TargetInfo<'static>)] = &[
os: "linux",
env: "musl",
abi: "eabihf",
unversioned_llvm_target: "armv7-unknown-linux-gnueabihf",
unversioned_llvm_target: "armv7-unknown-linux-musleabihf",
},
),
(
@@ -2617,7 +2617,7 @@ pub(crate) const LIST: &[(&str, TargetInfo<'static>)] = &[
os: "linux",
env: "musl",
abi: "eabihf",
unversioned_llvm_target: "armv7-unknown-linux-gnueabihf",
unversioned_llvm_target: "armv7-unknown-linux-musleabihf",
},
),
(
Loading