Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
1d66e66
add `body` to `ClosureDef`
b-naber May 20, 2025
8604e58
add doc comment and a test with a generic closure
b-naber Jun 2, 2025
46326e1
Use non-2015 edition paths in tests that do not test for their resolu…
Veykril Jun 5, 2025
1d7c1b1
Add more missing 2015 edition directives
Veykril Jun 5, 2025
2549962
Add missing `dyn` keywords to tests that do not test for them
Veykril Jun 5, 2025
4882ea4
rustc_resolve: Improve `resolve_const_param_in_non_trivial_anon_const…
Enselic Jun 7, 2025
e9eae28
transmutability: shift abstraction boundary
jswrenn Jun 4, 2025
2c82574
use correct edition when warning for unsafe attributes
folkertdev Jun 9, 2025
f461997
Rename `build` to `host_target`
Kobzol Jun 10, 2025
20e8325
Improve documentation of the `Rustc` step and rename `compiler` to `b…
Kobzol Jun 10, 2025
208f2e4
Remove useless and wrong std crates special casing when un-remap sysroot
Urgau Jun 10, 2025
b88c006
compiler: Change c_int_width to be an integer type
workingjubilee Jun 11, 2025
87feee9
compiler: Update all targets to the new c_int_width type
workingjubilee Jun 11, 2025
0994063
cleaned up some tests
Kivooeo Jun 8, 2025
c6c55cc
cleaned up some tests
Kivooeo Jun 8, 2025
9f6e81c
Rollup merge of #141307 - b-naber:closure-body, r=celinval
matthiaskrgr Jun 12, 2025
bdf7b74
Rollup merge of #142040 - jswrenn:transmute-ty-region-generic, r=comp…
matthiaskrgr Jun 12, 2025
b3ddf3c
Rollup merge of #142066 - ferrocene:lw/edition-2015-tests, r=compiler…
matthiaskrgr Jun 12, 2025
2d9513b
Rollup merge of #142157 - Enselic:trivial-anon-const-use-cases, r=com…
matthiaskrgr Jun 12, 2025
c557695
Rollup merge of #142217 - Kivooeo:tf10, r=jieyouxu
matthiaskrgr Jun 12, 2025
e2e201f
Rollup merge of #142219 - Kivooeo:tf11, r=wesleywiser
matthiaskrgr Jun 12, 2025
75c186b
Rollup merge of #142261 - folkertdev:unstable-attr-correct-edition, r…
matthiaskrgr Jun 12, 2025
bb9dda1
Rollup merge of #142303 - Kobzol:bootstrap-cleanup-1, r=jieyouxu
matthiaskrgr Jun 12, 2025
78d8395
Rollup merge of #142318 - Urgau:cleanup-rust-src-remap, r=jieyouxu
matthiaskrgr Jun 12, 2025
2407761
Rollup merge of #142352 - workingjubilee:c-int-width-is-an-integer, r…
matthiaskrgr Jun 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add missing dyn keywords to tests that do not test for them
  • Loading branch information
Veykril committed Jun 5, 2025
commit 2549962c63651e4edf33a215e118777faf6d1c42
6 changes: 3 additions & 3 deletions tests/ui/auxiliary/typeid-intrinsic-aux1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ pub struct E(Result<&'static str, isize>);
pub type F = Option<isize>;
pub type G = usize;
pub type H = &'static str;
pub type I = Box<Fn()>;
pub type I32Iterator = Iterator<Item=i32>;
pub type U32Iterator = Iterator<Item=u32>;
pub type I = Box<dyn Fn()>;
pub type I32Iterator = dyn Iterator<Item=i32>;
pub type U32Iterator = dyn Iterator<Item=u32>;

pub fn id_A() -> TypeId { TypeId::of::<A>() }
pub fn id_B() -> TypeId { TypeId::of::<B>() }
Expand Down
6 changes: 3 additions & 3 deletions tests/ui/auxiliary/typeid-intrinsic-aux2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ pub struct E(Result<&'static str, isize>);
pub type F = Option<isize>;
pub type G = usize;
pub type H = &'static str;
pub type I = Box<Fn()>;
pub type I32Iterator = Iterator<Item=i32>;
pub type U32Iterator = Iterator<Item=u32>;
pub type I = Box<dyn Fn()>;
pub type I32Iterator = dyn Iterator<Item=i32>;
pub type U32Iterator = dyn Iterator<Item=u32>;

pub fn id_A() -> TypeId { TypeId::of::<A>() }
pub fn id_B() -> TypeId { TypeId::of::<B>() }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
#![allow(bare_trait_objects)]
trait A: Sized {
fn f(a: A) -> A;
fn f(a: dyn A) -> dyn A;
//~^ ERROR associated item referring to unboxed trait object for its own trait
//~| ERROR the trait `A` is not dyn compatible
}
trait B {
fn f(a: B) -> B;
fn f(a: dyn B) -> dyn B;
//~^ ERROR associated item referring to unboxed trait object for its own trait
//~| ERROR the trait `B` is not dyn compatible
}
trait C {
fn f(&self, a: C) -> C;
fn f(&self, a: dyn C) -> dyn C;
}

fn main() {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: associated item referring to unboxed trait object for its own trait
--> $DIR/dyn-incompatible-trait-should-use-self.rs:3:13
--> $DIR/dyn-incompatible-trait-should-use-self.rs:2:13
|
LL | trait A: Sized {
| - in this trait
Expand All @@ -13,22 +13,22 @@ LL + fn f(a: Self) -> Self;
|

error[E0038]: the trait `A` is not dyn compatible
--> $DIR/dyn-incompatible-trait-should-use-self.rs:3:13
--> $DIR/dyn-incompatible-trait-should-use-self.rs:2:13
|
LL | fn f(a: dyn A) -> dyn A;
| ^^^^^ `A` is not dyn compatible
|
note: for a trait to be dyn compatible it needs to allow building a vtable
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
--> $DIR/dyn-incompatible-trait-should-use-self.rs:2:10
--> $DIR/dyn-incompatible-trait-should-use-self.rs:1:10
|
LL | trait A: Sized {
| - ^^^^^ ...because it requires `Self: Sized`
| |
| this trait is not dyn compatible...

error: associated item referring to unboxed trait object for its own trait
--> $DIR/dyn-incompatible-trait-should-use-self.rs:8:13
--> $DIR/dyn-incompatible-trait-should-use-self.rs:7:13
|
LL | trait B {
| - in this trait
Expand All @@ -42,14 +42,14 @@ LL + fn f(a: Self) -> Self;
|

error[E0038]: the trait `B` is not dyn compatible
--> $DIR/dyn-incompatible-trait-should-use-self.rs:8:13
--> $DIR/dyn-incompatible-trait-should-use-self.rs:7:13
|
LL | fn f(a: dyn B) -> dyn B;
| ^^^^^ `B` is not dyn compatible
|
note: for a trait to be dyn compatible it needs to allow building a vtable
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
--> $DIR/dyn-incompatible-trait-should-use-self.rs:8:8
--> $DIR/dyn-incompatible-trait-should-use-self.rs:7:8
|
LL | trait B {
| - this trait is not dyn compatible...
Expand Down
10 changes: 5 additions & 5 deletions tests/ui/suggestions/missing-lifetime-specifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
// Different number of duplicated diagnostics on different targets
//@ compile-flags: -Zdeduplicate-diagnostics=yes

#![allow(bare_trait_objects)]
use std::cell::RefCell;
use std::collections::HashMap;

Expand All @@ -28,15 +27,15 @@ thread_local! {
//~^ ERROR missing lifetime specifiers
}
thread_local! {
static b: RefCell<HashMap<i32, Vec<Vec<&Bar>>>> = RefCell::new(HashMap::new());
static b: RefCell<HashMap<i32, Vec<Vec<&dyn Bar>>>> = RefCell::new(HashMap::new());
//~^ ERROR missing lifetime specifiers
}
thread_local! {
static c: RefCell<HashMap<i32, Vec<Vec<Qux<i32>>>>> = RefCell::new(HashMap::new());
//~^ ERROR missing lifetime specifiers
}
thread_local! {
static d: RefCell<HashMap<i32, Vec<Vec<&Tar<i32>>>>> = RefCell::new(HashMap::new());
static d: RefCell<HashMap<i32, Vec<Vec<&dyn Tar<i32>>>>> = RefCell::new(HashMap::new());
//~^ ERROR missing lifetime specifiers
}

Expand All @@ -45,8 +44,9 @@ thread_local! {
//~^ ERROR union takes 2 lifetime arguments but 1 lifetime argument
}
thread_local! {
static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
//~^ ERROR trait takes 2 lifetime arguments but 1 lifetime argument was supplied
static f: RefCell<HashMap<i32, Vec<Vec<&dyn Tar<'static, i32>>>>> =
RefCell::new(HashMap::new());
//~^^ ERROR trait takes 2 lifetime arguments but 1 lifetime argument was supplied
//~| ERROR missing lifetime specifier
}

Expand Down
55 changes: 30 additions & 25 deletions tests/ui/suggestions/missing-lifetime-specifier.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0106]: missing lifetime specifiers
--> $DIR/missing-lifetime-specifier.rs:27:44
--> $DIR/missing-lifetime-specifier.rs:26:44
|
LL | static a: RefCell<HashMap<i32, Vec<Vec<Foo>>>> = RefCell::new(HashMap::new());
| ^^^ expected 2 lifetime parameters
Expand All @@ -11,21 +11,21 @@ LL | static a: RefCell<HashMap<i32, Vec<Vec<Foo<'static, 'static>>>>> = RefC
| ++++++++++++++++++

error[E0106]: missing lifetime specifiers
--> $DIR/missing-lifetime-specifier.rs:31:44
--> $DIR/missing-lifetime-specifier.rs:30:44
|
LL | static b: RefCell<HashMap<i32, Vec<Vec<&Bar>>>> = RefCell::new(HashMap::new());
| ^^^^ expected 2 lifetime parameters
LL | static b: RefCell<HashMap<i32, Vec<Vec<&dyn Bar>>>> = RefCell::new(HashMap::new());
| ^ ^^^ expected 2 lifetime parameters
| |
| expected named lifetime parameter
|
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`
|
LL | static b: RefCell<HashMap<i32, Vec<Vec<&'static Bar<'static, 'static>>>>> = RefCell::new(HashMap::new());
| +++++++ ++++++++++++++++++
LL | static b: RefCell<HashMap<i32, Vec<Vec<&'static dyn Bar<'static, 'static>>>>> = RefCell::new(HashMap::new());
| +++++++ ++++++++++++++++++

error[E0106]: missing lifetime specifiers
--> $DIR/missing-lifetime-specifier.rs:35:47
--> $DIR/missing-lifetime-specifier.rs:34:47
|
LL | static c: RefCell<HashMap<i32, Vec<Vec<Qux<i32>>>>> = RefCell::new(HashMap::new());
| ^ expected 2 lifetime parameters
Expand All @@ -37,41 +37,46 @@ LL | static c: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'static, i32>>>>> =
| +++++++++++++++++

error[E0106]: missing lifetime specifiers
--> $DIR/missing-lifetime-specifier.rs:39:44
--> $DIR/missing-lifetime-specifier.rs:38:44
|
LL | static d: RefCell<HashMap<i32, Vec<Vec<&Tar<i32>>>>> = RefCell::new(HashMap::new());
| ^ ^ expected 2 lifetime parameters
LL | static d: RefCell<HashMap<i32, Vec<Vec<&dyn Tar<i32>>>>> = RefCell::new(HashMap::new());
| ^ ^ expected 2 lifetime parameters
| |
| expected named lifetime parameter
|
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`
|
LL | static d: RefCell<HashMap<i32, Vec<Vec<&'static Tar<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
| +++++++ +++++++++++++++++
LL | static d: RefCell<HashMap<i32, Vec<Vec<&'static dyn Tar<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
| +++++++ +++++++++++++++++

error[E0106]: missing lifetime specifier
--> $DIR/missing-lifetime-specifier.rs:48:44
--> $DIR/missing-lifetime-specifier.rs:47:44
|
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
LL | static f: RefCell<HashMap<i32, Vec<Vec<&dyn Tar<'static, i32>>>>> =
| ^ expected named lifetime parameter
|
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`
|
LL | static f: RefCell<HashMap<i32, Vec<Vec<&'static Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
LL | static f: RefCell<HashMap<i32, Vec<Vec<&'static dyn Tar<'static, i32>>>>> =
| +++++++
help: instead, you are more likely to want to return an owned value
|
LL - static f: RefCell<HashMap<i32, Vec<Vec<&dyn Tar<'static, i32>>>>> =
LL + static f: RefCell<HashMap<i32, Vec<Vec<dyn Tar<'static, i32>>>>> =
|

error[E0107]: union takes 2 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/missing-lifetime-specifier.rs:44:44
--> $DIR/missing-lifetime-specifier.rs:43:44
|
LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, i32>>>>> = RefCell::new(HashMap::new());
| ^^^ ------- supplied 1 lifetime argument
| |
| expected 2 lifetime arguments
|
note: union defined here, with 2 lifetime parameters: `'t`, `'k`
--> $DIR/missing-lifetime-specifier.rs:20:11
--> $DIR/missing-lifetime-specifier.rs:19:11
|
LL | pub union Qux<'t, 'k, I> {
| ^^^ -- --
Expand All @@ -81,22 +86,22 @@ LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'static, i32>>>>> =
| +++++++++

error[E0107]: trait takes 2 lifetime arguments but 1 lifetime argument was supplied
--> $DIR/missing-lifetime-specifier.rs:48:45
--> $DIR/missing-lifetime-specifier.rs:47:49
|
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new());
| ^^^ ------- supplied 1 lifetime argument
| |
| expected 2 lifetime arguments
LL | static f: RefCell<HashMap<i32, Vec<Vec<&dyn Tar<'static, i32>>>>> =
| ^^^ ------- supplied 1 lifetime argument
| |
| expected 2 lifetime arguments
|
note: trait defined here, with 2 lifetime parameters: `'t`, `'k`
--> $DIR/missing-lifetime-specifier.rs:24:7
--> $DIR/missing-lifetime-specifier.rs:23:7
|
LL | trait Tar<'t, 'k, I> {}
| ^^^ -- --
help: add missing lifetime argument
|
LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, 'static, i32>>>>> = RefCell::new(HashMap::new());
| +++++++++
LL | static f: RefCell<HashMap<i32, Vec<Vec<&dyn Tar<'static, 'static, i32>>>>> =
| +++++++++

error: aborting due to 7 previous errors

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/traits/auxiliary/traitimpl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

pub trait Bar<'a> : 'a {}

impl<'a> Bar<'a> {
impl<'a> dyn Bar<'a> {
pub fn bar(&self) {}
}
2 changes: 1 addition & 1 deletion tests/ui/traits/const-traits/inherent-impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ trait T {}
impl const S {}
//~^ ERROR inherent impls cannot be `const`

impl const T {}
impl const dyn T {}
//~^ ERROR inherent impls cannot be `const`

fn main() {}
4 changes: 2 additions & 2 deletions tests/ui/traits/const-traits/inherent-impl.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ LL | impl const S {}
error: inherent impls cannot be `const`
--> $DIR/inherent-impl.rs:10:12
|
LL | impl const T {}
| ----- ^ inherent impl for this type
LL | impl const dyn T {}
| ----- ^^^^^ inherent impl for this type
| |
| `const` because of this
|
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/type/auxiliary/crate_a1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ pub struct Foo;

pub trait Bar {}

pub fn bar() -> Box<Bar> {
pub fn bar() -> Box<dyn Bar> {
unimplemented!()
}


pub fn try_foo(x: Foo){}
pub fn try_bar(x: Box<Bar>){}
pub fn try_bar(x: Box<dyn Bar>){}
2 changes: 1 addition & 1 deletion tests/ui/type/auxiliary/crate_a2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ pub struct Foo;

pub trait Bar {}

pub fn bar() -> Box<Bar> {
pub fn bar() -> Box<dyn Bar> {
unimplemented!()
}
2 changes: 1 addition & 1 deletion tests/ui/type/type-mismatch-same-crate-name.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ LL | extern crate crate_a1 as a;
note: function defined here
--> $DIR/auxiliary/crate_a1.rs:11:8
|
LL | pub fn try_bar(x: Box<Bar>){}
LL | pub fn try_bar(x: Box<dyn Bar>){}
| ^^^^^^^

error: aborting due to 2 previous errors
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/unsized/unsized3-rpass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl Tr for St {
}

struct Qux<'a> {
f: Tr + 'a,
f: dyn Tr + 'a,
}

pub fn main() {
Expand Down Expand Up @@ -85,7 +85,7 @@ pub fn main() {
}

let obj: Box<St> = Box::new(St { f: 42 });
let obj: &Tr = &*obj;
let obj: &dyn Tr = &*obj;
let data: Box<_> = Box::new(Qux_ { f: St { f: 234 } });
let x: &Qux = &*ptr::from_raw_parts::<Qux>(&*data as *const _, ptr::metadata(obj));
assert_eq!(x.f.foo(), 234);
Expand Down
10 changes: 2 additions & 8 deletions tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
trait Trait<const N: Trait = bar> {
trait Trait<const N: dyn Trait = bar> {
//~^ ERROR cannot find value `bar` in this scope
//~| ERROR cycle detected when computing type of `Trait::N`
//~| WARN trait objects without an explicit `dyn` are deprecated [bare_trait_objects]
//~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
fn fnc<const N: Trait = u32>(&self) -> Trait {
fn fnc<const N: dyn Trait = u32>(&self) -> dyn Trait {
//~^ ERROR the name `N` is already used for a generic parameter in this item's generic parameters
//~| ERROR expected value, found builtin type `u32`
//~| ERROR defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
//~| ERROR associated item referring to unboxed trait object for its own trait
//~| WARN trait objects without an explicit `dyn` are deprecated [bare_trait_objects]
//~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
//~| WARN trait objects without an explicit `dyn` are deprecated [bare_trait_objects]
//~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
bar
//~^ ERROR cannot find value `bar` in this scope
}
Expand Down
Loading
Loading