move auxiliary builds to a test-relative aux
Instead of finding aux-build files in `auxiliary`, we now search for an `aux` directory relative to the test. So if your test is `compile-fail/foo.rs`, we would look in `compile-fail/aux`. Similarly, we ignore the `aux` directory when searching for tets.
This commit is contained in:
parent
77ae7591a8
commit
fbc082dcc6
@ -0,0 +1,34 @@
|
||||
// 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) }
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
// 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)
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
// 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
|
||||
}
|
||||
|
@ -0,0 +1,20 @@
|
||||
// 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() {}
|
@ -0,0 +1,17 @@
|
||||
// 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) {}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
// 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
|
||||
}
|
||||
|
31
src/test/compile-fail-fulldeps/aux/attr_plugin_test.rs
Normal file
31
src/test/compile-fail-fulldeps/aux/attr_plugin_test.rs
Normal file
@ -0,0 +1,31 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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);
|
||||
}
|
47
src/test/compile-fail-fulldeps/aux/lint_for_crate.rs
Normal file
47
src/test/compile-fail-fulldeps/aux/lint_for_crate.rs
Normal file
@ -0,0 +1,47 @@
|
||||
// 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);
|
||||
}
|
51
src/test/compile-fail-fulldeps/aux/lint_group_plugin_test.rs
Normal file
51
src/test/compile-fail-fulldeps/aux/lint_group_plugin_test.rs
Normal file
@ -0,0 +1,51 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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]);
|
||||
}
|
48
src/test/compile-fail-fulldeps/aux/lint_plugin_test.rs
Normal file
48
src/test/compile-fail-fulldeps/aux/lint_plugin_test.rs
Normal file
@ -0,0 +1,48 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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);
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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);
|
||||
}
|
141
src/test/compile-fail-fulldeps/aux/macro_crate_test.rs
Normal file
141
src/test/compile-fail-fulldeps/aux/macro_crate_test.rs
Normal file
@ -0,0 +1,141 @@
|
||||
// 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() {}
|
15
src/test/compile-fail-fulldeps/aux/macro_reexport_1.rs
Normal file
15
src/test/compile-fail-fulldeps/aux/macro_reexport_1.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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 )
|
||||
}
|
22
src/test/compile-fail-fulldeps/aux/rlib_crate_test.rs
Normal file
22
src/test/compile-fail-fulldeps/aux/rlib_crate_test.rs
Normal file
@ -0,0 +1,22 @@
|
||||
// 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) {}
|
41
src/test/compile-fail-fulldeps/aux/use_from_trait_xc.rs
Normal file
41
src/test/compile-fail-fulldeps/aux/use_from_trait_xc.rs
Normal file
@ -0,0 +1,41 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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() {}
|
||||
}
|
||||
}
|
15
src/test/compile-fail/aux/allocator-dylib.rs
Normal file
15
src/test/compile-fail/aux/allocator-dylib.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// 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() {}
|
12
src/test/compile-fail/aux/allocator-dylib2.rs
Normal file
12
src/test/compile-fail/aux/allocator-dylib2.rs
Normal file
@ -0,0 +1,12 @@
|
||||
// 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() {}
|
||||
|
16
src/test/compile-fail/aux/allocator1.rs
Normal file
16
src/test/compile-fail/aux/allocator1.rs
Normal file
@ -0,0 +1,16 @@
|
||||
// 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]
|
16
src/test/compile-fail/aux/allocator2.rs
Normal file
16
src/test/compile-fail/aux/allocator2.rs
Normal file
@ -0,0 +1,16 @@
|
||||
// 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]
|
19
src/test/compile-fail/aux/allocator3.rs
Normal file
19
src/test/compile-fail/aux/allocator3.rs
Normal file
@ -0,0 +1,19 @@
|
||||
// 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;
|
||||
|
14
src/test/compile-fail/aux/ambig_impl_2_lib.rs
Normal file
14
src/test/compile-fail/aux/ambig_impl_2_lib.rs
Normal file
@ -0,0 +1,14 @@
|
||||
// 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 } }
|
24
src/test/compile-fail/aux/cci_class.rs
Normal file
24
src/test/compile-fail/aux/cci_class.rs
Normal file
@ -0,0 +1,24 @@
|
||||
// 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
|
||||
}
|
||||
}
|
||||
}
|
27
src/test/compile-fail/aux/cci_class_5.rs
Normal file
27
src/test/compile-fail/aux/cci_class_5.rs
Normal file
@ -0,0 +1,27 @@
|
||||
// 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
|
||||
}
|
||||
}
|
||||
}
|
13
src/test/compile-fail/aux/changing-crates-a1.rs
Normal file
13
src/test/compile-fail/aux/changing-crates-a1.rs
Normal file
@ -0,0 +1,13 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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>() {}
|
13
src/test/compile-fail/aux/changing-crates-a2.rs
Normal file
13
src/test/compile-fail/aux/changing-crates-a2.rs
Normal file
@ -0,0 +1,13 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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!"); }
|
15
src/test/compile-fail/aux/changing-crates-b.rs
Normal file
15
src/test/compile-fail/aux/changing-crates-b.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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>(); }
|
20
src/test/compile-fail/aux/coherence_copy_like_lib.rs
Normal file
20
src/test/compile-fail/aux/coherence_copy_like_lib.rs
Normal file
@ -0,0 +1,20 @@
|
||||
// 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);
|
21
src/test/compile-fail/aux/coherence_inherent_cc_lib.rs
Normal file
21
src/test/compile-fail/aux/coherence_inherent_cc_lib.rs
Normal file
@ -0,0 +1,21 @@
|
||||
// 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) {}
|
||||
}
|
25
src/test/compile-fail/aux/coherence_lib.rs
Normal file
25
src/test/compile-fail/aux/coherence_lib.rs
Normal file
@ -0,0 +1,25 @@
|
||||
// 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);
|
13
src/test/compile-fail/aux/coherence_orphan_lib.rs
Normal file
13
src/test/compile-fail/aux/coherence_orphan_lib.rs
Normal file
@ -0,0 +1,13 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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);
|
||||
}
|
16
src/test/compile-fail/aux/const_fn_lib.rs
Normal file
16
src/test/compile-fail/aux/const_fn_lib.rs
Normal file
@ -0,0 +1,16 @@
|
||||
// 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
|
21
src/test/compile-fail/aux/crate_a1.rs
Normal file
21
src/test/compile-fail/aux/crate_a1.rs
Normal file
@ -0,0 +1,21 @@
|
||||
// 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>){}
|
17
src/test/compile-fail/aux/crate_a2.rs
Normal file
17
src/test/compile-fail/aux/crate_a2.rs
Normal file
@ -0,0 +1,17 @@
|
||||
// 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!()
|
||||
}
|
15
src/test/compile-fail/aux/crateresolve1-1.rs
Normal file
15
src/test/compile-fail/aux/crateresolve1-1.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// 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 }
|
15
src/test/compile-fail/aux/crateresolve1-2.rs
Normal file
15
src/test/compile-fail/aux/crateresolve1-2.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// 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 }
|
15
src/test/compile-fail/aux/crateresolve1-3.rs
Normal file
15
src/test/compile-fail/aux/crateresolve1-3.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// 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 }
|
@ -0,0 +1,20 @@
|
||||
// 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) }
|
||||
|
90
src/test/compile-fail/aux/deprecation-lint.rs
Normal file
90
src/test/compile-fail/aux/deprecation-lint.rs
Normal file
@ -0,0 +1,90 @@
|
||||
// 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()));
|
||||
}
|
17
src/test/compile-fail/aux/empty-struct.rs
Normal file
17
src/test/compile-fail/aux/empty-struct.rs
Normal file
@ -0,0 +1,17 @@
|
||||
// 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,
|
||||
}
|
53
src/test/compile-fail/aux/go_trait.rs
Normal file
53
src/test/compile-fail/aux/go_trait.rs
Normal file
@ -0,0 +1,53 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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)
|
||||
}
|
||||
}
|
56
src/test/compile-fail/aux/inherited_stability.rs
Normal file
56
src/test/compile-fail/aux/inherited_stability.rs
Normal file
@ -0,0 +1,56 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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
|
||||
}
|
102
src/test/compile-fail/aux/internal_unstable.rs
Normal file
102
src/test/compile-fail/aux/internal_unstable.rs
Normal file
@ -0,0 +1,102 @@
|
||||
// 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 }
|
||||
}
|
16
src/test/compile-fail/aux/issue-19163.rs
Normal file
16
src/test/compile-fail/aux/issue-19163.rs
Normal file
@ -0,0 +1,16 @@
|
||||
// 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)*)))
|
||||
}
|
29
src/test/compile-fail/aux/issue-21221-3.rs
Normal file
29
src/test/compile-fail/aux/issue-21221-3.rs
Normal file
@ -0,0 +1,29 @@
|
||||
// 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 {}
|
||||
}
|
||||
}
|
22
src/test/compile-fail/aux/issue-21221-4.rs
Normal file
22
src/test/compile-fail/aux/issue-21221-4.rs
Normal file
@ -0,0 +1,22 @@
|
||||
// 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;
|
15
src/test/compile-fail/aux/issue-29181.rs
Normal file
15
src/test/compile-fail/aux/issue-29181.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// 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::*;
|
||||
}
|
15
src/test/compile-fail/aux/issue-30535.rs
Normal file
15
src/test/compile-fail/aux/issue-30535.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// 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: () }
|
||||
}
|
19
src/test/compile-fail/aux/issue_11680.rs
Normal file
19
src/test/compile-fail/aux/issue_11680.rs
Normal file
@ -0,0 +1,19 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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)
|
||||
}
|
||||
}
|
13
src/test/compile-fail/aux/issue_12612_1.rs
Normal file
13
src/test/compile-fail/aux/issue_12612_1.rs
Normal file
@ -0,0 +1,13 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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() {}
|
||||
}
|
13
src/test/compile-fail/aux/issue_16725.rs
Normal file
13
src/test/compile-fail/aux/issue_16725.rs
Normal file
@ -0,0 +1,13 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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();
|
||||
}
|
18
src/test/compile-fail/aux/issue_17718_const_privacy.rs
Normal file
18
src/test/compile-fail/aux/issue_17718_const_privacy.rs
Normal file
@ -0,0 +1,18 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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;
|
||||
}
|
16
src/test/compile-fail/aux/issue_21202.rs
Normal file
16
src/test/compile-fail/aux/issue_21202.rs
Normal file
@ -0,0 +1,16 @@
|
||||
// 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) { }
|
||||
}
|
||||
}
|
33
src/test/compile-fail/aux/issue_30123_aux.rs
Normal file
33
src/test/compile-fail/aux/issue_30123_aux.rs
Normal file
@ -0,0 +1,33 @@
|
||||
// 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}
|
||||
}
|
||||
}
|
13
src/test/compile-fail/aux/issue_3907.rs
Normal file
13
src/test/compile-fail/aux/issue_3907.rs
Normal file
@ -0,0 +1,13 @@
|
||||
// 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();
|
||||
}
|
17
src/test/compile-fail/aux/issue_5844_aux.rs
Normal file
17
src/test/compile-fail/aux/issue_5844_aux.rs
Normal file
@ -0,0 +1,17 @@
|
||||
// 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;
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
// 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>...
|
||||
}
|
30
src/test/compile-fail/aux/lint_output_format.rs
Normal file
30
src/test/compile-fail/aux/lint_output_format.rs
Normal file
@ -0,0 +1,30 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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
|
||||
}
|
179
src/test/compile-fail/aux/lint_stability.rs
Normal file
179
src/test/compile-fail/aux/lint_stability.rs
Normal file
@ -0,0 +1,179 @@
|
||||
// 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()));
|
||||
}
|
61
src/test/compile-fail/aux/lint_stability_fields.rs
Normal file
61
src/test/compile-fail/aux/lint_stability_fields.rs
Normal file
@ -0,0 +1,61 @@
|
||||
// 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);
|
11
src/test/compile-fail/aux/lint_unused_extern_crate.rs
Normal file
11
src/test/compile-fail/aux/lint_unused_extern_crate.rs
Normal file
@ -0,0 +1,11 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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() {}
|
22
src/test/compile-fail/aux/macro_crate_nonterminal.rs
Normal file
22
src/test/compile-fail/aux/macro_crate_nonterminal.rs
Normal file
@ -0,0 +1,22 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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);
|
||||
}
|
19
src/test/compile-fail/aux/macro_non_reexport_2.rs
Normal file
19
src/test/compile-fail/aux/macro_non_reexport_2.rs
Normal file
@ -0,0 +1,19 @@
|
||||
// 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;
|
15
src/test/compile-fail/aux/macro_reexport_1.rs
Normal file
15
src/test/compile-fail/aux/macro_reexport_1.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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 )
|
||||
}
|
20
src/test/compile-fail/aux/namespaced_enums.rs
Normal file
20
src/test/compile-fail/aux/namespaced_enums.rs
Normal file
@ -0,0 +1,20 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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) {}
|
||||
}
|
16
src/test/compile-fail/aux/needs_allocator.rs
Normal file
16
src/test/compile-fail/aux/needs_allocator.rs
Normal file
@ -0,0 +1,16 @@
|
||||
// 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"]
|
46
src/test/compile-fail/aux/no_method_suggested_traits.rs
Normal file
46
src/test/compile-fail/aux/no_method_suggested_traits.rs
Normal file
@ -0,0 +1,46 @@
|
||||
// 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);
|
||||
}
|
||||
}
|
12
src/test/compile-fail/aux/noexporttypelib.rs
Normal file
12
src/test/compile-fail/aux/noexporttypelib.rs
Normal file
@ -0,0 +1,12 @@
|
||||
// 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) }
|
11
src/test/compile-fail/aux/orphan_check_diagnostics.rs
Normal file
11
src/test/compile-fail/aux/orphan_check_diagnostics.rs
Normal file
@ -0,0 +1,11 @@
|
||||
// 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) { } }
|
14
src/test/compile-fail/aux/privacy_tuple_struct.rs
Normal file
14
src/test/compile-fail/aux/privacy_tuple_struct.rs
Normal file
@ -0,0 +1,14 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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);
|
11
src/test/compile-fail/aux/private_trait_xc.rs
Normal file
11
src/test/compile-fail/aux/private_trait_xc.rs
Normal file
@ -0,0 +1,11 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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 {}
|
11
src/test/compile-fail/aux/pub_static_array.rs
Normal file
11
src/test/compile-fail/aux/pub_static_array.rs
Normal file
@ -0,0 +1,11 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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];
|
42
src/test/compile-fail/aux/rbmtp_cross_crate_lib.rs
Normal file
42
src/test/compile-fail/aux/rbmtp_cross_crate_lib.rs
Normal file
@ -0,0 +1,42 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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!() }
|
||||
}
|
19
src/test/compile-fail/aux/stability_attribute_issue.rs
Normal file
19
src/test/compile-fail/aux/stability_attribute_issue.rs
Normal file
@ -0,0 +1,19 @@
|
||||
// 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() {}
|
13
src/test/compile-fail/aux/stability_cfg1.rs
Normal file
13
src/test/compile-fail/aux/stability_cfg1.rs
Normal file
@ -0,0 +1,13 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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)]
|
15
src/test/compile-fail/aux/stability_cfg2.rs
Normal file
15
src/test/compile-fail/aux/stability_cfg2.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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)]
|
61
src/test/compile-fail/aux/static_priv_by_default.rs
Normal file
61
src/test/compile-fail/aux/static_priv_by_default.rs
Normal file
@ -0,0 +1,61 @@
|
||||
// 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;
|
19
src/test/compile-fail/aux/struct_field_privacy.rs
Normal file
19
src/test/compile-fail/aux/struct_field_privacy.rs
Normal file
@ -0,0 +1,19 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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,
|
||||
}
|
13
src/test/compile-fail/aux/struct_variant_privacy.rs
Normal file
13
src/test/compile-fail/aux/struct_variant_privacy.rs
Normal file
@ -0,0 +1,13 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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 }
|
||||
}
|
35
src/test/compile-fail/aux/svh-a-base.rs
Normal file
35
src/test/compile-fail/aux/svh-a-base.rs
Normal file
@ -0,0 +1,35 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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
|
||||
}
|
35
src/test/compile-fail/aux/svh-a-change-lit.rs
Normal file
35
src/test/compile-fail/aux/svh-a-change-lit.rs
Normal file
@ -0,0 +1,35 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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
|
||||
}
|
37
src/test/compile-fail/aux/svh-a-change-significant-cfg.rs
Normal file
37
src/test/compile-fail/aux/svh-a-change-significant-cfg.rs
Normal file
@ -0,0 +1,37 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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
|
||||
}
|
35
src/test/compile-fail/aux/svh-a-change-trait-bound.rs
Normal file
35
src/test/compile-fail/aux/svh-a-change-trait-bound.rs
Normal file
@ -0,0 +1,35 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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
|
||||
}
|
35
src/test/compile-fail/aux/svh-a-change-type-arg.rs
Normal file
35
src/test/compile-fail/aux/svh-a-change-type-arg.rs
Normal file
@ -0,0 +1,35 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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
|
||||
}
|
35
src/test/compile-fail/aux/svh-a-change-type-ret.rs
Normal file
35
src/test/compile-fail/aux/svh-a-change-type-ret.rs
Normal file
@ -0,0 +1,35 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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
|
||||
}
|
36
src/test/compile-fail/aux/svh-a-change-type-static.rs
Normal file
36
src/test/compile-fail/aux/svh-a-change-type-static.rs
Normal file
@ -0,0 +1,36 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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
|
||||
}
|
23
src/test/compile-fail/aux/svh-b.rs
Normal file
23
src/test/compile-fail/aux/svh-b.rs
Normal file
@ -0,0 +1,23 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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); }
|
32
src/test/compile-fail/aux/svh-uta-base.rs
Normal file
32
src/test/compile-fail/aux/svh-uta-base.rs
Normal file
@ -0,0 +1,32 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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()
|
||||
}
|
32
src/test/compile-fail/aux/svh-uta-change-use-trait.rs
Normal file
32
src/test/compile-fail/aux/svh-uta-change-use-trait.rs
Normal file
@ -0,0 +1,32 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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()
|
||||
}
|
22
src/test/compile-fail/aux/svh-utb.rs
Normal file
22
src/test/compile-fail/aux/svh-utb.rs
Normal file
@ -0,0 +1,22 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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); }
|
17
src/test/compile-fail/aux/tdticc_coherence_lib.rs
Normal file
17
src/test/compile-fail/aux/tdticc_coherence_lib.rs
Normal file
@ -0,0 +1,17 @@
|
||||
// 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 }
|
@ -0,0 +1,23 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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),
|
||||
}
|
15
src/test/compile-fail/aux/trait_impl_conflict.rs
Normal file
15
src/test/compile-fail/aux/trait_impl_conflict.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// 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 {
|
||||
}
|
19
src/test/compile-fail/aux/trait_safety_lib.rs
Normal file
19
src/test/compile-fail/aux/trait_safety_lib.rs
Normal file
@ -0,0 +1,19 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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 }
|
||||
}
|
18
src/test/compile-fail/aux/trait_superkinds_in_metadata.rs
Normal file
18
src/test/compile-fail/aux/trait_superkinds_in_metadata.rs
Normal file
@ -0,0 +1,18 @@
|
||||
// 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 { }
|
15
src/test/compile-fail/aux/two_macros.rs
Normal file
15
src/test/compile-fail/aux/two_macros.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// 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") }
|
15
src/test/compile-fail/aux/unreachable_variant.rs
Normal file
15
src/test/compile-fail/aux/unreachable_variant.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// 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
|
||||
}
|
||||
}
|
41
src/test/compile-fail/aux/use_from_trait_xc.rs
Normal file
41
src/test/compile-fail/aux/use_from_trait_xc.rs
Normal file
@ -0,0 +1,41 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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() {}
|
||||
}
|
||||
}
|
15
src/test/compile-fail/aux/variant-namespacing.rs
Normal file
15
src/test/compile-fail/aux/variant-namespacing.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// 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,
|
||||
}
|
32
src/test/compile-fail/aux/weak-lang-items.rs
Normal file
32
src/test/compile-fail/aux/weak-lang-items.rs
Normal file
@ -0,0 +1,32 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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};
|
||||
}
|
43
src/test/compile-fail/aux/xc_private_method_lib.rs
Normal file
43
src/test/compile-fail/aux/xc_private_method_lib.rs
Normal file
@ -0,0 +1,43 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-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
|
||||
}
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user