about summary refs log tree commit diff
path: root/src/test/rustdoc/hide-complex-unevaluated-const-arguments.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-01-11 11:17:22 +0000
committerbors <bors@rust-lang.org>2023-01-11 11:17:22 +0000
commitb22c152958eade17a71d899b29a2d39bcc77aa48 (patch)
treeec6da75dc598a0a4086c0cc032c86d7241be1bc1 /src/test/rustdoc/hide-complex-unevaluated-const-arguments.rs
parent8ecaad85f61375b18e1667b51a3ef350121d2ca0 (diff)
parent40ba0e84d53f605ccf01836e9c2d27892728ae81 (diff)
downloadrust-b22c152958eade17a71d899b29a2d39bcc77aa48.tar.gz
rust-b22c152958eade17a71d899b29a2d39bcc77aa48.zip
Auto merge of #106458 - albertlarsan68:move-tests, r=jyn514
Move src/test to the root

See MCP at rust-lang/compiler-team#573

There may be more changes needed.

The first commit is just the move of the files:
You can check that the first commit did not do anything else than renames by running
```
git diff --diff-filter=r -M100% <rust-lang remote>/master <first commit hash>
```
The output should be empty, because the filter excludes renames, and the match threshold for qualifying a rename is 100%.

The second one is mostly a "find and replace" of `src/test` to `tests` and whatever is needed to make CI pass.

What is left to do:
---

- [x] Move directory
- [ ] Change references to `src/test`
    - [x] Change references in-tree
    - [ ] Change references in submodules / out-of-tree docs
- [x] Make CI pass:
    - [x] Fix tidy
    - [x] Fix tests
    - [x] Bless tests if needed (shouldn't normally)
- [ ] Merge it !
Diffstat (limited to 'src/test/rustdoc/hide-complex-unevaluated-const-arguments.rs')
-rw-r--r--src/test/rustdoc/hide-complex-unevaluated-const-arguments.rs82
1 files changed, 0 insertions, 82 deletions
diff --git a/src/test/rustdoc/hide-complex-unevaluated-const-arguments.rs b/src/test/rustdoc/hide-complex-unevaluated-const-arguments.rs
deleted file mode 100644
index 644a6e1cf33..00000000000
--- a/src/test/rustdoc/hide-complex-unevaluated-const-arguments.rs
+++ /dev/null
@@ -1,82 +0,0 @@
-// Test that certain unevaluated constant expression arguments that are
-// deemed too verbose or complex and that may leak private or
-// `doc(hidden)` struct fields are not displayed in the documentation.
-//
-// Read the documentation of `rustdoc::clean::utils::print_const_expr`
-// for further details.
-#![feature(const_trait_impl, generic_const_exprs)]
-#![allow(incomplete_features)]
-
-// @has hide_complex_unevaluated_const_arguments/trait.Stage.html
-pub trait Stage {
-    // A helper constant that prevents const expressions containing it
-    // from getting fully evaluated since it doesn't have a body and
-    // thus is non-reducible. This allows us to specifically test the
-    // pretty-printing of *unevaluated* consts.
-    const ABSTRACT: usize;
-
-    // Currently considered "overly complex" by the `generic_const_exprs`
-    // feature. If / once this expression kind gets supported, this
-    // unevaluated const expression could leak the private struct field.
-    //
-    // FIXME: Once the line below compiles, make this a test that
-    //        ensures that the private field is not printed.
-    //
-    //const ARRAY0: [u8; Struct { private: () } + Self::ABSTRACT];
-
-    // This assoc. const could leak the private assoc. function `Struct::new`.
-    // Ensure that this does not happen.
-    //
-    // @has - '//*[@id="associatedconstant.ARRAY1"]' \
-    //        'const ARRAY1: [u8; { _ }]'
-    const ARRAY1: [u8; Struct::new(/* ... */) + Self::ABSTRACT * 1_000];
-
-    // @has - '//*[@id="associatedconstant.VERBOSE"]' \
-    //        'const VERBOSE: [u16; { _ }]'
-    const VERBOSE: [u16; compute("thing", 9 + 9) * Self::ABSTRACT];
-
-    // Check that we do not leak the private struct field contained within
-    // the path. The output could definitely be improved upon
-    // (e.g. printing sth. akin to `<Self as Helper<{ _ }>>::OUT`) but
-    // right now “safe is safe”.
-    //
-    // @has - '//*[@id="associatedconstant.PATH"]' \
-    //        'const PATH: usize = _'
-    const PATH: usize = <Self as Helper<{ Struct { private: () } }>>::OUT;
-}
-
-const fn compute(input: &str, extra: usize) -> usize {
-    input.len() + extra
-}
-
-pub trait Helper<const S: Struct> {
-    const OUT: usize;
-}
-
-impl<const S: Struct, St: Stage + ?Sized> Helper<S> for St {
-    const OUT: usize = St::ABSTRACT;
-}
-
-// Currently in rustdoc, const arguments are not evaluated in this position
-// and therefore they fall under the realm of `print_const_expr`.
-// If rustdoc gets patched to evaluate const arguments, it is fine to replace
-// this test as long as one can ensure that private fields are not leaked!
-//
-// @has hide_complex_unevaluated_const_arguments/trait.Sub.html \
-//      '//*[@class="rust trait"]' \
-//      'pub trait Sub: Sup<{ _ }, { _ }> { }'
-pub trait Sub: Sup<{ 90 * 20 * 4 }, { Struct { private: () } }> {}
-
-pub trait Sup<const N: usize, const S: Struct> {}
-
-pub struct Struct { private: () }
-
-impl Struct {
-    const fn new() -> Self { Self { private: () } }
-}
-
-impl const std::ops::Add<usize> for Struct {
-    type Output = usize;
-
-    fn add(self, _: usize) -> usize { 0 }
-}