GithubHelp home page GithubHelp logo

Highlight `box` about tree-sitter-rust HOT 7 CLOSED

tree-sitter avatar tree-sitter commented on May 19, 2024
Highlight `box`

from tree-sitter-rust.

Comments (7)

Nokel81 avatar Nokel81 commented on May 19, 2024 2

Sure, here says that is is a reserved keyword (even in Rust2015 it seems). And here is the uses of box, which are currently unstable in nightly but do work.

from tree-sitter-rust.

maxbrunsfeld avatar maxbrunsfeld commented on May 19, 2024

Can you share a link to the docs for this? Upon first search, all I'm seeing is very old discussions about the box syntax that was eventually removed.

from tree-sitter-rust.

GrayJack avatar GrayJack commented on May 19, 2024

For reference:

  1. rust-lang/rust#49733
  2. https://doc.rust-lang.org/unstable-book/language-features/box-syntax.html

from tree-sitter-rust.

Nokel81 avatar Nokel81 commented on May 19, 2024

@GrayJack So if I read correctly, they are removing the let x = box 1; syntax but might be keeping the if let box Some(y) = Box::new(Some(10))?

from tree-sitter-rust.

GrayJack avatar GrayJack commented on May 19, 2024

What I understood was that nothing is clear LOL

from tree-sitter-rust.

GrayJack avatar GrayJack commented on May 19, 2024

On another dive into the comments on those features using the box keyword:

Looks like box as expression will probably never go to stable and probably remain as a unstable feature till some problems related to the Box can be fixed, a possible fix for those problems would be this RFC, but it wasn't accepted yet (21/10/2020). Once Box type problems fixed, this feature will probably be removed.

About the box pattern, it also looks like it will never face the light of a stable release (there some thoughts about removing it and adding a deref pattern that will work on any type that can de dereferenced).

Either way, I think it's ok for us to implement those in the parser, since those features are used inside the stdlib and when we open those std files in a editor using tree-sitter the syntax usually breaks. Implementing them would mean that we can get closer to be possible to highlight and parse any Rust code.

from tree-sitter-rust.

amaanq avatar amaanq commented on May 19, 2024

I think we're gonna close this out since it probably will never be stabilized, and might be removed in the future, seems like deref patterns will supersede box patterns

from tree-sitter-rust.

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.