diff options
| author | bors <bors@rust-lang.org> | 2021-10-24 14:12:10 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-10-24 14:12:10 +0000 |
| commit | 00d5e42e776da900049fe19087bc9b0057ec70cd (patch) | |
| tree | f168b0920764af97f372d7faa608611cd3f09f79 /src/test | |
| parent | ed08a67566d7d1d9dd2ad928ff21c23e841a4345 (diff) | |
| parent | eee29fd34c9fdc9afddfc3108d8e36199854f0b3 (diff) | |
| download | rust-00d5e42e776da900049fe19087bc9b0057ec70cd.tar.gz rust-00d5e42e776da900049fe19087bc9b0057ec70cd.zip | |
Auto merge of #90235 - matthiaskrgr:rollup-7pqtevk, r=matthiaskrgr
Rollup of 6 pull requests
Successful merges:
- #89558 (Add rustc lint, warning when iterating over hashmaps)
- #90100 (Skip documentation for tier 2 targets on dist-x86_64-apple-darwin)
- #90155 (Fix alignment of method headings for scannability)
- #90162 (Mark `{array, slice}::{from_ref, from_mut}` as const fn)
- #90221 (Fix ICE when forgetting to `Box` a parameter to a `Self::func` call)
- #90234 (Temporarily turn overflow checks off for rustc-rayon-core)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src/test')
7 files changed, 136 insertions, 0 deletions
diff --git a/src/test/rustdoc-gui/anchor-navigable.goml b/src/test/rustdoc-gui/anchor-navigable.goml new file mode 100644 index 00000000000..424c312233b --- /dev/null +++ b/src/test/rustdoc-gui/anchor-navigable.goml @@ -0,0 +1,11 @@ +// The `impl Foo` heading underneath `Implementations` has a ยง +// anchor to its left (used for linking to that heading). The anchor only shows +// up when hovering the `impl Foo`. This test ensures there's no gap between the +// anchor and the `impl Foo`. If there were a gap, this would cause an annoying +// problem: you hover `impl Foo` to see the anchor, then when you move your +// mouse to the left, the anchor disappears before you reach it. +goto: file://|DOC_PATH|/test_docs/struct.Foo.html +// We check that ".item-info" is bigger than its content. +move-cursor-to: ".impl" +assert-property: (".impl > a.anchor", {"offsetWidth": "9"}) +assert-css: (".impl > a.anchor", {"left": "-8px"}) diff --git a/src/test/ui-fulldeps/internal-lints/query_stability.rs b/src/test/ui-fulldeps/internal-lints/query_stability.rs new file mode 100644 index 00000000000..560675b4486 --- /dev/null +++ b/src/test/ui-fulldeps/internal-lints/query_stability.rs @@ -0,0 +1,24 @@ +// compile-flags: -Z unstable-options + +#![feature(rustc_private)] +#![deny(rustc::potential_query_instability)] + +extern crate rustc_data_structures; + +use rustc_data_structures::fx::{FxHashMap, FxHashSet}; + +fn main() { + let mut x = FxHashMap::<u32, i32>::default(); + + for _ in x.drain() {} + //~^ ERROR using `drain` can result in unstable + + for _ in x.iter() {} + //~^ ERROR using `iter` + + for _ in Some(&mut x).unwrap().iter_mut() {} + //~^ ERROR using `iter_mut` + + for _ in x {} + //~^ ERROR using `into_iter` +} diff --git a/src/test/ui-fulldeps/internal-lints/query_stability.stderr b/src/test/ui-fulldeps/internal-lints/query_stability.stderr new file mode 100644 index 00000000000..7e8b448f41a --- /dev/null +++ b/src/test/ui-fulldeps/internal-lints/query_stability.stderr @@ -0,0 +1,39 @@ +error: using `drain` can result in unstable query results + --> $DIR/query_stability.rs:13:16 + | +LL | for _ in x.drain() {} + | ^^^^^ + | +note: the lint level is defined here + --> $DIR/query_stability.rs:4:9 + | +LL | #![deny(rustc::potential_query_instability)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale + +error: using `iter` can result in unstable query results + --> $DIR/query_stability.rs:16:16 + | +LL | for _ in x.iter() {} + | ^^^^ + | + = note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale + +error: using `iter_mut` can result in unstable query results + --> $DIR/query_stability.rs:19:36 + | +LL | for _ in Some(&mut x).unwrap().iter_mut() {} + | ^^^^^^^^ + | + = note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale + +error: using `into_iter` can result in unstable query results + --> $DIR/query_stability.rs:22:14 + | +LL | for _ in x {} + | ^ + | + = note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale + +error: aborting due to 4 previous errors + diff --git a/src/test/ui-fulldeps/internal-lints/query_stability_incorrect.rs b/src/test/ui-fulldeps/internal-lints/query_stability_incorrect.rs new file mode 100644 index 00000000000..f478b73329e --- /dev/null +++ b/src/test/ui-fulldeps/internal-lints/query_stability_incorrect.rs @@ -0,0 +1,15 @@ +// compile-flags: -Z unstable-options + +#![feature(rustc_attrs)] + +#[rustc_lint_query_instability] +//~^ ERROR attribute should be applied to a function +struct Foo; + +impl Foo { + #[rustc_lint_query_instability(a)] + //~^ ERROR malformed `rustc_lint_query_instability` + fn bar() {} +} + +fn main() {} diff --git a/src/test/ui-fulldeps/internal-lints/query_stability_incorrect.stderr b/src/test/ui-fulldeps/internal-lints/query_stability_incorrect.stderr new file mode 100644 index 00000000000..b5156f2ac59 --- /dev/null +++ b/src/test/ui-fulldeps/internal-lints/query_stability_incorrect.stderr @@ -0,0 +1,17 @@ +error: malformed `rustc_lint_query_instability` attribute input + --> $DIR/query_stability_incorrect.rs:10:5 + | +LL | #[rustc_lint_query_instability(a)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[rustc_lint_query_instability]` + +error: attribute should be applied to a function + --> $DIR/query_stability_incorrect.rs:5:1 + | +LL | #[rustc_lint_query_instability] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | struct Foo; + | ----------- not a function + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/suggestions/issue-90213-expected-boxfuture-self-ice.rs b/src/test/ui/suggestions/issue-90213-expected-boxfuture-self-ice.rs new file mode 100644 index 00000000000..1e36b2fabf2 --- /dev/null +++ b/src/test/ui/suggestions/issue-90213-expected-boxfuture-self-ice.rs @@ -0,0 +1,13 @@ +// Checks that we do not ICE when comparing `Self` to `Pin` +// edition:2021 + +struct S; + +impl S { + fn foo(_: Box<Option<S>>) {} + fn bar() { + Self::foo(None) //~ ERROR mismatched types + } +} + +fn main() {} diff --git a/src/test/ui/suggestions/issue-90213-expected-boxfuture-self-ice.stderr b/src/test/ui/suggestions/issue-90213-expected-boxfuture-self-ice.stderr new file mode 100644 index 00000000000..c15b772b79c --- /dev/null +++ b/src/test/ui/suggestions/issue-90213-expected-boxfuture-self-ice.stderr @@ -0,0 +1,17 @@ +error[E0308]: mismatched types + --> $DIR/issue-90213-expected-boxfuture-self-ice.rs:9:19 + | +LL | Self::foo(None) + | ^^^^ expected struct `Box`, found enum `Option` + | + = note: expected struct `Box<Option<S>>` + found enum `Option<_>` + = note: for more on the distinction between the stack and the heap, read https://doc.rust-lang.org/book/ch15-01-box.html, https://doc.rust-lang.org/rust-by-example/std/box.html, and https://doc.rust-lang.org/std/boxed/index.html +help: store this in the heap by calling `Box::new` + | +LL | Self::foo(Box::new(None)) + | +++++++++ + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. |
