diff options
| author | bors <bors@rust-lang.org> | 2021-07-23 12:33:58 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-07-23 12:33:58 +0000 |
| commit | 0443424954f32d94f847322e85c77df50d44f80f (patch) | |
| tree | 5bdebedf6bc132939c7687c1c719124b40c594e3 /src/test | |
| parent | b2b7c859c1aae39d26884e760201f5e6c7feeff9 (diff) | |
| parent | 7c0c329635cde6602dc6d49a0f44459ff0c8b544 (diff) | |
| download | rust-0443424954f32d94f847322e85c77df50d44f80f.tar.gz rust-0443424954f32d94f847322e85c77df50d44f80f.zip | |
Auto merge of #87400 - JohnTitor:rollup-zbwyuxi, r=JohnTitor
Rollup of 8 pull requests Successful merges: - #87034 (DOC: fix hypothetical Rust code in `step_by()` docstring) - #87298 (memorialize Anna Harren in the bastion of the turbofish) - #87332 (Don't hide fields of enum struct variants) - #87362 (Make `x.py d` an alias for `x.py doc`) - #87372 (Move calls to test_main into one function) - #87373 (Extend HIR WF checking to fields) - #87376 (Change rustdoc logo to use the full container size) - #87383 (Add regression tests for the impl_trait_in_bindings ICEs) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src/test')
26 files changed, 234 insertions, 12 deletions
diff --git a/src/test/rustdoc/toggle-item-contents.rs b/src/test/rustdoc/toggle-item-contents.rs index 167858b6065..8d2046591d0 100644 --- a/src/test/rustdoc/toggle-item-contents.rs +++ b/src/test/rustdoc/toggle-item-contents.rs @@ -62,8 +62,7 @@ pub struct PrivStruct { } // @has 'toggle_item_contents/enum.Enum.html' -// @count - '//details[@class="rustdoc-toggle type-contents-toggle"]' 1 -// @has - '//details[@class="rustdoc-toggle type-contents-toggle"]' 'Show 2 fields' +// @!has - '//details[@class="rustdoc-toggle type-contents-toggle"]' pub enum Enum { A, B, C, D { @@ -73,8 +72,7 @@ pub enum Enum { } // @has 'toggle_item_contents/enum.EnumStructVariant.html' -// @count - '//details[@class="rustdoc-toggle type-contents-toggle"]' 1 -// @has - '//details[@class="rustdoc-toggle type-contents-toggle"]' 'Show 1 field' +// @!has - '//details[@class="rustdoc-toggle type-contents-toggle"]' pub enum EnumStructVariant { A, B, C, D { diff --git a/src/test/ui/bastion-of-the-turbofish.rs b/src/test/ui/bastion-of-the-turbofish.rs index d9ca7ddc7ca..233ddbbe117 100644 --- a/src/test/ui/bastion-of-the-turbofish.rs +++ b/src/test/ui/bastion-of-the-turbofish.rs @@ -25,9 +25,12 @@ // // My heart aches in sorrow, for I know I am defeated. Let this be a warning // to all those who come after. Here stands the bastion of the Turbofish. +// +// RIP Anna Harren, Guardian Angel of the Hallowed Turbofish. <3 // See https://github.com/rust-lang/rust/pull/53562 // and https://github.com/rust-lang/rfcs/pull/2527 +// and https://twitter.com/garblefart/status/1393236602856611843 // for context. fn main() { diff --git a/src/test/ui/impl-trait/issues/issue-54600.rs b/src/test/ui/impl-trait/issues/issue-54600.rs new file mode 100644 index 00000000000..7a647993023 --- /dev/null +++ b/src/test/ui/impl-trait/issues/issue-54600.rs @@ -0,0 +1,7 @@ +use std::fmt::Debug; + +fn main() { + let x: Option<impl Debug> = Some(44_u32); + //~^ `impl Trait` not allowed outside of function and method return types + println!("{:?}", x); +} diff --git a/src/test/ui/impl-trait/issues/issue-54600.stderr b/src/test/ui/impl-trait/issues/issue-54600.stderr new file mode 100644 index 00000000000..4d0c32c6bb7 --- /dev/null +++ b/src/test/ui/impl-trait/issues/issue-54600.stderr @@ -0,0 +1,9 @@ +error[E0562]: `impl Trait` not allowed outside of function and method return types + --> $DIR/issue-54600.rs:4:19 + | +LL | let x: Option<impl Debug> = Some(44_u32); + | ^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0562`. diff --git a/src/test/ui/impl-trait/issues/issue-54840.rs b/src/test/ui/impl-trait/issues/issue-54840.rs new file mode 100644 index 00000000000..030d5715d57 --- /dev/null +++ b/src/test/ui/impl-trait/issues/issue-54840.rs @@ -0,0 +1,7 @@ +use std::ops::Add; + +fn main() { + let i: i32 = 0; + let j: &impl Add = &i; + //~^ `impl Trait` not allowed outside of function and method return types +} diff --git a/src/test/ui/impl-trait/issues/issue-54840.stderr b/src/test/ui/impl-trait/issues/issue-54840.stderr new file mode 100644 index 00000000000..b8046b7482f --- /dev/null +++ b/src/test/ui/impl-trait/issues/issue-54840.stderr @@ -0,0 +1,9 @@ +error[E0562]: `impl Trait` not allowed outside of function and method return types + --> $DIR/issue-54840.rs:5:13 + | +LL | let j: &impl Add = &i; + | ^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0562`. diff --git a/src/test/ui/impl-trait/issues/issue-58504.rs b/src/test/ui/impl-trait/issues/issue-58504.rs new file mode 100644 index 00000000000..aac33b3b3e5 --- /dev/null +++ b/src/test/ui/impl-trait/issues/issue-58504.rs @@ -0,0 +1,12 @@ +#![feature(generators, generator_trait, never_type)] + +use std::ops::Generator; + +fn mk_gen() -> impl Generator<Return=!, Yield=()> { + || { loop { yield; } } +} + +fn main() { + let gens: [impl Generator<Return=!, Yield=()>;2] = [ mk_gen(), mk_gen() ]; + //~^ `impl Trait` not allowed outside of function and method return types +} diff --git a/src/test/ui/impl-trait/issues/issue-58504.stderr b/src/test/ui/impl-trait/issues/issue-58504.stderr new file mode 100644 index 00000000000..ff1010f0661 --- /dev/null +++ b/src/test/ui/impl-trait/issues/issue-58504.stderr @@ -0,0 +1,9 @@ +error[E0562]: `impl Trait` not allowed outside of function and method return types + --> $DIR/issue-58504.rs:10:16 + | +LL | let gens: [impl Generator<Return=!, Yield=()>;2] = [ mk_gen(), mk_gen() ]; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0562`. diff --git a/src/test/ui/impl-trait/issues/issue-58956.rs b/src/test/ui/impl-trait/issues/issue-58956.rs new file mode 100644 index 00000000000..5fe18b6e9b5 --- /dev/null +++ b/src/test/ui/impl-trait/issues/issue-58956.rs @@ -0,0 +1,14 @@ +trait Lam {} + +pub struct B; +impl Lam for B {} +pub struct Wrap<T>(T); + +const _A: impl Lam = { + //~^ `impl Trait` not allowed outside of function and method return types + let x: Wrap<impl Lam> = Wrap(B); + //~^ `impl Trait` not allowed outside of function and method return types + x.0 +}; + +fn main() {} diff --git a/src/test/ui/impl-trait/issues/issue-58956.stderr b/src/test/ui/impl-trait/issues/issue-58956.stderr new file mode 100644 index 00000000000..00ebf170ab2 --- /dev/null +++ b/src/test/ui/impl-trait/issues/issue-58956.stderr @@ -0,0 +1,15 @@ +error[E0562]: `impl Trait` not allowed outside of function and method return types + --> $DIR/issue-58956.rs:7:11 + | +LL | const _A: impl Lam = { + | ^^^^^^^^ + +error[E0562]: `impl Trait` not allowed outside of function and method return types + --> $DIR/issue-58956.rs:9:17 + | +LL | let x: Wrap<impl Lam> = Wrap(B); + | ^^^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0562`. diff --git a/src/test/ui/impl-trait/issues/issue-70971.rs b/src/test/ui/impl-trait/issues/issue-70971.rs new file mode 100644 index 00000000000..d4dc2fd877b --- /dev/null +++ b/src/test/ui/impl-trait/issues/issue-70971.rs @@ -0,0 +1,4 @@ +fn main() { + let x : (impl Copy,) = (true,); + //~^ `impl Trait` not allowed outside of function and method return types +} diff --git a/src/test/ui/impl-trait/issues/issue-70971.stderr b/src/test/ui/impl-trait/issues/issue-70971.stderr new file mode 100644 index 00000000000..31993da3e32 --- /dev/null +++ b/src/test/ui/impl-trait/issues/issue-70971.stderr @@ -0,0 +1,9 @@ +error[E0562]: `impl Trait` not allowed outside of function and method return types + --> $DIR/issue-70971.rs:2:14 + | +LL | let x : (impl Copy,) = (true,); + | ^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0562`. diff --git a/src/test/ui/impl-trait/issues/issue-79099.rs b/src/test/ui/impl-trait/issues/issue-79099.rs new file mode 100644 index 00000000000..f72533d42e1 --- /dev/null +++ b/src/test/ui/impl-trait/issues/issue-79099.rs @@ -0,0 +1,10 @@ +struct Bug { + V1: [(); { + let f: impl core::future::Future<Output = u8> = async { 1 }; + //~^ `impl Trait` not allowed outside of function and method return types + //~| expected identifier + 1 + }], +} + +fn main() {} diff --git a/src/test/ui/impl-trait/issues/issue-79099.stderr b/src/test/ui/impl-trait/issues/issue-79099.stderr new file mode 100644 index 00000000000..121536d3f68 --- /dev/null +++ b/src/test/ui/impl-trait/issues/issue-79099.stderr @@ -0,0 +1,20 @@ +error: expected identifier, found `1` + --> $DIR/issue-79099.rs:3:65 + | +LL | let f: impl core::future::Future<Output = u8> = async { 1 }; + | ----- ^ expected identifier + | | + | `async` blocks are only allowed in Rust 2018 or later + | + = help: set `edition = "2018"` in `Cargo.toml` + = note: for more on editions, read https://doc.rust-lang.org/edition-guide + +error[E0562]: `impl Trait` not allowed outside of function and method return types + --> $DIR/issue-79099.rs:3:16 + | +LL | let f: impl core::future::Future<Output = u8> = async { 1 }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0562`. diff --git a/src/test/ui/impl-trait/issues/issue-84919.rs b/src/test/ui/impl-trait/issues/issue-84919.rs new file mode 100644 index 00000000000..479bad97cdf --- /dev/null +++ b/src/test/ui/impl-trait/issues/issue-84919.rs @@ -0,0 +1,9 @@ +trait Trait {} +impl Trait for () {} + +fn foo<'a: 'a>() { + let _x: impl Trait = (); + //~^ `impl Trait` not allowed outside of function and method return types +} + +fn main() {} diff --git a/src/test/ui/impl-trait/issues/issue-84919.stderr b/src/test/ui/impl-trait/issues/issue-84919.stderr new file mode 100644 index 00000000000..bb1bcfefe64 --- /dev/null +++ b/src/test/ui/impl-trait/issues/issue-84919.stderr @@ -0,0 +1,9 @@ +error[E0562]: `impl Trait` not allowed outside of function and method return types + --> $DIR/issue-84919.rs:5:13 + | +LL | let _x: impl Trait = (); + | ^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0562`. diff --git a/src/test/ui/impl-trait/issues/issue-86201.rs b/src/test/ui/impl-trait/issues/issue-86201.rs new file mode 100644 index 00000000000..8dc76f4f752 --- /dev/null +++ b/src/test/ui/impl-trait/issues/issue-86201.rs @@ -0,0 +1,13 @@ +#![feature(unboxed_closures)] +#![feature(min_type_alias_impl_trait)] + +type FunType = impl Fn<()>; +//~^ could not find defining uses +static STATIC_FN: FunType = some_fn; +//~^ mismatched types + +fn some_fn() {} + +fn main() { + let _: <FunType as FnOnce<()>>::Output = STATIC_FN(); +} diff --git a/src/test/ui/impl-trait/issues/issue-86201.stderr b/src/test/ui/impl-trait/issues/issue-86201.stderr new file mode 100644 index 00000000000..b1460096ded --- /dev/null +++ b/src/test/ui/impl-trait/issues/issue-86201.stderr @@ -0,0 +1,21 @@ +error[E0308]: mismatched types + --> $DIR/issue-86201.rs:6:29 + | +LL | type FunType = impl Fn<()>; + | ----------- the expected opaque type +LL | +LL | static STATIC_FN: FunType = some_fn; + | ^^^^^^^ expected opaque type, found fn item + | + = note: expected opaque type `impl Fn<()>` + found fn item `fn() {some_fn}` + +error: could not find defining uses + --> $DIR/issue-86201.rs:4:16 + | +LL | type FunType = impl Fn<()>; + | ^^^^^^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/impl-trait/issues/issue-86642.rs b/src/test/ui/impl-trait/issues/issue-86642.rs new file mode 100644 index 00000000000..8953ff81581 --- /dev/null +++ b/src/test/ui/impl-trait/issues/issue-86642.rs @@ -0,0 +1,8 @@ +static x: impl Fn(&str) -> Result<&str, ()> = move |source| { + //~^ `impl Trait` not allowed outside of function and method return types + let res = (move |source| Ok(source))(source); + let res = res.or((move |source| Ok(source))(source)); + res +}; + +fn main() {} diff --git a/src/test/ui/impl-trait/issues/issue-86642.stderr b/src/test/ui/impl-trait/issues/issue-86642.stderr new file mode 100644 index 00000000000..2fc0a6fe1f5 --- /dev/null +++ b/src/test/ui/impl-trait/issues/issue-86642.stderr @@ -0,0 +1,9 @@ +error[E0562]: `impl Trait` not allowed outside of function and method return types + --> $DIR/issue-86642.rs:1:11 + | +LL | static x: impl Fn(&str) -> Result<&str, ()> = move |source| { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0562`. diff --git a/src/test/ui/impl-trait/issues/issue-87295.rs b/src/test/ui/impl-trait/issues/issue-87295.rs new file mode 100644 index 00000000000..2f2bfe147bd --- /dev/null +++ b/src/test/ui/impl-trait/issues/issue-87295.rs @@ -0,0 +1,18 @@ +trait Trait { + type Output; +} +impl Trait for () { + type Output = i32; +} + +struct Struct<F>(F); +impl<F> Struct<F> { + pub fn new(_: F) -> Self { + todo!() + } +} + +fn main() { + let _do_not_waste: Struct<impl Trait<Output = i32>> = Struct::new(()); + //~^ `impl Trait` not allowed outside of function and method return types +} diff --git a/src/test/ui/impl-trait/issues/issue-87295.stderr b/src/test/ui/impl-trait/issues/issue-87295.stderr new file mode 100644 index 00000000000..f5c7603ce49 --- /dev/null +++ b/src/test/ui/impl-trait/issues/issue-87295.stderr @@ -0,0 +1,9 @@ +error[E0562]: `impl Trait` not allowed outside of function and method return types + --> $DIR/issue-87295.rs:16:31 + | +LL | let _do_not_waste: Struct<impl Trait<Output = i32>> = Struct::new(()); + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0562`. diff --git a/src/test/ui/issues/issue-19380.stderr b/src/test/ui/issues/issue-19380.stderr index c3a5d3dfeee..4400b6179c6 100644 --- a/src/test/ui/issues/issue-19380.stderr +++ b/src/test/ui/issues/issue-19380.stderr @@ -1,8 +1,8 @@ error[E0038]: the trait `Qiz` cannot be made into an object - --> $DIR/issue-19380.rs:11:9 + --> $DIR/issue-19380.rs:11:29 | LL | foos: &'static [&'static (dyn Qiz + 'static)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Qiz` cannot be made into an object + | ^^^^^^^^^^^^^^^^^ `Qiz` cannot be made into an object | note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> --> $DIR/issue-19380.rs:2:6 diff --git a/src/test/ui/wf/wf-in-fn-type-arg.stderr b/src/test/ui/wf/wf-in-fn-type-arg.stderr index 33300b39642..20aa9770710 100644 --- a/src/test/ui/wf/wf-in-fn-type-arg.stderr +++ b/src/test/ui/wf/wf-in-fn-type-arg.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `T: Copy` is not satisfied - --> $DIR/wf-in-fn-type-arg.rs:9:8 + --> $DIR/wf-in-fn-type-arg.rs:9:11 | LL | struct MustBeCopy<T:Copy> { | ---- required by this bound in `MustBeCopy` ... LL | x: fn(MustBeCopy<T>) - | ^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T` + | ^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T` | help: consider restricting type parameter `T` | diff --git a/src/test/ui/wf/wf-in-fn-type-ret.stderr b/src/test/ui/wf/wf-in-fn-type-ret.stderr index 1ffc47e6d82..48af696c3a7 100644 --- a/src/test/ui/wf/wf-in-fn-type-ret.stderr +++ b/src/test/ui/wf/wf-in-fn-type-ret.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `T: Copy` is not satisfied - --> $DIR/wf-in-fn-type-ret.rs:9:8 + --> $DIR/wf-in-fn-type-ret.rs:9:16 | LL | struct MustBeCopy<T:Copy> { | ---- required by this bound in `MustBeCopy` ... LL | x: fn() -> MustBeCopy<T> - | ^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T` + | ^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T` | help: consider restricting type parameter `T` | diff --git a/src/test/ui/wf/wf-in-obj-type-trait.stderr b/src/test/ui/wf/wf-in-obj-type-trait.stderr index 8606eabf59c..b3b919a569e 100644 --- a/src/test/ui/wf/wf-in-obj-type-trait.stderr +++ b/src/test/ui/wf/wf-in-obj-type-trait.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `T: Copy` is not satisfied - --> $DIR/wf-in-obj-type-trait.rs:11:8 + --> $DIR/wf-in-obj-type-trait.rs:11:19 | LL | struct MustBeCopy<T:Copy> { | ---- required by this bound in `MustBeCopy` ... LL | x: dyn Object<MustBeCopy<T>> - | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T` + | ^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T` | help: consider restricting type parameter `T` | |
