forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correct fat pointer generation by codegen_rvalue_ref (rust-lang#101)
* Correct fat pointer generation by codegen_rvalue_ref Also restore the SizeAndAlignOfDst regression that now passes. * Respond to code review on correct fat pointer in codegen rvalue ref Co-authored-by: Mark R. Tuttle <mrtuttle@amazon.com>
- Loading branch information
Showing
3 changed files
with
118 additions
and
82 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,33 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
// This is a regression test for size_and_align_of_dst computing the | ||
// size and alignment of a dynamically-sized type like | ||
// Arc<Mutex<dyn Subscriber>>. | ||
// This test still fails with a final coercion error for | ||
// DummySubscriber to dyn Subscriber. | ||
|
||
use std::mem; | ||
use std::sync::Arc; | ||
use std::sync::Mutex; | ||
|
||
pub trait Subscriber { | ||
fn process(&mut self); | ||
fn interest_list(&self); | ||
} | ||
|
||
struct DummySubscriber {} | ||
|
||
impl DummySubscriber { | ||
fn new() -> Self { | ||
DummySubscriber {} | ||
} | ||
} | ||
|
||
impl Subscriber for DummySubscriber { | ||
fn process(&mut self) {} | ||
fn interest_list(&self) {} | ||
} | ||
|
||
fn main() { | ||
let s: Arc<Mutex<dyn Subscriber>> = Arc::new(Mutex::new(DummySubscriber::new())); | ||
} |
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