| Age | Commit message (Collapse) | Author | Lines |
|
resolve: Fix one more ICE in import validation
So if you have an unresolved import
```rust
mod m {
use foo::bar;
}
```
error recovery will insert a special item with `Def::Err` definition into module `m`, so other things depending on `bar` won't produce extra errors.
The issue was that erroneous `bar` was overwriting legitimate `bar`s coming from globs, e.g.
```rust
mod m {
use baz::*; // imports real existing `bar`
use foo::bar;
}
```
causing some unwanted diagnostics talking about "unresolved items", and producing inconsistent resolutions like https://github.com/rust-lang/rust/issues/57015.
This PR stops overwriting real successful resolutions with `Def::Err`s.
Fixes https://github.com/rust-lang/rust/issues/57015
|
|
|
|
Add a note describing the type of the non-Copy moved variable
Closes #56654
r?@davidtwco
|
|
|
|
Implement RFC 2338, "Type alias enum variants"
This PR implements [RFC 2338](https://github.com/rust-lang/rfcs/pull/2338), allowing one to write code like the following.
```rust
#![feature(type_alias_enum_variants)]
enum Foo {
Bar(i32),
Baz { i: i32 },
}
type Alias = Foo;
fn main() {
let t = Alias::Bar(0);
let t = Alias::Baz { i: 0 };
match t {
Alias::Bar(_i) => {}
Alias::Baz { i: _i } => {}
}
}
```
Since `Self` can be considered a type alias in this context, it also enables using `Self::Variant` as both a constructor and pattern.
Fixes issues #56199 and #56611.
N.B., after discussing the syntax for type arguments on enum variants with @petrochenkov and @eddyb (there are also a few comments on the [tracking issue](https://github.com/rust-lang/rust/issues/49683)), the consensus seems to be treat the syntax as follows, which ought to be backwards-compatible.
```rust
Option::<u8>::None; // OK
Option::None::<u8>; // OK, but lint in near future (hard error next edition?)
Alias::<u8>::None; // OK
Alias::None::<u8>; // Error
```
I do not know if this will need an FCP, but let's start one if so.
|
|
Rollup of 7 pull requests
Successful merges:
- #57149 (Fix typo in pin documentation)
- #57153 (Small: Fix span in char documentation)
- #57159 (Update references to closed issue)
- #57163 (Give the crate select chevron room to breathe.)
- #57168 (Removed aligned ZST requirement from docs of read_/write_unaligned.)
- #57174 (Update link to rustc guide)
- #57177 (Fix warning when compiling rustc)
Failed merges:
r? @ghost
|
|
|
|
resolve: Fix another ICE in import validation
Imports are allowed to have ambiguous resolutions as long as all of them have same `Def`.
As it turned out, it's possible for different `Module`s to have same `Def` when `extern crate` items are involved.
Fixes https://github.com/rust-lang/rust/issues/56596
|
|
Update references to closed issue
Issue #28979 was closed with a link to #55467.
|
|
resolve: Fix an ICE in import validation
Fixes ICE reported in the comment https://github.com/rust-lang/rust/issues/56596#issuecomment-449866807
|
|
|
|
Tweaks to format string diagnostics
Add label spans and fix incorrect spans.
Fix #55155, fix #55350.
|
|
|
|
|
|
Add no-crate filter option on rustdoc
@onur asked me about it so here it is!
r? @QuietMisdreavus
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Co-Authored-By: Dylan-DPC <dylan.dpc@gmail.com>
|
|
|
|
Simplified foreign type rendering by switching from tables to flexbox. Also, removed some seemingly extraneous elements like “ghost” spans.
Reduces element count on std::iter::Iterator by 30%.
|
|
Resolve `$crate`s for pretty-printing at more appropriate time
Doing it in `BuildReducedGraphVisitor` wasn't a good idea, identifiers wasn't actually visited half of the time.
As a result some `$crate`s weren't resolved and were therefore pretty-printed as `$crate` literally, which turns into two tokens during re-parsing of the pretty-printed text.
Now we are visiting and resolving `$crate` identifiers in an item right before sending that item to a proc macro attribute or derive.
Fixes https://github.com/rust-lang/rust/issues/57089
|
|
|
|
Issue #28979 was closed with a link to #55467.
|
|
AST/HIR: Introduce `ExprKind::Err` for better error recovery in the front-end
This way we can avoid aborting compilation if expansion produces errors and generate `ExprKind::Err`s instead.
|
|
|
|
|
|
|
|
|
|
Call poly_project_and_unify_type on types that contain inference types
Commit f57247c48cb59 (Ensure that Rusdoc discovers all necessary auto
trait bounds) added a check to ensure that we only attempt to unify a
projection predicatre with inference variables. However, the check it
added was too strict - instead of checking that a type *contains* an
inference variable (e.g. '&_', 'MyType<_>'), it required the type to
*be* an inference variable (i.e. only '_' would match).
This commit relaxes the check to use 'ty.has_infer_types', ensuring that
we perform unification wherever possible.
Fixes #56822
|
|
|
|
|
|
|
|
|
|
Fix a number of uncovered deficiencies in diagnostics
|
|
|
|
Remove the private generic NonZero<T> wrapper type
Instead, use `#[rustc_layout_scalar_valid_range_start(1)]` directly on relevant libcore types.
|
|
describe index with _
|
|
Fix #55350.
|
|
When a format string has escaped whitespace characters format
arguments were shifted by one per each escaped character. Account
for these escaped characters when synthesizing the spans.
Fix #55155.
|
|
- Point at opening mismatched formatting brace
- Account for differences between raw and regular strings
- Account for differences between the code snippet and `InternedString`
- Add more tests
|
|
|
|
|
|
|
|
|
|
|
|
|