| Age | Commit message (Collapse) | Author | Lines |
|
|
|
Fixes #35653
cc https://github.com/rust-lang/rust-www/pull/621
|
|
|
|
Fixes #38002.
|
|
|
|
|
|
This is an annoying gotcha with the projection cache's handling of
nested obligations.
Nested projection obligations enter the issue in this case:
```
DEBUG:rustc::traits::project: AssociatedTypeNormalizer: depth=3
normalized
<std::iter::Map<std::ops::Range<i32>,
[closure@not-a-recursion-error.rs:5:30: 5:53]> as
std::iter::IntoIterator>::Item to _#7t with 12 add'l obligations
```
Here the normalization result is the result of the nested impl
`<[closure@not-a-recursion-error.rs:5:30: 5:53] as FnMut(i32)>::Output`,
which is an additional obligation that is a part of "add'l obligations".
By itself, this is proper behaviour - the additional obligation is
returned, and the RFC 447 rules ensure that it is processed before the
output `#_7t` is used in any way.
However, the projection cache breaks this - it caches the
`<std::iter::Map<std::ops::Range<i32>,[closure@not-a-recursion-error.rs:5:30:
5:53]> as std::iter::IntoIterator>::Item = #_7t` resolution. Now
everybody else that attempts to look up the projection will just get
`#_7t` *without* any additional obligations. This obviously causes all
sorts of trouble (here a spurious `EvaluatedToAmbig` results in
specializations not being discarded
[here](https://github.com/rust-lang/rust/blob/9ca50bd4d50b55456e88a8c3ad8fcc9798f57522/src/librustc/traits/select.rs#L1705)).
The compiler works even with this projection cache gotcha because in most
cases during "one-pass evaluation". we tend to process obligations in LIFO
order - after an obligation is added to the cache, we process its nested
obligations before we do anything else (and if we have a cycle, we handle
it specifically) - which makes sure the inference variables are resolved
before they are used.
That "LIFO" order That was not done when projecting out of a closure, so
let's just fix that for the time being.
Fixes #38033.
|
|
This update of compiler-rt includes rust-lang/compiler-rt#26 which provides a
targeted fix to the powisf2 intrinsics to keep #37559 fixed but also address
the new issue of #37630. I've also [written up my thoughts][1] on why it appears
that this is the correct fix for now (hoepfully at least).
Closes #37630
[1]: https://github.com/rust-lang/compiler-rt/pull/26#issuecomment-259751998
|
|
If a rule is flagged with `default(true)` then the pseudo-rule `default:foo`
will include that. If a rule is also flagged with `.host(true)`, however, then
the rule shouldn't be included for targets that aren't in the host array. This
adds a filter to ensure we don't pull in host rules for targets by accident.
|
|
This will cause it to be built as part of `make dist`.
|
|
|
|
|
|
Stabilize `..` in tuple (struct) patterns
I'd like to nominate `..` in tuple and tuple struct patterns for stabilization.
This feature is a relatively small extension to existing stable functionality and doesn't have known blockers.
The feature first appeared in Rust 1.10 6 months ago.
An example of use: https://github.com/rust-lang/rust/pull/36203
Closes https://github.com/rust-lang/rust/issues/33627
r? @nikomatsakis
|
|
fix silent overflows on `Step` impls
Part of https://github.com/rust-lang/rust/issues/36110
r? @eddyb
|
|
rustbuild: support MIPS host builds
There is a *little* code duplication, but primarily for sake of "match exhaustiveness". Let's blame Linux/MIPS for not exposing endianness explicitly in `uname -m` (that's user-space interface and as such is frozen).
Currently the build won't work as we have to wait for a new stage0 for the MIPS host compilers, but this paves the way to self-hosted Rust on MIPS. The cross-compiled MIPS binaries are confirmed to work on the Loongson 3A2000 (MIPS64r2-compatible) so we have plenty of confidence that they'll work on other MIPS platforms too, as Linux/MIPS user-space ABI is consistent across machines of the same bitness.
r? @alexcrichton
|
|
Remove mention of mipsel target_arch
This is the only remaining instance in rustc. All others were in the libc repo, removed with rust-lang/libc#445.
Actually there's more to clean in `libsyntax/abi.rs`, but let's save that for another commit...
|
|
Fix Arc::clone()'s MAX_REFCOUNT check (off-by-one)
Before, the strong count of an `Arc` could be set to
`MAX_REFCOUNT + 1`, because when this happened, `old_size` would
be exactly `MAX_REFCOUNT`. `Arc::clone()` would not abort.
This commit changes the check in `Arc::clone()` to also abort if
the old value is equal to `MAX_REFCOUNT`, because then the new
value will be equal to `MAX_REFCOUNT + 1`.
A test would require allocating memory for `isize::MAX` pointers.
This would probably crash any machine, so no test is submitted
with this commit.
|
|
There is a *little* code duplication, but primarily for sake of "match
exhaustiveness". Let's blame Linux/MIPS for not exposing endianness
explicitly in `uname -m` (that's user-space interface and as such is
frozen).
Currently the build won't work as we have to wait for a new stage0 for
the MIPS host compilers, but this paves the way to self-hosted Rust on
MIPS. The cross-compiled MIPS binaries are confirmed to work on the
Loongson 3A2000 (MIPS64r2-compatible) so we have plenty of confidence
that they'll work on other MIPS platforms too, as Linux/MIPS user-space
ABI is consistent across machines of the same bitness.
|
|
The `mipsel` `target_arch` was introduced with the initial MIPSel
support (rust-lang/rust@82ec1aef293ddc5c6373bd7f5ec323fafbdf7901),
but was subsequently removed with implementation of the Flexible Target
Specification (Rust RFC 0131,
rust-lang/rust@3a8f4ec32a80d372db2d02c76acba0276c4effd0).
This is the only remaining instance in rustc. All others are in the libc
repo, and are fixed in rust-lang/libc@b3676593f6930c32d947c59e210789bbfcb30960.
|
|
macros: improve shadowing checks
This PR improves macro-expanded shadowing checks to work with out-of-(pre)order expansion.
Out-of-order expansion became possible in #37084, so this technically a [breaking-change] for nightly.
The regression test from this PR is an example of code that would break.
r? @nrc
|
|
use arm abi blacklist for aarch64 fuchsia
r? @alexcrichton
|
|
Force static linking of LLVM
Run `llvm-config` with `--link-static` if available, to force static linking of LLVM.
This option was added in LLVM 3.8.
This is my first pull request, any feedback is welcome!
Fixes #36854
See also: #36996
|
|
|
|
The constant name `MAX_REFCOUNT` suggests that the value is a
_hard_ limit on the amount of references to an `Arc`. This is
a more soft limit however. This commit adds a comment to the
constant to annotate this.
See also: PR #37605
|
|
Add test for issue 18060.
Closes #18060
|
|
Run llvm-config with "--link-static" if available, to force static linking of LLVM.
This option was added in LLVM 3.8.
Fixes #36854
See also: #36996
|
|
|
|
|
|
Add example using Self to reference
When I first came across `Self` I had a hard time finding references to it in the docs (and it's also been asked about on [StackOverflow](http://stackoverflow.com/questions/32304595/whats-the-difference-between-self-and-self).
I hope this example provides someone who comes across it for the first time a little more help. If there is a better way to show an example actually using `Self`, I'm happy to modify this. It was just the simplest place to start I could see.
|
|
Rollup of 24 pull requests
- Successful merges: #37255, #37317, #37408, #37410, #37422, #37427, #37470, #37501, #37537, #37556, #37557, #37564, #37565, #37566, #37569, #37574, #37577, #37579, #37583, #37585, #37586, #37587, #37589, #37596
- Failed merges: #37521, #37547
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Add error when proc_macro_derive is used not on functions
Fixes #37590
|
|
std: Track change to cprng syscall signature (Fuchsia)
The mx_cprng_draw syscall has changed signature to separate the status
and size return values, rather than multiplexing them into a single
value with errors interpreted as a negative value. This patch tracks
that change.
|
|
Remove recursive call from Cow::to_mut
It seems to prevent it from being inlined.
|
|
fix #37559: update compiler-rt
Fixes #37559
r? @alexcrichton
|
|
Change `Into<Vec<u8>> for String` and `Into<OsString> for PathBuf` to From
Fixes #37561. First contribution, happy with any and all feedback!
|
|
Add `-Z hir-stats` for collecting statistics on HIR and AST
The data collected will be printed to the commandline and looks like the following:
```
// stats for libcore
PRE EXPANSION AST STATS
Name Accumulated Size Count Item Size
----------------------------------------------------------------
TypeBinding 2_280 57 40
Mod 3_560 89 40
PathListItem 6_516 181 36
Variant 7_872 82 96
LifetimeDef 21_280 380 56
StructField 22_880 260 88
Lifetime 23_800 1_190 20
Local 30_192 629 48
ForeignItem 31_504 179 176
Arm 42_880 670 64
Mac 46_960 587 80
FnDecl 57_792 1_204 48
TraitItem 69_504 362 192
TyParamBound 98_280 945 104
Block 108_384 2_258 48
Stmt 144_720 3_618 40
ImplItem 230_272 1_028 224
Item 467_456 1_826 256
Pat 517_776 4_623 112
Attribute 745_680 15_535 48
Ty 1_114_848 9_954 112
PathSegment 1_218_528 16_924 72
Expr 3_082_408 20_279 152
----------------------------------------------------------------
Total 8_095_372
POST EXPANSION AST STATS
Name Accumulated Size Count Item Size
----------------------------------------------------------------
MacroDef 1_056 12 88
Mod 3_400 85 40
TypeBinding 4_280 107 40
PathListItem 6_516 181 36
Variant 7_872 82 96
StructField 24_904 283 88
ForeignItem 31_504 179 176
TraitItem 69_504 362 192
Local 85_008 1_771 48
Arm 100_288 1_567 64
Lifetime 123_980 6_199 20
LifetimeDef 126_728 2_263 56
TyParamBound 297_128 2_857 104
FnDecl 305_856 6_372 48
Block 481_104 10_023 48
Stmt 535_120 13_378 40
Item 1_469_952 5_742 256
Attribute 1_629_840 33_955 48
ImplItem 1_732_864 7_736 224
Pat 2_360_176 21_073 112
PathSegment 5_888_448 81_784 72
Ty 6_237_168 55_689 112
Expr 12_013_320 79_035 152
----------------------------------------------------------------
Total 33_536_016
HIR STATS
Name Accumulated Size Count Item Size
----------------------------------------------------------------
MacroDef 864 12 72
Mod 2_720 85 32
TypeBinding 3_424 107 32
PathListItem 5_068 181 28
Variant 6_560 82 80
StructField 20_376 283 72
ForeignItem 27_208 179 152
WherePredicate 43_776 684 64
TraitItem 52_128 362 144
Decl 68_992 2_156 32
Local 89_184 1_858 48
Arm 94_368 1_966 48
LifetimeDef 108_624 2_263 48
Lifetime 123_980 6_199 20
Stmt 168_000 4_200 40
TyParamBound 251_416 2_857 88
FnDecl 254_880 6_372 40
Block 583_968 12_166 48
Item 1_240_272 5_742 216
ImplItem 1_361_536 7_736 176
Attribute 1_620_480 33_760 48
Pat 2_073_120 21_595 96
Path 2_385_856 74_558 32
Ty 4_455_040 55_688 80
PathSegment 5_587_904 87_311 64
Expr 7_588_992 79_052 96
----------------------------------------------------------------
Total 28_218_736
```
|
|
reference full path DefaultHasher
Since `DefaultHasher` does not in scope, it's not obvious where to find it.
|
|
Shrink `hir::Expr` slightly
r? @eddyb
|
|
Fix issues with the Add/AddAssign impls for Cow<str>
* Correct the stability attributes.
* Make Add and AddAssign actually behave the same.
* Use String::with_capacity when allocating a new string.
* Fix the tests.
|
|
macros: improve expansion performance
This PR fixes that regression, further improves performance on recursive, `tt`-heavy workloads, and makes a variety of other improvements to parsing and expansion performance.
Expansion performance improvements:
| Test case | Run-time | Memory usage |
| -------------- | -------- | ------------ |
| libsyntax | 8% | 10% |
| librustc | 15% | 6% |
| librustc_trans | 30% | 6% |
| #37074 | 20% | 15% |
| #34630 | 40% | 8% |
r? @eddyb
|
|
Set RUSTC_BOOTSTRAP to some value.
Environment variables on windows can't be empty.
|
|
Peekable::peek(): Use Option::as_ref()
Replace the match expression in .peek() with Option::as_ref() since it's the same functionality.
|
|
Fix ICE when querying DefId on Def::Err.
Also moves computations into check that `kind_id` is `Ok(_)`, which is in theory an optimization, though I expect it's minor.
Fixes #37534.
r? @eddyb.
|
|
Use DefId's in const eval for cross-crate const fn's
Fixes #36954.
r? @eddyb
cc @raphaelcohn
|