Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some regression tests #68236

Merged
merged 4 commits into from
Jan 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions src/test/mir-opt/inline/inline-into-box-place.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// ignore-tidy-linelength
// ignore-wasm32-bare compiled with panic=abort by default
// compile-flags: -Z mir-opt-level=3
#![feature(box_syntax)]

fn main() {
Expand Down
29 changes: 29 additions & 0 deletions src/test/ui/associated-types/issue-64848.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// build-pass

trait AssociatedConstant {
const DATA: ();
}

impl<F, T> AssociatedConstant for F
where
F: FnOnce() -> T,
T: AssociatedConstant,
{
const DATA: () = T::DATA;
}

impl AssociatedConstant for () {
const DATA: () = ();
}

fn foo() -> impl AssociatedConstant {
()
}

fn get_data<T: AssociatedConstant>(_: T) -> &'static () {
&T::DATA
}

fn main() {
get_data(foo);
}
Binary file added src/test/ui/issues/issue-66473.rs
Binary file not shown.
Binary file added src/test/ui/issues/issue-66473.stderr
Binary file not shown.
49 changes: 49 additions & 0 deletions src/test/ui/type-alias-impl-trait/issue-65918.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// build-pass

#![feature(type_alias_impl_trait)]

use std::marker::PhantomData;

/* copied Index and TryFrom for convinience (and simplicity) */
trait MyIndex<T> {
type O;
fn my_index(self) -> Self::O;
}
trait MyFrom<T>: Sized {
type Error;
fn my_from(value: T) -> Result<Self, Self::Error>;
}

/* MCVE starts here */
trait F {}
impl F for () {}
type DummyT<T> = impl F;
fn _dummy_t<T>() -> DummyT<T> {}

struct Phantom1<T>(PhantomData<T>);
struct Phantom2<T>(PhantomData<T>);
struct Scope<T>(Phantom2<DummyT<T>>);

impl<T> Scope<T> {
fn new() -> Self {
unimplemented!()
}
}

impl<T> MyFrom<Phantom2<T>> for Phantom1<T> {
type Error = ();
fn my_from(_: Phantom2<T>) -> Result<Self, Self::Error> {
unimplemented!()
}
}

impl<T: MyFrom<Phantom2<DummyT<U>>>, U> MyIndex<Phantom1<T>> for Scope<U> {
type O = T;
fn my_index(self) -> Self::O {
MyFrom::my_from(self.0).ok().unwrap()
}
}

fn main() {
let _pos: Phantom1<DummyT<()>> = Scope::new().my_index();
}