Giter VIP home page Giter VIP logo

Comments (2)

suaviloquence avatar suaviloquence commented on June 30, 2024

Hi! I started to work on this. A couple of questions/uncertainties:

  1. I'm assuming it's a major-level change based on other violations like changing an established repr, although I couldn't find anything on the cargo semver page. for no_mangle/export_name specifically
  2. Is it a violation when a non-public function changes export name? For example, in the example you linked, you can still access im_secretly_public even when it's not public in the Rust API.
  3. Should this (these) lints proc when the export name of one function moves to a different function? For example,
#[no_mangle]
pub fn func1() {}

pub fn func2() {}

to

pub fn func1() {}

#[export_name = "func1"]
pub fn func2() {}

Thanks!

from cargo-semver-checks.

obi1kenobi avatar obi1kenobi commented on June 30, 2024

Great questions!

I'm assuming it's a major-level change based on other violations like changing an established repr, although I couldn't find anything on the cargo semver page. for no_mangle/export_name specifically

Yes, it's a major breaking change. The cargo semver reference isn't yet an exhaustive list of major changes, and we've had many situations where cargo-semver-checks work triggered additions to the reference or vice versa. I expect that trend will continue for some time :)

Is it a violation when a non-public function changes export name? For example, in the example you linked, you can still access im_secretly_public even when it's not public in the Rust API.

Yes! I believe we might actually have a lint for this already. It seems familiar and may have been added sometime in the last couple of months.

Should this (these) lints proc when the export name of one function moves to a different function? For example,

Great edge case! No, this should not trigger either lint.

In general, we want to trigger lints when we are certain there's a problem, so that we skew heavily away from false-positives which cause users to distrust the tool. In this edge case, the change may have been intentional and from an API/ABI perspective seems fine.

However, if the func2() function e.g. takes a different number of arguments, then that should trigger a lint — I'm adding that plus related cases to the list.

from cargo-semver-checks.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.