Git Product home page Git Product logo

rust-lisa's Introduction

๐Ÿ”ญ Assistant Professor (no-tenure track) at the University of Parma

๐ŸŒฑ Interested in static program analysis and verification, abstract interpretation

๐Ÿ“ซ How to reach me: vincenzo.arceri[at]unipr[dot]it

โšก Check out LiSA!



rust-lisa's People

Contributors

simonegazza avatar vincenzoarceri avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

rust-lisa's Issues

[FEATURE REQUEST] Make example compile

Description
As of now, some example are compiling (in Rust) and some are not. Furthermore some of them are compiling without warnings, but most of them have some (usually due to their nature of being simple example). We should make sure that all rust examples can compile, with the least number of warning possible.

[FEATURE REQUEST] Return from functions

Description
In rust there are two main ways of returning from a function. Using the return statement or omitting the ; at the end of a statement. At the moment, none of them are supported.

Rust while control structure

The code currently does not implement any code regarding the while control structure. This should change in the near future.

[BUG] Check weather a not-declared field of a struct (or struct enum) is assignable

Description
Currently there is no check for a field of a struct to be in the struct itself. This check can (and should) be done with static semantics.

For example, this code should raise an error:

enum Message {
    Move { x: i32, y: i32 },
}

fn main() {
    let m = Message::Move {x : 1, y : 2};
    if let Message::Move{ x: a, z: b} = m2{
        println!("{}", a);
        println!("{}", b);
    }
}

[BUG] Use of `RustEqualExpression` in destructuring of match statement

Description
During match statement we use the RustEqualExpression operator (== operator). We should check if this is the right operator to use, and if not we should change it / create a new one to use.

Suggested implementation
It is highly recommended that we create a new node that is capable of doing destructuring and correctly evaluates the guard.

[BUG] Functions with no statement

Description
Functions with no statement inside makes rust-lisa crash

Reproducibility information
The bug is already present in 180aaa9 on master branch.

Actual behavior
Example:

fn main () {
}

This is a legit Rust function that we are not able to parse right now.
The error is the following:

Exception in thread "main" java.lang.NullPointerException: The source of an edge cannot be null
	at java.base/java.util.Objects.requireNonNull(Objects.java:246)
	at it.unive.lisa.program.cfg.edge.Edge.<init>(Edge.java:38)
	at it.unive.lisa.program.cfg.edge.SequentialEdge.<init>(SequentialEdge.java:25)
	at it.unipr.frontend.RustCodeMemberVisitor.visitFn_decl(RustCodeMemberVisitor.java:218)
	at it.unipr.frontend.RustFrontend.visitPub_item(RustFrontend.java:151)
	at it.unipr.frontend.RustFrontend.visitItem(RustFrontend.java:140)
	at it.unipr.frontend.RustFrontend.visitMod_body(RustFrontend.java:129)
	at it.unipr.frontend.RustFrontend.visitCrate(RustFrontend.java:122)
	at it.unipr.frontend.RustFrontend.toLiSAProgram(RustFrontend.java:113)
	at it.unipr.frontend.RustFrontend.processFile(RustFrontend.java:94)
	at it.unipr.RustLiSA.main(RustLiSA.java:26)

Expected behavior
The function to be parsed correctly.

Further content
The fix should be easy. This issue is here as a remainder.

[FEATURE REQUEST] Rust variable declaration

Description
We should parse and create a CFG node for let statement.

Suggested implementation
For the moment, it could simply extend the Assignment class. Until we do not fix #1, we can just use Untyped type for any declared variable.

[BUG] Match catch all statement

Description
Currently, there is no support for catch alla statement inside a match (i.e. _ guard inside a branch).

Expected behavior
This catch-all statement in match should be the entry of each statement if any other case in the match is descarded.

Suggested implementation
The problem needs further analysis but it is probably enough to simply rewrite the guard as a true statement evaluation.

[FEATURE REQUEST] Parse non-primitive function return types

Description
As of now, functions with primitive return type are parsed correctly but the ones with user-defined types are not.

Further content
Rust function return types are specified after an arrow (->).
Example (with primitive types):

fn func() -> i32 {
    42
}

Rust guard parsing

As of now, the current code does not take into account the guards for if, else if, while, match and so on. The code should implement these feature.

[FEATURE REQUEST] Add support for match statement

Description
We should add support and create a CFG node for the match statement.

Motivation
match is a foundational statement of Rust. This should dramatically increase our support to the language.

[FEATURE REQUEST] Implement `RustTypeVisitor`

Description
As in the other LiSA frontend, we split the visit of code member from the visit of Rust types, my means of a RustTypeVisitor class, implementing the RustBaseVisitor interface, and managing exclusively the type parsing.

[FEATURE REQUEST] if let parsing

Description
We should implement the if-let statement. The if let statement is used particularly for matching enums. This should increase our parsing capabilities.

[BUG] Verify usefulness of `RustMultipleExpression`

Description
As of now, the class RustMultipleExpression is used a replacer for a List<Expression>, but it is probably useless and can be removed from the code (so that it will be cleaner). We could try to replace every instance of it with the above mentioned list and see if the behavior expected is the same.

[FEATURE REQUEST] README

Description
A proper README.md describing RustLiSA requirements and how to build and import in Eclipse RustLiSA is needed.

[FEATURE REQUEST] no_struct expressions

Description
In the grammar files, there are two non-terminal symbols for expressions: the ones that do not parse structs (they end with no_struct) and the ones that parse structs (e.g., prim_expr). We already have an implementation for the visit of the struct rules, the visit for the no_struct rules seems pretty similar. It seems they differ in post_expr and prim_expr. Just as an example, I report below the prim_expr and prim_expr_no_struct rules.

prim_expr
   : prim_expr_no_struct
   | path '{' expr_inner_attrs? fields? '}'
   ;
prim_expr_no_struct
   : lit
   | 'self'
   | path macro_tail?

[FEATURE REQUEST] `Continue` & `break` statements

Description
Add parsing for continue and break statements.

Motivation
We should implement those statements to allow, respectively, to skip to the next iteration (for eg. in a for statement) and exiting from a loop.

[FEATURE REQUEST] Macros call

Description
Currently, macros are skipped during parsing, so to avoid conflicts. We should start treating macros and parse their calls

Suggested implementation
We can start by thinking of treating them as UnresolvedCall

[FEATURE-REQUEST] [BUG] Return and reachable statement

Description
Currently, when we are parsing the code, unreachable statement are considered a hard errors and LiSA throws an exception.

Reproducibility information
A programma like the following can produce the error:

fn func() -> i32 {
	let x = 2;
	if x == 2 {
		return 1;
	} else {
		return 3;
	}
	
	return 4;
}

Expected behavior
We should remove the unreachable statements during parsing, or make sure in some ways that LiSA does not give a ProgramValidationException: Unreachable node that is not marked as entrypoint.

[FEATURE REQUEST] Method calls

Description
We should add support for calling methods of rust's struct. Note that in Rust methods can be somewhat static (they do not use the &self as parameter).

Rust empty statement

There is no implementation for the empty statement. An empty statement is composed only by a semicolon (;). We should take that statement also into account.

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.