Skip to content

Language ref sales pitch says that C functions are unsafe #1212

New issue

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

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

Already on GitHub? # to your account

Closed
brson opened this issue Nov 22, 2011 · 6 comments
Closed

Language ref sales pitch says that C functions are unsafe #1212

brson opened this issue Nov 22, 2011 · 6 comments
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@brson
Copy link
Contributor

brson commented Nov 22, 2011

This is not currently true.

@boggle
Copy link
Contributor

boggle commented Nov 26, 2011

And they can even be declared as pure (which probably needs to be added to the ref as well)

@DylanLukes
Copy link

Some compilers have a __pure attribute, and C++ can append const, but declaring functions as pure is not in the C standard at all.

@graydon
Copy link
Contributor

graydon commented Dec 1, 2011

Pure is an annotation for rust functions. It's sensible to apply to some imported c functions.

@DylanLukes
Copy link

Oh, you meant within rust. Alright. Can the safety/purity be verified though?

@graydon
Copy link
Contributor

graydon commented Dec 2, 2011

No. It's just a "trust me" assertion in the context of an external C function.

@brson
Copy link
Contributor Author

brson commented Jan 24, 2012

Sales pitch is gone.

@brson brson closed this as completed Jan 24, 2012
flip1995 pushed a commit to flip1995/rust that referenced this issue Nov 23, 2021
Improve `needless_borrow` lint

fixes: rust-lang#5327
fixes: rust-lang#1726
fixes: rust-lang#1212

This is merging `needless_borrow` into the `dereference` pass in preparation for `explicit_auto_deref`. `explicit_auto_deref` needs to implement most of what `needless_borrow` implements in order to work.

There is a minor regression here where `let x: &str = &x.deref()` will trigger `needless_borrow` without triggering `explicit_deref_methods`. Removing the redundant borrow will cause `explicit_deref_methods` to trigger. This will be fixed when `explicit_auto_deref` is implemented.

changelog: Lint `needless_borrow` when a borrow is auto-derefed more than once
changelog: Lint `needless_borrow` in the trailing expression of a block for a match arm
bors pushed a commit to rust-lang-ci/rust that referenced this issue Dec 20, 2021
celinval pushed a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
…g#1212)

* Define `min` expression

* Add `atomic_min*` intrinsics

* Add test and remove negative ones

* Add support for `atomic_umin*`

* Add test for `umin` and remove negative ones

* Complete `is_side_effect` and use in `min`

* Use `any` instead of local function

Co-authored-by: Daniel Schwartz-Narbonne <danielsn@users.noreply.github.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

No branches or pull requests

4 participants