about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2023-10-11rustdoc: enforce BODY_MIN constraint on sidebar resizeMichael Howell-17/+122
2023-10-11rustdoc: clean up main.js and src-script.jsMichael Howell-6/+13
* Run the querySelector for the toggleLabel only once, and store the result. * Use querySelector to find the resizer and sidebar. * Add comments to main.js sections.
2023-10-11rustdoc: allow resizing the sidebarMichael Howell-21/+328
2023-10-11Handle private dep at the same level as masked cratesGuillaume Gomez-15/+10
2023-10-11Prevent showing methods from blanket impls of not available foreign traits ↵Guillaume Gomez-1/+13
to show up in the search results
2023-10-11Auto merge of #115948 - notriddle:notriddle/logo-lockup, r=fmeasebors-61/+233
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-11Auto merge of #116622 - weihanglo:update-cargo, r=weihanglobors-0/+0
Update cargo 5 commits in 794d0a82547f3081044c0aca7b6083733ce51344..6fa6fdc7606cfa664f9bee2fb33ee2ed904f4e88 2023-10-03 23:19:33 +0000 to 2023-10-10 23:06:08 +0000 - test(build): generalize test assertion for non-rustup env (rust-lang/cargo#12804) - chore: Sort dependency tables (rust-lang/cargo#12803) - fix(install): Suggest an alternative version on MSRV failure (rust-lang/cargo#12798) - rustdoc: remove the word "Version" from test cases (rust-lang/cargo#12800) - Add unsupported lowercase `-z` flag suggestion for `-Z` flag (rust-lang/cargo#12788) r? ghost
2023-10-10implement sinlge line let-chain rulesYacin Tmimi-3/+41
for now, let-chains can only be formatted on a single line if the chain consits of 2 expressions where the first is an identifier proceeded by any number of unary operators and the second is a let-expr.
2023-10-10Add support for ExprKind::LetCameron Steffen-1/+32
2023-10-11Rollup merge of #116611 - mejrs:diagnostic_namespace, r=ehussAli MJ Al-Nasrawy-0/+84
Document `diagnostic_namespace` feature This adds it to the rust unstable book. FWIW: I couldn't find a way to serve the book locally (please send help), so I can't check that this renders correctly. cc `@weiznich`
2023-10-10update cargoWeihang Lo-0/+0
2023-10-11Document `diagnostic_namespace` featuremejrs-0/+84
2023-10-10Rollup merge of #116574 - rustbot:docs-update, r=ehussGuillaume Gomez-0/+0
Update books ## rust-lang/reference 2 commits in 5262e1c3b43a2c489df8f6717683a44c7a2260fd..142b2ed77d33f37a9973772bd95e6144ed9dce43 2023-10-07 19:41:21 UTC to 2023-09-26 12:26:35 UTC - replace 'UB on raw ptr deref' with UB on place projection/access (rust-lang/reference#1387) - docs: Fix links to ECMA standards in `attributes.md` (rust-lang/reference#1408) ## rust-lang/rust-by-example 11 commits in c954202c1e1720cba5628f99543cc01188c7d6fc..8eb3a01ab74c567b7174784892fb807f2c632d6b 2023-09-26 12:38:17 UTC to 2023-09-26 12:29:10 UTC - fixed a typo in the lifetime.md (rust-lang/rust-by-example#1737) - Misleading textual statement in HOF (rust-lang/rust-by-example#1731) - Equalize title from respective file with title in SUMMARY.md (rust-lang/rust-by-example#1738) - Added explanation for compiling and executing match_args.rs. (rust-lang/rust-by-example#1739) - Wrapped long lines and put #[doc] in backquotes. (rust-lang/rust-by-example#1740) - Update read_lines example to flatten iterator (rust-lang/rust-by-example#1742) - Update while_let.md: address inconsistent use of fn main between 2 co… (rust-lang/rust-by-example#1744) - [TRIVIAL] Remove confusing `also` (rust-lang/rust-by-example#1746) - Fix and extend the explanation of outer vs inner attributes. (rust-lang/rust-by-example#1748) - Fix uncorresponded back quote (rust-lang/rust-by-example#1749) - Fix format in constants.md (rust-lang/rust-by-example#1741) ## rust-lang/rustc-dev-guide 3 commits in a13b7c28ed705891c681ce5417b3d1cdb12cecd1..b98af7d661e4744baab81fb8dc7a049e44a4a998 2023-10-05 19:48:35 UTC to 2023-09-27 22:57:27 UTC - update new trait solver docs (rust-lang/rustc-dev-guide#1802) - update rustc_driver examples (rust-lang/rustc-dev-guide#1803) - test headers: fix `compile-flags` example (rust-lang/rustc-dev-guide#1800)
2023-10-10Rollup merge of #116503 - ehuss:fix-mips-tier, r=AmanieuGuillaume Gomez-0/+4
Update docs for mips target tier demotion. These mips targets were demoted in #113274, but the documentation was not updated. I have also elected to document this in the release notes for 1.72 because I think that should have been included.
2023-10-10Rollup merge of #109422 - notriddle:notriddle/impl-disambiguate-search, ↵Guillaume Gomez-51/+146
r=GuillaumeGomez rustdoc-search: add impl disambiguator to duplicate assoc items Preview (to see the difference, click the link and pay attention to the specific function that comes up): | Before | After | |--|--| | [`simd<i64>, simd<i64> -> simd<i64>`](https://doc.rust-lang.org/nightly/std/?search=simd%3Ci64%3E%2C%20simd%3Ci64%3E%20-%3E%20simd%3Ci64%3E) | [`simd<i64>, simd<i64> -> simd<i64>`](https://notriddle.com/rustdoc-demo-html-3/impl-disambiguate-search/std/index.html?search=simd%3Ci64%3E%2C%20simd%3Ci64%3E%20-%3E%20simd%3Ci64%3E) | | [`cow, vec -> bool`](https://doc.rust-lang.org/nightly/std/?search=cow%2C%20vec%20-%3E%20bool) | [`cow, vec -> bool`](https://notriddle.com/rustdoc-demo-html-3/impl-disambiguate-search/std/index.html?search=cow%2C%20vec%20-%3E%20bool) Helps with #90929 This changes the search results, specifically, when there's more than one impl with an associated item with the same name. For example, the search queries `simd<i8> -> simd<i8>` and `simd<i64> -> simd<i64>` don't link to the same function, but most of the functions have the same names. This change should probably be FCP-ed, especially since it adds a new anchor link format for `main.js` to handle, so that URLs like `struct.Vec.html#impl-AsMut<[T]>-for-Vec<T,+A>/method.as_mut` redirect to `struct.Vec.html#method.as_mut-2`. It's a strange design, but there are a few reasons for it: * I'd like to avoid making the HTML bigger. Obviously, fixing this bug is going to add at least a little more data to the search index, but adding more HTML penalises viewers for the benefit of searchers. * Breaking `struct.Vec.html#method.len` would also be a disappointment. On the other hand: * The path-style anchors might be less prone to link rot than the numbered anchors. It's definitely less likely to have URLs that appear to "work", but silently point at the wrong thing. * This commit arranges the path-style anchor to redirect to the numbered anchor. Nothing stops rustdoc from doing the opposite, making path-style anchors the default and redirecting the "legacy" numbered ones. ### The bug On the "Before" links, this example search calls for `i64`: ![image](https://github.com/rust-lang/rust/assets/1593513/9431d89d-41dc-4f68-bbb1-3e2704a973d2) But if I click any of the results, I get `f64` instead. ![image](https://github.com/rust-lang/rust/assets/1593513/6d89c692-1847-421a-84d9-22e359d9cf82) The PR fixes this problem by adding enough information to the search result `href` to disambiguate methods with different types but the same name. More detailed description of the problem at: https://github.com/rust-lang/rust/pull/109422#issuecomment-1491089293 > When a struct/enum/union has multiple impls with different type parameters, it can have multiple methods that have the same name, but which are on different impls. Besides Simd, [Any](https://doc.rust-lang.org/nightly/std/any/trait.Any.html?search=any%3A%3Adowncast) also demonstrates this pattern. It has three methods named `downcast`, on three different impls. > > When that happens, it presents a challenge in linking to the method. Normally we link like `#method.foo`. When there are multiple `foo`, we number them like `#method.foo`, `#method.foo-1`, `#method.foo-2`, etc. > > It also presents a challenge for our search code. Currently we store all the variants in the index, but don’t have any way to generate unambiguous URLs in the results page, or to distinguish them in the SERP. > > To fix this, we need three things: > > 1. A fragment format that fully specifies the impl type parameters when needed to disambiguate (`#impl-SimdOrd-for-Simd<i64,+LANES>/method.simd_max`) > 2. A search index that stores methods with enough information to disambiguate the impl they were on. > 3. A search results interface that can display multiple methods on the same type with the same name, when appropriate OR a disambiguation landing section on item pages? > > For reviewers: it can be hard to see the new fragment format in action since it immediately gets rewritten to the numbered form.
2023-10-10move `features` above to appear before others sectionsonur-ozkan-3/+3
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2023-10-10sort/reorganize dependencies in bootstrap/Cargo.tomlonur-ozkan-9/+9
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2023-10-10Update license for notifybjorn3-1/+1
2023-10-10Update status for the backtrace and stdarch exceptionsbjorn3-2/+2
2023-10-10Disable tidy license checker for cg_gcc until it's deps are vendoredbjorn3-10/+4
2023-10-10Ensure tidy never updates Cargo.lockbjorn3-2/+3
Otherwise the results may be outdated compared to a build at a later time. Also disable checking for the backtrace workspace until Cargo.lock is committed.
2023-10-10Check more workspacesbjorn3-0/+23
2023-10-10Give an error instead of a panic if the lockfile is missingbjorn3-0/+10
2023-10-10Add two lockfilesbjorn3-0/+91
2023-10-10Update rand dependency for test-float-parsebjorn3-1/+1
This removes a dependency on fuchsia-cprng which doesn't have any license info.
2023-10-10Clarify some license exceptionsbjorn3-13/+10
2023-10-10Check for external package sources in all workspacesbjorn3-26/+38
2023-10-10Run licence checks for cg_gcc and rust-analyzerbjorn3-1/+28
2023-10-10Make it easier to check licenses for new workspacesbjorn3-52/+60
2023-10-10Check permitted dependencies for rustc-mainbjorn3-1/+2
Rather than just for rustc_driver. rustc-main also depends on rustc_smir which may get unique dependencies in the future.
2023-10-10Split out check_runtime_license_exceptionsbjorn3-19/+48
For runtime dependencies we have a much stricter license check. Combining the license check code with that for regular tools makes it harder to follow.
2023-10-10Auto merge of #116551 - RalfJung:nondet-nan, r=oli-obkbors-20/+480
miri: make NaN generation non-deterministic This implements the [LLVM semantics for NaN generation](https://llvm.org/docs/LangRef.html#behavior-of-floating-point-nan-values). I will soon submit an RFC to make this also officially the Rust semantics, but it has been our de-facto semantics for a long time so there's no reason Miri has to wait for that RFC. This PR just better aligns Miri with codegen. This PR does that just for the operations that have MIR primitives; a future PR will adjust the intrinsics.
2023-10-10avoid confusing loop in catch_panic testRalf Jung-5/+6
2023-10-10Add unstable book page for the no-jump-tables codegen optionTrevor Gross-0/+19
2023-10-10Rejig some top-level `rustc_hir_pretty` functions.Nicholas Nethercote-2/+2
There are several that are unused and can be removed. And there are some calls to `to_string`, which can be expressed more nicely as a `foo_to_string` call, and then `to_string` need not be `pub`. (This requires adding `pat_to_string`).
2023-10-09Use GitHub Actions M1 builder for aarch64-apple-darwinJake Goulding-14/+7
Additionally, this enables 1. building the documentation 2. Setting `rust.lto` to `thin` to match the x86_64 build
2023-10-09Install `awscli` on the aarch64-apple-darwin builderJake Goulding-0/+33
Unlike the other builders, this one doesn't come with it preinstalled.
2023-10-09Auto merge of #116497 - compiler-errors:impl-span, r=cjgillotbors-1/+1
Extend `impl`'s `def_span` to include its where clauses Typically, we highlight the def-span of an impl in a diagnostic due to either: 1. coherence error 2. trait evaluation cycle 3. invalid implementation of built-in trait I find that an impl's where clauses are very often required to understanding why these errors come about, which is unfortunate since where clauses may be located on different lines and don't show up in the error. This PR expands the def-span of impls to include these where clauses. r? cjgillot since you've touched this code a while back to make some spans shorter, but you can also reassign to wg-diagnostics or compiler if you're busy or have no strong opinions.
2023-10-09Auto merge of #3101 - eduardosm:x86-aes-intrinsics, r=RalfJungbors-0/+539
Implement `llvm.x86.aesni.*` intrinsics
2023-10-09Add `--enable-bolt-settings` bootstrap flagJakub Beránek-16/+57
2023-10-09Optimize `librustc_driver.so` with BOLTJakub Beránek-43/+84
2023-10-09Enable relocations for BOLTJakub Beránek-0/+11
2023-10-09Build GCC with support for BOLTJakub Beránek-1/+6
2023-10-09Pass more host flags using `RUSTC_HOST_FLAGS`Jakub Beránek-15/+15
2023-10-09add `SAFETY` block on usage of unsafe `getuid`onur-ozkan-0/+4
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2023-10-09Implement `llvm.x86.aesni.*` intrinsicsEduardo Sánchez Muñoz-0/+539
2023-10-09Auto merge of #116532 - onur-ozkan:enable-rustflags-bootstrap-on-bootstrap, ↵bors-0/+7
r=albertlarsan68 Add RUSTFLAGS_BOOTSTRAP to RUSTFLAGS for bootstrap compilation Adds `RUSTFLAGS_BOOTSTRAP` to `RUSTFLAGS` for bootstrap compilation when `RUSTFLAGS_BOOTSTRAP` exists in the environment. With this PR, `RUSTFLAGS_BOOTSTRAP` will affect every build(as we already do for rustc and std) compiled with stage0 compiler. Resolves #94234
2023-10-09Update booksrustbot-0/+0
2023-10-09Auto merge of #116569 - matthiaskrgr:rollup-ni0jdd6, r=matthiaskrgrbors-1/+0
Rollup of 6 pull requests Successful merges: - #115882 (improve the suggestion of `generic_bound_failure`) - #116537 (Fix suggestion span involving wrongly placed generic arg on variant) - #116543 (In smir `find_crates` returns `Vec<Crate>` instead of `Option<Crate>`) - #116549 (Simplify some mir passes by using let chains) - #116556 (Sync rustc_codegen_cranelift) - #116561 (Add a test for fixed ICE) r? `@ghost` `@rustbot` modify labels: rollup
2023-10-09Rollup merge of #116556 - bjorn3:sync_cg_clif-2023-10-09, r=bjorn3Matthias Krüger-1/+0
Sync rustc_codegen_cranelift The highlights this time are improved simd and inline asm support, `is_x86_feature_detected!()` returning the actual cpu features when inline asm support is enabled and a couple of bug fixes. r? ```@ghost``` ```@rustbot``` label +A-codegen +A-cranelift +T-compiler +subtree-sync