GithubHelp home page GithubHelp logo

Comments (7)

workingjubilee avatar workingjubilee commented on August 22, 2024

These kinds of things can be filtered via this flotilla of lints: rust-lang/rust#82499

from plrust.

workingjubilee avatar workingjubilee commented on August 22, 2024

I probably need to redesign the unsafe detection, there was an alternate design that used a shell-game around building the code without the #[pg_extern] annotation, which would allow straightforward usage of #[forbid(unsafe_code)] and a few other lints, as a verification step, and then rebuilding the code with it (and with less lints), and then skipped using geiger.

from plrust.

workingjubilee avatar workingjubilee commented on August 22, 2024

The naive solution might be to just scan for #[ and error during parsing the code, but I'm not familiar with how Rust interprets Attributes, it seems something like works as well.

To address this part of your question more directly: Rust is very, very lax about whitespace in most cases where a logical segment in the parse could be interpreted as existing.

from plrust.

jbrindle avatar jbrindle commented on August 22, 2024

What lints can we add to Cargo.toml to validate that they will actually catch this behavior?

from plrust.

workingjubilee avatar workingjubilee commented on August 22, 2024

It involves restructuring the build a bit to let us do a "dry run" pre-build and then do it "for real", as mentioned. I am working on that PR.

from plrust.

workingjubilee avatar workingjubilee commented on August 22, 2024

I have a draft branch for this that successfully catches this specific example, but it is still technically possible to get #[link_section] without #[no_mangle] by, unless using a higher rustc version than 1.61.0, so I will polish it up and submit it next week but it will contain an ignored test unless we also have consensus on raising MSRV.

from plrust.

workingjubilee avatar workingjubilee commented on August 22, 2024

TODO:

  • Test for #[no_mangle]
    • ...passes
    • ...on main
  • Test for #[link_section]
    • ...passes
    • ...on main

from plrust.

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.