-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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 #128438 - Bryanskiy:empty-array-dropck, r=lcnr
Add special-case for [T, 0] in dropck_outlives implements/fixes #110288. r? `@lcnr`
- Loading branch information
Showing
2 changed files
with
32 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
//@ run-pass | ||
|
||
#[allow(dead_code)] | ||
struct Struct<'s>(&'s str); | ||
|
||
impl<'s> Drop for Struct<'s> { | ||
fn drop(&mut self) {} | ||
} | ||
|
||
fn to_array_zero<T>(_: T) -> [T; 0] { | ||
[] | ||
} | ||
|
||
pub fn array_zero_in_tuple() { | ||
let mut x = ([], String::new()); | ||
{ | ||
let s = String::from("temporary"); | ||
let p = Struct(&s); | ||
x.0 = to_array_zero(p); | ||
} | ||
} | ||
|
||
fn main() {} |