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

docs(refs): Add unsafe to extern while using build scripts in Cargo Book #15294

Merged
merged 1 commit into from
Mar 11, 2025

Conversation

namanlp
Copy link
Contributor

@namanlp namanlp commented Mar 10, 2025

What does this PR try to resolve?

Since rust 1.85.0, It is no longer sufficient to use the unsafe keyword only at the call site. It must also be applied to the extern statement, hence, Cargo Book must be updated

and also update some more related content

How should we test and review this PR?

Run mdbook build. The unsafe extern should be seen at cargo/reference/build-script-examples.html#linking-to-system-libraries , cargo/reference/build-script-examples.html#building-a-native-library , cargo/reference/semver.html#repr-c-shuffle , cargo/reference/semver.html#repr-c-remove and cargo/reference/semver.html#repr-transparent-remove

Additional information

@rustbot
Copy link
Collaborator

rustbot commented Mar 10, 2025

r? @epage

rustbot has assigned @epage.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added A-documenting-cargo-itself Area: Cargo's documentation S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 10, 2025
Copy link
Contributor

@epage epage left a comment

Choose a reason for hiding this comment

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

Thanks!

@epage epage added this pull request to the merge queue Mar 11, 2025
@epage
Copy link
Contributor

epage commented Mar 11, 2025

I wonder if we should pull the example code out into a crate that we make a workspace member, like over at https://github.com/rust-cli/book

Merged via the queue into rust-lang:master with commit 3897c7c Mar 11, 2025
21 checks passed
@namanlp namanlp deleted the fix-15289 branch March 11, 2025 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-documenting-cargo-itself Area: Cargo's documentation S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cargo reference build script example fails to compile
3 participants