diff options
| author | bors <bors@rust-lang.org> | 2024-12-07 09:38:00 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-12-07 09:38:00 +0000 |
| commit | 9c707a8b769523bb6768bf58e74fa2c39cc24844 (patch) | |
| tree | 29685106e8bc422851734c9d3e4c95fb95e50e81 /tests | |
| parent | cdb89d6b15056a5cfa8932231360ae358b08983f (diff) | |
| parent | d210b91331766bf3a9ebbdb7ea1889440afc6b93 (diff) | |
| download | rust-9c707a8b769523bb6768bf58e74fa2c39cc24844.tar.gz rust-9c707a8b769523bb6768bf58e74fa2c39cc24844.zip | |
Auto merge of #133978 - matthiaskrgr:rollup-6gh1iho, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #130209 (Stabilize `std::io::ErrorKind::CrossesDevices`) - #130254 (Stabilize `std::io::ErrorKind::QuotaExceeded`) - #132187 (Add Extend impls for tuples of arity 1 through 12) - #133875 (handle `--json-output` properly) - #133934 (Do not implement unsafe auto traits for types with unsafe fields) - #133954 (Hide errors whose suggestions would contain error constants or types) - #133960 (rustdoc: remove eq for clean::Attributes) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'tests')
14 files changed, 64 insertions, 81 deletions
diff --git a/tests/crashes/123809.rs b/tests/crashes/123809.rs deleted file mode 100644 index 75abe6dc0cd..00000000000 --- a/tests/crashes/123809.rs +++ /dev/null @@ -1,4 +0,0 @@ -//@ known-bug: #123809 -type Positive = std::pat::pattern_type!(std::pat is 0..); - -pub fn main() {} diff --git a/tests/ui/associated-consts/assoc-const-eq-ambiguity.stderr b/tests/ui/associated-consts/assoc-const-eq-ambiguity.stderr index ba3a8701316..aa1db4cb032 100644 --- a/tests/ui/associated-consts/assoc-const-eq-ambiguity.stderr +++ b/tests/ui/associated-consts/assoc-const-eq-ambiguity.stderr @@ -26,12 +26,6 @@ LL | trait Parent2 { const C: &'static str; } LL | LL | fn take1(_: impl Trait1<C = "?">) {} | ^^^^^^^ ambiguous associated constant `C` - | - = help: consider introducing a new type parameter `T` and adding `where` constraints: - where - T: Trait1, - T: Parent2::C = "?", - T: Parent1::C = "?" error: aborting due to 2 previous errors diff --git a/tests/ui/unsafe-fields/auto-traits.current.stderr b/tests/ui/unsafe-fields/auto-traits.current.stderr new file mode 100644 index 00000000000..53a97458b7c --- /dev/null +++ b/tests/ui/unsafe-fields/auto-traits.current.stderr @@ -0,0 +1,17 @@ +error[E0277]: the trait bound `UnsafeEnum: UnsafeAuto` is not satisfied + --> $DIR/auto-traits.rs:24:22 + | +LL | impl_unsafe_auto(UnsafeEnum::Safe(42)); + | ---------------- ^^^^^^^^^^^^^^^^^^^^ the trait `UnsafeAuto` is not implemented for `UnsafeEnum` + | | + | required by a bound introduced by this call + | +note: required by a bound in `impl_unsafe_auto` + --> $DIR/auto-traits.rs:20:29 + | +LL | fn impl_unsafe_auto(_: impl UnsafeAuto) {} + | ^^^^^^^^^^ required by this bound in `impl_unsafe_auto` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/unsafe-fields/auto-traits.next.stderr b/tests/ui/unsafe-fields/auto-traits.next.stderr new file mode 100644 index 00000000000..53a97458b7c --- /dev/null +++ b/tests/ui/unsafe-fields/auto-traits.next.stderr @@ -0,0 +1,17 @@ +error[E0277]: the trait bound `UnsafeEnum: UnsafeAuto` is not satisfied + --> $DIR/auto-traits.rs:24:22 + | +LL | impl_unsafe_auto(UnsafeEnum::Safe(42)); + | ---------------- ^^^^^^^^^^^^^^^^^^^^ the trait `UnsafeAuto` is not implemented for `UnsafeEnum` + | | + | required by a bound introduced by this call + | +note: required by a bound in `impl_unsafe_auto` + --> $DIR/auto-traits.rs:20:29 + | +LL | fn impl_unsafe_auto(_: impl UnsafeAuto) {} + | ^^^^^^^^^^ required by this bound in `impl_unsafe_auto` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/unsafe-fields/auto-traits.rs b/tests/ui/unsafe-fields/auto-traits.rs new file mode 100644 index 00000000000..e15d0000079 --- /dev/null +++ b/tests/ui/unsafe-fields/auto-traits.rs @@ -0,0 +1,26 @@ +//@ compile-flags: --crate-type=lib +//@ revisions: current next +//@[next] compile-flags: -Znext-solver + +#![feature(auto_traits)] +#![feature(unsafe_fields)] +#![allow(incomplete_features)] + +enum UnsafeEnum { + Safe(u8), + Unsafe { unsafe field: u8 }, +} + +auto trait SafeAuto {} + +fn impl_safe_auto(_: impl SafeAuto) {} + +unsafe auto trait UnsafeAuto {} + +fn impl_unsafe_auto(_: impl UnsafeAuto) {} + +fn tests() { + impl_safe_auto(UnsafeEnum::Safe(42)); + impl_unsafe_auto(UnsafeEnum::Safe(42)); + //~^ ERROR the trait bound `UnsafeEnum: UnsafeAuto` is not satisfied +} diff --git a/tests/ui/auxiliary/unsafe-fields-crate-dep.rs b/tests/ui/unsafe-fields/auxiliary/unsafe-fields-crate-dep.rs index 95b928402a9..95b928402a9 100644 --- a/tests/ui/auxiliary/unsafe-fields-crate-dep.rs +++ b/tests/ui/unsafe-fields/auxiliary/unsafe-fields-crate-dep.rs diff --git a/tests/ui/unsafe-fields-crate.rs b/tests/ui/unsafe-fields/unsafe-fields-crate.rs index cfb9ad6b544..cfb9ad6b544 100644 --- a/tests/ui/unsafe-fields-crate.rs +++ b/tests/ui/unsafe-fields/unsafe-fields-crate.rs diff --git a/tests/ui/unsafe-fields-crate.stderr b/tests/ui/unsafe-fields/unsafe-fields-crate.stderr index 778c26e0a43..778c26e0a43 100644 --- a/tests/ui/unsafe-fields-crate.stderr +++ b/tests/ui/unsafe-fields/unsafe-fields-crate.stderr diff --git a/tests/ui/unsafe-fields-parse.rs b/tests/ui/unsafe-fields/unsafe-fields-parse.rs index 67277731293..67277731293 100644 --- a/tests/ui/unsafe-fields-parse.rs +++ b/tests/ui/unsafe-fields/unsafe-fields-parse.rs diff --git a/tests/ui/unsafe-fields-parse.stderr b/tests/ui/unsafe-fields/unsafe-fields-parse.stderr index 5a45ab03ffe..5a45ab03ffe 100644 --- a/tests/ui/unsafe-fields-parse.stderr +++ b/tests/ui/unsafe-fields/unsafe-fields-parse.stderr diff --git a/tests/ui/unsafe-fields.rs b/tests/ui/unsafe-fields/unsafe-fields.rs index 637471582d7..637471582d7 100644 --- a/tests/ui/unsafe-fields.rs +++ b/tests/ui/unsafe-fields/unsafe-fields.rs diff --git a/tests/ui/unsafe-fields.stderr b/tests/ui/unsafe-fields/unsafe-fields.stderr index a1c5d2b44cd..a1c5d2b44cd 100644 --- a/tests/ui/unsafe-fields.stderr +++ b/tests/ui/unsafe-fields/unsafe-fields.stderr diff --git a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.rs b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.rs index a953f1818c5..997bee1e600 100644 --- a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.rs +++ b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.rs @@ -3,15 +3,11 @@ trait Foo<const N: Bar<2>> { //~^ WARN trait objects without an explicit `dyn` are deprecated //~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! //~| ERROR cycle detected when computing type of `Foo::N` - //~| ERROR the trait `Foo` cannot be made into an object - //~| ERROR `(dyn Bar<2> + 'static)` is forbidden as the type of a const generic parameter fn func() {} } trait Bar<const M: Foo<2>> {} //~^ WARN trait objects without an explicit `dyn` are deprecated //~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! -//~| ERROR the trait `Foo` cannot be made into an object -//~| ERROR `(dyn Foo<2> + 'static)` is forbidden as the type of a const generic parameter fn main() {} diff --git a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.stderr b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.stderr index f8905437c6e..733b729faf0 100644 --- a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.stderr +++ b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.stderr @@ -13,7 +13,7 @@ LL | trait Foo<const N: dyn Bar<2>> { | +++ warning: trait objects without an explicit `dyn` are deprecated - --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:11:20 + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:9:20 | LL | trait Bar<const M: Foo<2>> {} | ^^^^^^ @@ -32,7 +32,7 @@ LL | trait Foo<const N: Bar<2>> { | ^^^^^^^^^^^^^^^ | note: ...which requires computing type of `Bar::M`... - --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:11:11 + --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:9:11 | LL | trait Bar<const M: Foo<2>> {} | ^^^^^^^^^^^^^^^ @@ -44,69 +44,6 @@ LL | trait Foo<const N: Bar<2>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information -error[E0038]: the trait `Foo` cannot be made into an object - --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:2:24 - | -LL | trait Foo<const N: Bar<2>> { - | ^ `Foo` cannot be made into an object - | -note: for a trait to be "dyn-compatible" 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/ice-hir-wf-check-anon-const-issue-122989.rs:8:8 - | -LL | trait Foo<const N: Bar<2>> { - | --- this trait cannot be made into an object... -... -LL | fn func() {} - | ^^^^ ...because associated function `func` has no `self` parameter -help: consider turning `func` into a method by giving it a `&self` argument - | -LL | fn func(&self) {} - | +++++ -help: alternatively, consider constraining `func` so it does not apply to trait objects - | -LL | fn func() where Self: Sized {} - | +++++++++++++++++ - -error: `(dyn Bar<2> + 'static)` is forbidden as the type of a const generic parameter - --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:2:20 - | -LL | trait Foo<const N: Bar<2>> { - | ^^^^^^ - | - = note: the only supported types are integers, `bool`, and `char` - -error[E0038]: the trait `Foo` cannot be made into an object - --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:11:11 - | -LL | trait Bar<const M: Foo<2>> {} - | ^^^^^^^^^^^^^^^ `Foo` cannot be made into an object - | -note: for a trait to be "dyn-compatible" 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/ice-hir-wf-check-anon-const-issue-122989.rs:8:8 - | -LL | trait Foo<const N: Bar<2>> { - | --- this trait cannot be made into an object... -... -LL | fn func() {} - | ^^^^ ...because associated function `func` has no `self` parameter -help: consider turning `func` into a method by giving it a `&self` argument - | -LL | fn func(&self) {} - | +++++ -help: alternatively, consider constraining `func` so it does not apply to trait objects - | -LL | fn func() where Self: Sized {} - | +++++++++++++++++ - -error: `(dyn Foo<2> + 'static)` is forbidden as the type of a const generic parameter - --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:11:20 - | -LL | trait Bar<const M: Foo<2>> {} - | ^^^^^^ - | - = note: the only supported types are integers, `bool`, and `char` - -error: aborting due to 5 previous errors; 2 warnings emitted +error: aborting due to 1 previous error; 2 warnings emitted -Some errors have detailed explanations: E0038, E0391. -For more information about an error, try `rustc --explain E0038`. +For more information about this error, try `rustc --explain E0391`. |
