Commit Graph

1670 Commits

Author SHA1 Message Date
bors 208dd2032b Auto merge of #118847 - eholk:for-await, r=compiler-errors
Add support for `for await` loops

This adds support for `for await` loops. This includes parsing, desugaring in AST->HIR lowering, and adding some support functions to the library.

Given a loop like:
```rust
for await i in iter {
    ...
}
```
this is desugared to something like:
```rust
let mut iter = iter.into_async_iter();
while let Some(i) = loop {
    match core::pin::Pin::new(&mut iter).poll_next(cx) {
        Poll::Ready(i) => break i,
        Poll::Pending => yield,
    }
} {
    ...
}
```

This PR also adds a basic `IntoAsyncIterator` trait. This is partly for symmetry with the way `Iterator` and `IntoIterator` work. The other reason is that for async iterators it's helpful to have a place apart from the data structure being iterated over to store state. `IntoAsyncIterator` gives us a good place to do this.

I've gated this feature behind `async_for_loop` and opened #118898 as the feature tracking issue.

r? `@compiler-errors`
2023-12-22 14:17:10 +00:00
bors aaef5fe497 Auto merge of #119163 - fmease:refactor-ast-trait-bound-modifiers, r=compiler-errors
Refactor AST trait bound modifiers

Instead of having two types to represent trait bound modifiers in the parser / the AST (`parser::ty::BoundModifiers` & `ast::TraitBoundModifier`), only to map one to the other later, just use `parser::ty::BoundModifiers` (moved & renamed to `ast::TraitBoundModifiers`).

The struct type is more extensible and easier to deal with (see [here](https://github.com/rust-lang/rust/pull/119099/files#r1430749981) and [here](https://github.com/rust-lang/rust/pull/119099/files#r1430752116) for context) since it more closely models what it represents: A compound of two kinds of modifiers, constness and polarity. Modeling this as an enum (the now removed `ast::TraitBoundModifier`) meant one had to add a new variant per *combination* of modifier kind, which simply isn't scalable and which lead to a lot of explicit non-DRY matches.

NB: `hir::TraitBoundModifier` being an enum is fine since HIR doesn't need to worry representing invalid modifier kind combinations as those get rejected during AST validation thereby immensely cutting down the number of possibilities.
2023-12-22 02:00:55 +00:00
León Orell Valerian Liehr 5e4f12b41a
Refactor AST trait bound modifiers 2023-12-20 19:39:46 +01:00
Vadim Petrochenkov 006e0ef18d resolve: Stop feeding visibilities for import list stems 2023-12-20 20:27:10 +03:00
bors 8fca8295cb Auto merge of #119136 - petrochenkov:feedvis3, r=WaffleLapkin
resolve: Eagerly feed closure visibilities

Also factor out all tcx-dependent operations performed for every created definition into `TyCtxt::create_def`.

Addresses https://github.com/rust-lang/rust/pull/118657#discussion_r1421424277
2023-12-20 14:03:00 +00:00
Vadim Petrochenkov 5e5d82e803 resolve: Eagerly feed closure visibilities
Also factor out all tcx-dependent operations performed for every created definition into `TyCtxt::create_def`
2023-12-20 13:42:58 +03:00
Jules Bertholet 5c0e62cd3e
Hide foreign `#[doc(hidden)]` paths in import suggestions 2023-12-20 00:19:45 -05:00
Eric Holk 27d6539a46
Plumb awaitness of for loops 2023-12-19 12:26:20 -08:00
Vadim Petrochenkov 7571f6f685 resolve: Feed visibilities for unresolved trait impl items 2023-12-19 22:33:26 +03:00
Michael Woerister 115885ba7e Replace some instances of FxHashMap/FxHashSet with stable alternatives (mostly in rustc_hir and rustc_ast_lowering)
Part of https://github.com/rust-lang/compiler-team/issues/533
2023-12-18 21:03:32 +01:00
Nicholas Nethercote 09af8a667c Rename `Session::span_diagnostic` as `Session::dcx`. 2023-12-18 16:06:21 +11:00
Vadim Petrochenkov be321aa473 resolve: Replace visibility table in resolver outputs with query feeding
Also feed missing visibilities for import stems and trait impl items, which were previously evaluated lazily.
2023-12-18 02:26:55 +03:00
Matthias Krüger 8479945c08 NFC don't convert types to identical types 2023-12-15 23:56:24 +01:00
Jubilee 4583a0134f
Rollup merge of #118889 - matthiaskrgr:compl_2023_2, r=WaffleLapkin
more clippy::complexity fixes

      redundant_guards
      redundant_slicing
      filter_next
      needless_borrowed_reference
      useless_format
2023-12-12 18:48:54 -08:00
Jubilee 89d4a9bee9
Rollup merge of #118884 - matthiaskrgr:auszweimacheins, r=Nadrieril
NFC: simplify merging of two vecs
2023-12-12 18:48:52 -08:00
Matthias Krüger 3795cc8eb0 more clippy::complexity fixes
redundant_guards
      redundant_slicing
      filter_next
      needless_borrowed_reference
      useless_format
2023-12-12 20:41:51 +01:00
Matthias Krüger 6892fcd690 simplify merging of two vecs 2023-12-12 18:42:37 +01:00
Matthias Krüger ffdb471872
Rollup merge of #117914 - estebank:issue-85843, r=wesleywiser
On borrow return type, suggest borrowing from arg or owned return type

When we encounter a function with a return type that has an anonymous lifetime with no argument to borrow from, besides suggesting the `'static` lifetime we now also suggest changing the arguments to be borrows or changing the return type to be an owned type.

```
error[E0106]: missing lifetime specifier
  --> $DIR/variadic-ffi-6.rs:7:6
   |
LL | ) -> &usize {
   |      ^ expected named lifetime parameter
   |
   = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`
   |
LL | ) -> &'static usize {
   |       +++++++
help: instead, you are more likely to want to change one of the arguments to be borrowed...
   |
LL |     x: &usize,
   |        +
help: ...or alternatively, to want to return an owned value
   |
LL - ) -> &usize {
LL + ) -> usize {
   |
```

Fix #85843.
2023-12-12 17:40:53 +01:00
Matthias Krüger fefa8fc6c4
Rollup merge of #118840 - matthiaskrgr:cloooooone, r=compiler-errors
remove some redundant clones
2023-12-12 06:52:50 +01:00
Matthias Krüger 0564de10b1 remove some redundant clones 2023-12-11 21:54:36 +01:00
Matthias Krüger 670ba478de
Rollup merge of #118620 - petrochenkov:defeed2, r=compiler-errors
resolve: Use `def_kind` query to cleanup some code

Follow up to https://github.com/rust-lang/rust/pull/118188.

Similar attempts to use queries in resolver resulted in perf regressions in the past, so this needs a perf run first.
2023-12-11 20:46:48 +01:00
Michael Goulet 8361a7288e Introduce closure_id method on CoroutineKind 2023-12-08 21:46:39 +00:00
bors f967532a47 Auto merge of #118420 - compiler-errors:async-gen, r=eholk
Introduce support for `async gen` blocks

I'm delighted to demonstrate that `async gen` block are not very difficult to support. They're simply coroutines that yield `Poll<Option<T>>` and return `()`.

**This PR is WIP and in draft mode for now** -- I'm mostly putting it up to show folks that it's possible. This PR needs a lang-team experiment associated with it or possible an RFC, since I don't think it falls under the jurisdiction of the `gen` RFC that was recently authored by oli (https://github.com/rust-lang/rfcs/pull/3513, https://github.com/rust-lang/rust/issues/117078).

### Technical note on the pre-generator-transform yield type:

The reason that the underlying coroutines yield `Poll<Option<T>>` and not `Poll<T>` (which would make more sense, IMO, for the pre-transformed coroutine), is because the `TransformVisitor` that is used to turn coroutines into built-in state machine functions would have to destructure and reconstruct the latter into the former, which requires at least inserting a new basic block (for a `switchInt` terminator, to match on the `Poll` discriminant).

This does mean that the desugaring (at the `rustc_ast_lowering` level) of `async gen` blocks is a bit more involved. However, since we already need to intercept both `.await` and `yield` operators, I don't consider it much of a technical burden.

r? `@ghost`
2023-12-08 19:13:57 +00:00
Michael Goulet 44911b7c67 Make some matches exhaustive to avoid bugs, fix tools 2023-12-08 17:23:26 +00:00
Michael Goulet a208bae00e Support async gen fn 2023-12-08 17:23:26 +00:00
Michael Goulet 2806c2df7b coro_kind -> coroutine_kind 2023-12-08 17:23:25 +00:00
bors 2b399b5275 Auto merge of #118527 - Nadrieril:never_patterns_parse, r=compiler-errors
never_patterns: Parse match arms with no body

Never patterns are meant to signal unreachable cases, and thus don't take bodies:
```rust
let ptr: *const Option<!> = ...;
match *ptr {
    None => { foo(); }
    Some(!),
}
```
This PR makes rustc accept the above, and enforces that an arm has a body xor is a never pattern. This affects parsing of match arms even with the feature off, so this is delicate. (Plus this is my first non-trivial change to the parser).

~~The last commit is optional; it introduces a bit of churn to allow the new suggestions to be machine-applicable. There may be a better solution? I'm not sure.~~ EDIT: I removed that commit

r? `@compiler-errors`
2023-12-08 17:08:52 +00:00
bors 8235469e48 Auto merge of #118687 - matthiaskrgr:rollup-317ztgu, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #117981 (Remove deprecated `--check-cfg` syntax)
 - #118177 (Suppress warnings in LLVM wrapper when targeting MSVC)
 - #118317 (tip for define macro name after `macro_rules!`)
 - #118504 (Enforce `must_use` on associated types and RPITITs that have a must-use trait in bounds)
 - #118660 (rustc_arena: add `alloc_str`)
 - #118681 (Fix is_foreign_item for StableMIR instance )

r? `@ghost`
`@rustbot` modify labels: rollup
2023-12-06 22:23:25 +00:00
bohan 0f14e8ea74 tip for define macro name after `macro_rules!` 2023-12-06 23:19:39 +08:00
r0cky 940473adb4 Use the glob binding in resolve_rustdoc_path process 2023-12-06 21:48:19 +08:00
bors 56278a6e28 Auto merge of #118457 - eholk:genfn, r=compiler-errors
Add support for `gen fn`

This builds on #116447 to add support for `gen fn` functions. For the most part we follow the same approach as desugaring `async fn`, but replacing `Future` with `Iterator` and `async {}` with `gen {}` for the body.

The version implemented here uses the return type of a `gen fn` as the yield type. For example:

```rust
gen fn count_to_three() -> i32 {
    yield 1;
    yield 2;
    yield 3;
}
```

In the future, I think we should experiment with a syntax like `gen fn count_to_three() yield i32 { ... }`, but that can go in another PR.

cc `@oli-obk` `@compiler-errors`
2023-12-05 18:37:15 +00:00
Vadim Petrochenkov fb9ca0ffe5 resolve: Use `def_kind` query to cleanup some code 2023-12-05 20:56:38 +03:00
Eric Holk 50ef8006eb
Address code review feedback 2023-12-04 14:33:46 -08:00
Esteban Küber beaf31581a Structured `use` suggestion on privacy error
When encoutering a privacy error on an item through a re-export that is
accessible in an alternative path, provide a structured suggestion with
that path.

```
error[E0603]: module import `mem` is private
  --> $DIR/private-std-reexport-suggest-public.rs:4:14
   |
LL |     use foo::mem;
   |              ^^^ private module import
   |
note: the module import `mem` is defined here...
  --> $DIR/private-std-reexport-suggest-public.rs:8:9
   |
LL |     use std::mem;
   |         ^^^^^^^^
note: ...and refers to the module `mem` which is defined here
  --> $SRC_DIR/std/src/lib.rs:LL:COL
   |
   = note: you could import this
help: import `mem` through the re-export
   |
LL |     use std::mem;
   |         ~~~~~~~~
```

Fix #42909.
2023-12-04 22:26:08 +00:00
Eric Holk f9d1f922dc
Option<CoroutineKind> 2023-12-04 13:03:37 -08:00
Eric Holk 48d5f1f0f2
Merge Async and Gen into CoroutineKind 2023-12-04 12:48:01 -08:00
Eric Holk c104f3b629
Lower return types for gen fn to impl Iterator 2023-12-04 11:23:05 -08:00
Vadim Petrochenkov 17e799c270 rustc: Harmonize `DefKind` and `DefPathData`
`DefPathData::(ClosureExpr,ImplTrait)` are renamed to match `DefKind::(Closure,OpaqueTy)`.

`DefPathData::ImplTraitAssocTy` is replaced with `DefPathData::TypeNS(kw::Empty)` because both correspond to `DefKind::AssocTy`.
It's possible that introducing `(DefKind,DefPathData)::AssocOpaqueTy` could be a better solution, but that would be a much more invasive change.

Const generic parameters introduced for effects are moved from `DefPathData::TypeNS` to `DefPathData::ValueNS`, because constants are values.

`DefPathData` is no longer passed to `create_def` functions to avoid redundancy.
2023-12-03 16:24:56 +03:00
Nadrieril 80bdcbf50a Parse a pattern with no arm 2023-12-03 12:25:46 +01:00
bors 2da59b8676 Auto merge of #118470 - nnethercote:cleanup-error-handlers, r=compiler-errors
Cleanup error handlers

Mostly by making function naming more consistent. More to do after this, but this is enough for one PR.

r? compiler-errors
2023-12-02 02:48:34 +00:00
Nicholas Nethercote 5d1d384443 Rename `HandlerInner::delay_span_bug` as `HandlerInner::span_delayed_bug`.
Because the corresponding `Level` is `DelayedBug` and `span_delayed_bug`
follows the pattern used everywhere else: `span_err`, `span_warning`,
etc.
2023-12-02 09:01:19 +11:00
bors 64d7e0d0b6 Auto merge of #115993 - bvanjoi:fix-115966, r=petrochenkov
vis note for no pub reexports glob import

Fixes #115966

Only trigger the `unused_import` lint when it's not being used.

r? `@petrochenkov`
2023-12-01 15:46:04 +00:00
bohan d0941f92d7 vis note for no pub reexports glob import 2023-12-01 12:10:07 +08:00
Ralf Jung 1dbfe17f12 generic_const_exprs: suggest to add the feature, not use it 2023-11-30 20:59:51 +01:00
Matthias Krüger 5e7f770a0d
Rollup merge of #118342 - compiler-errors:macro-generic-bang, r=estebank
Dont suggest `!` for path in function call if it has generic args

Fixes #118335
2023-11-29 04:23:28 +01:00
Vadim Petrochenkov 84de641484 def collector: Set correct namespace in `DefPathData` for foreign types 2023-11-28 16:17:52 +03:00
Vadim Petrochenkov f0dc906319 resolve: Feed the `def_kind` query immediately on `DefId` creation 2023-11-28 15:39:31 +03:00
Jake Goulding 87380cbc0c Address unused tuple struct fields in the compiler 2023-11-27 13:54:50 -05:00
Michael Goulet 8490b8ec63 Dont suggest `!` for path in function call if it has generic args 2023-11-27 01:02:37 +00:00
bohan f23befe6c1 merge `DefKind::Coroutine` into `DefKind::Closure` 2023-11-26 21:05:08 +08:00
Michael Goulet 8dd8db5073
Rollup merge of #118288 - compiler-errors:is_some_and, r=lqd,dtolnay
Use `is_{some,ok}_and` more in the compiler

slightly more fluent-reading code
2023-11-25 17:23:34 -05:00
Michael Goulet 3b2f33ee28
Rollup merge of #118158 - nnethercote:reduce-fluent-boilerplate, r=compiler-errors
Reduce fluent boilerplate

Best reviewed one commit at a time.

r? `@davidtwco`
2023-11-25 17:23:33 -05:00
Nicholas Nethercote 57cd5e6551 Use `rustc_fluent_macro::fluent_messages!` directly.
Currently we always do this:
```
use rustc_fluent_macro::fluent_messages;
...
fluent_messages! { "./example.ftl" }
```
But there is no need, we can just do this everywhere:
```
rustc_fluent_macro::fluent_messages! { "./example.ftl" }
```
which is shorter.
2023-11-26 08:38:40 +11:00
Nicholas Nethercote a733082be9 Avoid need for `{D,Subd}iagnosticMessage` imports.
The `fluent_messages!` macro produces uses of
`crate::{D,Subd}iagnosticMessage`, which means that every crate using
the macro must have this import:
```
use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
```

This commit changes the macro to instead use
`rustc_errors::{D,Subd}iagnosticMessage`, which avoids the need for the
imports.
2023-11-26 08:38:00 +11:00
Michael Goulet 079a2e865f is_{some,ok}_and 2023-11-25 18:47:16 +00:00
Vadim Petrochenkov ad0770eeee resolve: Avoid clones of `MacroData`
And move declarative macro compilation to an earlier point in def collector, which is required for #118188.
2023-11-25 02:32:33 +03:00
bors 4fd68eb47b Auto merge of #117934 - Young-Flash:dev, r=petrochenkov
feat: make `let_binding_suggestion` more reasonable

This is my first PR for rustc, which trying to fix https://github.com/rust-lang/rust/issues/117894, I am not familiar with some internal api so maybe some modification here isn't the way to go, appreciated for any review suggestion.
2023-11-24 15:26:04 +00:00
Young-Flash c710db8ea7 feat: make let_binding_suggestion more reasonable 2023-11-23 20:22:17 +08:00
bors 360bafad68 Auto merge of #118065 - estebank:core-not-found-404, r=TaKO8Ki
When failing to import `core`, suggest `std`
2023-11-23 02:26:52 +00:00
Esteban Küber ec50f1c90b When failing to import `core`, suggest `std` 2023-11-22 19:30:47 +00:00
Nilstrieb 21a870515b Fix `clippy::needless_borrow` in the compiler
`x clippy compiler -Aclippy::all -Wclippy::needless_borrow --fix`.

Then I had to remove a few unnecessary parens and muts that were exposed
now.
2023-11-21 20:13:40 +01:00
Esteban Küber eee4cc6616 let-chain fmt 2023-11-20 23:44:37 +00:00
Esteban Küber 02bea16c08 Rely in resolve and not on path name for `&str` -> `String` suggestion 2023-11-20 23:44:37 +00:00
Esteban Küber bb9d720a16 Do not consider traits as ownable in suggestion 2023-11-20 23:44:37 +00:00
Esteban Küber 85f26ade8d Account for '_ in lifetime suggestion 2023-11-20 23:44:37 +00:00
Esteban Küber 2a92d820c7 Suggest 'a when trait object assoc type has '_ 2023-11-20 23:44:37 +00:00
Esteban Küber dec7f00e15 Fix incorrect lifetime suggestion 2023-11-20 23:44:37 +00:00
Esteban Küber d30252e359 Tweak wording 2023-11-20 23:44:37 +00:00
Esteban Küber 5fce361d58 Account for impl Trait in lifetime suggestion
When encountering
```rust
fn g(mut x: impl Iterator<Item = &()>) -> Option<&()> { /* */ }
```
Suggest
```rust
fn g<'a>(mut x: impl Iterator<Item = &'a ()>) -> Option<&'a ()> { /* */ }
```
2023-11-20 23:44:37 +00:00
Esteban Küber b7a23bc08b On borrow return type, suggest borrowing from arg or owned return type
When we encounter a function with a return type that has an anonymous
lifetime with no argument to borrow from, besides suggesting the
`'static` lifetime we now also suggest changing the arguments to be
borrows or changing the return type to be an owned type.

```
error[E0106]: missing lifetime specifier
  --> $DIR/variadic-ffi-6.rs:7:6
   |
LL | ) -> &usize {
   |      ^ expected named lifetime parameter
   |
   = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`
   |
LL | ) -> &'static usize {
   |       +++++++
help: instead, you are more likely to want to change one of the arguments to be borrowed...
   |
LL |     x: &usize,
   |        +
help: ...or alternatively, to want to return an owned value
   |
LL - ) -> &usize {
LL + ) -> usize {
   |
```

Fix #85843.
2023-11-20 23:44:36 +00:00
Esteban Küber ac56b06b44 fix rebase 2023-11-19 18:07:22 +00:00
Esteban Küber a519c9b6b7 review comments 2023-11-19 17:50:47 +00:00
Esteban Küber 4d16171f56 Account for number of arguments in suggestion 2023-11-19 17:50:47 +00:00
Esteban Küber 00265f0cc0 fix tidy 2023-11-19 17:50:47 +00:00
Esteban Küber 987155f35d Suggest using builder on curly brace struct called as fn 2023-11-19 17:50:46 +00:00
Esteban Küber 12a8bb8d9b Do not suggest struct literal when fields are private 2023-11-19 17:50:46 +00:00
Esteban Küber a4f47de7ff On private tuple struct, suggest `Default::default` when possible 2023-11-19 17:50:46 +00:00
Esteban Küber f1ae02f4bd Don't sort `span_suggestions`, leave that to caller 2023-11-19 17:50:45 +00:00
Esteban Küber 42aa1273b0 When encountering struct fn call literal with private fields, suggest all builders
When encountering code like `Box(42)`, suggest `Box::new(42)` and *all*
other associated functions that return `-> Box<T>`.
2023-11-19 17:47:41 +00:00
Matthias Krüger 8792e81f29
Rollup merge of #117964 - estebank:issue-81232, r=petrochenkov
When using existing fn as module, don't claim it doesn't exist

Tweak wording of module not found in resolve, when the name exists but belongs to a non-`mod` item.

Fix #81232.
2023-11-17 23:04:23 +01:00
Esteban Küber 5c3e01a340 On resolve error of `[rest..]`, suggest `[rest @ ..]`
When writing a pattern to collect multiple entries of a slice in a
single binding, it is easy to misremember or typo the appropriate syntax
to do so, instead writing the experimental `X..` pattern syntax. When we
encounter a resolve error because `X` isn't available, we suggest
`X @ ..` as an alternative.

```
error[E0425]: cannot find value `rest` in this scope
  --> $DIR/range-pattern-meant-to-be-slice-rest-pattern.rs:3:13
   |
LL |         [1, rest..] => println!("{rest:?}"),
   |             ^^^^ not found in this scope
   |
help: if you meant to collect the rest of the slice in `rest`, use the at operator
   |
LL |         [1, rest @ ..] => println!("{rest:?}"),
   |                  +
```

Fix #88404.
2023-11-17 00:55:55 +00:00
Esteban Küber 890ce26213 When using existing fn as module, don't claim it doesn't exist
Tweak wording of module not found in resolve, when the name exists but
belongs to a non-`mod` item.

Fix #81232.
2023-11-16 06:07:33 +00:00
Mark Rousskov db3e2bacb6 Bump cfg(bootstrap)s 2023-11-15 19:41:28 -05:00
Nicholas Nethercote 1b3733e5a4 rustc: minor changes suggested by clippy perf lints. 2023-11-08 08:57:57 +11:00
Nicholas Nethercote 8ff624a9f2 Clean up `rustc_*/Cargo.toml`.
- Sort dependencies and features sections.
- Add `tidy` markers to the sorted sections so they stay sorted.
- Remove empty `[lib`] sections.
- Remove "See more keys..." comments.

Excluded files:
- rustc_codegen_{cranelift,gcc}, because they're external.
- rustc_lexer, because it has external use.
- stable_mir, because it has external use.
2023-10-30 08:46:02 +11:00
bors 2cad938a81 Auto merge of #116447 - oli-obk:gen_fn, r=compiler-errors
Implement `gen` blocks in the 2024 edition

Coroutines tracking issue https://github.com/rust-lang/rust/issues/43122
`gen` block tracking issue https://github.com/rust-lang/rust/issues/117078

This PR implements `gen` blocks that implement `Iterator`. Most of the logic with `async` blocks is shared, and thus I renamed various types that were referring to `async` specifically.

An example usage of `gen` blocks is

```rust
fn foo() -> impl Iterator<Item = i32> {
    gen {
        yield 42;
        for i in 5..18 {
            if i.is_even() { continue }
            yield i * 2;
        }
    }
}
```

The limitations (to be resolved) of the implementation are listed in the tracking issue
2023-10-29 00:03:52 +00:00
Oli Scherer b8bfd08999 Rename `RibKind::ClosureOrAsync` to reflect how it is actually used 2023-10-27 13:05:49 +00:00
Oli Scherer 621494382d Add gen blocks to ast and do some broken ast lowering 2023-10-27 13:05:48 +00:00
bors 688892938e Auto merge of #116858 - estebank:issue-22488, r=petrochenkov
Suggest assoc fn `new` when trying to build tuple struct with private fields

Fix #22488.
2023-10-27 12:16:01 +00:00
Esteban Küber 87dc85d322 Suggest assoc fn `new` when trying to build tuple struct with private fields
Fix #22488.
2023-10-26 22:21:05 +00:00
Matthias Krüger 17fb2f4b31
Rollup merge of #116905 - Fenex:refactor/compiler/resolve, r=petrochenkov
refactor(compiler/resolve): simplify some code

Removes unnecessary allocate and double-sorting the same vector, makes the code a little nicer.
2023-10-26 17:45:43 +02:00
Matthias Krüger 2a027faf68
Rollup merge of #117009 - fmease:diag-disambig-sugg-crate, r=b-naber
On unresolved imports, suggest a disambiguated path if necessary to avoid collision with local items

Fixes #116970.
2023-10-25 23:37:10 +02:00
bohan 482275b194 use visibility to check unused imports and delete some stmts 2023-10-22 21:27:46 +08:00
León Orell Valerian Liehr 4aaf8e03e1
on unresolved import disambiguate suggested path if it would collide 2023-10-21 15:40:32 +02:00
Matthias Krüger c5dd84d493
Rollup merge of #116961 - estebank:issue-60164, r=oli-obk
Typo suggestion to change bindings with leading underscore

When encountering a binding that isn't found but has a typo suggestion for a binding with a leading underscore, suggest changing the binding definition instead of the use place.

Fix #60164.
2023-10-21 10:08:16 +02:00
Oli Scherer 60956837cf s/Generator/Coroutine/ 2023-10-20 21:10:38 +00:00
Esteban Küber b0d17f35d9 Typo suggestion to change bindings with leading underscore
When encountering a binding that isn't found but has a typo suggestion
for a binding with a leading underscore, suggest changing the binding
definition instead of the use place.

Fix #60164.
2023-10-20 15:58:25 +00:00
Vitaliy Busko e68edb89ad
refactor(compiler/resolve): simplify some code
Removes unnecessary allocates and double-sorting the same vector,
makes the code a little nicer.
2023-10-19 04:45:06 +07:00
Michael Goulet b2d2184ede Format all the let chains in compiler 2023-10-13 08:59:36 +00:00
Michael Howell c6e6ecb1af rustdoc: remove rust logo from non-Rust crates 2023-10-08 20:17:53 -07:00