Code Monkey home page Code Monkey logo

Comments (4)

nilehmann avatar nilehmann commented on June 9, 2024

The reason is that the function expects a strong reference but you only have a mutable one. This (again) can be solved by implementing opening of mutable references (seeing a mutable reference as strong during the duration of the lifetime). Maybe I should add implementing this to my new year's resolutions.

Note that the signature fn(&mut FdMap[@dummy], k: usize) is wrong because the function doesn't preserve the size of the vector, thus you could avoid the panic by taking a strong reference and exposing the updated length in the ensures clause. Then, whether to take strong vs mutable references (provided that we implement opening of mutable references) is a matter of encapsulation, you either expose the length or not.

from flux.

ranjitjhala avatar ranjitjhala commented on June 9, 2024

from flux.

nilehmann avatar nilehmann commented on June 9, 2024

Yes, I always wanted to implement it so I never bother making it a user facing error.

from flux.

ranjitjhala avatar ranjitjhala commented on June 9, 2024

Ah, ok sounds good let me close. The thing that motivated this issue works, but the original problem still remains, namely:

ctx.fdmap.delete(...)

causes a

panicked at 'expected type at Some(src/wrappers.rs:98:5: 98:27 (#0))', flux-typeck/src/type_env/paths_tree.rs:568:23

which requires me to do make the delete a method of ctx and do ctx.fdmap_delete... [update having a hard time replicating the problem in a small standalone test so will tell you about it offline...]

from flux.

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.