From 4feb5de34c1e41da0c10e149e243a25a6eafcd17 Mon Sep 17 00:00:00 2001 From: Kivooeo Date: Mon, 30 Jun 2025 00:03:28 +0500 Subject: [PATCH 1/2] moved tests --- .../non-primitive-cast-suggestion.fixed} | 0 .../{nonscalar-cast.rs => cast/non-primitive-cast-suggestion.rs} | 0 .../non-primitive-cast-suggestion.stderr} | 0 .../closure-clone-requires-captured-clone.rs} | 0 .../closure-clone-requires-captured-clone.stderr} | 0 .../array-repeat-expr-not-const.rs} | 0 .../array-repeat-expr-not-const.stderr} | 0 tests/ui/{ => cross-crate}/auxiliary/noexporttypelib.rs | 0 .../unexported-type-error-message.rs} | 0 .../unexported-type-error-message.stderr} | 0 .../field-replace-in-struct-with-drop.rs} | 0 tests/ui/{no-core-2.rs => no_std/no-core-edition2018-syntax.rs} | 0 .../ui/{no-core-1.rs => no_std/no-core-with-explicit-std-core.rs} | 0 .../{no-send-res-ports.rs => threads-sendsync/rc-is-not-send.rs} | 0 .../rc-is-not-send.stderr} | 0 15 files changed, 0 insertions(+), 0 deletions(-) rename tests/ui/{nonscalar-cast.fixed => cast/non-primitive-cast-suggestion.fixed} (100%) rename tests/ui/{nonscalar-cast.rs => cast/non-primitive-cast-suggestion.rs} (100%) rename tests/ui/{nonscalar-cast.stderr => cast/non-primitive-cast-suggestion.stderr} (100%) rename tests/ui/{not-clone-closure.rs => closures/closure-clone-requires-captured-clone.rs} (100%) rename tests/ui/{not-clone-closure.stderr => closures/closure-clone-requires-captured-clone.stderr} (100%) rename tests/ui/{non-constant-expr-for-arr-len.rs => consts/array-repeat-expr-not-const.rs} (100%) rename tests/ui/{non-constant-expr-for-arr-len.stderr => consts/array-repeat-expr-not-const.stderr} (100%) rename tests/ui/{ => cross-crate}/auxiliary/noexporttypelib.rs (100%) rename tests/ui/{noexporttypeexe.rs => cross-crate/unexported-type-error-message.rs} (100%) rename tests/ui/{noexporttypeexe.stderr => cross-crate/unexported-type-error-message.stderr} (100%) rename tests/ui/{no-warn-on-field-replace-issue-34101.rs => drop/field-replace-in-struct-with-drop.rs} (100%) rename tests/ui/{no-core-2.rs => no_std/no-core-edition2018-syntax.rs} (100%) rename tests/ui/{no-core-1.rs => no_std/no-core-with-explicit-std-core.rs} (100%) rename tests/ui/{no-send-res-ports.rs => threads-sendsync/rc-is-not-send.rs} (100%) rename tests/ui/{no-send-res-ports.stderr => threads-sendsync/rc-is-not-send.stderr} (100%) diff --git a/tests/ui/nonscalar-cast.fixed b/tests/ui/cast/non-primitive-cast-suggestion.fixed similarity index 100% rename from tests/ui/nonscalar-cast.fixed rename to tests/ui/cast/non-primitive-cast-suggestion.fixed diff --git a/tests/ui/nonscalar-cast.rs b/tests/ui/cast/non-primitive-cast-suggestion.rs similarity index 100% rename from tests/ui/nonscalar-cast.rs rename to tests/ui/cast/non-primitive-cast-suggestion.rs diff --git a/tests/ui/nonscalar-cast.stderr b/tests/ui/cast/non-primitive-cast-suggestion.stderr similarity index 100% rename from tests/ui/nonscalar-cast.stderr rename to tests/ui/cast/non-primitive-cast-suggestion.stderr diff --git a/tests/ui/not-clone-closure.rs b/tests/ui/closures/closure-clone-requires-captured-clone.rs similarity index 100% rename from tests/ui/not-clone-closure.rs rename to tests/ui/closures/closure-clone-requires-captured-clone.rs diff --git a/tests/ui/not-clone-closure.stderr b/tests/ui/closures/closure-clone-requires-captured-clone.stderr similarity index 100% rename from tests/ui/not-clone-closure.stderr rename to tests/ui/closures/closure-clone-requires-captured-clone.stderr diff --git a/tests/ui/non-constant-expr-for-arr-len.rs b/tests/ui/consts/array-repeat-expr-not-const.rs similarity index 100% rename from tests/ui/non-constant-expr-for-arr-len.rs rename to tests/ui/consts/array-repeat-expr-not-const.rs diff --git a/tests/ui/non-constant-expr-for-arr-len.stderr b/tests/ui/consts/array-repeat-expr-not-const.stderr similarity index 100% rename from tests/ui/non-constant-expr-for-arr-len.stderr rename to tests/ui/consts/array-repeat-expr-not-const.stderr diff --git a/tests/ui/auxiliary/noexporttypelib.rs b/tests/ui/cross-crate/auxiliary/noexporttypelib.rs similarity index 100% rename from tests/ui/auxiliary/noexporttypelib.rs rename to tests/ui/cross-crate/auxiliary/noexporttypelib.rs diff --git a/tests/ui/noexporttypeexe.rs b/tests/ui/cross-crate/unexported-type-error-message.rs similarity index 100% rename from tests/ui/noexporttypeexe.rs rename to tests/ui/cross-crate/unexported-type-error-message.rs diff --git a/tests/ui/noexporttypeexe.stderr b/tests/ui/cross-crate/unexported-type-error-message.stderr similarity index 100% rename from tests/ui/noexporttypeexe.stderr rename to tests/ui/cross-crate/unexported-type-error-message.stderr diff --git a/tests/ui/no-warn-on-field-replace-issue-34101.rs b/tests/ui/drop/field-replace-in-struct-with-drop.rs similarity index 100% rename from tests/ui/no-warn-on-field-replace-issue-34101.rs rename to tests/ui/drop/field-replace-in-struct-with-drop.rs diff --git a/tests/ui/no-core-2.rs b/tests/ui/no_std/no-core-edition2018-syntax.rs similarity index 100% rename from tests/ui/no-core-2.rs rename to tests/ui/no_std/no-core-edition2018-syntax.rs diff --git a/tests/ui/no-core-1.rs b/tests/ui/no_std/no-core-with-explicit-std-core.rs similarity index 100% rename from tests/ui/no-core-1.rs rename to tests/ui/no_std/no-core-with-explicit-std-core.rs diff --git a/tests/ui/no-send-res-ports.rs b/tests/ui/threads-sendsync/rc-is-not-send.rs similarity index 100% rename from tests/ui/no-send-res-ports.rs rename to tests/ui/threads-sendsync/rc-is-not-send.rs diff --git a/tests/ui/no-send-res-ports.stderr b/tests/ui/threads-sendsync/rc-is-not-send.stderr similarity index 100% rename from tests/ui/no-send-res-ports.stderr rename to tests/ui/threads-sendsync/rc-is-not-send.stderr From da5c6395dad7c5be33f842c3660ae2f6af287f3a Mon Sep 17 00:00:00 2001 From: Kivooeo Date: Mon, 30 Jun 2025 00:05:58 +0500 Subject: [PATCH 2/2] cleaned up some tests --- .../cast/non-primitive-cast-suggestion.fixed | 11 ++++- .../ui/cast/non-primitive-cast-suggestion.rs | 11 ++++- .../cast/non-primitive-cast-suggestion.stderr | 10 ++-- .../closure-clone-requires-captured-clone.rs | 20 +++++--- ...osure-clone-requires-captured-clone.stderr | 22 ++++----- .../ui/consts/array-repeat-expr-not-const.rs | 6 ++- .../consts/array-repeat-expr-not-const.stderr | 6 +-- ...ib.rs => unexported-type-error-message.rs} | 0 .../unexported-type-error-message.rs | 6 +-- .../unexported-type-error-message.stderr | 14 +++--- .../drop/field-replace-in-struct-with-drop.rs | 48 ++++++++----------- tests/ui/no_std/no-core-edition2018-syntax.rs | 18 +++++-- .../no_std/no-core-with-explicit-std-core.rs | 8 +++- tests/ui/threads-sendsync/rc-is-not-send.rs | 30 ++++++------ .../ui/threads-sendsync/rc-is-not-send.stderr | 24 +++++----- 15 files changed, 132 insertions(+), 102 deletions(-) rename tests/ui/cross-crate/auxiliary/{noexporttypelib.rs => unexported-type-error-message.rs} (100%) diff --git a/tests/ui/cast/non-primitive-cast-suggestion.fixed b/tests/ui/cast/non-primitive-cast-suggestion.fixed index cb5591dbb9de4..9a1a3c022c791 100644 --- a/tests/ui/cast/non-primitive-cast-suggestion.fixed +++ b/tests/ui/cast/non-primitive-cast-suggestion.fixed @@ -1,8 +1,14 @@ +//! Test that casting non-primitive types with `as` is rejected with a helpful suggestion. +//! +//! You can't use `as` to cast between non-primitive types, even if they have +//! `From`/`Into` implementations. The compiler should suggest using `From::from()` +//! or `.into()` instead, and rustfix should be able to apply the suggestion. + //@ run-rustfix #[derive(Debug)] struct Foo { - x: isize + x: isize, } impl From for isize { @@ -12,5 +18,6 @@ impl From for isize { } fn main() { - println!("{}", isize::from(Foo { x: 1 })); //~ ERROR non-primitive cast: `Foo` as `isize` [E0605] + let _ = isize::from(Foo { x: 1 }); + //~^ ERROR non-primitive cast: `Foo` as `isize` [E0605] } diff --git a/tests/ui/cast/non-primitive-cast-suggestion.rs b/tests/ui/cast/non-primitive-cast-suggestion.rs index 27429b44cd086..79006f4ba26d3 100644 --- a/tests/ui/cast/non-primitive-cast-suggestion.rs +++ b/tests/ui/cast/non-primitive-cast-suggestion.rs @@ -1,8 +1,14 @@ +//! Test that casting non-primitive types with `as` is rejected with a helpful suggestion. +//! +//! You can't use `as` to cast between non-primitive types, even if they have +//! `From`/`Into` implementations. The compiler should suggest using `From::from()` +//! or `.into()` instead, and rustfix should be able to apply the suggestion. + //@ run-rustfix #[derive(Debug)] struct Foo { - x: isize + x: isize, } impl From for isize { @@ -12,5 +18,6 @@ impl From for isize { } fn main() { - println!("{}", Foo { x: 1 } as isize); //~ ERROR non-primitive cast: `Foo` as `isize` [E0605] + let _ = Foo { x: 1 } as isize; + //~^ ERROR non-primitive cast: `Foo` as `isize` [E0605] } diff --git a/tests/ui/cast/non-primitive-cast-suggestion.stderr b/tests/ui/cast/non-primitive-cast-suggestion.stderr index 834d4ea241c12..bd35ded15a46c 100644 --- a/tests/ui/cast/non-primitive-cast-suggestion.stderr +++ b/tests/ui/cast/non-primitive-cast-suggestion.stderr @@ -1,13 +1,13 @@ error[E0605]: non-primitive cast: `Foo` as `isize` - --> $DIR/nonscalar-cast.rs:15:20 + --> $DIR/non-primitive-cast-suggestion.rs:21:13 | -LL | println!("{}", Foo { x: 1 } as isize); - | ^^^^^^^^^^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object +LL | let _ = Foo { x: 1 } as isize; + | ^^^^^^^^^^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object | help: consider using the `From` trait instead | -LL - println!("{}", Foo { x: 1 } as isize); -LL + println!("{}", isize::from(Foo { x: 1 })); +LL - let _ = Foo { x: 1 } as isize; +LL + let _ = isize::from(Foo { x: 1 }); | error: aborting due to 1 previous error diff --git a/tests/ui/closures/closure-clone-requires-captured-clone.rs b/tests/ui/closures/closure-clone-requires-captured-clone.rs index 976e3b9e81c2e..80938e50b67a7 100644 --- a/tests/ui/closures/closure-clone-requires-captured-clone.rs +++ b/tests/ui/closures/closure-clone-requires-captured-clone.rs @@ -1,13 +1,19 @@ -//@compile-flags: --diagnostic-width=300 -// Check that closures do not implement `Clone` if their environment is not `Clone`. +//! Test that closures only implement `Clone` if all captured values implement `Clone`. +//! +//! When a closure captures variables from its environment, it can only be cloned +//! if all those captured variables are cloneable. This test makes sure the compiler +//! properly rejects attempts to clone closures that capture non-Clone types. -struct S(i32); +//@ compile-flags: --diagnostic-width=300 + +struct NonClone(i32); fn main() { - let a = S(5); - let hello = move || { - println!("Hello {}", a.0); + let captured_value = NonClone(5); + let closure = move || { + let _ = captured_value.0; }; - let hello = hello.clone(); //~ ERROR the trait bound `S: Clone` is not satisfied + closure.clone(); + //~^ ERROR the trait bound `NonClone: Clone` is not satisfied } diff --git a/tests/ui/closures/closure-clone-requires-captured-clone.stderr b/tests/ui/closures/closure-clone-requires-captured-clone.stderr index 0c95a99d0c095..785cc8a3032e2 100644 --- a/tests/ui/closures/closure-clone-requires-captured-clone.stderr +++ b/tests/ui/closures/closure-clone-requires-captured-clone.stderr @@ -1,21 +1,21 @@ -error[E0277]: the trait bound `S: Clone` is not satisfied in `{closure@$DIR/not-clone-closure.rs:8:17: 8:24}` - --> $DIR/not-clone-closure.rs:12:23 +error[E0277]: the trait bound `NonClone: Clone` is not satisfied in `{closure@$DIR/closure-clone-requires-captured-clone.rs:13:19: 13:26}` + --> $DIR/closure-clone-requires-captured-clone.rs:17:13 | -LL | let hello = move || { - | ------- within this `{closure@$DIR/not-clone-closure.rs:8:17: 8:24}` +LL | let closure = move || { + | ------- within this `{closure@$DIR/closure-clone-requires-captured-clone.rs:13:19: 13:26}` ... -LL | let hello = hello.clone(); - | ^^^^^ within `{closure@$DIR/not-clone-closure.rs:8:17: 8:24}`, the trait `Clone` is not implemented for `S` +LL | closure.clone(); + | ^^^^^ within `{closure@$DIR/closure-clone-requires-captured-clone.rs:13:19: 13:26}`, the trait `Clone` is not implemented for `NonClone` | note: required because it's used within this closure - --> $DIR/not-clone-closure.rs:8:17 + --> $DIR/closure-clone-requires-captured-clone.rs:13:19 | -LL | let hello = move || { - | ^^^^^^^ -help: consider annotating `S` with `#[derive(Clone)]` +LL | let closure = move || { + | ^^^^^^^ +help: consider annotating `NonClone` with `#[derive(Clone)]` | LL + #[derive(Clone)] -LL | struct S(i32); +LL | struct NonClone(i32); | error: aborting due to 1 previous error diff --git a/tests/ui/consts/array-repeat-expr-not-const.rs b/tests/ui/consts/array-repeat-expr-not-const.rs index 1b101d3233f14..55aee7336da32 100644 --- a/tests/ui/consts/array-repeat-expr-not-const.rs +++ b/tests/ui/consts/array-repeat-expr-not-const.rs @@ -1,7 +1,9 @@ -// Check that non constant exprs fail for array repeat syntax +//! Arrays created with `[value; length]` syntax need the length to be known at +//! compile time. This test makes sure the compiler rejects runtime values like +//! function parameters in the length position. fn main() { - fn bar(n: usize) { + fn create_array(n: usize) { let _x = [0; n]; //~^ ERROR attempt to use a non-constant value in a constant [E0435] } diff --git a/tests/ui/consts/array-repeat-expr-not-const.stderr b/tests/ui/consts/array-repeat-expr-not-const.stderr index c9f977fbaa409..f576154525964 100644 --- a/tests/ui/consts/array-repeat-expr-not-const.stderr +++ b/tests/ui/consts/array-repeat-expr-not-const.stderr @@ -1,8 +1,8 @@ error[E0435]: attempt to use a non-constant value in a constant - --> $DIR/non-constant-expr-for-arr-len.rs:5:22 + --> $DIR/array-repeat-expr-not-const.rs:7:22 | -LL | fn bar(n: usize) { - | - this would need to be a `const` +LL | fn create_array(n: usize) { + | - this would need to be a `const` LL | let _x = [0; n]; | ^ diff --git a/tests/ui/cross-crate/auxiliary/noexporttypelib.rs b/tests/ui/cross-crate/auxiliary/unexported-type-error-message.rs similarity index 100% rename from tests/ui/cross-crate/auxiliary/noexporttypelib.rs rename to tests/ui/cross-crate/auxiliary/unexported-type-error-message.rs diff --git a/tests/ui/cross-crate/unexported-type-error-message.rs b/tests/ui/cross-crate/unexported-type-error-message.rs index 35257b20ccdf8..5998f0dc6e233 100644 --- a/tests/ui/cross-crate/unexported-type-error-message.rs +++ b/tests/ui/cross-crate/unexported-type-error-message.rs @@ -1,13 +1,13 @@ -//@ aux-build:noexporttypelib.rs +//@ aux-build:unexported-type-error-message.rs -extern crate noexporttypelib; +extern crate unexported_type_error_message; fn main() { // Here, the type returned by foo() is not exported. // This used to cause internal errors when serializing // because the def_id associated with the type was // not convertible to a path. - let x: isize = noexporttypelib::foo(); + let x: isize = unexported_type_error_message::foo(); //~^ ERROR mismatched types //~| NOTE expected type `isize` //~| NOTE found enum `Option` diff --git a/tests/ui/cross-crate/unexported-type-error-message.stderr b/tests/ui/cross-crate/unexported-type-error-message.stderr index 59759b696c7a2..b468d9839e10e 100644 --- a/tests/ui/cross-crate/unexported-type-error-message.stderr +++ b/tests/ui/cross-crate/unexported-type-error-message.stderr @@ -1,17 +1,17 @@ error[E0308]: mismatched types - --> $DIR/noexporttypeexe.rs:10:18 + --> $DIR/unexported-type-error-message.rs:10:20 | -LL | let x: isize = noexporttypelib::foo(); - | ----- ^^^^^^^^^^^^^^^^^^^^^^ expected `isize`, found `Option` - | | - | expected due to this +LL | let x: isize = unexported_type_error_message::foo(); + | ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `isize`, found `Option` + | | + | expected due to this | = note: expected type `isize` found enum `Option` help: consider using `Option::expect` to unwrap the `Option` value, panicking if the value is an `Option::None` | -LL | let x: isize = noexporttypelib::foo().expect("REASON"); - | +++++++++++++++++ +LL | let x: isize = unexported_type_error_message::foo().expect("REASON"); + | +++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/drop/field-replace-in-struct-with-drop.rs b/tests/ui/drop/field-replace-in-struct-with-drop.rs index e1d5e9c5268b8..8c65a4b3ad1e0 100644 --- a/tests/ui/drop/field-replace-in-struct-with-drop.rs +++ b/tests/ui/drop/field-replace-in-struct-with-drop.rs @@ -1,22 +1,17 @@ -// Issue 34101: Circa 2016-06-05, `fn inline` below issued an -// erroneous warning from the elaborate_drops pass about moving out of -// a field in `Foo`, which has a destructor (and thus cannot have -// content moved out of it). The reason that the warning is erroneous -// in this case is that we are doing a *replace*, not a move, of the -// content in question, and it is okay to replace fields within `Foo`. -// -// Another more subtle problem was that the elaborate_drops was -// creating a separate drop flag for that internally replaced content, -// even though the compiler should enforce an invariant that any drop -// flag for such subcontent of `Foo` will always have the same value -// as the drop flag for `Foo` itself. - - - - - - - +//! Circa 2016-06-05, `fn inline` below issued an +//! erroneous warning from the elaborate_drops pass about moving out of +//! a field in `Foo`, which has a destructor (and thus cannot have +//! content moved out of it). The reason that the warning is erroneous +//! in this case is that we are doing a *replace*, not a move, of the +//! content in question, and it is okay to replace fields within `Foo`. +//! +//! Another more subtle problem was that the elaborate_drops was +//! creating a separate drop flag for that internally replaced content, +//! even though the compiler should enforce an invariant that any drop +//! flag for such subcontent of `Foo` will always have the same value +//! as the drop flag for `Foo` itself. +//! +//! Regression test for . //@ check-pass @@ -26,21 +21,20 @@ impl Drop for Foo { fn drop(&mut self) {} } -fn inline() { - // (dummy variable so `f` gets assigned `var1` in MIR for both fn's) +fn test_inline_replacement() { + // dummy variable so `f` gets assigned `var1` in MIR for both functions let _s = (); let mut f = Foo(String::from("foo")); - f.0 = String::from("bar"); + f.0 = String::from("bar"); // This should not warn } -fn outline() { +fn test_outline_replacement() { let _s = String::from("foo"); let mut f = Foo(_s); - f.0 = String::from("bar"); + f.0 = String::from("bar"); // This should not warn either } - fn main() { - inline(); - outline(); + test_inline_replacement(); + test_outline_replacement(); } diff --git a/tests/ui/no_std/no-core-edition2018-syntax.rs b/tests/ui/no_std/no-core-edition2018-syntax.rs index 2f55365bdd0f3..9a327e4c8e316 100644 --- a/tests/ui/no_std/no-core-edition2018-syntax.rs +++ b/tests/ui/no_std/no-core-edition2018-syntax.rs @@ -1,19 +1,27 @@ +//! Test that `#![no_core]` doesn't break modern Rust syntax in edition 2018. +//! +//! When you use `#![no_core]`, you lose the automatic prelude, but you can still +//! get everything back by manually importing `use core::{prelude::v1::*, *}`. +//! This test makes sure that after doing that, things like `for` loops and the +//! `?` operator still work as expected. + //@ run-pass +//@ edition:2018 #![allow(dead_code, unused_imports)] #![feature(no_core)] #![no_core] -//@ edition:2018 -extern crate std; extern crate core; -use core::{prelude::v1::*, *}; +extern crate std; +use core::prelude::v1::*; +use core::*; -fn foo() { +fn test_for_loop() { for _ in &[()] {} } -fn bar() -> Option<()> { +fn test_question_mark_operator() -> Option<()> { None? } diff --git a/tests/ui/no_std/no-core-with-explicit-std-core.rs b/tests/ui/no_std/no-core-with-explicit-std-core.rs index d6d2ba6044585..3940bcb3aa4fb 100644 --- a/tests/ui/no_std/no-core-with-explicit-std-core.rs +++ b/tests/ui/no_std/no-core-with-explicit-std-core.rs @@ -1,11 +1,17 @@ +//! Test that you can use `#![no_core]` and still import std and core manually. +//! +//! The `#![no_core]` attribute disables the automatic core prelude, but you should +//! still be able to explicitly import both `std` and `core` crates and use types +//! like `Option` normally. + //@ run-pass #![allow(stable_features)] #![feature(no_core, core)] #![no_core] -extern crate std; extern crate core; +extern crate std; use std::option::Option::Some; diff --git a/tests/ui/threads-sendsync/rc-is-not-send.rs b/tests/ui/threads-sendsync/rc-is-not-send.rs index 1bac5868e73fe..dd562e9e8f34f 100644 --- a/tests/ui/threads-sendsync/rc-is-not-send.rs +++ b/tests/ui/threads-sendsync/rc-is-not-send.rs @@ -1,28 +1,28 @@ -use std::thread; +//! Test that `Rc` cannot be sent between threads. + use std::rc::Rc; +use std::thread; #[derive(Debug)] struct Port(Rc); -fn main() { - #[derive(Debug)] - struct Foo { - _x: Port<()>, - } +#[derive(Debug)] +struct Foo { + _x: Port<()>, +} - impl Drop for Foo { - fn drop(&mut self) {} - } +impl Drop for Foo { + fn drop(&mut self) {} +} - fn foo(x: Port<()>) -> Foo { - Foo { - _x: x - } - } +fn foo(x: Port<()>) -> Foo { + Foo { _x: x } +} +fn main() { let x = foo(Port(Rc::new(()))); - thread::spawn(move|| { + thread::spawn(move || { //~^ ERROR `Rc<()>` cannot be sent between threads safely let y = x; println!("{:?}", y); diff --git a/tests/ui/threads-sendsync/rc-is-not-send.stderr b/tests/ui/threads-sendsync/rc-is-not-send.stderr index 9c30261e5cb73..a06b683f729e0 100644 --- a/tests/ui/threads-sendsync/rc-is-not-send.stderr +++ b/tests/ui/threads-sendsync/rc-is-not-send.stderr @@ -1,10 +1,10 @@ error[E0277]: `Rc<()>` cannot be sent between threads safely - --> $DIR/no-send-res-ports.rs:25:19 + --> $DIR/rc-is-not-send.rs:25:19 | -LL | thread::spawn(move|| { - | ------------- ^----- +LL | thread::spawn(move || { + | ------------- ^------ | | | - | _____|_____________within this `{closure@$DIR/no-send-res-ports.rs:25:19: 25:25}` + | _____|_____________within this `{closure@$DIR/rc-is-not-send.rs:25:19: 25:26}` | | | | | required by a bound introduced by this call LL | | @@ -13,22 +13,22 @@ LL | | println!("{:?}", y); LL | | }); | |_____^ `Rc<()>` cannot be sent between threads safely | - = help: within `{closure@$DIR/no-send-res-ports.rs:25:19: 25:25}`, the trait `Send` is not implemented for `Rc<()>` + = help: within `{closure@$DIR/rc-is-not-send.rs:25:19: 25:26}`, the trait `Send` is not implemented for `Rc<()>` note: required because it appears within the type `Port<()>` - --> $DIR/no-send-res-ports.rs:5:8 + --> $DIR/rc-is-not-send.rs:7:8 | LL | struct Port(Rc); | ^^^^ note: required because it appears within the type `Foo` - --> $DIR/no-send-res-ports.rs:9:12 + --> $DIR/rc-is-not-send.rs:10:8 | -LL | struct Foo { - | ^^^ +LL | struct Foo { + | ^^^ note: required because it's used within this closure - --> $DIR/no-send-res-ports.rs:25:19 + --> $DIR/rc-is-not-send.rs:25:19 | -LL | thread::spawn(move|| { - | ^^^^^^ +LL | thread::spawn(move || { + | ^^^^^^^ note: required by a bound in `spawn` --> $SRC_DIR/std/src/thread/mod.rs:LL:COL