Matthias Krüger
d4f5a89f6e
Rollup merge of #129034 - henryksloan:coroutine-must-use, r=joboet
...
Add `#[must_use]` attribute to `Coroutine` trait
[Coroutines tracking issue](https://github.com/rust-lang/rust/issues/43122 )
Like closures (`FnOnce`, `AsyncFn`, etc.), coroutines are lazy and do nothing unless called (resumed). Closure traits like `FnOnce` have `#[must_use = "closures are lazy and do nothing unless called"]` to catch likely bugs for users of APIs that produce them. This PR adds such a `#[must_use]` attribute to `trait Coroutine`.
2024-08-13 21:11:13 +02:00
Matthias Krüger
f68a28d95c
Rollup merge of #127857 - tbu-:pr_deprecated_safe_todo, r=petrochenkov
...
Allow to customize `// TODO:` comment for deprecated safe autofix
Relevant for the deprecation of `CommandExt::before_exit` in #125970 .
Tracking:
- #124866
2024-08-13 21:11:12 +02:00
Matthias Krüger
bc9c31df69
Rollup merge of #122884 - mzabaluev:pow-remove-exit-branch, r=Amanieu
...
Optimize integer `pow` by removing the exit branch
The branch at the end of the `pow` implementations is redundant with multiplication code already present in the loop. By rotating the exit check, this branch can be largely removed, improving code size and reducing instruction cache misses.
Testing on my machine (`x86_64`, 11th Gen Intel Core i5-1135G7 @ 2.40GHz), the `num::int_pow` benchmarks improve by some 40% for the unchecked operations and show some slight improvement for the checked operations as well.
2024-08-13 21:11:12 +02:00
beetrees
fe4fa2f1da
Use the enum2$
Natvis visualiser for repr128 C-style enums
2024-08-13 19:53:21 +01:00
Michael Woerister
5082e25263
Add mw back to review rotation
2024-08-13 20:16:14 +02:00
Guillaume Gomez
05fb8ff4f5
Fix intra-doc link
2024-08-13 20:14:58 +02:00
Guillaume Gomez
1d75f78ea2
Ignore cross compile check for tests/run-make/doctests-keep-binaries-2024
test
2024-08-13 20:14:57 +02:00
Guillaume Gomez
488614d2dd
Update tests/run-make/doctests-keep-binaries-2024/rmake.rs
test to new run-make API
2024-08-13 20:14:57 +02:00
Guillaume Gomez
f1c1c49216
Run fmt
2024-08-13 20:14:57 +02:00
Guillaume Gomez
a708d0bc77
Fix commands syntax in rustdoc-ui tests
2024-08-13 20:14:57 +02:00
Guillaume Gomez
903d2db4d2
Only keep "useful" code in tests/rustdoc-ui/2024-doctests-checks.rs
2024-08-13 20:14:57 +02:00
Guillaume Gomez
7dcb841de0
Add doctest to ensure that doctests with crate-level attributes are not part of merged doctest
2024-08-13 20:14:57 +02:00
Guillaume Gomez
cbf6fe05e7
Add more merged doctests tests
2024-08-13 20:14:57 +02:00
Guillaume Gomez
c9f730e223
Improve documentation for internal doctest API
2024-08-13 20:14:57 +02:00
Guillaume Gomez
baf8ce83b8
Move is_multiple_tests
argument into RunnableDocTest
2024-08-13 20:14:57 +02:00
Guillaume Gomez
ab3d90e037
Unify naming of DocTest
2024-08-13 20:14:57 +02:00
Guillaume Gomez
4b1db071d1
Don't special-case if there is only one merged doctest
2024-08-13 20:14:56 +02:00
Guillaume Gomez
72aeffa78c
Remove need for unsafe
code in merged doctests
2024-08-13 20:14:56 +02:00
Guillaume Gomez
a3bc2c7478
Improve code readability
2024-08-13 20:14:56 +02:00
Guillaume Gomez
0fbc32ce42
If there are crate attributes, we prevent doctest to be merged with others
2024-08-13 20:14:56 +02:00
Guillaume Gomez
ffc18c5cfb
Rename DocTest
into DocTestBuilder
2024-08-13 20:14:56 +02:00
Guillaume Gomez
1e1743a379
Reduce merged doctest source code size
2024-08-13 20:14:56 +02:00
Guillaume Gomez
d512438435
Run mergeable doctest as part of standalone doctests if there is only one
2024-08-13 20:14:56 +02:00
Guillaume Gomez
bfabf1db44
Add documentation on DocTest
and RunnableDoctest
structs
2024-08-13 20:14:56 +02:00
Guillaume Gomez
6d552ba446
Improve code by removing unneeded function arguments
2024-08-13 20:14:56 +02:00
Guillaume Gomez
84d9b67dab
Add 2024 edition doctests to cover corner cases
2024-08-13 20:14:55 +02:00
Guillaume Gomez
14f80f9e69
Correctly handle macros using $crate
in merged doctests
2024-08-13 20:14:55 +02:00
Guillaume Gomez
112e44740e
Disable merged doctests by default
2024-08-13 20:14:55 +02:00
Guillaume Gomez
0bd2c99ce8
Only show rustdoc doctest compilation output if nocapture
is used
2024-08-13 20:14:55 +02:00
Guillaume Gomez
c5ae545fbd
If no argument is provided to merged doctests binary, they will be run in the same process (needed for miri)
2024-08-13 20:14:55 +02:00
Guillaume Gomez
ec4d910190
Correctly handle internal_features
attribute
2024-08-13 20:14:55 +02:00
Guillaume Gomez
475824d811
Mark location doctest as standalone since file information will not work in merged doctest file
2024-08-13 20:14:55 +02:00
Guillaume Gomez
995858eed3
Don't change indent in merged doctests
2024-08-13 20:14:55 +02:00
Guillaume Gomez
0f0681e941
Make merged doctests run in their own process
2024-08-13 20:14:54 +02:00
Guillaume Gomez
dcc77b4cbc
Fix weird memory allocation failure in merged doctests by storing doctest list into a const
2024-08-13 20:14:54 +02:00
Guillaume Gomez
b6831bbdda
Don't merge doctests with #[global_allocator]
2024-08-13 20:14:54 +02:00
Guillaume Gomez
6eabffbaec
Greatly improve handling of doctests attributes, making it possible to merge doctests more efficiently
2024-08-13 20:14:54 +02:00
Guillaume Gomez
03118fa80a
Simplify has_main_fn
to be a boolean instead of a Option<Span>
2024-08-13 20:14:54 +02:00
Guillaume Gomez
010731d5b6
Add new run-make
tests for doctests
2024-08-13 20:14:54 +02:00
Guillaume Gomez
2fd8d1c1ce
Add/update rustdoc-ui
tests to check new merged doctests
2024-08-13 20:14:54 +02:00
Guillaume Gomez
7ec3cabe17
Correctly handle doctests with invalid AST
2024-08-13 20:14:54 +02:00
Guillaume Gomez
59a9e0986d
Correctly handle the case where there is no doctests to run
2024-08-13 20:14:54 +02:00
Guillaume Gomez
a0ae8ac861
If there is any AST error with a doctest, we make it a standalone test
...
To do so, AST error detection was improved in order to not filter out
too many doctests.
2024-08-13 20:14:54 +02:00
Guillaume Gomez
b7079c5c83
Prevent merged doctests to break stdin if the generated file is too big
2024-08-13 20:14:53 +02:00
Guillaume Gomez
23badff4fe
Add documentation for the doctest standalone
attribute
2024-08-13 20:14:53 +02:00
Guillaume Gomez
3147520d34
Add new doc codeblock standalone
attribute
2024-08-13 20:14:53 +02:00
Guillaume Gomez
58cd70e062
Only merge doctests starting 2024 edition
2024-08-13 20:14:53 +02:00
Guillaume Gomez
6ae3524835
Split doctests into two categories: mergeable ones and standalone ones
2024-08-13 20:14:53 +02:00
Guillaume Gomez
96051f20e2
Split standalone and mergeable doctests
2024-08-13 20:14:53 +02:00
Guillaume Gomez
39f029a852
Split doctests between standalone and mergeable ones
2024-08-13 20:14:53 +02:00