profile
viewpoint

marcoeilers/nagini 149

Nagini is a static verifier for Python 3, based on the Viper verification infrastructure.

vakaras/Algoritm--teorija 4

Adomo Birštuno Algoritmų teorijos paskaitų konspektas

rust-corpus/qrates 2

A framework for large scale analysis of the Rust ecosystem.

vakaras/django-starter 2

A fork of django-starter created by Sirex.

vakaras/Dokumentacija 2

Projektų dokumentavimo aprašymai.

vakaras/Buhalterin--apskaita 1

Paskaitų konspektas.

Pull request review commentviperproject/prusti-dev

Implement simple optimizations for predicates

+// © 2020, ETH Zurich+//+// This Source Code Form is subject to the terms of the Mozilla Public+// License, v. 2.0. If a copy of the MPL was not distributed with this+// file, You can obtain one at http://mozilla.org/MPL/2.0/.++use crate::vir::{ast::*, cfg, cfg::CfgMethod, CfgBlock};+use std::collections::BTreeSet;++fn get_used_predicates(methods: &[CfgMethod], functions: &[Function]) -> BTreeSet<String> {+    let mut collector = UsedPredicateCollector::new();+    super::walk_methods(methods, &mut collector);+    super::walk_functions(functions, &mut collector);++    // DeadBorrowToken$ is a used predicate but it does not appear in VIR becaue it is only created when viper code is created from VIR+    collector+        .used_predicates+        .insert("DeadBorrowToken$".to_string());+    collector.used_predicates+}++fn get_used_predicates_in_predicates(predicates: &[Predicate]) -> BTreeSet<String> {+    let mut collector = UsedPredicateCollector::new();++    for pred in predicates {+        match pred {+            Predicate::Struct(StructPredicate { body: Some(e), .. }) => {+                ExprWalker::walk(&mut collector, e)+            }+            Predicate::Struct(_) => { /* ignore */ }+            Predicate::Enum(p) => {+                ExprWalker::walk(&mut collector, &p.discriminant);+                ExprWalker::walk(&mut collector, &p.discriminant_bounds);++                for (e, _, sp) in &p.variants {+                    ExprWalker::walk(&mut collector, e);+                    collector.used_predicates.insert(sp.name.to_string());+                    sp.body+                        .iter()+                        .for_each(|e| ExprWalker::walk(&mut collector, e))+                }+            }+            Predicate::Bodyless(_, _) => { /* ignore */ }+        }+    }+    collector.used_predicates+}++fn remove_body_of_predicates_if_possible(+    predicates: &[Predicate],+    predicates_only_used_in_predicates: &BTreeSet<String>,+) -> Vec<Predicate> {+    let mut new_predicates = predicates.to_vec();++    new_predicates.iter_mut().for_each(|predicate| {+        let predicates_used_in_this_predicate =+            get_used_predicates_in_predicates(&[predicate.clone()]);+        if predicates_used_in_this_predicate+            .intersection(&predicates_only_used_in_predicates)+            .next()+            .is_some()+        {+            if let Predicate::Struct(sp) = predicate {+                sp.body = None;+            }+        }+    });+    new_predicates+}++pub fn delete_unused_predicates(+    methods: &[CfgMethod],+    functions: &[Function],+    predicates: &[Predicate],+) -> Vec<Predicate> {+    let mut has_changed = true;+    let mut new_predicates: Vec<Predicate> = predicates.to_vec();++    let used_preds = get_used_predicates(methods, functions);++    debug!(+        "The used predicates in functions and methods are {:?}",+        &used_preds+    );++    while has_changed {+        has_changed = false;++        let predicates_used_in_predicates = get_used_predicates_in_predicates(&new_predicates);+        debug!(+            "The used predicates in predicates are {:?}",+            &predicates_used_in_predicates+        );+        new_predicates = new_predicates+            .into_iter()+            .filter(|p| {+                let name = p.name();+                let is_used_in_predicate = predicates_used_in_predicates.contains(name);+                let is_used_in_func_or_method = used_preds.contains(name);+                let is_used = is_used_in_predicate || is_used_in_func_or_method;+                if !is_used {+                    debug!("The predicate {} was never used and thus removed", name);+                    has_changed = true;+                }++                is_used+            })+            .collect();+    }++    // FIXME: This acctually removes bodies that are needed

In other words: could the optimization implemented in prusti-common/src/vir/optimizations/predicates/remove_unnecessary_bodies.rs be merged into this file?

tillarnold

comment created time in 6 days

Pull request review commentviperproject/prusti-dev

Implement simple optimizations for predicates

+// © 2020, ETH Zurich+//+// This Source Code Form is subject to the terms of the Mozilla Public+// License, v. 2.0. If a copy of the MPL was not distributed with this+// file, You can obtain one at http://mozilla.org/MPL/2.0/.++use crate::vir::{ast::*, cfg, cfg::CfgMethod, CfgBlock};+use std::collections::BTreeSet;++fn get_used_predicates(methods: &[CfgMethod], functions: &[Function]) -> BTreeSet<String> {+    let mut collector = UsedPredicateCollector::new();+    super::walk_methods(methods, &mut collector);+    super::walk_functions(functions, &mut collector);++    // DeadBorrowToken$ is a used predicate but it does not appear in VIR becaue it is only created when viper code is created from VIR+    collector+        .used_predicates+        .insert("DeadBorrowToken$".to_string());+    collector.used_predicates+}++fn get_used_predicates_in_predicates(predicates: &[Predicate]) -> BTreeSet<String> {+    let mut collector = UsedPredicateCollector::new();++    for pred in predicates {+        match pred {+            Predicate::Struct(StructPredicate { body: Some(e), .. }) => {+                ExprWalker::walk(&mut collector, e)+            }+            Predicate::Struct(_) => { /* ignore */ }+            Predicate::Enum(p) => {+                ExprWalker::walk(&mut collector, &p.discriminant);+                ExprWalker::walk(&mut collector, &p.discriminant_bounds);++                for (e, _, sp) in &p.variants {+                    ExprWalker::walk(&mut collector, e);+                    collector.used_predicates.insert(sp.name.to_string());+                    sp.body+                        .iter()+                        .for_each(|e| ExprWalker::walk(&mut collector, e))+                }+            }+            Predicate::Bodyless(_, _) => { /* ignore */ }+        }+    }+    collector.used_predicates+}++fn remove_body_of_predicates_if_possible(+    predicates: &[Predicate],+    predicates_only_used_in_predicates: &BTreeSet<String>,+) -> Vec<Predicate> {+    let mut new_predicates = predicates.to_vec();++    new_predicates.iter_mut().for_each(|predicate| {+        let predicates_used_in_this_predicate =+            get_used_predicates_in_predicates(&[predicate.clone()]);+        if predicates_used_in_this_predicate+            .intersection(&predicates_only_used_in_predicates)+            .next()+            .is_some()+        {+            if let Predicate::Struct(sp) = predicate {+                sp.body = None;+            }+        }+    });+    new_predicates+}++pub fn delete_unused_predicates(+    methods: &[CfgMethod],+    functions: &[Function],+    predicates: &[Predicate],+) -> Vec<Predicate> {+    let mut has_changed = true;+    let mut new_predicates: Vec<Predicate> = predicates.to_vec();++    let used_preds = get_used_predicates(methods, functions);++    debug!(+        "The used predicates in functions and methods are {:?}",+        &used_preds+    );++    while has_changed {+        has_changed = false;++        let predicates_used_in_predicates = get_used_predicates_in_predicates(&new_predicates);

I think it would be more performant to create a map predicate_name → set of predicate names used in that predicate that is computed once instead of recomputing this information over and over again in the loop.

tillarnold

comment created time in 6 days

Pull request review commentviperproject/prusti-dev

Implement simple optimizations for predicates

+// © 2020, ETH Zurich+//+// This Source Code Form is subject to the terms of the Mozilla Public+// License, v. 2.0. If a copy of the MPL was not distributed with this+// file, You can obtain one at http://mozilla.org/MPL/2.0/.++use crate::vir::{ast::*, cfg, cfg::CfgMethod, CfgBlock};+use std::collections::BTreeSet;++fn get_used_predicates(methods: &[CfgMethod], functions: &[Function]) -> BTreeSet<String> {+    let mut collector = UsedPredicateCollector::new();+    super::walk_methods(methods, &mut collector);+    super::walk_functions(functions, &mut collector);++    // DeadBorrowToken$ is a used predicate but it does not appear in VIR becaue it is only created when viper code is created from VIR+    collector+        .used_predicates+        .insert("DeadBorrowToken$".to_string());+    collector.used_predicates+}++fn get_used_predicates_in_predicates(predicates: &[Predicate]) -> BTreeSet<String> {+    let mut collector = UsedPredicateCollector::new();++    for pred in predicates {+        match pred {+            Predicate::Struct(StructPredicate { body: Some(e), .. }) => {+                ExprWalker::walk(&mut collector, e)+            }+            Predicate::Struct(_) => { /* ignore */ }+            Predicate::Enum(p) => {+                ExprWalker::walk(&mut collector, &p.discriminant);+                ExprWalker::walk(&mut collector, &p.discriminant_bounds);++                for (e, _, sp) in &p.variants {+                    ExprWalker::walk(&mut collector, e);+                    collector.used_predicates.insert(sp.name.to_string());+                    sp.body+                        .iter()+                        .for_each(|e| ExprWalker::walk(&mut collector, e))+                }+            }+            Predicate::Bodyless(_, _) => { /* ignore */ }+        }+    }+    collector.used_predicates+}++fn remove_body_of_predicates_if_possible(+    predicates: &[Predicate],+    predicates_only_used_in_predicates: &BTreeSet<String>,+) -> Vec<Predicate> {+    let mut new_predicates = predicates.to_vec();++    new_predicates.iter_mut().for_each(|predicate| {+        let predicates_used_in_this_predicate =+            get_used_predicates_in_predicates(&[predicate.clone()]);+        if predicates_used_in_this_predicate+            .intersection(&predicates_only_used_in_predicates)+            .next()+            .is_some()+        {+            if let Predicate::Struct(sp) = predicate {+                sp.body = None;+            }+        }+    });+    new_predicates+}++pub fn delete_unused_predicates(+    methods: &[CfgMethod],+    functions: &[Function],+    predicates: &[Predicate],+) -> Vec<Predicate> {+    let mut has_changed = true;+    let mut new_predicates: Vec<Predicate> = predicates.to_vec();++    let used_preds = get_used_predicates(methods, functions);++    debug!(+        "The used predicates in functions and methods are {:?}",+        &used_preds+    );++    while has_changed {+        has_changed = false;++        let predicates_used_in_predicates = get_used_predicates_in_predicates(&new_predicates);+        debug!(+            "The used predicates in predicates are {:?}",+            &predicates_used_in_predicates+        );+        new_predicates = new_predicates+            .into_iter()+            .filter(|p| {+                let name = p.name();+                let is_used_in_predicate = predicates_used_in_predicates.contains(name);+                let is_used_in_func_or_method = used_preds.contains(name);+                let is_used = is_used_in_predicate || is_used_in_func_or_method;+                if !is_used {+                    debug!("The predicate {} was never used and thus removed", name);+                    has_changed = true;+                }++                is_used+            })+            .collect();+    }++    // FIXME: This acctually removes bodies that are needed

I would prefer to avoid the fixpoint if possible because it could void the gains of the optimization.

Have you checked where the predicates with removed bodies are used? Are they used only in fold, unfold, and unfolding? If yes, we could collect the predicates whose folding state is changed in a special list and remove only the bodies of predicates that are not mentioned in that list.

tillarnold

comment created time in 6 days

Pull request review commentviperproject/prusti-dev

Implement simple optimizations for predicates

+// © 2020, ETH Zurich+//+// This Source Code Form is subject to the terms of the Mozilla Public+// License, v. 2.0. If a copy of the MPL was not distributed with this+// file, You can obtain one at http://mozilla.org/MPL/2.0/.++use crate::vir::{ast::*, cfg, cfg::CfgMethod, CfgBlock};+use std::collections::BTreeSet;++fn get_used_predicates(methods: &[CfgMethod], functions: &[Function]) -> BTreeSet<String> {+    let mut collector = UsedPredicateCollector::new();+    super::walk_methods(methods, &mut collector);+    super::walk_functions(functions, &mut collector);++    // DeadBorrowToken$ is a used predicate but it does not appear in VIR becaue it is only created when viper code is created from VIR+    collector+        .used_predicates+        .insert("DeadBorrowToken$".to_string());+    collector.used_predicates+}++fn get_used_predicates_in_predicates(predicates: &[Predicate]) -> BTreeSet<String> {+    let mut collector = UsedPredicateCollector::new();++    for pred in predicates {+        match pred {+            Predicate::Struct(StructPredicate { body: Some(e), .. }) => {+                ExprWalker::walk(&mut collector, e)+            }+            Predicate::Struct(_) => { /* ignore */ }+            Predicate::Enum(p) => {+                ExprWalker::walk(&mut collector, &p.discriminant);+                ExprWalker::walk(&mut collector, &p.discriminant_bounds);++                for (e, _, sp) in &p.variants {+                    ExprWalker::walk(&mut collector, e);+                    collector.used_predicates.insert(sp.name.to_string());+                    sp.body+                        .iter()+                        .for_each(|e| ExprWalker::walk(&mut collector, e))+                }+            }+            Predicate::Bodyless(_, _) => { /* ignore */ }+        }+    }+    collector.used_predicates+}++fn remove_body_of_predicates_if_possible(+    predicates: &[Predicate],+    predicates_only_used_in_predicates: &BTreeSet<String>,+) -> Vec<Predicate> {+    let mut new_predicates = predicates.to_vec();++    new_predicates.iter_mut().for_each(|predicate| {+        let predicates_used_in_this_predicate =+            get_used_predicates_in_predicates(&[predicate.clone()]);+        if predicates_used_in_this_predicate+            .intersection(&predicates_only_used_in_predicates)+            .next()+            .is_some()+        {+            if let Predicate::Struct(sp) = predicate {+                sp.body = None;+            }+        }+    });+    new_predicates+}++pub fn delete_unused_predicates(+    methods: &[CfgMethod],+    functions: &[Function],+    predicates: &[Predicate],+) -> Vec<Predicate> {+    let mut has_changed = true;+    let mut new_predicates: Vec<Predicate> = predicates.to_vec();++    let used_preds = get_used_predicates(methods, functions);++    debug!(+        "The used predicates in functions and methods are {:?}",+        &used_preds+    );++    while has_changed {+        has_changed = false;++        let predicates_used_in_predicates = get_used_predicates_in_predicates(&new_predicates);+        debug!(+            "The used predicates in predicates are {:?}",+            &predicates_used_in_predicates+        );+        new_predicates = new_predicates+            .into_iter()+            .filter(|p| {

You probably could use Vec::retain here.

tillarnold

comment created time in 6 days

Pull request review commentviperproject/prusti-dev

Implement simple optimizations for predicates

+// © 2020, ETH Zurich+//+// This Source Code Form is subject to the terms of the Mozilla Public+// License, v. 2.0. If a copy of the MPL was not distributed with this+// file, You can obtain one at http://mozilla.org/MPL/2.0/.++use crate::vir::{ast::*, cfg, cfg::CfgMethod, CfgBlock};+use std::collections::BTreeSet;++fn get_used_predicates(methods: &[CfgMethod], functions: &[Function]) -> BTreeSet<String> {+    let mut collector = UsedPredicateCollector::new();+    super::walk_methods(methods, &mut collector);+    super::walk_functions(functions, &mut collector);++    // DeadBorrowToken$ is a used predicate but it does not appear in VIR becaue it is only created when viper code is created from VIR+    collector+        .used_predicates+        .insert("DeadBorrowToken$".to_string());+    collector.used_predicates+}++fn get_used_predicates_in_predicates(predicates: &[Predicate]) -> BTreeSet<String> {+    let mut collector = UsedPredicateCollector::new();++    for pred in predicates {+        match pred {+            Predicate::Struct(StructPredicate { body: Some(e), .. }) => {+                ExprWalker::walk(&mut collector, e)+            }+            Predicate::Struct(_) => { /* ignore */ }

I think it would be better to make the code more explicit.

            Predicate::Struct(StructPredicate { body: None, .. }) => { /* ignore */ }
tillarnold

comment created time in 6 days

Pull request review commentviperproject/prusti-dev

Implement simple optimizations for predicates

+// © 2020, ETH Zurich+//+// This Source Code Form is subject to the terms of the Mozilla Public+// License, v. 2.0. If a copy of the MPL was not distributed with this+// file, You can obtain one at http://mozilla.org/MPL/2.0/.++use crate::vir::{ast::*, cfg, cfg::CfgMethod, CfgBlock};+use std::collections::BTreeSet;++fn get_used_predicates(methods: &[CfgMethod], functions: &[Function]) -> BTreeSet<String> {+    let mut collector = UsedPredicateCollector::new();+    super::walk_methods(methods, &mut collector);+    super::walk_functions(functions, &mut collector);++    // DeadBorrowToken$ is a used predicate but it does not appear in VIR becaue it is only created when viper code is created from VIR

Would be good to keep the lines containing comments no more than 80 characters long.

tillarnold

comment created time in 6 days

Pull request review commentviperproject/prusti-dev

Implement simple optimizations for predicates

+// © 2020, ETH Zurich+//+// This Source Code Form is subject to the terms of the Mozilla Public+// License, v. 2.0. If a copy of the MPL was not distributed with this+// file, You can obtain one at http://mozilla.org/MPL/2.0/.++use crate::vir::{ast::*, cfg, cfg::CfgMethod, Successor};++mod delete_unused_predicates;+mod remove_unnecessary_bodies;++pub use self::{+    delete_unused_predicates::delete_unused_predicates,+    remove_unnecessary_bodies::remove_unnecessary_bodies,+};++/// Walks all Statements and Expressions in the provided methods+fn walk_methods(methods: &[CfgMethod], walker: &mut (impl StmtWalker + ExprWalker)) {

I think that it would be good to place these methods in VIR utils module or somewhere like that.

@fpoli @cmatheja @Aurel300 What do you think?

tillarnold

comment created time in 6 days

Pull request review commentviperproject/prusti-dev

Implement simple optimizations for predicates

 impl Program {             .into_iter()             .map(|f| folding::FoldingOptimizer::optimize(f))             .collect();+        self.viper_predicates = predicates::delete_unused_predicates(+            &self.methods,+            &self.functions,+            &self.viper_predicates,+        );+        self.viper_predicates = predicates::remove_unnecessary_bodies(+            &self.methods,+            &self.functions,+            &self.viper_predicates,

Same here.

tillarnold

comment created time in 6 days

Pull request review commentviperproject/prusti-dev

Implement simple optimizations for predicates

 impl Program {             .into_iter()             .map(|f| folding::FoldingOptimizer::optimize(f))             .collect();+        self.viper_predicates = predicates::delete_unused_predicates(+            &self.methods,+            &self.functions,+            &self.viper_predicates,

I think it would be better to take the vector by value so that we can avoid a potentially expensive to_vec() inside the body of delete_unused_predicates.

tillarnold

comment created time in 6 days

PullRequestReviewEvent
PullRequestReviewEvent

issue openedrust-corpus/qrates

Write a query that finds incorrect uses of zeroize

When using zeroize one needs to be careful of the fact that Rust implements move operations as memcopy. We could write a query that, for example, detects the cases where an unpined zeroized local variable is created on a stack.

created time in 6 days

issue commentrust-corpus/qrates

New Query: finding all #[cfg(target_feature = “some_val”)] annotations

Looks like I can get the hashes from any table with a def_path attribute

Yes, any table should work.

but is there a simpler way to do this? by "simpler" I mean is there a dedicated table for getting the hashes.

Not really. The builds table has an entry per crate, so, in theory, is easier to work with, but at the same time, it has full hashes while the def_path includes only the first 4 symbols of it.

nataliepopescu

comment created time in 15 days

issue commentrust-corpus/qrates

New Query: finding all #[cfg(target_feature = “some_val”)] annotations

Why are you only loading const calls (isn't this a subset of all calls)?

Yes, const calls are a subset of all calls, so we might miss some cases. More specifically, we will miss calls via function pointers because we cannot dermine a call target of a call via function pointer without a complex analysis. However, these calls seem to be super rare (<1% if I recall correctly), so should not cause a problem in practice.

Where does the 'core[e667]::core_arch' string come from?

This string is part of the identifier used internally by the Rust compiler to identify definitions. [e667] is a hash of the crate that make the crate name unique; this is needed because Rust allows including multiple versions of the same crate as dependencies. The really painful thing is that the hash may change each time you recompile the project. Therefore, if you compile the same dataset and search for core[e667]::core_arch you may get no results because the core in your case may have gotten a different hash. To find out what hash was assigned to core, you need to manually look it up in the builds table.

Additionally, given the CSV you attached (presumably the result of running the query on all crates), I've confirmed that at least one of those crates does exist in the subset of crates.io that I'm running on yet I get no matches from running the query. I'm wondering if there's perhaps some local configuration that I'm missing?

Could you say more precisely which query are you running? Are you trying to run the same query on your own dataset? If yes, then you need to check if hashes in your dataset match.

nataliepopescu

comment created time in 16 days

issue commentrust-corpus/qrates

New Query: finding all #[cfg(target_feature = “some_val”)] annotations

It depends on what you are looking for and how far that thing is from what we needed for our paper. It can happen that even a very simple thing (like #2) will not be supported if we did not need that for our paper.

nataliepopescu

comment created time in 17 days

issue commentrust-corpus/qrates

New Query: finding all #[cfg(target_feature = “some_val”)] annotations

Edit: I would also be interested in any of the other query implementations for section 3.2 of this paper, if they are available. Thanks!

You can find the relevant Jupyter notebook here. (That folder contains all the notebooks used in that paper.)

nataliepopescu

comment created time in 17 days

push eventrust-corpus/qrates

Vytautas Astrauskas

commit sha 4c8d68b9cc46c99cebd7cb10222fbead66b35d7b

Update Jupyter notebooks based on the compiler team feedback.

view details

Vytautas Astrauskas

commit sha 0c10a6e89e56f85c794e52f37b4c5258d1447d08

Remove unnecessary code from the notebooks.

view details

Vytautas Astrauskas

commit sha 0b5c0c30d0ec5635ae3bb5529a9e791f193f28c1

Add history to the README.

view details

Vytautas Astrauskas

commit sha 2a7958bfc2fa7a0fe520716024fbd5d9a3627f22

Merge pull request #7 from rust-corpus/rustc-team-comments Address the Rust compiler team comments

view details

push time in 17 days

PR opened rust-corpus/qrates

Address the Rust compiler team comments
+857 -238

0 comment

4 changed files

pr created time in 17 days

create barnchrust-corpus/qrates

branch : rustc-team-comments

created branch time in 17 days

issue commentrust-corpus/qrates

New Query: finding all #[cfg(target_feature = “some_val”)] annotations

If you want to know only the Rust packages that call SIMD intrinsics, something like this should work:

import pandas as pd
import utils
const_calls_loaded = utils.load_const_calls()
const_calls_loaded.rename(
    columns={"crate_name": "crate_callsite", "crate": "crate_defsite"},
    inplace=True
)
simd_functions = set([
    x
    for x in const_calls_loaded.def_path.unique()
    if x.startswith('core[e667]::core_arch')
])
calls = const_calls_loaded[
    const_calls_loaded.def_path.isin(simd_functions)
]
calls

You can find the CSV file here.

If you want the precise line numbers of calls, then you will have to patch the extractor to collect that information. (It should be straightforward to do; please let me know if you need some guidance.)

nataliepopescu

comment created time in 17 days

Pull request review commentviperproject/prusti-dev

Ghost Type Encodings

+use prusti_contracts::GhostInt; use prusti_contracts::*;-use crate::ghost::GhostInt; -fn test4() {-    let a = GhostInt;-    let b = GhostInt;-    let c = a + b;-}   +fn test_1() -> GhostInt{+    let x = GhostInt::new(10);+    let y = GhostInt::new(20);+    x + y+}++#[ensures(result == gh1 + gh2)]+fn test_2(gh1: GhostInt, gh2: GhostInt) -> GhostInt{

@cmatheja GhostInt is a mathematical integer type that we want to encode in the same way as isize just without any bounds. Any suggestions regarding the consistency error?

aakp10

comment created time in 17 days

PullRequestReviewEvent

issue commentrust-lang/rust

repr(packed) allows invalid unaligned loads

Thanks @vakaras :-) When I asked if it is possible to gather that data, I didn't quite expect you'd just go and get it. ;)

I would say that we just got lucky this time that @fpoli decided to extract the reasons why the Rust compiler thinks that a specific function needs to have an unsafe block, which also includes this reason.

huonw

comment created time in 20 days

issue commentrust-lang/rust

repr(packed) allows invalid unaligned loads

As requested by @RalfJung, here you can find the list of all functions that trigger “borrow of packed field” lint. Our dataset is based on a snapshot of crates.io made on 2020-01-14.

huonw

comment created time in 20 days

create barnchrust-corpus/qrates

branch : packed-fields

created branch time in 20 days

issue openedrust-corpus/qrates

summary_key does not uniquely identify atomic functions

The following code snippet taken from RQ5 collects all atomics:

set([
    x
    for x in unsafe_block_const_calls.def_path.unique()
    if "core[e667]::sync[0]::atomic[0]" in x
])

Its output:

{'core[e667]::sync[0]::atomic[0]::atomic_add[0]',
 'core[e667]::sync[0]::atomic[0]::atomic_and[0]',
 'core[e667]::sync[0]::atomic[0]::atomic_compare_exchange[0]',
 'core[e667]::sync[0]::atomic[0]::atomic_compare_exchange_weak[0]',
 'core[e667]::sync[0]::atomic[0]::atomic_load[0]',
 'core[e667]::sync[0]::atomic[0]::atomic_max[0]',
 'core[e667]::sync[0]::atomic[0]::atomic_min[0]',
 'core[e667]::sync[0]::atomic[0]::atomic_nand[0]',
 'core[e667]::sync[0]::atomic[0]::atomic_or[0]',
 'core[e667]::sync[0]::atomic[0]::atomic_store[0]',
 'core[e667]::sync[0]::atomic[0]::atomic_sub[0]',
 'core[e667]::sync[0]::atomic[0]::atomic_swap[0]',
 'core[e667]::sync[0]::atomic[0]::atomic_umax[0]',
 'core[e667]::sync[0]::atomic[0]::atomic_umin[0]',
 'core[e667]::sync[0]::atomic[0]::atomic_xor[0]',
 'core[e667]::sync[0]::atomic[0]::compiler_fence[0]',
 'core[e667]::sync[0]::atomic[0]::fence[0]',
 'core[e667]::sync[0]::atomic[0]::spin_loop_hint[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[24]::new[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[29]::compare_exchange[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[29]::compare_exchange_weak[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[29]::fetch_and[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[29]::load[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[29]::store[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[29]::swap[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[39]::load[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[49]::compare_exchange[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[49]::load[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[49]::store[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[59]::fetch_add[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[59]::store[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[5]::compare_and_swap[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[5]::compare_exchange[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[5]::get_mut[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[5]::load[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[5]::new[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[5]::store[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[5]::swap[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[64]::fetch_add[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[64]::fetch_sub[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[64]::load[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[64]::new[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[64]::store[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[64]::swap[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[69]::compare_and_swap[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[69]::compare_exchange[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[69]::compare_exchange_weak[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[69]::fetch_add[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[69]::fetch_and[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[69]::fetch_or[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[69]::fetch_sub[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[69]::fetch_xor[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[69]::load[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[69]::new[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[69]::store[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[69]::swap[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[6]::compare_and_swap[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[6]::compare_exchange[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[6]::get_mut[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[6]::load[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[6]::new[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[6]::store[0]',
 'core[e667]::sync[0]::atomic[0]::{{impl}}[6]::swap[0]'}

However, if you do the same filtering by using summary keys:

set([
    x
    for x in unsafe_block_const_calls.summary_key.unique()
    if x.startswith("core.sync.atomic") or x.startswith("std.sync.atomic")
])

we get significantly less results:

{'core.sync.atomic.atomic_add',
 'core.sync.atomic.atomic_and',
 'core.sync.atomic.atomic_compare_exchange',
 'core.sync.atomic.atomic_compare_exchange_weak',
 'core.sync.atomic.atomic_load',
 'core.sync.atomic.atomic_max',
 'core.sync.atomic.atomic_min',
 'core.sync.atomic.atomic_nand',
 'core.sync.atomic.atomic_or',
 'core.sync.atomic.atomic_store',
 'core.sync.atomic.atomic_sub',
 'core.sync.atomic.atomic_swap',
 'core.sync.atomic.atomic_umax',
 'core.sync.atomic.atomic_umin',
 'core.sync.atomic.atomic_xor',
 'core.sync.atomic.compiler_fence',
 'core.sync.atomic.fence',
 'core.sync.atomic.implement_atomic.compare_and_swap',
 'core.sync.atomic.implement_atomic.compare_exchange',
 'core.sync.atomic.implement_atomic.compare_exchange_weak',
 'core.sync.atomic.implement_atomic.fetch_add',
 'core.sync.atomic.implement_atomic.fetch_and',
 'core.sync.atomic.implement_atomic.fetch_or',
 'core.sync.atomic.implement_atomic.fetch_sub',
 'core.sync.atomic.implement_atomic.fetch_xor',
 'core.sync.atomic.implement_atomic.get_mut',
 'core.sync.atomic.implement_atomic.load',
 'core.sync.atomic.implement_atomic.new',
 'core.sync.atomic.implement_atomic.store',
 'core.sync.atomic.implement_atomic.swap',
 'core.sync.atomic.spin_loop_hint'}

created time in 21 days

issue commentrust-corpus/qrates

New Query: finding all #[cfg(target_feature = “some_val”)] annotations

Our framework is using the intermediate representation of the compiler. As a result, things like #[cfg(target_feature = "some_val")] are already desugared and not visible to us. However, since #[cfg(target_feature = "some_val")] is a very syntactic feature, I think you can easily just grep for it. If you need more explanations on how to do that, please let me know.

By the way, in our framework, we have quite precise information about what function is going to be called at a specfic place (for static calls we know precise call targets). If the called SIMD functions are comming from a specific crate, then it should be quite easy to find all their callers.

nataliepopescu

comment created time in 22 days

PR opened viperproject/prusti-dev

Fix after_expiry parsing.
+30 -7

0 comment

3 changed files

pr created time in 23 days

create barnchviperproject/prusti-dev

branch : trait-refinement

created branch time in 23 days

delete branch viperproject/prusti-dev

delete branch : trait-refinement

delete time in 23 days

push eventviperproject/prusti-dev

Vytautas Astrauskas

commit sha 657ca78cf466ea6c3f200fdc03d1a55360b1153a

Reenable trait-contracts refinement test.

view details

Vytautas Astrauskas

commit sha 1679710502dc2d931cd6a677780a8b64d9f88ab5

Merge pull request #215 from viperproject/trait-refinement Reenable trait-contracts refinement test.

view details

push time in 23 days

create barnchviperproject/prusti-dev

branch : trait-refinement

created branch time in 23 days

push eventrust-corpus/qrates

Vytautas Astrauskas

commit sha 14c7666760f0f31995375ae92736fc9663cc1dd6

Fix a bug in `counters` query.

view details

push time in 23 days

delete branch viperproject/prusti-dev

delete branch : verify-test-flags

delete time in 23 days

create barnchviperproject/prusti-dev

branch : verify-test-flags

created branch time in 23 days

push eventviperproject/prusti-dev

Vytautas Astrauskas

commit sha 88772664ec19a8017849d9eefb8589bc44603f65

Take into account flags when using verify-test command.

view details

Vytautas Astrauskas

commit sha 27ab58e99f8a437ad76b53ecbdcc2ab1c4872714

Merge pull request #210 from viperproject/verify-test-flags Take into account flags when using verify-test command.

view details

push time in 25 days

delete branch viperproject/prusti-dev

delete branch : verify-test-flags

delete time in 25 days

create barnchviperproject/prusti-dev

branch : verify-test-flags

created branch time in 25 days

push eventviperproject/prusti-dev

Vytautas Astrauskas

commit sha b21e8d29b2f4964a44556db35e7583e67d63d199

Add refine_trait_spec attribute.

view details

Vytautas Astrauskas

commit sha fc752c804339388e780ec9bcb32b94980d9990e5

Add verify-test command to x.py.

view details

Vytautas Astrauskas

commit sha d0d49d7ed56d3e741b6f984fa8c536f6cc1f3d1b

Merge pull request #193 from viperproject/fix-179 Parse trait specs.

view details

push time in 25 days

delete branch viperproject/prusti-dev

delete branch : fix-179

delete time in 25 days

PR merged viperproject/prusti-dev

Parse trait specs.

A work in progress to fix #179

+570 -58

2 comments

15 changed files

vakaras

pr closed time in 25 days

issue closedviperproject/prusti-dev

Parsing of Prusti attributes on methods

Since the 2018->2020 compiler upgrade, prusti-spec doesn't support requires and ensures attributes on methods in traits and in type implementations. After #177, the same happens for pure and trusted.

closed time in 25 days

fpoli

push eventviperproject/prusti-dev

Vytautas Astrauskas

commit sha b21e8d29b2f4964a44556db35e7583e67d63d199

Add refine_trait_spec attribute.

view details

Vytautas Astrauskas

commit sha fc752c804339388e780ec9bcb32b94980d9990e5

Add verify-test command to x.py.

view details

push time in 25 days

pull request commentviperproject/prusti-dev

Fix issue 179

Why the verify-test command? If it's for debugging we could put scripts like that in a scripts folder

./x.py test <test> prints error messages in json, which is very hard to read. So, running a specific test in a “normal” way seems to be a command that one would use often. Especially, if it also configures the necessary flags correctly like checking for overflows (not done yet).

to keep x.py lean.

I would like to have x.py as a main entry point because it makes much easier to discover commands. If the file grows too big, we can just split into multiple Python modules.

I also have some scripts which I could add, for example to move passing tests from tests_old to tests.

I think it would be useful if you shared them. We can delete them after we have finished the migration completely.

vakaras

comment created time in a month

push eventviperproject/prusti-dev

Federico Poli

commit sha 52b7b98e49271a49dee41d3152c11ce84ad5f0c6

Ignore DEBUG and TRACE log messages in release mode

view details

Federico Poli

commit sha 98cfdbb1deb929799c715bfb9d9d57314f5274a8

Remove outdated or build instructions from the readme

view details

Federico Poli

commit sha 724fe34df114447cbccf6cc9be7bc81f1d9bf685

Remove outdated or build instructions from the readme

view details

Federico Poli

commit sha d1695eb0efd7c8490e1f3e343751fd85afeedb81

Update readme

view details

Federico Poli

commit sha 67178f006056d2809b3564c1e60400b683728547

Fix compiler panic when encoding type invariants

view details

Federico Poli

commit sha 215fa872967720f03a7ca89f4d63401159ca0277

Fix usage of after_expiry in tests

view details

Federico Poli

commit sha 32712e3071f51bdf418aa958276b1cc603e785de

Fix usage of try in Knights_tour.rs

view details

Federico Poli

commit sha 642ff9d77c8ee57884dc737537cde94bf4ab7dbf

Fix typo in readme Co-authored-by: Aurel <Aurel300@users.noreply.github.com>

view details

Federico Poli

commit sha 9cfc7e4e788580ffd42919a7e3c094da5d6b82dc

Update readme Co-authored-by: Aurel <Aurel300@users.noreply.github.com>

view details

Federico Poli

commit sha 237b6877fe32e6a2aa0e4d054d39bd929449c73c

Merge pull request #207 from viperproject/log Hide TRACE and DEBUG logs, update readme

view details

Federico Poli

commit sha 117db76c7416363514bb3a41b901c12cd01ca29c

Skip NonUse context in AccessCollector::visit_place

view details

Federico Poli

commit sha a56c9f20051cd9d115b4ef7aaa4c082226655ec8

Implement missing RegionKind::ReErased case in extract_bound_region

view details

Federico Poli

commit sha 5523ff4353592e447ca08a5baf0f369f73bb8324

Enable tests

view details

Federico Poli

commit sha 18b200f56bcc0fb980e680f855e74aeb6cc5ec23

Enable tests

view details

Federico Poli

commit sha 3d0184b9bd46e1009b7ba3e3beb7414c8dc87987

Add missing intentation Co-authored-by: Aurel <Aurel300@users.noreply.github.com>

view details

Federico Poli

commit sha 25bfed85f37cf687f554b4f6f191fc22236851df

Update todo comment in a test

view details

Federico Poli

commit sha 98dab4876070c8eeb13525602a4b87c25d750a7a

Merge pull request #208 from viperproject/fix-tests Fix tests

view details

Federico Poli

commit sha 1db0d08ba83ffc6d2513c3c804b4d3dc1a98d11e

Cache cargo builds in quick-tests

view details

Federico Poli

commit sha 0765ee5033d228fe445a7b1135e66aad0226277d

Merge pull request #209 from viperproject/cargo-cache Cache cargo builds in quick-tests

view details

Vytautas Astrauskas

commit sha 003c817db899b76a275d711ed6918abfeade4468

Start working on issue 179: fix parsing.

view details

push time in a month

push eventviperproject/prusti-dev

Vytautas Astrauskas

commit sha 56727000e252ff79057d845baef1ebfbfda63b15

Disable again the refinement tests.

view details

push time in a month

push eventviperproject/prusti-dev

Vytautas Astrauskas

commit sha b850aeb95f5d0410e4261e0cc7b7b13f8ad8cb5f

Resolve self_ty of a call on a struct.

view details

push time in a month

push eventviperproject/prusti-dev

Vytautas Astrauskas

commit sha 33dbf2be026deb283ec4ff5762b9aa685608b852

Add a missing break statement.

view details

push time in a month

push eventviperproject/prusti-dev

Vytautas Astrauskas

commit sha 8c541207b35b9f891e960960cc1d25fbd3b082f0

Add verify-test command to x.py.

view details

push time in a month

push eventviperproject/prusti-dev

Vytautas Astrauskas

commit sha 1850902a25b860fb0c69d25cc05bfa35306db09b

Add refine_trait_spec attribute.

view details

push time in a month

push eventviperproject/prusti-dev

Vytautas Astrauskas

commit sha 9c0c060a1c6a92d570224094e914d0d0bc89be90

Merge pull request #192 from viperproject/fix-188 Try to fix #188.

view details

Federico Poli

commit sha 3315976b5a60d70ea61175d7fafa2cd2e3625330

Simplify collection of specifications

view details

Federico Poli

commit sha 92839750091f3b4d3b435ee51c78fc6867d9c8ce

Rewrite SpecEncoder::encode_expression

view details

Federico Poli

commit sha 38cd494504227927a81c57c3b046608cac234185

Simplify encode_pure_function_body

view details

Federico Poli

commit sha e8bf7033515f15cff6d8015e95e03f6c38b14399

Fix missing namespace

view details

Federico Poli

commit sha 931b5eca8dd1e125b27df94aeb291cdf90961782

Use the new 'replace_multiple_places' function

view details

Federico Poli

commit sha f4b4e269a464baacedc591ec01a50aea1b09308c

Stop using the '_pure' namespace

view details

Federico Poli

commit sha 19669e4ad01d3e2152747710be5c9acc2f52a9cc

Fix test annotations

view details

Federico Poli

commit sha a351c92c1639b739a313757dfe9679783f5655e4

Fix collection of closure instantiations

view details

Federico Poli

commit sha 1e54799be76339086c8f944ef98bef471c6b6677

Make SpecEncoder private

view details

Federico Poli

commit sha d7811b85adef29da24e8ab79ea5f6d941ba4caba

Comment unused implementation of type invariants

view details

Federico Poli

commit sha c96270e7f4ad8c72036362b58f42a3991994d6e7

Remove redundant MIR argument from encode_spec_assertion(..)

view details

Federico Poli

commit sha 2c566e94c8847c15f3c213219cb1743b83f92bf2

Document encode_spec_assertion(..)

view details

Federico Poli

commit sha 05f2f87f6c4788156ca886a6cbeafa7e2361df7e

Fix the new encode_expression function

view details

Federico Poli

commit sha b809726dd7b8ac4e56dceaa220af5b4f3c02f11c

Rename methods

view details

Federico Poli

commit sha 2daea1caa59af04d5c9d5d7c8175fc416fa38f1b

Fix encoding of old expressions in specifications

view details

Federico Poli

commit sha d156be5ca2dcc58ecb1df348c1786a3961fff893

Encode quantified variables

view details

Federico Poli

commit sha 978ea16b6b6f20e3cfc7fd1371dc6001fc88bff8

Fix collision of replacements

view details

Federico Poli

commit sha 201541c6421f11bf1e8bb3fe45876d8f0deb9782

Add tests

view details

Federico Poli

commit sha 58d9823eb71bfc3478d4174aaf937c10bb6c8671

Fix compilation error after rebase

view details

push time in a month

issue commentviperproject/prusti-dev

Use prusti-contracts from regular Rust projects

Since when Prusti is not enabled, the proc macros can just be no-ops.

This is exactly what happens: implementation.

fpoli

comment created time in a month

issue openedrust-corpus/qrates

Consider switching to fs-err

Consider using fs-err instead of built-in fs.

created time in a month

push eventviperproject/prusti-dev

Vytautas Astrauskas

commit sha 4365dd28a045c08af14efcf59e1265fd03713435

Start working on issue 179: fix parsing.

view details

push time in a month

create barnchviperproject/prusti-dev

branch : fix-179

created branch time in a month

push eventviperproject/prusti-dev

Vytautas Astrauskas

commit sha c4e399452aa6bf5af77872449cb205578ca249f1

Try to fix #188.

view details

Vytautas Astrauskas

commit sha 9c0c060a1c6a92d570224094e914d0d0bc89be90

Merge pull request #192 from viperproject/fix-188 Try to fix #188.

view details

push time in a month

issue closedviperproject/prusti-dev

Prusti crashes while creating a stub due to non-local proc_def_id

Currently, Prusti crashes on the program below while attempting to create a stub for partial_cmp. The issue originates here when creating a new Procedure: the def_id corresponding to partial_cmp is not local.

Do you know a workaround for this? It seems the only method in TyCtxt providing MIR that does not require a LocalDefId is optimized_mir.

use prusti_contracts::*;
use std::cmp::Ordering;

#[derive(PartialEq)]
struct A {
    i: i32,
}

impl PartialOrd for A {
    fn partial_cmp(&self, other: &A) -> Option<Ordering> {
        self.i.partial_cmp(&other.i)
    }
}

#[requires(x < y)]
fn test(x: A, y: A) {
}

closed time in a month

cmatheja

delete branch viperproject/prusti-dev

delete branch : fix-188

delete time in a month

PR merged viperproject/prusti-dev

Try to fix #188.

@cmatheja With this change, Prusti does not crash anymore but gives the following error for your example:

[Prusti: invalid specification] use of impure function "std::cmp::PartialOrd::lt" in assertion is not allowed
+4 -2

2 comments

1 changed file

vakaras

pr closed time in a month

pull request commentviperproject/prusti-dev

Try to fix #188.

As long as it is indeed safe to switch to optimized mir, I can take care of the rest.

StubFunctionEncoder uses MIR only to get the types of the arguments, so optimized MIR should work here.

vakaras

comment created time in a month

PR opened viperproject/prusti-dev

Try to fix #188.

@cmatheja With this change, Prusti does not crash anymore but gives the following error for your example:

[Prusti: invalid specification] use of impure function "std::cmp::PartialOrd::lt" in assertion is not allowed
+4 -2

0 comment

1 changed file

pr created time in a month

push eventviperproject/prusti-dev

Vytautas Astrauskas

commit sha c4e399452aa6bf5af77872449cb205578ca249f1

Try to fix #188.

view details

push time in a month

create barnchviperproject/prusti-dev

branch : fix-188

created branch time in a month

issue commentrust-corpus/qrates

Add query: Count references to packed structs

“packed fields” → fields of packed structs.

vakaras

comment created time in a month

issue openedrust-corpus/qrates

Add query: find all macros that emit unsafe code

Write a query that finds all macros that generate unsafe blocks.

Motivation: finding uses of crates like plutonium (discussion).

To ensure that we do not miss some important macros, we should also collect all unused macros.

created time in a month

issue openedrust-corpus/qrates

Add query: find all conflicting #[no_mangle] functions

Joshua suggested checking how many crates are affected by this bug.

Steps:

  • [ ] Update the extractor to collect information whether a function is annotated with #[no_mangle].
  • [ ] Write a query that collects all #[no_mangle] queries that have the same name.

created time in a month

issue commentviperproject/prusti-dev

First class support for type parameters in VIR

I think we should check whether it would be cleaner to have two layers of VIR: a generic VIR and monomorphic VIR that can be directly translated into Viper.

fpoli

comment created time in a month

issue openedrust-corpus/qrates

Add query: Count references to packed structs

A question by Ralf:

"how many crates create references to packed fields, inside or outside unsafe blocks" (and would thus be affected by finally making that a hard error)?

Required changes:

  • [] Collect repr of ADTs.
  • [] Write the query.

created time in a month

push eventviperproject/prusti-dev

Vytautas Astrauskas

commit sha 8f8ff8eacecb9b96a743e9d94a35881ec39ffb61

Fix encoding of Box::new.

view details

Vytautas Astrauskas

commit sha 315a1bee0fa54929939f9d6979ea42e0efadb148

Fix encoding of MutatingUse::Drop.

view details

Vytautas Astrauskas

commit sha a11a5f9691eec5b54338d3c0882d71e542e9a0d4

Add support for downcast.

view details

Vytautas Astrauskas

commit sha 629d451d2140784378db3cbf5caeb530a61d1556

Enable tests.

view details

Vytautas Astrauskas

commit sha 4e94a3e06fbbfc3641498e4fd5203ed6c59fc88c

Merge pull request #186 from viperproject/fix-182 Fix #182

view details

push time in a month

delete branch viperproject/prusti-dev

delete branch : fix-182

delete time in a month

PR merged viperproject/prusti-dev

Fix 182

An attempt to fix #182.

+39 -37

0 comment

14 changed files

vakaras

pr closed time in a month

issue closedviperproject/prusti-dev

Tests crashing for unimplemented downcast

The tests listed below crash with "not implemented: We do not support downcast yet" at prusti-interface/src/utils.rs:42:

https://github.com/viperproject/prusti-dev/blob/910f2a59bd987f260d8df44687f74f8e5cd49715/prusti-interface/src/utils.rs#L41-L43

test [compile-fail] fail/assert-false/list-sound.rs ... 
test [compile-fail] fail/assert-false/tree-sound.rs ... 
test [compile-fail] fail/no-annotataions/unreachable-branch.rs ... 
test [run-pass] pass/larger/first-final.rs ... 
test [run-pass] pass/loop-invs/result_in_guard.rs ... 
test [run-pass] pass/no-annotations/enums.rs ... 
test [run-pass] pass/no-annotations/list.rs ... 
test [run-pass] pass/no-annotations/nested-match.rs ... 
test [run-pass] pass/no-annotations/tree-with-box.rs ... 
test [run-pass] pass/no-annotations/unreachable.rs ... 
test [run-pass] pass/no-annotations/void.rs ... 
test [run-pass] pass/rosetta/Singly_Linked_List.rs ... 

closed time in a month

fpoli

PR opened viperproject/prusti-dev

Fix 182

An attempt to fix #182.

+39 -37

0 comment

14 changed files

pr created time in a month

create barnchviperproject/prusti-dev

branch : fix-182

created branch time in a month

Pull request review commentviperproject/prusti-dev

Ghost Type Encodings

 impl<'p, 'v, 'r: 'v, 'tcx: 'v> TypeEncoder<'p, 'v, 'tcx> {         }     } +    fn is_ghost_adt(ghost_adt_def: &ty::AdtDef, item_name: String) -> Option<String> {+        // check if Crate: prusti_contracts and Module: ghost+        let item_name: Vec<&str> = item_name.split("::").collect();+        let crate_name = item_name[0];+        let mod_name = item_name[1];+        let adt_identifier = item_name[2];+        if crate_name.eq("prusti_contracts") && mod_name.contains("ghost"){+            let ghost_name = ghost_adt_def.non_enum_variant().ident.as_str();+            if ghost_name.contains("Ghost") {+                return Some(ghost_name.to_string());+            }+        }+        None+    }++    fn encode_ghost_predicate(ghost_type: &str, value_field: vir::Field) -> Vec<vir::Predicate> {+        match ghost_type {+            "GhostInt" => vec![vir::Predicate::new_primitive_value(

Do you suggest changing the name argument of the vir::Predicate::new_primitive_value() method to the type name instead of vir::Type::GhostInt?

Yes, see these lines of the bool encoding:

https://github.com/viperproject/prusti-dev/pull/181/files/33ac0c3e21d79636a7a595dc3eb9436aef2c7b14#diff-9d1fe0d43f4aa745d82726fcc766cfa7R291-R295

aakp10

comment created time in a month

PullRequestReviewEvent

Pull request review commentviperproject/prusti-dev

Ghost Type Encodings

 impl<'p, 'v, 'r: 'v, 'tcx: 'v> TypeEncoder<'p, 'v, 'tcx> {         }     } +    fn is_ghost_adt(ghost_adt_def: &ty::AdtDef, item_name: String) -> Option<String> {+        // check if Crate: prusti_contracts and Module: ghost+        let item_name: Vec<&str> = item_name.split("::").collect();+        let crate_name = item_name[0];+        let mod_name = item_name[1];+        let adt_identifier = item_name[2];+        if crate_name.eq("prusti_contracts") && mod_name.contains("ghost"){+            let ghost_name = ghost_adt_def.non_enum_variant().ident.as_str();+            if ghost_name.contains("Ghost") {+                return Some(ghost_name.to_string());+            }+        }+        None+    }++    fn encode_ghost_predicate(ghost_type: &str, value_field: vir::Field) -> Vec<vir::Predicate> {+        match ghost_type {+            "GhostInt" => vec![vir::Predicate::new_primitive_value(

I think it would be easiest to encode GhostInt in the same way as, for example, u32 is encoded.

aakp10

comment created time in a month

PullRequestReviewEvent

push eventrust-corpus/qrates

Vytautas Astrauskas

commit sha ae8d92d4f0ecbe7c881894478c1ce43dcf0ed6ea

Mention in README how to run a query on the entire crates.io by using our CI.

view details

push time in a month

PullRequestReviewEvent

Pull request review commentviperproject/prusti-dev

Ghost Type Encodings

+use std::ops::*;+use core::marker::PhantomData;++pub unsafe auto trait Ghost {}++macro_rules! implement_ghost_type {+    ($ghost_type: ident) => {+        pub struct $ghost_type;+        unsafe impl Ghost for $ghost_type{}+    };+}++macro_rules! implement_ghost_type_generic {+    ($ghost_type: ident) => {+        pub struct $ghost_type<T: Ghost> {+            _type: PhantomData<T>+        }+        impl <T: Ghost> $ghost_type<T> {+            ///  let seq_inst: GhostSeq<GhostInt> = GhostSeq::new();

Code examples should be inside Markdown code blocks:

            ///  ```rust
            ///  let seq_inst: GhostSeq<GhostInt> = GhostSeq::new();
            ///  ```
aakp10

comment created time in a month

PullRequestReviewEvent

Pull request review commentviperproject/prusti-dev

Ghost Type Encodings

 impl<'v> ToViper<'v, viper::Type<'v>> for Type {         match self {             &Type::Int => ast.int_type(),             &Type::Bool => ast.bool_type(),+            // N.B. currently testing with T = Int
            // N.B. currently testing with T = Int
            // FIXME: Implement support for generic arguments.
aakp10

comment created time in a month

PullRequestReviewEvent

pull request commentviperproject/prusti-dev

Port testcases to new syntax

I guess some of this is deprecated by #160 @fpoli ?

The tests under prusti/tests probably yes, but there are various other changes that I don't fully understand. Moveover, this PR has rustc-update as target branch, which I thought could be deleted. Do you know what's the status here @vakaras?

I think we should cherry-pick https://github.com/viperproject/prusti-dev/commit/17efa628a0aa9404962debd7320008dd55fc823c if it is not already redone (it fixes the recognition which blocks are spec blocks).

karlosss

comment created time in a month

pull request commentviperproject/prusti-dev

Bump up Rustc toolchain to 2020-09-20.

@fpoli Since this PR is likely to conflict with some other PRs, I will let you decide in which order to merge them.

vakaras

comment created time in a month

push eventviperproject/prusti-dev

Vytautas Astrauskas

commit sha 498fc1ccbc1c6279bba5733cce4cd7d649bb737f

Update expected output.

view details

push time in a month

create barnchviperproject/prusti-dev

branch : update-rust-toolchain

created branch time in a month

issue commentviperproject/prusti-dev

Loop invariants are ignored

The problem is in the visitor that collects specifications. That visitor currently collects specs only for items.

fpoli

comment created time in a month

CommitCommentEvent

pull request commentviperproject/prusti-dev

Verification of closure bodies

But this seems to require both #![feature(stmt_expr_attributes)] and #![feature(proc_macro_hygiene)] for now. @vakaras You were opposed to the former at least, in the PR comments. Is it just because you don't want to rely on any unstable features at all? Both seem to be pretty old features by now, I would expect them to stabilise…

I think that the code must be compilable with the stable Rust compiler to make Prusti adoptable in real codebases.

FabianWolff

comment created time in a month

push eventrust-corpus/qrates

Vytautas Astrauskas

commit sha 0a95513c0c2a64ad332d526c1ad84ec908dfdeb5

Update docs based on feedback.

view details

push time in 2 months

push eventrust-corpus/qrates

Vytautas Astrauskas

commit sha 1e594bedae2772b743739388efc4526bbf2e4b1f

Update README.

view details

push time in 2 months

more