Commit Graph

342 Commits

Author SHA1 Message Date
Jacob Pratt
05f22c3614
Rollup merge of #121840 - oli-obk:freeze, r=dtolnay
Expose the Freeze trait again (unstably) and forbid implementing it manually

non-emoji version of https://github.com/rust-lang/rust/pull/121501

cc #60715

This trait is useful for generic constants (associated consts of generic traits). See the test (`tests/ui/associated-consts/freeze.rs`) added in this PR for a usage example. The builtin `Freeze` trait is the only way to do it, users cannot work around this issue.

It's also a useful trait for building some very specific abstrations, as shown by the usage by the `zerocopy` crate: https://github.com/google/zerocopy/issues/941

cc ```@RalfJung```

T-lang signed off on reexposing this unstably: https://github.com/rust-lang/rust/pull/121501#issuecomment-1969827742
2024-03-11 03:47:19 -04:00
许杰友 Jieyou Xu (Joe)
247a080b98
Update test names to not have dots 2024-03-05 09:02:33 +00:00
Guillaume Gomez
b119189075 Add regression test for #121772 2024-03-01 15:33:02 +01:00
Oli Scherer
f030d49536 Expose Freeze trait again 2024-02-29 13:55:11 +00:00
Matthias Krüger
843920f0f6
Rollup merge of #121689 - GuillaumeGomez:rustdoc-highlighting-whitespace, r=notriddle
[rustdoc] Prevent inclusion of whitespace character after macro_rules ident

Discovered this bug randomly when looking at:

![image](https://github.com/rust-lang/rust/assets/3050060/dca38047-9085-4377-bfac-f98890224be4)

We were too eagerly trying to merge tokens that shouldn't be merged together (for example if you have a code comment followed by a code comment, we merge them in one attribute to reduce the DOM size).

r? ``@notriddle``
2024-02-29 00:16:59 +01:00
Guillaume Gomez
632d26aeff Add regression test for inclusion of whitespace characters in rustdoc highlighting 2024-02-28 16:08:46 +01:00
Guillaume Gomez
b609afeaf2
Rollup merge of #121680 - GuillaumeGomez:foreign-macro-jump-to-def, r=notriddle
Fix link generation for foreign macro in jump to definition feature

The crate name is already added to the link so it shouldn't be added a second time for local foreign macros.

r? ``@notriddle``
2024-02-28 16:04:52 +01:00
Guillaume Gomez
65b190d34d
Rollup merge of #121572 - notriddle:notriddle/test-case-121106, r=GuillaumeGomez
Add test case for primitive links in alias js

Follow up #121490

CC #121106
2024-02-28 16:04:51 +01:00
Guillaume Gomez
4dd05e6424 Add regression test for link generation on foreign macro in jump to defintion feature 2024-02-27 16:20:11 +01:00
bors
0250ef2571 Auto merge of #121461 - reitermarkus:generic-nonzero-tests, r=dtolnay
Use generic `NonZero` in tests.

Tracking issue: https://github.com/rust-lang/rust/issues/120257

r? `@dtolnay`
2024-02-26 01:16:16 +00:00
Markus Reiter
b2fbb8a053
Use generic NonZero in tests. 2024-02-25 12:03:48 +01:00
Michael Howell
0da1b71053 Add test case for primitive links in alias js 2024-02-24 16:47:29 -07:00
Michael Howell
24aa348586 Add test cases for inlining compiler-private items
Closes #106421

This was already fixed by
f5d43a052b, but now the test cases are
added.
2024-02-24 15:38:55 -07:00
许杰友 Jieyou Xu (Joe)
6e48b96692
[AUTO_GENERATED] Migrate compiletest to use ui_test-style //@ directives 2024-02-22 16:04:04 +00:00
León Orell Valerian Liehr
8ba0ad0775
Rollup merge of #121218 - ShoyuVanilla:fix-issue-76736, r=notriddle
Fix missing trait impls for type in rustc docs

Fixes #76736
2024-02-18 05:10:18 +01:00
León Orell Valerian Liehr
28c0fa87bb
Rollup merge of #121160 - fmease:rustdoc-fix-n-refactor-html-rendering, r=GuillaumeGomez
rustdoc: fix and refactor HTML rendering a bit

* refactoring: get rid of a bunch of manual `f.alternate()` branches
  * not sure why this wasn't done so already, is this perf-sensitive?
* fix an ICE in debug builds of rustdoc
  * rustdoc used to crash on empty outlives-bounds: `where 'a:`
* properly escape const generic defaults
* actually print empty trait and outlives-bounds (doesn't work for cross-crate reexports yet, will fix that at some other point) since they can have semantic significance
  * outlives-bounds: forces lifetime params to be early-bound instead of late-bound which is technically speaking part of the public API
  * trait-bounds: can affect the well-formedness, consider
    * makeshift “const-evaluatable” bounds under `generic_const_exprs`
    * bounds to force wf-checking in light of #100041 (quite artificial I know, I couldn't figure out something better), see https://github.com/rust-lang/rust/pull/121160#discussion_r1491563816
2024-02-18 05:10:17 +01:00
Shoyu Vanilla
f5d43a052b Fix missing trait impls for type in rustc docs 2024-02-17 14:27:05 +09:00
León Orell Valerian Liehr
5fbb1b2f4d
rustdoc: fix and refactor HTML rendering a bit 2024-02-16 21:29:16 +01:00
Guillaume Gomez
a7e486a76e
Rollup merge of #121095 - chenyukang:yukang-fix-120998-rust-playground-link, r=GuillaumeGomez
Add extra indent spaces for rust-playground link

Fixes #120998

Seems add `rustfmt` for this is somehow too heavy,
only adding indent spaces at the starting of each line of code seems good enough.
2024-02-16 00:27:32 +01:00
yukang
bd546fb20a add extra indent spaces for rust-playground link 2024-02-15 18:57:21 +08:00
Matthias Krüger
f9a0675c3c
Rollup merge of #121022 - fmease:rustdoc-x-crate-late-bound-lt-src-order, r=GuillaumeGomez
rustdoc: cross-crate re-exports: correctly render late-bound params in source order even if early-bound params are present

r? ghost
2024-02-15 09:20:18 +01:00
León Orell Valerian Liehr
a8d869e1d1
rustdoc: cross-crate re-exports: correctly render late-bound params in source order even if early-bound params are present 2024-02-15 01:40:38 +01:00
Matthias Krüger
5d9c899c77
Rollup merge of #120548 - GuillaumeGomez:glob-reexport-cfg-merge, r=GuillaumeGomez
rustdoc: Fix handling of doc_auto_cfg feature for cfg attributes on glob reexport

This is a follow-up of #120501 and a part of https://github.com/rust-lang/rust/issues/120487.

r? `@notriddle`
2024-02-13 17:38:09 +01:00
Guillaume Gomez
14e0dab96b Unify item relative path computation in one function 2024-02-09 14:16:37 +01:00
Guillaume Gomez
f3c24833c5 Add regression test for non local items link generation 2024-02-09 11:29:40 +01:00
Guillaume Gomez
48c4272718 Add regression test for doc_auto_cfg feature handling with glob reexports 2024-02-01 11:47:02 +01:00
Nadrieril
4eaf4c2615
Rollup merge of #120501 - GuillaumeGomez:glob-reexport-attr-merge-bugfix, r=notriddle
rustdoc: Correctly handle attribute merge if this is a glob reexport

Fixes #120487.

The regression was introduced in https://github.com/rust-lang/rust/pull/113091. Only non-glob reexports should have been impacted.

cc `````@Nemo157`````
r? `````@notriddle`````
2024-01-31 12:10:53 +01:00
Guillaume Gomez
024364ac60 Add regression test for #120487 2024-01-30 18:14:09 +01:00
Guillaume Gomez
1e60cc9bd9 Add regression test for #100638 2024-01-29 14:14:03 +01:00
Nikita Popov
31f5f033e9 Remove uses of no-system-llvm
It looks like none of these are actually needed.
2024-01-23 10:31:07 +01:00
Guillaume Gomez
0933f48ac0 Add regression test for #119015 and update tests 2024-01-20 13:21:03 +01:00
Matthias Krüger
cad609d9e3
Rollup merge of #117662 - GuillaumeGomez:links-in-headings, r=notriddle
[rustdoc] Allows links in headings

Reopening of https://github.com/rust-lang/rust/pull/94360.

# Explanations

Rustdoc currently doesn't follow the markdown spec on headings: we don't allow links in them. So instead of having headings linking to themselves, this PR generates an anchor on the left side like this:

![image](https://github.com/rust-lang/rust/assets/3050060/a118a7e9-5ef8-4d07-914f-46defc3245c3)

<details>
<summary>previous version</summary>

![image](https://github.com/rust-lang/rust/assets/3050060/c34fa844-9cd4-47dc-bb51-b37f5f66afee)

</details>

Having the anchor always displayed allows for mobile devices users to be able to have a link to the anchor. The different color used for the anchor itself is the same as links so people notice when looking at it that they can click on it.

You can test it [here](https://rustdoc.crud.net/imperio/links-in-headings/std/index.html).

cc `@camelid`
r? `@notriddle`
2024-01-19 19:26:59 +01:00
Guillaume Gomez
8914ca722c
Rollup merge of #119561 - notriddle:master, r=fmease
rustdoc: rename `issue-\d+.rs` tests to have meaningful names (part 5)

Follow up

* https://github.com/rust-lang/rust/pull/116214
* https://github.com/rust-lang/rust/pull/116432
* https://github.com/rust-lang/rust/pull/116824
* https://github.com/rust-lang/rust/pull/118105
2024-01-14 20:17:23 +01:00
Matthias Krüger
7c378d0058
Rollup merge of #119769 - fmease:rustdoc-off-by-one-dyn-trait-def-gen-args, r=GuillaumeGomez
rustdoc: offset generic args of cross-crate trait object types when cleaning

Fixes #119529.

This PR contains several refactorings apart from the bug fix.
Best reviewed commit by commit.
r? GuillaumeGomez
2024-01-10 06:28:44 +01:00
León Orell Valerian Liehr
17ec134fa4
Update tests 2024-01-09 17:07:38 +01:00
Michael Goulet
d90c702566
Rollup merge of #119216 - weiznich:use_diagnostic_namespace_in_stdlib, r=compiler-errors
Use diagnostic namespace in stdlib

This required a minor fix to have the diagnostics shown in third party crates when the `diagnostic_namespace` feature is not enabled. See 5d63f5d8d1 for details. I've opted for having a single PR for both changes as it's really not that much code. If it is required it should be easy to split up the change into several PR's.

r? `@compiler-errors`
2024-01-05 23:41:41 -05:00
León Orell Valerian Liehr
54967d7a68
Ignore a rustdoc test 2024-01-05 20:33:16 +01:00
Michael Goulet
3f19de6352
Rollup merge of #119586 - GuillaumeGomez:jump-to-def-static-methods, r=notriddle
[rustdoc] Fix invalid handling for static method calls in jump to definition feature

I realized when working on a clippy lint that static method calls on `Self` could not give me the method `Res`. For that, we need to use `typeck` and so that's what I did in here.

It fixes the linking to static method calls.

r? ````@notriddle````
2024-01-05 10:57:23 -05:00
Guillaume Gomez
5bc7687351 Add regression test for jump to def static method calls 2024-01-04 20:24:16 +01:00
Michael Howell
35830fe218 rustdoc: rename issue-\d+.rs tests to have meaningful names (part 5) 2024-01-03 15:33:12 -07:00
Michael Howell
b5c9982c0a Add crate_name and URL to test cases 2024-01-03 15:33:12 -07:00
bors
67b6975051 Auto merge of #119066 - notriddle:notriddle/sidebar-source-redesign, r=GuillaumeGomez
rustdoc: clean up source sidebar hide button

This is a redesign of the feature, with parts pulled from https://github.com/rust-lang/rust/pull/119049 but with a button that looks more like a button and matches the one used on other sidebar pages.

Preview:

* http://notriddle.com/rustdoc-html-demo-8/source-sidebar-resize/src/std/lib.rs.html
* http://notriddle.com/rustdoc-html-demo-8/source-sidebar-resize/std/index.html

| | Before | After |
|--|--|--|
| Closed | ![image](https://github.com/rust-lang/rust/assets/1593513/092bed75-79c3-412f-8e7b-557f30dfb1e3) | ![image](https://github.com/rust-lang/rust/assets/1593513/b68e1ee9-9aef-484d-a5b1-2fd29c9d72ea)
| Open | ![image](https://github.com/rust-lang/rust/assets/1593513/95cf9545-25b1-48ec-820b-02e1aec99839) | ![image](https://github.com/rust-lang/rust/assets/1593513/923532f6-59e0-4d7c-9976-21699c30d42e)
| Mobile Closed | ![image](https://github.com/rust-lang/rust/assets/1593513/9bc00cc5-937c-4120-94be-94c7cb6d5297) | ![image](https://github.com/rust-lang/rust/assets/1593513/76a744d8-aac2-46fe-abb9-3b34e2d3ccaa)
| Mobile Open | ![image](https://github.com/rust-lang/rust/assets/1593513/d19a94fe-47b1-462d-a280-44fc215b9b72) | ![image](https://github.com/rust-lang/rust/assets/1593513/2b2e3dec-b610-4b12-8a72-35b86359ba45)
2023-12-31 15:32:15 +00:00
Guillaume Gomez
0fd3be948a Strenghten tests/rustdoc/trait-object-safe.rs to prevent unforeseen regression 2023-12-23 11:28:33 +01:00
Michael Howell
c3e29ea5e9 Stop using the trigram of heaven as a hamburger button
It doesn't look quite right, because the lines are too far apart,
and it's not going to be announced by screenreaders as a menu button,
since that's not what the symbol means.

This adds a real tooltip and uses a better drawing of the icon.
2023-12-18 13:56:55 -07:00
Guillaume Gomez
ec0008a915
Rollup merge of #113091 - GuillaumeGomez:prevent-cfg-merge-reexport, r=rustdoc
Don't merge cfg and doc(cfg) attributes for re-exports

Fixes #112881.

## Explanations

When re-exporting things with different `cfg`s there are two things that can happen:

 * The re-export uses a subset of `cfg`s, this subset is sufficient so that the item will appear exactly with the subset
 * The re-export uses a non-subset of `cfg`s (e.g. like the example I posted just above where the re-export is ungated), if the non-subset `cfg`s are active (e.g. compiling that example on windows) then this will be a compile error as the item doesn't exist to re-export, if the subset `cfg`s are active it behaves like 1.

### Glob re-exports?

**This only applies to non-glob inlined re-exports.** For glob re-exports the item may or may not exist to be re-exported (potentially the `cfg`s on the path up until the glob can be removed, and only `cfg`s on the globbed item itself matter), for non-inlined re-exports see https://github.com/rust-lang/rust/issues/85043.

cc `@Nemo157`
r? `@notriddle`
2023-12-15 11:51:23 +01:00
Matthias Krüger
fddda14ac0
Rollup merge of #118594 - hdost:patch-1, r=fmease
Remove mention of rust to make the error message generic.

The deprecation notice is used when in crates as well. This applies to versions Rust or Crates.

Relates #118148
2023-12-05 16:08:35 +01:00
Guillaume Gomez
42fcba7a67 Add tests for headings anchor and links in headings 2023-12-05 15:59:40 +01:00
Guillaume Gomez
13b2156c68 Update rustdoc headings tests 2023-12-05 15:59:40 +01:00
Harold Dost
1b503042b8 Remove mention of rust to make the error message generic.
The deprecation notice is used when in crates as well. This applies to versions Rust or Crates.

Fixes #118148

Signed-off-by: Harold Dost <h.dost@criteo.com>
2023-12-05 09:18:41 +01:00
Guillaume Gomez
8e53edb2ec Add regression test for #118195 2023-12-04 12:13:24 +01:00