Merge remote-tracking branch 'origin/master' into gen
This commit is contained in:
commit
3971a3d55c
64 changed files with 544 additions and 167 deletions
|
|
@ -9,6 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
// aux-build:attribute-with-error.rs
|
||||
// ignore-stage1
|
||||
|
||||
#![feature(proc_macro)]
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
// aux-build:attributes-included.rs
|
||||
// ignore-stage1
|
||||
|
||||
#![feature(proc_macro, rustc_attrs)]
|
||||
#![warn(unused)]
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
// aux-build:derive-bad.rs
|
||||
// ignore-stage1
|
||||
|
||||
#[macro_use]
|
||||
extern crate derive_bad;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
// aux-build:derive-unstable-2.rs
|
||||
// ignore-stage1
|
||||
|
||||
#![allow(warnings)]
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
// aux-build:derive-unstable.rs
|
||||
// ignore-stage1
|
||||
|
||||
#![allow(warnings)]
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
// aux-build:issue_38586.rs
|
||||
// ignore-stage1
|
||||
|
||||
#![feature(proc_macro)]
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
// aux-build:derive-b.rs
|
||||
// ignore-stage1
|
||||
|
||||
#![allow(warnings)]
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
// aux-build:bang_proc_macro2.rs
|
||||
// ignore-stage1
|
||||
|
||||
#![feature(proc_macro)]
|
||||
#![allow(unused_macros)]
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
// aux-build:derive-b.rs
|
||||
// ignore-stage1
|
||||
|
||||
#![allow(warnings)]
|
||||
|
||||
|
|
|
|||
17
src/test/compile-fail/issue-43162.rs
Normal file
17
src/test/compile-fail/issue-43162.rs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn foo() -> bool {
|
||||
break true; //~ ERROR E0268
|
||||
}
|
||||
|
||||
fn main() {
|
||||
break {}; //~ ERROR E0268
|
||||
}
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
// ignore-tidy-linelength
|
||||
// compile-flags: -Z verbose -Z mir-emit-validate=1
|
||||
// compile-flags: -Z verbose -Z mir-emit-validate=1 -Z span_free_formats
|
||||
|
||||
struct Test(i32);
|
||||
|
||||
|
|
@ -20,16 +20,13 @@ impl Test {
|
|||
|
||||
fn main() {
|
||||
let mut x = 0;
|
||||
Test(0).foo(&mut x);
|
||||
Test(0).foo(&mut x); // just making sure we do not panic when there is a tuple struct ctor
|
||||
|
||||
// Also test closures
|
||||
let c = |x: &mut i32| { let y = &*x; *y };
|
||||
c(&mut x);
|
||||
}
|
||||
|
||||
// FIXME: Also test code generated inside the closure, make sure it has validation. Unfortunately,
|
||||
// the interesting lines of code also contain name of the source file, so we cannot test for it.
|
||||
|
||||
// END RUST SOURCE
|
||||
// START rustc.node12.EraseRegions.after.mir
|
||||
// bb0: {
|
||||
|
|
@ -57,3 +54,24 @@ fn main() {
|
|||
// }
|
||||
// }
|
||||
// END rustc.node23.EraseRegions.after.mir
|
||||
// START rustc.node50.EraseRegions.after.mir
|
||||
// fn main::{{closure}}(_1: &ReErased [closure@NodeId(50)], _2: &ReErased mut i32) -> i32 {
|
||||
// bb0: {
|
||||
// Validate(Acquire, [_1: &ReFree(DefId { krate: CrateNum(0), node: DefIndex(2147483663) => validate_1/8cd878b::main[0]::{{closure}}[0] }, "BrEnv") [closure@NodeId(50)], _2: &ReFree(DefId { krate: CrateNum(0), node: DefIndex(2147483663) => validate_1/8cd878b::main[0]::{{closure}}[0] }, BrAnon(1)) mut i32]);
|
||||
// StorageLive(_3);
|
||||
// _3 = _2;
|
||||
// StorageLive(_4);
|
||||
// Validate(Suspend(ReScope(Remainder(BlockRemainder { block: NodeId(41), first_statement_index: 0 }))), [(*_3): i32]);
|
||||
// _4 = &ReErased (*_3);
|
||||
// Validate(Acquire, [(*_4): i32/ReScope(Remainder(BlockRemainder { block: NodeId(41), first_statement_index: 0 })) (imm)]);
|
||||
// StorageLive(_5);
|
||||
// _5 = (*_4);
|
||||
// _0 = _5;
|
||||
// StorageDead(_5);
|
||||
// StorageDead(_4);
|
||||
// EndRegion(ReScope(Remainder(BlockRemainder { block: NodeId(41), first_statement_index: 0 })));
|
||||
// StorageDead(_3);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// END rustc.node50.EraseRegions.after.mir
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
// ignore-tidy-linelength
|
||||
// compile-flags: -Z verbose -Z mir-emit-validate=1
|
||||
// compile-flags: -Z verbose -Z mir-emit-validate=1 -Z span_free_formats
|
||||
|
||||
// Make sure unsafe fns and fns with an unsafe block only get restricted validation.
|
||||
|
||||
|
|
@ -45,6 +45,19 @@ fn main() {
|
|||
// }
|
||||
// }
|
||||
// END rustc.node4.EraseRegions.after.mir
|
||||
// START rustc.node22.EraseRegions.after.mir
|
||||
// fn write_42::{{closure}}(_1: &ReErased [closure@NodeId(22)], _2: *mut i32) -> () {
|
||||
// bb0: {
|
||||
// Validate(Acquire, [_1: &ReFree(DefId { krate: CrateNum(0), node: DefIndex(2147483659) => validate_4/8cd878b::write_42[0]::{{closure}}[0] }, "BrEnv") [closure@NodeId(22)], _2: *mut i32]);
|
||||
// Validate(Release, [_1: &ReFree(DefId { krate: CrateNum(0), node: DefIndex(2147483659) => validate_4/8cd878b::write_42[0]::{{closure}}[0] }, "BrEnv") [closure@NodeId(22)], _2: *mut i32]);
|
||||
// StorageLive(_3);
|
||||
// _3 = _2;
|
||||
// (*_3) = const 23i32;
|
||||
// StorageDead(_3);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// END rustc.node22.EraseRegions.after.mir
|
||||
// START rustc.node31.EraseRegions.after.mir
|
||||
// fn test(_1: &ReErased mut i32) -> () {
|
||||
// bb0: {
|
||||
|
|
@ -58,3 +71,13 @@ fn main() {
|
|||
// }
|
||||
// }
|
||||
// END rustc.node31.EraseRegions.after.mir
|
||||
// START rustc.node60.EraseRegions.after.mir
|
||||
// fn main::{{closure}}(_1: &ReErased [closure@NodeId(60)], _2: &ReErased mut i32) -> bool {
|
||||
// bb0: {
|
||||
// Validate(Acquire, [_1: &ReFree(DefId { krate: CrateNum(0), node: DefIndex(2147483663) => validate_4/8cd878b::main[0]::{{closure}}[0] }, "BrEnv") [closure@NodeId(60)], _2: &ReFree(DefId { krate: CrateNum(0), node: DefIndex(2147483663) => validate_4/8cd878b::main[0]::{{closure}}[0] }, BrAnon(1)) mut i32]);
|
||||
// Validate(Release, [_1: &ReFree(DefId { krate: CrateNum(0), node: DefIndex(2147483663) => validate_4/8cd878b::main[0]::{{closure}}[0] }, "BrEnv") [closure@NodeId(60)], _2: &ReFree(DefId { krate: CrateNum(0), node: DefIndex(2147483663) => validate_4/8cd878b::main[0]::{{closure}}[0] }, BrAnon(1)) mut i32]);
|
||||
// StorageLive(_3);
|
||||
// _0 = const write_42(_4) -> bb1;
|
||||
// }
|
||||
// }
|
||||
// END rustc.node60.EraseRegions.after.mir
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@
|
|||
// except according to those terms.
|
||||
|
||||
// ignore-tidy-linelength
|
||||
// compile-flags: -Z verbose -Z mir-emit-validate=2
|
||||
// compile-flags: -Z verbose -Z mir-emit-validate=2 -Z span_free_formats
|
||||
|
||||
// Make sure unsafe fns and fns with an unsafe block only get full validation.
|
||||
// Make sure unsafe fns and fns with an unsafe block still get full validation.
|
||||
|
||||
unsafe fn write_42(x: *mut i32) -> bool {
|
||||
*x = 42;
|
||||
|
|
@ -26,12 +26,12 @@ fn main() {
|
|||
test(&mut 0);
|
||||
|
||||
let test_closure = unsafe { |x: &mut i32| write_42(x) };
|
||||
// Note that validation will fail if this is executed: The closure keeps the lock on
|
||||
// x, so the write in write_42 fails. This test just checks code generation,
|
||||
// so the UB doesn't matter.
|
||||
test_closure(&mut 0);
|
||||
}
|
||||
|
||||
// FIXME: Also test code generated inside the closure, make sure it has validation. Unfortunately,
|
||||
// the interesting lines of code also contain name of the source file, so we cannot test for it.
|
||||
|
||||
// END RUST SOURCE
|
||||
// START rustc.node17.EraseRegions.after.mir
|
||||
// fn test(_1: &ReErased mut i32) -> () {
|
||||
|
|
@ -42,3 +42,22 @@ fn main() {
|
|||
// }
|
||||
// }
|
||||
// END rustc.node17.EraseRegions.after.mir
|
||||
// START rustc.node46.EraseRegions.after.mir
|
||||
// fn main::{{closure}}(_1: &ReErased [closure@NodeId(46)], _2: &ReErased mut i32) -> bool {
|
||||
// bb0: {
|
||||
// Validate(Acquire, [_1: &ReFree(DefId { krate: CrateNum(0), node: DefIndex(2147483660) => validate_5/8cd878b::main[0]::{{closure}}[0] }, "BrEnv") [closure@NodeId(46)], _2: &ReFree(DefId { krate: CrateNum(0), node: DefIndex(2147483660) => validate_5/8cd878b::main[0]::{{closure}}[0] }, BrAnon(1)) mut i32]);
|
||||
// StorageLive(_3);
|
||||
// _3 = _2;
|
||||
// StorageLive(_4);
|
||||
// StorageLive(_5);
|
||||
// Validate(Suspend(ReScope(Misc(NodeId(44)))), [(*_3): i32]);
|
||||
// _5 = &ReErased mut (*_3);
|
||||
// Validate(Acquire, [(*_5): i32/ReScope(Misc(NodeId(44)))]);
|
||||
// _4 = _5 as *mut i32 (Misc);
|
||||
// StorageDead(_5);
|
||||
// EndRegion(ReScope(Misc(NodeId(44))));
|
||||
// Validate(Release, [_0: bool, _4: *mut i32]);
|
||||
// _0 = const write_42(_4) -> bb1;
|
||||
// }
|
||||
// }
|
||||
// END rustc.node46.EraseRegions.after.mir
|
||||
|
|
|
|||
|
|
@ -1,6 +1,12 @@
|
|||
-include ../tools.mk
|
||||
|
||||
ifeq ($(findstring stage1,$(RUST_BUILD_STAGE)),stage1)
|
||||
# ignore stage1
|
||||
all:
|
||||
|
||||
else
|
||||
all:
|
||||
$(RUSTC) a.rs && $(RUSTC) b.rs
|
||||
$(BARE_RUSTC) c.rs -L dependency=$(TMPDIR) --extern b=$(TMPDIR)/libb.rlib \
|
||||
--out-dir=$(TMPDIR)
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,10 @@
|
|||
-include ../tools.mk
|
||||
|
||||
ifeq ($(findstring stage1,$(RUST_BUILD_STAGE)),stage1)
|
||||
# ignore stage1
|
||||
all:
|
||||
|
||||
else
|
||||
all:
|
||||
$(RUSTC) a.rs && $(RUSTC) b.rs && $(RUSTC) c.rs
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -1,5 +1,11 @@
|
|||
-include ../tools.mk
|
||||
|
||||
ifeq ($(findstring stage1,$(RUST_BUILD_STAGE)),stage1)
|
||||
# ignore stage1
|
||||
all:
|
||||
|
||||
else
|
||||
all:
|
||||
$(RUSTC) foo.rs; $(RUSTC) bar.rs
|
||||
$(RUSTDOC) baz.rs -L $(TMPDIR) -o $(TMPDIR)
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
-include ../tools.mk
|
||||
|
||||
ifeq ($(findstring stage1,$(RUST_BUILD_STAGE)),stage1)
|
||||
# ignore stage1
|
||||
all:
|
||||
|
||||
else
|
||||
# Windows doesn't correctly handle include statements with escaping paths,
|
||||
# so this test will not get run on Windows.
|
||||
ifdef IS_WINDOWS
|
||||
|
|
@ -15,3 +20,5 @@ $(TMPDIR)/libllvm-function-pass.o:
|
|||
$(TMPDIR)/libllvm-module-pass.o:
|
||||
$(CXX) $(CFLAGS) $(LLVM_CXXFLAGS) -c llvm-module-pass.so.cc -o $(TMPDIR)/libllvm-module-pass.o
|
||||
endif
|
||||
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -1,6 +1,12 @@
|
|||
-include ../tools.mk
|
||||
|
||||
ifeq ($(findstring stage1,$(RUST_BUILD_STAGE)),stage1)
|
||||
# ignore stage1
|
||||
all:
|
||||
|
||||
else
|
||||
all:
|
||||
$(RUSTC) foo.rs
|
||||
$(RUSTC) bar.rs --emit dep-info
|
||||
grep "proc-macro source" $(TMPDIR)/bar.d && exit 1 || exit 0
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
// aux-build:custom_derive_plugin.rs
|
||||
// ignore-stage1
|
||||
|
||||
#![feature(plugin, custom_derive)]
|
||||
#![plugin(custom_derive_plugin)]
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
// aux-build:add-impl.rs
|
||||
// ignore-stage1
|
||||
|
||||
#[macro_use]
|
||||
extern crate add_impl;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
// aux-build:append-impl.rs
|
||||
// ignore-stage1
|
||||
|
||||
#![allow(warnings)]
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
// aux-build:attr-args.rs
|
||||
// ignore-stage1
|
||||
|
||||
#![allow(warnings)]
|
||||
#![feature(proc_macro)]
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
// aux-build:bang-macro.rs
|
||||
// ignore-stage1
|
||||
|
||||
#![feature(proc_macro)]
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
// aux-build:count_compound_ops.rs
|
||||
// ignore-stage1
|
||||
|
||||
#![feature(proc_macro)]
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
// aux-build:double.rs
|
||||
// ignore-stage1
|
||||
|
||||
#![allow(unused)]
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
// aux-build:derive-same-struct.rs
|
||||
// ignore-stage1
|
||||
|
||||
#[macro_use]
|
||||
extern crate derive_same_struct;
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
// aux-build:hygiene_example_codegen.rs
|
||||
// aux-build:hygiene_example.rs
|
||||
// ignore-stage1
|
||||
|
||||
#![feature(proc_macro)]
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
// aux-build:issue-39889.rs
|
||||
// ignore-stage1
|
||||
|
||||
#![feature(proc_macro)]
|
||||
#![allow(unused)]
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
// aux-build:issue-40001-plugin.rs
|
||||
// ignore-stage1
|
||||
|
||||
#![feature(proc_macro, plugin)]
|
||||
#![plugin(issue_40001_plugin)]
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
// aux-build:derive-atob.rs
|
||||
// aux-build:derive-ctod.rs
|
||||
// ignore-stage1
|
||||
|
||||
#[macro_use]
|
||||
extern crate derive_atob;
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
// aux-build:derive-a.rs
|
||||
// aux-build:derive-reexport.rs
|
||||
// ignore-stage1
|
||||
|
||||
#[macro_use]
|
||||
extern crate derive_reexport;
|
||||
|
|
|
|||
|
|
@ -137,4 +137,10 @@ pub fn main() {
|
|||
panic!("from outer");
|
||||
};
|
||||
assert_eq!(break_from_while_to_outer, 567);
|
||||
|
||||
let rust = true;
|
||||
let value = loop {
|
||||
break rust;
|
||||
};
|
||||
assert!(value);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,11 @@ fn main() {
|
|||
assert!(g != h);
|
||||
assert!(g != i);
|
||||
assert!(h != i);
|
||||
|
||||
// Make sure lifetime anonymization handles nesting correctly
|
||||
let j = TypeId::of::<fn(for<'a> fn(&'a isize) -> &'a usize)>();
|
||||
let k = TypeId::of::<fn(for<'b> fn(&'b isize) -> &'b usize)>();
|
||||
assert_eq!(j, k);
|
||||
}
|
||||
// Boxed unboxed closures
|
||||
{
|
||||
|
|
|
|||
|
|
@ -107,6 +107,10 @@ fn fishy() {
|
|||
String::<>::from::<>("><>").chars::<>().rev::<>().collect::<String>());
|
||||
}
|
||||
|
||||
fn union() {
|
||||
union union<'union> { union: &'union union<'union>, }
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
strange();
|
||||
funny();
|
||||
|
|
@ -119,4 +123,5 @@ pub fn main() {
|
|||
dots();
|
||||
you_eight();
|
||||
fishy();
|
||||
union();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue