Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
eddyb
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
16 ms
·
91.
▲
by
eddyb
10y ago
Compile error if it's holding on to any borrowed data on the stack - however, borrowing is only the default, if you move from a capture your closure will contain that value instead of reference to the value, and if you have "mov
92.
▲
by
eddyb
10y ago
Not even in nightly yet - follow https://github.com/rust-lang/rust/pull/35091 for updates (we're trying to land it this week).
93.
▲
by
eddyb
10y ago
It is a build system written in Rust: https://github.com/rust-lang/rust/tree/master/src/bootstrap There is only one Python file: https://github.com/rust-lang/rust/blob&#x
94.
▲
by
eddyb
10y ago
But how many times can you access the DRAM in that time? One thing you have to keep in mind is that the more dynamic the scene graph, and the larger its memory footprint, the more frequent you'll miss the cache while traversing it. It&
95.
▲
by
eddyb
10y ago
With generics, yes, like C++ templates: each combination of parameters results in one instance. However, you can opt into using trait objects instead, which do use virtual calls.
96.
▲
by
eddyb
10y ago
You can do it with either -C debug-assertions (stable) or -Z force-overflow-checks=on (unstable). The difference is that the former will also enable debug_assert! in your own code.
97.
▲
by
eddyb
10y ago
That's LLVM's abort intrinsic - no a lot of those left around, I believe OOM, panicking while panicking and stack overflow use it or used to use it.
98.
▲
by
eddyb
10y ago
> These are mostly reported using return values of type Error However, unlike more dynamic languages, the return types are usually Result<SuccessValue, SomeErrorType>, e.g. writing to a file or a socket will get you Result<usize
99.
▲
by
eddyb
10y ago
mio has nothing to do with callbacks in its design, unless you build such an abstraction yourself on top of it. However, without an ergonomic way to create state machines (i.e. generators), it's hard to use at all in the intended fashi
100.
▲
by
eddyb
10y ago
I believe C++14 adds the first sane C-family array type: template<typename T, size_t N> class array { T data[N]; };
101.
▲
by
eddyb
10y ago
My understanding was that the goal of that research project is to produce tools for proving code written in unsafe Rust as safe at the API boundary (with limitations around FFI and inline assembly, of course).
102.
▲
by
eddyb
10y ago
Well, actually, we store MIR in crate metadata. However, it's not a special serialization format, just the rustc_serialize infrastructure, i.e. you could also serialize MIR to JSON if you really wanted to.
103.
▲
by
eddyb
10y ago
You are correct that a Rust interpreter would work great on MIR, which is why Scott Olson (@tsion) has been working on one: https://github.com/tsion/miri (check out the slides and the report).
104.
▲
by
eddyb
10y ago
There is discussion of a WebAssembly backend which lowers MIR directly, see https://github.com/rust-lang/rust/issues/33205 .
105.
▲
by
eddyb
10y ago
AFAIK this could've been fixed in LLVM a long time ago, which would also help C code compiled with clang, although I believe stack probes are opt-in there. We can't fix it fully in rustc because we don't know the stack size,
106.
▲
by
eddyb
11y ago
If you write `let data = data;` in the closure, then you can achieve the effect of `move` without the special syntax (unless `data` can be copied, in which case there is really no way to force it to be moved inside the closure without `move
107.
▲
by
eddyb
11y ago
The hashing optimization isn't necessary as using String at all is wasteful - my code ended up being simpler, but in the end the largest gain came from replacing u64 with u32 - see https://news.ycombinator.com/item?id=1
108.
▲
by
eddyb
11y ago
LuaJIT 2.0.4: 3.67user 0.01system 0:03.68elapsed 99%CPU rustc 1.9.0-nightly (74b886ab1 2016-03-13) (-C opt-level=3): 5.18user 0.00system 0:05.20elapsed 99%CPU Switching to BTreeMap gives me: 4.36user 0.00system 0:04.38elapsed 99%CPU Using u
109.
▲
by
eddyb
11y ago
In a sibling answer, steveklabnik suggests the Rust version was compiled without optimizations - https://news.ycombinator.com/item?id=11285569 Could you try running both on the same machine? I'm curious if LuaJIT can s
110.
▲
by
eddyb
11y ago
Accelerando[0] starts with this quote, which I really like: "The question of whether a computer can think is no more interesting than the question of whether a submarine can swim." – Edsger W. Dijkstra [0] http://www.an
111.
▲
by
eddyb
11y ago
That's what the well-typed check I mentioned before is, see https://github.com/rust-lang/rust/pull/31474
112.
▲
by
eddyb
11y ago
We don't really have our own optimizations atm, but we do want MIR optimization passes. The benefits would be two-fold: We could do transformations LLVM can't figure out itself, like NVRO: `fn bar() -> T {let mut x = ...; foo(&
113.
▲
by
eddyb
11y ago
Depends what you mean by "match" statements: if you're referring to complex patterns, yes, they get desugared. If you're instead referring to matching over ADT (enum) variants, that is a MIR primitive, the "Switch&q
114.
▲
by
eddyb
11y ago
Yes, there are no immediate plans for anything other than MIR at the imperative-semantic level (the compiler also uses HIR, which is mostly a desugared AST and not related to LLVM IR). Currently, initial support for lowering MIR to LLVM IR
115.
▲
by
eddyb
11y ago
It has a predefined set of calling conventions (sadly, this doesn't list x86 and other architecture-specific ones): http://llvm.org/docs/LangRef.html#calling-conventions GHC and HiPE appear to have gotten themselv
116.
▲
by
eddyb
11y ago
The x87 FPU "stack" is not truly a stack though: it's rather a ring buffer of 8 registers. And you can model it pretty well even without a "head pointer", just with moves between all registers, e.g. push(x) is ST(7)
117.
▲
by
eddyb
11y ago
At no point while using LLVM, could Rust have used a different calling convention. It was managing its stack, but it does that even today: when creating a thread, it allocates a 8MB stack. Within that stack, however, function calls work as
118.
▲
by
eddyb
11y ago
"This isn't a theoretical question at all -- Rust actually has a different calling convention from C" Technically correct, but not at the register/stack management level: LLVM still controls all of that, Rust only choose
119.
▲
by
eddyb
11y ago
It's been rewritten in JavaScript so you don't need Java at all.
120.
▲
by
eddyb
11y ago
What you can do for mmap is have several abstractions (or one using generics and phantom types), one for each different set of usecases, with different access modes. Examples would be: * read-only: &ROMemMap -> &[u8] * read-write
More ›