Don't keep the possibly initialized flow around longer than needed
The possibly initialized flow isn't used after liveness is computed, so don't keep it around. Locally this is about a 10% time win for tuple-stress (which is spending a lot of time calculating flows now that it's not spending so much on liveness).
r? @nikomatsakis
LHS of assign op is invariant
This addresses a bug injected by #45435. That PR changed the way we type-check `LHS <op> RHS` to coerce the LHS to the expected supertype in much the same way that we coerce the RHS.
The problem is that when we have a case of `LHS <op>= RHS`, we do not want to coerce to a supertype; we need the type to remain invariant. Otherwise we risk leaking a value with short-lifetimes into a expression context that needs to satisfy a long lifetime.
Fix#52126
add structured suggestions and fix false-positive for elided-lifetimes-in-paths lint
This adds structured suggestions to the elided-lifetimes-in-paths lint (introduced in Nov. 2017's #46254), prevents it from emitting a false-positive on anonymous (underscore) lifetimes (!), and adds it to the idioms-2018 group (#52041).
~~As an aside, "elided-lifetimes-in-paths" seems like an unfortunate name, because it's not clear exactly what "elided" means. The motivation for this lint (see original issue #45992, and [RFC 2115](e978a8d301/text/2115-argument-lifetimes.md (motivation))) seems to be specifically about not supplying angle-bracketed lifetime arguments to non-`&` types, but (1) the phrase "lifetime elision" has historically also referred to the ability to not supply a lifetime name to `&` references, and (2) an `is_elided` method in the HIR returns true for anoymous/underscore lifetimes, which is _not_ what we're trying to lint here. (That naming confusion is almost certainly what led to the false positive addressed here.) Given that the lint is relatively new and is allow-by-default, is it too late to rename it ... um, _again_ (#50879)?~~
~~This does _not_ address a couple of other false positives discovered in https://github.com/rust-lang/rust/issues/52041#issuecomment-402547901.~~
![elided_states](https://user-images.githubusercontent.com/1076988/42302137-2bf9479c-7fce-11e8-8bd0-f29aefc802b6.png)
r? @nikomatsakis
cc @nrc @petrochenkov
Rollup of 11 pull requests
Successful merges:
- #51807 (Deprecation of str::slice_unchecked(_mut))
- #52051 (mem::swap the obvious way for types smaller than the SIMD optimization's block size)
- #52465 (Add CI test harness for `thumb*` targets. [IRR-2018-embedded])
- #52507 (Reword when `_` couldn't be inferred)
- #52508 (Document that Unique::empty() and NonNull::dangling() aren't sentinel values)
- #52521 (Fix links in rustdoc book.)
- #52581 (Avoid using `#[macro_export]` for documenting builtin macros)
- #52582 (Typo)
- #52587 (Add missing backtick in UniversalRegions doc comment)
- #52594 (Run the error index tool against the sysroot libdir)
- #52615 (Added new lines to .gitignore.)
Added new lines to .gitignore.
There are a handful of files that I often find in my local working directories that I never want to commit that aren't covered in the `.gitignore` file:
`/mir_dump`:
Default output location from `-Z mir-dump=all` for a specific test, I can't think of a reason why this should ever be commited.
`tags*`/`TAGS*`:
I use `vim-gutentags` which outputs `tags` and `tags.temp` which I don't want commited. I also collapsed the `TAGS`, `TAGS.vi`, `TAGS.emacs` into `TAGS*`.
`Session.vim`:
I use `vim-obsession` to save my current session in Vim, it outputs a `Session.vim` file, this also shouldn't be commited.
Run the error index tool against the sysroot libdir
Previously when building the error index tool in stage 0 we would
attempt to use stage 0 libraries, but because it depends on rustdoc,
those don't exist: rustdoc is built against stage 1 libraries.
This patch aligns those two and passes the stage 1 libdir to the error
index.
@GuillaumeGomez discovered that this hasn't worked (presumably for a long time now, but not sure).
r? @alexcrichton
Ever plagued by #43081 the compiler can return surprising spans in situations
related to procedural macros. This is exhibited by #47983 where whenever a
procedural macro is invoked in a nested item context it would fail to have
correct span information.
While #43230 provided a "hack" to cache the token stream used for each item in
the compiler it's not a full-blown solution. This commit continues to extend
this "hack" a bit more to work for nested items.
Previously in the parser the `parse_item` method would collect the tokens for an
item into a cache on the item itself. It turned out, however, that nested items
were parsed through the `parse_item_` method, so they didn't receive similar
treatment. To remedy this situation the hook for collecting tokens was moved
into `parse_item_` instead of `parse_item`.
Afterwards the token collection scheme was updated to support nested collection
of tokens. This is implemented by tracking `TokenStream` tokens instead of
`TokenTree` to allow for collecting items into streams at intermediate layers
and having them interleaved in the upper layers.
All in all, this...
Closes#47983
The existing elided-lifetimes-in-paths lint (introduced in Nov. 2017's
accd997b5 / #46254) lacked stuctured suggestions and—much more
alarmingly—produced false positives on associated functions (like
`Ref::clone`) and on anonymous '_ lifetimes (!!—yes, the very
anonymous lifetimes that we meant to suggest "instead"). That this
went apparently unnoticed for so long maybe tells you something about
how many people actually bother to flip on allow-by-default lints.
After many hours of good old-fashioned American elbow grease—and a
little help from expert reviewers—it turns out that getting the right
answer is a lot easier if we fire the lint while lowering the Higher
Intermediate Representation.
The lint is promoted to the idioms-2018 group.
Also, in the matter of test filenames, "elided" only has one 'l' (see,
e.g., https://en.wiktionary.org/wiki/elide).
Resolves#52041.
Document that Unique::empty() and NonNull::dangling() aren't sentinel values
The documentation of Unique::empty() and NonNull::dangling() could
potentially suggest that they work as sentinel values indicating a
not-yet-initialized pointer. However, they both declare a non-null
pointer equal to the alignment of the type, which could potentially
reference a valid value of that type (specifically, the first such valid
value in memory). Explicitly document that the return value of these
functions does not work as a sentinel value.