For legacy reasons (presumably), Windows does not permit files name aux.
+++ /dev/null
-// 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) }
-}
+++ /dev/null
-// 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)
-}
+++ /dev/null
-// 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
-}
-
--- /dev/null
+// 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) }
+}
--- /dev/null
+// 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)
+}
--- /dev/null
+// 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
+}
+
+++ /dev/null
-// 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() {}
+++ /dev/null
-// 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) {}
-}
+++ /dev/null
-// 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
-}
-
--- /dev/null
+// 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() {}
--- /dev/null
+// 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) {}
+}
--- /dev/null
+// 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
+}
+
+++ /dev/null
-// 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);
-}
+++ /dev/null
-// 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 syntax;
-
-use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass, LateLintPassObject, LintArray};
-use rustc_plugin::Registry;
-use rustc::hir;
-use syntax::attr;
-
-declare_lint!(CRATE_NOT_OKAY, Warn, "crate not marked with #![crate_okay]");
-
-struct Pass;
-
-impl LintPass for Pass {
- fn get_lints(&self) -> LintArray {
- lint_array!(CRATE_NOT_OKAY)
- }
-}
-
-impl LateLintPass for Pass {
- fn check_crate(&mut self, cx: &LateContext, krate: &hir::Crate) {
- if !attr::contains_name(&krate.attrs, "crate_okay") {
- cx.span_lint(CRATE_NOT_OKAY, krate.span,
- "crate is not marked with #![crate_okay]");
- }
- }
-}
-
-#[plugin_registrar]
-pub fn plugin_registrar(reg: &mut Registry) {
- reg.register_late_lint_pass(box Pass as LateLintPassObject);
-}
+++ /dev/null
-// 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(box_syntax, rustc_private)]
-
-// Load rustc as a plugin to get macros
-#[macro_use]
-extern crate rustc;
-extern crate rustc_plugin;
-
-use rustc::hir;
-use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass, LateLintPassObject, LintArray};
-use rustc_plugin::Registry;
-
-declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'");
-
-declare_lint!(PLEASE_LINT, Warn, "Warn about items named 'pleaselintme'");
-
-struct Pass;
-
-impl LintPass for Pass {
- fn get_lints(&self) -> LintArray {
- lint_array!(TEST_LINT, PLEASE_LINT)
- }
-}
-
-impl LateLintPass for Pass {
- fn check_item(&mut self, cx: &LateContext, it: &hir::Item) {
- match &*it.name.as_str() {
- "lintme" => cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'"),
- "pleaselintme" => cx.span_lint(PLEASE_LINT, it.span, "item is named 'pleaselintme'"),
- _ => {}
- }
- }
-}
-
-#[plugin_registrar]
-pub fn plugin_registrar(reg: &mut Registry) {
- reg.register_late_lint_pass(box Pass as LateLintPassObject);
- reg.register_lint_group("lint_me", vec![TEST_LINT, PLEASE_LINT]);
-}
+++ /dev/null
-// 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(box_syntax, rustc_private)]
-
-extern crate syntax;
-
-// Load rustc as a plugin to get macros
-#[macro_use]
-extern crate rustc;
-extern crate rustc_plugin;
-
-use rustc::lint::{EarlyContext, LintContext, LintPass, EarlyLintPass,
- EarlyLintPassObject, LintArray};
-use rustc_plugin::Registry;
-use syntax::ast;
-declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'");
-
-struct Pass;
-
-impl LintPass for Pass {
- fn get_lints(&self) -> LintArray {
- lint_array!(TEST_LINT)
- }
-}
-
-impl EarlyLintPass for Pass {
- fn check_item(&mut self, cx: &EarlyContext, it: &ast::Item) {
- if it.ident.name.as_str() == "lintme" {
- cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'");
- }
- }
-}
-
-#[plugin_registrar]
-pub fn plugin_registrar(reg: &mut Registry) {
- reg.register_early_lint_pass(box Pass as EarlyLintPassObject);
-}
+++ /dev/null
-// 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, rustc_private)]
-
-extern crate syntax;
-extern crate rustc;
-extern crate rustc_plugin;
-
-use syntax::parse::token;
-use syntax::ext::base::MacroRulesTT;
-use rustc_plugin::Registry;
-
-#[plugin_registrar]
-pub fn plugin_registrar(reg: &mut Registry) {
- reg.register_syntax_extension(token::intern("bogus"), MacroRulesTT);
-}
+++ /dev/null
-// 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.
-
-// force-host
-
-#![feature(plugin_registrar, quote, rustc_private)]
-
-extern crate syntax;
-extern crate rustc;
-extern crate rustc_plugin;
-
-use syntax::ast::{self, TokenTree, Item, MetaItem, ImplItem, TraitItem, ItemKind};
-use syntax::codemap::Span;
-use syntax::ext::base::*;
-use syntax::parse::{self, token};
-use syntax::ptr::P;
-use rustc_plugin::Registry;
-
-#[macro_export]
-macro_rules! exported_macro { () => (2) }
-macro_rules! unexported_macro { () => (3) }
-
-#[plugin_registrar]
-pub fn plugin_registrar(reg: &mut Registry) {
- reg.register_macro("make_a_1", expand_make_a_1);
- reg.register_macro("identity", expand_identity);
- reg.register_syntax_extension(
- token::intern("into_multi_foo"),
- // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
- MultiModifier(Box::new(expand_into_foo_multi)));
- reg.register_syntax_extension(
- token::intern("duplicate"),
- // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
- MultiDecorator(Box::new(expand_duplicate)));
-}
-
-fn expand_make_a_1(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree])
- -> Box<MacResult+'static> {
- if !tts.is_empty() {
- cx.span_fatal(sp, "make_a_1 takes no arguments");
- }
- MacEager::expr(quote_expr!(cx, 1))
-}
-
-// See Issue #15750
-fn expand_identity(cx: &mut ExtCtxt, _span: Span, tts: &[TokenTree])
- -> Box<MacResult+'static> {
- // Parse an expression and emit it unchanged.
- let mut parser = parse::new_parser_from_tts(cx.parse_sess(),
- cx.cfg(), tts.to_vec());
- let expr = parser.parse_expr().unwrap();
- MacEager::expr(quote_expr!(&mut *cx, $expr))
-}
-
-fn expand_into_foo_multi(cx: &mut ExtCtxt,
- sp: Span,
- attr: &MetaItem,
- it: Annotatable) -> Annotatable {
- match it {
- Annotatable::Item(it) => {
- Annotatable::Item(P(Item {
- attrs: it.attrs.clone(),
- ..(*quote_item!(cx, enum Foo2 { Bar2, Baz2 }).unwrap()).clone()
- }))
- }
- Annotatable::ImplItem(it) => {
- quote_item!(cx, impl X { fn foo(&self) -> i32 { 42 } }).unwrap().and_then(|i| {
- match i.node {
- ItemKind::Impl(_, _, _, _, _, mut items) => {
- Annotatable::ImplItem(P(items.pop().expect("impl method not found")))
- }
- _ => unreachable!("impl parsed to something other than impl")
- }
- })
- }
- Annotatable::TraitItem(it) => {
- quote_item!(cx, trait X { fn foo(&self) -> i32 { 0 } }).unwrap().and_then(|i| {
- match i.node {
- ItemKind::Trait(_, _, _, mut items) => {
- Annotatable::TraitItem(P(items.pop().expect("trait method not found")))
- }
- _ => unreachable!("trait parsed to something other than trait")
- }
- })
- }
- }
-}
-
-// Create a duplicate of the annotatable, based on the MetaItem
-fn expand_duplicate(cx: &mut ExtCtxt,
- sp: Span,
- mi: &MetaItem,
- it: &Annotatable,
- push: &mut FnMut(Annotatable))
-{
- let copy_name = match mi.node {
- ast::MetaItemKind::List(_, ref xs) => {
- if let ast::MetaItemKind::Word(ref w) = xs[0].node {
- token::str_to_ident(&w)
- } else {
- cx.span_err(mi.span, "Expected word");
- return;
- }
- }
- _ => {
- cx.span_err(mi.span, "Expected list");
- return;
- }
- };
-
- // Duplicate the item but replace its ident by the MetaItem
- match it.clone() {
- Annotatable::Item(it) => {
- let mut new_it = (*it).clone();
- new_it.attrs.clear();
- new_it.ident = copy_name;
- push(Annotatable::Item(P(new_it)));
- }
- Annotatable::ImplItem(it) => {
- let mut new_it = (*it).clone();
- new_it.attrs.clear();
- new_it.ident = copy_name;
- push(Annotatable::ImplItem(P(new_it)));
- }
- Annotatable::TraitItem(tt) => {
- let mut new_it = (*tt).clone();
- new_it.attrs.clear();
- new_it.ident = copy_name;
- push(Annotatable::TraitItem(P(new_it)));
- }
- }
-}
-
-pub fn foo() {}
+++ /dev/null
-// 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"]
-#[macro_export]
-macro_rules! reexported {
- () => ( 3 )
-}
+++ /dev/null
-// 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"]
-#![feature(plugin_registrar, rustc_private)]
-
-extern crate rustc;
-extern crate rustc_plugin;
-
-use rustc_plugin::Registry;
-
-#[plugin_registrar]
-pub fn plugin_registrar(_: &mut Registry) {}
+++ /dev/null
-// 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(associated_consts)]
-
-pub use self::sub::{Bar, Baz};
-
-pub trait Trait {
- fn foo(&self);
- type Assoc;
- const CONST: u32;
-}
-
-struct Foo;
-
-impl Foo {
- pub fn new() {}
-
- pub const C: u32 = 0;
-}
-
-mod sub {
- pub struct Bar;
-
- impl Bar {
- pub fn new() {}
- }
-
- pub enum Baz {}
-
- impl Baz {
- pub fn new() {}
- }
-}
--- /dev/null
+// 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);
+}
--- /dev/null
+// 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 syntax;
+
+use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass, LateLintPassObject, LintArray};
+use rustc_plugin::Registry;
+use rustc::hir;
+use syntax::attr;
+
+declare_lint!(CRATE_NOT_OKAY, Warn, "crate not marked with #![crate_okay]");
+
+struct Pass;
+
+impl LintPass for Pass {
+ fn get_lints(&self) -> LintArray {
+ lint_array!(CRATE_NOT_OKAY)
+ }
+}
+
+impl LateLintPass for Pass {
+ fn check_crate(&mut self, cx: &LateContext, krate: &hir::Crate) {
+ if !attr::contains_name(&krate.attrs, "crate_okay") {
+ cx.span_lint(CRATE_NOT_OKAY, krate.span,
+ "crate is not marked with #![crate_okay]");
+ }
+ }
+}
+
+#[plugin_registrar]
+pub fn plugin_registrar(reg: &mut Registry) {
+ reg.register_late_lint_pass(box Pass as LateLintPassObject);
+}
--- /dev/null
+// 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(box_syntax, rustc_private)]
+
+// Load rustc as a plugin to get macros
+#[macro_use]
+extern crate rustc;
+extern crate rustc_plugin;
+
+use rustc::hir;
+use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass, LateLintPassObject, LintArray};
+use rustc_plugin::Registry;
+
+declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'");
+
+declare_lint!(PLEASE_LINT, Warn, "Warn about items named 'pleaselintme'");
+
+struct Pass;
+
+impl LintPass for Pass {
+ fn get_lints(&self) -> LintArray {
+ lint_array!(TEST_LINT, PLEASE_LINT)
+ }
+}
+
+impl LateLintPass for Pass {
+ fn check_item(&mut self, cx: &LateContext, it: &hir::Item) {
+ match &*it.name.as_str() {
+ "lintme" => cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'"),
+ "pleaselintme" => cx.span_lint(PLEASE_LINT, it.span, "item is named 'pleaselintme'"),
+ _ => {}
+ }
+ }
+}
+
+#[plugin_registrar]
+pub fn plugin_registrar(reg: &mut Registry) {
+ reg.register_late_lint_pass(box Pass as LateLintPassObject);
+ reg.register_lint_group("lint_me", vec![TEST_LINT, PLEASE_LINT]);
+}
--- /dev/null
+// 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(box_syntax, rustc_private)]
+
+extern crate syntax;
+
+// Load rustc as a plugin to get macros
+#[macro_use]
+extern crate rustc;
+extern crate rustc_plugin;
+
+use rustc::lint::{EarlyContext, LintContext, LintPass, EarlyLintPass,
+ EarlyLintPassObject, LintArray};
+use rustc_plugin::Registry;
+use syntax::ast;
+declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'");
+
+struct Pass;
+
+impl LintPass for Pass {
+ fn get_lints(&self) -> LintArray {
+ lint_array!(TEST_LINT)
+ }
+}
+
+impl EarlyLintPass for Pass {
+ fn check_item(&mut self, cx: &EarlyContext, it: &ast::Item) {
+ if it.ident.name.as_str() == "lintme" {
+ cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'");
+ }
+ }
+}
+
+#[plugin_registrar]
+pub fn plugin_registrar(reg: &mut Registry) {
+ reg.register_early_lint_pass(box Pass as EarlyLintPassObject);
+}
--- /dev/null
+// 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, rustc_private)]
+
+extern crate syntax;
+extern crate rustc;
+extern crate rustc_plugin;
+
+use syntax::parse::token;
+use syntax::ext::base::MacroRulesTT;
+use rustc_plugin::Registry;
+
+#[plugin_registrar]
+pub fn plugin_registrar(reg: &mut Registry) {
+ reg.register_syntax_extension(token::intern("bogus"), MacroRulesTT);
+}
--- /dev/null
+// 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.
+
+// force-host
+
+#![feature(plugin_registrar, quote, rustc_private)]
+
+extern crate syntax;
+extern crate rustc;
+extern crate rustc_plugin;
+
+use syntax::ast::{self, TokenTree, Item, MetaItem, ImplItem, TraitItem, ItemKind};
+use syntax::codemap::Span;
+use syntax::ext::base::*;
+use syntax::parse::{self, token};
+use syntax::ptr::P;
+use rustc_plugin::Registry;
+
+#[macro_export]
+macro_rules! exported_macro { () => (2) }
+macro_rules! unexported_macro { () => (3) }
+
+#[plugin_registrar]
+pub fn plugin_registrar(reg: &mut Registry) {
+ reg.register_macro("make_a_1", expand_make_a_1);
+ reg.register_macro("identity", expand_identity);
+ reg.register_syntax_extension(
+ token::intern("into_multi_foo"),
+ // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
+ MultiModifier(Box::new(expand_into_foo_multi)));
+ reg.register_syntax_extension(
+ token::intern("duplicate"),
+ // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
+ MultiDecorator(Box::new(expand_duplicate)));
+}
+
+fn expand_make_a_1(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree])
+ -> Box<MacResult+'static> {
+ if !tts.is_empty() {
+ cx.span_fatal(sp, "make_a_1 takes no arguments");
+ }
+ MacEager::expr(quote_expr!(cx, 1))
+}
+
+// See Issue #15750
+fn expand_identity(cx: &mut ExtCtxt, _span: Span, tts: &[TokenTree])
+ -> Box<MacResult+'static> {
+ // Parse an expression and emit it unchanged.
+ let mut parser = parse::new_parser_from_tts(cx.parse_sess(),
+ cx.cfg(), tts.to_vec());
+ let expr = parser.parse_expr().unwrap();
+ MacEager::expr(quote_expr!(&mut *cx, $expr))
+}
+
+fn expand_into_foo_multi(cx: &mut ExtCtxt,
+ sp: Span,
+ attr: &MetaItem,
+ it: Annotatable) -> Annotatable {
+ match it {
+ Annotatable::Item(it) => {
+ Annotatable::Item(P(Item {
+ attrs: it.attrs.clone(),
+ ..(*quote_item!(cx, enum Foo2 { Bar2, Baz2 }).unwrap()).clone()
+ }))
+ }
+ Annotatable::ImplItem(it) => {
+ quote_item!(cx, impl X { fn foo(&self) -> i32 { 42 } }).unwrap().and_then(|i| {
+ match i.node {
+ ItemKind::Impl(_, _, _, _, _, mut items) => {
+ Annotatable::ImplItem(P(items.pop().expect("impl method not found")))
+ }
+ _ => unreachable!("impl parsed to something other than impl")
+ }
+ })
+ }
+ Annotatable::TraitItem(it) => {
+ quote_item!(cx, trait X { fn foo(&self) -> i32 { 0 } }).unwrap().and_then(|i| {
+ match i.node {
+ ItemKind::Trait(_, _, _, mut items) => {
+ Annotatable::TraitItem(P(items.pop().expect("trait method not found")))
+ }
+ _ => unreachable!("trait parsed to something other than trait")
+ }
+ })
+ }
+ }
+}
+
+// Create a duplicate of the annotatable, based on the MetaItem
+fn expand_duplicate(cx: &mut ExtCtxt,
+ sp: Span,
+ mi: &MetaItem,
+ it: &Annotatable,
+ push: &mut FnMut(Annotatable))
+{
+ let copy_name = match mi.node {
+ ast::MetaItemKind::List(_, ref xs) => {
+ if let ast::MetaItemKind::Word(ref w) = xs[0].node {
+ token::str_to_ident(&w)
+ } else {
+ cx.span_err(mi.span, "Expected word");
+ return;
+ }
+ }
+ _ => {
+ cx.span_err(mi.span, "Expected list");
+ return;
+ }
+ };
+
+ // Duplicate the item but replace its ident by the MetaItem
+ match it.clone() {
+ Annotatable::Item(it) => {
+ let mut new_it = (*it).clone();
+ new_it.attrs.clear();
+ new_it.ident = copy_name;
+ push(Annotatable::Item(P(new_it)));
+ }
+ Annotatable::ImplItem(it) => {
+ let mut new_it = (*it).clone();
+ new_it.attrs.clear();
+ new_it.ident = copy_name;
+ push(Annotatable::ImplItem(P(new_it)));
+ }
+ Annotatable::TraitItem(tt) => {
+ let mut new_it = (*tt).clone();
+ new_it.attrs.clear();
+ new_it.ident = copy_name;
+ push(Annotatable::TraitItem(P(new_it)));
+ }
+ }
+}
+
+pub fn foo() {}
--- /dev/null
+// 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"]
+#[macro_export]
+macro_rules! reexported {
+ () => ( 3 )
+}
--- /dev/null
+// 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"]
+#![feature(plugin_registrar, rustc_private)]
+
+extern crate rustc;
+extern crate rustc_plugin;
+
+use rustc_plugin::Registry;
+
+#[plugin_registrar]
+pub fn plugin_registrar(_: &mut Registry) {}
--- /dev/null
+// 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(associated_consts)]
+
+pub use self::sub::{Bar, Baz};
+
+pub trait Trait {
+ fn foo(&self);
+ type Assoc;
+ const CONST: u32;
+}
+
+struct Foo;
+
+impl Foo {
+ pub fn new() {}
+
+ pub const C: u32 = 0;
+}
+
+mod sub {
+ pub struct Bar;
+
+ impl Bar {
+ pub fn new() {}
+ }
+
+ pub enum Baz {}
+
+ impl Baz {
+ pub fn new() {}
+ }
+}
+++ /dev/null
-// 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() {}
+++ /dev/null
-// 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() {}
-
+++ /dev/null
-// 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]
+++ /dev/null
-// 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]
+++ /dev/null
-// 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;
-
+++ /dev/null
-// 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 } }
+++ /dev/null
-// 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
- }
- }
-}
+++ /dev/null
-// 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
- }
- }
-}
+++ /dev/null
-// 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>() {}
+++ /dev/null
-// 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!"); }
+++ /dev/null
-// 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>(); }
+++ /dev/null
-// 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);
+++ /dev/null
-// 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) {}
-}
+++ /dev/null
-// 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);
+++ /dev/null
-// 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);
-}
+++ /dev/null
-// 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
+++ /dev/null
-// 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>){}
+++ /dev/null
-// 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!()
-}
+++ /dev/null
-// 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 }
+++ /dev/null
-// 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 }
+++ /dev/null
-// 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 }
+++ /dev/null
-// 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) }
-
+++ /dev/null
-// 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()));
-}
+++ /dev/null
-// 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,
-}
+++ /dev/null
-// 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)
- }
-}
+++ /dev/null
-// 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
-}
+++ /dev/null
-// 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 }
-}
+++ /dev/null
-// 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"]
-
-#[macro_export]
-macro_rules! mywrite {
- ($dst:expr, $($arg:tt)*) => ($dst.write_fmt(format_args!($($arg)*)))
-}
+++ /dev/null
-// 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.
-
-// include file for issue-21146.rs
-
-parse_error
+++ /dev/null
-// 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.
-
-// testing whether the lookup mechanism picks up types
-// defined in the outside crate
-
-#![crate_type="lib"]
-
-pub mod outer {
- // should suggest this
- pub trait OuterTrait {}
-
- // should not suggest this since the module is private
- mod private_module {
- pub trait OuterTrait {}
- }
-
- // should not suggest since the trait is private
- pub mod public_module {
- trait OuterTrait {}
- }
-}
+++ /dev/null
-// 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.
-
-// testing whether the lookup mechanism picks up types
-// defined in the outside crate
-
-#![crate_type="lib"]
-
-mod foo {
- // should not be suggested => foo is private
- pub trait T {}
-}
-
-// should be suggested
-pub use foo::T;
+++ /dev/null
-// 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 mod foo {
- pub use super::*;
-}
+++ /dev/null
-// 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.
-
-#![crate_type="lib"]
-
-pub enum Foo {
- FooV { data: () }
-}
+++ /dev/null
-// 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.
-
-enum Foo {
- Bar(isize)
-}
-
-pub mod test {
- enum Foo {
- Bar(isize)
- }
-}
+++ /dev/null
-// 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 mod bar {
- pub fn foo() {}
-}
+++ /dev/null
-// 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.
-
-extern {
- fn bar();
-}
+++ /dev/null
-// 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 use foo::FOO2;
-
-pub const FOO: usize = 3;
-const BAR: usize = 3;
-
-mod foo {
- pub const FOO2: usize = 3;
-}
+++ /dev/null
-// 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 mod A {
- pub struct Foo;
- impl Foo {
- fn foo(&self) { }
- }
-}
+++ /dev/null
-// 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::marker::PhantomData;
-
-pub struct Directed;
-pub struct Undirected;
-
-pub struct Graph<N, E, Ty = Directed> {
- nodes: Vec<PhantomData<N>>,
- edges: Vec<PhantomData<E>>,
- ty: PhantomData<Ty>,
-}
-
-
-impl<N, E> Graph<N, E, Directed> {
- pub fn new() -> Self {
- Graph{nodes: Vec::new(), edges: Vec::new(), ty: PhantomData}
- }
-}
-
-impl<N, E> Graph<N, E, Undirected> {
- pub fn new_undirected() -> Self {
- Graph{nodes: Vec::new(), edges: Vec::new(), ty: PhantomData}
- }
-}
+++ /dev/null
-// 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 trait Foo {
- fn bar();
-}
+++ /dev/null
-// 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.
-
-#![feature(libc)]
-
-extern crate libc;
-
-extern "C" {
- pub fn rand() -> libc::c_int;
-}
+++ /dev/null
-// 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 = "rlib"]
-
-// Helper for testing that we get suitable warnings when lifetime
-// bound change will cause breakage.
-
-pub fn just_ref(x: &Fn()) {
-}
-
-pub fn ref_obj(x: &Box<Fn()>) {
- // this will change to &Box<Fn()+'static>...
-}
+++ /dev/null
-// 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="lint_output_format"]
-#![crate_type = "lib"]
-#![feature(staged_api)]
-#![unstable(feature = "test_feature", issue = "0")]
-
-#[stable(feature = "test_feature", since = "1.0.0")]
-#[rustc_deprecated(since = "1.0.0", reason = "text")]
-pub fn foo() -> usize {
- 20
-}
-
-#[unstable(feature = "test_feature", issue = "0")]
-pub fn bar() -> usize {
- 40
-}
-
-#[unstable(feature = "test_feature", issue = "0")]
-pub fn baz() -> usize {
- 30
-}
+++ /dev/null
-// 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="lint_stability"]
-#![crate_type = "lib"]
-#![feature(staged_api)]
-#![stable(feature = "lint_stability", since = "1.0.0")]
-
-#[stable(feature = "test_feature", since = "1.0.0")]
-#[rustc_deprecated(since = "1.0.0", reason = "text")]
-pub fn deprecated() {}
-#[stable(feature = "test_feature", since = "1.0.0")]
-#[rustc_deprecated(since = "1.0.0", reason = "text")]
-pub fn deprecated_text() {}
-
-#[unstable(feature = "test_feature", issue = "0")]
-#[rustc_deprecated(since = "1.0.0", reason = "text")]
-pub fn deprecated_unstable() {}
-#[unstable(feature = "test_feature", issue = "0")]
-#[rustc_deprecated(since = "1.0.0", reason = "text")]
-pub fn deprecated_unstable_text() {}
-
-#[unstable(feature = "test_feature", issue = "0")]
-pub fn unstable() {}
-#[unstable(feature = "test_feature", reason = "text", issue = "0")]
-pub fn unstable_text() {}
-
-#[stable(feature = "rust1", since = "1.0.0")]
-pub fn stable() {}
-#[stable(feature = "rust1", since = "1.0.0")]
-pub fn stable_text() {}
-
-#[stable(feature = "rust1", since = "1.0.0")]
-pub struct MethodTester;
-
-impl MethodTester {
- #[stable(feature = "test_feature", since = "1.0.0")]
- #[rustc_deprecated(since = "1.0.0", reason = "text")]
- pub fn method_deprecated(&self) {}
- #[stable(feature = "test_feature", since = "1.0.0")]
- #[rustc_deprecated(since = "1.0.0", reason = "text")]
- pub fn method_deprecated_text(&self) {}
-
- #[unstable(feature = "test_feature", issue = "0")]
- #[rustc_deprecated(since = "1.0.0", reason = "text")]
- pub fn method_deprecated_unstable(&self) {}
- #[unstable(feature = "test_feature", issue = "0")]
- #[rustc_deprecated(since = "1.0.0", reason = "text")]
- pub fn method_deprecated_unstable_text(&self) {}
-
- #[unstable(feature = "test_feature", issue = "0")]
- pub fn method_unstable(&self) {}
- #[unstable(feature = "test_feature", reason = "text", issue = "0")]
- pub fn method_unstable_text(&self) {}
-
- #[stable(feature = "rust1", since = "1.0.0")]
- pub fn method_stable(&self) {}
- #[stable(feature = "rust1", since = "1.0.0")]
- pub fn method_stable_text(&self) {}
-}
-
-#[stable(feature = "test_feature", since = "1.0.0")]
-pub trait Trait {
- #[stable(feature = "test_feature", since = "1.0.0")]
- #[rustc_deprecated(since = "1.0.0", reason = "text")]
- fn trait_deprecated(&self) {}
- #[stable(feature = "test_feature", since = "1.0.0")]
- #[rustc_deprecated(since = "1.0.0", reason = "text")]
- fn trait_deprecated_text(&self) {}
-
- #[unstable(feature = "test_feature", issue = "0")]
- #[rustc_deprecated(since = "1.0.0", reason = "text")]
- fn trait_deprecated_unstable(&self) {}
- #[unstable(feature = "test_feature", issue = "0")]
- #[rustc_deprecated(since = "1.0.0", reason = "text")]
- fn trait_deprecated_unstable_text(&self) {}
-
- #[unstable(feature = "test_feature", issue = "0")]
- fn trait_unstable(&self) {}
- #[unstable(feature = "test_feature", reason = "text", issue = "0")]
- fn trait_unstable_text(&self) {}
-
- #[stable(feature = "rust1", since = "1.0.0")]
- fn trait_stable(&self) {}
- #[stable(feature = "rust1", since = "1.0.0")]
- fn trait_stable_text(&self) {}
-}
-
-#[stable(feature = "test_feature", since = "1.0.0")]
-impl Trait for MethodTester {}
-
-#[unstable(feature = "test_feature", issue = "0")]
-pub trait UnstableTrait { fn dummy(&self) { } }
-
-#[stable(feature = "test_feature", since = "1.0.0")]
-#[rustc_deprecated(since = "1.0.0", reason = "text")]
-pub trait DeprecatedTrait {
- #[stable(feature = "test_feature", since = "1.0.0")] fn dummy(&self) { }
-}
-
-#[stable(feature = "test_feature", since = "1.0.0")]
-#[rustc_deprecated(since = "1.0.0", reason = "text")]
-pub struct DeprecatedStruct {
- #[stable(feature = "test_feature", since = "1.0.0")] pub i: isize
-}
-#[unstable(feature = "test_feature", issue = "0")]
-#[rustc_deprecated(since = "1.0.0", reason = "text")]
-pub struct DeprecatedUnstableStruct {
- #[stable(feature = "test_feature", since = "1.0.0")] pub i: isize
-}
-#[unstable(feature = "test_feature", issue = "0")]
-pub struct UnstableStruct {
- #[stable(feature = "test_feature", since = "1.0.0")] pub i: isize
-}
-#[stable(feature = "rust1", since = "1.0.0")]
-pub struct StableStruct {
- #[stable(feature = "test_feature", since = "1.0.0")] pub i: isize
-}
-
-#[stable(feature = "test_feature", since = "1.0.0")]
-#[rustc_deprecated(since = "1.0.0", reason = "text")]
-pub struct DeprecatedUnitStruct;
-#[unstable(feature = "test_feature", issue = "0")]
-#[rustc_deprecated(since = "1.0.0", reason = "text")]
-pub struct DeprecatedUnstableUnitStruct;
-#[unstable(feature = "test_feature", issue = "0")]
-pub struct UnstableUnitStruct;
-#[stable(feature = "rust1", since = "1.0.0")]
-pub struct StableUnitStruct;
-
-#[stable(feature = "test_feature", since = "1.0.0")]
-pub enum Enum {
- #[stable(feature = "test_feature", since = "1.0.0")]
- #[rustc_deprecated(since = "1.0.0", reason = "text")]
- DeprecatedVariant,
- #[unstable(feature = "test_feature", issue = "0")]
- #[rustc_deprecated(since = "1.0.0", reason = "text")]
- DeprecatedUnstableVariant,
- #[unstable(feature = "test_feature", issue = "0")]
- UnstableVariant,
-
- #[stable(feature = "rust1", since = "1.0.0")]
- StableVariant,
-}
-
-#[stable(feature = "test_feature", since = "1.0.0")]
-#[rustc_deprecated(since = "1.0.0", reason = "text")]
-pub struct DeprecatedTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);
-#[unstable(feature = "test_feature", issue = "0")]
-#[rustc_deprecated(since = "1.0.0", reason = "text")]
-pub struct DeprecatedUnstableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);
-#[unstable(feature = "test_feature", issue = "0")]
-pub struct UnstableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);
-#[stable(feature = "rust1", since = "1.0.0")]
-pub struct StableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);
-
-#[stable(feature = "test_feature", since = "1.0.0")]
-#[macro_export]
-macro_rules! macro_test {
- () => (deprecated());
-}
-
-#[stable(feature = "test_feature", since = "1.0.0")]
-#[macro_export]
-macro_rules! macro_test_arg {
- ($func:expr) => ($func);
-}
-
-#[stable(feature = "test_feature", since = "1.0.0")]
-#[macro_export]
-macro_rules! macro_test_arg_nested {
- ($func:ident) => (macro_test_arg!($func()));
-}
+++ /dev/null
-// 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)]
-#![stable(feature = "rust1", since = "1.0.0")]
-
-#[stable(feature = "rust1", since = "1.0.0")]
-pub struct Stable {
- #[stable(feature = "rust1", since = "1.0.0")]
- pub inherit: u8, // it's a lie (stable doesn't inherit)
- #[unstable(feature = "test_feature", issue = "0")]
- pub override1: u8,
- #[rustc_deprecated(since = "1.0.0", reason = "text")]
- #[unstable(feature = "test_feature", issue = "0")]
- pub override2: u8,
-}
-
-#[stable(feature = "rust1", since = "1.0.0")]
-pub struct Stable2(#[stable(feature = "rust1", since = "1.0.0")] pub u8,
- #[unstable(feature = "test_feature", issue = "0")] pub u8,
- #[unstable(feature = "test_feature", issue = "0")]
- #[rustc_deprecated(since = "1.0.0", reason = "text")] pub u8);
-
-#[unstable(feature = "test_feature", issue = "0")]
-pub struct Unstable {
- pub inherit: u8,
- #[stable(feature = "rust1", since = "1.0.0")]
- pub override1: u8,
- #[rustc_deprecated(since = "1.0.0", reason = "text")]
- #[unstable(feature = "test_feature", issue = "0")]
- pub override2: u8,
-}
-
-#[unstable(feature = "test_feature", issue = "0")]
-pub struct Unstable2(pub u8,
- #[stable(feature = "rust1", since = "1.0.0")] pub u8,
- #[unstable(feature = "test_feature", issue = "0")]
- #[rustc_deprecated(since = "1.0.0", reason = "text")] pub u8);
-
-#[unstable(feature = "test_feature", issue = "0")]
-#[rustc_deprecated(since = "1.0.0", reason = "text")]
-pub struct Deprecated {
- pub inherit: u8,
- #[stable(feature = "rust1", since = "1.0.0")]
- pub override1: u8,
- #[unstable(feature = "test_feature", issue = "0")]
- pub override2: u8,
-}
-
-#[unstable(feature = "test_feature", issue = "0")]
-#[rustc_deprecated(since = "1.0.0", reason = "text")]
-pub struct Deprecated2(pub u8,
- #[stable(feature = "rust1", since = "1.0.0")] pub u8,
- #[unstable(feature = "test_feature", issue = "0")] pub u8);
+++ /dev/null
-// 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 fn foo() {}
+++ /dev/null
-// 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 fn increment(x: usize) -> usize {
- x + 1
-}
-
-#[macro_export]
-macro_rules! increment {
- ($x:expr) => ($crate::increment($x))
-}
-
-pub fn check_local() {
- assert_eq!(increment!(3), 4);
-}
+++ /dev/null
-// 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 = "dylib"]
-
-// Since we load a serialized macro with all its attributes, accidentally
-// re-exporting a `#[macro_export] macro_rules!` is something of a concern!
-//
-// We avoid it at the moment only because of the order in which we do things.
-
-#[macro_use] #[no_link]
-extern crate macro_reexport_1;
+++ /dev/null
-// 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"]
-#[macro_export]
-macro_rules! reexported {
- () => ( 3 )
-}
+++ /dev/null
-// 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 enum Foo {
- A,
- B(isize),
- C { a: isize },
-}
-
-impl Foo {
- pub fn foo() {}
- pub fn bar(&self) {}
-}
+++ /dev/null
-// 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(needs_allocator)]
-#![no_std]
-#![needs_allocator]
-#![crate_type = "rlib"]
+++ /dev/null
-// 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 use reexport::Reexported;
-
-pub struct Foo;
-pub enum Bar { X }
-
-pub mod foo {
- pub trait PubPub {
- fn method(&self) {}
-
- fn method3(&self) {}
- }
-
- impl PubPub for u32 {}
- impl PubPub for i32 {}
-}
-pub mod bar {
- trait PubPriv {
- fn method(&self);
- }
-}
-mod qux {
- pub trait PrivPub {
- fn method(&self);
- }
-}
-mod quz {
- trait PrivPriv {
- fn method(&self);
- }
-}
-
-mod reexport {
- pub trait Reexported {
- fn method(&self);
- }
-}
+++ /dev/null
-// 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 type oint = Option<isize>;
-pub fn foo() -> oint { Some(3) }
+++ /dev/null
-// 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 trait RemoteTrait { fn dummy(&self) { } }
+++ /dev/null
-// 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(());
-pub struct B(isize);
-pub struct C(pub isize, isize);
-pub struct D(pub isize);
+++ /dev/null
-// 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.
-
-trait Foo {}
+++ /dev/null
-// 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 ARRAY: &'static [u8] = &[1];
+++ /dev/null
-// 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.
-
-// Check that method bounds declared on traits/impls in a cross-crate
-// scenario work. This is the library portion of the test.
-
-pub enum MaybeOwned<'a> {
- Owned(isize),
- Borrowed(&'a isize)
-}
-
-pub struct Inv<'a> { // invariant w/r/t 'a
- x: &'a mut &'a isize
-}
-
-// I encountered a bug at some point with encoding the IntoMaybeOwned
-// trait, so I'll use that as the template for this test.
-pub trait IntoMaybeOwned<'a> {
- fn into_maybe_owned(self) -> MaybeOwned<'a>;
-
- // Note: without this `into_inv` method, the trait is
- // contravariant w/r/t `'a`, since if you look strictly at the
- // interface, it only returns `'a`. This complicates the
- // downstream test since it wants invariance to force an error.
- // Hence we add this method.
- fn into_inv(self) -> Inv<'a>;
-
- fn bigger_region<'b:'a>(self, b: Inv<'b>);
-}
-
-impl<'a> IntoMaybeOwned<'a> for Inv<'a> {
- fn into_maybe_owned(self) -> MaybeOwned<'a> { panic!() }
- fn into_inv(self) -> Inv<'a> { panic!() }
- fn bigger_region<'b:'a>(self, b: Inv<'b>) { panic!() }
-}
+++ /dev/null
-// 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)]
-#![stable(feature = "foo", since = "1.2.0")]
-
-
-#[unstable(feature = "foo", issue = "1")]
-pub fn unstable() {}
-
-#[unstable(feature = "foo", reason = "message", issue = "2")]
-pub fn unstable_msg() {}
+++ /dev/null
-// 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.
-
-#![cfg_attr(foo, experimental)]
-#![cfg_attr(not(foo), stable(feature = "test_feature", since = "1.0.0"))]
-#![feature(staged_api)]
+++ /dev/null
-// 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.
-
-// compile-flags:--cfg foo
-
-#![cfg_attr(foo, unstable(feature = "test_feature", issue = "0"))]
-#![cfg_attr(not(foo), stable(feature = "test_feature", since = "1.0.0"))]
-#![feature(staged_api)]
+++ /dev/null
-// 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_type = "lib"]
-
-static private: isize = 0;
-pub static public: isize = 0;
-
-pub struct A(());
-
-impl A {
- fn foo() {}
-}
-
-mod foo {
- pub static a: isize = 0;
- pub fn b() {}
- pub struct c;
- pub enum d {}
- pub type e = isize;
-
- pub struct A(());
-
- impl A {
- fn foo() {}
- }
-
- // these are public so the parent can reexport them.
- pub static reexported_a: isize = 0;
- pub fn reexported_b() {}
- pub struct reexported_c;
- pub enum reexported_d {}
- pub type reexported_e = isize;
-}
-
-pub mod bar {
- pub use foo::reexported_a as e;
- pub use foo::reexported_b as f;
- pub use foo::reexported_c as g;
- pub use foo::reexported_d as h;
- pub use foo::reexported_e as i;
-}
-
-pub static a: isize = 0;
-pub fn b() {}
-pub struct c;
-pub enum d {}
-pub type e = isize;
-
-static j: isize = 0;
-fn k() {}
-struct l;
-enum m {}
-type n = isize;
+++ /dev/null
-// 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: isize,
- pub b: isize,
-}
-
-pub struct B {
- pub a: isize,
- b: isize,
-}
+++ /dev/null
-// 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.
-
-enum Bar {
- Baz { a: isize }
-}
+++ /dev/null
-// 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.
-
-//! The `svh-a-*.rs` files are all deviations from the base file
-//! svh-a-base.rs with some difference (usually in `fn foo`) that
-//! should not affect the strict version hash (SVH) computation
-//! (#14132).
-
-#![crate_name = "a"]
-
-macro_rules! three {
- () => { 3 }
-}
-
-pub trait U {}
-pub trait V {}
-impl U for () {}
-impl V for () {}
-
-static A_CONSTANT : isize = 2;
-
-pub fn foo<T:U>(_: isize) -> isize {
- 3
-}
-
-pub fn an_unused_name() -> isize {
- 4
-}
+++ /dev/null
-// 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.
-
-//! The `svh-a-*.rs` files are all deviations from the base file
-//! svh-a-base.rs with some difference (usually in `fn foo`) that
-//! should not affect the strict version hash (SVH) computation
-//! (#14132).
-
-#![crate_name = "a"]
-
-macro_rules! three {
- () => { 3 }
-}
-
-pub trait U {}
-pub trait V {}
-impl U for () {}
-impl V for () {}
-
-static A_CONSTANT : isize = 2;
-
-pub fn foo<T:U>(_: isize) -> isize {
- 0
-}
-
-pub fn an_unused_name() -> isize {
- 4
-}
+++ /dev/null
-// 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.
-
-//! The `svh-a-*.rs` files are all deviations from the base file
-//! svh-a-base.rs with some difference (usually in `fn foo`) that
-//! should not affect the strict version hash (SVH) computation
-//! (#14132).
-
-#![crate_name = "a"]
-
-macro_rules! three {
- () => { 3 }
-}
-
-pub trait U {}
-pub trait V {}
-impl U for () {}
-impl V for () {}
-
-static A_CONSTANT : isize = 2;
-
-#[cfg(some_flag)]
-pub fn foo<T:U>(_: isize) -> isize {
- 3
-}
-
-#[cfg(not(some_flag))]
-pub fn an_unused_name() -> isize {
- 4
-}
+++ /dev/null
-// 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.
-
-//! The `svh-a-*.rs` files are all deviations from the base file
-//! svh-a-base.rs with some difference (usually in `fn foo`) that
-//! should not affect the strict version hash (SVH) computation
-//! (#14132).
-
-#![crate_name = "a"]
-
-macro_rules! three {
- () => { 3 }
-}
-
-pub trait U {}
-pub trait V {}
-impl U for () {}
-impl V for () {}
-
-static A_CONSTANT : isize = 2;
-
-pub fn foo<T:V>(_: isize) -> isize {
- 3
-}
-
-pub fn an_unused_name() -> isize {
- 4
-}
+++ /dev/null
-// 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.
-
-//! The `svh-a-*.rs` files are all deviations from the base file
-//! svh-a-base.rs with some difference (usually in `fn foo`) that
-//! should not affect the strict version hash (SVH) computation
-//! (#14132).
-
-#![crate_name = "a"]
-
-macro_rules! three {
- () => { 3 }
-}
-
-pub trait U {}
-pub trait V {}
-impl U for () {}
-impl V for () {}
-
-static A_CONSTANT : isize = 2;
-
-pub fn foo<T:U>(_: i32) -> isize {
- 3
-}
-
-pub fn an_unused_name() -> isize {
- 4
-}
+++ /dev/null
-// 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.
-
-//! The `svh-a-*.rs` files are all deviations from the base file
-//! svh-a-base.rs with some difference (usually in `fn foo`) that
-//! should not affect the strict version hash (SVH) computation
-//! (#14132).
-
-#![crate_name = "a"]
-
-macro_rules! three {
- () => { 3 }
-}
-
-pub trait U {}
-pub trait V {}
-impl U for () {}
-impl V for () {}
-
-static A_CONSTANT : isize = 2;
-
-pub fn foo<T:U>(_: isize) -> i64 {
- 3
-}
-
-pub fn an_unused_name() -> i32 {
- 4
-}
+++ /dev/null
-// 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.
-
-//! The `svh-a-*.rs` files are all deviations from the base file
-//! svh-a-base.rs with some difference (usually in `fn foo`) that
-//! should not affect the strict version hash (SVH) computation
-//! (#14132).
-
-#![crate_name = "a"]
-#![feature(core)]
-
-macro_rules! three {
- () => { 3 }
-}
-
-pub trait U {}
-pub trait V {}
-impl U for () {}
-impl V for () {}
-
-static A_CONSTANT : i32 = 2;
-
-pub fn foo<T:U>(_: isize) -> isize {
- 3
-}
-
-pub fn an_unused_name() -> isize {
- 4
-}
+++ /dev/null
-// 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.
-
-//! This is a client of the `a` crate defined in "svn-a-base.rs". The
-//! rpass and cfail tests (such as "run-pass/svh-add-comment.rs") use
-//! it by swapping in a different object code library crate built from
-//! some variant of "svn-a-base.rs", and then we are checking if the
-//! compiler properly ignores or accepts the change, based on whether
-//! the change could affect the downstream crate content or not
-//! (#14132).
-
-#![crate_name = "b"]
-
-extern crate a;
-
-pub fn foo() { assert_eq!(a::foo::<()>(0), 3); }
+++ /dev/null
-// 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.
-
-//! "compile-fail/svh-uta-trait.rs" is checking that we detect a
-//! change from `use foo::TraitB` to use `foo::TraitB` in the hash
-//! (SVH) computation (#14132), since that will affect method
-//! resolution.
-//!
-//! This is the upstream crate.
-
-#![crate_name = "uta"]
-
-mod traits {
- pub trait TraitA { fn val(&self) -> isize { 2 } }
- pub trait TraitB { fn val(&self) -> isize { 3 } }
-}
-
-impl traits::TraitA for () {}
-impl traits::TraitB for () {}
-
-pub fn foo<T>(_: isize) -> isize {
- use traits::TraitA;
- let v = ();
- v.val()
-}
+++ /dev/null
-// 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.
-
-//! "compile-fail/svh-uta-trait.rs" is checking that we detect a
-//! change from `use foo::TraitB` to use `foo::TraitB` in the hash
-//! (SVH) computation (#14132), since that will affect method
-//! resolution.
-//!
-//! This is the upstream crate.
-
-#![crate_name = "uta"]
-
-mod traits {
- pub trait TraitA { fn val(&self) -> isize { 2 } }
- pub trait TraitB { fn val(&self) -> isize { 3 } }
-}
-
-impl traits::TraitA for () {}
-impl traits::TraitB for () {}
-
-pub fn foo<T>(_: isize) -> isize {
- use traits::TraitB;
- let v = ();
- v.val()
-}
+++ /dev/null
-// 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.
-
-//! "compile-fail/svh-uta-trait.rs" is checking that we detect a
-//! change from `use foo::TraitB` to use `foo::TraitB` in the hash
-//! (SVH) computation (#14132), since that will affect method
-//! resolution.
-//!
-//! This is the downstream crate.
-
-#![crate_name = "utb"]
-
-extern crate uta;
-
-pub fn foo() { assert_eq!(uta::foo::<()>(0), 3); }
+++ /dev/null
-// 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(optin_builtin_traits, core)]
-#![crate_type = "rlib"]
-
-pub trait DefaultedTrait { }
-impl DefaultedTrait for .. { }
-
-pub struct Something<T> { t: T }
+++ /dev/null
-// 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 Trait {
- fn dummy(&self) { }
-}
-
-pub struct Foo<T:Trait> {
- pub x: T,
-}
-
-pub enum Bar<T:Trait> {
- ABar(isize),
- BBar(T),
- CBar(usize),
-}
+++ /dev/null
-// 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 {
-}
-
-impl Foo for isize {
-}
+++ /dev/null
-// 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.
-
-// Simple smoke test that unsafe traits can be compiled etc.
-
-pub unsafe trait Foo {
- fn foo(&self) -> isize;
-}
-
-unsafe impl Foo for isize {
- fn foo(&self) -> isize { *self }
-}
+++ /dev/null
-// 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.
-
-// Test library crate for cross-crate usages of traits inheriting
-// from the builtin kinds. Mostly tests metadata correctness.
-
-#![crate_type="lib"]
-
-pub trait RequiresShare : Sync { }
-pub trait RequiresRequiresShareAndSend : RequiresShare + Send { }
-pub trait RequiresCopy : Copy { }
+++ /dev/null
-// 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.
-
-#[macro_export]
-macro_rules! macro_one { () => ("one") }
-
-#[macro_export]
-macro_rules! macro_two { () => ("two") }
+++ /dev/null
-// 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.
-
-mod super_sekrit {
- pub enum sooper_sekrit {
- quux, baz
- }
-}
+++ /dev/null
-// 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(associated_consts)]
-
-pub use self::sub::{Bar, Baz};
-
-pub trait Trait {
- fn foo(&self);
- type Assoc;
- const CONST: u32;
-}
-
-struct Foo;
-
-impl Foo {
- pub fn new() {}
-
- pub const C: u32 = 0;
-}
-
-mod sub {
- pub struct Bar;
-
- impl Bar {
- pub fn new() {}
- }
-
- pub enum Baz {}
-
- impl Baz {
- pub fn new() {}
- }
-}
+++ /dev/null
-// 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 enum XE {
- XStruct { a: u8 },
- XTuple(u8),
- XUnit,
-}
+++ /dev/null
-// 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
-
-// This aux-file will require the eh_personality function to be codegen'd, but
-// it hasn't been defined just yet. Make sure we don't explode.
-
-#![no_std]
-#![crate_type = "rlib"]
-
-struct A;
-
-impl core::ops::Drop for A {
- fn drop(&mut self) {}
-}
-
-pub fn foo() {
- let _a = A;
- panic!("wut");
-}
-
-mod std {
- pub use core::{option, fmt};
-}
+++ /dev/null
-// 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 Struct {
- pub x: isize
-}
-
-impl Struct {
- fn static_meth_struct() -> Struct {
- Struct { x: 1 }
- }
-
- fn meth_struct(&self) -> isize {
- self.x
- }
-}
-
-pub enum Enum {
- Variant1(isize),
- Variant2(isize)
-}
-
-impl Enum {
- fn static_meth_enum() -> Enum {
- Enum::Variant2(10)
- }
-
- fn meth_enum(&self) -> isize {
- match *self {
- Enum::Variant1(x) |
- Enum::Variant2(x) => x
- }
- }
-}
+++ /dev/null
-// 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_type = "lib"]
-
-// used by the rpass test
-
-#[derive(Copy, Clone)]
-pub struct Struct;
-
-#[derive(Copy, Clone)]
-pub enum Unit {
- UnitVariant,
- Argument(Struct)
-}
-
-#[derive(Copy, Clone)]
-pub struct TupleStruct(pub usize, pub &'static str);
-
-// used by the cfail test
-
-#[derive(Copy, Clone)]
-pub struct StructWithFields {
- foo: isize,
-}
-
-#[derive(Copy, Clone)]
-pub enum EnumWithVariants {
- EnumVariant,
- EnumVariantArg(isize)
-}
--- /dev/null
+// 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() {}
--- /dev/null
+// 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() {}
+
--- /dev/null
+// 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]
--- /dev/null
+// 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]
--- /dev/null
+// 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;
+
--- /dev/null
+// 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 } }
--- /dev/null
+// 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
+ }
+ }
+}
--- /dev/null
+// 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
+ }
+ }
+}
--- /dev/null
+// 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>() {}
--- /dev/null
+// 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!"); }
--- /dev/null
+// 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>(); }
--- /dev/null
+// 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);
--- /dev/null
+// 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) {}
+}
--- /dev/null
+// 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);
--- /dev/null
+// 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);
+}
--- /dev/null
+// 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
--- /dev/null
+// 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>){}
--- /dev/null
+// 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!()
+}
--- /dev/null
+// 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 }
--- /dev/null
+// 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 }
--- /dev/null
+// 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 }
--- /dev/null
+// 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) }
+
--- /dev/null
+// 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()));
+}
--- /dev/null
+// 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,
+}
--- /dev/null
+// 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)
+ }
+}
--- /dev/null
+// 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
+}
--- /dev/null
+// 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 }
+}
--- /dev/null
+// 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"]
+
+#[macro_export]
+macro_rules! mywrite {
+ ($dst:expr, $($arg:tt)*) => ($dst.write_fmt(format_args!($($arg)*)))
+}
--- /dev/null
+// 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.
+
+// include file for issue-21146.rs
+
+parse_error
--- /dev/null
+// 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.
+
+// testing whether the lookup mechanism picks up types
+// defined in the outside crate
+
+#![crate_type="lib"]
+
+pub mod outer {
+ // should suggest this
+ pub trait OuterTrait {}
+
+ // should not suggest this since the module is private
+ mod private_module {
+ pub trait OuterTrait {}
+ }
+
+ // should not suggest since the trait is private
+ pub mod public_module {
+ trait OuterTrait {}
+ }
+}
--- /dev/null
+// 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.
+
+// testing whether the lookup mechanism picks up types
+// defined in the outside crate
+
+#![crate_type="lib"]
+
+mod foo {
+ // should not be suggested => foo is private
+ pub trait T {}
+}
+
+// should be suggested
+pub use foo::T;
--- /dev/null
+// 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 mod foo {
+ pub use super::*;
+}
--- /dev/null
+// 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.
+
+#![crate_type="lib"]
+
+pub enum Foo {
+ FooV { data: () }
+}
--- /dev/null
+// 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.
+
+enum Foo {
+ Bar(isize)
+}
+
+pub mod test {
+ enum Foo {
+ Bar(isize)
+ }
+}
--- /dev/null
+// 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 mod bar {
+ pub fn foo() {}
+}
--- /dev/null
+// 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.
+
+extern {
+ fn bar();
+}
--- /dev/null
+// 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 use foo::FOO2;
+
+pub const FOO: usize = 3;
+const BAR: usize = 3;
+
+mod foo {
+ pub const FOO2: usize = 3;
+}
--- /dev/null
+// 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 mod A {
+ pub struct Foo;
+ impl Foo {
+ fn foo(&self) { }
+ }
+}
--- /dev/null
+// 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::marker::PhantomData;
+
+pub struct Directed;
+pub struct Undirected;
+
+pub struct Graph<N, E, Ty = Directed> {
+ nodes: Vec<PhantomData<N>>,
+ edges: Vec<PhantomData<E>>,
+ ty: PhantomData<Ty>,
+}
+
+
+impl<N, E> Graph<N, E, Directed> {
+ pub fn new() -> Self {
+ Graph{nodes: Vec::new(), edges: Vec::new(), ty: PhantomData}
+ }
+}
+
+impl<N, E> Graph<N, E, Undirected> {
+ pub fn new_undirected() -> Self {
+ Graph{nodes: Vec::new(), edges: Vec::new(), ty: PhantomData}
+ }
+}
--- /dev/null
+// 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 trait Foo {
+ fn bar();
+}
--- /dev/null
+// 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.
+
+#![feature(libc)]
+
+extern crate libc;
+
+extern "C" {
+ pub fn rand() -> libc::c_int;
+}
--- /dev/null
+// 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 = "rlib"]
+
+// Helper for testing that we get suitable warnings when lifetime
+// bound change will cause breakage.
+
+pub fn just_ref(x: &Fn()) {
+}
+
+pub fn ref_obj(x: &Box<Fn()>) {
+ // this will change to &Box<Fn()+'static>...
+}
--- /dev/null
+// 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="lint_output_format"]
+#![crate_type = "lib"]
+#![feature(staged_api)]
+#![unstable(feature = "test_feature", issue = "0")]
+
+#[stable(feature = "test_feature", since = "1.0.0")]
+#[rustc_deprecated(since = "1.0.0", reason = "text")]
+pub fn foo() -> usize {
+ 20
+}
+
+#[unstable(feature = "test_feature", issue = "0")]
+pub fn bar() -> usize {
+ 40
+}
+
+#[unstable(feature = "test_feature", issue = "0")]
+pub fn baz() -> usize {
+ 30
+}
--- /dev/null
+// 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="lint_stability"]
+#![crate_type = "lib"]
+#![feature(staged_api)]
+#![stable(feature = "lint_stability", since = "1.0.0")]
+
+#[stable(feature = "test_feature", since = "1.0.0")]
+#[rustc_deprecated(since = "1.0.0", reason = "text")]
+pub fn deprecated() {}
+#[stable(feature = "test_feature", since = "1.0.0")]
+#[rustc_deprecated(since = "1.0.0", reason = "text")]
+pub fn deprecated_text() {}
+
+#[unstable(feature = "test_feature", issue = "0")]
+#[rustc_deprecated(since = "1.0.0", reason = "text")]
+pub fn deprecated_unstable() {}
+#[unstable(feature = "test_feature", issue = "0")]
+#[rustc_deprecated(since = "1.0.0", reason = "text")]
+pub fn deprecated_unstable_text() {}
+
+#[unstable(feature = "test_feature", issue = "0")]
+pub fn unstable() {}
+#[unstable(feature = "test_feature", reason = "text", issue = "0")]
+pub fn unstable_text() {}
+
+#[stable(feature = "rust1", since = "1.0.0")]
+pub fn stable() {}
+#[stable(feature = "rust1", since = "1.0.0")]
+pub fn stable_text() {}
+
+#[stable(feature = "rust1", since = "1.0.0")]
+pub struct MethodTester;
+
+impl MethodTester {
+ #[stable(feature = "test_feature", since = "1.0.0")]
+ #[rustc_deprecated(since = "1.0.0", reason = "text")]
+ pub fn method_deprecated(&self) {}
+ #[stable(feature = "test_feature", since = "1.0.0")]
+ #[rustc_deprecated(since = "1.0.0", reason = "text")]
+ pub fn method_deprecated_text(&self) {}
+
+ #[unstable(feature = "test_feature", issue = "0")]
+ #[rustc_deprecated(since = "1.0.0", reason = "text")]
+ pub fn method_deprecated_unstable(&self) {}
+ #[unstable(feature = "test_feature", issue = "0")]
+ #[rustc_deprecated(since = "1.0.0", reason = "text")]
+ pub fn method_deprecated_unstable_text(&self) {}
+
+ #[unstable(feature = "test_feature", issue = "0")]
+ pub fn method_unstable(&self) {}
+ #[unstable(feature = "test_feature", reason = "text", issue = "0")]
+ pub fn method_unstable_text(&self) {}
+
+ #[stable(feature = "rust1", since = "1.0.0")]
+ pub fn method_stable(&self) {}
+ #[stable(feature = "rust1", since = "1.0.0")]
+ pub fn method_stable_text(&self) {}
+}
+
+#[stable(feature = "test_feature", since = "1.0.0")]
+pub trait Trait {
+ #[stable(feature = "test_feature", since = "1.0.0")]
+ #[rustc_deprecated(since = "1.0.0", reason = "text")]
+ fn trait_deprecated(&self) {}
+ #[stable(feature = "test_feature", since = "1.0.0")]
+ #[rustc_deprecated(since = "1.0.0", reason = "text")]
+ fn trait_deprecated_text(&self) {}
+
+ #[unstable(feature = "test_feature", issue = "0")]
+ #[rustc_deprecated(since = "1.0.0", reason = "text")]
+ fn trait_deprecated_unstable(&self) {}
+ #[unstable(feature = "test_feature", issue = "0")]
+ #[rustc_deprecated(since = "1.0.0", reason = "text")]
+ fn trait_deprecated_unstable_text(&self) {}
+
+ #[unstable(feature = "test_feature", issue = "0")]
+ fn trait_unstable(&self) {}
+ #[unstable(feature = "test_feature", reason = "text", issue = "0")]
+ fn trait_unstable_text(&self) {}
+
+ #[stable(feature = "rust1", since = "1.0.0")]
+ fn trait_stable(&self) {}
+ #[stable(feature = "rust1", since = "1.0.0")]
+ fn trait_stable_text(&self) {}
+}
+
+#[stable(feature = "test_feature", since = "1.0.0")]
+impl Trait for MethodTester {}
+
+#[unstable(feature = "test_feature", issue = "0")]
+pub trait UnstableTrait { fn dummy(&self) { } }
+
+#[stable(feature = "test_feature", since = "1.0.0")]
+#[rustc_deprecated(since = "1.0.0", reason = "text")]
+pub trait DeprecatedTrait {
+ #[stable(feature = "test_feature", since = "1.0.0")] fn dummy(&self) { }
+}
+
+#[stable(feature = "test_feature", since = "1.0.0")]
+#[rustc_deprecated(since = "1.0.0", reason = "text")]
+pub struct DeprecatedStruct {
+ #[stable(feature = "test_feature", since = "1.0.0")] pub i: isize
+}
+#[unstable(feature = "test_feature", issue = "0")]
+#[rustc_deprecated(since = "1.0.0", reason = "text")]
+pub struct DeprecatedUnstableStruct {
+ #[stable(feature = "test_feature", since = "1.0.0")] pub i: isize
+}
+#[unstable(feature = "test_feature", issue = "0")]
+pub struct UnstableStruct {
+ #[stable(feature = "test_feature", since = "1.0.0")] pub i: isize
+}
+#[stable(feature = "rust1", since = "1.0.0")]
+pub struct StableStruct {
+ #[stable(feature = "test_feature", since = "1.0.0")] pub i: isize
+}
+
+#[stable(feature = "test_feature", since = "1.0.0")]
+#[rustc_deprecated(since = "1.0.0", reason = "text")]
+pub struct DeprecatedUnitStruct;
+#[unstable(feature = "test_feature", issue = "0")]
+#[rustc_deprecated(since = "1.0.0", reason = "text")]
+pub struct DeprecatedUnstableUnitStruct;
+#[unstable(feature = "test_feature", issue = "0")]
+pub struct UnstableUnitStruct;
+#[stable(feature = "rust1", since = "1.0.0")]
+pub struct StableUnitStruct;
+
+#[stable(feature = "test_feature", since = "1.0.0")]
+pub enum Enum {
+ #[stable(feature = "test_feature", since = "1.0.0")]
+ #[rustc_deprecated(since = "1.0.0", reason = "text")]
+ DeprecatedVariant,
+ #[unstable(feature = "test_feature", issue = "0")]
+ #[rustc_deprecated(since = "1.0.0", reason = "text")]
+ DeprecatedUnstableVariant,
+ #[unstable(feature = "test_feature", issue = "0")]
+ UnstableVariant,
+
+ #[stable(feature = "rust1", since = "1.0.0")]
+ StableVariant,
+}
+
+#[stable(feature = "test_feature", since = "1.0.0")]
+#[rustc_deprecated(since = "1.0.0", reason = "text")]
+pub struct DeprecatedTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);
+#[unstable(feature = "test_feature", issue = "0")]
+#[rustc_deprecated(since = "1.0.0", reason = "text")]
+pub struct DeprecatedUnstableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);
+#[unstable(feature = "test_feature", issue = "0")]
+pub struct UnstableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);
+#[stable(feature = "rust1", since = "1.0.0")]
+pub struct StableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize);
+
+#[stable(feature = "test_feature", since = "1.0.0")]
+#[macro_export]
+macro_rules! macro_test {
+ () => (deprecated());
+}
+
+#[stable(feature = "test_feature", since = "1.0.0")]
+#[macro_export]
+macro_rules! macro_test_arg {
+ ($func:expr) => ($func);
+}
+
+#[stable(feature = "test_feature", since = "1.0.0")]
+#[macro_export]
+macro_rules! macro_test_arg_nested {
+ ($func:ident) => (macro_test_arg!($func()));
+}
--- /dev/null
+// 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)]
+#![stable(feature = "rust1", since = "1.0.0")]
+
+#[stable(feature = "rust1", since = "1.0.0")]
+pub struct Stable {
+ #[stable(feature = "rust1", since = "1.0.0")]
+ pub inherit: u8, // it's a lie (stable doesn't inherit)
+ #[unstable(feature = "test_feature", issue = "0")]
+ pub override1: u8,
+ #[rustc_deprecated(since = "1.0.0", reason = "text")]
+ #[unstable(feature = "test_feature", issue = "0")]
+ pub override2: u8,
+}
+
+#[stable(feature = "rust1", since = "1.0.0")]
+pub struct Stable2(#[stable(feature = "rust1", since = "1.0.0")] pub u8,
+ #[unstable(feature = "test_feature", issue = "0")] pub u8,
+ #[unstable(feature = "test_feature", issue = "0")]
+ #[rustc_deprecated(since = "1.0.0", reason = "text")] pub u8);
+
+#[unstable(feature = "test_feature", issue = "0")]
+pub struct Unstable {
+ pub inherit: u8,
+ #[stable(feature = "rust1", since = "1.0.0")]
+ pub override1: u8,
+ #[rustc_deprecated(since = "1.0.0", reason = "text")]
+ #[unstable(feature = "test_feature", issue = "0")]
+ pub override2: u8,
+}
+
+#[unstable(feature = "test_feature", issue = "0")]
+pub struct Unstable2(pub u8,
+ #[stable(feature = "rust1", since = "1.0.0")] pub u8,
+ #[unstable(feature = "test_feature", issue = "0")]
+ #[rustc_deprecated(since = "1.0.0", reason = "text")] pub u8);
+
+#[unstable(feature = "test_feature", issue = "0")]
+#[rustc_deprecated(since = "1.0.0", reason = "text")]
+pub struct Deprecated {
+ pub inherit: u8,
+ #[stable(feature = "rust1", since = "1.0.0")]
+ pub override1: u8,
+ #[unstable(feature = "test_feature", issue = "0")]
+ pub override2: u8,
+}
+
+#[unstable(feature = "test_feature", issue = "0")]
+#[rustc_deprecated(since = "1.0.0", reason = "text")]
+pub struct Deprecated2(pub u8,
+ #[stable(feature = "rust1", since = "1.0.0")] pub u8,
+ #[unstable(feature = "test_feature", issue = "0")] pub u8);
--- /dev/null
+// 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 fn foo() {}
--- /dev/null
+// 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 fn increment(x: usize) -> usize {
+ x + 1
+}
+
+#[macro_export]
+macro_rules! increment {
+ ($x:expr) => ($crate::increment($x))
+}
+
+pub fn check_local() {
+ assert_eq!(increment!(3), 4);
+}
--- /dev/null
+// 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 = "dylib"]
+
+// Since we load a serialized macro with all its attributes, accidentally
+// re-exporting a `#[macro_export] macro_rules!` is something of a concern!
+//
+// We avoid it at the moment only because of the order in which we do things.
+
+#[macro_use] #[no_link]
+extern crate macro_reexport_1;
--- /dev/null
+// 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"]
+#[macro_export]
+macro_rules! reexported {
+ () => ( 3 )
+}
--- /dev/null
+// 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 enum Foo {
+ A,
+ B(isize),
+ C { a: isize },
+}
+
+impl Foo {
+ pub fn foo() {}
+ pub fn bar(&self) {}
+}
--- /dev/null
+// 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(needs_allocator)]
+#![no_std]
+#![needs_allocator]
+#![crate_type = "rlib"]
--- /dev/null
+// 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 use reexport::Reexported;
+
+pub struct Foo;
+pub enum Bar { X }
+
+pub mod foo {
+ pub trait PubPub {
+ fn method(&self) {}
+
+ fn method3(&self) {}
+ }
+
+ impl PubPub for u32 {}
+ impl PubPub for i32 {}
+}
+pub mod bar {
+ trait PubPriv {
+ fn method(&self);
+ }
+}
+mod qux {
+ pub trait PrivPub {
+ fn method(&self);
+ }
+}
+mod quz {
+ trait PrivPriv {
+ fn method(&self);
+ }
+}
+
+mod reexport {
+ pub trait Reexported {
+ fn method(&self);
+ }
+}
--- /dev/null
+// 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 type oint = Option<isize>;
+pub fn foo() -> oint { Some(3) }
--- /dev/null
+// 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 trait RemoteTrait { fn dummy(&self) { } }
--- /dev/null
+// 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(());
+pub struct B(isize);
+pub struct C(pub isize, isize);
+pub struct D(pub isize);
--- /dev/null
+// 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.
+
+trait Foo {}
--- /dev/null
+// 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 ARRAY: &'static [u8] = &[1];
--- /dev/null
+// 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.
+
+// Check that method bounds declared on traits/impls in a cross-crate
+// scenario work. This is the library portion of the test.
+
+pub enum MaybeOwned<'a> {
+ Owned(isize),
+ Borrowed(&'a isize)
+}
+
+pub struct Inv<'a> { // invariant w/r/t 'a
+ x: &'a mut &'a isize
+}
+
+// I encountered a bug at some point with encoding the IntoMaybeOwned
+// trait, so I'll use that as the template for this test.
+pub trait IntoMaybeOwned<'a> {
+ fn into_maybe_owned(self) -> MaybeOwned<'a>;
+
+ // Note: without this `into_inv` method, the trait is
+ // contravariant w/r/t `'a`, since if you look strictly at the
+ // interface, it only returns `'a`. This complicates the
+ // downstream test since it wants invariance to force an error.
+ // Hence we add this method.
+ fn into_inv(self) -> Inv<'a>;
+
+ fn bigger_region<'b:'a>(self, b: Inv<'b>);
+}
+
+impl<'a> IntoMaybeOwned<'a> for Inv<'a> {
+ fn into_maybe_owned(self) -> MaybeOwned<'a> { panic!() }
+ fn into_inv(self) -> Inv<'a> { panic!() }
+ fn bigger_region<'b:'a>(self, b: Inv<'b>) { panic!() }
+}
--- /dev/null
+// 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)]
+#![stable(feature = "foo", since = "1.2.0")]
+
+
+#[unstable(feature = "foo", issue = "1")]
+pub fn unstable() {}
+
+#[unstable(feature = "foo", reason = "message", issue = "2")]
+pub fn unstable_msg() {}
--- /dev/null
+// 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.
+
+#![cfg_attr(foo, experimental)]
+#![cfg_attr(not(foo), stable(feature = "test_feature", since = "1.0.0"))]
+#![feature(staged_api)]
--- /dev/null
+// 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.
+
+// compile-flags:--cfg foo
+
+#![cfg_attr(foo, unstable(feature = "test_feature", issue = "0"))]
+#![cfg_attr(not(foo), stable(feature = "test_feature", since = "1.0.0"))]
+#![feature(staged_api)]
--- /dev/null
+// 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_type = "lib"]
+
+static private: isize = 0;
+pub static public: isize = 0;
+
+pub struct A(());
+
+impl A {
+ fn foo() {}
+}
+
+mod foo {
+ pub static a: isize = 0;
+ pub fn b() {}
+ pub struct c;
+ pub enum d {}
+ pub type e = isize;
+
+ pub struct A(());
+
+ impl A {
+ fn foo() {}
+ }
+
+ // these are public so the parent can reexport them.
+ pub static reexported_a: isize = 0;
+ pub fn reexported_b() {}
+ pub struct reexported_c;
+ pub enum reexported_d {}
+ pub type reexported_e = isize;
+}
+
+pub mod bar {
+ pub use foo::reexported_a as e;
+ pub use foo::reexported_b as f;
+ pub use foo::reexported_c as g;
+ pub use foo::reexported_d as h;
+ pub use foo::reexported_e as i;
+}
+
+pub static a: isize = 0;
+pub fn b() {}
+pub struct c;
+pub enum d {}
+pub type e = isize;
+
+static j: isize = 0;
+fn k() {}
+struct l;
+enum m {}
+type n = isize;
--- /dev/null
+// 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: isize,
+ pub b: isize,
+}
+
+pub struct B {
+ pub a: isize,
+ b: isize,
+}
--- /dev/null
+// 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.
+
+enum Bar {
+ Baz { a: isize }
+}
--- /dev/null
+// 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.
+
+//! The `svh-a-*.rs` files are all deviations from the base file
+//! svh-a-base.rs with some difference (usually in `fn foo`) that
+//! should not affect the strict version hash (SVH) computation
+//! (#14132).
+
+#![crate_name = "a"]
+
+macro_rules! three {
+ () => { 3 }
+}
+
+pub trait U {}
+pub trait V {}
+impl U for () {}
+impl V for () {}
+
+static A_CONSTANT : isize = 2;
+
+pub fn foo<T:U>(_: isize) -> isize {
+ 3
+}
+
+pub fn an_unused_name() -> isize {
+ 4
+}
--- /dev/null
+// 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.
+
+//! The `svh-a-*.rs` files are all deviations from the base file
+//! svh-a-base.rs with some difference (usually in `fn foo`) that
+//! should not affect the strict version hash (SVH) computation
+//! (#14132).
+
+#![crate_name = "a"]
+
+macro_rules! three {
+ () => { 3 }
+}
+
+pub trait U {}
+pub trait V {}
+impl U for () {}
+impl V for () {}
+
+static A_CONSTANT : isize = 2;
+
+pub fn foo<T:U>(_: isize) -> isize {
+ 0
+}
+
+pub fn an_unused_name() -> isize {
+ 4
+}
--- /dev/null
+// 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.
+
+//! The `svh-a-*.rs` files are all deviations from the base file
+//! svh-a-base.rs with some difference (usually in `fn foo`) that
+//! should not affect the strict version hash (SVH) computation
+//! (#14132).
+
+#![crate_name = "a"]
+
+macro_rules! three {
+ () => { 3 }
+}
+
+pub trait U {}
+pub trait V {}
+impl U for () {}
+impl V for () {}
+
+static A_CONSTANT : isize = 2;
+
+#[cfg(some_flag)]
+pub fn foo<T:U>(_: isize) -> isize {
+ 3
+}
+
+#[cfg(not(some_flag))]
+pub fn an_unused_name() -> isize {
+ 4
+}
--- /dev/null
+// 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.
+
+//! The `svh-a-*.rs` files are all deviations from the base file
+//! svh-a-base.rs with some difference (usually in `fn foo`) that
+//! should not affect the strict version hash (SVH) computation
+//! (#14132).
+
+#![crate_name = "a"]
+
+macro_rules! three {
+ () => { 3 }
+}
+
+pub trait U {}
+pub trait V {}
+impl U for () {}
+impl V for () {}
+
+static A_CONSTANT : isize = 2;
+
+pub fn foo<T:V>(_: isize) -> isize {
+ 3
+}
+
+pub fn an_unused_name() -> isize {
+ 4
+}
--- /dev/null
+// 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.
+
+//! The `svh-a-*.rs` files are all deviations from the base file
+//! svh-a-base.rs with some difference (usually in `fn foo`) that
+//! should not affect the strict version hash (SVH) computation
+//! (#14132).
+
+#![crate_name = "a"]
+
+macro_rules! three {
+ () => { 3 }
+}
+
+pub trait U {}
+pub trait V {}
+impl U for () {}
+impl V for () {}
+
+static A_CONSTANT : isize = 2;
+
+pub fn foo<T:U>(_: i32) -> isize {
+ 3
+}
+
+pub fn an_unused_name() -> isize {
+ 4
+}
--- /dev/null
+// 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.
+
+//! The `svh-a-*.rs` files are all deviations from the base file
+//! svh-a-base.rs with some difference (usually in `fn foo`) that
+//! should not affect the strict version hash (SVH) computation
+//! (#14132).
+
+#![crate_name = "a"]
+
+macro_rules! three {
+ () => { 3 }
+}
+
+pub trait U {}
+pub trait V {}
+impl U for () {}
+impl V for () {}
+
+static A_CONSTANT : isize = 2;
+
+pub fn foo<T:U>(_: isize) -> i64 {
+ 3
+}
+
+pub fn an_unused_name() -> i32 {
+ 4
+}
--- /dev/null
+// 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.
+
+//! The `svh-a-*.rs` files are all deviations from the base file
+//! svh-a-base.rs with some difference (usually in `fn foo`) that
+//! should not affect the strict version hash (SVH) computation
+//! (#14132).
+
+#![crate_name = "a"]
+#![feature(core)]
+
+macro_rules! three {
+ () => { 3 }
+}
+
+pub trait U {}
+pub trait V {}
+impl U for () {}
+impl V for () {}
+
+static A_CONSTANT : i32 = 2;
+
+pub fn foo<T:U>(_: isize) -> isize {
+ 3
+}
+
+pub fn an_unused_name() -> isize {
+ 4
+}
--- /dev/null
+// 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.
+
+//! This is a client of the `a` crate defined in "svn-a-base.rs". The
+//! rpass and cfail tests (such as "run-pass/svh-add-comment.rs") use
+//! it by swapping in a different object code library crate built from
+//! some variant of "svn-a-base.rs", and then we are checking if the
+//! compiler properly ignores or accepts the change, based on whether
+//! the change could affect the downstream crate content or not
+//! (#14132).
+
+#![crate_name = "b"]
+
+extern crate a;
+
+pub fn foo() { assert_eq!(a::foo::<()>(0), 3); }
--- /dev/null
+// 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.
+
+//! "compile-fail/svh-uta-trait.rs" is checking that we detect a
+//! change from `use foo::TraitB` to use `foo::TraitB` in the hash
+//! (SVH) computation (#14132), since that will affect method
+//! resolution.
+//!
+//! This is the upstream crate.
+
+#![crate_name = "uta"]
+
+mod traits {
+ pub trait TraitA { fn val(&self) -> isize { 2 } }
+ pub trait TraitB { fn val(&self) -> isize { 3 } }
+}
+
+impl traits::TraitA for () {}
+impl traits::TraitB for () {}
+
+pub fn foo<T>(_: isize) -> isize {
+ use traits::TraitA;
+ let v = ();
+ v.val()
+}
--- /dev/null
+// 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.
+
+//! "compile-fail/svh-uta-trait.rs" is checking that we detect a
+//! change from `use foo::TraitB` to use `foo::TraitB` in the hash
+//! (SVH) computation (#14132), since that will affect method
+//! resolution.
+//!
+//! This is the upstream crate.
+
+#![crate_name = "uta"]
+
+mod traits {
+ pub trait TraitA { fn val(&self) -> isize { 2 } }
+ pub trait TraitB { fn val(&self) -> isize { 3 } }
+}
+
+impl traits::TraitA for () {}
+impl traits::TraitB for () {}
+
+pub fn foo<T>(_: isize) -> isize {
+ use traits::TraitB;
+ let v = ();
+ v.val()
+}
--- /dev/null
+// 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.
+
+//! "compile-fail/svh-uta-trait.rs" is checking that we detect a
+//! change from `use foo::TraitB` to use `foo::TraitB` in the hash
+//! (SVH) computation (#14132), since that will affect method
+//! resolution.
+//!
+//! This is the downstream crate.
+
+#![crate_name = "utb"]
+
+extern crate uta;
+
+pub fn foo() { assert_eq!(uta::foo::<()>(0), 3); }
--- /dev/null
+// 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(optin_builtin_traits, core)]
+#![crate_type = "rlib"]
+
+pub trait DefaultedTrait { }
+impl DefaultedTrait for .. { }
+
+pub struct Something<T> { t: T }
--- /dev/null
+// 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 Trait {
+ fn dummy(&self) { }
+}
+
+pub struct Foo<T:Trait> {
+ pub x: T,
+}
+
+pub enum Bar<T:Trait> {
+ ABar(isize),
+ BBar(T),
+ CBar(usize),
+}
--- /dev/null
+// 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 {
+}
+
+impl Foo for isize {
+}
--- /dev/null
+// 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.
+
+// Simple smoke test that unsafe traits can be compiled etc.
+
+pub unsafe trait Foo {
+ fn foo(&self) -> isize;
+}
+
+unsafe impl Foo for isize {
+ fn foo(&self) -> isize { *self }
+}
--- /dev/null
+// 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.
+
+// Test library crate for cross-crate usages of traits inheriting
+// from the builtin kinds. Mostly tests metadata correctness.
+
+#![crate_type="lib"]
+
+pub trait RequiresShare : Sync { }
+pub trait RequiresRequiresShareAndSend : RequiresShare + Send { }
+pub trait RequiresCopy : Copy { }
--- /dev/null
+// 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.
+
+#[macro_export]
+macro_rules! macro_one { () => ("one") }
+
+#[macro_export]
+macro_rules! macro_two { () => ("two") }
--- /dev/null
+// 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.
+
+mod super_sekrit {
+ pub enum sooper_sekrit {
+ quux, baz
+ }
+}
--- /dev/null
+// 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(associated_consts)]
+
+pub use self::sub::{Bar, Baz};
+
+pub trait Trait {
+ fn foo(&self);
+ type Assoc;
+ const CONST: u32;
+}
+
+struct Foo;
+
+impl Foo {
+ pub fn new() {}
+
+ pub const C: u32 = 0;
+}
+
+mod sub {
+ pub struct Bar;
+
+ impl Bar {
+ pub fn new() {}
+ }
+
+ pub enum Baz {}
+
+ impl Baz {
+ pub fn new() {}
+ }
+}
--- /dev/null
+// 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 enum XE {
+ XStruct { a: u8 },
+ XTuple(u8),
+ XUnit,
+}
--- /dev/null
+// 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
+
+// This aux-file will require the eh_personality function to be codegen'd, but
+// it hasn't been defined just yet. Make sure we don't explode.
+
+#![no_std]
+#![crate_type = "rlib"]
+
+struct A;
+
+impl core::ops::Drop for A {
+ fn drop(&mut self) {}
+}
+
+pub fn foo() {
+ let _a = A;
+ panic!("wut");
+}
+
+mod std {
+ pub use core::{option, fmt};
+}
--- /dev/null
+// 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 Struct {
+ pub x: isize
+}
+
+impl Struct {
+ fn static_meth_struct() -> Struct {
+ Struct { x: 1 }
+ }
+
+ fn meth_struct(&self) -> isize {
+ self.x
+ }
+}
+
+pub enum Enum {
+ Variant1(isize),
+ Variant2(isize)
+}
+
+impl Enum {
+ fn static_meth_enum() -> Enum {
+ Enum::Variant2(10)
+ }
+
+ fn meth_enum(&self) -> isize {
+ match *self {
+ Enum::Variant1(x) |
+ Enum::Variant2(x) => x
+ }
+ }
+}
--- /dev/null
+// 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_type = "lib"]
+
+// used by the rpass test
+
+#[derive(Copy, Clone)]
+pub struct Struct;
+
+#[derive(Copy, Clone)]
+pub enum Unit {
+ UnitVariant,
+ Argument(Struct)
+}
+
+#[derive(Copy, Clone)]
+pub struct TupleStruct(pub usize, pub &'static str);
+
+// used by the cfail test
+
+#[derive(Copy, Clone)]
+pub struct StructWithFields {
+ foo: isize,
+}
+
+#[derive(Copy, Clone)]
+pub enum EnumWithVariants {
+ EnumVariant,
+ EnumVariantArg(isize)
+}
// except according to those terms.
// error-pattern: expected item, found `parse_error`
-include!("aux/issue-21146-inc.rs");
+include!("auxiliary/issue-21146-inc.rs");
fn main() {}
+++ /dev/null
-// 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.
-
-#![feature(pub_restricted)]
-
-pub(crate) struct Crate;
-#[derive(Default)]
-pub struct Universe {
- pub x: i32,
- pub(crate) y: i32
-}
-
-impl Universe {
- pub fn f(&self) {}
- pub(crate) fn g(&self) {}
-}
--- /dev/null
+// 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.
+
+#![feature(pub_restricted)]
+
+pub(crate) struct Crate;
+#[derive(Default)]
+pub struct Universe {
+ pub x: i32,
+ pub(crate) y: i32
+}
+
+impl Universe {
+ pub fn f(&self) {}
+ pub(crate) fn g(&self) {}
+}
+++ /dev/null
-// 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) { }
-}
+++ /dev/null
-// 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() {()}
+++ /dev/null
-// 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.
-
-#![crate_type = "lib"]
-// compile-flags:-g
-
-pub use private::P;
-
-#[derive(Copy, Clone)]
-pub struct S {
- p: P,
-}
-
-mod private {
- #[derive(Copy, Clone)]
- pub struct P {
- p: i32,
- }
- pub const THREE: P = P { p: 3 };
-}
-
-pub static A: S = S { p: private::THREE };
--- /dev/null
+// 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) { }
+}
--- /dev/null
+// 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() {()}
--- /dev/null
+// 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.
+
+#![crate_type = "lib"]
+// compile-flags:-g
+
+pub use private::P;
+
+#[derive(Copy, Clone)]
+pub struct S {
+ p: P,
+}
+
+mod private {
+ #[derive(Copy, Clone)]
+ pub struct P {
+ p: i32,
+ }
+ pub const THREE: P = P { p: 3 };
+}
+
+pub static A: S = S { p: private::THREE };
+++ /dev/null
-// 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)
-}
+++ /dev/null
-// 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()))
- }
- })
-}
+++ /dev/null
-// 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);
-}
+++ /dev/null
-// 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"]
+++ /dev/null
-// 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"]
+++ /dev/null
-// 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"]
-
-#[macro_use] #[no_link] extern crate issue_13560_1 as t1;
-#[macro_use] extern crate issue_13560_2 as t2;
+++ /dev/null
-// 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"]
-
-use std::cell::RefCell;
-
-pub struct Window<Data>{
- pub data: RefCell<Data>
-}
-
-impl<Data: Update> Window<Data> {
- pub fn update(&self, e: i32) {
- match e {
- 1 => self.data.borrow_mut().update(),
- _ => {}
- }
- }
-}
-
-pub trait Update {
- fn update(&mut self);
-}
+++ /dev/null
-// 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"]
-
-struct Foo;
-// This is the ICE trigger
-struct Formatter;
-
-trait Show {
- fn fmt(&self);
-}
-
-impl Show for Foo {
- fn fmt(&self) {}
-}
-
-fn bar<T>(f: extern "Rust" fn(&T), t: &T) { }
-
-// ICE requirement: this has to be marked as inline
-#[inline]
-pub fn baz() {
- bar(Show::fmt, &Foo);
-}
+++ /dev/null
-// 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.
-
-// force-host
-
-#![feature(plugin_registrar, quote, rustc_private)]
-#![crate_type = "dylib"]
-
-extern crate syntax;
-extern crate rustc;
-extern crate rustc_plugin;
-
-use syntax::ast;
-use syntax::codemap;
-use syntax::ext::base::{ExtCtxt, MacResult, MacEager};
-use syntax::util::small_vector::SmallVector;
-use rustc_plugin::Registry;
-
-#[plugin_registrar]
-pub fn plugin_registrar(reg: &mut Registry) {
- reg.register_macro("multiple_items", expand)
-}
-
-fn expand(cx: &mut ExtCtxt, _: codemap::Span, _: &[ast::TokenTree]) -> Box<MacResult+'static> {
- MacEager::items(SmallVector::many(vec![
- quote_item!(cx, struct Struct1;).unwrap(),
- quote_item!(cx, struct Struct2;).unwrap()
- ]))
-}
+++ /dev/null
-// 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.
-
-#![feature(rustc_private)]
-
-// We're testing linkage visibility; the compiler warns us, but we want to
-// do the runtime check that these functions aren't exported.
-#![allow(private_no_mangle_fns)]
-
-extern crate rustc_back;
-
-use rustc_back::dynamic_lib::DynamicLibrary;
-
-#[no_mangle]
-pub fn foo() { bar(); }
-
-pub fn foo2<T>() {
- fn bar2() {
- bar();
- }
- bar2();
-}
-
-#[no_mangle]
-fn bar() { }
-
-#[allow(dead_code)]
-#[no_mangle]
-fn baz() { }
-
-pub fn test() {
- let lib = DynamicLibrary::open(None).unwrap();
- unsafe {
- assert!(lib.symbol::<isize>("foo").is_ok());
- assert!(lib.symbol::<isize>("baz").is_err());
- assert!(lib.symbol::<isize>("bar").is_err());
- }
-}
+++ /dev/null
-// 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 syntax;
-
-use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass, LateLintPassObject, LintArray};
-use rustc_plugin::Registry;
-use rustc::hir;
-use syntax::attr;
-
-declare_lint!(CRATE_NOT_OKAY, Warn, "crate not marked with #![crate_okay]");
-
-struct Pass;
-
-impl LintPass for Pass {
- fn get_lints(&self) -> LintArray {
- lint_array!(CRATE_NOT_OKAY)
- }
-}
-
-impl LateLintPass for Pass {
- fn check_crate(&mut self, cx: &LateContext, krate: &hir::Crate) {
- if !attr::contains_name(&krate.attrs, "crate_okay") {
- cx.span_lint(CRATE_NOT_OKAY, krate.span,
- "crate is not marked with #![crate_okay]");
- }
- }
-}
-
-#[plugin_registrar]
-pub fn plugin_registrar(reg: &mut Registry) {
- reg.register_late_lint_pass(box Pass as LateLintPassObject);
-}
+++ /dev/null
-// 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(box_syntax, rustc_private)]
-
-// Load rustc as a plugin to get macros
-#[macro_use]
-extern crate rustc;
-extern crate rustc_plugin;
-
-use rustc::hir;
-use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass, LateLintPassObject, LintArray};
-use rustc_plugin::Registry;
-
-declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'");
-
-declare_lint!(PLEASE_LINT, Warn, "Warn about items named 'pleaselintme'");
-
-struct Pass;
-
-impl LintPass for Pass {
- fn get_lints(&self) -> LintArray {
- lint_array!(TEST_LINT, PLEASE_LINT)
- }
-}
-
-impl LateLintPass for Pass {
- fn check_item(&mut self, cx: &LateContext, it: &hir::Item) {
- match &*it.name.as_str() {
- "lintme" => cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'"),
- "pleaselintme" => cx.span_lint(PLEASE_LINT, it.span, "item is named 'pleaselintme'"),
- _ => {}
- }
- }
-}
-
-#[plugin_registrar]
-pub fn plugin_registrar(reg: &mut Registry) {
- reg.register_late_lint_pass(box Pass as LateLintPassObject);
- reg.register_lint_group("lint_me", vec![TEST_LINT, PLEASE_LINT]);
-}
+++ /dev/null
-// 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(box_syntax, rustc_private)]
-
-extern crate syntax;
-
-// Load rustc as a plugin to get macros
-#[macro_use]
-extern crate rustc;
-extern crate rustc_plugin;
-
-use rustc::lint::{EarlyContext, LintContext, LintPass, EarlyLintPass,
- EarlyLintPassObject, LintArray};
-use rustc_plugin::Registry;
-use syntax::ast;
-declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'");
-
-struct Pass;
-
-impl LintPass for Pass {
- fn get_lints(&self) -> LintArray {
- lint_array!(TEST_LINT)
- }
-}
-
-impl EarlyLintPass for Pass {
- fn check_item(&mut self, cx: &EarlyContext, it: &ast::Item) {
- if it.ident.name.as_str() == "lintme" {
- cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'");
- }
- }
-}
-
-#[plugin_registrar]
-pub fn plugin_registrar(reg: &mut Registry) {
- reg.register_early_lint_pass(box Pass as EarlyLintPassObject);
-}
+++ /dev/null
-// 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(rustc_private)]
-
-extern crate rustc;
-extern crate rustc_plugin;
-
-use rustc_plugin::Registry;
-
-#[plugin_registrar]
-pub fn plugin_registrar(reg: &mut Registry) {
- // This pass is built in to LLVM.
- //
- // Normally, we would name a pass that was registered through
- // C++ static object constructors in the same .so file as the
- // plugin registrar.
- reg.register_llvm_pass("gvn");
-}
+++ /dev/null
-// 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.
-
-#![feature(rustc_private)]
-
-#[macro_use] extern crate log;
-
-pub fn foo<T>() {
- fn death() -> isize { panic!() }
- debug!("{}", (||{ death() })());
-}
+++ /dev/null
-// 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"]
-
-pub fn foo() {}
+++ /dev/null
-// 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(rustc_private)]
-
-extern crate rustc;
-extern crate rustc_plugin;
-
-use rustc_plugin::Registry;
-
-#[plugin_registrar]
-pub fn plugin_registrar(_reg: &mut Registry) {}
+++ /dev/null
-// 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.
-
-// force-host
-
-#![feature(plugin_registrar, quote, rustc_private)]
-
-extern crate syntax;
-extern crate rustc;
-extern crate rustc_plugin;
-
-use syntax::ast::{self, TokenTree, Item, MetaItem, ImplItem, TraitItem, ItemKind};
-use syntax::codemap::Span;
-use syntax::ext::base::*;
-use syntax::parse::{self, token};
-use syntax::ptr::P;
-use rustc_plugin::Registry;
-
-#[macro_export]
-macro_rules! exported_macro { () => (2) }
-macro_rules! unexported_macro { () => (3) }
-
-#[plugin_registrar]
-pub fn plugin_registrar(reg: &mut Registry) {
- reg.register_macro("make_a_1", expand_make_a_1);
- reg.register_macro("identity", expand_identity);
- reg.register_syntax_extension(
- token::intern("into_multi_foo"),
- // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
- MultiModifier(Box::new(expand_into_foo_multi)));
- reg.register_syntax_extension(
- token::intern("duplicate"),
- // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
- MultiDecorator(Box::new(expand_duplicate)));
-}
-
-fn expand_make_a_1(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree])
- -> Box<MacResult+'static> {
- if !tts.is_empty() {
- cx.span_fatal(sp, "make_a_1 takes no arguments");
- }
- MacEager::expr(quote_expr!(cx, 1))
-}
-
-// See Issue #15750
-fn expand_identity(cx: &mut ExtCtxt, _span: Span, tts: &[TokenTree])
- -> Box<MacResult+'static> {
- // Parse an expression and emit it unchanged.
- let mut parser = parse::new_parser_from_tts(cx.parse_sess(),
- cx.cfg(), tts.to_vec());
- let expr = parser.parse_expr().unwrap();
- MacEager::expr(quote_expr!(&mut *cx, $expr))
-}
-
-fn expand_into_foo_multi(cx: &mut ExtCtxt,
- sp: Span,
- attr: &MetaItem,
- it: Annotatable) -> Annotatable {
- match it {
- Annotatable::Item(it) => {
- Annotatable::Item(P(Item {
- attrs: it.attrs.clone(),
- ..(*quote_item!(cx, enum Foo2 { Bar2, Baz2 }).unwrap()).clone()
- }))
- }
- Annotatable::ImplItem(it) => {
- quote_item!(cx, impl X { fn foo(&self) -> i32 { 42 } }).unwrap().and_then(|i| {
- match i.node {
- ItemKind::Impl(_, _, _, _, _, mut items) => {
- Annotatable::ImplItem(P(items.pop().expect("impl method not found")))
- }
- _ => unreachable!("impl parsed to something other than impl")
- }
- })
- }
- Annotatable::TraitItem(it) => {
- quote_item!(cx, trait X { fn foo(&self) -> i32 { 0 } }).unwrap().and_then(|i| {
- match i.node {
- ItemKind::Trait(_, _, _, mut items) => {
- Annotatable::TraitItem(P(items.pop().expect("trait method not found")))
- }
- _ => unreachable!("trait parsed to something other than trait")
- }
- })
- }
- }
-}
-
-// Create a duplicate of the annotatable, based on the MetaItem
-fn expand_duplicate(cx: &mut ExtCtxt,
- sp: Span,
- mi: &MetaItem,
- it: &Annotatable,
- push: &mut FnMut(Annotatable))
-{
- let copy_name = match mi.node {
- ast::MetaItemKind::List(_, ref xs) => {
- if let ast::MetaItemKind::Word(ref w) = xs[0].node {
- token::str_to_ident(&w)
- } else {
- cx.span_err(mi.span, "Expected word");
- return;
- }
- }
- _ => {
- cx.span_err(mi.span, "Expected list");
- return;
- }
- };
-
- // Duplicate the item but replace its ident by the MetaItem
- match it.clone() {
- Annotatable::Item(it) => {
- let mut new_it = (*it).clone();
- new_it.attrs.clear();
- new_it.ident = copy_name;
- push(Annotatable::Item(P(new_it)));
- }
- Annotatable::ImplItem(it) => {
- let mut new_it = (*it).clone();
- new_it.attrs.clear();
- new_it.ident = copy_name;
- push(Annotatable::ImplItem(P(new_it)));
- }
- Annotatable::TraitItem(tt) => {
- let mut new_it = (*tt).clone();
- new_it.attrs.clear();
- new_it.ident = copy_name;
- push(Annotatable::TraitItem(P(new_it)));
- }
- }
-}
-
-pub fn foo() {}
+++ /dev/null
-// 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, rustc_private)]
-
-extern crate syntax;
-extern crate rustc;
-extern crate rustc_plugin;
-
-use std::borrow::ToOwned;
-use syntax::ast;
-use syntax::codemap::Span;
-use syntax::ext::build::AstBuilder;
-use syntax::ext::base::{TTMacroExpander, ExtCtxt, MacResult, MacEager, NormalTT};
-use syntax::parse::token;
-use syntax::print::pprust;
-use syntax::ptr::P;
-use rustc_plugin::Registry;
-
-struct Expander {
- args: Vec<P<ast::MetaItem>>,
-}
-
-impl TTMacroExpander for Expander {
- fn expand<'cx>(&self,
- ecx: &'cx mut ExtCtxt,
- sp: Span,
- _: &[ast::TokenTree]) -> Box<MacResult+'cx> {
- let args = self.args.iter().map(|i| pprust::meta_item_to_string(&*i))
- .collect::<Vec<_>>().join(", ");
- let interned = token::intern_and_get_ident(&args[..]);
- MacEager::expr(ecx.expr_str(sp, interned))
- }
-}
-
-#[plugin_registrar]
-pub fn plugin_registrar(reg: &mut Registry) {
- let args = reg.args().clone();
- reg.register_syntax_extension(token::intern("plugin_args"),
- // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
- NormalTT(Box::new(Expander { args: args, }), None, false));
-}
+++ /dev/null
-// 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(box_syntax, rustc_private)]
-
-extern crate rustc;
-extern crate rustc_plugin;
-
-use std::any::Any;
-use std::cell::RefCell;
-use rustc_plugin::Registry;
-
-struct Foo {
- foo: isize
-}
-
-impl Drop for Foo {
- fn drop(&mut self) {}
-}
-
-#[plugin_registrar]
-pub fn registrar(_: &mut Registry) {
- thread_local!(static FOO: RefCell<Option<Box<Any+Send>>> = RefCell::new(None));
- FOO.with(|s| *s.borrow_mut() = Some(box Foo { foo: 10 } as Box<Any+Send>));
-}
+++ /dev/null
-// 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)]
-#![deny(plugin_as_library)] // should have no effect in a plugin crate
-
-extern crate macro_crate_test;
-extern crate rustc;
-extern crate rustc_plugin;
-
-use rustc_plugin::Registry;
-
-#[plugin_registrar]
-pub fn plugin_registrar(_: &mut Registry) { }
+++ /dev/null
-// 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
-
-#![crate_type="dylib"]
-#![feature(plugin_registrar, quote, rustc_private)]
-
-extern crate syntax;
-extern crate rustc;
-extern crate rustc_plugin;
-
-use syntax::codemap::Span;
-use syntax::parse::token::{self, str_to_ident, NtExpr, NtPat};
-use syntax::ast::{TokenTree, Pat};
-use syntax::ext::base::{ExtCtxt, MacResult, DummyResult, MacEager};
-use syntax::ext::build::AstBuilder;
-use syntax::ext::tt::macro_parser::{MatchedSeq, MatchedNonterminal};
-use syntax::ext::tt::macro_parser::{Success, Failure, Error};
-use syntax::ptr::P;
-use rustc_plugin::Registry;
-
-fn expand_mbe_matches(cx: &mut ExtCtxt, sp: Span, args: &[TokenTree])
- -> Box<MacResult + 'static> {
-
- let mbe_matcher = quote_matcher!(cx, $matched:expr, $($pat:pat)|+);
-
- let mac_expr = match TokenTree::parse(cx, &mbe_matcher[..], args) {
- Success(map) => {
- match (&*map[&str_to_ident("matched").name], &*map[&str_to_ident("pat").name]) {
- (&MatchedNonterminal(NtExpr(ref matched_expr)),
- &MatchedSeq(ref pats, seq_sp)) => {
- let pats: Vec<P<Pat>> = pats.iter().map(|pat_nt|
- if let &MatchedNonterminal(NtPat(ref pat)) = &**pat_nt {
- pat.clone()
- } else {
- unreachable!()
- }
- ).collect();
- let arm = cx.arm(seq_sp, pats, cx.expr_bool(seq_sp, true));
-
- quote_expr!(cx,
- match $matched_expr {
- $arm
- _ => false
- }
- )
- }
- _ => unreachable!()
- }
- }
- Failure(_, s) | Error(_, s) => {
- panic!("expected Success, but got Error/Failure: {}", s);
- }
- };
-
- MacEager::expr(mac_expr)
-}
-
-#[plugin_registrar]
-pub fn plugin_registrar(reg: &mut Registry) {
- reg.register_macro("matches", expand_mbe_matches);
-}
+++ /dev/null
-// 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
-
-#![crate_type="dylib"]
-#![feature(plugin_registrar, rustc_private)]
-#![feature(slice_patterns)]
-
-extern crate syntax;
-extern crate rustc;
-extern crate rustc_plugin;
-
-use syntax::codemap::Span;
-use syntax::ast::TokenTree;
-use syntax::parse::token;
-use syntax::ext::base::{ExtCtxt, MacResult, DummyResult, MacEager};
-use syntax::ext::build::AstBuilder; // trait for expr_usize
-use rustc_plugin::Registry;
-
-// WARNING WARNING WARNING WARNING WARNING
-// =======================================
-//
-// This code also appears in src/doc/guide-plugin.md. Please keep
-// the two copies in sync! FIXME: have rustdoc read this file
-
-fn expand_rn(cx: &mut ExtCtxt, sp: Span, args: &[TokenTree])
- -> Box<MacResult + 'static> {
-
- static NUMERALS: &'static [(&'static str, usize)] = &[
- ("M", 1000), ("CM", 900), ("D", 500), ("CD", 400),
- ("C", 100), ("XC", 90), ("L", 50), ("XL", 40),
- ("X", 10), ("IX", 9), ("V", 5), ("IV", 4),
- ("I", 1)];
-
- if args.len() != 1 {
- cx.span_err(
- sp,
- &format!("argument should be a single identifier, but got {} arguments", args.len()));
- return DummyResult::any(sp);
- }
-
- let text = match args[0] {
- TokenTree::Token(_, token::Ident(s)) => s.to_string(),
- _ => {
- cx.span_err(sp, "argument should be a single identifier");
- return DummyResult::any(sp);
- }
- };
-
- let mut text = &*text;
- let mut total = 0;
- while !text.is_empty() {
- match NUMERALS.iter().find(|&&(rn, _)| text.starts_with(rn)) {
- Some(&(rn, val)) => {
- total += val;
- text = &text[rn.len()..];
- }
- None => {
- cx.span_err(sp, "invalid Roman numeral");
- return DummyResult::any(sp);
- }
- }
- }
-
- MacEager::expr(cx.expr_usize(sp, total))
-}
-
-#[plugin_registrar]
-pub fn plugin_registrar(reg: &mut Registry) {
- reg.register_macro("rn", expand_rn);
-}
+++ /dev/null
-// 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
-
-#![crate_type = "dylib"]
-
-pub fn the_answer() -> isize {
- 2
-}
+++ /dev/null
-// 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
-
-#![crate_type = "dylib"]
-#![feature(plugin_registrar, quote, rustc_private)]
-
-extern crate syntax_extension_with_dll_deps_1 as other;
-extern crate syntax;
-extern crate rustc;
-extern crate rustc_plugin;
-
-use syntax::ast::{TokenTree, Item, MetaItem};
-use syntax::codemap::Span;
-use syntax::ext::base::*;
-use rustc_plugin::Registry;
-
-#[plugin_registrar]
-pub fn plugin_registrar(reg: &mut Registry) {
- reg.register_macro("foo", expand_foo);
-}
-
-fn expand_foo(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree])
- -> Box<MacResult+'static> {
- let answer = other::the_answer();
- MacEager::expr(quote_expr!(cx, $answer))
-}
--- /dev/null
+// 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)
+}
--- /dev/null
+// 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()))
+ }
+ })
+}
--- /dev/null
+// 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);
+}
--- /dev/null
+// 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"]
--- /dev/null
+// 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"]
--- /dev/null
+// 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"]
+
+#[macro_use] #[no_link] extern crate issue_13560_1 as t1;
+#[macro_use] extern crate issue_13560_2 as t2;
--- /dev/null
+// 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"]
+
+use std::cell::RefCell;
+
+pub struct Window<Data>{
+ pub data: RefCell<Data>
+}
+
+impl<Data: Update> Window<Data> {
+ pub fn update(&self, e: i32) {
+ match e {
+ 1 => self.data.borrow_mut().update(),
+ _ => {}
+ }
+ }
+}
+
+pub trait Update {
+ fn update(&mut self);
+}
--- /dev/null
+// 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"]
+
+struct Foo;
+// This is the ICE trigger
+struct Formatter;
+
+trait Show {
+ fn fmt(&self);
+}
+
+impl Show for Foo {
+ fn fmt(&self) {}
+}
+
+fn bar<T>(f: extern "Rust" fn(&T), t: &T) { }
+
+// ICE requirement: this has to be marked as inline
+#[inline]
+pub fn baz() {
+ bar(Show::fmt, &Foo);
+}
--- /dev/null
+// 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.
+
+// force-host
+
+#![feature(plugin_registrar, quote, rustc_private)]
+#![crate_type = "dylib"]
+
+extern crate syntax;
+extern crate rustc;
+extern crate rustc_plugin;
+
+use syntax::ast;
+use syntax::codemap;
+use syntax::ext::base::{ExtCtxt, MacResult, MacEager};
+use syntax::util::small_vector::SmallVector;
+use rustc_plugin::Registry;
+
+#[plugin_registrar]
+pub fn plugin_registrar(reg: &mut Registry) {
+ reg.register_macro("multiple_items", expand)
+}
+
+fn expand(cx: &mut ExtCtxt, _: codemap::Span, _: &[ast::TokenTree]) -> Box<MacResult+'static> {
+ MacEager::items(SmallVector::many(vec![
+ quote_item!(cx, struct Struct1;).unwrap(),
+ quote_item!(cx, struct Struct2;).unwrap()
+ ]))
+}
--- /dev/null
+// 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.
+
+#![feature(rustc_private)]
+
+// We're testing linkage visibility; the compiler warns us, but we want to
+// do the runtime check that these functions aren't exported.
+#![allow(private_no_mangle_fns)]
+
+extern crate rustc_back;
+
+use rustc_back::dynamic_lib::DynamicLibrary;
+
+#[no_mangle]
+pub fn foo() { bar(); }
+
+pub fn foo2<T>() {
+ fn bar2() {
+ bar();
+ }
+ bar2();
+}
+
+#[no_mangle]
+fn bar() { }
+
+#[allow(dead_code)]
+#[no_mangle]
+fn baz() { }
+
+pub fn test() {
+ let lib = DynamicLibrary::open(None).unwrap();
+ unsafe {
+ assert!(lib.symbol::<isize>("foo").is_ok());
+ assert!(lib.symbol::<isize>("baz").is_err());
+ assert!(lib.symbol::<isize>("bar").is_err());
+ }
+}
--- /dev/null
+// 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 syntax;
+
+use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass, LateLintPassObject, LintArray};
+use rustc_plugin::Registry;
+use rustc::hir;
+use syntax::attr;
+
+declare_lint!(CRATE_NOT_OKAY, Warn, "crate not marked with #![crate_okay]");
+
+struct Pass;
+
+impl LintPass for Pass {
+ fn get_lints(&self) -> LintArray {
+ lint_array!(CRATE_NOT_OKAY)
+ }
+}
+
+impl LateLintPass for Pass {
+ fn check_crate(&mut self, cx: &LateContext, krate: &hir::Crate) {
+ if !attr::contains_name(&krate.attrs, "crate_okay") {
+ cx.span_lint(CRATE_NOT_OKAY, krate.span,
+ "crate is not marked with #![crate_okay]");
+ }
+ }
+}
+
+#[plugin_registrar]
+pub fn plugin_registrar(reg: &mut Registry) {
+ reg.register_late_lint_pass(box Pass as LateLintPassObject);
+}
--- /dev/null
+// 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(box_syntax, rustc_private)]
+
+// Load rustc as a plugin to get macros
+#[macro_use]
+extern crate rustc;
+extern crate rustc_plugin;
+
+use rustc::hir;
+use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass, LateLintPassObject, LintArray};
+use rustc_plugin::Registry;
+
+declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'");
+
+declare_lint!(PLEASE_LINT, Warn, "Warn about items named 'pleaselintme'");
+
+struct Pass;
+
+impl LintPass for Pass {
+ fn get_lints(&self) -> LintArray {
+ lint_array!(TEST_LINT, PLEASE_LINT)
+ }
+}
+
+impl LateLintPass for Pass {
+ fn check_item(&mut self, cx: &LateContext, it: &hir::Item) {
+ match &*it.name.as_str() {
+ "lintme" => cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'"),
+ "pleaselintme" => cx.span_lint(PLEASE_LINT, it.span, "item is named 'pleaselintme'"),
+ _ => {}
+ }
+ }
+}
+
+#[plugin_registrar]
+pub fn plugin_registrar(reg: &mut Registry) {
+ reg.register_late_lint_pass(box Pass as LateLintPassObject);
+ reg.register_lint_group("lint_me", vec![TEST_LINT, PLEASE_LINT]);
+}
--- /dev/null
+// 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(box_syntax, rustc_private)]
+
+extern crate syntax;
+
+// Load rustc as a plugin to get macros
+#[macro_use]
+extern crate rustc;
+extern crate rustc_plugin;
+
+use rustc::lint::{EarlyContext, LintContext, LintPass, EarlyLintPass,
+ EarlyLintPassObject, LintArray};
+use rustc_plugin::Registry;
+use syntax::ast;
+declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'");
+
+struct Pass;
+
+impl LintPass for Pass {
+ fn get_lints(&self) -> LintArray {
+ lint_array!(TEST_LINT)
+ }
+}
+
+impl EarlyLintPass for Pass {
+ fn check_item(&mut self, cx: &EarlyContext, it: &ast::Item) {
+ if it.ident.name.as_str() == "lintme" {
+ cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'");
+ }
+ }
+}
+
+#[plugin_registrar]
+pub fn plugin_registrar(reg: &mut Registry) {
+ reg.register_early_lint_pass(box Pass as EarlyLintPassObject);
+}
--- /dev/null
+// 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(rustc_private)]
+
+extern crate rustc;
+extern crate rustc_plugin;
+
+use rustc_plugin::Registry;
+
+#[plugin_registrar]
+pub fn plugin_registrar(reg: &mut Registry) {
+ // This pass is built in to LLVM.
+ //
+ // Normally, we would name a pass that was registered through
+ // C++ static object constructors in the same .so file as the
+ // plugin registrar.
+ reg.register_llvm_pass("gvn");
+}
--- /dev/null
+// 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.
+
+#![feature(rustc_private)]
+
+#[macro_use] extern crate log;
+
+pub fn foo<T>() {
+ fn death() -> isize { panic!() }
+ debug!("{}", (||{ death() })());
+}
--- /dev/null
+// 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"]
+
+pub fn foo() {}
--- /dev/null
+// 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(rustc_private)]
+
+extern crate rustc;
+extern crate rustc_plugin;
+
+use rustc_plugin::Registry;
+
+#[plugin_registrar]
+pub fn plugin_registrar(_reg: &mut Registry) {}
--- /dev/null
+// 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.
+
+// force-host
+
+#![feature(plugin_registrar, quote, rustc_private)]
+
+extern crate syntax;
+extern crate rustc;
+extern crate rustc_plugin;
+
+use syntax::ast::{self, TokenTree, Item, MetaItem, ImplItem, TraitItem, ItemKind};
+use syntax::codemap::Span;
+use syntax::ext::base::*;
+use syntax::parse::{self, token};
+use syntax::ptr::P;
+use rustc_plugin::Registry;
+
+#[macro_export]
+macro_rules! exported_macro { () => (2) }
+macro_rules! unexported_macro { () => (3) }
+
+#[plugin_registrar]
+pub fn plugin_registrar(reg: &mut Registry) {
+ reg.register_macro("make_a_1", expand_make_a_1);
+ reg.register_macro("identity", expand_identity);
+ reg.register_syntax_extension(
+ token::intern("into_multi_foo"),
+ // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
+ MultiModifier(Box::new(expand_into_foo_multi)));
+ reg.register_syntax_extension(
+ token::intern("duplicate"),
+ // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
+ MultiDecorator(Box::new(expand_duplicate)));
+}
+
+fn expand_make_a_1(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree])
+ -> Box<MacResult+'static> {
+ if !tts.is_empty() {
+ cx.span_fatal(sp, "make_a_1 takes no arguments");
+ }
+ MacEager::expr(quote_expr!(cx, 1))
+}
+
+// See Issue #15750
+fn expand_identity(cx: &mut ExtCtxt, _span: Span, tts: &[TokenTree])
+ -> Box<MacResult+'static> {
+ // Parse an expression and emit it unchanged.
+ let mut parser = parse::new_parser_from_tts(cx.parse_sess(),
+ cx.cfg(), tts.to_vec());
+ let expr = parser.parse_expr().unwrap();
+ MacEager::expr(quote_expr!(&mut *cx, $expr))
+}
+
+fn expand_into_foo_multi(cx: &mut ExtCtxt,
+ sp: Span,
+ attr: &MetaItem,
+ it: Annotatable) -> Annotatable {
+ match it {
+ Annotatable::Item(it) => {
+ Annotatable::Item(P(Item {
+ attrs: it.attrs.clone(),
+ ..(*quote_item!(cx, enum Foo2 { Bar2, Baz2 }).unwrap()).clone()
+ }))
+ }
+ Annotatable::ImplItem(it) => {
+ quote_item!(cx, impl X { fn foo(&self) -> i32 { 42 } }).unwrap().and_then(|i| {
+ match i.node {
+ ItemKind::Impl(_, _, _, _, _, mut items) => {
+ Annotatable::ImplItem(P(items.pop().expect("impl method not found")))
+ }
+ _ => unreachable!("impl parsed to something other than impl")
+ }
+ })
+ }
+ Annotatable::TraitItem(it) => {
+ quote_item!(cx, trait X { fn foo(&self) -> i32 { 0 } }).unwrap().and_then(|i| {
+ match i.node {
+ ItemKind::Trait(_, _, _, mut items) => {
+ Annotatable::TraitItem(P(items.pop().expect("trait method not found")))
+ }
+ _ => unreachable!("trait parsed to something other than trait")
+ }
+ })
+ }
+ }
+}
+
+// Create a duplicate of the annotatable, based on the MetaItem
+fn expand_duplicate(cx: &mut ExtCtxt,
+ sp: Span,
+ mi: &MetaItem,
+ it: &Annotatable,
+ push: &mut FnMut(Annotatable))
+{
+ let copy_name = match mi.node {
+ ast::MetaItemKind::List(_, ref xs) => {
+ if let ast::MetaItemKind::Word(ref w) = xs[0].node {
+ token::str_to_ident(&w)
+ } else {
+ cx.span_err(mi.span, "Expected word");
+ return;
+ }
+ }
+ _ => {
+ cx.span_err(mi.span, "Expected list");
+ return;
+ }
+ };
+
+ // Duplicate the item but replace its ident by the MetaItem
+ match it.clone() {
+ Annotatable::Item(it) => {
+ let mut new_it = (*it).clone();
+ new_it.attrs.clear();
+ new_it.ident = copy_name;
+ push(Annotatable::Item(P(new_it)));
+ }
+ Annotatable::ImplItem(it) => {
+ let mut new_it = (*it).clone();
+ new_it.attrs.clear();
+ new_it.ident = copy_name;
+ push(Annotatable::ImplItem(P(new_it)));
+ }
+ Annotatable::TraitItem(tt) => {
+ let mut new_it = (*tt).clone();
+ new_it.attrs.clear();
+ new_it.ident = copy_name;
+ push(Annotatable::TraitItem(P(new_it)));
+ }
+ }
+}
+
+pub fn foo() {}
--- /dev/null
+// 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, rustc_private)]
+
+extern crate syntax;
+extern crate rustc;
+extern crate rustc_plugin;
+
+use std::borrow::ToOwned;
+use syntax::ast;
+use syntax::codemap::Span;
+use syntax::ext::build::AstBuilder;
+use syntax::ext::base::{TTMacroExpander, ExtCtxt, MacResult, MacEager, NormalTT};
+use syntax::parse::token;
+use syntax::print::pprust;
+use syntax::ptr::P;
+use rustc_plugin::Registry;
+
+struct Expander {
+ args: Vec<P<ast::MetaItem>>,
+}
+
+impl TTMacroExpander for Expander {
+ fn expand<'cx>(&self,
+ ecx: &'cx mut ExtCtxt,
+ sp: Span,
+ _: &[ast::TokenTree]) -> Box<MacResult+'cx> {
+ let args = self.args.iter().map(|i| pprust::meta_item_to_string(&*i))
+ .collect::<Vec<_>>().join(", ");
+ let interned = token::intern_and_get_ident(&args[..]);
+ MacEager::expr(ecx.expr_str(sp, interned))
+ }
+}
+
+#[plugin_registrar]
+pub fn plugin_registrar(reg: &mut Registry) {
+ let args = reg.args().clone();
+ reg.register_syntax_extension(token::intern("plugin_args"),
+ // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
+ NormalTT(Box::new(Expander { args: args, }), None, false));
+}
--- /dev/null
+// 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(box_syntax, rustc_private)]
+
+extern crate rustc;
+extern crate rustc_plugin;
+
+use std::any::Any;
+use std::cell::RefCell;
+use rustc_plugin::Registry;
+
+struct Foo {
+ foo: isize
+}
+
+impl Drop for Foo {
+ fn drop(&mut self) {}
+}
+
+#[plugin_registrar]
+pub fn registrar(_: &mut Registry) {
+ thread_local!(static FOO: RefCell<Option<Box<Any+Send>>> = RefCell::new(None));
+ FOO.with(|s| *s.borrow_mut() = Some(box Foo { foo: 10 } as Box<Any+Send>));
+}
--- /dev/null
+// 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)]
+#![deny(plugin_as_library)] // should have no effect in a plugin crate
+
+extern crate macro_crate_test;
+extern crate rustc;
+extern crate rustc_plugin;
+
+use rustc_plugin::Registry;
+
+#[plugin_registrar]
+pub fn plugin_registrar(_: &mut Registry) { }
--- /dev/null
+// 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
+
+#![crate_type="dylib"]
+#![feature(plugin_registrar, quote, rustc_private)]
+
+extern crate syntax;
+extern crate rustc;
+extern crate rustc_plugin;
+
+use syntax::codemap::Span;
+use syntax::parse::token::{self, str_to_ident, NtExpr, NtPat};
+use syntax::ast::{TokenTree, Pat};
+use syntax::ext::base::{ExtCtxt, MacResult, DummyResult, MacEager};
+use syntax::ext::build::AstBuilder;
+use syntax::ext::tt::macro_parser::{MatchedSeq, MatchedNonterminal};
+use syntax::ext::tt::macro_parser::{Success, Failure, Error};
+use syntax::ptr::P;
+use rustc_plugin::Registry;
+
+fn expand_mbe_matches(cx: &mut ExtCtxt, sp: Span, args: &[TokenTree])
+ -> Box<MacResult + 'static> {
+
+ let mbe_matcher = quote_matcher!(cx, $matched:expr, $($pat:pat)|+);
+
+ let mac_expr = match TokenTree::parse(cx, &mbe_matcher[..], args) {
+ Success(map) => {
+ match (&*map[&str_to_ident("matched").name], &*map[&str_to_ident("pat").name]) {
+ (&MatchedNonterminal(NtExpr(ref matched_expr)),
+ &MatchedSeq(ref pats, seq_sp)) => {
+ let pats: Vec<P<Pat>> = pats.iter().map(|pat_nt|
+ if let &MatchedNonterminal(NtPat(ref pat)) = &**pat_nt {
+ pat.clone()
+ } else {
+ unreachable!()
+ }
+ ).collect();
+ let arm = cx.arm(seq_sp, pats, cx.expr_bool(seq_sp, true));
+
+ quote_expr!(cx,
+ match $matched_expr {
+ $arm
+ _ => false
+ }
+ )
+ }
+ _ => unreachable!()
+ }
+ }
+ Failure(_, s) | Error(_, s) => {
+ panic!("expected Success, but got Error/Failure: {}", s);
+ }
+ };
+
+ MacEager::expr(mac_expr)
+}
+
+#[plugin_registrar]
+pub fn plugin_registrar(reg: &mut Registry) {
+ reg.register_macro("matches", expand_mbe_matches);
+}
--- /dev/null
+// 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
+
+#![crate_type="dylib"]
+#![feature(plugin_registrar, rustc_private)]
+#![feature(slice_patterns)]
+
+extern crate syntax;
+extern crate rustc;
+extern crate rustc_plugin;
+
+use syntax::codemap::Span;
+use syntax::ast::TokenTree;
+use syntax::parse::token;
+use syntax::ext::base::{ExtCtxt, MacResult, DummyResult, MacEager};
+use syntax::ext::build::AstBuilder; // trait for expr_usize
+use rustc_plugin::Registry;
+
+// WARNING WARNING WARNING WARNING WARNING
+// =======================================
+//
+// This code also appears in src/doc/guide-plugin.md. Please keep
+// the two copies in sync! FIXME: have rustdoc read this file
+
+fn expand_rn(cx: &mut ExtCtxt, sp: Span, args: &[TokenTree])
+ -> Box<MacResult + 'static> {
+
+ static NUMERALS: &'static [(&'static str, usize)] = &[
+ ("M", 1000), ("CM", 900), ("D", 500), ("CD", 400),
+ ("C", 100), ("XC", 90), ("L", 50), ("XL", 40),
+ ("X", 10), ("IX", 9), ("V", 5), ("IV", 4),
+ ("I", 1)];
+
+ if args.len() != 1 {
+ cx.span_err(
+ sp,
+ &format!("argument should be a single identifier, but got {} arguments", args.len()));
+ return DummyResult::any(sp);
+ }
+
+ let text = match args[0] {
+ TokenTree::Token(_, token::Ident(s)) => s.to_string(),
+ _ => {
+ cx.span_err(sp, "argument should be a single identifier");
+ return DummyResult::any(sp);
+ }
+ };
+
+ let mut text = &*text;
+ let mut total = 0;
+ while !text.is_empty() {
+ match NUMERALS.iter().find(|&&(rn, _)| text.starts_with(rn)) {
+ Some(&(rn, val)) => {
+ total += val;
+ text = &text[rn.len()..];
+ }
+ None => {
+ cx.span_err(sp, "invalid Roman numeral");
+ return DummyResult::any(sp);
+ }
+ }
+ }
+
+ MacEager::expr(cx.expr_usize(sp, total))
+}
+
+#[plugin_registrar]
+pub fn plugin_registrar(reg: &mut Registry) {
+ reg.register_macro("rn", expand_rn);
+}
--- /dev/null
+// 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
+
+#![crate_type = "dylib"]
+
+pub fn the_answer() -> isize {
+ 2
+}
--- /dev/null
+// 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
+
+#![crate_type = "dylib"]
+#![feature(plugin_registrar, quote, rustc_private)]
+
+extern crate syntax_extension_with_dll_deps_1 as other;
+extern crate syntax;
+extern crate rustc;
+extern crate rustc_plugin;
+
+use syntax::ast::{TokenTree, Item, MetaItem};
+use syntax::codemap::Span;
+use syntax::ext::base::*;
+use rustc_plugin::Registry;
+
+#[plugin_registrar]
+pub fn plugin_registrar(reg: &mut Registry) {
+ reg.register_macro("foo", expand_foo);
+}
+
+fn expand_foo(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree])
+ -> Box<MacResult+'static> {
+ let answer = other::the_answer();
+ MacEager::expr(quote_expr!(cx, $answer))
+}
+++ /dev/null
-// 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() }
-}
+++ /dev/null
-// 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;
-}
+++ /dev/null
-// 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 }
- }
-}
+++ /dev/null
-// 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;
-}
+++ /dev/null
-// 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 }
-}
+++ /dev/null
-// 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) {
- }
-}
+++ /dev/null
-// 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: () = ();
+++ /dev/null
-// 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: () = ();
+++ /dev/null
-// 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
-}
+++ /dev/null
-// 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
-}
+++ /dev/null
-// 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
- }
- }
-}
+++ /dev/null
-// 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
- }
- }
-}
+++ /dev/null
-// 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
- }
- }
-}
+++ /dev/null
-// 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
- }
- }
-}
+++ /dev/null
-// 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
- }
- }
-}
+++ /dev/null
-// 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
- }
- }
-}
+++ /dev/null
-// 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);
- }
-}
+++ /dev/null
-// 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;
+++ /dev/null
-// 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
-};
+++ /dev/null
-// 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;
- }
- }
-}
+++ /dev/null
-// 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)
- }
-}
+++ /dev/null
-// 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;
- }
-}
+++ /dev/null
-// 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()),
- };
-}
+++ /dev/null
-// 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;
- }
-}
+++ /dev/null
-// 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 };
-}
+++ /dev/null
-// 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
-}
+++ /dev/null
-// 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);
- }
-}
+++ /dev/null
-// 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);
- }
-}
+++ /dev/null
-// 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;
+++ /dev/null
-// 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);
+++ /dev/null
-// 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);
+++ /dev/null
-// 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
+++ /dev/null
-// 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() {}
+++ /dev/null
-// 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) {
- }
- }
-}
+++ /dev/null
-// 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)> }
+++ /dev/null
-// 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 {}
-
+++ /dev/null
-// 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,
-}
+++ /dev/null
-// 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);
- }
-}
+++ /dev/null
-// 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
- }
-}
+++ /dev/null
-// 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 }
+++ /dev/null
-// 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)
-}
+++ /dev/null
-// 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() {}
-}
+++ /dev/null
-// 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;
- }
- }
-}
+++ /dev/null
-// 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() {}
+++ /dev/null
-// 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());
- }
-}
+++ /dev/null
-// 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)
- }
-}
+++ /dev/null
-// 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;
+++ /dev/null
-// 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) {}
-}
+++ /dev/null
-// 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 }
- }
-}
+++ /dev/null
-// 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) {}
-}
+++ /dev/null
-// 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();
-}
+++ /dev/null
-// 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()
-};
+++ /dev/null
-// 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
- }
-}
+++ /dev/null
-// 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();
-}
+++ /dev/null
-// 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);
-}
+++ /dev/null
-// 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)
-}
+++ /dev/null
-// 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);
-}
+++ /dev/null
-// 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() }
+++ /dev/null
-// 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);
+++ /dev/null
-// 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"]
+++ /dev/null
-// 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;
+++ /dev/null
-// 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"]
+++ /dev/null
-// 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) {
- }
-}
+++ /dev/null
-// Copyright 2012-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 Foo {
- pub foo: extern fn()
-}
-
-extern fn the_foo() {}
-
-pub const FOO: Foo = Foo {
- foo: the_foo
-};
+++ /dev/null
-// Copyright 2012-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.
-
-extern crate issue_13620_1 as crate1;
-
-pub static FOO2: crate1::Foo = crate1::FOO;
+++ /dev/null
-// 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 enum A { B }
+++ /dev/null
-// 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.
-
-extern crate issue_13872_1 as foo;
-
-pub use foo::A::B;
+++ /dev/null
-// 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.
-
-extern crate issue_13872_2 as bar;
-
-use bar::B;
-
-pub fn foo() {
- match B {
- B => {}
- }
-}
+++ /dev/null
-// 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"]
-
-pub fn foo() {}
+++ /dev/null
-// 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.
-
-extern crate issue_14344_1;
-
-pub fn bar() {}
+++ /dev/null
-// 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"]
-#![deny(warnings)]
-#![allow(dead_code)]
-
-pub use src::aliases::B;
-pub use src::hidden_core::make;
-
-mod src {
- pub mod aliases {
- use super::hidden_core::A;
- pub type B = A<f32>;
- }
-
- pub mod hidden_core {
- use super::aliases::B;
-
- pub struct A<T> { t: T }
-
- pub fn make() -> B { A { t: 1.0 } }
-
- impl<T> A<T> {
- pub fn foo(&mut self) { println!("called foo"); }
- }
- }
-}
+++ /dev/null
-// 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"]
-#![deny(warnings)]
-
-pub use src::aliases::B;
-pub use src::hidden_core::make;
-
-mod src {
- pub mod aliases {
- use super::hidden_core::A;
- pub type B = A;
- }
-
- pub mod hidden_core {
- use super::aliases::B;
-
- #[derive(Copy, Clone)]
- pub struct A;
-
- pub fn make() -> B { A }
-
- impl A {
- pub fn foo(&mut self) { println!("called foo"); }
- }
- }
-}
+++ /dev/null
-// 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"]
-
-extern {
- pub fn transmute();
-}
+++ /dev/null
-// 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 TreeBuilder<H> { pub h: H }
-
-impl<H> TreeBuilder<H> {
- pub fn process_token(&mut self) {
- match self {
- _ => for _y in self.by_ref() {}
- }
- }
-}
-
-impl<H> Iterator for TreeBuilder<H> {
- type Item = H;
-
- fn next(&mut self) -> Option<H> {
- None
- }
-}
+++ /dev/null
-// 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 trait Foo<'a, T> {
- fn foo(&'a self) -> T;
-}
-
-pub fn foo<'a, T>(x: &'a Foo<'a, T>) -> T {
- let x: &'a Foo<T> = x;
- // ^ the lifetime parameter of Foo is left to be inferred.
- x.foo()
- // ^ encoding this method call in metadata triggers an ICE.
-}
+++ /dev/null
-// 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(const_fn)]
-
-use std::sync::atomic;
-
-pub const C1: usize = 1;
-pub const C2: atomic::AtomicUsize = atomic::AtomicUsize::new(0);
-pub const C3: fn() = foo;
-pub const C4: usize = C1 * C1 + C1 / C1;
-pub const C5: &'static usize = &C4;
-
-pub static S1: usize = 3;
-pub static S2: atomic::AtomicUsize = atomic::AtomicUsize::new(0);
-
-fn foo() {}
+++ /dev/null
-// 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 = "rlib"]
-struct Foo;
-
-trait Tr {
- fn tr(&self);
-}
-
-impl Tr for Foo {
- fn tr(&self) {}
-}
-
-fn take_method<T>(f: fn(&T), t: &T) {}
-
-#[inline]
-pub fn pass_method() {
- take_method(Tr::tr, &Foo);
-}
+++ /dev/null
-// 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 = "rlib"]
-
-pub trait Tr {
- fn tr(&self);
-}
-
-pub struct St<V>(pub Vec<V>);
-
-impl<V> Tr for St<V> {
- fn tr(&self) {
- match self {
- &St(ref v) => {
- v.iter();
- }
- }
- }
-}
+++ /dev/null
-// 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(unboxed_closures)]
-#![crate_type = "rlib"]
-
-pub fn inner<F>(f: F) -> F {
- (move || f)()
-}
+++ /dev/null
-// 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"]
-#![crate_name = "foo"]
-
-pub fn foo() -> i32 { 0 }
+++ /dev/null
-// 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"]
-#![crate_name = "foo"]
-
-pub fn foo() -> i32 { 1 }
+++ /dev/null
-// 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 enum Homura {
- Madoka { name: String },
-}
+++ /dev/null
-// 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="a"]
-#![crate_type = "lib"]
-
-#![allow(unknown_features)]
-#![feature(box_syntax)]
-
-pub trait i<T>
-{
- fn dummy(&self, t: T) -> T { panic!() }
-}
-
-pub fn f<T>() -> Box<i<T>+'static> {
- impl<T> i<T> for () { }
-
- box () as Box<i<T>+'static>
-}
+++ /dev/null
-// 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="a"]
-#![crate_type = "lib"]
-
-type t1 = usize;
-
-trait foo {
- fn foo(&self);
-}
-
-impl foo for String {
- fn foo(&self) {}
-}
+++ /dev/null
-// Copyright 2012-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"]
-#![crate_type = "lib"]
-
-extern crate a;
+++ /dev/null
-// 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(linked_from)]
-
-#![crate_type = "rlib"]
-
-#[link(name = "rust_test_helpers", kind = "static")]
-#[linked_from = "rust_test_helpers"]
-extern {
- pub fn rust_dbg_extern_identity_u32(u: u32) -> u32;
-}
+++ /dev/null
-// 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.
-
-extern crate issue_25185_1;
-
-pub use issue_25185_1::rust_dbg_extern_identity_u32;
+++ /dev/null
-// 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="issue_2526"]
-#![crate_type = "lib"]
-
-use std::marker;
-
-pub struct arc_destruct<T: Sync> {
- _data: isize,
- _marker: marker::PhantomData<T>
-}
-
-impl<T: Sync> Drop for arc_destruct<T> {
- fn drop(&mut self) {}
-}
-
-fn arc_destruct<T: Sync>(data: isize) -> arc_destruct<T> {
- arc_destruct {
- _data: data,
- _marker: marker::PhantomData
- }
-}
-
-fn arc<T: Sync>(_data: T) -> arc_destruct<T> {
- arc_destruct(0)
-}
-
-fn init() -> arc_destruct<context_res> {
- arc(context_res())
-}
-
-pub struct context_res {
- ctx : isize,
-}
-
-impl Drop for context_res {
- fn drop(&mut self) {}
-}
-
-fn context_res() -> context_res {
- context_res {
- ctx: 0
- }
-}
-
-pub type context = arc_destruct<context_res>;
+++ /dev/null
-// 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 trait Trait {
- // the issue is sensitive to interning order - so use names
- // unlikely to appear in libstd.
- type Issue25467FooT;
- type Issue25467BarT;
-}
-
-pub type Object = Option<Box<Trait<Issue25467FooT=(),Issue25467BarT=()>>>;
+++ /dev/null
-// 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="req"]
-#![crate_type = "lib"]
-
-use std::cell::RefCell;
-use std::collections::HashMap;
-use std::rc::Rc;
-
-pub type header_map = HashMap<String, Rc<RefCell<Vec<Rc<String>>>>>;
-
-// the unused ty param is necessary so this gets monomorphized
-pub fn request<T>(req: &header_map) {
- let data = req[&"METHOD".to_string()].clone();
- let _x = data.borrow().clone()[0].clone();
-}
+++ /dev/null
-// 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.
-
-#![crate_name="a"]
-#![crate_type = "lib"]
-
-pub struct X(pub u8);
-
-impl Drop for X {
- fn drop(&mut self) {
- assert_eq!(self.0, 1)
- }
-}
-
-pub fn f(x: &mut X, g: fn()) {
- x.0 = 1;
- g();
- x.0 = 0;
-}
+++ /dev/null
-// 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="socketlib"]
-#![crate_type = "lib"]
-#![feature(libc)]
-
-pub mod socket {
- extern crate libc;
-
- pub struct socket_handle {
- sockfd: libc::c_int,
- }
-
- impl Drop for socket_handle {
- fn drop(&mut self) {
- /* c::close(self.sockfd); */
- }
- }
-
- pub fn socket_handle(x: libc::c_int) -> socket_handle {
- socket_handle {
- sockfd: x
- }
- }
-}
+++ /dev/null
-// 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.
-
-#[derive(Copy)]
-pub struct U256(pub [u64; 4]);
-
-impl Clone for U256 {
- fn clone(&self) -> U256 {
- *self
- }
-}
-
-impl U256 {
- pub fn new(value: u64) -> U256 {
- let mut ret = [0; 4];
- ret[0] = value;
- U256(ret)
- }
-}
+++ /dev/null
-// 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.
-
-// compile-flags: -g
-
-extern crate issue_31702_1;
-
-use std::collections::HashMap;
-use issue_31702_1::U256;
-
-pub struct Ethash {
- engine_params: for<'a> fn() -> Option<&'a Vec<u8>>,
- u256_params: HashMap<String, U256>,
-}
-
-impl Ethash {
- pub fn u256_param(&mut self, name: &str) -> U256 {
- let engine = self.engine_params;
- *self.u256_params.entry(name.to_owned()).or_insert_with(|| {
- engine().map_or(U256::new(0u64), |_a| loop {})
- })
- }
-}
+++ /dev/null
-// 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="numeric"]
-#![crate_type = "lib"]
-
-pub trait Trig<T> {
- fn sin(&self) -> T;
-}
-
-pub fn sin<T:Trig<R>, R>(theta: &T) -> R { theta.sin() }
-
-pub trait Angle<T>: Trig<T> {}
+++ /dev/null
-// 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 S<T>(Option<T>);
-pub fn mk<T>() -> S<T> { S(None) }
+++ /dev/null
-// Copyright 2012-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.
-
-trait A<'a, T> {
- fn f(&mut self) -> &'a mut T;
- fn p() -> T;
-}
+++ /dev/null
-// 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.
-
-
-use std::collections::HashMap;
-
-pub type map = Box<HashMap<usize, usize>>;
+++ /dev/null
-// 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 Foo<'a, A:'a>(&'a A);
-
-impl<'a, A> Foo<'a, A> {
- pub fn new(a: &'a A) -> Foo<'a, A> {
- Foo(a)
- }
-}
+++ /dev/null
-// 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 V2<T>(pub T, pub T);
+++ /dev/null
-// 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 BTree<V> {
- pub node: TreeItem<V>,
-}
-
-pub enum TreeItem<V> {
- TreeLeaf { value: V },
-}
-
-pub fn leaf<V>(value: V) -> TreeItem<V> {
- TreeItem::TreeLeaf { value: value }
-}
-
-fn main() {
- BTree::<isize> { node: leaf(1) };
-}
+++ /dev/null
-// 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 enum Foo<'a> {
- A,
- B(&'a str),
-}
+++ /dev/null
-// 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.
-
-pub use other::FooBar;
-pub use other::foo;
-
-mod other {
- pub struct FooBar{value: isize}
- impl FooBar{
- pub fn new(val: isize) -> FooBar {
- FooBar{value: val}
- }
- }
-
- pub fn foo(){
- 1+1;
- }
-}
+++ /dev/null
-// 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 use internal::core::{Trait, Struct};
-
-mod internal {
- pub mod core {
- pub struct Struct;
- impl Struct {
- pub fn init() -> Struct {
- Struct
- }
- }
-
- pub trait Trait {
- fn test(&self) {
- private();
- }
- }
-
- impl Trait for Struct {}
-
- fn private() { }
- }
-}
+++ /dev/null
-// Copyright 2012-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(core)]
-
-pub mod testtypes {
- use std::any::TypeId;
-
- pub fn type_ids() -> Vec<TypeId> {
- vec![
- TypeId::of::<FooBool>(),
- TypeId::of::<FooInt>(),
- TypeId::of::<FooUint>(),
- TypeId::of::<FooFloat>(),
- TypeId::of::<FooStr>(),
- TypeId::of::<FooArray>(),
- TypeId::of::<FooSlice>(),
- TypeId::of::<FooBox>(),
- TypeId::of::<FooPtr>(),
- TypeId::of::<FooRef>(),
- TypeId::of::<FooFnPtr>(),
- TypeId::of::<FooNil>(),
- TypeId::of::<FooTuple>(),
- TypeId::of::<FooTrait>(),
- TypeId::of::<FooStruct>(),
- TypeId::of::<FooEnum>()
- ]
- }
-
- // Tests TyBool
- pub type FooBool = bool;
-
- // Tests TyChar
- pub type FooChar = char;
-
- // Tests TyInt (does not test all variants of IntTy)
- pub type FooInt = isize;
-
- // Tests TyUint (does not test all variants of UintTy)
- pub type FooUint = usize;
-
- // Tests TyFloat (does not test all variants of FloatTy)
- pub type FooFloat = f64;
-
- // Tests TyStr
- pub type FooStr = str;
-
- // Tests TyArray
- pub type FooArray = [u8; 1];
-
- // Tests TySlice
- pub type FooSlice = [u8];
-
- // Tests TyBox (of u8)
- pub type FooBox = Box<u8>;
-
- // Tests TyRawPtr
- pub type FooPtr = *const u8;
-
- // Tests TyRef
- pub type FooRef = &'static u8;
-
- // Tests TyFnPtr
- pub type FooFnPtr = fn(u8) -> bool;
-
- // Tests TyTrait
- pub trait FooTrait {
- fn foo_method(&self) -> usize;
- }
-
- // Tests TyStruct
- pub struct FooStruct {
- pub pub_foo_field: usize,
- foo_field: usize
- }
-
- // Tests TyEnum
- pub enum FooEnum {
- VarA(usize),
- VarB(usize, usize)
- }
-
- // Tests TyTuple
- pub type FooNil = ();
- pub type FooTuple = (u8, i8, bool);
-
- // Skipping TyParam
-
- // Skipping TyInfer
-
- // Skipping TyError
-}
+++ /dev/null
-// 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.
-
-fn foo(_x: i32) {
-}
-
-pub struct rsrc {
- x: i32,
-}
-
-impl Drop for rsrc {
- fn drop(&mut self) {
- foo(self.x);
- }
-}
-
-pub fn rsrc(x: i32) -> rsrc {
- rsrc {
- x: x
- }
-}
+++ /dev/null
-// 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 Wrap<A>(pub A);
+++ /dev/null
-// 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 mod bar {
- pub fn foo() {}
-}
+++ /dev/null
-// 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 fn baz() {}
+++ /dev/null
-// 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 Foo (pub isize);
-pub enum MyEnum {
- Foo(Foo),
-}
+++ /dev/null
-// 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 trait T {
- type C;
- fn dummy(&self) { }
-}
+++ /dev/null
-// 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.
-
-enum cat {
- tabby, calico, tortoiseshell
-}
+++ /dev/null
-// Copyright 2012-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.
-
-#![allow(unused_imports)]
-
-extern crate issue_2316_a;
-
-pub mod cloth {
- use issue_2316_a::*;
-
- pub enum fabric {
- gingham, flannel, calico
- }
-}
+++ /dev/null
-// 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 S(pub ());
-
-impl S {
- pub fn foo(&self) { }
-}
-
-pub trait T {
- fn bar(&self);
-}
-
-impl T for S {
- fn bar(&self) { }
-}
+++ /dev/null
-// 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 unsafe fn f(xs: Vec<isize> ) {
- xs.iter().map(|_x| { unsafe fn q() { panic!(); } }).collect::<Vec<()>>();
-}
+++ /dev/null
-// 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 mod issue_3136_a;
+++ /dev/null
-// 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.
-
-trait x {
- fn use_x<T>(&self);
-}
-struct y(());
-impl x for y {
- fn use_x<T>(&self) {
- struct foo { //~ ERROR quux
- i: ()
- }
- fn new_foo<T>(i: ()) -> foo {
- foo { i: i }
- }
- }
-}
+++ /dev/null
-// 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="issue_3979_traits"]
-
-#![crate_type = "lib"]
-
-pub trait Positioned {
- fn SetX(&mut self, isize);
- fn X(&self) -> isize;
-}
-
-pub trait Movable: Positioned {
- fn translate(&mut self, dx: isize) {
- let x = self.X() + dx;
- self.SetX(x);
- }
-}
+++ /dev/null
-// 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.
-
-// for this issue, this code must be built in a library
-
-use std::mem;
-
-trait A {
- fn dummy(&self) { }
-}
-struct B;
-impl A for B {}
-
-fn bar<T>(_: &mut A, _: &T) {}
-
-fn foo<T>(t: &T) {
- let mut b = B;
- bar(&mut b as &mut A, t)
-}
+++ /dev/null
-// 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_type = "lib"]
-
-pub trait X {
- fn x() {
- fn f() { }
- f();
- }
- fn dummy(&self) { }
-}
+++ /dev/null
-// 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 Foo<T>(T);
-
-impl<T> Foo<T> {
- pub fn new(t: T) -> Foo<T> {
- Foo(t)
- }
-}
+++ /dev/null
-// 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 fn foo<T>() -> &'static isize {
- if false {
- static a: isize = 4;
- return &a;
- } else {
- static a: isize = 5;
- return &a;
- }
-}
-
-pub fn bar() -> &'static isize {
- foo::<isize>()
-}
+++ /dev/null
-// 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.
-
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that metadata serialization works for the `Copy` kind.
-
-#![crate_type="lib"]
-
-pub fn f<T:Copy>() {}
+++ /dev/null
-// 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_mangle]
-pub static foo: isize = 3;
-
-pub fn bar() {}
+++ /dev/null
-// 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.
-
-// ignore-test: this is not a test
-
-1
+++ /dev/null
-// 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.
-
-// ignore-test: this is not a test
-
-fn foo() { bar() }
+++ /dev/null
-// 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.
-
-#[macro_export]
-macro_rules! make_a_5 {
- () => (5)
-}
+++ /dev/null
-// 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 fn increment(x: usize) -> usize {
- x + 1
-}
-
-#[macro_export]
-macro_rules! increment {
- ($x:expr) => ($crate::increment($x))
-}
-
-pub fn check_local() {
- assert_eq!(increment!(3), 4);
-}
+++ /dev/null
-// 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 mod inner {
- #[macro_export]
- macro_rules! foo {
- () => (1)
- }
-}
+++ /dev/null
-// 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"]
-#[macro_export]
-macro_rules! reexported {
- () => ( 3 )
-}
+++ /dev/null
-// 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"]
-#![feature(macro_reexport)]
-
-#[macro_reexport(reexported)]
-#[macro_use] #[no_link]
-extern crate macro_reexport_1;
+++ /dev/null
-// 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 = "dylib"]
-#![feature(macro_reexport)]
-
-#[macro_reexport(reexported)]
-#[no_link]
-extern crate macro_reexport_1;
+++ /dev/null
-// 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"]
-
-#[macro_export]
-macro_rules! declare {
- () => (
- pub fn aaa() {}
-
- pub mod bbb {
- use super::aaa;
-
- pub fn ccc() {
- aaa();
- }
- }
- )
-}
+++ /dev/null
-// 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"]
-
-#![allow(unknown_features)]
-#![feature(box_syntax)]
-
-static mut COUNT: u64 = 1;
-
-pub fn get_count() -> u64 { unsafe { COUNT } }
-
-#[derive(Copy, Clone)]
-pub struct Foo;
-
-impl Foo {
- pub fn foo(self, x: &Foo) {
- unsafe { COUNT *= 2; }
- // Test internal call.
- Foo::bar(&self);
- Foo::bar(x);
-
- Foo::baz(self);
- Foo::baz(*x);
-
- Foo::qux(box self);
- Foo::qux(box *x);
- }
-
- pub fn bar(&self) {
- unsafe { COUNT *= 3; }
- }
-
- pub fn baz(self) {
- unsafe { COUNT *= 5; }
- }
-
- pub fn qux(self: Box<Foo>) {
- unsafe { COUNT *= 7; }
- }
-}
+++ /dev/null
-// 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"]
-
-#![allow(unknown_features)]
-#![feature(box_syntax)]
-
-static mut COUNT: u64 = 1;
-
-pub fn get_count() -> u64 { unsafe { COUNT } }
-
-#[derive(Copy, Clone)]
-pub struct Foo;
-
-impl Foo {
- pub fn run_trait(self) {
- unsafe { COUNT *= 17; }
- // Test internal call.
- Bar::foo1(&self);
- Bar::foo2(self);
- Bar::foo3(box self);
-
- Bar::bar1(&self);
- Bar::bar2(self);
- Bar::bar3(box self);
- }
-}
-
-pub trait Bar : Sized {
- fn foo1(&self);
- fn foo2(self);
- fn foo3(self: Box<Self>);
-
- fn bar1(&self) {
- unsafe { COUNT *= 7; }
- }
- fn bar2(self) {
- unsafe { COUNT *= 11; }
- }
- fn bar3(self: Box<Self>) {
- unsafe { COUNT *= 13; }
- }
-}
-
-impl Bar for Foo {
- fn foo1(&self) {
- unsafe { COUNT *= 2; }
- }
-
- fn foo2(self) {
- unsafe { COUNT *= 3; }
- }
-
- fn foo3(self: Box<Foo>) {
- unsafe { COUNT *= 5; }
- }
-}
+++ /dev/null
-// 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 S(pub u8);
-
-impl S {
- pub fn hey() -> u8 { 24 }
-}
-
-pub trait X {
- fn hoy(&self) -> u8 { 25 }
-}
-
-impl X for S {}
-
-pub enum E {
- U(u8)
-}
-
-pub fn regular_fn() -> u8 { 12 }
+++ /dev/null
-// 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 struct S {
- x: isize,
-}
-
-impl Drop for S {
- fn drop(&mut self) {
- println!("goodbye");
- }
-}
-
-pub fn f() {
- let x = S { x: 1 };
- let y = x;
- let _z = y;
-}
+++ /dev/null
-// 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"]
-
-pub static FOO: i32 = 42;
+++ /dev/null
-// 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 use Foo::*;
-
-pub enum Foo {
- A,
- B(isize),
- C { a: isize },
-}
-
-impl Foo {
- pub fn foo() {}
-}
-
-pub mod nest {
- pub use self::Bar::*;
-
- pub enum Bar {
- D,
- E(isize),
- F { a: isize },
- }
-
- impl Bar {
- pub fn foo() {}
- }
-}
+++ /dev/null
-// 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 enum Foo {
- A,
- B(isize),
- C { a: isize },
-}
-
-impl Foo {
- pub fn foo() {}
- pub fn bar(&self) {}
-}
+++ /dev/null
-// 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.
-
-// original problem
-pub fn foo<T>() -> isize {
- {
- static foo: isize = 2;
- foo
- }
-}
-
-// issue 8134
-struct Foo;
-impl Foo {
- pub fn foo<T>(&self) {
- static X: usize = 1;
- }
-}
-
-// issue 8134
-pub struct Parser<T>(T);
-impl<T: std::iter::Iterator<Item=char>> Parser<T> {
- fn in_doctype(&mut self) {
- static DOCTYPEPattern: [char; 6] = ['O', 'C', 'T', 'Y', 'P', 'E'];
- }
-}
-
-struct Bar;
-impl Foo {
- pub fn bar<T>(&self) {
- static X: usize = 1;
- }
-}
+++ /dev/null
-// 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 Au(pub isize);
+++ /dev/null
-// 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.
-
-use std::ops::Deref;
-
-struct DerefWithHelper<H, T> {
- pub helper: H,
- pub value: Option<T>
-}
-
-trait Helper<T> {
- fn helper_borrow(&self) -> &T;
-}
-
-impl<T> Helper<T> for Option<T> {
- fn helper_borrow(&self) -> &T {
- self.as_ref().unwrap()
- }
-}
-
-impl<T, H: Helper<T>> Deref for DerefWithHelper<H, T> {
- type Target = T;
-
- fn deref(&self) -> &T {
- self.helper.helper_borrow()
- }
-}
-
-// Test cross-crate autoderef + vtable.
-pub fn check<T: PartialEq>(x: T, y: T) -> bool {
- let d: DerefWithHelper<Option<T>, T> = DerefWithHelper { helper: Some(x), value: None };
- d.eq(&y)
-}
+++ /dev/null
-// 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.
-
-#[repr(packed)]
-pub struct S {
- a: u8,
- b: u32
-}
+++ /dev/null
-// 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 trait A {
- fn frob(&self);
-}
-
-impl A for isize { fn frob(&self) {} }
-
-pub fn frob<T:A>(t: T) {
- t.frob();
-}
+++ /dev/null
-// 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 crate core;
-pub use foo as bar;
-
-pub mod foo {
- pub fn frob() {}
-}
+++ /dev/null
-// 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 a {
- pub use a::b::c;
-
- pub mod b {
- pub mod c {
- fn f(){}
- fn g(){}
- }
- }
-}
+++ /dev/null
-// 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 name: isize
-}
+++ /dev/null
-// 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.
-
-extern crate pub_use_xcrate1;
-
-pub use pub_use_xcrate1::Foo;
+++ /dev/null
-// 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.
-
-use inner_private_module::*;
-
-mod inner_private_module {
- pub struct Unnameable1;
- pub struct Unnameable2;
- #[derive(Clone, Copy)]
- pub struct Unnameable3;
- pub struct Unnameable4;
- pub struct Unnameable5;
- pub struct Unnameable6;
- pub struct Unnameable7;
- #[derive(Default)]
- pub struct Unnameable8;
- pub enum UnnameableEnum {
- NameableVariant
- }
- pub trait UnnameableTrait {
- type Alias: Default;
- }
-
- impl Unnameable1 {
- pub fn method_of_unnameable_type1(&self) -> &'static str {
- "Hello1"
- }
- }
- impl Unnameable2 {
- pub fn method_of_unnameable_type2(&self) -> &'static str {
- "Hello2"
- }
- }
- impl Unnameable3 {
- pub fn method_of_unnameable_type3(&self) -> &'static str {
- "Hello3"
- }
- }
- impl Unnameable4 {
- pub fn method_of_unnameable_type4(&self) -> &'static str {
- "Hello4"
- }
- }
- impl Unnameable5 {
- pub fn method_of_unnameable_type5(&self) -> &'static str {
- "Hello5"
- }
- }
- impl Unnameable6 {
- pub fn method_of_unnameable_type6(&self) -> &'static str {
- "Hello6"
- }
- }
- impl Unnameable7 {
- pub fn method_of_unnameable_type7(&self) -> &'static str {
- "Hello7"
- }
- }
- impl Unnameable8 {
- pub fn method_of_unnameable_type8(&self) -> &'static str {
- "Hello8"
- }
- }
- impl UnnameableEnum {
- pub fn method_of_unnameable_enum(&self) -> &'static str {
- "HelloEnum"
- }
- }
-}
-
-pub fn function_returning_unnameable_type() -> Unnameable1 {
- Unnameable1
-}
-
-pub const CONSTANT_OF_UNNAMEABLE_TYPE: Unnameable2 =
- Unnameable2;
-
-pub fn function_accepting_unnameable_type(_: Option<Unnameable3>) {}
-
-pub type AliasOfUnnameableType = Unnameable4;
-
-impl Unnameable1 {
- pub fn inherent_method_returning_unnameable_type(&self) -> Unnameable5 {
- Unnameable5
- }
-}
-
-pub trait Tr {
- fn trait_method_returning_unnameable_type(&self) -> Unnameable6 {
- Unnameable6
- }
-}
-impl Tr for Unnameable1 {}
-
-pub use inner_private_module::UnnameableEnum::NameableVariant;
-
-pub struct Struct {
- pub field_of_unnameable_type: Unnameable7
-}
-
-pub static STATIC: Struct = Struct { field_of_unnameable_type: Unnameable7 } ;
-
-impl UnnameableTrait for AliasOfUnnameableType {
- type Alias = Unnameable8;
-}
-
-pub fn generic_function<T: UnnameableTrait>() -> T::Alias {
- Default::default()
-}
+++ /dev/null
-// 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 use foo::bar;
-
-mod foo {
- pub fn bar() {}
-}
+++ /dev/null
-// 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 use sub_foo::Foo;
-pub use self::Bar as Baz;
-pub use sub_foo::Boz;
-pub use sub_foo::Bort;
-
-pub trait Bar {
- fn bar() -> Self;
-}
-
-impl Bar for isize {
- fn bar() -> isize { 84 }
-}
-
-pub mod sub_foo {
- pub trait Foo {
- fn foo() -> Self;
- }
-
- impl Foo for isize {
- fn foo() -> isize { 42 }
- }
-
- pub struct Boz {
- unused_str: String
- }
-
- impl Boz {
- pub fn boz(i: isize) -> bool {
- i > 0
- }
- }
-
- pub enum Bort {
- Bort1,
- Bort2
- }
-
- impl Bort {
- pub fn bort() -> String {
- "bort()".to_string()
- }
- }
-}
+++ /dev/null
-// 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.
-
-#[no_mangle]
-pub extern "C" fn foo() -> usize {
- 1234
-}
+++ /dev/null
-// 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.
-
-#[inline]
-pub fn cci_fn() -> usize {
- 1200
-}
-
-pub const CCI_CONST: usize = 34;
+++ /dev/null
-// 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 codegen-units=3 --crate-type=rlib,dylib
-
-pub mod a {
- pub fn one() -> usize {
- 1
- }
-}
-
-pub mod b {
- pub fn two() -> usize {
- 2
- }
-}
-
-pub mod c {
- use a::one;
- use b::two;
- pub fn three() -> usize {
- one() + two()
- }
-}
+++ /dev/null
-// 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 fn f(x: isize) -> isize { -x }
-
-pub static F: fn(isize) -> isize = f;
-pub static mut MutF: fn(isize) -> isize = f;
+++ /dev/null
-// 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="static_methods_crate"]
-#![crate_type = "lib"]
-
-pub trait read: Sized {
- fn readMaybe(s: String) -> Option<Self>;
-}
-
-impl read for isize {
- fn readMaybe(s: String) -> Option<isize> {
- s.parse().ok()
- }
-}
-
-impl read for bool {
- fn readMaybe(s: String) -> Option<bool> {
- match &*s {
- "true" => Some(true),
- "false" => Some(false),
- _ => None
- }
- }
-}
-
-pub fn read<T:read>(s: String) -> T {
- match read::readMaybe(s) {
- Some(x) => x,
- _ => panic!("read panicked!")
- }
-}
+++ /dev/null
-// 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 num {
- pub trait Num2 {
- fn from_int2(n: isize) -> Self;
- }
-}
-
-pub mod f64 {
- impl ::num::Num2 for f64 {
- #[inline]
- fn from_int2(n: isize) -> f64 { return n as f64; }
- }
-}
+++ /dev/null
-// 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 mod num {
- pub trait Num2 {
- fn from_int2(n: isize) -> Self;
- }
-}
-
-pub mod f64 {
- impl ::num::Num2 for f64 {
- fn from_int2(n: isize) -> f64 { return n as f64; }
- }
-}
+++ /dev/null
-// 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 mut a: isize = 3;
+++ /dev/null
-// 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 struct S {
- pub x: isize,
- pub y: isize,
-}
+++ /dev/null
-// 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="struct_variant_xc_aux"]
-#![crate_type = "lib"]
-
-#[derive(Copy, Clone)]
-pub enum Enum {
- Variant(u8),
- StructVariant { arg: u8 }
-}
+++ /dev/null
-// 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.
-
-//! The `svh-a-*.rs` files are all deviations from the base file
-//! svh-a-base.rs with some difference (usually in `fn foo`) that
-//! should not affect the strict version hash (SVH) computation
-//! (#14132).
-
-#![crate_name = "a"]
-
-macro_rules! three {
- () => { 3 }
-}
-
-pub trait U {}
-pub trait V {}
-impl U for () {}
-impl V for () {}
-
-static A_CONSTANT : isize = 2;
-
-pub fn foo<T:U>(_: isize) -> isize {
- 3
-}
-
-pub fn an_unused_name() -> isize {
- 4
-}
+++ /dev/null
-// 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.
-
-//! The `svh-a-*.rs` files are all deviations from the base file
-//! svh-a-base.rs with some difference (usually in `fn foo`) that
-//! should not affect the strict version hash (SVH) computation
-//! (#14132).
-
-#![crate_name = "a"]
-
-macro_rules! three {
- () => { 3 }
-}
-
-pub trait U {}
-pub trait V {}
-impl U for () {}
-impl V for () {}
-
-static A_CONSTANT : isize = 2;
-
-pub fn foo<T:U>(_: isize) -> isize {
- // a comment does not affect the svh
- 3
-}
-
-pub fn an_unused_name() -> isize {
- 4
-}
+++ /dev/null
-// 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.
-
-//! The `svh-a-*.rs` files are all deviations from the base file
-//! svh-a-base.rs with some difference (usually in `fn foo`) that
-//! should not affect the strict version hash (SVH) computation
-//! (#14132).
-
-#![crate_name = "a"]
-
-macro_rules! three {
- () => { 3 }
-}
-
-pub trait U {}
-pub trait V {}
-impl U for () {}
-impl V for () {}
-
-static A_CONSTANT : isize = 2;
-
-// Adding some documentation does not affect the svh.
-
-/// foo always returns three.
-pub fn foo<T:U>(_: isize) -> isize {
- 3
-}
-
-pub fn an_unused_name() -> isize {
- 4
-}
+++ /dev/null
-// 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.
-
-//! The `svh-a-*.rs` files are all deviations from the base file
-//! svh-a-base.rs with some difference (usually in `fn foo`) that
-//! should not affect the strict version hash (SVH) computation
-//! (#14132).
-
-#![crate_name = "a"]
-
-macro_rules! three {
- () => { 3 }
-}
-
-pub trait U {}
-pub trait V {}
-impl U for () {}
-impl V for () {}
-
-static A_CONSTANT : isize = 2;
-
-pub fn foo<T:U>(_: isize) -> isize {
- // a macro invocation in a function body does not affect the svh,
- // as long as it yields the same code.
- three!()
-}
-
-pub fn an_unused_name() -> isize {
- 4
-}
+++ /dev/null
-// 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.
-
-//! The `svh-a-*.rs` files are all deviations from the base file
-//! svh-a-base.rs with some difference (usually in `fn foo`) that
-//! should not affect the strict version hash (SVH) computation
-//! (#14132).
-
-#![crate_name = "a"]
-
-macro_rules! three {
- () => { 3 }
-}
-
-pub trait U {}
-pub trait V {}
-impl U for () {}
-impl V for () {}
-
-static A_CONSTANT : isize = 2;
-
-pub fn foo<T:U>(_: isize) -> isize {
- 3
-}
-
-pub fn an_unused_name() -> isize {
- 4
-}
+++ /dev/null
-// 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.
-
-//! The `svh-a-*.rs` files are all deviations from the base file
-//! svh-a-base.rs with some difference (usually in `fn foo`) that
-//! should not affect the strict version hash (SVH) computation
-//! (#14132).
-
-#![crate_name = "a"]
-
-macro_rules! three {
- () => { 3 }
-}
-
-pub trait U {}
-pub trait V {}
-impl U for () {}
-impl V for () {}
-
-static A_CONSTANT : isize = 2;
-
-// cfg attribute does not affect the svh, as long as it yields the same code.
-#[cfg(not(an_unused_name))]
-pub fn foo<T:U>(_: isize) -> isize {
- 3
-}
-
-pub fn an_unused_name() -> isize {
- 4
-}
+++ /dev/null
-// 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.
-
-//! The `svh-a-*.rs` files are all deviations from the base file
-//! svh-a-base.rs with some difference (usually in `fn foo`) that
-//! should not affect the strict version hash (SVH) computation
-//! (#14132).
-
-#![crate_name = "a"]
-
-macro_rules! three {
- () => { 3 }
-}
-
-pub trait U {}
-pub trait V {}
-impl U for () {}
-impl V for () {}
-
-static A_CONSTANT : isize = 2;
-
-pub fn foo<T:U>(_: isize) -> isize {
-
- 3
-
-}
-
-pub fn an_unused_name() -> isize {
- 4
-}
+++ /dev/null
-// 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.
-
-//! This is a client of the `a` crate defined in "svn-a-base.rs". The
-//! rpass and cfail tests (such as "run-pass/svh-add-comment.rs") use
-//! it by swapping in a different object code library crate built from
-//! some variant of "svn-a-base.rs", and then we are checking if the
-//! compiler properly ignores or accepts the change, based on whether
-//! the change could affect the downstream crate content or not
-//! (#14132).
-
-#![crate_name = "b"]
-
-extern crate a;
-
-pub fn foo() { assert_eq!(a::foo::<()>(0), 3); }
+++ /dev/null
-// 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.
-
-#![feature(thread_local)]
-#![feature(cfg_target_thread_local)]
-#![crate_type = "lib"]
-
-#[no_mangle]
-#[cfg_attr(target_thread_local, thread_local)]
-pub static FOO: u32 = 3;
+++ /dev/null
-// 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 Something { pub x: isize }
-
-pub trait A {
- fn f(&self) -> isize;
- fn g(&self) -> isize { 10 }
- fn h(&self) -> isize { 11 }
- fn lurr(x: &Self, y: &Self) -> isize { x.g() + y.h() }
-}
-
-
-impl A for isize {
- fn f(&self) -> isize { 10 }
-}
-
-impl A for Something {
- fn f(&self) -> isize { 10 }
-}
-
-pub trait B<T> {
- fn thing<U>(&self, x: T, y: U) -> (T, U) { (x, y) }
- fn staticthing<U>(_z: &Self, x: T, y: U) -> (T, U) { (x, y) }
-}
-
-impl<T> B<T> for isize { }
-impl B<f64> for bool { }
-
-
-
-pub trait TestEquality {
- fn test_eq(&self, rhs: &Self) -> bool;
- fn test_neq(&self, rhs: &Self) -> bool {
- !self.test_eq(rhs)
- }
-}
-
-impl TestEquality for isize {
- fn test_eq(&self, rhs: &isize) -> bool {
- *self == *rhs
- }
-}
+++ /dev/null
-// 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.
-
-// aux-build:trait_default_method_xc_aux.rs
-
-extern crate trait_default_method_xc_aux as aux;
-use aux::A;
-
-pub struct a_struct { pub x: isize }
-
-impl A for a_struct {
- fn f(&self) -> isize { 10 }
-}
-
-// This function will need to get inlined, and badness may result.
-pub fn welp<A>(x: A) -> A {
- let a = a_struct { x: 0 };
- a.g();
- x
-}
+++ /dev/null
-// 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 { fn f(&self) -> isize; }
-pub trait Bar { fn g(&self) -> isize; }
-pub trait Baz { fn h(&self) -> isize; }
-
-pub struct A { pub x: isize }
-
-impl Foo for A { fn f(&self) -> isize { 10 } }
-impl Bar for A { fn g(&self) -> isize { 20 } }
-impl Baz for A { fn h(&self) -> isize { 30 } }
+++ /dev/null
-// 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 { fn f(&self) -> isize; }
-pub trait Bar { fn g(&self) -> isize; }
-pub trait Baz { fn h(&self) -> isize; }
-
-pub trait Quux: Foo + Bar + Baz { }
-
-impl<T:Foo + Bar + Baz> Quux for T { }
+++ /dev/null
-// 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 {
- fn f(&self) -> isize;
-}
-
-pub struct A {
- pub x: isize
-}
-
-impl Foo for A {
- fn f(&self) -> isize { 10 }
-}
+++ /dev/null
-// 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::cmp::PartialEq;
-use std::ops::{Add, Sub, Mul};
-
-pub trait MyNum : Add<Output=Self> + Sub<Output=Self> + Mul<Output=Self> + PartialEq + Clone {
-}
-
-#[derive(Clone, Debug)]
-pub struct MyInt {
- pub val: isize
-}
-
-impl Add for MyInt {
- type Output = MyInt;
-
- fn add(self, other: MyInt) -> MyInt { mi(self.val + other.val) }
-}
-
-impl Sub for MyInt {
- type Output = MyInt;
-
- fn sub(self, other: MyInt) -> MyInt { mi(self.val - other.val) }
-}
-
-impl Mul for MyInt {
- type Output = MyInt;
-
- fn mul(self, other: MyInt) -> MyInt { mi(self.val * other.val) }
-}
-
-impl PartialEq for MyInt {
- fn eq(&self, other: &MyInt) -> bool { self.val == other.val }
-
- fn ne(&self, other: &MyInt) -> bool { !self.eq(other) }
-}
-
-impl MyNum for MyInt {}
-
-fn mi(v: isize) -> MyInt { MyInt { val: v } }
+++ /dev/null
-// 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.
-
-// Simple smoke test that unsafe traits can be compiled etc.
-
-pub unsafe trait Foo {
- fn foo(&self) -> isize;
-}
-
-unsafe impl Foo for isize {
- fn foo(&self) -> isize { *self }
-}
+++ /dev/null
-// 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.
-
-// Test library crate for cross-crate usages of traits inheriting
-// from the builtin kinds. Mostly tests metadata correctness.
-
-#![crate_type="lib"]
-
-pub trait RequiresShare : Sync { }
-pub trait RequiresRequiresShareAndSend : RequiresShare + Send { }
-pub trait RequiresCopy : Copy { }
+++ /dev/null
-// 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.
-
-// Test inherent trait impls work cross-crait.
-
-pub trait Bar<'a> : 'a {}
-
-impl<'a> Bar<'a> {
- pub fn bar(&self) {}
-}
+++ /dev/null
-// 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.
-
-#[macro_export]
-macro_rules! macro_one { () => ("one") }
-
-#[macro_export]
-macro_rules! macro_two { () => ("two") }
+++ /dev/null
-// 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.
-
-#![feature(core)]
-
-use std::any::{Any, TypeId};
-
-pub struct A;
-pub struct B(Option<A>);
-pub struct C(Option<isize>);
-pub struct D(Option<&'static str>);
-pub struct E(Result<&'static str, isize>);
-
-pub type F = Option<isize>;
-pub type G = usize;
-pub type H = &'static str;
-
-pub unsafe fn id_A() -> TypeId { TypeId::of::<A>() }
-pub unsafe fn id_B() -> TypeId { TypeId::of::<B>() }
-pub unsafe fn id_C() -> TypeId { TypeId::of::<C>() }
-pub unsafe fn id_D() -> TypeId { TypeId::of::<D>() }
-pub unsafe fn id_E() -> TypeId { TypeId::of::<E>() }
-pub unsafe fn id_F() -> TypeId { TypeId::of::<F>() }
-pub unsafe fn id_G() -> TypeId { TypeId::of::<G>() }
-pub unsafe fn id_H() -> TypeId { TypeId::of::<H>() }
-
-pub unsafe fn foo<T: Any>() -> TypeId { TypeId::of::<T>() }
+++ /dev/null
-// 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.
-
-#![feature(core)]
-
-use std::any::{Any, TypeId};
-
-pub struct A;
-pub struct B(Option<A>);
-pub struct C(Option<isize>);
-pub struct D(Option<&'static str>);
-pub struct E(Result<&'static str, isize>);
-
-pub type F = Option<isize>;
-pub type G = usize;
-pub type H = &'static str;
-
-pub unsafe fn id_A() -> TypeId { TypeId::of::<A>() }
-pub unsafe fn id_B() -> TypeId { TypeId::of::<B>() }
-pub unsafe fn id_C() -> TypeId { TypeId::of::<C>() }
-pub unsafe fn id_D() -> TypeId { TypeId::of::<D>() }
-pub unsafe fn id_E() -> TypeId { TypeId::of::<E>() }
-pub unsafe fn id_F() -> TypeId { TypeId::of::<F>() }
-pub unsafe fn id_G() -> TypeId { TypeId::of::<G>() }
-pub unsafe fn id_H() -> TypeId { TypeId::of::<H>() }
-
-pub unsafe fn foo<T:Any>() -> TypeId { TypeId::of::<T>() }
+++ /dev/null
-// 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(unboxed_closures)]
-
-use std::ops::Add;
-
-#[inline]
-pub fn has_closures() -> usize {
- let x = 1;
- let mut f = move || x;
- let y = 1;
- let g = || y;
- f() + g()
-}
-
-pub fn has_generic_closures<T: Add<Output=T> + Copy>(x: T, y: T) -> T {
- let mut f = move || x;
- let g = || y;
- f() + g()
-}
+++ /dev/null
-// 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
-
-// This aux-file will require the eh_personality function to be codegen'd, but
-// it hasn't been defined just yet. Make sure we don't explode.
-
-#![no_std]
-#![crate_type = "rlib"]
-
-struct A;
-
-impl core::ops::Drop for A {
- fn drop(&mut self) {}
-}
-
-pub fn foo() {
- let _a = A;
- panic!("wut");
-}
-
-mod std {
- pub use core::{option, fmt};
-}
+++ /dev/null
-// 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 Equal {
- fn equal(&self, other: &Self) -> bool;
- fn equals<T,U>(&self, this: &T, that: &T, x: &U, y: &U) -> bool
- where T: Eq, U: Eq;
-}
-
-impl<T> Equal for T where T: Eq {
- fn equal(&self, other: &T) -> bool {
- self == other
- }
- fn equals<U,X>(&self, this: &U, other: &U, x: &X, y: &X) -> bool
- where U: Eq, X: Eq {
- this == other && x == y
- }
-}
-
-pub fn equal<T>(x: &T, y: &T) -> bool where T: Eq {
- x == y
-}
+++ /dev/null
-// 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 trait FromBuf<'a> {
- fn from_buf(&'a [u8]) -> Self;
-}
+++ /dev/null
-// 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 fn foo<T>() -> isize {
- static a: isize = 3;
- a
-}
-
-pub fn bar() -> isize {
- foo::<isize>()
-}
+++ /dev/null
-// 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_type_defaults)]
-
-pub trait Foo<T: Default + ToString> {
- type Out: Default + ToString = T;
-}
-
-impl Foo<u32> for () {
-}
-
-impl Foo<u64> for () {
- type Out = bool;
-}
+++ /dev/null
-// 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 static global: isize = 3;
-
-static global0: isize = 4;
-
-pub static global2: &'static isize = &global0;
-
-pub fn verify_same(a: &'static isize) {
- let a = a as *const isize as usize;
- let b = &global as *const isize as usize;
- assert_eq!(a, b);
-}
-
-pub fn verify_same2(a: &'static isize) {
- let a = a as *const isize as usize;
- let b = global2 as *const isize as usize;
- assert_eq!(a, b);
-}
+++ /dev/null
-// 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 S {
- pub x: isize,
- pub y: isize,
-}
-
-pub type S2 = S;
+++ /dev/null
-// 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_type = "lib"]
-
-// used by the rpass test
-
-#[derive(Copy, Clone)]
-pub struct Struct;
-
-#[derive(Copy, Clone)]
-pub enum Unit {
- UnitVariant,
- Argument(Struct)
-}
-
-#[derive(Copy, Clone)]
-pub struct TupleStruct(pub usize, pub &'static str);
-
-// used by the cfail test
-
-#[derive(Copy, Clone)]
-pub struct StructWithFields {
- foo: isize,
-}
-
-#[derive(Copy, Clone)]
-pub enum EnumWithVariants {
- EnumVariant,
- EnumVariantArg(isize)
-}
--- /dev/null
+// 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() }
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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 }
+ }
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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 }
+}
--- /dev/null
+// 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) {
+ }
+}
--- /dev/null
+// 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: () = ();
--- /dev/null
+// 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: () = ();
--- /dev/null
+// 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
+}
--- /dev/null
+// 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
+}
--- /dev/null
+// 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
+ }
+ }
+}
--- /dev/null
+// 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
+ }
+ }
+}
--- /dev/null
+// 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
+ }
+ }
+}
--- /dev/null
+// 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
+ }
+ }
+}
--- /dev/null
+// 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
+ }
+ }
+}
--- /dev/null
+// 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
+ }
+ }
+}
--- /dev/null
+// 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);
+ }
+}
--- /dev/null
+// 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;
--- /dev/null
+// 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
+};
--- /dev/null
+// 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;
+ }
+ }
+}
--- /dev/null
+// 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)
+ }
+}
--- /dev/null
+// 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;
+ }
+}
--- /dev/null
+// 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()),
+ };
+}
--- /dev/null
+// 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;
+ }
+}
--- /dev/null
+// 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 };
+}
--- /dev/null
+// 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
+}
--- /dev/null
+// 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);
+ }
+}
--- /dev/null
+// 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);
+ }
+}
--- /dev/null
+// 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;
--- /dev/null
+// 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);
--- /dev/null
+// 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);
--- /dev/null
+// 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
--- /dev/null
+// 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() {}
--- /dev/null
+// 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) {
+ }
+ }
+}
--- /dev/null
+// 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)> }
--- /dev/null
+// 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 {}
+
--- /dev/null
+// 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,
+}
--- /dev/null
+// 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);
+ }
+}
--- /dev/null
+// 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
+ }
+}
--- /dev/null
+// 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 }
--- /dev/null
+// 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)
+}
--- /dev/null
+// 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() {}
+}
--- /dev/null
+// 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;
+ }
+ }
+}
--- /dev/null
+// 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() {}
--- /dev/null
+// 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());
+ }
+}
--- /dev/null
+// 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)
+ }
+}
--- /dev/null
+// 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;
--- /dev/null
+// 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) {}
+}
--- /dev/null
+// 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 }
+ }
+}
--- /dev/null
+// 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) {}
+}
--- /dev/null
+// 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();
+}
--- /dev/null
+// 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()
+};
--- /dev/null
+// 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
+ }
+}
--- /dev/null
+// 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();
+}
--- /dev/null
+// 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);
+}
--- /dev/null
+// 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)
+}
--- /dev/null
+// 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);
+}
--- /dev/null
+// 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() }
--- /dev/null
+// 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);
--- /dev/null
+// 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"]
--- /dev/null
+// 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;
--- /dev/null
+// 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"]
--- /dev/null
+// 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) {
+ }
+}
--- /dev/null
+// Copyright 2012-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 Foo {
+ pub foo: extern fn()
+}
+
+extern fn the_foo() {}
+
+pub const FOO: Foo = Foo {
+ foo: the_foo
+};
--- /dev/null
+// Copyright 2012-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.
+
+extern crate issue_13620_1 as crate1;
+
+pub static FOO2: crate1::Foo = crate1::FOO;
--- /dev/null
+// 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 enum A { B }
--- /dev/null
+// 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.
+
+extern crate issue_13872_1 as foo;
+
+pub use foo::A::B;
--- /dev/null
+// 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.
+
+extern crate issue_13872_2 as bar;
+
+use bar::B;
+
+pub fn foo() {
+ match B {
+ B => {}
+ }
+}
--- /dev/null
+// 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"]
+
+pub fn foo() {}
--- /dev/null
+// 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.
+
+extern crate issue_14344_1;
+
+pub fn bar() {}
--- /dev/null
+// 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"]
+#![deny(warnings)]
+#![allow(dead_code)]
+
+pub use src::aliases::B;
+pub use src::hidden_core::make;
+
+mod src {
+ pub mod aliases {
+ use super::hidden_core::A;
+ pub type B = A<f32>;
+ }
+
+ pub mod hidden_core {
+ use super::aliases::B;
+
+ pub struct A<T> { t: T }
+
+ pub fn make() -> B { A { t: 1.0 } }
+
+ impl<T> A<T> {
+ pub fn foo(&mut self) { println!("called foo"); }
+ }
+ }
+}
--- /dev/null
+// 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"]
+#![deny(warnings)]
+
+pub use src::aliases::B;
+pub use src::hidden_core::make;
+
+mod src {
+ pub mod aliases {
+ use super::hidden_core::A;
+ pub type B = A;
+ }
+
+ pub mod hidden_core {
+ use super::aliases::B;
+
+ #[derive(Copy, Clone)]
+ pub struct A;
+
+ pub fn make() -> B { A }
+
+ impl A {
+ pub fn foo(&mut self) { println!("called foo"); }
+ }
+ }
+}
--- /dev/null
+// 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"]
+
+extern {
+ pub fn transmute();
+}
--- /dev/null
+// 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 TreeBuilder<H> { pub h: H }
+
+impl<H> TreeBuilder<H> {
+ pub fn process_token(&mut self) {
+ match self {
+ _ => for _y in self.by_ref() {}
+ }
+ }
+}
+
+impl<H> Iterator for TreeBuilder<H> {
+ type Item = H;
+
+ fn next(&mut self) -> Option<H> {
+ None
+ }
+}
--- /dev/null
+// 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 trait Foo<'a, T> {
+ fn foo(&'a self) -> T;
+}
+
+pub fn foo<'a, T>(x: &'a Foo<'a, T>) -> T {
+ let x: &'a Foo<T> = x;
+ // ^ the lifetime parameter of Foo is left to be inferred.
+ x.foo()
+ // ^ encoding this method call in metadata triggers an ICE.
+}
--- /dev/null
+// 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(const_fn)]
+
+use std::sync::atomic;
+
+pub const C1: usize = 1;
+pub const C2: atomic::AtomicUsize = atomic::AtomicUsize::new(0);
+pub const C3: fn() = foo;
+pub const C4: usize = C1 * C1 + C1 / C1;
+pub const C5: &'static usize = &C4;
+
+pub static S1: usize = 3;
+pub static S2: atomic::AtomicUsize = atomic::AtomicUsize::new(0);
+
+fn foo() {}
--- /dev/null
+// 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 = "rlib"]
+struct Foo;
+
+trait Tr {
+ fn tr(&self);
+}
+
+impl Tr for Foo {
+ fn tr(&self) {}
+}
+
+fn take_method<T>(f: fn(&T), t: &T) {}
+
+#[inline]
+pub fn pass_method() {
+ take_method(Tr::tr, &Foo);
+}
--- /dev/null
+// 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 = "rlib"]
+
+pub trait Tr {
+ fn tr(&self);
+}
+
+pub struct St<V>(pub Vec<V>);
+
+impl<V> Tr for St<V> {
+ fn tr(&self) {
+ match self {
+ &St(ref v) => {
+ v.iter();
+ }
+ }
+ }
+}
--- /dev/null
+// 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(unboxed_closures)]
+#![crate_type = "rlib"]
+
+pub fn inner<F>(f: F) -> F {
+ (move || f)()
+}
--- /dev/null
+// 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"]
+#![crate_name = "foo"]
+
+pub fn foo() -> i32 { 0 }
--- /dev/null
+// 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"]
+#![crate_name = "foo"]
+
+pub fn foo() -> i32 { 1 }
--- /dev/null
+// 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 enum Homura {
+ Madoka { name: String },
+}
--- /dev/null
+// 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="a"]
+#![crate_type = "lib"]
+
+#![allow(unknown_features)]
+#![feature(box_syntax)]
+
+pub trait i<T>
+{
+ fn dummy(&self, t: T) -> T { panic!() }
+}
+
+pub fn f<T>() -> Box<i<T>+'static> {
+ impl<T> i<T> for () { }
+
+ box () as Box<i<T>+'static>
+}
--- /dev/null
+// 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="a"]
+#![crate_type = "lib"]
+
+type t1 = usize;
+
+trait foo {
+ fn foo(&self);
+}
+
+impl foo for String {
+ fn foo(&self) {}
+}
--- /dev/null
+// Copyright 2012-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"]
+#![crate_type = "lib"]
+
+extern crate a;
--- /dev/null
+// 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(linked_from)]
+
+#![crate_type = "rlib"]
+
+#[link(name = "rust_test_helpers", kind = "static")]
+#[linked_from = "rust_test_helpers"]
+extern {
+ pub fn rust_dbg_extern_identity_u32(u: u32) -> u32;
+}
--- /dev/null
+// 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.
+
+extern crate issue_25185_1;
+
+pub use issue_25185_1::rust_dbg_extern_identity_u32;
--- /dev/null
+// 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="issue_2526"]
+#![crate_type = "lib"]
+
+use std::marker;
+
+pub struct arc_destruct<T: Sync> {
+ _data: isize,
+ _marker: marker::PhantomData<T>
+}
+
+impl<T: Sync> Drop for arc_destruct<T> {
+ fn drop(&mut self) {}
+}
+
+fn arc_destruct<T: Sync>(data: isize) -> arc_destruct<T> {
+ arc_destruct {
+ _data: data,
+ _marker: marker::PhantomData
+ }
+}
+
+fn arc<T: Sync>(_data: T) -> arc_destruct<T> {
+ arc_destruct(0)
+}
+
+fn init() -> arc_destruct<context_res> {
+ arc(context_res())
+}
+
+pub struct context_res {
+ ctx : isize,
+}
+
+impl Drop for context_res {
+ fn drop(&mut self) {}
+}
+
+fn context_res() -> context_res {
+ context_res {
+ ctx: 0
+ }
+}
+
+pub type context = arc_destruct<context_res>;
--- /dev/null
+// 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 trait Trait {
+ // the issue is sensitive to interning order - so use names
+ // unlikely to appear in libstd.
+ type Issue25467FooT;
+ type Issue25467BarT;
+}
+
+pub type Object = Option<Box<Trait<Issue25467FooT=(),Issue25467BarT=()>>>;
--- /dev/null
+// 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="req"]
+#![crate_type = "lib"]
+
+use std::cell::RefCell;
+use std::collections::HashMap;
+use std::rc::Rc;
+
+pub type header_map = HashMap<String, Rc<RefCell<Vec<Rc<String>>>>>;
+
+// the unused ty param is necessary so this gets monomorphized
+pub fn request<T>(req: &header_map) {
+ let data = req[&"METHOD".to_string()].clone();
+ let _x = data.borrow().clone()[0].clone();
+}
--- /dev/null
+// 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.
+
+#![crate_name="a"]
+#![crate_type = "lib"]
+
+pub struct X(pub u8);
+
+impl Drop for X {
+ fn drop(&mut self) {
+ assert_eq!(self.0, 1)
+ }
+}
+
+pub fn f(x: &mut X, g: fn()) {
+ x.0 = 1;
+ g();
+ x.0 = 0;
+}
--- /dev/null
+// 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="socketlib"]
+#![crate_type = "lib"]
+#![feature(libc)]
+
+pub mod socket {
+ extern crate libc;
+
+ pub struct socket_handle {
+ sockfd: libc::c_int,
+ }
+
+ impl Drop for socket_handle {
+ fn drop(&mut self) {
+ /* c::close(self.sockfd); */
+ }
+ }
+
+ pub fn socket_handle(x: libc::c_int) -> socket_handle {
+ socket_handle {
+ sockfd: x
+ }
+ }
+}
--- /dev/null
+// 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.
+
+#[derive(Copy)]
+pub struct U256(pub [u64; 4]);
+
+impl Clone for U256 {
+ fn clone(&self) -> U256 {
+ *self
+ }
+}
+
+impl U256 {
+ pub fn new(value: u64) -> U256 {
+ let mut ret = [0; 4];
+ ret[0] = value;
+ U256(ret)
+ }
+}
--- /dev/null
+// 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.
+
+// compile-flags: -g
+
+extern crate issue_31702_1;
+
+use std::collections::HashMap;
+use issue_31702_1::U256;
+
+pub struct Ethash {
+ engine_params: for<'a> fn() -> Option<&'a Vec<u8>>,
+ u256_params: HashMap<String, U256>,
+}
+
+impl Ethash {
+ pub fn u256_param(&mut self, name: &str) -> U256 {
+ let engine = self.engine_params;
+ *self.u256_params.entry(name.to_owned()).or_insert_with(|| {
+ engine().map_or(U256::new(0u64), |_a| loop {})
+ })
+ }
+}
--- /dev/null
+// 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="numeric"]
+#![crate_type = "lib"]
+
+pub trait Trig<T> {
+ fn sin(&self) -> T;
+}
+
+pub fn sin<T:Trig<R>, R>(theta: &T) -> R { theta.sin() }
+
+pub trait Angle<T>: Trig<T> {}
--- /dev/null
+// 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 S<T>(Option<T>);
+pub fn mk<T>() -> S<T> { S(None) }
--- /dev/null
+// Copyright 2012-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.
+
+trait A<'a, T> {
+ fn f(&mut self) -> &'a mut T;
+ fn p() -> T;
+}
--- /dev/null
+// 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.
+
+
+use std::collections::HashMap;
+
+pub type map = Box<HashMap<usize, usize>>;
--- /dev/null
+// 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 Foo<'a, A:'a>(&'a A);
+
+impl<'a, A> Foo<'a, A> {
+ pub fn new(a: &'a A) -> Foo<'a, A> {
+ Foo(a)
+ }
+}
--- /dev/null
+// 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 V2<T>(pub T, pub T);
--- /dev/null
+// 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 BTree<V> {
+ pub node: TreeItem<V>,
+}
+
+pub enum TreeItem<V> {
+ TreeLeaf { value: V },
+}
+
+pub fn leaf<V>(value: V) -> TreeItem<V> {
+ TreeItem::TreeLeaf { value: value }
+}
+
+fn main() {
+ BTree::<isize> { node: leaf(1) };
+}
--- /dev/null
+// 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 enum Foo<'a> {
+ A,
+ B(&'a str),
+}
--- /dev/null
+// 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.
+
+pub use other::FooBar;
+pub use other::foo;
+
+mod other {
+ pub struct FooBar{value: isize}
+ impl FooBar{
+ pub fn new(val: isize) -> FooBar {
+ FooBar{value: val}
+ }
+ }
+
+ pub fn foo(){
+ 1+1;
+ }
+}
--- /dev/null
+// 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 use internal::core::{Trait, Struct};
+
+mod internal {
+ pub mod core {
+ pub struct Struct;
+ impl Struct {
+ pub fn init() -> Struct {
+ Struct
+ }
+ }
+
+ pub trait Trait {
+ fn test(&self) {
+ private();
+ }
+ }
+
+ impl Trait for Struct {}
+
+ fn private() { }
+ }
+}
--- /dev/null
+// Copyright 2012-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(core)]
+
+pub mod testtypes {
+ use std::any::TypeId;
+
+ pub fn type_ids() -> Vec<TypeId> {
+ vec![
+ TypeId::of::<FooBool>(),
+ TypeId::of::<FooInt>(),
+ TypeId::of::<FooUint>(),
+ TypeId::of::<FooFloat>(),
+ TypeId::of::<FooStr>(),
+ TypeId::of::<FooArray>(),
+ TypeId::of::<FooSlice>(),
+ TypeId::of::<FooBox>(),
+ TypeId::of::<FooPtr>(),
+ TypeId::of::<FooRef>(),
+ TypeId::of::<FooFnPtr>(),
+ TypeId::of::<FooNil>(),
+ TypeId::of::<FooTuple>(),
+ TypeId::of::<FooTrait>(),
+ TypeId::of::<FooStruct>(),
+ TypeId::of::<FooEnum>()
+ ]
+ }
+
+ // Tests TyBool
+ pub type FooBool = bool;
+
+ // Tests TyChar
+ pub type FooChar = char;
+
+ // Tests TyInt (does not test all variants of IntTy)
+ pub type FooInt = isize;
+
+ // Tests TyUint (does not test all variants of UintTy)
+ pub type FooUint = usize;
+
+ // Tests TyFloat (does not test all variants of FloatTy)
+ pub type FooFloat = f64;
+
+ // Tests TyStr
+ pub type FooStr = str;
+
+ // Tests TyArray
+ pub type FooArray = [u8; 1];
+
+ // Tests TySlice
+ pub type FooSlice = [u8];
+
+ // Tests TyBox (of u8)
+ pub type FooBox = Box<u8>;
+
+ // Tests TyRawPtr
+ pub type FooPtr = *const u8;
+
+ // Tests TyRef
+ pub type FooRef = &'static u8;
+
+ // Tests TyFnPtr
+ pub type FooFnPtr = fn(u8) -> bool;
+
+ // Tests TyTrait
+ pub trait FooTrait {
+ fn foo_method(&self) -> usize;
+ }
+
+ // Tests TyStruct
+ pub struct FooStruct {
+ pub pub_foo_field: usize,
+ foo_field: usize
+ }
+
+ // Tests TyEnum
+ pub enum FooEnum {
+ VarA(usize),
+ VarB(usize, usize)
+ }
+
+ // Tests TyTuple
+ pub type FooNil = ();
+ pub type FooTuple = (u8, i8, bool);
+
+ // Skipping TyParam
+
+ // Skipping TyInfer
+
+ // Skipping TyError
+}
--- /dev/null
+// 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.
+
+fn foo(_x: i32) {
+}
+
+pub struct rsrc {
+ x: i32,
+}
+
+impl Drop for rsrc {
+ fn drop(&mut self) {
+ foo(self.x);
+ }
+}
+
+pub fn rsrc(x: i32) -> rsrc {
+ rsrc {
+ x: x
+ }
+}
--- /dev/null
+// 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 Wrap<A>(pub A);
--- /dev/null
+// 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 mod bar {
+ pub fn foo() {}
+}
--- /dev/null
+// 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 fn baz() {}
--- /dev/null
+// 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 Foo (pub isize);
+pub enum MyEnum {
+ Foo(Foo),
+}
--- /dev/null
+// 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 trait T {
+ type C;
+ fn dummy(&self) { }
+}
--- /dev/null
+// 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.
+
+enum cat {
+ tabby, calico, tortoiseshell
+}
--- /dev/null
+// Copyright 2012-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.
+
+#![allow(unused_imports)]
+
+extern crate issue_2316_a;
+
+pub mod cloth {
+ use issue_2316_a::*;
+
+ pub enum fabric {
+ gingham, flannel, calico
+ }
+}
--- /dev/null
+// 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 S(pub ());
+
+impl S {
+ pub fn foo(&self) { }
+}
+
+pub trait T {
+ fn bar(&self);
+}
+
+impl T for S {
+ fn bar(&self) { }
+}
--- /dev/null
+// 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 unsafe fn f(xs: Vec<isize> ) {
+ xs.iter().map(|_x| { unsafe fn q() { panic!(); } }).collect::<Vec<()>>();
+}
--- /dev/null
+// 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 mod issue_3136_a;
--- /dev/null
+// 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.
+
+trait x {
+ fn use_x<T>(&self);
+}
+struct y(());
+impl x for y {
+ fn use_x<T>(&self) {
+ struct foo { //~ ERROR quux
+ i: ()
+ }
+ fn new_foo<T>(i: ()) -> foo {
+ foo { i: i }
+ }
+ }
+}
--- /dev/null
+// 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="issue_3979_traits"]
+
+#![crate_type = "lib"]
+
+pub trait Positioned {
+ fn SetX(&mut self, isize);
+ fn X(&self) -> isize;
+}
+
+pub trait Movable: Positioned {
+ fn translate(&mut self, dx: isize) {
+ let x = self.X() + dx;
+ self.SetX(x);
+ }
+}
--- /dev/null
+// 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.
+
+// for this issue, this code must be built in a library
+
+use std::mem;
+
+trait A {
+ fn dummy(&self) { }
+}
+struct B;
+impl A for B {}
+
+fn bar<T>(_: &mut A, _: &T) {}
+
+fn foo<T>(t: &T) {
+ let mut b = B;
+ bar(&mut b as &mut A, t)
+}
--- /dev/null
+// 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_type = "lib"]
+
+pub trait X {
+ fn x() {
+ fn f() { }
+ f();
+ }
+ fn dummy(&self) { }
+}
--- /dev/null
+// 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 Foo<T>(T);
+
+impl<T> Foo<T> {
+ pub fn new(t: T) -> Foo<T> {
+ Foo(t)
+ }
+}
--- /dev/null
+// 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 fn foo<T>() -> &'static isize {
+ if false {
+ static a: isize = 4;
+ return &a;
+ } else {
+ static a: isize = 5;
+ return &a;
+ }
+}
+
+pub fn bar() -> &'static isize {
+ foo::<isize>()
+}
--- /dev/null
+// 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.
+
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+// Tests that metadata serialization works for the `Copy` kind.
+
+#![crate_type="lib"]
+
+pub fn f<T:Copy>() {}
--- /dev/null
+// 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_mangle]
+pub static foo: isize = 3;
+
+pub fn bar() {}
--- /dev/null
+// 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.
+
+// ignore-test: this is not a test
+
+1
--- /dev/null
+// 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.
+
+// ignore-test: this is not a test
+
+fn foo() { bar() }
--- /dev/null
+// 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.
+
+#[macro_export]
+macro_rules! make_a_5 {
+ () => (5)
+}
--- /dev/null
+// 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 fn increment(x: usize) -> usize {
+ x + 1
+}
+
+#[macro_export]
+macro_rules! increment {
+ ($x:expr) => ($crate::increment($x))
+}
+
+pub fn check_local() {
+ assert_eq!(increment!(3), 4);
+}
--- /dev/null
+// 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 mod inner {
+ #[macro_export]
+ macro_rules! foo {
+ () => (1)
+ }
+}
--- /dev/null
+// 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"]
+#[macro_export]
+macro_rules! reexported {
+ () => ( 3 )
+}
--- /dev/null
+// 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"]
+#![feature(macro_reexport)]
+
+#[macro_reexport(reexported)]
+#[macro_use] #[no_link]
+extern crate macro_reexport_1;
--- /dev/null
+// 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 = "dylib"]
+#![feature(macro_reexport)]
+
+#[macro_reexport(reexported)]
+#[no_link]
+extern crate macro_reexport_1;
--- /dev/null
+// 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"]
+
+#[macro_export]
+macro_rules! declare {
+ () => (
+ pub fn aaa() {}
+
+ pub mod bbb {
+ use super::aaa;
+
+ pub fn ccc() {
+ aaa();
+ }
+ }
+ )
+}
--- /dev/null
+// 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"]
+
+#![allow(unknown_features)]
+#![feature(box_syntax)]
+
+static mut COUNT: u64 = 1;
+
+pub fn get_count() -> u64 { unsafe { COUNT } }
+
+#[derive(Copy, Clone)]
+pub struct Foo;
+
+impl Foo {
+ pub fn foo(self, x: &Foo) {
+ unsafe { COUNT *= 2; }
+ // Test internal call.
+ Foo::bar(&self);
+ Foo::bar(x);
+
+ Foo::baz(self);
+ Foo::baz(*x);
+
+ Foo::qux(box self);
+ Foo::qux(box *x);
+ }
+
+ pub fn bar(&self) {
+ unsafe { COUNT *= 3; }
+ }
+
+ pub fn baz(self) {
+ unsafe { COUNT *= 5; }
+ }
+
+ pub fn qux(self: Box<Foo>) {
+ unsafe { COUNT *= 7; }
+ }
+}
--- /dev/null
+// 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"]
+
+#![allow(unknown_features)]
+#![feature(box_syntax)]
+
+static mut COUNT: u64 = 1;
+
+pub fn get_count() -> u64 { unsafe { COUNT } }
+
+#[derive(Copy, Clone)]
+pub struct Foo;
+
+impl Foo {
+ pub fn run_trait(self) {
+ unsafe { COUNT *= 17; }
+ // Test internal call.
+ Bar::foo1(&self);
+ Bar::foo2(self);
+ Bar::foo3(box self);
+
+ Bar::bar1(&self);
+ Bar::bar2(self);
+ Bar::bar3(box self);
+ }
+}
+
+pub trait Bar : Sized {
+ fn foo1(&self);
+ fn foo2(self);
+ fn foo3(self: Box<Self>);
+
+ fn bar1(&self) {
+ unsafe { COUNT *= 7; }
+ }
+ fn bar2(self) {
+ unsafe { COUNT *= 11; }
+ }
+ fn bar3(self: Box<Self>) {
+ unsafe { COUNT *= 13; }
+ }
+}
+
+impl Bar for Foo {
+ fn foo1(&self) {
+ unsafe { COUNT *= 2; }
+ }
+
+ fn foo2(self) {
+ unsafe { COUNT *= 3; }
+ }
+
+ fn foo3(self: Box<Foo>) {
+ unsafe { COUNT *= 5; }
+ }
+}
--- /dev/null
+// 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 S(pub u8);
+
+impl S {
+ pub fn hey() -> u8 { 24 }
+}
+
+pub trait X {
+ fn hoy(&self) -> u8 { 25 }
+}
+
+impl X for S {}
+
+pub enum E {
+ U(u8)
+}
+
+pub fn regular_fn() -> u8 { 12 }
--- /dev/null
+// 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 struct S {
+ x: isize,
+}
+
+impl Drop for S {
+ fn drop(&mut self) {
+ println!("goodbye");
+ }
+}
+
+pub fn f() {
+ let x = S { x: 1 };
+ let y = x;
+ let _z = y;
+}
--- /dev/null
+// 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"]
+
+pub static FOO: i32 = 42;
--- /dev/null
+// 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 use Foo::*;
+
+pub enum Foo {
+ A,
+ B(isize),
+ C { a: isize },
+}
+
+impl Foo {
+ pub fn foo() {}
+}
+
+pub mod nest {
+ pub use self::Bar::*;
+
+ pub enum Bar {
+ D,
+ E(isize),
+ F { a: isize },
+ }
+
+ impl Bar {
+ pub fn foo() {}
+ }
+}
--- /dev/null
+// 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 enum Foo {
+ A,
+ B(isize),
+ C { a: isize },
+}
+
+impl Foo {
+ pub fn foo() {}
+ pub fn bar(&self) {}
+}
--- /dev/null
+// 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.
+
+// original problem
+pub fn foo<T>() -> isize {
+ {
+ static foo: isize = 2;
+ foo
+ }
+}
+
+// issue 8134
+struct Foo;
+impl Foo {
+ pub fn foo<T>(&self) {
+ static X: usize = 1;
+ }
+}
+
+// issue 8134
+pub struct Parser<T>(T);
+impl<T: std::iter::Iterator<Item=char>> Parser<T> {
+ fn in_doctype(&mut self) {
+ static DOCTYPEPattern: [char; 6] = ['O', 'C', 'T', 'Y', 'P', 'E'];
+ }
+}
+
+struct Bar;
+impl Foo {
+ pub fn bar<T>(&self) {
+ static X: usize = 1;
+ }
+}
--- /dev/null
+// 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 Au(pub isize);
--- /dev/null
+// 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.
+
+use std::ops::Deref;
+
+struct DerefWithHelper<H, T> {
+ pub helper: H,
+ pub value: Option<T>
+}
+
+trait Helper<T> {
+ fn helper_borrow(&self) -> &T;
+}
+
+impl<T> Helper<T> for Option<T> {
+ fn helper_borrow(&self) -> &T {
+ self.as_ref().unwrap()
+ }
+}
+
+impl<T, H: Helper<T>> Deref for DerefWithHelper<H, T> {
+ type Target = T;
+
+ fn deref(&self) -> &T {
+ self.helper.helper_borrow()
+ }
+}
+
+// Test cross-crate autoderef + vtable.
+pub fn check<T: PartialEq>(x: T, y: T) -> bool {
+ let d: DerefWithHelper<Option<T>, T> = DerefWithHelper { helper: Some(x), value: None };
+ d.eq(&y)
+}
--- /dev/null
+// 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.
+
+#[repr(packed)]
+pub struct S {
+ a: u8,
+ b: u32
+}
--- /dev/null
+// 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 trait A {
+ fn frob(&self);
+}
+
+impl A for isize { fn frob(&self) {} }
+
+pub fn frob<T:A>(t: T) {
+ t.frob();
+}
--- /dev/null
+// 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 crate core;
+pub use foo as bar;
+
+pub mod foo {
+ pub fn frob() {}
+}
--- /dev/null
+// 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 a {
+ pub use a::b::c;
+
+ pub mod b {
+ pub mod c {
+ fn f(){}
+ fn g(){}
+ }
+ }
+}
--- /dev/null
+// 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 name: isize
+}
--- /dev/null
+// 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.
+
+extern crate pub_use_xcrate1;
+
+pub use pub_use_xcrate1::Foo;
--- /dev/null
+// 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.
+
+use inner_private_module::*;
+
+mod inner_private_module {
+ pub struct Unnameable1;
+ pub struct Unnameable2;
+ #[derive(Clone, Copy)]
+ pub struct Unnameable3;
+ pub struct Unnameable4;
+ pub struct Unnameable5;
+ pub struct Unnameable6;
+ pub struct Unnameable7;
+ #[derive(Default)]
+ pub struct Unnameable8;
+ pub enum UnnameableEnum {
+ NameableVariant
+ }
+ pub trait UnnameableTrait {
+ type Alias: Default;
+ }
+
+ impl Unnameable1 {
+ pub fn method_of_unnameable_type1(&self) -> &'static str {
+ "Hello1"
+ }
+ }
+ impl Unnameable2 {
+ pub fn method_of_unnameable_type2(&self) -> &'static str {
+ "Hello2"
+ }
+ }
+ impl Unnameable3 {
+ pub fn method_of_unnameable_type3(&self) -> &'static str {
+ "Hello3"
+ }
+ }
+ impl Unnameable4 {
+ pub fn method_of_unnameable_type4(&self) -> &'static str {
+ "Hello4"
+ }
+ }
+ impl Unnameable5 {
+ pub fn method_of_unnameable_type5(&self) -> &'static str {
+ "Hello5"
+ }
+ }
+ impl Unnameable6 {
+ pub fn method_of_unnameable_type6(&self) -> &'static str {
+ "Hello6"
+ }
+ }
+ impl Unnameable7 {
+ pub fn method_of_unnameable_type7(&self) -> &'static str {
+ "Hello7"
+ }
+ }
+ impl Unnameable8 {
+ pub fn method_of_unnameable_type8(&self) -> &'static str {
+ "Hello8"
+ }
+ }
+ impl UnnameableEnum {
+ pub fn method_of_unnameable_enum(&self) -> &'static str {
+ "HelloEnum"
+ }
+ }
+}
+
+pub fn function_returning_unnameable_type() -> Unnameable1 {
+ Unnameable1
+}
+
+pub const CONSTANT_OF_UNNAMEABLE_TYPE: Unnameable2 =
+ Unnameable2;
+
+pub fn function_accepting_unnameable_type(_: Option<Unnameable3>) {}
+
+pub type AliasOfUnnameableType = Unnameable4;
+
+impl Unnameable1 {
+ pub fn inherent_method_returning_unnameable_type(&self) -> Unnameable5 {
+ Unnameable5
+ }
+}
+
+pub trait Tr {
+ fn trait_method_returning_unnameable_type(&self) -> Unnameable6 {
+ Unnameable6
+ }
+}
+impl Tr for Unnameable1 {}
+
+pub use inner_private_module::UnnameableEnum::NameableVariant;
+
+pub struct Struct {
+ pub field_of_unnameable_type: Unnameable7
+}
+
+pub static STATIC: Struct = Struct { field_of_unnameable_type: Unnameable7 } ;
+
+impl UnnameableTrait for AliasOfUnnameableType {
+ type Alias = Unnameable8;
+}
+
+pub fn generic_function<T: UnnameableTrait>() -> T::Alias {
+ Default::default()
+}
--- /dev/null
+// 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 use foo::bar;
+
+mod foo {
+ pub fn bar() {}
+}
--- /dev/null
+// 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 use sub_foo::Foo;
+pub use self::Bar as Baz;
+pub use sub_foo::Boz;
+pub use sub_foo::Bort;
+
+pub trait Bar {
+ fn bar() -> Self;
+}
+
+impl Bar for isize {
+ fn bar() -> isize { 84 }
+}
+
+pub mod sub_foo {
+ pub trait Foo {
+ fn foo() -> Self;
+ }
+
+ impl Foo for isize {
+ fn foo() -> isize { 42 }
+ }
+
+ pub struct Boz {
+ unused_str: String
+ }
+
+ impl Boz {
+ pub fn boz(i: isize) -> bool {
+ i > 0
+ }
+ }
+
+ pub enum Bort {
+ Bort1,
+ Bort2
+ }
+
+ impl Bort {
+ pub fn bort() -> String {
+ "bort()".to_string()
+ }
+ }
+}
--- /dev/null
+// 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.
+
+#[no_mangle]
+pub extern "C" fn foo() -> usize {
+ 1234
+}
--- /dev/null
+// 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.
+
+#[inline]
+pub fn cci_fn() -> usize {
+ 1200
+}
+
+pub const CCI_CONST: usize = 34;
--- /dev/null
+// 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 codegen-units=3 --crate-type=rlib,dylib
+
+pub mod a {
+ pub fn one() -> usize {
+ 1
+ }
+}
+
+pub mod b {
+ pub fn two() -> usize {
+ 2
+ }
+}
+
+pub mod c {
+ use a::one;
+ use b::two;
+ pub fn three() -> usize {
+ one() + two()
+ }
+}
--- /dev/null
+// 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 fn f(x: isize) -> isize { -x }
+
+pub static F: fn(isize) -> isize = f;
+pub static mut MutF: fn(isize) -> isize = f;
--- /dev/null
+// 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="static_methods_crate"]
+#![crate_type = "lib"]
+
+pub trait read: Sized {
+ fn readMaybe(s: String) -> Option<Self>;
+}
+
+impl read for isize {
+ fn readMaybe(s: String) -> Option<isize> {
+ s.parse().ok()
+ }
+}
+
+impl read for bool {
+ fn readMaybe(s: String) -> Option<bool> {
+ match &*s {
+ "true" => Some(true),
+ "false" => Some(false),
+ _ => None
+ }
+ }
+}
+
+pub fn read<T:read>(s: String) -> T {
+ match read::readMaybe(s) {
+ Some(x) => x,
+ _ => panic!("read panicked!")
+ }
+}
--- /dev/null
+// 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 num {
+ pub trait Num2 {
+ fn from_int2(n: isize) -> Self;
+ }
+}
+
+pub mod f64 {
+ impl ::num::Num2 for f64 {
+ #[inline]
+ fn from_int2(n: isize) -> f64 { return n as f64; }
+ }
+}
--- /dev/null
+// 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 mod num {
+ pub trait Num2 {
+ fn from_int2(n: isize) -> Self;
+ }
+}
+
+pub mod f64 {
+ impl ::num::Num2 for f64 {
+ fn from_int2(n: isize) -> f64 { return n as f64; }
+ }
+}
--- /dev/null
+// 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 mut a: isize = 3;
--- /dev/null
+// 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 struct S {
+ pub x: isize,
+ pub y: isize,
+}
--- /dev/null
+// 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="struct_variant_xc_aux"]
+#![crate_type = "lib"]
+
+#[derive(Copy, Clone)]
+pub enum Enum {
+ Variant(u8),
+ StructVariant { arg: u8 }
+}
--- /dev/null
+// 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.
+
+//! The `svh-a-*.rs` files are all deviations from the base file
+//! svh-a-base.rs with some difference (usually in `fn foo`) that
+//! should not affect the strict version hash (SVH) computation
+//! (#14132).
+
+#![crate_name = "a"]
+
+macro_rules! three {
+ () => { 3 }
+}
+
+pub trait U {}
+pub trait V {}
+impl U for () {}
+impl V for () {}
+
+static A_CONSTANT : isize = 2;
+
+pub fn foo<T:U>(_: isize) -> isize {
+ 3
+}
+
+pub fn an_unused_name() -> isize {
+ 4
+}
--- /dev/null
+// 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.
+
+//! The `svh-a-*.rs` files are all deviations from the base file
+//! svh-a-base.rs with some difference (usually in `fn foo`) that
+//! should not affect the strict version hash (SVH) computation
+//! (#14132).
+
+#![crate_name = "a"]
+
+macro_rules! three {
+ () => { 3 }
+}
+
+pub trait U {}
+pub trait V {}
+impl U for () {}
+impl V for () {}
+
+static A_CONSTANT : isize = 2;
+
+pub fn foo<T:U>(_: isize) -> isize {
+ // a comment does not affect the svh
+ 3
+}
+
+pub fn an_unused_name() -> isize {
+ 4
+}
--- /dev/null
+// 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.
+
+//! The `svh-a-*.rs` files are all deviations from the base file
+//! svh-a-base.rs with some difference (usually in `fn foo`) that
+//! should not affect the strict version hash (SVH) computation
+//! (#14132).
+
+#![crate_name = "a"]
+
+macro_rules! three {
+ () => { 3 }
+}
+
+pub trait U {}
+pub trait V {}
+impl U for () {}
+impl V for () {}
+
+static A_CONSTANT : isize = 2;
+
+// Adding some documentation does not affect the svh.
+
+/// foo always returns three.
+pub fn foo<T:U>(_: isize) -> isize {
+ 3
+}
+
+pub fn an_unused_name() -> isize {
+ 4
+}
--- /dev/null
+// 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.
+
+//! The `svh-a-*.rs` files are all deviations from the base file
+//! svh-a-base.rs with some difference (usually in `fn foo`) that
+//! should not affect the strict version hash (SVH) computation
+//! (#14132).
+
+#![crate_name = "a"]
+
+macro_rules! three {
+ () => { 3 }
+}
+
+pub trait U {}
+pub trait V {}
+impl U for () {}
+impl V for () {}
+
+static A_CONSTANT : isize = 2;
+
+pub fn foo<T:U>(_: isize) -> isize {
+ // a macro invocation in a function body does not affect the svh,
+ // as long as it yields the same code.
+ three!()
+}
+
+pub fn an_unused_name() -> isize {
+ 4
+}
--- /dev/null
+// 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.
+
+//! The `svh-a-*.rs` files are all deviations from the base file
+//! svh-a-base.rs with some difference (usually in `fn foo`) that
+//! should not affect the strict version hash (SVH) computation
+//! (#14132).
+
+#![crate_name = "a"]
+
+macro_rules! three {
+ () => { 3 }
+}
+
+pub trait U {}
+pub trait V {}
+impl U for () {}
+impl V for () {}
+
+static A_CONSTANT : isize = 2;
+
+pub fn foo<T:U>(_: isize) -> isize {
+ 3
+}
+
+pub fn an_unused_name() -> isize {
+ 4
+}
--- /dev/null
+// 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.
+
+//! The `svh-a-*.rs` files are all deviations from the base file
+//! svh-a-base.rs with some difference (usually in `fn foo`) that
+//! should not affect the strict version hash (SVH) computation
+//! (#14132).
+
+#![crate_name = "a"]
+
+macro_rules! three {
+ () => { 3 }
+}
+
+pub trait U {}
+pub trait V {}
+impl U for () {}
+impl V for () {}
+
+static A_CONSTANT : isize = 2;
+
+// cfg attribute does not affect the svh, as long as it yields the same code.
+#[cfg(not(an_unused_name))]
+pub fn foo<T:U>(_: isize) -> isize {
+ 3
+}
+
+pub fn an_unused_name() -> isize {
+ 4
+}
--- /dev/null
+// 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.
+
+//! The `svh-a-*.rs` files are all deviations from the base file
+//! svh-a-base.rs with some difference (usually in `fn foo`) that
+//! should not affect the strict version hash (SVH) computation
+//! (#14132).
+
+#![crate_name = "a"]
+
+macro_rules! three {
+ () => { 3 }
+}
+
+pub trait U {}
+pub trait V {}
+impl U for () {}
+impl V for () {}
+
+static A_CONSTANT : isize = 2;
+
+pub fn foo<T:U>(_: isize) -> isize {
+
+ 3
+
+}
+
+pub fn an_unused_name() -> isize {
+ 4
+}
--- /dev/null
+// 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.
+
+//! This is a client of the `a` crate defined in "svn-a-base.rs". The
+//! rpass and cfail tests (such as "run-pass/svh-add-comment.rs") use
+//! it by swapping in a different object code library crate built from
+//! some variant of "svn-a-base.rs", and then we are checking if the
+//! compiler properly ignores or accepts the change, based on whether
+//! the change could affect the downstream crate content or not
+//! (#14132).
+
+#![crate_name = "b"]
+
+extern crate a;
+
+pub fn foo() { assert_eq!(a::foo::<()>(0), 3); }
--- /dev/null
+// 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.
+
+#![feature(thread_local)]
+#![feature(cfg_target_thread_local)]
+#![crate_type = "lib"]
+
+#[no_mangle]
+#[cfg_attr(target_thread_local, thread_local)]
+pub static FOO: u32 = 3;
--- /dev/null
+// 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 Something { pub x: isize }
+
+pub trait A {
+ fn f(&self) -> isize;
+ fn g(&self) -> isize { 10 }
+ fn h(&self) -> isize { 11 }
+ fn lurr(x: &Self, y: &Self) -> isize { x.g() + y.h() }
+}
+
+
+impl A for isize {
+ fn f(&self) -> isize { 10 }
+}
+
+impl A for Something {
+ fn f(&self) -> isize { 10 }
+}
+
+pub trait B<T> {
+ fn thing<U>(&self, x: T, y: U) -> (T, U) { (x, y) }
+ fn staticthing<U>(_z: &Self, x: T, y: U) -> (T, U) { (x, y) }
+}
+
+impl<T> B<T> for isize { }
+impl B<f64> for bool { }
+
+
+
+pub trait TestEquality {
+ fn test_eq(&self, rhs: &Self) -> bool;
+ fn test_neq(&self, rhs: &Self) -> bool {
+ !self.test_eq(rhs)
+ }
+}
+
+impl TestEquality for isize {
+ fn test_eq(&self, rhs: &isize) -> bool {
+ *self == *rhs
+ }
+}
--- /dev/null
+// 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.
+
+// aux-build:trait_default_method_xc_aux.rs
+
+extern crate trait_default_method_xc_aux as aux;
+use aux::A;
+
+pub struct a_struct { pub x: isize }
+
+impl A for a_struct {
+ fn f(&self) -> isize { 10 }
+}
+
+// This function will need to get inlined, and badness may result.
+pub fn welp<A>(x: A) -> A {
+ let a = a_struct { x: 0 };
+ a.g();
+ x
+}
--- /dev/null
+// 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 { fn f(&self) -> isize; }
+pub trait Bar { fn g(&self) -> isize; }
+pub trait Baz { fn h(&self) -> isize; }
+
+pub struct A { pub x: isize }
+
+impl Foo for A { fn f(&self) -> isize { 10 } }
+impl Bar for A { fn g(&self) -> isize { 20 } }
+impl Baz for A { fn h(&self) -> isize { 30 } }
--- /dev/null
+// 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 { fn f(&self) -> isize; }
+pub trait Bar { fn g(&self) -> isize; }
+pub trait Baz { fn h(&self) -> isize; }
+
+pub trait Quux: Foo + Bar + Baz { }
+
+impl<T:Foo + Bar + Baz> Quux for T { }
--- /dev/null
+// 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 {
+ fn f(&self) -> isize;
+}
+
+pub struct A {
+ pub x: isize
+}
+
+impl Foo for A {
+ fn f(&self) -> isize { 10 }
+}
--- /dev/null
+// 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::cmp::PartialEq;
+use std::ops::{Add, Sub, Mul};
+
+pub trait MyNum : Add<Output=Self> + Sub<Output=Self> + Mul<Output=Self> + PartialEq + Clone {
+}
+
+#[derive(Clone, Debug)]
+pub struct MyInt {
+ pub val: isize
+}
+
+impl Add for MyInt {
+ type Output = MyInt;
+
+ fn add(self, other: MyInt) -> MyInt { mi(self.val + other.val) }
+}
+
+impl Sub for MyInt {
+ type Output = MyInt;
+
+ fn sub(self, other: MyInt) -> MyInt { mi(self.val - other.val) }
+}
+
+impl Mul for MyInt {
+ type Output = MyInt;
+
+ fn mul(self, other: MyInt) -> MyInt { mi(self.val * other.val) }
+}
+
+impl PartialEq for MyInt {
+ fn eq(&self, other: &MyInt) -> bool { self.val == other.val }
+
+ fn ne(&self, other: &MyInt) -> bool { !self.eq(other) }
+}
+
+impl MyNum for MyInt {}
+
+fn mi(v: isize) -> MyInt { MyInt { val: v } }
--- /dev/null
+// 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.
+
+// Simple smoke test that unsafe traits can be compiled etc.
+
+pub unsafe trait Foo {
+ fn foo(&self) -> isize;
+}
+
+unsafe impl Foo for isize {
+ fn foo(&self) -> isize { *self }
+}
--- /dev/null
+// 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.
+
+// Test library crate for cross-crate usages of traits inheriting
+// from the builtin kinds. Mostly tests metadata correctness.
+
+#![crate_type="lib"]
+
+pub trait RequiresShare : Sync { }
+pub trait RequiresRequiresShareAndSend : RequiresShare + Send { }
+pub trait RequiresCopy : Copy { }
--- /dev/null
+// 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.
+
+// Test inherent trait impls work cross-crait.
+
+pub trait Bar<'a> : 'a {}
+
+impl<'a> Bar<'a> {
+ pub fn bar(&self) {}
+}
--- /dev/null
+// 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.
+
+#[macro_export]
+macro_rules! macro_one { () => ("one") }
+
+#[macro_export]
+macro_rules! macro_two { () => ("two") }
--- /dev/null
+// 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.
+
+#![feature(core)]
+
+use std::any::{Any, TypeId};
+
+pub struct A;
+pub struct B(Option<A>);
+pub struct C(Option<isize>);
+pub struct D(Option<&'static str>);
+pub struct E(Result<&'static str, isize>);
+
+pub type F = Option<isize>;
+pub type G = usize;
+pub type H = &'static str;
+
+pub unsafe fn id_A() -> TypeId { TypeId::of::<A>() }
+pub unsafe fn id_B() -> TypeId { TypeId::of::<B>() }
+pub unsafe fn id_C() -> TypeId { TypeId::of::<C>() }
+pub unsafe fn id_D() -> TypeId { TypeId::of::<D>() }
+pub unsafe fn id_E() -> TypeId { TypeId::of::<E>() }
+pub unsafe fn id_F() -> TypeId { TypeId::of::<F>() }
+pub unsafe fn id_G() -> TypeId { TypeId::of::<G>() }
+pub unsafe fn id_H() -> TypeId { TypeId::of::<H>() }
+
+pub unsafe fn foo<T: Any>() -> TypeId { TypeId::of::<T>() }
--- /dev/null
+// 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.
+
+#![feature(core)]
+
+use std::any::{Any, TypeId};
+
+pub struct A;
+pub struct B(Option<A>);
+pub struct C(Option<isize>);
+pub struct D(Option<&'static str>);
+pub struct E(Result<&'static str, isize>);
+
+pub type F = Option<isize>;
+pub type G = usize;
+pub type H = &'static str;
+
+pub unsafe fn id_A() -> TypeId { TypeId::of::<A>() }
+pub unsafe fn id_B() -> TypeId { TypeId::of::<B>() }
+pub unsafe fn id_C() -> TypeId { TypeId::of::<C>() }
+pub unsafe fn id_D() -> TypeId { TypeId::of::<D>() }
+pub unsafe fn id_E() -> TypeId { TypeId::of::<E>() }
+pub unsafe fn id_F() -> TypeId { TypeId::of::<F>() }
+pub unsafe fn id_G() -> TypeId { TypeId::of::<G>() }
+pub unsafe fn id_H() -> TypeId { TypeId::of::<H>() }
+
+pub unsafe fn foo<T:Any>() -> TypeId { TypeId::of::<T>() }
--- /dev/null
+// 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(unboxed_closures)]
+
+use std::ops::Add;
+
+#[inline]
+pub fn has_closures() -> usize {
+ let x = 1;
+ let mut f = move || x;
+ let y = 1;
+ let g = || y;
+ f() + g()
+}
+
+pub fn has_generic_closures<T: Add<Output=T> + Copy>(x: T, y: T) -> T {
+ let mut f = move || x;
+ let g = || y;
+ f() + g()
+}
--- /dev/null
+// 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
+
+// This aux-file will require the eh_personality function to be codegen'd, but
+// it hasn't been defined just yet. Make sure we don't explode.
+
+#![no_std]
+#![crate_type = "rlib"]
+
+struct A;
+
+impl core::ops::Drop for A {
+ fn drop(&mut self) {}
+}
+
+pub fn foo() {
+ let _a = A;
+ panic!("wut");
+}
+
+mod std {
+ pub use core::{option, fmt};
+}
--- /dev/null
+// 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 Equal {
+ fn equal(&self, other: &Self) -> bool;
+ fn equals<T,U>(&self, this: &T, that: &T, x: &U, y: &U) -> bool
+ where T: Eq, U: Eq;
+}
+
+impl<T> Equal for T where T: Eq {
+ fn equal(&self, other: &T) -> bool {
+ self == other
+ }
+ fn equals<U,X>(&self, this: &U, other: &U, x: &X, y: &X) -> bool
+ where U: Eq, X: Eq {
+ this == other && x == y
+ }
+}
+
+pub fn equal<T>(x: &T, y: &T) -> bool where T: Eq {
+ x == y
+}
--- /dev/null
+// 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 trait FromBuf<'a> {
+ fn from_buf(&'a [u8]) -> Self;
+}
--- /dev/null
+// 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 fn foo<T>() -> isize {
+ static a: isize = 3;
+ a
+}
+
+pub fn bar() -> isize {
+ foo::<isize>()
+}
--- /dev/null
+// 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_type_defaults)]
+
+pub trait Foo<T: Default + ToString> {
+ type Out: Default + ToString = T;
+}
+
+impl Foo<u32> for () {
+}
+
+impl Foo<u64> for () {
+ type Out = bool;
+}
--- /dev/null
+// 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 static global: isize = 3;
+
+static global0: isize = 4;
+
+pub static global2: &'static isize = &global0;
+
+pub fn verify_same(a: &'static isize) {
+ let a = a as *const isize as usize;
+ let b = &global as *const isize as usize;
+ assert_eq!(a, b);
+}
+
+pub fn verify_same2(a: &'static isize) {
+ let a = a as *const isize as usize;
+ let b = global2 as *const isize as usize;
+ assert_eq!(a, b);
+}
--- /dev/null
+// 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 S {
+ pub x: isize,
+ pub y: isize,
+}
+
+pub type S2 = S;
--- /dev/null
+// 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_type = "lib"]
+
+// used by the rpass test
+
+#[derive(Copy, Clone)]
+pub struct Struct;
+
+#[derive(Copy, Clone)]
+pub enum Unit {
+ UnitVariant,
+ Argument(Struct)
+}
+
+#[derive(Copy, Clone)]
+pub struct TupleStruct(pub usize, pub &'static str);
+
+// used by the cfail test
+
+#[derive(Copy, Clone)]
+pub struct StructWithFields {
+ foo: isize,
+}
+
+#[derive(Copy, Clone)]
+pub enum EnumWithVariants {
+ EnumVariant,
+ EnumVariantArg(isize)
+}
+++ /dev/null
-// 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));
-}
+++ /dev/null
-// 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.
-
-macro_rules! add1 {
- ($e:expr) => ({
- let a = 1 + $e;
- let b = $e + 1;
- a + b - 1
- })
-}
--- /dev/null
+// 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));
+}
--- /dev/null
+// 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.
+
+macro_rules! add1 {
+ ($e:expr) => ({
+ let a = 1 + $e;
+ let b = $e + 1;
+ a + b - 1
+ })
+}
+++ /dev/null
-// 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"]
-
-// This is a file that pulls in a separate file as a submodule, where
-// that separate file has many multi-byte characters, to try to
-// encourage the compiler to trip on them.
-
-mod issue24687_mbcs_in_comments;
-
-pub use issue24687_mbcs_in_comments::D;
-
+++ /dev/null
-// 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::fmt;
-
-// This ia file with many multi-byte characters, to try to encourage
-// the compiler to trip on them. The Drop implementation below will
-// need to have its source location embedded into the debug info for
-// the output file.
-
-// αααααααααααααααααααααααααααααααααααααααααααααααααααααααααααααααααααααα
-// ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
-// γγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγ
-// δδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδ
-// εεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεε
-
-// ζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζ
-// ηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηη
-// θθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθ
-// ιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιι
-// κκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκ
-
-pub struct D<X:fmt::Debug>(pub X);
-
-impl<X:fmt::Debug> Drop for D<X> {
- fn drop(&mut self) {
- // λλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλ
- println!("Dropping D({:?})", self.0);
- }
-}
--- /dev/null
+// 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"]
+
+// This is a file that pulls in a separate file as a submodule, where
+// that separate file has many multi-byte characters, to try to
+// encourage the compiler to trip on them.
+
+mod issue24687_mbcs_in_comments;
+
+pub use issue24687_mbcs_in_comments::D;
+
--- /dev/null
+// 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::fmt;
+
+// This ia file with many multi-byte characters, to try to encourage
+// the compiler to trip on them. The Drop implementation below will
+// need to have its source location embedded into the debug info for
+// the output file.
+
+// αααααααααααααααααααααααααααααααααααααααααααααααααααααααααααααααααααααα
+// ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
+// γγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγ
+// δδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδ
+// εεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεε
+
+// ζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζ
+// ηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηη
+// θθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθ
+// ιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιι
+// κκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκ
+
+pub struct D<X:fmt::Debug>(pub X);
+
+impl<X:fmt::Debug> Drop for D<X> {
+ fn drop(&mut self) {
+ // λλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλ
+ println!("Dropping D({:?})", self.0);
+ }
+}
fn bar() {}
-include!(concat!("", "", "aux/", "macro-include-items-item.rs"));
+include!(concat!("", "", "auxiliary/", "macro-include-items-item.rs"));
fn main() {
foo();
- assert_eq!(include!(concat!("", "aux/", "macro-include-items-expr.rs")), 1_usize);
+ assert_eq!(include!(concat!("", "auxiliary/", "macro-include-items-expr.rs")), 1_usize);
}
+++ /dev/null
-// 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)
- }
-}
+++ /dev/null
-// 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(specialization)]
-
-pub trait Foo {
- fn foo(&self) -> &'static str;
-}
-
-impl<T> Foo for T {
- default fn foo(&self) -> &'static str {
- "generic"
- }
-}
-
-impl<T: Clone> Foo for T {
- default fn foo(&self) -> &'static str {
- "generic Clone"
- }
-}
-
-impl<T, U> Foo for (T, U) where T: Clone, U: Clone {
- default fn foo(&self) -> &'static str {
- "generic pair"
- }
-}
-
-impl<T: Clone> Foo for (T, T) {
- default fn foo(&self) -> &'static str {
- "generic uniform pair"
- }
-}
-
-impl Foo for (u8, u32) {
- default fn foo(&self) -> &'static str {
- "(u8, u32)"
- }
-}
-
-impl Foo for (u8, u8) {
- default fn foo(&self) -> &'static str {
- "(u8, u8)"
- }
-}
-
-impl<T: Clone> Foo for Vec<T> {
- default fn foo(&self) -> &'static str {
- "generic Vec"
- }
-}
-
-impl Foo for Vec<i32> {
- fn foo(&self) -> &'static str {
- "Vec<i32>"
- }
-}
-
-impl Foo for String {
- fn foo(&self) -> &'static str {
- "String"
- }
-}
-
-impl Foo for i32 {
- fn foo(&self) -> &'static str {
- "i32"
- }
-}
-
-pub trait MyMarker {}
-impl<T: Clone + MyMarker> Foo for T {
- default fn foo(&self) -> &'static str {
- "generic Clone + MyMarker"
- }
-}
+++ /dev/null
-// 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(specialization)]
-
-// First, test only use of explicit `default` items:
-
-pub trait Foo {
- fn foo(&self) -> bool;
-}
-
-impl<T> Foo for T {
- default fn foo(&self) -> bool { false }
-}
-
-impl Foo for i32 {}
-
-impl Foo for i64 {
- fn foo(&self) -> bool { true }
-}
-
-// Next, test mixture of explicit `default` and provided methods:
-
-pub trait Bar {
- fn bar(&self) -> i32 { 0 }
-}
-
-impl<T> Bar for T {} // use the provided method
-
-impl Bar for i32 {
- fn bar(&self) -> i32 { 1 }
-}
-impl<'a> Bar for &'a str {}
-
-impl<T> Bar for Vec<T> {
- default fn bar(&self) -> i32 { 2 }
-}
-impl Bar for Vec<i32> {}
-impl Bar for Vec<i64> {
- fn bar(&self) -> i32 { 3 }
-}
--- /dev/null
+// 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)
+ }
+}
--- /dev/null
+// 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(specialization)]
+
+pub trait Foo {
+ fn foo(&self) -> &'static str;
+}
+
+impl<T> Foo for T {
+ default fn foo(&self) -> &'static str {
+ "generic"
+ }
+}
+
+impl<T: Clone> Foo for T {
+ default fn foo(&self) -> &'static str {
+ "generic Clone"
+ }
+}
+
+impl<T, U> Foo for (T, U) where T: Clone, U: Clone {
+ default fn foo(&self) -> &'static str {
+ "generic pair"
+ }
+}
+
+impl<T: Clone> Foo for (T, T) {
+ default fn foo(&self) -> &'static str {
+ "generic uniform pair"
+ }
+}
+
+impl Foo for (u8, u32) {
+ default fn foo(&self) -> &'static str {
+ "(u8, u32)"
+ }
+}
+
+impl Foo for (u8, u8) {
+ default fn foo(&self) -> &'static str {
+ "(u8, u8)"
+ }
+}
+
+impl<T: Clone> Foo for Vec<T> {
+ default fn foo(&self) -> &'static str {
+ "generic Vec"
+ }
+}
+
+impl Foo for Vec<i32> {
+ fn foo(&self) -> &'static str {
+ "Vec<i32>"
+ }
+}
+
+impl Foo for String {
+ fn foo(&self) -> &'static str {
+ "String"
+ }
+}
+
+impl Foo for i32 {
+ fn foo(&self) -> &'static str {
+ "i32"
+ }
+}
+
+pub trait MyMarker {}
+impl<T: Clone + MyMarker> Foo for T {
+ default fn foo(&self) -> &'static str {
+ "generic Clone + MyMarker"
+ }
+}
--- /dev/null
+// 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(specialization)]
+
+// First, test only use of explicit `default` items:
+
+pub trait Foo {
+ fn foo(&self) -> bool;
+}
+
+impl<T> Foo for T {
+ default fn foo(&self) -> bool { false }
+}
+
+impl Foo for i32 {}
+
+impl Foo for i64 {
+ fn foo(&self) -> bool { true }
+}
+
+// Next, test mixture of explicit `default` and provided methods:
+
+pub trait Bar {
+ fn bar(&self) -> i32 { 0 }
+}
+
+impl<T> Bar for T {} // use the provided method
+
+impl Bar for i32 {
+ fn bar(&self) -> i32 { 1 }
+}
+impl<'a> Bar for &'a str {}
+
+impl<T> Bar for Vec<T> {
+ default fn bar(&self) -> i32 { 2 }
+}
+impl Bar for Vec<i32> {}
+impl Bar for Vec<i64> {
+ fn bar(&self) -> i32 { 3 }
+}
+++ /dev/null
-// 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.
+++ /dev/null
-// 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) {}
-}
+++ /dev/null
-// 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 {
- #[doc(hidden)]
- fn foo(&self) {}
-}
-
-impl Foo for i32 {}
+++ /dev/null
-// 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
-
-#![doc(html_root_url = "http://example.com/")]
-
-/// dox
-#[doc(primitive = "pointer")]
-pub mod ptr {}
+++ /dev/null
-// 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
-
-#![doc(html_root_url = "http://example.com")]
-
-pub trait Foo {
- fn foo(&self) {}
-}
+++ /dev/null
-// 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
-
-use std::ops::Deref;
-
-pub struct Foo;
-
-impl Deref for Foo {
- type Target = i32;
- fn deref(&self) -> &i32 { loop {} }
-}
-
-pub struct Bar;
-pub struct Baz;
-
-impl Baz {
- pub fn baz(&self) {}
- pub fn static_baz() {}
-}
-
-impl Deref for Bar {
- type Target = Baz;
- fn deref(&self) -> &Baz { loop {} }
-}
+++ /dev/null
-// 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 Trait {
- type Output;
-}
-
-pub fn fun<T>(_: T) where T: Trait<Output=i32> {}
+++ /dev/null
-// 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 Deref {
- type Target: ?Sized;
-
- fn deref<'a>(&'a self) -> &'a Self::Target;
-}
-
-pub trait Add<RHS = Self> {
- type Output;
-
- fn add(self, rhs: RHS) -> Self::Output;
-}
-
-
-pub trait Bar {}
-pub trait Deref2 {
- type Target: Bar;
-
- fn deref(&self) -> Self::Target;
-}
-
-pub trait Index<Idx: ?Sized> {
- type Output: ?Sized;
- fn index(&self, index: Idx) -> &Self::Output;
-}
-
-pub trait IndexMut<Idx: ?Sized>: Index<Idx> {
- fn index_mut(&mut self, index: Idx) -> &mut Self::Output;
-}
+++ /dev/null
-// 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 {
- type Bar;
- fn foo(&self) {}
-}
-
-pub struct Bar;
-
-impl Foo for Bar {
- type Bar = i32;
-}
+++ /dev/null
-// 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 struct Foo;
-
-impl Foo {
- pub fn new<F>(f: F) -> Foo where F: FnMut() -> i32 {
- loop {}
- }
-}
+++ /dev/null
-// 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 mod foo {
-
- pub trait Foo {}
- pub struct Bar;
-
- impl Foo for Bar {}
-
-}
+++ /dev/null
-// 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 mod fmt {
- pub struct Error;
-}
+++ /dev/null
-// 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.
-
-extern crate issue_23207_1;
-
-pub mod fmt {
- pub use issue_23207_1::fmt::Error;
-}
-
+++ /dev/null
-// 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.
-
-#[macro_export]
-macro_rules! make_item (
- ($name: ident) => (pub const $name: usize = 42;)
-);
+++ /dev/null
-// 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
-
-#![feature(const_fn)]
-
-pub const fn foo() {}
-pub const unsafe fn bar() {}
-
-pub struct Foo;
-
-impl Foo {
- pub const unsafe fn baz() {}
-}
+++ /dev/null
-// 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.
-
-extern crate issue_28927_2 as inner2;
-pub use inner2 as bar;
+++ /dev/null
-// 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 Baz;
+++ /dev/null
-// 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.
-
-// compile-flags: -Cmetadata=aux
-
-pub struct Foo;
-
-#[doc(hidden)]
-mod bar {
- trait Bar {}
-
- impl Bar for ::Foo {}
-}
+++ /dev/null
-// 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 Bar;
+++ /dev/null
-// 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.
-
-pub use private::Quz;
-pub use hidden::Bar;
-
-mod private {
- pub struct Quz;
-}
-
-#[doc(hidden)]
-pub mod hidden {
- pub struct Bar;
-}
+++ /dev/null
-// 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(optin_builtin_traits)]
-#![feature(core)]
-
-pub mod bar {
- use std::marker;
-
- pub trait Bar: 'static {}
-
- impl Bar for .. {}
-
- pub trait Foo {
- fn foo(&self) {}
- }
-
- impl Foo {
- pub fn test<T: Bar>(&self) {}
- }
-
- pub struct TypeId;
-
- impl TypeId {
- pub fn of<T: Bar + ?Sized>() -> TypeId {
- panic!()
- }
- }
-}
+++ /dev/null
-// 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 trait Trait {
- fn provided(&self) {}
-}
-
-pub struct Struct;
-
-impl Trait for Struct {
- fn provided(&self) {}
-}
+++ /dev/null
-// 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"]
-#![feature(unboxed_closures)]
-
-pub trait Foo {
- extern "rust-call" fn foo(&self, _: ()) -> i32;
- extern "rust-call" fn foo_(&self, _: ()) -> i32 { 0 }
-}
+++ /dev/null
-// 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"]
-
-extern "C" {
- // @has lib/fn.foreigner.html //pre 'pub unsafe fn foreigner(cold_as_ice: u32)'
- pub fn foreigner(cold_as_ice: u32);
-}
+++ /dev/null
-// 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(optin_builtin_traits)]
-
-pub trait AnOibit {}
-
-impl AnOibit for .. {}
+++ /dev/null
-// 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.
-
-pub enum Foo {
- Bar {
- qux: (),
- }
-}
--- /dev/null
+// 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.
--- /dev/null
+// 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) {}
+}
--- /dev/null
+// 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 {
+ #[doc(hidden)]
+ fn foo(&self) {}
+}
+
+impl Foo for i32 {}
--- /dev/null
+// 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
+
+#![doc(html_root_url = "http://example.com/")]
+
+/// dox
+#[doc(primitive = "pointer")]
+pub mod ptr {}
--- /dev/null
+// 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
+
+#![doc(html_root_url = "http://example.com")]
+
+pub trait Foo {
+ fn foo(&self) {}
+}
--- /dev/null
+// 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
+
+use std::ops::Deref;
+
+pub struct Foo;
+
+impl Deref for Foo {
+ type Target = i32;
+ fn deref(&self) -> &i32 { loop {} }
+}
+
+pub struct Bar;
+pub struct Baz;
+
+impl Baz {
+ pub fn baz(&self) {}
+ pub fn static_baz() {}
+}
+
+impl Deref for Bar {
+ type Target = Baz;
+ fn deref(&self) -> &Baz { loop {} }
+}
--- /dev/null
+// 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 Trait {
+ type Output;
+}
+
+pub fn fun<T>(_: T) where T: Trait<Output=i32> {}
--- /dev/null
+// 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 Deref {
+ type Target: ?Sized;
+
+ fn deref<'a>(&'a self) -> &'a Self::Target;
+}
+
+pub trait Add<RHS = Self> {
+ type Output;
+
+ fn add(self, rhs: RHS) -> Self::Output;
+}
+
+
+pub trait Bar {}
+pub trait Deref2 {
+ type Target: Bar;
+
+ fn deref(&self) -> Self::Target;
+}
+
+pub trait Index<Idx: ?Sized> {
+ type Output: ?Sized;
+ fn index(&self, index: Idx) -> &Self::Output;
+}
+
+pub trait IndexMut<Idx: ?Sized>: Index<Idx> {
+ fn index_mut(&mut self, index: Idx) -> &mut Self::Output;
+}
--- /dev/null
+// 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 {
+ type Bar;
+ fn foo(&self) {}
+}
+
+pub struct Bar;
+
+impl Foo for Bar {
+ type Bar = i32;
+}
--- /dev/null
+// 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 struct Foo;
+
+impl Foo {
+ pub fn new<F>(f: F) -> Foo where F: FnMut() -> i32 {
+ loop {}
+ }
+}
--- /dev/null
+// 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 mod foo {
+
+ pub trait Foo {}
+ pub struct Bar;
+
+ impl Foo for Bar {}
+
+}
--- /dev/null
+// 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 mod fmt {
+ pub struct Error;
+}
--- /dev/null
+// 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.
+
+extern crate issue_23207_1;
+
+pub mod fmt {
+ pub use issue_23207_1::fmt::Error;
+}
+
--- /dev/null
+// 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.
+
+#[macro_export]
+macro_rules! make_item (
+ ($name: ident) => (pub const $name: usize = 42;)
+);
--- /dev/null
+// 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
+
+#![feature(const_fn)]
+
+pub const fn foo() {}
+pub const unsafe fn bar() {}
+
+pub struct Foo;
+
+impl Foo {
+ pub const unsafe fn baz() {}
+}
--- /dev/null
+// 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.
+
+extern crate issue_28927_2 as inner2;
+pub use inner2 as bar;
--- /dev/null
+// 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 Baz;
--- /dev/null
+// 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.
+
+// compile-flags: -Cmetadata=aux
+
+pub struct Foo;
+
+#[doc(hidden)]
+mod bar {
+ trait Bar {}
+
+ impl Bar for ::Foo {}
+}
--- /dev/null
+// 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 Bar;
--- /dev/null
+// 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.
+
+pub use private::Quz;
+pub use hidden::Bar;
+
+mod private {
+ pub struct Quz;
+}
+
+#[doc(hidden)]
+pub mod hidden {
+ pub struct Bar;
+}
--- /dev/null
+// 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(optin_builtin_traits)]
+#![feature(core)]
+
+pub mod bar {
+ use std::marker;
+
+ pub trait Bar: 'static {}
+
+ impl Bar for .. {}
+
+ pub trait Foo {
+ fn foo(&self) {}
+ }
+
+ impl Foo {
+ pub fn test<T: Bar>(&self) {}
+ }
+
+ pub struct TypeId;
+
+ impl TypeId {
+ pub fn of<T: Bar + ?Sized>() -> TypeId {
+ panic!()
+ }
+ }
+}
--- /dev/null
+// 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 trait Trait {
+ fn provided(&self) {}
+}
+
+pub struct Struct;
+
+impl Trait for Struct {
+ fn provided(&self) {}
+}
--- /dev/null
+// 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"]
+#![feature(unboxed_closures)]
+
+pub trait Foo {
+ extern "rust-call" fn foo(&self, _: ()) -> i32;
+ extern "rust-call" fn foo_(&self, _: ()) -> i32 { 0 }
+}
--- /dev/null
+// 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"]
+
+extern "C" {
+ // @has lib/fn.foreigner.html //pre 'pub unsafe fn foreigner(cold_as_ice: u32)'
+ pub fn foreigner(cold_as_ice: u32);
+}
--- /dev/null
+// 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(optin_builtin_traits)]
+
+pub trait AnOibit {}
+
+impl AnOibit for .. {}
--- /dev/null
+// 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.
+
+pub enum Foo {
+ Bar {
+ qux: (),
+ }
+}
+++ /dev/null
-// 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.
-
-#![crate_name="bar"]
-
-pub trait Bar {}
-pub struct Foo;
-
-impl<'a> Bar for &'a char {}
-impl Bar for Foo {}
+++ /dev/null
-// 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.
-
-pub struct Bar;
-
-impl Bar {
- pub fn bar(_: u8) -> hidden::Hidden {
- hidden::Hidden
- }
-}
-
-#[doc(hidden)]
-pub mod hidden {
- pub struct Hidden;
-}
+++ /dev/null
-// 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.
-
-#[doc(hidden)]
-pub struct Foo;
-
-pub struct Bar;
+++ /dev/null
-// 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.
-
-pub struct Foo;
-
-pub trait Woof {}
-pub trait Bark {}
-
-mod private {
- // should be shown
- impl ::Woof for ::Foo {}
-
- pub trait Bar {}
- pub struct Wibble;
-
- // these should not be shown
- impl Bar for ::Foo {}
- impl Bar for Wibble {}
- impl ::Bark for Wibble {}
- impl ::Woof for Wibble {}
-}
-
-#[doc(hidden)]
-pub mod hidden {
- // should be shown
- impl ::Bark for ::Foo {}
-
- pub trait Qux {}
- pub struct Wobble;
-
-
- // these should only be shown if they're reexported correctly
- impl Qux for ::Foo {}
- impl Qux for Wobble {}
- impl ::Bark for Wobble {}
- impl ::Woof for Wobble {}
-}
+++ /dev/null
-// 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.
-
-use std::fmt;
-
-pub trait Bar {}
-
-impl<'a> Bar + 'a {
- pub fn bar(&self) -> usize { 42 }
-}
-
-impl<'a> fmt::Debug for Bar + 'a {
- fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result {
- Ok(())
- }
-}
-
--- /dev/null
+// 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.
+
+#![crate_name="bar"]
+
+pub trait Bar {}
+pub struct Foo;
+
+impl<'a> Bar for &'a char {}
+impl Bar for Foo {}
--- /dev/null
+// 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.
+
+pub struct Bar;
+
+impl Bar {
+ pub fn bar(_: u8) -> hidden::Hidden {
+ hidden::Hidden
+ }
+}
+
+#[doc(hidden)]
+pub mod hidden {
+ pub struct Hidden;
+}
--- /dev/null
+// 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.
+
+#[doc(hidden)]
+pub struct Foo;
+
+pub struct Bar;
--- /dev/null
+// 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.
+
+pub struct Foo;
+
+pub trait Woof {}
+pub trait Bark {}
+
+mod private {
+ // should be shown
+ impl ::Woof for ::Foo {}
+
+ pub trait Bar {}
+ pub struct Wibble;
+
+ // these should not be shown
+ impl Bar for ::Foo {}
+ impl Bar for Wibble {}
+ impl ::Bark for Wibble {}
+ impl ::Woof for Wibble {}
+}
+
+#[doc(hidden)]
+pub mod hidden {
+ // should be shown
+ impl ::Bark for ::Foo {}
+
+ pub trait Qux {}
+ pub struct Wobble;
+
+
+ // these should only be shown if they're reexported correctly
+ impl Qux for ::Foo {}
+ impl Qux for Wobble {}
+ impl ::Bark for Wobble {}
+ impl ::Woof for Wobble {}
+}
--- /dev/null
+// 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.
+
+use std::fmt;
+
+pub trait Bar {}
+
+impl<'a> Bar + 'a {
+ pub fn bar(&self) -> usize { 42 }
+}
+
+impl<'a> fmt::Debug for Bar + 'a {
+ fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result {
+ Ok(())
+ }
+}
+
tests.push(make_test(config, &paths))
} else if file_path.is_dir() {
let relative_file_path = relative_dir_path.join(file.file_name());
- if &file_name == "aux" {
+ if &file_name == "auxiliary" {
// `aux` directories contain other crates used for
// cross-crate tests. Don't search them for tests, but
// do create a directory in the build dir for them,
let test_ab = self.testpaths.file
.parent()
.expect("test file path has no parent")
- .join("aux")
+ .join("auxiliary")
.join(rel_ab);
if !test_ab.exists() {
self.fatal(&format!("aux-build `{}` source not found", test_ab.display()))
file: test_ab,
base: self.testpaths.base.clone(),
relative_dir: self.testpaths.relative_dir
- .join("aux")
+ .join("auxiliary")
.join(rel_ab)
.parent()
.expect("aux-build path has no parent")