Commit Graph

214234 Commits

Author SHA1 Message Date
clubby789
fed349957d Clarify examples for VecDeque::get/get_mut 2023-01-07 14:38:21 +00:00
bors
a2112fcb0a Auto merge of #106519 - estebank:tail-unit, r=cjgillot
Detect bindings assigned blocks without tail expressions

Fix #44173.
2023-01-07 13:24:12 +00:00
Ali MJ Al-Nasrawy
bf228ace5c don't eagerly normalize SelfCtor type
Delay until user annotations are registered.
See the added test.
2023-01-07 13:42:16 +03:00
Ali MJ Al-Nasrawy
030d60f1c7 more tests 2023-01-07 13:42:16 +03:00
Ali MJ Al-Nasrawy
dca15fd5b9 rename create_raw_ty -> handle_raw_ty 2023-01-07 13:42:15 +03:00
Ali MJ Al-Nasrawy
8afd3c47a8 remove unnecessary normalize call 2023-01-07 13:42:15 +03:00
Ali MJ Al-Nasrawy
c6a17bf8bc make ascribe_user_type a TypeOp
Projection types in user annotations may contain inference variables.
This makes the normalization depend on the unification with the actual
type and thus requires a separate TypeOp to track the obligations.
Otherwise simply calling `TypeChecker::normalize` would ICE with
"unexpected ambiguity"
2023-01-07 13:41:41 +03:00
Ali MJ Al-Nasrawy
37b40e471a fix method substs 2023-01-07 13:38:40 +03:00
Ali MJ Al-Nasrawy
be5a45d392 fix struct path 2023-01-07 13:38:39 +03:00
Ali MJ Al-Nasrawy
34329d6f6c introduce AstConv::probe_adt 2023-01-07 13:38:38 +03:00
Ali MJ Al-Nasrawy
d227506683 don't normalize in astconv
We delay projection normalization to further stages in order to
register user type annotations before normalization in HIR typeck.

There are two consumers of astconv: ItemCtxt and FnCtxt.
The former already expects unnormalized types from astconv, see its
AstConv trait impl.
The latter needs `RawTy` for a cleaner interface.

Unfortunately astconv still needs the normalization machinery in
order to resolve enum variants that have projections in the self type,
e.g. `<<T as Trait>::Assoc>::StructVariant {}`.
This is why `AstConv::normalize_ty_2` is necessary.
2023-01-07 13:38:38 +03:00
bors
d72b7d2d2a Auto merge of #106283 - JulianKnodt:enum_err, r=cjgillot
Add help diag. for `const = Enum` missing braces around `Enum`

Previously it was not clear why this errored or if it was even supported, as there was no diagnostic that suggested wrapping it in braces.

Thus, add a simple diagnostic that suggests wrapping enum variants in braces.

Fixes #105927
2023-01-07 10:04:39 +00:00
Yuki Okushi
ab9313e624
Apply merge-functions=disabled
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2023-01-07 19:03:07 +09:00
Yuki Okushi
78e11a4556
Apply review suggestions
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2023-01-07 18:58:07 +09:00
Yuki Okushi
75f1dfcc32
Add regression test for #86106
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2023-01-07 18:58:07 +09:00
bors
472651aa10 Auto merge of #106558 - compiler-errors:rollup-lkii3j3, r=compiler-errors
Rollup of 4 pull requests

Successful merges:

 - #106525 (Report WF error for chalk *and* new solver)
 - #106533 (Use smaller spans for missing lifetime/generic args)
 - #106543 (rustdoc: remove no-op CSS `.rustdoc.source .sidebar { width: 0 }`)
 - #106554 (Fix a typo in the explanation of E0588)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-07 06:54:47 +00:00
Michael Goulet
01cb9dcd5b
Rollup merge of #106554 - LingMan:explanation_typo, r=compiler-errors
Fix a typo in the explanation of E0588
2023-01-06 21:54:01 -08:00
Michael Goulet
64beb046ee
Rollup merge of #106543 - notriddle:notriddle/source-sidebar-width-zero, r=GuillaumeGomez
rustdoc: remove no-op CSS `.rustdoc.source .sidebar { width: 0 }`

This CSS was added in dc2c972334, before 6a5f8b1aef when the sidebars were merged.

Now that they are merged, the source sidebar is being pushed off-screen anyway, so giving it zero width doesn't do much.
2023-01-06 21:54:00 -08:00
Michael Goulet
eeb76eb593
Rollup merge of #106533 - TaKO8Ki:use-smaller-span-for-missing-lifetime/generic-args, r=compiler-errors
Use smaller spans for missing lifetime/generic args

We can remove ident from suggestions.
2023-01-06 21:54:00 -08:00
Michael Goulet
258257a029
Rollup merge of #106525 - compiler-errors:new-solver-wf, r=jackh726
Report WF error for chalk *and* new solver

addressing this nit https://github.com/rust-lang/rust/pull/106385#discussion_r1062571070

No test yet because new solver is currently unusable, lol

r? `@lcnr`
2023-01-06 21:53:59 -08:00
Ezra Shaw
09382db78b
minor fixes for error_codes.rs tidy check 2023-01-07 18:36:32 +13:00
Michael Howell
a7ac923088 rustdoc: remove no-op mobile CSS .content { margin-left: 0 }
This rule was added to override non-zero left margin on `.content`,
which was removed in 135281ed15 and
the margin-left was put on the docblock.
2023-01-06 22:21:54 -07:00
LingMan
dc0e4207d4 Fix a typo in the explanation of E0588 2023-01-07 05:10:53 +01:00
Ezra Shaw
43bec83266
docs: make HashSet::retain doctest more clear 2023-01-07 17:08:07 +13:00
bors
93bf84c902 Auto merge of #106538 - aDotInTheVoid:strip-use-doc-hidden, r=notriddle
rustdoc: Strip imports of items which are `#[doc(hidden)]`

Closes #106379
2023-01-07 04:00:24 +00:00
yukang
6082729646 use type_implements_trait to check Param clone 2023-01-07 09:20:05 +08:00
bors
84f22e44c5 Auto merge of #106544 - matthiaskrgr:rollup-e9prjed, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #106287 (Add some docs to `bug`, `span_bug` and `delay_span_bug`)
 - #106341 (refactor: clean up `errors.rs` and `error_codes_check.rs`)
 - #106453 (Improve include macro documentation)
 - #106466 (Fix rustdoc source code rendering for `#[path = "../path/to/mod.rs"]` links)
 - #106528 (Tiny formatting fix)
 - #106534 (rustdoc-gui: Use new block syntax for define-function in goml scripts)
 - #106542 (Add default and latest stable edition to --edition in rustc (attempt 2))

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-07 00:53:19 +00:00
wcampbell
d0cf7e3bf5 Use fmt named parameters in rustc_borrowck 2023-01-06 19:34:45 -05:00
Nixon Enraght-Moony
d4139b36cf jsondoclint: Check local items in paths are also in index. 2023-01-06 23:10:14 +00:00
bors
7ac9572c48 Auto merge of #106415 - Nilstrieb:where-is-my-master-branch, r=jyn514
Handle non-existent upstream master branches in `x fmt`

People who do have a remote for `rust-lang/rust` but don't have the master branch checked out there used to get this error when running `x fmt`:
> fatal: ambiguous argument 'rust/master': unknown revision or path not in the working tree.
> Use '--' to separate paths from revisions, like this:
> 'git <command> [<revision>...] -- [<file>...]'
> rust/master

Which is not exactly helpful.

Now, we fall back to `origin/master` (hoping that at least that remote exists) for that case. If there is still some error, we just fall back to `x fmt .` and print a warning.

r? `@jyn514`
2023-01-06 21:51:44 +00:00
Esteban Küber
b693365b84 fix rebase 2023-01-06 21:08:56 +00:00
Esteban Küber
2631a5df61 Turn IllegalSizedBound into struct variant 2023-01-06 21:03:26 +00:00
Esteban Küber
670a6f1ef5 Change wording to avoid being misleading 2023-01-06 21:03:26 +00:00
Esteban Küber
1eb828ecb1 Structured suggestion for &mut dyn Iterator when possible
Fix #37914.
2023-01-06 21:03:26 +00:00
yukang
ce4afed2ef comments feedback 2023-01-07 05:00:49 +08:00
Yukang
1a0a6132a8 Apply suggestions from code review
Co-authored-by: Esteban Kuber <estebank@users.noreply.github.com>
2023-01-07 04:44:04 +08:00
yukang
e7a777805a Suggest possible clone when we have &T 2023-01-07 04:43:57 +08:00
Matthias Krüger
a1b3393f5f
Rollup merge of #106542 - sigaloid:master, r=bjorn3
Add default and latest stable edition to --edition in rustc (attempt 2)

Fixes #106041

No longer leaks string like my first attempt PR, #106094 - uses LazyLock to construct a `&'static str`

It will now output the default edition and latest stable edition in the help message for the `--edition` flag.

Going to request the same reviewer as the first attempt for continuity - r? `@Nilstrieb`
2023-01-06 21:26:12 +01:00
Matthias Krüger
92d812de1d
Rollup merge of #106534 - GuillaumeGomez:block-syntax, r=notriddle
rustdoc-gui: Use new block syntax for define-function in goml scripts

r? `@notriddle`
2023-01-06 21:26:12 +01:00
Matthias Krüger
9a090edf2e
Rollup merge of #106528 - estebank:quick-fix, r=TaKO8Ki
Tiny formatting fix
2023-01-06 21:26:11 +01:00
Matthias Krüger
eb27b613b6
Rollup merge of #106466 - clubby789:relative-module-fix, r=notriddle
Fix rustdoc source code rendering for `#[path = "../path/to/mod.rs"]` links

Fixes #103517

While generating the location for modules source HTML to be saved at, a `..` path component appeared to be translated to `/up/`.
Additionally, while generating the navigation sidebar, `..` path components were ignored. This means that (as in the issue above), a *real* directory structure of:
```
sys/
  unix/
    mod.rs  <-- contains #![path = "../unix/mod.rs]
    cmath.rs
```
was rendered as:
```
sys/
  unix/
    mod.rs
    unix/
      cmath.rs  <-- links to sys/unix/unix/cmath.rs.html, 404
```
While the *files* were stored as
```
sys/
  unix/
    mod.rs.html
    up/
      unix/
        cmath.rs.html
```
2023-01-06 21:26:11 +01:00
Matthias Krüger
72d650f47a
Rollup merge of #106453 - coastalwhite:master, r=GuillaumeGomez
Improve include macro documentation

As outlined in #106118, the `include!` macro is a SEO problem when it comes to the Rust documentation. Beginners may see it as a replacement to `include` syntax in other languages. I feel like this documentation should quite explicitly link to the modules' documentation.

The primary goal of this PR is to address that issue by adding a warning to the documentation. While I was here, I also added some other parts. This included a `Uses` section and some (intra doc) links to other relevant topics.

I hope this can help beginners to Rust more quickly understand some multi-file project intricacies.

# References
- Syntax for the warning: 58accc6da3/tracing/src/lib.rs (L55)
2023-01-06 21:26:10 +01:00
Matthias Krüger
498216e9db
Rollup merge of #106341 - Ezrashaw:refactor-error-code-tidy-check, r=mejrs,klensy,GuillaumeGomez
refactor: clean up `errors.rs` and `error_codes_check.rs`

`errors.rs` is basically unused now, `error_codes_check.rs` is useful but not well commented, etc. It also doesn't check certain things which are certainly not correct. For example, `E0505` has a UI test in `src/test/ui/error-codes/` but that test actually outputs `E0504`?! Other issues like these exist. I've implemented these with "warnings" which are a bit rough around the edges but should be removed eventually.

r? `@GuillaumeGomez` (again not sure if you want to review but its relevant to you)
2023-01-06 21:26:10 +01:00
Matthias Krüger
7568c49bf0
Rollup merge of #106287 - Nilstrieb:its-bugging-me-how-we-dont-have-docs, r=jyn514
Add some docs to `bug`, `span_bug` and `delay_span_bug`

cc `@mejrs` as you wanted me to do this, does this look good and understandable?
2023-01-06 21:26:09 +01:00
Michael Howell
16a3c8032e rustdoc: remove no-op CSS .rustdoc.source .sidebar { width: 0 }
This CSS was added in dc2c972334,
before 6a5f8b1aef when the sidebars
were merged.

Now that they are merged, the source sidebar is being pushed
off-screen anyway, so giving it zero width doesn't do much.
2023-01-06 13:14:41 -07:00
Matthew E
893938f64f
Update compiler/rustc_session/src/config.rs
Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com>
2023-01-06 14:36:52 -05:00
Nilstrieb
d5e5762211 Handle non-existant upstream master branches in x fmt 2023-01-06 20:18:50 +01:00
Matthew Esposito
5cda0a2f39 Add default and latest stable edition to --edition in rustc 2023-01-06 14:07:12 -05:00
Nixon Enraght-Moony
ff46d116c1 rustdoc: Strip imports of items which are #[doc(hidden)]
Closes #106379
2023-01-06 18:44:37 +00:00
bors
0fb8b72ce4 Auto merge of #106501 - cjgillot:resolved-elided-apit, r=compiler-errors
Correct detection of elided lifetimes in impl-trait.

Fixes https://github.com/rust-lang/rust/issues/106338

r? `@compiler-errors`
cc `@pnkfelix`
2023-01-06 18:15:56 +00:00