Esteban Küber
7449478c2f
Account for type param from other item in note_and_explain
...
Fix #89868 .
2023-10-27 16:24:01 +00:00
Esteban Küber
3bbc70a5f7
Restrict param constraint suggestion
...
When encountering an associated item with a type param that could be
constrained, do not look at the parent item if the type param comes from
the associated item.
Fix #117209 .
2023-10-26 18:33:03 +00:00
Oli Scherer
c601ade3ad
Refactor away the need for some descr
methods.
...
Instead we use `Display` impls and their `alternate` render scheme to
decide whether we want backticks or not.
2023-10-25 16:40:32 +00:00
Michael Goulet
a986ab4d4d
Get rid of 'tcx on ConstVid, EffectVid
2023-10-24 20:13:36 +00:00
Matthias Krüger
cb651300ec
Rollup merge of #117091 - compiler-errors:debug, r=lcnr
...
`OptWithInfcx` naming nits, trait bound simplifications
* Use an associated type `Interner` on `InferCtxtLike` to remove a redundant interner parameter (`I: Interner, Infcx: InferCtxtLike<I>` -> `Infcx: InferCtxtLike`).
* Remove double-`Option` between `infcx: Option<Infcx>` and `fn universe_of_ty(&self, ty: ty::InferTy) -> Option<ty::UniverseIndex>`. We don't need the infcx to be optional if we can provide a "noop" (`NoInfcx`) implementation that just always returns `None` for universe index.
* Also removes the `core::convert::Infallible` implementation which I found a bit weird...
* Some naming nits with params.
* I found `InferCtxt` + `InfCtx` and `Infcx` to be a lot of different ways to spell "inference context", so I got rid of the `InfCtx` type parameter name in favor of `Infcx` which is a more standard name.
* I found `OptWithInfcx` to be a bit redundant -> `WithInfcx`.
I'm making these changes because I intend to reuse the `InferCtxtLike` trait for uplifting the canonicalizer into a new trait -- conveniently, the information I need for uplifting the canonicalizer also is just the universe information of a type var, so it's super convenient 😸
r? `@BoxyUwU` or `@lcnr`
2023-10-24 17:09:00 +02:00
bors
f654229c27
Auto merge of #117103 - matthiaskrgr:rollup-96zuuom, r=matthiaskrgr
...
Rollup of 6 pull requests
Successful merges:
- #107159 (rand use getrandom for freebsd (available since 12.x))
- #116859 (Make `ty::print::Printer` take `&mut self` instead of `self`)
- #117046 (return unfixed len if pat has reported error)
- #117070 (rustdoc: wrap Type with Box instead of Generics)
- #117074 (Remove smir from triage and add me to stablemir)
- #117086 (Update .mailmap to promote my livename)
r? `@ghost`
`@rustbot` modify labels: rollup
2023-10-23 22:18:45 +00:00
Matthias Krüger
8af4a3f9cd
Rollup merge of #116859 - Nilstrieb:more-more-funny-pretty-printers, r=oli-obk
...
Make `ty::print::Printer` take `&mut self` instead of `self`
based on #116815
This simplifies the code by removing all the `self` assignments and
makes the flow of data clearer - always into the printer.
Especially in v0 mangling, which already used `&mut self` in some
places, it gets a lot more uniform.
2023-10-23 22:26:29 +02:00
Michael Goulet
269d5a322e
Remove redundant type parameter
2023-10-23 16:02:05 -04:00
bohan
482275b194
use visibility to check unused imports and delete some stmts
2023-10-22 21:27:46 +08:00
Matthias Krüger
05e154fdb7
Rollup merge of #106601 - estebank:match-semi, r=cjgillot
...
Suggest `;` after bare `match` expression E0308
Fix #72634 .
2023-10-21 13:58:33 +02:00
Nilstrieb
5acf26b97e
Make ty::print::Printer
take &mut self
instead of self
...
This simplifies the code by removing all the `self` assignments and
makes the flow of data clearer - always into the printer.
Especially in v0 mangling, which already used `&mut self` in some
places, it gets a lot more uniform.
2023-10-21 11:33:05 +02:00
Oli Scherer
e96ce20b34
s/generator/coroutine/
2023-10-20 21:14:01 +00:00
Oli Scherer
60956837cf
s/Generator/Coroutine/
2023-10-20 21:10:38 +00:00
bors
4578435e16
Auto merge of #116874 - compiler-errors:elaborator-nits, r=wesleywiser
...
Some small elaborator nits
Didn't want to fold these into a totally unrelated pr.
2023-10-19 21:42:17 +00:00
León Orell Valerian Liehr
64ed233fc1
Rollup merge of #116908 - estebank:issue-78206, r=compiler-errors
...
Tweak wording of type errors involving type params
Fix #78206 .
2023-10-19 04:34:47 +02:00
Esteban Küber
bd8b46800d
Tweak wording of type errors involving type params
...
Fix #78206 .
2023-10-18 23:53:18 +00:00
Michael Goulet
ea73f10867
Don't ICE when encountering unresolved regions in fully_resolve
2023-10-18 20:39:29 +00:00
bors
e1de04ad4e
Auto merge of #116885 - aliemjay:rollup-plbeppt, r=aliemjay
...
Rollup of 5 pull requests
Successful merges:
- #116812 (Disable missing_copy_implementations lint on non_exhaustive types)
- #116856 (Disable effects in libcore again)
- #116865 (Suggest constraining assoc types in more cases)
- #116870 (Don't compare host param by name)
- #116879 (revert #114586 )
r? `@ghost`
`@rustbot` modify labels: rollup
2023-10-18 11:55:41 +00:00
Ali MJ Al-Nasrawy
8489bce7f5
Rollup merge of #116879 - aliemjay:revert-opaque-bubble, r=oli-obk
...
revert #114586
Reverts #114586 .
cc #116877 (not closing until this gets a beta backport)
fixes #116684
fixes https://github.com/rust-lang/rust/pull/114586#issuecomment-1751967321
r? `@oli-obk` or `@lcnr`
2023-10-18 14:24:52 +03:00
Ali MJ Al-Nasrawy
a1e274f172
revert rust-lang/rust#114586
2023-10-18 06:19:04 +00:00
Michael Goulet
232f3146b3
Make sure that non-pretty-printing usages are using the correct elaborator
2023-10-18 03:05:38 +00:00
Michael Goulet
910bb4fe25
Simplify transitive_bounds_that_define_assoc_item
2023-10-18 03:00:51 +00:00
Esteban Küber
dee86bff40
Suggest constraining assoc types in more cases
...
Fix #46969 .
2023-10-17 23:50:13 +00:00
Nilstrieb
6fc6a6d783
Remove Print::Error
...
All printing goes through `fmt::Error` now.
2023-10-17 18:02:57 +02:00
Nilstrieb
6038888118
Remove Printer::Error
...
It's always a `fmt::Error` except in some cases where it was `!`, but
we're not really winning anything in that case.
2023-10-17 18:02:55 +02:00
Nilstrieb
0b5a4c1adf
Remove Print::Output
...
Now that `Printer` doesn't have subprinters anymore, the output of a
printing operation is always the same.
2023-10-17 18:01:07 +02:00
Nilstrieb
3895f0e9af
Remove "subprinter" types from Printer
...
These are `Self` in almost all printers except one, which can just store
the state as a field instead. This simplifies the printer and allows for
further simplifications, for example using `&mut self` instead of
passing around the printer.
2023-10-17 18:01:05 +02:00
Michael Goulet
b2d2184ede
Format all the let chains in compiler
2023-10-13 08:59:36 +00:00
Esteban Küber
a53f280bfc
Suggest ;
after bare match
expression E0308
...
Fix #72634 .
2023-10-11 18:51:56 +00:00
Matthias Krüger
8ddc0df1f1
Rollup merge of #116219 - compiler-errors:relate-alias-ty-with-variance, r=lcnr
...
Relate alias ty with variance
In the new solver, turns out that the subst-relate branch of the alias-relate predicate was relating args invariantly even for opaques, which have variance 💀 .
This change is a bit more invasive, but I'd rather not special-case it [here](aeaa5c30e5/compiler/rustc_trait_selection/src/solve/alias_relate.rs (L171-L190)
) and then have it break elsewhere. I'm doing a perf run to see if the extra call to `def_kind` is that expensive, if it is, I'll reconsider.
r? ``@lcnr``
2023-10-11 20:08:20 +02:00
bors
6d05c430d2
Auto merge of #115948 - notriddle:notriddle/logo-lockup, r=fmease
...
rustdoc: show crate name beside smaller logo
*Blocked on https://github.com/rust-lang/cargo/pull/12800 *
## Summary
In this PR, the crate name and version are always shown in the sidebar, even in subpages, and the lateral navigation is always shown in the sidebar, even in modules.
Clicking the crate name does the same thing clicking the logo always did: take you to the crate root (the crate's home page, at least within Rustdoc).
The Rust logo is also no longer shown by default for non-Rust docs.
### Screenshots
<details><summary>Before</summary>
| | Macro | Module |
|--|-------|--------|
| In crate |  |
| In module[^1] |  | 
[^1]: This PR also includes a bug fix for derive macros not showing up in the lateral navigation part of the sidebar
</details>
#### Whole sidebar screenshots
| | Macro | Module |
|--|-------|--------|
| In crate |  | 
| In module |  | 
#### Different logo configurations
| | Short crate name | Long crate name |
|---------|------------------|-----------------|
| Root | ![short-root] | ![long-root]
| Subpage | ![short-subpage] | ![long-subpage]
[short-root]: https://github.com/rust-lang/rust/assets/1593513/9e2b4fa8-f581-4106-b562-1e0372c13f79
[short-subpage]: https://github.com/rust-lang/rust/assets/1593513/8331cdb8-fa13-4671-a1e2-dcc1cdca7451
[long-root]: https://github.com/rust-lang/rust/assets/1593513/7d377fec-0f1d-4343-9f82-0e35a8f58056
[long-subpage]: https://github.com/rust-lang/rust/assets/1593513/3b3094a4-63c9-477c-8c15-b6075837df30
##### Without a logo

### Preview pages
https://notriddle.com/rustdoc-html-demo-5/sidebar-layout-rocket/rocket/index.html
https://notriddle.com/rustdoc-html-demo-5/sidebar-layout-rocket/rocket_sync_db_pools/index.html
https://notriddle.com/rustdoc-html-demo-5/sidebar-layout-rust-compiler/index.html
https://notriddle.com/rustdoc-html-demo-5/sidebar-layout-rust/std/index.html
https://notriddle.com/rustdoc-html-demo-5/sidebar-layout-rocket/tokio/index.html
## Motivation
This improves visual information density (the construct with the logo and crate name is *shorter* than the logo on its own, because it's not square) and navigation clarity (we can now see what clicking the Rust logo does, specifically).
Compare this with the layout at [Phoenix's Hexdocs] (which is what this proposal is closely based on), the old proposal on [Internals Discourse] (which always says "Rust standard library" in the sidebar, but doesn't do the side-by-side layout).
[Phoenix's Hexdocs]: https://hexdocs.pm/phoenix/1.7.7/overview.html
[Internals Discourse]: https://internals.rust-lang.org/t/poc-of-a-new-design-for-the-generated-rustdoc/11018
## Guide-level explanation
This PR cleans up some of the sidebar navigation.
It makes the logo in the desktop sidebar a bit smaller, and puts the crate name and version next to it (either beside it, or below it, depending on if there's space), making it clearer what clicking on it does: click the crate name to open the crate's home page. It also removes the Rust logo from non-official-Rust crates, again to make the navigation and supply chain clearer (since the crate name has been added, the logo is no longer necessary for navigation).
It adds a bit more clarifying information for lateral navigation. On items that don't add their own sidebar items, it just shows its siblings directly below the crate name and logo, but for other items, it shows "In crate alloc" instead of just "In alloc". It also shows the lateral navigation tools on module pages, making modules consistent with every other item.
## Drawbacks
While this actually takes up less screen real estate than the old layout on desktop, it takes up more HTML. It's also a bit more visually complex.
## Rationale and alternatives
I could do what the Internals POC did and keep the vertically stacked layout all the time, instead of doing a horizontal stack where possible. It would take up more screen real estate, though.
## Prior art
This design is lifted almost verbatim from Hexdocs. It seems to work for them. [`opentelemetry_process_propagator`], for example, has a long application name.
[`opentelemetry_process_propagator`]: https://hexdocs.pm/opentelemetry_process_propagator/OpentelemetryProcessPropagator.html
## Unresolved questions
Maybe we should encourage crate authors to include their own logo more often? It certainly helps give people a better sense of "place." This seems to be blocked on coming up with an API to do it without requiring them to host the file somewhere.
## Future possibilities
Beyond this, plenty of other changes could be made to improve the layout, like
* Fix things so that clicking an item in the sidebar doesn't cause it to scroll back to the top.
* The [Internals demo](https://utherii.github.io/new.html ) does this right: clicking an item in the sidebar changes the content area, but the sidebar itself does not change. This is nice, because clicking is cheap and I can skim the opening few paragraphs while browsing.
* The layout of the docs sidebar causes trouble to implement this, because it's different on different pages, but at least fix this on the file browser.
* Come up with a less cluttered way to do disclosure. There's a lot of `[-]` on the page.
* We don't lack ideas to fix this one. We have *too many*.
* Do a better job of separating local navigation (vec::Vec links to vec::IntoIter) and the table of contents (vec::Vec links to vec::Vec::new).
* A possibility: add a Back arrow next to the "In [module]" header?

* Give readers more control of how much rustdoc shows them, and giving doc authors more control of how much it generates. Basically, https://github.com/rust-lang/rust/pull/115660 is great, let's do it too.
But those are mostly orthogonal, not future possibilities unlocked by this change.
2023-10-11 06:28:36 +00:00
Michael Howell
c6e6ecb1af
rustdoc: remove rust logo from non-Rust crates
2023-10-08 20:17:53 -07:00
Ali MJ Al-Nasrawy
a8830631b9
remove trailing dots
2023-10-08 10:06:17 +00:00
Ali MJ Al-Nasrawy
996ffcb718
always show and explain sub region
2023-10-08 09:59:51 +00:00
Ali MJ Al-Nasrawy
5be0b2283a
improve the suggestion of generic_bound_failure
2023-10-08 09:56:57 +00:00
bors
94bc9c737e
Auto merge of #114811 - estebank:impl-ambiguity, r=wesleywiser
...
Show more information when multiple `impl`s apply
- When there are `impl`s without type params, show only those (to avoid showing overly generic `impl`s).
```
error[E0283]: type annotations needed
--> $DIR/multiple-impl-apply.rs:34:9
|
LL | let y = x.into();
| ^ ---- type must be known at this point
|
note: multiple `impl`s satisfying `_: From<Baz>` found
--> $DIR/multiple-impl-apply.rs:14:1
|
LL | impl From<Baz> for Bar {
| ^^^^^^^^^^^^^^^^^^^^^^
...
LL | impl From<Baz> for Foo {
| ^^^^^^^^^^^^^^^^^^^^^^
= note: required for `Baz` to implement `Into<_>`
help: consider giving `y` an explicit type
|
LL | let y: /* Type */ = x.into();
| ++++++++++++
```
- Lower the importance of `T: Sized`, `T: WellFormed` and coercion errors, to prioritize more relevant errors. The pre-existing deduplication logic deals with hiding redundant errors better that way, and we show errors with more metadata that is useful to the user.
- Show `<SelfTy as Trait>::assoc_fn` suggestion in more cases.
```
error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type
--> $DIR/cross-return-site-inference.rs:38:16
|
LL | return Err(From::from("foo"));
| ^^^^^^^^^^ cannot call associated function of trait
|
help: use a fully-qualified path to a specific available implementation
|
LL | return Err(</* self type */ as From>::from("foo"));
| +++++++++++++++++++ +
```
Fix #88284 .
2023-10-06 18:44:32 +00:00
Michael Goulet
137b6d0b01
Point to where missing return type should go
2023-10-04 21:09:54 +00:00
Michael Goulet
be29d22eab
Make it clear that args default to being related invariantly
2023-10-04 04:22:04 +00:00
Esteban Küber
7313c10774
Show suggestion for <SelfTy as Trait>::assoc_fn
in more cases and fmt code
2023-10-04 02:04:14 +00:00
Matthias Krüger
12e4c780ee
Rollup merge of #116358 - compiler-errors:match, r=lcnr
...
Rename both of the `Match` relations
Both of these names kinda were ambiguous.
r? lcnr
2023-10-03 12:24:12 +02:00
Matthias Krüger
144862ede8
Rollup merge of #115863 - chenyukang:yukang-add-message-tidy-check, r=davidtwco
...
Add check_unused_messages in tidy
From https://github.com/rust-lang/rust/pull/115728#issuecomment-1715490553
The check is not 100% accurate, I guess it's enough for now.
2023-10-03 12:24:11 +02:00
Michael Goulet
2ffaeb5110
Rename both of the Match relations
2023-10-02 21:06:09 +00:00
Matthias Krüger
fd95627134
fix clippy::{redundant_guards, useless_format}
2023-09-27 23:49:15 +02:00
Michael Goulet
d6ce9ce115
Don't store lazyness in DefKind
2023-09-26 02:53:59 +00:00
Camille GILLOT
26cb34cd18
Remove span from BrAnon.
2023-09-24 09:46:55 +00:00
Matthias Krüger
8c9e516e6e
Rollup merge of #116082 - compiler-errors:default-assoc-ty-msg, r=estebank
...
Tweak expected message to explain what it's actually signifying
r? ``@estebank`` since you added this
2023-09-24 01:14:06 +02:00
Matthias Krüger
d92a1bd7cc
Rollup merge of #116073 - compiler-errors:poly-sigs, r=b-naber
...
Allow higher-ranked fn sigs in `ValuePairs`
For better bookkeeping -- only affects diagnostic path. Allow reporting signature mismatches like "signature"s and not "fn pointer"s.
Improves https://github.com/rust-lang/rust/pull/115897#discussion_r1331940846
2023-09-24 01:14:05 +02:00
Camille GILLOT
44ac8dcc71
Remove GeneratorWitness and rename GeneratorWitnessMIR.
2023-09-23 13:47:30 +00:00
Camille GILLOT
baa64b0e77
Remove dead error code.
2023-09-23 13:47:30 +00:00
Michael Goulet
82e7cec16d
Tweak expected message to explain what it's actually signifying
2023-09-23 00:57:17 +00:00