Oğuz Ağcayazı
d6a55d3409
change fn name, return loc info, local name
2023-10-13 11:44:38 +03:00
Oğuz Ağcayazı
1d9481fdc8
implement get_filename/lines for span
2023-10-11 17:55:57 +03: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 | ![image](https://github.com/rust-lang/rust/assets/1593513/d5db0a46-2bb6-44a2-a3aa-2d915ecb8595 ) |![image](https://github.com/rust-lang/rust/assets/1593513/61f8c1ee-c298-4e2c-b791-18ecb79ab83b )
| In module[^1] | ![image](https://github.com/rust-lang/rust/assets/1593513/73abca59-0b69-4650-a1e2-7278ca34795c ) | ![image](https://github.com/rust-lang/rust/assets/1593513/0baf02c2-2ec7-4674-80e5-a6a74a973376 )
[^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 | ![image](https://github.com/rust-lang/rust/assets/1593513/75d1bd07-41f7-4f11-ba24-fd5476e0586a ) | ![image](https://github.com/rust-lang/rust/assets/1593513/52960259-2b65-4131-b380-01826f0a0eb7 )
| In module | ![image](https://github.com/rust-lang/rust/assets/1593513/06e57928-8cb0-41bd-b152-be16cc53e5ec ) | ![image](https://github.com/rust-lang/rust/assets/1593513/37291c69-2a07-4467-a382-d9b029084a47 )
#### 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
![image](https://github.com/rust-lang/rust/assets/1593513/66672b79-6c59-4be8-a527-25ef6f0b04ab )
### 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?
![image](https://github.com/rust-lang/rust/assets/1593513/e969faf7-7722-457a-b8c6-8d962e9e1e23 )
* 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
Guillaume Gomez
100713ef08
Rollup merge of #116560 - ouz-a:efficient_ids, r=oli-obk
...
In smir use `FxIndexMap` to store indexed ids
Previously we used `vec` for storing indexed types, which is fine for small cases but will lead to huge performance issues when we use `smir` for real world cases.
Addresses https://github.com/rust-lang/project-stable-mir/issues/35
r? ``@oli-obk``
2023-10-10 18:44:46 +02:00
Oğuz Ağcayazı
0bcb058fb1
add new wrapper for FxIndexMap
2023-10-10 13:18:31 +03:00
Oğuz Ağcayazı
77df2cd9a5
spans are now indexmapped
2023-10-09 13:03:58 +03:00
Oğuz Ağcayazı
5f079dd2ff
alloc id is indexmapped
2023-10-09 12:58:41 +03:00
Oğuz Ağcayazı
0f27c1b5b5
defids are indexmapped
2023-10-09 12:56:14 +03:00
Oğuz Ağcayazı
4ff6e87a8c
return crates instead of a crate
2023-10-09 10:33:23 +03:00
Michael Howell
c6e6ecb1af
rustdoc: remove rust logo from non-Rust crates
2023-10-08 20:17:53 -07:00
Nicholas Nethercote
e7dabc9f87
Remove unnecessary pub
.
2023-10-06 14:59:11 +11:00
Nicholas Nethercote
093b435b78
Remove unneeded features.
2023-10-06 14:58:01 +11:00
Nicholas Nethercote
4b51a3eb52
Remove unneeded dependency.
...
Also sort them.
2023-10-06 14:57:25 +11:00
Oğuz Ağcayazı
a49138e46e
impl stable for kinds
2023-10-05 11:15:34 +03:00
ouz-a
a79567b01c
add span to statements
2023-10-05 11:15:34 +03:00
ouz-a
999a354a81
add span to terminator
2023-09-30 16:52:10 +03:00
ouz-a
9130484db9
create localdecl and add span to it
2023-09-30 16:40:15 +03:00
ouz-a
34f10e2ab9
remove unimplemented
2023-09-28 19:52:41 +03:00
ouz-a
bb17fe8bf5
add real folder to Region
2023-09-28 12:32:15 +03:00
ouz-a
da2f897e59
remove un-needed variants
2023-09-28 11:43:21 +03:00
ouz-a
2069e8c218
fix imports
2023-09-28 11:36:53 +03:00
ouz-a
5dc2214884
add stable for RegionKind
2023-09-28 11:19:51 +03:00
ouz-a
e49aa04000
add RegionDef
2023-09-28 11:19:51 +03:00
Oli Scherer
411e431c70
Rebase fallout
2023-09-25 15:02:10 +00:00
Oli Scherer
a38e98371b
Split out the stable part of smir into its own crate to prevent accidental usage of forever unstable things
2023-09-25 14:38:27 +00:00
Oli Scherer
19f1d782d5
Move Opaque
to stable_mir
2023-09-25 14:38:27 +00:00
Oli Scherer
33998a9751
Fix test by adding a stable way to get an opaque DefKind
2023-09-25 14:38:27 +00:00
Oli Scherer
55b6f64902
Eliminate escape hatch
2023-09-25 14:38:26 +00:00
Oli Scherer
e02a139a23
Eliminate with_tables
helper
2023-09-25 14:38:26 +00:00
Camille GILLOT
26cb34cd18
Remove span from BrAnon.
2023-09-24 09:46:55 +00:00
Camille GILLOT
44ac8dcc71
Remove GeneratorWitness and rename GeneratorWitnessMIR.
2023-09-23 13:47:30 +00:00
Guillaume Gomez
208f6ed95c
Rollup merge of #115972 - RalfJung:const-consistency, r=oli-obk
...
rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::Const
Also, be more consistent with the `to/eval_bits` methods... we had some that take a type and some that take a size, and then sometimes the one that takes a type is called `bits_for_ty`.
Turns out that `ty::Const`/`mir::ConstKind` carry their type with them, so we don't need to even pass the type to those `eval_bits` functions at all.
However this is not properly consistent yet: in `ty` we have most of the methods on `ty::Const`, but in `mir` we have them on `mir::ConstKind`. And indeed those two types are the ones that correspond to each other. So `mir::ConstantKind` should actually be renamed to `mir::Const`. But what to do with `mir::Constant`? It carries around a span, that's really more like a constant operand that appears as a MIR operand... it's more suited for `syntax.rs` than `consts.rs`, but the bigger question is, which name should it get if we want to align the `mir` and `ty` types? `ConstOperand`? `ConstOp`? `Literal`? It's not a literal but it has a field called `literal` so it would at least be consistently wrong-ish...
``@oli-obk`` any ideas?
2023-09-21 13:25:39 +02:00
Ralf Jung
c94410c145
rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::Const
2023-09-21 08:12:30 +02:00
Ralf Jung
ea22adbabd
adjust constValue::Slice to work for arbitrary slice types
2023-09-19 20:17:43 +02:00
Ralf Jung
5a0a1ff0cd
move ConstValue into mir
...
this way we have mir::ConstValue and ty::ValTree as reasonably parallel
2023-09-19 11:11:02 +02:00
Matthias Krüger
4f90a52ae6
Rollup merge of #115772 - ouz-a:smir_span2, r=oli-obk
...
Improve Span in smir
Addressing https://github.com/rust-lang/project-stable-mir/issues/31
r? ``@oli-obk``
2023-09-14 19:12:31 +02:00
Ralf Jung
430c386821
make it more clear which functions create fresh AllocId
2023-09-14 07:27:31 +02:00
Ralf Jung
0f8908da27
cleanup op_to_const a bit; rename ConstValue::ByRef → Indirect
2023-09-14 07:27:30 +02:00
Ralf Jung
551f481ffb
use AllocId instead of Allocation in ConstValue::ByRef
2023-09-14 07:26:24 +02:00
ouz-a
fa57a48cf5
span is index
2023-09-14 00:32:21 +03:00
bors
1fe747c160
Auto merge of #115793 - spastorino:smir-explicit-predicates-of, r=oli-obk
...
Add explicit_predicates_of to SMIR
Adding `explicit_predicates_of` so we can use it from Mir formality.
r? `@oli-obk`
2023-09-13 04:51:19 +00:00
Santiago Pastorino
3678dbc382
Add explicit_predicates_of to SMIR
2023-09-12 15:12:02 -03:00
Matthias Krüger
2a087be735
Rollup merge of #115749 - oli-obk:smir_consts, r=compiler-errors
...
Allow loading the SMIR for constants and statics
cc https://github.com/rust-lang/project-stable-mir/issues/34
before this PR we were ICEing when trying to access the SMIR of anything other than functions
2023-09-11 21:16:23 +02:00
Matthias Krüger
c943ec2fba
Rollup merge of #115730 - bjorn3:some_driver_refactors, r=compiler-errors
...
Some more small driver refactors
To improve clarity and simplify some code.
2023-09-11 21:16:22 +02:00
Matthias Krüger
e7a347baf8
Rollup merge of #115727 - fee1-dead-contrib:effect-fallback, r=oli-obk
...
Implement fallback for effect param
r? `@oli-obk` or `@lcnr`
tracking issue for this ongoing work: https://github.com/rust-lang/rust/issues/110395
2023-09-11 17:03:31 +02:00
Deadbeef
9654d5ceaf
add is_host_effect
to GenericParamDefKind::Const
and address review
2023-09-11 13:18:36 +00:00
Oli Scherer
c2e790044c
Allow loading the SMIR for constants and statics
2023-09-11 08:14:56 +00:00
bjorn3
2eca717a24
Remove EarlyErrorHandler argument from after_analysis callback
...
It is only used by miri which can create a new one using the Session.
2023-09-10 09:44:03 +00:00
ouz-a
d190ebf2fc
add function that returns span of an item
2023-09-09 14:17:36 +03:00
Matthias Krüger
9a901dad6f
Rollup merge of #115605 - ouz-a:smir_better_debug, r=oli-obk
...
Better Debug for `Ty` in smir
Similar to what I did here https://github.com/rust-lang/rust/pull/115534 .
r? ``@oli-obk``
2023-09-06 19:31:51 +02:00