A derived implementation would not be appropriate for the Buffered types
since the buffer is both huge (64k by default) and full of uninitialized
memory. Instead of printing the whole thing, we display how full it is.
I also altered `MultiWriter` to make it generic over Writers instead of
taking `Box<Writer>` trait objects. `Box<Writer>` implements `Writer` so
existing use cases should continue to work, and this enables a more
useful Show implementation in applicable cases.
The change to `MultiWriter` may break code that uses it, but any fixes
should be easy.
[breaking-change]
r? @alexcrichton
Using "generic" disables a number of features that are present on all
x86_64 cpus, the "x86-64" target cpu is the common denominator for that
arch.
Refs #20777
If the type of a node cannot be determined due to a previous type error,
a "no type for node" ICE occurs. This commit makes it return ty_err
instead in such a case.
Fixes#20401.
Fixes#20506.
Fixes#20614.
Fixes#20752.
Fixes#20829.
Fixes#20846.
Fixes#20885.
Fixes#20886.
I saw these hanging on a windows bot, and the previous ones seem to have calmed
down after switching from Thread::spawn to Thread::scoped, so try that here as
well!
I saw these hanging on a windows bot, and the previous ones seem to have calmed
down after switching from Thread::spawn to Thread::scoped, so try that here as
well!
Currently, small aggregates are passed to functions as immediate values
as is. This has two consequences.
One is that aggregates are passed component-wise by LLVM, so e.g. a
struct containing four u8 values (e.g. an RGBA struct) will be passed as
four individual values.
The other is that LLVM isn't very good at optimizing loads/stores of
first class attributes. What clang does is converting the aggregate to
an appropriately sized integer type (e.g. i32 for the four u8 values),
and using that for the function argument. This allows LLVM to create
code that is a lot better.
Fixes#20450#20149#16506#13927
A derived implementation would not be appropriate for the Buffered types
since the buffer is both huge (64k by default) and full of uninitialized
memory. Instead of printing the whole thing, we display how full it is.
I also altered MultiWriter to make it generic over Writers instead of
taking Box<Writer> trait objects. Box<Writer> implements Writer so
existing use cases should continue to work, and this enables a more
useful Show implementation in applicable cases.
The change to MultiWriter may break code that uses it, but any fixes
should be easy.
[breaking-change]
Currently even small fixed-size arrays are passed as indirect
parameters, which seems to be just an oversight. Let's handle them the
same as structs of the same size, passing them as immediate values.
Currently, small aggregates are passed to functions as immediate values
as is. This has two consequences.
One is that aggregates are passed component-wise by LLVM, so e.g. a
struct containing four u8 values (e.g. an RGBA struct) will be passed as
four individual values.
The other is that LLVM isn't very good at optimizing loads/stores of
first class attributes. What clang does is converting the aggregate to
an appropriately sized integer type (e.g. i32 for the four u8 values),
and using that for the function argument. This allows LLVM to create
code that is a lot better.
Fixes#20450#20149#16506#13927
* add Token::AndAnd (double borrow)
* add Token::DotDot (range notation)
* remove Token::Pound and Token::At
Fixes a syntax error when parsing "fn f() -> RangeTo<i32> { return ..1; }".
Also, remove "fn_expr_lookahead".
It's from the fn~ days and seems to no longer be necessary.
Compiler gives the following warning:
`warning: the `u` suffix on integers is deprecated; use `us` or one of the fixed-sized suffixes`
And also the errror:
`error: mismatched types: expected `u64`, found `usize` (expected u64, found usize)`
Changing the suffix to `u64` results in a successful `cargo run` outputting the desired `Versions compared successfully!`
Part of #18085
Instead of using an Enum, we use a struct with Option<&Tree> as leaves. It allow
to limit a lot of allocation.
before:
```
texitoi@vaio:~/dev/benchmarksgame-rs$ time ./bin/binary-trees-orig 20
stretch tree of depth 21 check: -1
2097152 trees of depth 4 check: -2097152
524288 trees of depth 6 check: -524288
131072 trees of depth 8 check: -131072
32768 trees of depth 10 check: -32768
8192 trees of depth 12 check: -8192
2048 trees of depth 14 check: -2048
512 trees of depth 16 check: -512
128 trees of depth 18 check: -128
32 trees of depth 20 check: -32
long lived tree of depth 20 check: -1
real 0m3.860s
user 0m11.032s
sys 0m3.572s
```
after:
```
texitoi@vaio:~/dev/benchmarksgame-rs$ time ./bin/binary-trees 20
stretch tree of depth 21 check: -1
2097152 trees of depth 4 check: -2097152
524288 trees of depth 6 check: -524288
131072 trees of depth 8 check: -131072
32768 trees of depth 10 check: -32768
8192 trees of depth 12 check: -8192
2048 trees of depth 14 check: -2048
512 trees of depth 16 check: -512
128 trees of depth 18 check: -128
32 trees of depth 20 check: -32
long lived tree of depth 20 check: -1
real 0m2.824s
user 0m9.224s
sys 0m1.428s
```