Skip to content

fix: use autocfg to detect rustc version#7

Merged
AsakuraMizu merged 3 commits into
mainfrom
fix/borrowed_buf
Dec 19, 2025
Merged

fix: use autocfg to detect rustc version#7
AsakuraMizu merged 3 commits into
mainfrom
fix/borrowed_buf

Conversation

@AsakuraMizu

Copy link
Copy Markdown
Contributor

Close #6

remove targets, add toolchains, introduce cargo-hack

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements automatic detection of Rust compiler version capabilities using the autocfg crate to conditionally use newer APIs in BorrowedBuf. The changes enable compatibility across different Rust nightly versions and stable by detecting whether BorrowedBuf::init_len() and related methods are available.

Key changes:

  • Adds build-time feature detection for borrowedbuf_init capability using autocfg
  • Implements fallback code paths for older Rust versions that lack the newer BorrowedBuf API methods
  • Extends CI matrix to test against multiple Rust toolchain versions (nightly, specific nightly dates, and stable)

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
build.rs Adds autocfg-based feature detection to probe for BorrowedBuf::init_len availability
Cargo.toml Adds autocfg as a build dependency
src/lib.rs Implements conditional compilation with separate code paths for new and old BorrowedBuf APIs, adding support for the maybe_uninit_fill feature when newer APIs aren't available
.github/workflows/ci.yml Expands CI matrix to test multiple Rust versions and removes target-specific testing in favor of feature-powerset testing

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread build.rs
Comment thread .github/workflows/ci.yml
@AsakuraMizu AsakuraMizu merged commit 1ea2440 into main Dec 19, 2025
20 checks passed
@AsakuraMizu AsakuraMizu deleted the fix/borrowed_buf branch December 19, 2025 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] axio@0.2.0 builds only on nightly-2025-12-04 to nightly-2025-12-17

2 participants