Workaround rust-lang/rust#49855 by forcing rustc_error in any mode, including NLL.

NOTE: I was careful to make each change in a manner that preserves the
existing diagnostic output (usually by ensuring that no lines were
added or removed). This means that the resulting source files are not
as nice to read as they were at the start. But we will have to review
these cases by hand anyway as follow-up work, so cleanup could
reasonably happen then (or not at all).
This commit is contained in:
Felix S. Klock II 2018-04-11 00:20:05 +02:00
parent ae05961fdf
commit 1c8d2bdda1
27 changed files with 54 additions and 54 deletions

View File

@ -7,9 +7,9 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
#![allow(dead_code)]
fn main() {
fn main() { #![rustc_error] // rust-lang/rust#49855
// Original borrow ends at end of function
let mut x = 1;
let y = &mut x;

View File

@ -9,8 +9,8 @@
// except according to those terms.
// ensure borrowck messages are correct outside special case
fn main() {
#![feature(rustc_attrs)]
fn main() { #![rustc_error] // rust-lang/rust#49855
let mut void = ();
let first = &mut void;

View File

@ -93,8 +93,8 @@
fn main() {
#![feature(rustc_attrs)]
fn main() { #![rustc_error] // rust-lang/rust#49855
let mut x = "foo";
let y = &mut x;
let z = &mut x; //~ ERROR cannot borrow

View File

@ -19,12 +19,12 @@
//
// See also dropck-eyepatch.rs for more information about the general
// structure of the test.
#![feature(rustc_attrs)]
extern crate dropck_eyepatch_extern_crate as other;
use other::{Dt,Dr,Pt,Pr,St,Sr};
fn main() {
fn main() { #![rustc_error] // rust-lang/rust#49855
use std::cell::Cell;
let c_long;
let (c, mut dt, mut dr, mut pt, mut pr, st, sr)

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(dropck_eyepatch)]
#![feature(dropck_eyepatch, rustc_attrs)]
// The point of this test is to test uses of `#[may_dangle]` attribute
// where the formal declaration order (in the impl generics) does not
@ -41,7 +41,7 @@ unsafe impl<'b, #[may_dangle] 'a, B: fmt::Debug> Drop for Pr<'a, 'b, B> {
fn drop(&mut self) { println!("drop {} {:?}", self.0, self.2); }
}
fn main() {
fn main() { #![rustc_error] // rust-lang/rust#49855
use std::cell::Cell;
let c_long;
let (c, mut dt, mut dr, mut pt, mut pr, st, sr)

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(dropck_eyepatch)]
#![feature(dropck_eyepatch, rustc_attrs)]
// The point of this test is to illustrate that the `#[may_dangle]`
// attribute specifically allows, in the context of a type
@ -64,7 +64,7 @@ unsafe impl<#[may_dangle] 'a, 'b, B: fmt::Debug> Drop for Pr<'a, 'b, B> {
fn drop(&mut self) { println!("drop {} {:?}", self.0, self.2); }
}
fn main() {
fn main() { #![rustc_error] // rust-lang/rust#49855
use std::cell::Cell;
let c_long;
let (c, mut dt, mut dr, mut pt, mut pr, st, sr)

View File

@ -7,8 +7,8 @@
// <LICENSE-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 main() {
#![feature(rustc_attrs)]
fn main() { #![rustc_error] // rust-lang/rust#49855
let mut i = 0;
let mut x = &mut i;
let mut a = &mut i; //~ ERROR E0499

View File

@ -7,12 +7,12 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
fn bar(x: &mut i32) {}
fn foo(a: &mut i32) {
let ref y = a;
bar(a); //~ ERROR E0502
}
fn main() {
fn main() { #![rustc_error] // rust-lang/rust#49855
}

View File

@ -7,8 +7,8 @@
// <LICENSE-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 main() {
#![feature(rustc_attrs)]
fn main() { #![rustc_error] // rust-lang/rust#49855
let mut value = 3;
let _borrow = &mut value;
let _sum = value + 1; //~ ERROR E0503

View File

@ -7,12 +7,12 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
struct Value {}
fn eat(val: Value) {}
fn main() {
fn main() { #![rustc_error] // rust-lang/rust#49855
let x = Value{};
{
let _ref_to_val: &Value = &x;

View File

@ -7,12 +7,12 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
struct Foo<'a> {
x: Option<&'a u32>,
}
fn main() {
fn main() { #![rustc_error] // rust-lang/rust#49855
let mut x = Foo { x: None };
let y = 0;
x.x = Some(&y);

View File

@ -7,10 +7,10 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
#![allow(dead_code)]
fn main() {
fn main() { #![rustc_error] // rust-lang/rust#49855
let mut x = 33;
let p = &x;

View File

@ -8,11 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(generators, generator_trait)]
#![feature(generators, generator_trait, rustc_attrs)]
use std::ops::Generator;
fn main() {
fn main() { #![rustc_error] // rust-lang/rust#49855
let _b = {
let a = 3;
unsafe { (|| yield &a).resume() }

View File

@ -8,12 +8,12 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(generators, generator_trait, box_leak)]
#![feature(generators, generator_trait, box_leak, rustc_attrs)]
use std::cell::RefCell;
use std::ops::Generator;
fn main() {
fn main() { #![rustc_error] // rust-lang/rust#49855
let (cell, mut gen);
cell = Box::new(RefCell::new(0));
let ref_ = Box::leak(Box::new(Some(cell.borrow_mut())));

View File

@ -8,11 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(generators)]
#![feature(generators, rustc_attrs)]
enum Test { A(i32), B, }
fn main() { }
fn main() { #![rustc_error] } // rust-lang/rust#49855
fn fun(test: Test) {
move || {

View File

@ -8,11 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(box_syntax)]
#![feature(box_syntax, rustc_attrs)]
struct Foo { a: isize, b: isize }
fn main() {
fn main() { #![rustc_error] // rust-lang/rust#49855
let mut x: Box<_> = box Foo { a: 1, b: 2 };
let (a, b) = (&mut x.a, &mut x.b);
//~^ ERROR cannot borrow `x` (via `x.b`) as mutable more than once at a time

View File

@ -7,7 +7,7 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
macro_rules! width(
($this:expr) => {
$this.width.unwrap()
@ -29,4 +29,4 @@ impl HasInfo {
}
}
fn main() {}
fn main() { #![rustc_error] } // rust-lang/rust#49855

View File

@ -7,10 +7,10 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
fn do_something<T>(collection: &mut Vec<T>) {
let _a = &collection;
collection.swap(1, 2); //~ ERROR also borrowed as immutable
}
fn main() {}
fn main() { #![rustc_error] } // rust-lang/rust#49855

View File

@ -7,11 +7,11 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
fn f() {
let x = vec![1].iter();
}
fn main() {
fn main() { #![rustc_error] // rust-lang/rust#49855
f();
}

View File

@ -7,7 +7,7 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
fn id<T>(x: T) -> T { x }
fn f() {
@ -58,6 +58,6 @@ fn f() {
//~| NOTE temporary value needs to live until here
//~| NOTE temporary value needs to live until here
fn main() {
fn main() { #![rustc_error] // rust-lang/rust#49855
f();
}

View File

@ -7,8 +7,8 @@
// <LICENSE-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 main() {
#![feature(rustc_attrs)]
fn main() { #![rustc_error] // rust-lang/rust#49855
let p;
let a = 42;
p = &a;

View File

@ -7,10 +7,10 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
use std::cell::RefCell;
fn main() {
fn main() { #![rustc_error] // rust-lang/rust#49855
let m = RefCell::new(0);
let p;
{

View File

@ -9,8 +9,8 @@
// except according to those terms.
// Test range syntax - borrow errors.
pub fn main() {
#![feature(rustc_attrs)]
pub fn main() { #![rustc_error] // rust-lang/rust#49855
let r = {
let a = 42;
let b = 42;

View File

@ -7,10 +7,10 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
use std::ops::FnMut;
fn main() {
fn main() { #![rustc_error] // rust-lang/rust#49855
let mut f;
{
let c = 1;

View File

@ -7,10 +7,10 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(rustc_attrs)]
// Test slicing expressions doesn't defeat the borrow checker.
fn main() {
fn main() { #![rustc_error] // rust-lang/rust#49855
let y;
{
let x: &[isize] = &vec![1, 2, 3, 4, 5];

View File

@ -17,8 +17,8 @@
// element it owns; thus, for data like this, it seems like we could
// loosen the restrictions here if we wanted. But it also is not
// clear whether such loosening is terribly important.)
fn main() {
#![feature(rustc_attrs)]
fn main() { #![rustc_error] // rust-lang/rust#49855
let mut v = Vec::new();
let x: i8 = 3;

View File

@ -11,7 +11,7 @@
// A method's receiver must be well-formed, even if it has late-bound regions.
// Because of this, a method's substs being well-formed does not imply that
// the method's implied bounds are met.
#![feature(rustc_attrs)]
struct Foo<'b>(Option<&'b ()>);
trait Bar<'b> {
@ -22,7 +22,7 @@ impl<'b> Bar<'b> for Foo<'b> {
fn xmute<'a>(&'a self, u: &'b u32) -> &'a u32 { u }
}
fn main() {
fn main() { #![rustc_error] // rust-lang/rust#49855
let f = Foo(None);
let f2 = f;
let dangling = {