question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TY: Introduce array of unknown size

See original GitHub issue

This code is ok, but syntax checker marks array as wrong

const COUNT: usize = 2;

struct Foo {
    v: [usize; COUNT]
}

fn bar(f: Foo) {}

fn main() {
    bar(Foo{
        v:[10, 20] // E308, expected [usize], found [usize; 2]
    });
}

Mentoring instructions can be found in this comment

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
vlad20012commented, Sep 29, 2017

Btw, we should probably use Long instead of Int for array size. Just because if usize is even 32-bit it’s still more than java’s int and our type inference will fail on 3Gb arrays =D

1reaction
mkaputcommented, Sep 29, 2017

Unfortunately, now I don’t have a lot of time to grab large task, but I want to help too.

I know that feel bro

Read more comments on GitHub >

github_iconTop Results From Across the Web

c++ - How to initialize an array whose size is initially unknown?
Size of dynamically created array on the stack must be known at compile time. You can either use new : const char* pArray...
Read more >
How can I make an array of unknown size? - NI Community
Use Build Array.vi and shift register(s) to dynamically create the array. See the attached. For memory management, it is better to initialize the...
Read more >
How to declare an array of undefined or no initial size - Quora
Let's say you want to create an array of integers of some size, which you are not aware of initially. So to declare...
Read more >
Generating an array of unknown size : r/C_Programming
Hello everyone, I have some code where I am transforming a height map into a mesh, the end result would be an array...
Read more >
Making Dynamic array - MATLAB Answers - MathWorks
I want to creat an array that is dynamic in size. I mean I dont know what is going to be the size...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found