forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#91888 - BoxyUwU:generic_arg_infer_aaaa, r=lcnr
Handle unordered const/ty generics for object lifetime defaults *feel like I should have a PR description but cant think of what to put here* r? ``@lcnr``
- Loading branch information
Showing
5 changed files
with
30 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
src/test/ui/const-generics/defaults/auxiliary/trait_object_lt_defaults_lib.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub struct Foo<'a, const N: usize, T: 'a + ?Sized>(pub &'a T, [(); N]); |
24 changes: 24 additions & 0 deletions
24
src/test/ui/const-generics/defaults/trait_object_lt_defaults.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// aux-build:trait_object_lt_defaults_lib.rs | ||
// run-pass | ||
#![allow(dead_code)] | ||
extern crate trait_object_lt_defaults_lib; | ||
|
||
// Tests that `A<'a, 3, dyn Test>` is short for `A<'a, 3, dyn Test + 'a>` | ||
// and `Foo<'a, 3, dyn Test>` is short for `Foo<'a, 3, dyn Test + 'a>` | ||
// Test is in `const-generics/defaults` because it relies on param ordering | ||
|
||
trait Test {} | ||
|
||
struct A<'a, const N: usize, T: ?Sized + 'a>(&'a T, [(); N]); | ||
fn blah<'a>(mut a: A<'a, 3, dyn Test>, arg: &'a (dyn Test + 'a)) { | ||
a.0 = arg; | ||
} | ||
|
||
fn other_blah<'a>( | ||
mut a: trait_object_lt_defaults_lib::Foo<'a, 3, dyn Test>, | ||
arg: &'a (dyn Test + 'a), | ||
) { | ||
a.0 = arg; | ||
} | ||
|
||
fn main() {} |