diff options
| author | DuskyElf <91879372+DuskyElf@users.noreply.github.com> | 2025-02-04 17:02:37 +0530 |
|---|---|---|
| committer | DuskyElf <91879372+DuskyElf@users.noreply.github.com> | 2025-02-04 17:02:37 +0530 |
| commit | 2431977ecfe6e88e71ddad8bf0bb9a10f9a6256c (patch) | |
| tree | f94ac85313d1ac9f909dff1e142e7c54ccc59750 /tests/ui/trait-bounds | |
| parent | 8a8b4641754e9ce8a31b272dda6567727452df9e (diff) | |
| download | rust-2431977ecfe6e88e71ddad8bf0bb9a10f9a6256c.tar.gz rust-2431977ecfe6e88e71ddad8bf0bb9a10f9a6256c.zip | |
Rename and Move some UI tests to more suitable subdirs
Diffstat (limited to 'tests/ui/trait-bounds')
| -rw-r--r-- | tests/ui/trait-bounds/deep-level-Send-bound-check-issue-40827.rs | 17 | ||||
| -rw-r--r-- | tests/ui/trait-bounds/deep-level-Send-bound-check-issue-40827.stderr | 55 |
2 files changed, 72 insertions, 0 deletions
diff --git a/tests/ui/trait-bounds/deep-level-Send-bound-check-issue-40827.rs b/tests/ui/trait-bounds/deep-level-Send-bound-check-issue-40827.rs new file mode 100644 index 00000000000..6e42c506169 --- /dev/null +++ b/tests/ui/trait-bounds/deep-level-Send-bound-check-issue-40827.rs @@ -0,0 +1,17 @@ +use std::rc::Rc; +use std::sync::Arc; + +struct Foo(Arc<Bar>); + +enum Bar { + A(Rc<Foo>), + B(Option<Foo>), +} + +fn f<T: Send>(_: T) {} + +fn main() { + f(Foo(Arc::new(Bar::B(None)))); + //~^ ERROR E0277 + //~| ERROR E0277 +} diff --git a/tests/ui/trait-bounds/deep-level-Send-bound-check-issue-40827.stderr b/tests/ui/trait-bounds/deep-level-Send-bound-check-issue-40827.stderr new file mode 100644 index 00000000000..7b59fe72f43 --- /dev/null +++ b/tests/ui/trait-bounds/deep-level-Send-bound-check-issue-40827.stderr @@ -0,0 +1,55 @@ +error[E0277]: `Rc<Foo>` cannot be shared between threads safely + --> $DIR/deep-level-Send-bound-check-issue-40827.rs:14:7 + | +LL | f(Foo(Arc::new(Bar::B(None)))); + | - ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Rc<Foo>` cannot be shared between threads safely + | | + | required by a bound introduced by this call + | + = help: within `Bar`, the trait `Sync` is not implemented for `Rc<Foo>` +note: required because it appears within the type `Bar` + --> $DIR/deep-level-Send-bound-check-issue-40827.rs:6:6 + | +LL | enum Bar { + | ^^^ + = note: required for `Arc<Bar>` to implement `Send` +note: required because it appears within the type `Foo` + --> $DIR/deep-level-Send-bound-check-issue-40827.rs:4:8 + | +LL | struct Foo(Arc<Bar>); + | ^^^ +note: required by a bound in `f` + --> $DIR/deep-level-Send-bound-check-issue-40827.rs:11:9 + | +LL | fn f<T: Send>(_: T) {} + | ^^^^ required by this bound in `f` + +error[E0277]: `Rc<Foo>` cannot be sent between threads safely + --> $DIR/deep-level-Send-bound-check-issue-40827.rs:14:7 + | +LL | f(Foo(Arc::new(Bar::B(None)))); + | - ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Rc<Foo>` cannot be sent between threads safely + | | + | required by a bound introduced by this call + | + = help: within `Bar`, the trait `Send` is not implemented for `Rc<Foo>` +note: required because it appears within the type `Bar` + --> $DIR/deep-level-Send-bound-check-issue-40827.rs:6:6 + | +LL | enum Bar { + | ^^^ + = note: required for `Arc<Bar>` to implement `Send` +note: required because it appears within the type `Foo` + --> $DIR/deep-level-Send-bound-check-issue-40827.rs:4:8 + | +LL | struct Foo(Arc<Bar>); + | ^^^ +note: required by a bound in `f` + --> $DIR/deep-level-Send-bound-check-issue-40827.rs:11:9 + | +LL | fn f<T: Send>(_: T) {} + | ^^^^ required by this bound in `f` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. |
