kill the old auxiliary directory
This commit is contained in:
parent
fbc082dcc6
commit
ce0f73bbc4
|
@ -622,7 +622,6 @@ CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
|
||||||
--rustc-path $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
|
--rustc-path $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
|
||||||
--rustdoc-path $$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
|
--rustdoc-path $$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
|
||||||
--llvm-filecheck $(CFG_LLVM_INST_DIR_$(CFG_BUILD))/bin/FileCheck \
|
--llvm-filecheck $(CFG_LLVM_INST_DIR_$(CFG_BUILD))/bin/FileCheck \
|
||||||
--aux-base $$(S)src/test/auxiliary/ \
|
|
||||||
--stage-id stage$(1)-$(2) \
|
--stage-id stage$(1)-$(2) \
|
||||||
--target $(2) \
|
--target $(2) \
|
||||||
--host $(3) \
|
--host $(3) \
|
||||||
|
|
|
@ -1,55 +0,0 @@
|
||||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
// no-prefer-dynamic
|
|
||||||
|
|
||||||
#![feature(allocator, core_intrinsics, libc)]
|
|
||||||
#![allocator]
|
|
||||||
#![crate_type = "rlib"]
|
|
||||||
#![no_std]
|
|
||||||
|
|
||||||
extern crate libc;
|
|
||||||
|
|
||||||
pub static mut HITS: usize = 0;
|
|
||||||
|
|
||||||
#[no_mangle]
|
|
||||||
pub extern fn __rust_allocate(size: usize, align: usize) -> *mut u8 {
|
|
||||||
unsafe {
|
|
||||||
HITS += 1;
|
|
||||||
libc::malloc(size as libc::size_t) as *mut u8
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[no_mangle]
|
|
||||||
pub extern fn __rust_deallocate(ptr: *mut u8, old_size: usize, align: usize) {
|
|
||||||
unsafe {
|
|
||||||
HITS += 1;
|
|
||||||
libc::free(ptr as *mut _)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[no_mangle]
|
|
||||||
pub extern fn __rust_reallocate(ptr: *mut u8, old_size: usize, size: usize,
|
|
||||||
align: usize) -> *mut u8 {
|
|
||||||
unsafe {
|
|
||||||
libc::realloc(ptr as *mut _, size as libc::size_t) as *mut u8
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[no_mangle]
|
|
||||||
pub extern fn __rust_reallocate_inplace(ptr: *mut u8, old_size: usize,
|
|
||||||
size: usize, align: usize) -> usize {
|
|
||||||
unsafe { core::intrinsics::abort() }
|
|
||||||
}
|
|
||||||
|
|
||||||
#[no_mangle]
|
|
||||||
pub extern fn __rust_usable_size(size: usize, align: usize) -> usize {
|
|
||||||
unsafe { core::intrinsics::abort() }
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
// no-prefer-dynamic
|
|
||||||
|
|
||||||
#![crate_type = "dylib"]
|
|
||||||
|
|
||||||
pub fn foo() {}
|
|
|
@ -1,12 +0,0 @@
|
||||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
pub fn foo() {}
|
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
// no-prefer-dynamic
|
|
||||||
|
|
||||||
#![feature(allocator)]
|
|
||||||
#![allocator]
|
|
||||||
#![crate_type = "rlib"]
|
|
||||||
#![no_std]
|
|
|
@ -1,16 +0,0 @@
|
||||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
// no-prefer-dynamic
|
|
||||||
|
|
||||||
#![feature(allocator)]
|
|
||||||
#![allocator]
|
|
||||||
#![crate_type = "rlib"]
|
|
||||||
#![no_std]
|
|
|
@ -1,19 +0,0 @@
|
||||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
// no-prefer-dynamic
|
|
||||||
|
|
||||||
#![feature(allocator)]
|
|
||||||
#![no_std]
|
|
||||||
#![allocator]
|
|
||||||
#![crate_type = "rlib"]
|
|
||||||
|
|
||||||
extern crate needs_allocator;
|
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
pub trait me {
|
|
||||||
fn me(&self) -> usize;
|
|
||||||
}
|
|
||||||
impl me for usize { fn me(&self) -> usize { *self } }
|
|
|
@ -1,19 +0,0 @@
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#![crate_name="anonexternmod"]
|
|
||||||
#![feature(libc)]
|
|
||||||
|
|
||||||
extern crate libc;
|
|
||||||
|
|
||||||
#[link(name="rust_test_helpers")]
|
|
||||||
extern {
|
|
||||||
pub fn rust_get_test_int() -> libc::intptr_t;
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
pub struct Foo {
|
|
||||||
pub x: isize
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Foo {
|
|
||||||
pub fn new() -> Foo {
|
|
||||||
Foo { x: 3 }
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,46 +0,0 @@
|
||||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#![feature(associated_consts)]
|
|
||||||
|
|
||||||
#![crate_type="lib"]
|
|
||||||
|
|
||||||
// These items are for testing that associated consts work cross-crate.
|
|
||||||
pub trait Foo {
|
|
||||||
const BAR: usize;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct FooNoDefault;
|
|
||||||
|
|
||||||
impl Foo for FooNoDefault {
|
|
||||||
const BAR: usize = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// These test that defaults and default resolution work cross-crate.
|
|
||||||
pub trait FooDefault {
|
|
||||||
const BAR: usize = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct FooOverwriteDefault;
|
|
||||||
|
|
||||||
impl FooDefault for FooOverwriteDefault {
|
|
||||||
const BAR: usize = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct FooUseDefault;
|
|
||||||
|
|
||||||
impl FooDefault for FooUseDefault {}
|
|
||||||
|
|
||||||
// Test inherent impls.
|
|
||||||
pub struct InherentBar;
|
|
||||||
|
|
||||||
impl InherentBar {
|
|
||||||
pub const BAR: usize = 3;
|
|
||||||
}
|
|
|
@ -1,26 +0,0 @@
|
||||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
// Helper for test issue-18048, which tests associated types in a
|
|
||||||
// cross-crate scenario.
|
|
||||||
|
|
||||||
#![crate_type="lib"]
|
|
||||||
|
|
||||||
pub trait Bar: Sized {
|
|
||||||
type T;
|
|
||||||
|
|
||||||
fn get(x: Option<Self>) -> <Self as Bar>::T;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Bar for isize {
|
|
||||||
type T = usize;
|
|
||||||
|
|
||||||
fn get(_: Option<isize>) -> usize { 22 }
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
// force-host
|
|
||||||
|
|
||||||
#![feature(plugin_registrar)]
|
|
||||||
#![feature(rustc_private)]
|
|
||||||
|
|
||||||
extern crate syntax;
|
|
||||||
|
|
||||||
extern crate rustc;
|
|
||||||
extern crate rustc_plugin;
|
|
||||||
|
|
||||||
use syntax::feature_gate::AttributeType;
|
|
||||||
use rustc_plugin::Registry;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#[plugin_registrar]
|
|
||||||
pub fn plugin_registrar(reg: &mut Registry) {
|
|
||||||
reg.register_attribute("foo".to_owned(), AttributeType::Normal);
|
|
||||||
reg.register_attribute("bar".to_owned(), AttributeType::CrateLevel);
|
|
||||||
reg.register_attribute("baz".to_owned(), AttributeType::Whitelisted);
|
|
||||||
}
|
|
|
@ -1,18 +0,0 @@
|
||||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
use std::ops::AddAssign;
|
|
||||||
|
|
||||||
pub struct Int(pub i32);
|
|
||||||
|
|
||||||
impl AddAssign<i32> for Int {
|
|
||||||
fn add_assign(&mut self, _: i32) {
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#![crate_type="lib"]
|
|
||||||
|
|
||||||
pub const X: () = ();
|
|
|
@ -1,13 +0,0 @@
|
||||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#![crate_type="lib"]
|
|
||||||
|
|
||||||
pub const Y: () = ();
|
|
|
@ -1,13 +0,0 @@
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
pub fn foo(x: &usize) -> usize {
|
|
||||||
*x
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
use std::thread;
|
|
||||||
use std::sync::mpsc::{Receiver, channel};
|
|
||||||
|
|
||||||
pub fn foo<T:'static + Send + Clone>(x: T) -> Receiver<T> {
|
|
||||||
let (tx, rx) = channel();
|
|
||||||
thread::spawn(move|| {
|
|
||||||
tx.send(x.clone());
|
|
||||||
});
|
|
||||||
rx
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
pub mod kitties {
|
|
||||||
pub struct cat {
|
|
||||||
meows : usize,
|
|
||||||
|
|
||||||
pub how_hungry : isize,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn cat(in_x : usize, in_y : isize) -> cat {
|
|
||||||
cat {
|
|
||||||
meows: in_x,
|
|
||||||
how_hungry: in_y
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,29 +0,0 @@
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
pub mod kitties {
|
|
||||||
pub struct cat {
|
|
||||||
meows : usize,
|
|
||||||
|
|
||||||
pub how_hungry : isize,
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
impl cat {
|
|
||||||
pub fn speak(&self) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn cat(in_x : usize, in_y : isize) -> cat {
|
|
||||||
cat {
|
|
||||||
meows: in_x,
|
|
||||||
how_hungry: in_y
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,29 +0,0 @@
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
pub mod kitties {
|
|
||||||
pub struct cat {
|
|
||||||
meows : usize,
|
|
||||||
|
|
||||||
pub how_hungry : isize,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl cat {
|
|
||||||
pub fn speak(&mut self) { self.meows += 1; }
|
|
||||||
pub fn meow_count(&mut self) -> usize { self.meows }
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn cat(in_x : usize, in_y : isize) -> cat {
|
|
||||||
cat {
|
|
||||||
meows: in_x,
|
|
||||||
how_hungry: in_y
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,51 +0,0 @@
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
pub mod kitties {
|
|
||||||
pub struct cat {
|
|
||||||
meows : usize,
|
|
||||||
|
|
||||||
pub how_hungry : isize,
|
|
||||||
pub name : String,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl cat {
|
|
||||||
pub fn speak(&mut self) { self.meow(); }
|
|
||||||
|
|
||||||
pub fn eat(&mut self) -> bool {
|
|
||||||
if self.how_hungry > 0 {
|
|
||||||
println!("OM NOM NOM");
|
|
||||||
self.how_hungry -= 2;
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
println!("Not hungry!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl cat {
|
|
||||||
pub fn meow(&mut self) {
|
|
||||||
println!("Meow");
|
|
||||||
self.meows += 1;
|
|
||||||
if self.meows % 5 == 0 {
|
|
||||||
self.how_hungry += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn cat(in_x : usize, in_y : isize, in_name: String) -> cat {
|
|
||||||
cat {
|
|
||||||
meows: in_x,
|
|
||||||
how_hungry: in_y,
|
|
||||||
name: in_name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
pub mod kitties {
|
|
||||||
pub struct cat {
|
|
||||||
meows : usize,
|
|
||||||
pub how_hungry : isize,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl cat {
|
|
||||||
fn nap(&self) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn cat(in_x : usize, in_y : isize) -> cat {
|
|
||||||
cat {
|
|
||||||
meows: in_x,
|
|
||||||
how_hungry: in_y
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,35 +0,0 @@
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
pub mod kitties {
|
|
||||||
|
|
||||||
pub struct cat<U> {
|
|
||||||
info : Vec<U> ,
|
|
||||||
meows : usize,
|
|
||||||
|
|
||||||
pub how_hungry : isize,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<U> cat<U> {
|
|
||||||
pub fn speak<T>(&mut self, stuff: Vec<T> ) {
|
|
||||||
self.meows += stuff.len();
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn meow_count(&mut self) -> usize { self.meows }
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn cat<U>(in_x : usize, in_y : isize, in_info: Vec<U> ) -> cat<U> {
|
|
||||||
cat {
|
|
||||||
meows: in_x,
|
|
||||||
how_hungry: in_y,
|
|
||||||
info: in_info
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,60 +0,0 @@
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
pub mod kitty {
|
|
||||||
use std::fmt;
|
|
||||||
|
|
||||||
pub struct cat {
|
|
||||||
meows : usize,
|
|
||||||
pub how_hungry : isize,
|
|
||||||
pub name : String,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl fmt::Display for cat {
|
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
||||||
write!(f, "{}", self.name)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl cat {
|
|
||||||
fn meow(&mut self) {
|
|
||||||
println!("Meow");
|
|
||||||
self.meows += 1;
|
|
||||||
if self.meows % 5 == 0 {
|
|
||||||
self.how_hungry += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
impl cat {
|
|
||||||
pub fn speak(&mut self) { self.meow(); }
|
|
||||||
|
|
||||||
pub fn eat(&mut self) -> bool {
|
|
||||||
if self.how_hungry > 0 {
|
|
||||||
println!("OM NOM NOM");
|
|
||||||
self.how_hungry -= 2;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
println!("Not hungry!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn cat(in_x : usize, in_y : isize, in_name: String) -> cat {
|
|
||||||
cat {
|
|
||||||
meows: in_x,
|
|
||||||
how_hungry: in_y,
|
|
||||||
name: in_name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
pub mod animals {
|
|
||||||
pub trait noisy {
|
|
||||||
fn speak(&mut self);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
pub extern fn bar() {
|
|
||||||
}
|
|
||||||
|
|
||||||
pub const foopy: &'static str = "hi there";
|
|
||||||
pub const uint_val: usize = 12;
|
|
||||||
pub const uint_expr: usize = (1 << uint_val) - 1;
|
|
|
@ -1,16 +0,0 @@
|
||||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
pub static BLOCK_FN_DEF: fn(usize) -> usize = {
|
|
||||||
fn foo(a: usize) -> usize {
|
|
||||||
a + 10
|
|
||||||
}
|
|
||||||
foo
|
|
||||||
};
|
|
|
@ -1,26 +0,0 @@
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#![crate_name="cci_impl_lib"]
|
|
||||||
|
|
||||||
pub trait uint_helpers {
|
|
||||||
fn to<F>(&self, v: usize, f: F) where F: FnMut(usize);
|
|
||||||
}
|
|
||||||
|
|
||||||
impl uint_helpers for usize {
|
|
||||||
#[inline]
|
|
||||||
fn to<F>(&self, v: usize, mut f: F) where F: FnMut(usize) {
|
|
||||||
let mut i = *self;
|
|
||||||
while i < v {
|
|
||||||
f(i);
|
|
||||||
i += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#![feature(intrinsics)]
|
|
||||||
|
|
||||||
pub mod rusti {
|
|
||||||
extern "rust-intrinsic" {
|
|
||||||
pub fn atomic_xchg<T>(dst: *mut T, src: T) -> T;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline(always)]
|
|
||||||
pub fn atomic_xchg(dst: *mut isize, src: isize) -> isize {
|
|
||||||
unsafe {
|
|
||||||
rusti::atomic_xchg(dst, src)
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#![crate_name="cci_iter_lib"]
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
pub fn iter<T, F>(v: &[T], mut f: F) where F: FnMut(&T) {
|
|
||||||
let mut i = 0;
|
|
||||||
let n = v.len();
|
|
||||||
while i < n {
|
|
||||||
f(&v[i]);
|
|
||||||
i += 1;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,63 +0,0 @@
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#![allow(unknown_features)]
|
|
||||||
#![feature(box_syntax)]
|
|
||||||
|
|
||||||
use std::cell::RefCell;
|
|
||||||
|
|
||||||
pub struct Entry<A,B> {
|
|
||||||
key: A,
|
|
||||||
value: B
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct alist<A,B> {
|
|
||||||
eq_fn: extern "Rust" fn(A,A) -> bool,
|
|
||||||
data: Box<RefCell<Vec<Entry<A,B>>>>,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn alist_add<A:'static,B:'static>(lst: &alist<A,B>, k: A, v: B) {
|
|
||||||
let mut data = lst.data.borrow_mut();
|
|
||||||
(*data).push(Entry{key:k, value:v});
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn alist_get<A:Clone + 'static,
|
|
||||||
B:Clone + 'static>(
|
|
||||||
lst: &alist<A,B>,
|
|
||||||
k: A)
|
|
||||||
-> B {
|
|
||||||
let eq_fn = lst.eq_fn;
|
|
||||||
let data = lst.data.borrow();
|
|
||||||
for entry in &(*data) {
|
|
||||||
if eq_fn(entry.key.clone(), k.clone()) {
|
|
||||||
return entry.value.clone();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
panic!();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
pub fn new_int_alist<B:'static>() -> alist<isize, B> {
|
|
||||||
fn eq_int(a: isize, b: isize) -> bool { a == b }
|
|
||||||
return alist {
|
|
||||||
eq_fn: eq_int,
|
|
||||||
data: box RefCell::new(Vec::new()),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
pub fn new_int_alist_2<B:'static>() -> alist<isize, B> {
|
|
||||||
#[inline]
|
|
||||||
fn eq_int(a: isize, b: isize) -> bool { a == b }
|
|
||||||
return alist {
|
|
||||||
eq_fn: eq_int,
|
|
||||||
data: box RefCell::new(Vec::new()),
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#![crate_name="cci_no_inline_lib"]
|
|
||||||
|
|
||||||
|
|
||||||
// same as cci_iter_lib, more-or-less, but not marked inline
|
|
||||||
pub fn iter<F>(v: Vec<usize> , mut f: F) where F: FnMut(usize) {
|
|
||||||
let mut i = 0;
|
|
||||||
let n = v.len();
|
|
||||||
while i < n {
|
|
||||||
f(v[i]);
|
|
||||||
i += 1;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
// this used to just ICE on compiling
|
|
||||||
pub fn foo() {
|
|
||||||
if cfg!(foo) {
|
|
||||||
static a: isize = 3;
|
|
||||||
a
|
|
||||||
} else { 3 };
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#![crate_type = "lib"]
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
pub fn inlined() {}
|
|
||||||
|
|
||||||
#[inline(always)]
|
|
||||||
pub fn always_inlined() {}
|
|
||||||
|
|
||||||
#[inline(never)]
|
|
||||||
pub fn never_inlined() {}
|
|
|
@ -1,34 +0,0 @@
|
||||||
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#![crate_type = "lib"]
|
|
||||||
|
|
||||||
pub trait Trait : Sized {
|
|
||||||
fn without_self() -> u32;
|
|
||||||
fn without_self_default() -> u32 { 0 }
|
|
||||||
|
|
||||||
fn with_default_impl(self) -> Self { self }
|
|
||||||
fn with_default_impl_generic<T>(self, x: T) -> (Self, T) { (self, x) }
|
|
||||||
|
|
||||||
fn without_default_impl(x: u32) -> (Self, u32);
|
|
||||||
fn without_default_impl_generic<T>(x: T) -> (Self, T);
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Trait for char {
|
|
||||||
fn without_self() -> u32 { 2 }
|
|
||||||
fn without_default_impl(x: u32) -> (Self, u32) { ('c', x) }
|
|
||||||
fn without_default_impl_generic<T>(x: T) -> (Self, T) { ('c', x) }
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Trait for u32 {
|
|
||||||
fn without_self() -> u32 { 1 }
|
|
||||||
fn without_default_impl(x: u32) -> (Self, u32) { (0, x) }
|
|
||||||
fn without_default_impl_generic<T>(x: T) -> (Self, T) { (0, x) }
|
|
||||||
}
|
|
|
@ -1,33 +0,0 @@
|
||||||
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#![crate_type = "lib"]
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
pub fn inlined_fn(x: i32, y: i32) -> i32 {
|
|
||||||
|
|
||||||
let closure = |a, b| { a + b };
|
|
||||||
|
|
||||||
closure(x, y)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn inlined_fn_generic<T>(x: i32, y: i32, z: T) -> (i32, T) {
|
|
||||||
|
|
||||||
let closure = |a, b| { a + b };
|
|
||||||
|
|
||||||
(closure(x, y), z)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn non_inlined_fn(x: i32, y: i32) -> i32 {
|
|
||||||
|
|
||||||
let closure = |a, b| { a + b };
|
|
||||||
|
|
||||||
closure(x, y)
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#![crate_type = "lib"]
|
|
||||||
|
|
||||||
pub struct Struct(pub u32);
|
|
||||||
|
|
||||||
impl Drop for Struct {
|
|
||||||
fn drop(&mut self) {}
|
|
||||||
}
|
|
|
@ -1,37 +0,0 @@
|
||||||
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#![crate_type = "lib"]
|
|
||||||
|
|
||||||
struct Struct(u32);
|
|
||||||
|
|
||||||
#[inline(never)]
|
|
||||||
pub fn foo<T>(x: T) -> (T, u32, i8) {
|
|
||||||
let (x, Struct(y)) = bar(x);
|
|
||||||
(x, y, 2)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline(never)]
|
|
||||||
fn bar<T>(x: T) -> (T, Struct) {
|
|
||||||
let _ = not_exported_and_not_generic(0);
|
|
||||||
(x, Struct(1))
|
|
||||||
}
|
|
||||||
|
|
||||||
// These should not contribute to the codegen items of other crates.
|
|
||||||
#[inline(never)]
|
|
||||||
pub fn exported_but_not_generic(x: i32) -> i64 {
|
|
||||||
x as i64
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline(never)]
|
|
||||||
fn not_exported_and_not_generic(x: u32) -> u64 {
|
|
||||||
x as u64
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
// no-prefer-dynamic
|
|
||||||
// compile-flags: --crate-type=lib
|
|
||||||
|
|
||||||
pub fn id<T>(t: T) -> T {
|
|
||||||
t
|
|
||||||
}
|
|
|
@ -1,25 +0,0 @@
|
||||||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
// no-prefer-dynamic
|
|
||||||
// compile-flags: -Ccodegen-units=2 --crate-type=lib
|
|
||||||
|
|
||||||
extern crate cgu_test;
|
|
||||||
|
|
||||||
pub mod a {
|
|
||||||
pub fn a() {
|
|
||||||
::cgu_test::id(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pub mod b {
|
|
||||||
pub fn a() {
|
|
||||||
::cgu_test::id(0);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,25 +0,0 @@
|
||||||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
// no-prefer-dynamic
|
|
||||||
// compile-flags: -Ccodegen-units=2 --crate-type=lib
|
|
||||||
|
|
||||||
extern crate cgu_test;
|
|
||||||
|
|
||||||
pub mod a {
|
|
||||||
pub fn a() {
|
|
||||||
::cgu_test::id(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pub mod b {
|
|
||||||
pub fn a() {
|
|
||||||
::cgu_test::id(0);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#![crate_name = "a"]
|
|
||||||
|
|
||||||
pub fn foo<T>() {}
|
|
|
@ -1,13 +0,0 @@
|
||||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#![crate_name = "a"]
|
|
||||||
|
|
||||||
pub fn foo<T>() { println!("hello!"); }
|
|
|
@ -1,15 +0,0 @@
|
||||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#![crate_name = "b"]
|
|
||||||
|
|
||||||
extern crate a;
|
|
||||||
|
|
||||||
pub fn foo() { a::foo::<isize>(); }
|
|
|
@ -1,21 +0,0 @@
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
// Helper definition for test/run-pass/check-static-recursion-foreign.rs.
|
|
||||||
|
|
||||||
#![feature(libc)]
|
|
||||||
|
|
||||||
#[crate_id = "check_static_recursion_foreign_helper"]
|
|
||||||
#[crate_type = "lib"]
|
|
||||||
|
|
||||||
extern crate libc;
|
|
||||||
|
|
||||||
#[no_mangle]
|
|
||||||
pub static test_static: libc::c_int = 0;
|
|
|
@ -1,20 +0,0 @@
|
||||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#![crate_type = "rlib"]
|
|
||||||
#![feature(fundamental)]
|
|
||||||
|
|
||||||
pub trait MyCopy { }
|
|
||||||
impl MyCopy for i32 { }
|
|
||||||
|
|
||||||
pub struct MyStruct<T>(T);
|
|
||||||
|
|
||||||
#[fundamental]
|
|
||||||
pub struct MyFundamentalStruct<T>(T);
|
|
|
@ -1,21 +0,0 @@
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
// See coherence_inherent_cc.rs
|
|
||||||
|
|
||||||
pub trait TheTrait {
|
|
||||||
fn the_fn(&self);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct TheStruct;
|
|
||||||
|
|
||||||
impl TheTrait for TheStruct {
|
|
||||||
fn the_fn(&self) {}
|
|
||||||
}
|
|
|
@ -1,25 +0,0 @@
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#![crate_type="lib"]
|
|
||||||
|
|
||||||
pub trait Remote {
|
|
||||||
fn foo(&self) { }
|
|
||||||
}
|
|
||||||
|
|
||||||
pub trait Remote1<T> {
|
|
||||||
fn foo(&self, t: T) { }
|
|
||||||
}
|
|
||||||
|
|
||||||
pub trait Remote2<T, U> {
|
|
||||||
fn foo(&self, t: T, u: U) { }
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct Pair<T,U>(T,U);
|
|
|
@ -1,13 +0,0 @@
|
||||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
pub trait TheTrait<T> {
|
|
||||||
fn the_fn(&self);
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
// Crate that exports a const fn. Used for testing cross-crate.
|
|
||||||
|
|
||||||
#![crate_type="rlib"]
|
|
||||||
#![feature(const_fn)]
|
|
||||||
|
|
||||||
pub const fn foo() -> usize { 22 } //~ ERROR const fn is unstable
|
|
|
@ -1,16 +0,0 @@
|
||||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
// no-prefer-dynamic
|
|
||||||
// compile-flags: --cfg foo
|
|
||||||
|
|
||||||
#![cfg_attr(foo, crate_type="lib")]
|
|
||||||
|
|
||||||
pub fn foo() {}
|
|
|
@ -1,41 +0,0 @@
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#![crate_name="crate_method_reexport_grrrrrrr2"]
|
|
||||||
|
|
||||||
pub use name_pool::add;
|
|
||||||
|
|
||||||
pub mod name_pool {
|
|
||||||
pub type name_pool = ();
|
|
||||||
|
|
||||||
pub trait add {
|
|
||||||
fn add(&self, s: String);
|
|
||||||
}
|
|
||||||
|
|
||||||
impl add for name_pool {
|
|
||||||
fn add(&self, _s: String) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub mod rust {
|
|
||||||
pub use name_pool::add;
|
|
||||||
|
|
||||||
pub type rt = Box<()>;
|
|
||||||
|
|
||||||
pub trait cx {
|
|
||||||
fn cx(&self);
|
|
||||||
}
|
|
||||||
|
|
||||||
impl cx for rt {
|
|
||||||
fn cx(&self) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
pub struct Foo;
|
|
||||||
|
|
||||||
pub trait Bar{}
|
|
||||||
|
|
||||||
pub fn bar() -> Box<Bar> {
|
|
||||||
unimplemented!()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
pub fn try_foo(x: Foo){}
|
|
||||||
pub fn try_bar(x: Box<Bar>){}
|
|
|
@ -1,17 +0,0 @@
|
||||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
pub struct Foo;
|
|
||||||
|
|
||||||
pub trait Bar{}
|
|
||||||
|
|
||||||
pub fn bar() -> Box<Bar> {
|
|
||||||
unimplemented!()
|
|
||||||
}
|
|
|
@ -1,30 +0,0 @@
|
||||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#![crate_type = "rlib"]
|
|
||||||
// no-prefer-dynamic
|
|
||||||
|
|
||||||
// compile-flags: -g
|
|
||||||
|
|
||||||
#[macro_use]
|
|
||||||
mod crate_with_invalid_spans_macros;
|
|
||||||
|
|
||||||
pub fn exported_generic<T>(x: T, y: u32) -> (T, u32) {
|
|
||||||
// Using the add1 macro will produce an invalid span, because the `y` passed
|
|
||||||
// to the macro will have a span from this file, but the rest of the code
|
|
||||||
// generated from the macro will have spans from the macro-defining file.
|
|
||||||
// The AST node for the (1 + y) expression generated by the macro will then
|
|
||||||
// take it's `lo` span bound from the `1` literal in the macro-defining file
|
|
||||||
// and it's `hi` bound from `y` in this file, which should be lower than the
|
|
||||||
// `lo` and even lower than the lower bound of the FileMap it is supposedly
|
|
||||||
// contained in because the FileMap for this file was allocated earlier than
|
|
||||||
// the FileMap of the macro-defining file.
|
|
||||||
return (x, add1!(y));
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
// compile-flags:-C extra-filename=-1
|
|
||||||
#![crate_name = "crateresolve1"]
|
|
||||||
#![crate_type = "lib"]
|
|
||||||
|
|
||||||
pub fn f() -> isize { 10 }
|
|
|
@ -1,15 +0,0 @@
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
// compile-flags:-C extra-filename=-2
|
|
||||||
#![crate_name = "crateresolve1"]
|
|
||||||
#![crate_type = "lib"]
|
|
||||||
|
|
||||||
pub fn f() -> isize { 20 }
|
|
|
@ -1,15 +0,0 @@
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
// compile-flags:-C extra-filename=-3
|
|
||||||
#![crate_name = "crateresolve1"]
|
|
||||||
#![crate_type = "lib"]
|
|
||||||
|
|
||||||
pub fn f() -> isize { 30 }
|
|
|
@ -1,26 +0,0 @@
|
||||||
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
// no-prefer-dynamic
|
|
||||||
#![crate_type = "rlib"]
|
|
||||||
// compile-flags:-g
|
|
||||||
|
|
||||||
struct S1;
|
|
||||||
|
|
||||||
impl S1 {
|
|
||||||
fn f(&mut self) { }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
struct S2;
|
|
||||||
|
|
||||||
impl S2 {
|
|
||||||
fn f(&mut self) { }
|
|
||||||
}
|
|
|
@ -1,29 +0,0 @@
|
||||||
// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#![crate_type = "rlib"]
|
|
||||||
|
|
||||||
#![allow(unused_variables)]
|
|
||||||
#![feature(omit_gdb_pretty_printer_section)]
|
|
||||||
#![omit_gdb_pretty_printer_section]
|
|
||||||
|
|
||||||
// no-prefer-dynamic
|
|
||||||
// compile-flags:-g
|
|
||||||
|
|
||||||
pub fn generic_function<T: Clone>(val: T) -> (T, T) {
|
|
||||||
let result = (val.clone(), val.clone());
|
|
||||||
let a_variable: u32 = 123456789;
|
|
||||||
let another_variable: f64 = 123456789.5;
|
|
||||||
zzz();
|
|
||||||
result
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline(never)]
|
|
||||||
fn zzz() {()}
|
|
|
@ -1,78 +0,0 @@
|
||||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
// force-host
|
|
||||||
|
|
||||||
#![feature(plugin_registrar)]
|
|
||||||
#![feature(box_syntax)]
|
|
||||||
#![feature(rustc_private)]
|
|
||||||
|
|
||||||
extern crate syntax;
|
|
||||||
extern crate syntax_ext;
|
|
||||||
extern crate rustc;
|
|
||||||
extern crate rustc_plugin;
|
|
||||||
|
|
||||||
use syntax::ast;
|
|
||||||
use syntax::codemap::Span;
|
|
||||||
use syntax::ext::base::{MultiDecorator, ExtCtxt, Annotatable};
|
|
||||||
use syntax::ext::build::AstBuilder;
|
|
||||||
use syntax::parse::token;
|
|
||||||
use syntax::ptr::P;
|
|
||||||
use syntax_ext::deriving::generic::{cs_fold, TraitDef, MethodDef, combine_substructure};
|
|
||||||
use syntax_ext::deriving::generic::ty::{Literal, LifetimeBounds, Path, borrowed_explicit_self};
|
|
||||||
use rustc_plugin::Registry;
|
|
||||||
|
|
||||||
#[plugin_registrar]
|
|
||||||
pub fn plugin_registrar(reg: &mut Registry) {
|
|
||||||
reg.register_syntax_extension(
|
|
||||||
token::intern("derive_TotalSum"),
|
|
||||||
MultiDecorator(box expand));
|
|
||||||
}
|
|
||||||
|
|
||||||
fn expand(cx: &mut ExtCtxt,
|
|
||||||
span: Span,
|
|
||||||
mitem: &ast::MetaItem,
|
|
||||||
item: &Annotatable,
|
|
||||||
push: &mut FnMut(Annotatable)) {
|
|
||||||
let trait_def = TraitDef {
|
|
||||||
span: span,
|
|
||||||
attributes: vec![],
|
|
||||||
path: Path::new(vec!["TotalSum"]),
|
|
||||||
additional_bounds: vec![],
|
|
||||||
generics: LifetimeBounds::empty(),
|
|
||||||
associated_types: vec![],
|
|
||||||
is_unsafe: false,
|
|
||||||
methods: vec![
|
|
||||||
MethodDef {
|
|
||||||
name: "total_sum",
|
|
||||||
generics: LifetimeBounds::empty(),
|
|
||||||
explicit_self: borrowed_explicit_self(),
|
|
||||||
args: vec![],
|
|
||||||
ret_ty: Literal(Path::new_local("isize")),
|
|
||||||
attributes: vec![],
|
|
||||||
is_unsafe: false,
|
|
||||||
combine_substructure: combine_substructure(box |cx, span, substr| {
|
|
||||||
let zero = cx.expr_isize(span, 0);
|
|
||||||
cs_fold(false,
|
|
||||||
|cx, span, subexpr, field, _| {
|
|
||||||
cx.expr_binary(span, ast::BinOpKind::Add, subexpr,
|
|
||||||
cx.expr_method_call(span, field,
|
|
||||||
token::str_to_ident("total_sum"), vec![]))
|
|
||||||
},
|
|
||||||
zero,
|
|
||||||
box |cx, span, _, _| { cx.span_bug(span, "wtf??"); },
|
|
||||||
cx, span, substr)
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
||||||
trait_def.expand(cx, mitem, item, push)
|
|
||||||
}
|
|
|
@ -1,91 +0,0 @@
|
||||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
// force-host
|
|
||||||
|
|
||||||
#![feature(plugin_registrar)]
|
|
||||||
#![feature(box_syntax)]
|
|
||||||
#![feature(rustc_private)]
|
|
||||||
|
|
||||||
extern crate syntax;
|
|
||||||
extern crate syntax_ext;
|
|
||||||
extern crate rustc;
|
|
||||||
extern crate rustc_plugin;
|
|
||||||
|
|
||||||
use syntax::ast;
|
|
||||||
use syntax::attr::AttrMetaMethods;
|
|
||||||
use syntax::codemap::Span;
|
|
||||||
use syntax::ext::base::{MultiDecorator, ExtCtxt, Annotatable};
|
|
||||||
use syntax::ext::build::AstBuilder;
|
|
||||||
use syntax::parse::token;
|
|
||||||
use syntax::ptr::P;
|
|
||||||
use syntax_ext::deriving::generic::{cs_fold, TraitDef, MethodDef, combine_substructure};
|
|
||||||
use syntax_ext::deriving::generic::{Substructure, Struct, EnumMatching};
|
|
||||||
use syntax_ext::deriving::generic::ty::{Literal, LifetimeBounds, Path, borrowed_explicit_self};
|
|
||||||
use rustc_plugin::Registry;
|
|
||||||
|
|
||||||
#[plugin_registrar]
|
|
||||||
pub fn plugin_registrar(reg: &mut Registry) {
|
|
||||||
reg.register_syntax_extension(
|
|
||||||
token::intern("derive_TotalSum"),
|
|
||||||
MultiDecorator(box expand));
|
|
||||||
}
|
|
||||||
|
|
||||||
fn expand(cx: &mut ExtCtxt,
|
|
||||||
span: Span,
|
|
||||||
mitem: &ast::MetaItem,
|
|
||||||
item: &Annotatable,
|
|
||||||
push: &mut FnMut(Annotatable)) {
|
|
||||||
let trait_def = TraitDef {
|
|
||||||
span: span,
|
|
||||||
attributes: vec![],
|
|
||||||
path: Path::new(vec!["TotalSum"]),
|
|
||||||
additional_bounds: vec![],
|
|
||||||
generics: LifetimeBounds::empty(),
|
|
||||||
associated_types: vec![],
|
|
||||||
is_unsafe: false,
|
|
||||||
methods: vec![
|
|
||||||
MethodDef {
|
|
||||||
name: "total_sum",
|
|
||||||
generics: LifetimeBounds::empty(),
|
|
||||||
explicit_self: borrowed_explicit_self(),
|
|
||||||
args: vec![],
|
|
||||||
ret_ty: Literal(Path::new_local("isize")),
|
|
||||||
attributes: vec![],
|
|
||||||
is_unsafe: false,
|
|
||||||
combine_substructure: combine_substructure(Box::new(totalsum_substructure)),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
||||||
trait_def.expand(cx, mitem, item, push)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mostly copied from syntax::ext::deriving::hash
|
|
||||||
/// Defines how the implementation for `trace()` is to be generated
|
|
||||||
fn totalsum_substructure(cx: &mut ExtCtxt, trait_span: Span,
|
|
||||||
substr: &Substructure) -> P<ast::Expr> {
|
|
||||||
let fields = match *substr.fields {
|
|
||||||
Struct(_, ref fs) | EnumMatching(_, _, ref fs) => fs,
|
|
||||||
_ => cx.span_bug(trait_span, "impossible substructure")
|
|
||||||
};
|
|
||||||
|
|
||||||
fields.iter().fold(cx.expr_isize(trait_span, 0), |acc, ref item| {
|
|
||||||
if item.attrs.iter().find(|a| a.check_name("ignore")).is_some() {
|
|
||||||
acc
|
|
||||||
} else {
|
|
||||||
cx.expr_binary(item.span, ast::BinOpKind::Add, acc,
|
|
||||||
cx.expr_method_call(item.span,
|
|
||||||
item.self_.clone(),
|
|
||||||
substr.method_ident,
|
|
||||||
Vec::new()))
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#![crate_type = "lib"]
|
|
||||||
#![crate_name = "default_param_test"]
|
|
||||||
#![feature(default_type_parameter_fallback)]
|
|
||||||
|
|
||||||
use std::marker::PhantomData;
|
|
||||||
|
|
||||||
pub struct Foo<A, B>(PhantomData<(A, B)>);
|
|
||||||
|
|
||||||
pub fn bleh<A=i32, X=char>() -> Foo<A, X> { Foo(PhantomData) }
|
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
pub struct Heap;
|
|
||||||
|
|
||||||
pub struct FakeHeap;
|
|
||||||
|
|
||||||
pub struct FakeVec<T, A = FakeHeap> { pub f: Option<(T,A)> }
|
|
|
@ -1,90 +0,0 @@
|
||||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#![feature(deprecated)]
|
|
||||||
|
|
||||||
#[deprecated(since = "1.0.0", note = "text")]
|
|
||||||
pub fn deprecated() {}
|
|
||||||
#[deprecated(since = "1.0.0", note = "text")]
|
|
||||||
pub fn deprecated_text() {}
|
|
||||||
|
|
||||||
pub struct MethodTester;
|
|
||||||
|
|
||||||
impl MethodTester {
|
|
||||||
#[deprecated(since = "1.0.0", note = "text")]
|
|
||||||
pub fn method_deprecated(&self) {}
|
|
||||||
#[deprecated(since = "1.0.0", note = "text")]
|
|
||||||
pub fn method_deprecated_text(&self) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub trait Trait {
|
|
||||||
#[deprecated(since = "1.0.0", note = "text")]
|
|
||||||
fn trait_deprecated(&self) {}
|
|
||||||
#[deprecated(since = "1.0.0", note = "text")]
|
|
||||||
fn trait_deprecated_text(&self) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[deprecated(since = "1.0.0", note = "text")]
|
|
||||||
pub trait DeprecatedTrait { fn dummy(&self) { } }
|
|
||||||
|
|
||||||
impl Trait for MethodTester {}
|
|
||||||
|
|
||||||
#[deprecated(since = "1.0.0", note = "text")]
|
|
||||||
pub struct DeprecatedStruct {
|
|
||||||
pub i: isize
|
|
||||||
}
|
|
||||||
|
|
||||||
#[deprecated(since = "1.0.0", note = "text")]
|
|
||||||
pub struct DeprecatedUnitStruct;
|
|
||||||
|
|
||||||
pub enum Enum {
|
|
||||||
#[deprecated(since = "1.0.0", note = "text")]
|
|
||||||
DeprecatedVariant,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[deprecated(since = "1.0.0", note = "text")]
|
|
||||||
pub struct DeprecatedTupleStruct(pub isize);
|
|
||||||
|
|
||||||
pub struct Stable {
|
|
||||||
#[deprecated(since = "1.0.0", note = "text")]
|
|
||||||
pub override2: u8,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct Stable2(pub u8, pub u8, #[deprecated(since = "1.0.0", note = "text")] pub u8);
|
|
||||||
|
|
||||||
#[deprecated(since = "1.0.0", note = "text")]
|
|
||||||
pub struct Deprecated {
|
|
||||||
pub inherit: u8,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[deprecated(since = "1.0.0", note = "text")]
|
|
||||||
pub struct Deprecated2(pub u8,
|
|
||||||
pub u8,
|
|
||||||
pub u8);
|
|
||||||
|
|
||||||
#[deprecated(since = "1.0.0", note = "text")]
|
|
||||||
pub mod deprecated_mod {
|
|
||||||
pub fn deprecated() {}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! macro_test {
|
|
||||||
() => (deprecated());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! macro_test_arg {
|
|
||||||
($func:expr) => ($func);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! macro_test_arg_nested {
|
|
||||||
($func:ident) => (macro_test_arg!($func()));
|
|
||||||
}
|
|
|
@ -1,40 +0,0 @@
|
||||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
// no-prefer-dynamic
|
|
||||||
|
|
||||||
#![crate_type = "rlib"]
|
|
||||||
#![no_std]
|
|
||||||
|
|
||||||
// Issue #16803
|
|
||||||
|
|
||||||
#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord,
|
|
||||||
Debug, Default, Copy)]
|
|
||||||
pub struct Foo {
|
|
||||||
pub x: u32,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord,
|
|
||||||
Debug, Copy)]
|
|
||||||
pub enum Bar {
|
|
||||||
Qux,
|
|
||||||
Quux(u32),
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord,
|
|
||||||
Debug, Copy)]
|
|
||||||
pub enum Void {}
|
|
||||||
#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord,
|
|
||||||
Debug, Copy)]
|
|
||||||
pub struct Empty;
|
|
||||||
#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord,
|
|
||||||
Debug, Copy)]
|
|
||||||
pub struct AlsoEmpty {}
|
|
||||||
|
|
|
@ -1,55 +0,0 @@
|
||||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
// force-host
|
|
||||||
|
|
||||||
#![feature(plugin_registrar, rustc_private)]
|
|
||||||
#![feature(box_syntax)]
|
|
||||||
|
|
||||||
#[macro_use] extern crate rustc;
|
|
||||||
extern crate rustc_plugin;
|
|
||||||
extern crate rustc_const_math;
|
|
||||||
extern crate syntax;
|
|
||||||
|
|
||||||
use rustc::mir::transform::{self, MirPass};
|
|
||||||
use rustc::mir::repr::{Mir, Literal};
|
|
||||||
use rustc::mir::visit::MutVisitor;
|
|
||||||
use rustc::ty;
|
|
||||||
use rustc::middle::const_val::ConstVal;
|
|
||||||
use rustc_const_math::ConstInt;
|
|
||||||
use rustc_plugin::Registry;
|
|
||||||
|
|
||||||
use syntax::ast::NodeId;
|
|
||||||
|
|
||||||
struct Pass;
|
|
||||||
|
|
||||||
impl transform::Pass for Pass {}
|
|
||||||
impl<'tcx> MirPass<'tcx> for Pass {
|
|
||||||
fn run_pass(&mut self, _: &ty::TyCtxt<'tcx>, _: NodeId, mir: &mut Mir<'tcx>) {
|
|
||||||
Visitor.visit_mir(mir)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct Visitor;
|
|
||||||
|
|
||||||
impl<'tcx> MutVisitor<'tcx> for Visitor {
|
|
||||||
fn visit_literal(&mut self, literal: &mut Literal<'tcx>) {
|
|
||||||
if let Literal::Value { ref mut value } = *literal {
|
|
||||||
if let ConstVal::Integral(ConstInt::I32(ref mut i @ 11)) = *value {
|
|
||||||
*i = 42;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[plugin_registrar]
|
|
||||||
pub fn plugin_registrar(reg: &mut Registry) {
|
|
||||||
reg.register_mir_pass(box Pass);
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
pub struct XEmpty1 {}
|
|
||||||
pub struct XEmpty2;
|
|
||||||
|
|
||||||
pub enum XE {
|
|
||||||
XEmpty3 {},
|
|
||||||
XEmpty4,
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
|
@ -1,25 +0,0 @@
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
pub trait Foo {
|
|
||||||
#[inline(always)]
|
|
||||||
fn f(&self);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct Bar {
|
|
||||||
pub x: String
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Foo for Bar {
|
|
||||||
#[inline(always)]
|
|
||||||
fn f(&self) {
|
|
||||||
println!("{}", (*self).x);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,41 +0,0 @@
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#![crate_name="externcallback"]
|
|
||||||
#![crate_type = "lib"]
|
|
||||||
#![feature(libc)]
|
|
||||||
|
|
||||||
extern crate libc;
|
|
||||||
|
|
||||||
pub mod rustrt {
|
|
||||||
extern crate libc;
|
|
||||||
|
|
||||||
#[link(name = "rust_test_helpers")]
|
|
||||||
extern {
|
|
||||||
pub fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t,
|
|
||||||
data: libc::uintptr_t)
|
|
||||||
-> libc::uintptr_t;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn fact(n: libc::uintptr_t) -> libc::uintptr_t {
|
|
||||||
unsafe {
|
|
||||||
println!("n = {}", n);
|
|
||||||
rustrt::rust_dbg_call(cb, n)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
|
|
||||||
if data == 1 {
|
|
||||||
data
|
|
||||||
} else {
|
|
||||||
fact(data - 1) * data
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
pub extern fn f() -> i32 { 1 }
|
|
||||||
pub extern fn g() -> i32 { 2 }
|
|
||||||
|
|
||||||
pub fn get_f() -> extern fn() -> i32 { f }
|
|
||||||
pub fn get_g() -> extern fn() -> i32 { g }
|
|
|
@ -1,36 +0,0 @@
|
||||||
// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
// Make sure Rust generates the correct calling convention for extern
|
|
||||||
// functions.
|
|
||||||
|
|
||||||
#[inline(never)]
|
|
||||||
#[cfg(target_arch = "x86_64")]
|
|
||||||
pub extern "win64" fn foo(a: isize, b: isize, c: isize, d: isize) {
|
|
||||||
assert_eq!(a, 1);
|
|
||||||
assert_eq!(b, 2);
|
|
||||||
assert_eq!(c, 3);
|
|
||||||
assert_eq!(d, 4);
|
|
||||||
|
|
||||||
println!("a: {}, b: {}, c: {}, d: {}",
|
|
||||||
a, b, c, d)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline(never)]
|
|
||||||
#[cfg(not(target_arch = "x86_64"))]
|
|
||||||
pub extern fn foo(a: isize, b: isize, c: isize, d: isize) {
|
|
||||||
assert_eq!(a, 1);
|
|
||||||
assert_eq!(b, 2);
|
|
||||||
assert_eq!(c, 3);
|
|
||||||
assert_eq!(d, 4);
|
|
||||||
|
|
||||||
println!("a: {}, b: {}, c: {}, d: {}",
|
|
||||||
a, b, c, d)
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#![crate_type="lib"]
|
|
||||||
|
|
||||||
pub mod extern_mod_ordering_lib {
|
|
||||||
pub fn f() {}
|
|
||||||
}
|
|
|
@ -1,23 +0,0 @@
|
||||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
pub static mut DROPPED: bool = false;
|
|
||||||
|
|
||||||
pub struct S {
|
|
||||||
_unsized: [u8]
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Drop for S {
|
|
||||||
fn drop(&mut self) {
|
|
||||||
unsafe {
|
|
||||||
DROPPED = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,12 +0,0 @@
|
||||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#[no_mangle]
|
|
||||||
pub extern fn foo() {}
|
|
|
@ -1,48 +0,0 @@
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#![crate_name="foreign_lib"]
|
|
||||||
|
|
||||||
#![feature(libc)]
|
|
||||||
|
|
||||||
pub mod rustrt {
|
|
||||||
extern crate libc;
|
|
||||||
|
|
||||||
#[link(name = "rust_test_helpers")]
|
|
||||||
extern {
|
|
||||||
pub fn rust_get_test_int() -> libc::intptr_t;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub mod rustrt2 {
|
|
||||||
extern crate libc;
|
|
||||||
|
|
||||||
extern {
|
|
||||||
pub fn rust_get_test_int() -> libc::intptr_t;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub mod rustrt3 {
|
|
||||||
// Different type, but same ABI (on all supported platforms).
|
|
||||||
// Ensures that we don't ICE or trigger LLVM asserts when
|
|
||||||
// importing the same symbol under different types.
|
|
||||||
// See https://github.com/rust-lang/rust/issues/32740.
|
|
||||||
extern {
|
|
||||||
pub fn rust_get_test_int() -> *const u8;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn local_uses() {
|
|
||||||
unsafe {
|
|
||||||
let x = rustrt::rust_get_test_int();
|
|
||||||
assert_eq!(x, rustrt2::rust_get_test_int());
|
|
||||||
assert_eq!(x as *const _, rustrt3::rust_get_test_int());
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,53 +0,0 @@
|
||||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#![feature(specialization)]
|
|
||||||
|
|
||||||
// Common code used for tests that model the Fn/FnMut/FnOnce hierarchy.
|
|
||||||
|
|
||||||
pub trait Go {
|
|
||||||
fn go(&self, arg: isize);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn go<G:Go>(this: &G, arg: isize) {
|
|
||||||
this.go(arg)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub trait GoMut {
|
|
||||||
fn go_mut(&mut self, arg: isize);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn go_mut<G:GoMut>(this: &mut G, arg: isize) {
|
|
||||||
this.go_mut(arg)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub trait GoOnce {
|
|
||||||
fn go_once(self, arg: isize);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn go_once<G:GoOnce>(this: G, arg: isize) {
|
|
||||||
this.go_once(arg)
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<G> GoMut for G
|
|
||||||
where G : Go
|
|
||||||
{
|
|
||||||
default fn go_mut(&mut self, arg: isize) {
|
|
||||||
go(&*self, arg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<G> GoOnce for G
|
|
||||||
where G : GoMut
|
|
||||||
{
|
|
||||||
default fn go_once(mut self, arg: isize) {
|
|
||||||
go_mut(&mut self, arg)
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
// A crate named after a built-in type.
|
|
||||||
|
|
||||||
pub struct Test;
|
|
|
@ -1,19 +0,0 @@
|
||||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#![crate_type = "lib"]
|
|
||||||
|
|
||||||
pub struct Fish {
|
|
||||||
pub x: isize
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Fish {
|
|
||||||
pub fn swim(&self) {}
|
|
||||||
}
|
|
|
@ -1,23 +0,0 @@
|
||||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#![crate_type = "lib"]
|
|
||||||
|
|
||||||
pub struct Fish {
|
|
||||||
pub x: isize
|
|
||||||
}
|
|
||||||
|
|
||||||
mod unexported {
|
|
||||||
use super::Fish;
|
|
||||||
impl PartialEq for Fish {
|
|
||||||
fn eq(&self, _: &Fish) -> bool { true }
|
|
||||||
fn ne(&self, _: &Fish) -> bool { false }
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,56 +0,0 @@
|
||||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
#![crate_name="inherited_stability"]
|
|
||||||
#![crate_type = "lib"]
|
|
||||||
#![unstable(feature = "test_feature", issue = "0")]
|
|
||||||
#![feature(staged_api)]
|
|
||||||
|
|
||||||
pub fn unstable() {}
|
|
||||||
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
|
||||||
pub fn stable() {}
|
|
||||||
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
|
||||||
pub mod stable_mod {
|
|
||||||
#[unstable(feature = "test_feature", issue = "0")]
|
|
||||||
pub fn unstable() {}
|
|
||||||
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
|
||||||
pub fn stable() {}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[unstable(feature = "test_feature", issue = "0")]
|
|
||||||
pub mod unstable_mod {
|
|
||||||
#[stable(feature = "test_feature", since = "1.0.0")]
|
|
||||||
#[rustc_deprecated(since = "1.0.0", reason = "text")]
|
|
||||||
pub fn deprecated() {}
|
|
||||||
|
|
||||||
pub fn unstable() {}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
|
||||||
pub trait Stable {
|
|
||||||
#[unstable(feature = "test_feature", issue = "0")]
|
|
||||||
fn unstable(&self);
|
|
||||||
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
|
||||||
fn stable(&self);
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Stable for usize {
|
|
||||||
fn unstable(&self) {}
|
|
||||||
fn stable(&self) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub enum Unstable {
|
|
||||||
UnstableVariant,
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
|
||||||
StableVariant
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
// compile-flags: -Cmetadata=aux
|
|
||||||
|
|
||||||
pub trait Foo {
|
|
||||||
fn bar(&self);
|
|
||||||
fn foo(&mut self) {}
|
|
||||||
}
|
|
|
@ -1,18 +0,0 @@
|
||||||
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#![crate_name="inline_dtor"]
|
|
||||||
|
|
||||||
pub struct Foo;
|
|
||||||
|
|
||||||
impl Drop for Foo {
|
|
||||||
#[inline]
|
|
||||||
fn drop(&mut self) {}
|
|
||||||
}
|
|
|
@ -1,61 +0,0 @@
|
||||||
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
pub struct A<T> { pub v: T }
|
|
||||||
pub struct B<T> { pub v: T }
|
|
||||||
|
|
||||||
pub mod test {
|
|
||||||
pub struct A<T> { pub v: T }
|
|
||||||
|
|
||||||
impl<T> A<T> {
|
|
||||||
pub fn foo(&self) -> isize {
|
|
||||||
static a: isize = 5;
|
|
||||||
return a
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn bar(&self) -> isize {
|
|
||||||
static a: isize = 6;
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T> A<T> {
|
|
||||||
pub fn foo(&self) -> isize {
|
|
||||||
static a: isize = 1;
|
|
||||||
return a
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn bar(&self) -> isize {
|
|
||||||
static a: isize = 2;
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T> B<T> {
|
|
||||||
pub fn foo(&self) -> isize {
|
|
||||||
static a: isize = 3;
|
|
||||||
return a
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn bar(&self) -> isize {
|
|
||||||
static a: isize = 4;
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn foo() -> isize {
|
|
||||||
let a = A { v: () };
|
|
||||||
let b = B { v: () };
|
|
||||||
let c = test::A { v: () };
|
|
||||||
return a.foo() + a.bar() +
|
|
||||||
b.foo() + b.bar() +
|
|
||||||
c.foo() + c.bar();
|
|
||||||
}
|
|
|
@ -1,102 +0,0 @@
|
||||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#![feature(staged_api, allow_internal_unstable)]
|
|
||||||
#![stable(feature = "stable", since = "1.0.0")]
|
|
||||||
|
|
||||||
#[unstable(feature = "function", issue = "0")]
|
|
||||||
pub fn unstable() {}
|
|
||||||
|
|
||||||
|
|
||||||
#[stable(feature = "stable", since = "1.0.0")]
|
|
||||||
pub struct Foo {
|
|
||||||
#[unstable(feature = "struct_field", issue = "0")]
|
|
||||||
pub x: u8
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Foo {
|
|
||||||
#[unstable(feature = "method", issue = "0")]
|
|
||||||
pub fn method(&self) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[stable(feature = "stable", since = "1.0.0")]
|
|
||||||
pub struct Bar {
|
|
||||||
#[unstable(feature = "struct2_field", issue = "0")]
|
|
||||||
pub x: u8
|
|
||||||
}
|
|
||||||
|
|
||||||
#[stable(feature = "stable", since = "1.0.0")]
|
|
||||||
#[allow_internal_unstable]
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! call_unstable_allow {
|
|
||||||
() => { $crate::unstable() }
|
|
||||||
}
|
|
||||||
|
|
||||||
#[stable(feature = "stable", since = "1.0.0")]
|
|
||||||
#[allow_internal_unstable]
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! construct_unstable_allow {
|
|
||||||
($e: expr) => {
|
|
||||||
$crate::Foo { x: $e }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[stable(feature = "stable", since = "1.0.0")]
|
|
||||||
#[allow_internal_unstable]
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! call_method_allow {
|
|
||||||
($e: expr) => { $e.method() }
|
|
||||||
}
|
|
||||||
|
|
||||||
#[stable(feature = "stable", since = "1.0.0")]
|
|
||||||
#[allow_internal_unstable]
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! access_field_allow {
|
|
||||||
($e: expr) => { $e.x }
|
|
||||||
}
|
|
||||||
|
|
||||||
#[stable(feature = "stable", since = "1.0.0")]
|
|
||||||
#[allow_internal_unstable]
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! pass_through_allow {
|
|
||||||
($e: expr) => { $e }
|
|
||||||
}
|
|
||||||
|
|
||||||
#[stable(feature = "stable", since = "1.0.0")]
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! call_unstable_noallow {
|
|
||||||
() => { $crate::unstable() }
|
|
||||||
}
|
|
||||||
|
|
||||||
#[stable(feature = "stable", since = "1.0.0")]
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! construct_unstable_noallow {
|
|
||||||
($e: expr) => {
|
|
||||||
$crate::Foo { x: $e }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[stable(feature = "stable", since = "1.0.0")]
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! call_method_noallow {
|
|
||||||
($e: expr) => { $e.method() }
|
|
||||||
}
|
|
||||||
|
|
||||||
#[stable(feature = "stable", since = "1.0.0")]
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! access_field_noallow {
|
|
||||||
($e: expr) => { $e.x }
|
|
||||||
}
|
|
||||||
|
|
||||||
#[stable(feature = "stable", since = "1.0.0")]
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! pass_through_noallow {
|
|
||||||
($e: expr) => { $e }
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#![crate_name="issue6919_3"]
|
|
||||||
|
|
||||||
// part of issue-6919.rs
|
|
||||||
|
|
||||||
pub struct C<K> where K: FnOnce() {
|
|
||||||
pub k: K,
|
|
||||||
}
|
|
||||||
|
|
||||||
fn no_op() { }
|
|
||||||
pub const D : C<fn()> = C {
|
|
||||||
k: no_op as fn()
|
|
||||||
};
|
|
|
@ -1,22 +0,0 @@
|
||||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#![feature(unsafe_no_drop_flag)]
|
|
||||||
|
|
||||||
#[unsafe_no_drop_flag]
|
|
||||||
pub struct ZeroLengthThingWithDestructor;
|
|
||||||
impl Drop for ZeroLengthThingWithDestructor {
|
|
||||||
fn drop(&mut self) {}
|
|
||||||
}
|
|
||||||
impl ZeroLengthThingWithDestructor {
|
|
||||||
pub fn new() -> ZeroLengthThingWithDestructor {
|
|
||||||
ZeroLengthThingWithDestructor
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,26 +0,0 @@
|
||||||
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#![deny(dead_code)]
|
|
||||||
|
|
||||||
mod inner {
|
|
||||||
pub trait Trait {
|
|
||||||
fn f(&self) { f(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Trait for isize {}
|
|
||||||
|
|
||||||
fn f() {}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn foo() {
|
|
||||||
let a = &1isize as &inner::Trait;
|
|
||||||
a.f();
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
mod inner {
|
|
||||||
pub trait Trait {
|
|
||||||
fn f(&self) { f(); }
|
|
||||||
fn f_ufcs(&self) { f_ufcs(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Trait for isize {}
|
|
||||||
|
|
||||||
fn f() {}
|
|
||||||
fn f_ufcs() {}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn foo<T: inner::Trait>(t: T) {
|
|
||||||
t.f();
|
|
||||||
}
|
|
||||||
pub fn foo_ufcs<T: inner::Trait>(t: T) {
|
|
||||||
T::f_ufcs(&t);
|
|
||||||
}
|
|
|
@ -1,38 +0,0 @@
|
||||||
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
use inner::Trait;
|
|
||||||
|
|
||||||
mod inner {
|
|
||||||
pub struct Foo;
|
|
||||||
pub trait Trait {
|
|
||||||
fn f(&self);
|
|
||||||
fn f_ufcs(&self);
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Trait for Foo {
|
|
||||||
fn f(&self) { }
|
|
||||||
fn f_ufcs(&self) { }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub trait Outer {
|
|
||||||
fn foo<T: Trait>(&self, t: T) { t.f(); }
|
|
||||||
fn foo_ufcs<T: Trait>(&self, t: T) { T::f(&t); }
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Outer for isize {}
|
|
||||||
|
|
||||||
pub fn foo<T: Outer>(t: T) {
|
|
||||||
t.foo(inner::Foo);
|
|
||||||
}
|
|
||||||
pub fn foo_ufcs<T: Outer>(t: T) {
|
|
||||||
T::foo_ufcs(&t, inner::Foo)
|
|
||||||
}
|
|
|
@ -1,38 +0,0 @@
|
||||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
trait PrivateTrait {
|
|
||||||
fn private_trait_method(&self);
|
|
||||||
fn private_trait_method_ufcs(&self);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct PrivateStruct;
|
|
||||||
|
|
||||||
impl PrivateStruct {
|
|
||||||
fn private_inherent_method(&self) { }
|
|
||||||
fn private_inherent_method_ufcs(&self) { }
|
|
||||||
}
|
|
||||||
|
|
||||||
impl PrivateTrait for PrivateStruct {
|
|
||||||
fn private_trait_method(&self) { }
|
|
||||||
fn private_trait_method_ufcs(&self) { }
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
pub fn public_inlinable_function() {
|
|
||||||
PrivateStruct.private_trait_method();
|
|
||||||
PrivateStruct.private_inherent_method();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
pub fn public_inlinable_function_ufcs() {
|
|
||||||
PrivateStruct::private_trait_method(&PrivateStruct);
|
|
||||||
PrivateStruct::private_inherent_method(&PrivateStruct);
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
pub struct Closed01<F>(pub F);
|
|
||||||
|
|
||||||
pub trait Bar { fn new() -> Self; }
|
|
||||||
|
|
||||||
impl<T: Bar> Bar for Closed01<T> {
|
|
||||||
fn new() -> Closed01<T> { Closed01(Bar::new()) }
|
|
||||||
}
|
|
||||||
impl Bar for f32 { fn new() -> f32 { 1.0 } }
|
|
||||||
|
|
||||||
pub fn random<T: Bar>() -> T { Bar::new() }
|
|
|
@ -1,11 +0,0 @@
|
||||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
pub struct A<'a>(pub &'a isize);
|
|
|
@ -1,11 +0,0 @@
|
||||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#![crate_type = "dylib"]
|
|
|
@ -1,16 +0,0 @@
|
||||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
// no-prefer-dynamic
|
|
||||||
|
|
||||||
#![crate_type = "dylib"]
|
|
||||||
|
|
||||||
extern crate issue_12133_rlib as a;
|
|
||||||
extern crate issue_12133_dylib as b;
|
|
|
@ -1,13 +0,0 @@
|
||||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
// no-prefer-dynamic
|
|
||||||
|
|
||||||
#![crate_type = "rlib"]
|
|
|
@ -1,21 +0,0 @@
|
||||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
#![crate_type="lib"]
|
|
||||||
#![crate_name="issue12660aux"]
|
|
||||||
|
|
||||||
pub use my_mod::{MyStruct, my_fn};
|
|
||||||
|
|
||||||
mod my_mod {
|
|
||||||
pub struct MyStruct;
|
|
||||||
|
|
||||||
pub fn my_fn(my_struct: MyStruct) {
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
// no-prefer-dynamic
|
|
||||||
|
|
||||||
#![crate_type = "dylib"]
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue