Previously, if there were a module in scope with the same name as the
primitive, that would take precedence. Coupled with
https://github.com/rust-lang/rust/issues/58699, this made it impossible
to link to the primitive when that module was in scope.
This approach could be extended so that `struct@foo` would no longer resolve
to any type, etc. However, it could not be used for glob imports:
```rust
pub mod foo {
pub struct Bar;
}
pub enum Bar {}
use foo::*;
// This is expected to link to `inner::Bar`, but instead it will link to the enum.
/// Link to [struct@Bar]
pub struct MyDocs;
```
The reason for this is that this change does not affect the resolution
algorithm of rustc_resolve at all. The only reason we could special-case
primitives is because we have a list of all possible primitives ahead of time.
Remove unnecessary release from Arc::try_unwrap
The thread that recovers the unique access to Arc inner value (e.g., drop
when ref-count strong reaches zero, successful try_unwrap), ensures that
other operations on Arc inner value happened before by synchronizing
with release operations performed when decrementing the reference counter.
When try_unwrap succeeds, the current thread recovers the unique access
to Arc inner value, so release is unnecessary.
r? @Amanieu
add `lazy_normalization_consts` feature gate
In #71973 I underestimated the amount of code which is influenced by lazy normalization of consts
and decided against having a separate feature flag for this.
Looking a bit more into this, the following issues are already working with lazy norm in its current state #47814#57739#73980
I therefore think it is worth it to enable lazy norm separately. Note that `#![feature(const_generics)]` still automatically activates
this feature, so using `#![feature(const_generics, lazy_normalization_consts)]` is redundant.
r? @varkor @nikomatsakis
Fix try_print_visible_def_path for Rust 2018
The recursive check of `try_print_visible_def_path` did not properly handle the Rust 2018 case of crate-paths without 'extern crate'. Instead, it returned a "not found" via (false, self).
This fixes#56175.
Some refactoring around intrinsic type checking
So... This PR went a bit overboard. I wanted to make the `rustc_peek` intrinsic safe (cc @ecstatic-morse ), and remembered a long-standing itch of mine. So I made that huge `&str` match for the intrinsic name a match on `Symbol`s (so basically `u32`s). This is unlikely to have a positive perf effect, even if it likely has better codegen (intrinsics are used rarely, mostly once in their wrapper), so it's mostly a consistency thing since other places actually match on the symbol name of the intrinsics.
added .collect() into String from Box<str>
I have not created an rfc, because i felt like this is a very minor change.
i have just set a random feature name and rust version as stability attribute, i expect to have to change that, i just don't know what the policy on that is. all guides i could find focused on contributing to the compiler, not contributing to the standard library.
drawbacks: more code in the standard library, could be replaced with specialization: base-implementation for AsRef\<str> and specialization for String and Cow. i can write that code if ppl want it.
advantages: using "real strings" i.e. Box\<str> is as ergonomic as string slices (&str) and string buffers (String) with iterators.
Handle inactive enum variants in `MaybeUninitializedPlaces`
Resolves the first part of #69715.
This is the equivalent of #68528 but for `MaybeUninitializedPlaces`. Because we now notify drop elaboration that inactive enum variants might be uninitialized, some drops get marked as ["open" that were previously "static"](e0e5d82e16/src/librustc_mir/transform/elaborate_drops.rs (L191)). Unlike in #69715, this isn't strictly better: An "open" drop expands to more MIR than a simple call to the drop shim. However, because drop elaboration considers each field of an "open" drop separately, it can sometimes eliminate unnecessary drops of moved-from or unit-like enum variants. This is the case for `Option::unwrap`, which is reflected in the `mir-opt` test.
cc @eddyb
r? @oli-obk
This causes the components of FQN's to behave similarly to other links
in the contents of rustdoc-styled pages.
I (and I hope others at least in part) have found the prior design to be
somewhat confusing, as it is not clear (upon hovering) that the various
parts of the FQN are actually links that the user can navigate to.
In short, this patch makes links in the FQN have an underline when the
user hovers over them, more clearly indicating that they can be used for
navigation.
Signed-off-by: Kristofer Rye <kristofer.rye@gmail.com>
The thread that recovers the unique access to Arc inner value (e.g., drop
when ref-count strong reaches zero, successful try_unwrap), ensures that
other operations on Arc inner value happened before by synchronizing
with release operations performed when decrementing the reference counter.
When try_unwrap succeeds, the current thread recovers the unique access
to Arc inner value, so release is unnecessary.
ship rust analyzer
This successfully builds rust-analyzer as a part of rust repo. I haven't yet added required changes to dist.rs -- seems like I just have to copy-paste quite a bit of code I don't really understand :-)
Bump mingw-check CI image from Ubuntu 16.04 to 18.04.
I chose 18.04 because we use it for other builders, and it's enough to get a version of MinGW that can build `libssh2-sys`.
This is a prereq for #73902, where `libssh2-sys` shows up as an indirect dependency of `x.py check src/tools/semverver` (through `src/tools/cargo`, which we don't currently `x.py check` because it's not in-tree). See also https://github.com/rust-lang/rust/pull/73902#issuecomment-652414502.
r? @Mark-Simulacrum cc @mati865
[mir-opt] Fix mis-optimization and other issues with the SimplifyArmIdentity pass
This does not yet attempt re-enabling the pass, but it does resolve a number of issues with the pass.
r? @oli-obk
I believe this closes#73223.