+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn f() -> isize {
- (return 1, return 2)
-//~^ ERROR mismatched types
-//~| expected type `isize`
-//~| found type `(!, !)`
-//~| expected isize, found tuple
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Foo(bool);
-fn foo(_: usize) -> Foo { Foo(false) }
-
-fn main() {
- match Foo(true) {
- foo(x) //~ ERROR expected tuple struct/variant, found function `foo`
- => ()
- }
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn test<'x>(x: &'x isize) {
- drop::<Box<for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| {
- x //~ ERROR E0312
- }));
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(box_syntax)]
-
-fn main() {
- let x: Box<_> = box 1;
- let f = move|| {
- let _a = x;
- drop(x);
- //~^ ERROR: use of moved value: `x`
- };
- f();
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- let mut a = "a";
- a += { "b" };
- //~^ ERROR: binary assignment operation `+=` cannot be applied
-}
+++ /dev/null
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Serializable<'self, T> { //~ ERROR lifetimes cannot use keyword names
- fn serialize(val : &'self T) -> Vec<u8>; //~ ERROR lifetimes cannot use keyword names
- fn deserialize(repr : &[u8]) -> &'self T; //~ ERROR lifetimes cannot use keyword names
-}
-
-impl<'self> Serializable<str> for &'self str { //~ ERROR lifetimes cannot use keyword names
- //~^ ERROR lifetimes cannot use keyword names
- //~| ERROR missing lifetime specifier
- fn serialize(val : &'self str) -> Vec<u8> { //~ ERROR lifetimes cannot use keyword names
- vec![1]
- }
- fn deserialize(repr: &[u8]) -> &'self str { //~ ERROR lifetimes cannot use keyword names
- "hi"
- }
-}
-
-fn main() {
- println!("hello");
- let x = "foo".to_string();
- let y = x;
- println!("{}", y);
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub mod a {
- pub trait A {
- fn foo(&self);
- }
-
-}
-pub mod b {
- use a::A;
-
- pub struct B;
- impl A for B { fn foo(&self) {} }
-
- pub mod c {
- use b::B;
-
- fn foo(b: &B) {
- b.foo(); //~ ERROR: no method named `foo` found
- }
- }
-
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// We only want to assert that this doesn't ICE, we don't particularly care
-// about whether it nor it fails to compile.
-
-// error-pattern:
-
-macro_rules! foo{
- () => {{
- macro_rules! bar{() => (())}
- 1
- }}
-}
-
-pub fn main() {
- foo!();
-
- assert!({one! two()});
-
- // regardless of whether nested macro_rules works, the following should at
- // least throw a conventional error.
- assert!({one! two});
-}
+++ /dev/null
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-
-mod a {
- struct S;
- impl S { }
-}
-
-fn foo(_: a::S) { //~ ERROR: struct `S` is private
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// error-pattern: missing documentation for crate
-
-#![deny(missing_docs)]
-#![crate_type="lib"]
+++ /dev/null
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// compile-flags: -C linker=llllll -Z linker-flavor=ld
-// error-pattern: linker `llllll` not found
-
-fn main() {
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn f(_: extern "Rust" fn()) {}
-extern fn bar() {}
-
-fn main() { f(bar) }
-//~^ ERROR mismatched types
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Foo { x: isize }
-extern {
- fn foo(1: ());
- //~^ ERROR: patterns aren't allowed in foreign function declarations
- fn bar((): isize);
- //~^ ERROR: patterns aren't allowed in foreign function declarations
- fn baz(Foo { x }: isize);
- //~^ ERROR: patterns aren't allowed in foreign function declarations
- fn qux((x,y): ());
- //~^ ERROR: patterns aren't allowed in foreign function declarations
- fn this_is_actually_ok(a: usize);
- fn and_so_is_this(_: usize);
-}
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- let nil = ();
- let _t = nil as usize; //~ ERROR: non-primitive cast: `()` as `usize`
-}
+++ /dev/null
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// compile-flags: -C lto -C prefer-dynamic
-
-// error-pattern: cannot prefer dynamic linking
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(box_syntax)]
-
-struct Foo {
- x: isize
-}
-
-impl Drop for Foo {
- fn drop(&mut self) {
- println!("drop {}", self.x);
- }
-}
-
-fn main() {
- let mut ptr: Box<_> = box Foo { x: 0 };
- let mut test = |foo: &Foo| {
- println!("access {}", foo.x);
- ptr = box Foo { x: ptr.x + 1 };
- println!("access {}", foo.x);
- };
- test(&*ptr);
- //~^ ERROR: cannot borrow `*ptr` as immutable
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use std::io::{self, Read};
-use std::vec;
-
-pub struct Container<'a> {
- reader: &'a mut Read
-}
-
-impl<'a> Container<'a> {
- pub fn wrap<'s>(reader: &'s mut io::Read) -> Container<'s> {
- Container { reader: reader }
- }
-
- pub fn read_to(&mut self, vec: &mut [u8]) {
- self.reader.read(vec);
- }
-}
-
-pub fn for_stdin<'a>() -> Container<'a> {
- let mut r = io::stdin();
- Container::wrap(&mut r as &mut io::Read)
-}
-
-fn main() {
- let mut c = for_stdin();
- let mut v = Vec::new();
- c.read_to(v); //~ ERROR E0308
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// This file must never have a trailing newline
-
-fn id<T>(x: T) -> T { x }
-
-fn main() {
- let x = Some(3);
- let y = x.as_ref().unwrap_or(&id(5)); //~ ERROR: borrowed value does not live long enough
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(box_syntax)]
-
-struct Test {
- func: Box<FnMut()+'static>
-}
-
-fn main() {
- let closure: Box<Fn()+'static> = Box::new(|| ());
- let test = box Test { func: closure }; //~ ERROR mismatched types
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// This tests verifies that unary structs and enum variants
-// are treated as rvalues and their lifetime is not bounded to
-// the static scope.
-
-struct Test;
-
-impl Drop for Test {
- fn drop (&mut self) {}
-}
-
-fn createTest<'a>() -> &'a Test {
- let testValue = &Test; //~ ERROR borrowed value does not live long enough
- return testValue;
-}
-
-
-pub fn main() {
- createTest();
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- print!(test!());
- //~^ ERROR: format argument must be a string literal
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- concat!(test!());
- //~^ ERROR cannot find macro `test!` in this scope
-}
+++ /dev/null
-// 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.
-
-#![feature(rustc_attrs)]
-#![allow(warnings)]
-
-struct Attr {
- name: String,
- value: String,
-}
-
-struct Element {
- attrs: Vec<Box<Attr>>,
-}
-
-impl Element {
- pub unsafe fn get_attr<'a>(&'a self, name: &str) {
- self.attrs
- .iter()
- .find(|attr| {
- let attr: &&Box<Attr> = std::mem::transmute(attr);
- true
- });
- }
-}
-
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
- let element = Element { attrs: Vec::new() };
- let _ = unsafe { element.get_attr("foo") };
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- let x = ();
- 1 +
- x //~^ ERROR E0277
- ;
-
- let x: () = ();
- 1 +
- x //~^ ERROR E0277
- ;
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(box_syntax)]
-
-fn main() {
- let a = Some(box 1);
- match a {
- Ok(a) => //~ ERROR: mismatched types
- println!("{}",a),
- None => panic!()
- }
-}
+++ /dev/null
-// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- let mut v = vec![1];
- let mut f = || v.push(2);
- let _w = v; //~ ERROR: cannot move out of `v`
-
- f();
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Test an example where we fail to infer the type parameter H. This
-// is because there is really nothing constraining it. At one time, we
-// would infer based on the where clauses in scope, but that no longer
-// works.
-
-trait Hash<H> {
- fn hash2(&self, hasher: &H) -> u64;
-}
-
-trait Stream {
- fn input(&mut self, bytes: &[u8]);
- fn result(&self) -> u64;
-}
-
-trait StreamHasher {
- type S : Stream;
- fn stream(&self) -> Self::S;
-}
-
-//////////////////////////////////////////////////////////////////////////////
-
-trait StreamHash<H: StreamHasher>: Hash<H> {
- fn input_stream(&self, stream: &mut H::S);
-}
-
-impl<H: StreamHasher> Hash<H> for u8 {
- fn hash2(&self, hasher: &H) -> u64 {
- let mut stream = hasher.stream();
- self.input_stream(&mut stream); //~ ERROR type annotations required
- Stream::result(&stream)
- }
-}
-
-impl<H: StreamHasher> StreamHash<H> for u8 {
- fn input_stream(&self, stream: &mut H::S) {
- Stream::input(stream, &[*self]);
- }
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use std::sync::mpsc::channel;
-use std::thread;
-
-fn main() {
- let (tx, rx) = channel();
- let _t = thread::spawn(move|| -> () {
- loop {
- let tx = tx;
- //~^ ERROR: use of moved value: `tx`
- tx.send(1);
- }
- });
-}
+++ /dev/null
-// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(box_patterns)]
-#![feature(box_syntax)]
-#![allow(dead_code)]
-#![allow(unused_variables)]
-#![deny(unreachable_patterns)]
-
-enum IntList {
- Cons(isize, Box<IntList>),
- Nil
-}
-
-fn tail(source_list: &IntList) -> IntList {
- match source_list {
- &IntList::Cons(val, box ref next_list) => tail(next_list),
- &IntList::Cons(val, box IntList::Nil) => IntList::Cons(val, box IntList::Nil),
-//~^ ERROR unreachable pattern
- _ => panic!()
- }
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(box_syntax, unboxed_closures)]
-
-fn to_fn_once<A,F:FnOnce<A>>(f: F) -> F { f }
-fn do_it(x: &isize) { }
-
-fn main() {
- let x: Box<_> = box 22;
- let f = to_fn_once(move|| do_it(&*x));
- to_fn_once(move|| {
- f();
- f();
- //~^ ERROR: use of moved value: `f`
- })()
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(slice_patterns)]
-#![deny(unreachable_patterns)]
-
-fn main() {
- let sl = vec![1,2,3];
- let v: isize = match &*sl {
- &[] => 0,
- &[a,b,c] => 3,
- &[a, ref rest..] => a,
- &[10,a, ref rest..] => 10 //~ ERROR: unreachable pattern
- };
-}
+++ /dev/null
-// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(box_syntax)]
-
-trait X {
- fn get_i(&self) -> isize;
-}
-
-
-struct B {
- i: isize
-}
-
-impl X for B {
- fn get_i(&self) -> isize {
- self.i
- }
-}
-
-struct A<'a> {
- p: &'a (X+'a)
-}
-
-fn make_a<'a>(p: &'a X) -> A<'a> {
- A { p: p }
-}
-
-fn make_make_a<'a>() -> A<'a> {
- let b: Box<B> = box B {i:1};
- let bb: &B = &*b; //~ ERROR does not live long enough
- make_a(bb)
-}
-
-fn main() {
- let _a = make_make_a();
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// this code used to cause an ICE
-
-fn main() {
- let t = Err(0);
- match t {
- Some(k) => match k { //~ ERROR mismatched types
- a => println!("{}", a)
- },
- None => () //~ ERROR mismatched types
- }
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(slice_patterns)]
-
-fn match_vecs<'a, T>(l1: &'a [T], l2: &'a [T]) {
- match (l1, l2) {
- (&[], &[]) => println!("both empty"),
- (&[], &[hd, ..]) | (&[hd, ..], &[])
- => println!("one empty"),
- //~^^ ERROR: cannot move out of type `[T]`, a non-copy slice
- //~^^^ ERROR: cannot move out of type `[T]`, a non-copy slice
- (&[hd1, ..], &[hd2, ..])
- => println!("both nonempty"),
- //~^^ ERROR: cannot move out of type `[T]`, a non-copy slice
- //~^^^ ERROR: cannot move out of type `[T]`, a non-copy slice
- }
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Trait {
- fn outer(&self) {
- fn inner(_: &Self) {
- //~^ ERROR can't use type parameters from outer function
- }
- }
-}
-
-fn main() { }
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-mod foo { pub fn bar() {} }
-
-fn main() {
- match () {
- foo::bar => {} //~ ERROR expected unit struct/variant or constant, found function `foo::bar`
- }
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// compile-flags: --test
-
-//! Test that makes sure wrongly-typed bench functions aren't ignored
-
-#[bench]
-fn foo() { } //~ ERROR functions used as benches
-
-#[bench]
-fn bar(x: isize, y: isize) { } //~ ERROR functions used as benches
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// compile-flags: --test
-
-//! Test that makes sure wrongly-typed bench functions are rejected
-
-#[bench]
-fn bar(x: isize) { }
-//~^ ERROR mismatched types
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Foo {
- fn bar(&mut self, other: &mut Foo);
-}
-
-struct Baz;
-
-impl Foo for Baz {
- fn bar(&mut self, other: &Foo) {}
- //~^ ERROR method `bar` has an incompatible type for trait
- //~| expected type `fn(&mut Baz, &mut dyn Foo)`
- //~| found type `fn(&mut Baz, &dyn Foo)`
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-cloudabi no std::process
-
-fn foo(_: Box<FnMut()>) {}
-
-fn main() {
- foo(loop {
- std::process::exit(0);
- });
- 2_usize + (loop {});
- //~^ ERROR E0277
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn foo(_s: i16) { }
-
-fn bar(_s: u32) { }
-
-fn main() {
- foo(1*(1 as isize));
- //~^ ERROR mismatched types
- //~| expected i16, found isize
-
- bar(1*(1 as usize));
- //~^ ERROR mismatched types
- //~| expected u32, found usize
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use a::f;
-use b::f; //~ ERROR: unresolved import `b::f` [E0432]
- //~^ no `f` in `b`
-
-mod a { pub fn f() {} }
-mod b { }
-
-fn main() {
- f();
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-mod A {
- struct C;
-}
-
-fn main() {
- A::C = 1;
- //~^ ERROR: invalid left-hand side expression
- //~| ERROR: mismatched types
- //~| ERROR: struct `C` is private
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-
-// Used to cause ICE
-
-// error-pattern: mismatched types
-
-static VEC: [u32; 256] = vec![];
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Regression test for #13466
-
-pub fn main() {
- // The expected arm type `Option<T>` has one type parameter, while
- // the actual arm `Result<T, E>` has two. typeck should not be
- // tricked into looking up a non-existing second type parameter.
- let _x: usize = match Some(1) {
- Ok(u) => u,
- //~^ ERROR mismatched types
- //~| expected type `std::option::Option<{integer}>`
- //~| found type `std::result::Result<_, _>`
- //~| expected enum `std::option::Option`, found enum `std::result::Result`
-
- Err(e) => panic!(e)
- //~^ ERROR mismatched types
- //~| expected type `std::option::Option<{integer}>`
- //~| found type `std::result::Result<_, _>`
- //~| expected enum `std::option::Option`, found enum `std::result::Result`
- };
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// compile-flags:-Z verbose
-
-fn main() {
- let x = [1,2];
- let y = match x {
- [] => None, //~ ERROR pattern requires 0 elements but array has 2
- [a,_] => Some(a)
- };
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- let x = [1,2];
- let y = match x {
- [] => None, //~ ERROR pattern requires 0 elements but array has 2
- [a,_] => Some(a)
- };
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn read_lines_borrowed<'a>() -> Vec<&'a str> {
- let rawLines: Vec<String> = vec!["foo ".to_string(), " bar".to_string()];
- rawLines //~ ERROR `rawLines` does not live long enough
- .iter().map(|l| l.trim()).collect()
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn read_lines_borrowed1() -> Vec<
- &str //~ ERROR missing lifetime specifier
-> {
- let rawLines: Vec<String> = vec!["foo ".to_string(), " bar".to_string()];
- rawLines.iter().map(|l| l.trim()).collect()
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Regression test for issue #1362 - without that fix the span will be bogus
-// no-reformat
-fn main() {
- let x: u32 = 20i32; //~ ERROR mismatched types
-}
-// NOTE: Do not add any extra lines as the line number the error is
-// on is significant; an error later in the source file might not
-// trigger the bug.
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-mod a {
- struct Foo;
- impl Foo { pub fn new() {} }
- enum Bar {}
- impl Bar { pub fn new() {} }
-}
-
-fn main() {
- a::Foo::new();
- //~^ ERROR: struct `Foo` is private
- a::Bar::new();
- //~^ ERROR: enum `Bar` is private
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![allow(overflowing_literals)]
-#![deny(unreachable_patterns)]
-
-fn test(val: u8) {
- match val {
- 256 => print!("0b1110\n"),
- 512 => print!("0b1111\n"),
- //~^ ERROR: unreachable pattern
- _ => print!("fail\n"),
- }
-}
-
-fn main() {
- test(1);
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- return.is_failure //~ ERROR no field `is_failure` on type `!`
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait FromStructReader<'a> { }
-trait ResponseHook {
- fn get(&self);
-}
-fn foo(res : Box<ResponseHook>) { res.get } //~ ERROR attempted to take value of method
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Deserializer<'a> { }
-
-trait Deserializable {
- fn deserialize_token<'a, D: Deserializer<'a>>(_: D, _: &'a str) -> Self;
-}
-
-impl<'a, T: Deserializable> Deserializable for &'a str {
- //~^ ERROR type parameter `T` is not constrained
- fn deserialize_token<D: Deserializer<'a>>(_x: D, _y: &'a str) -> &'a str {
- }
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Node {
- fn zomg();
-}
-
-trait Graph<N: Node> {
- fn nodes<'a, I: Iterator<Item=&'a N>>(&'a self) -> I
- where N: 'a;
-}
-
-impl<N: Node> Graph<N> for Vec<N> {
- fn nodes<'a, I: Iterator<Item=&'a N>>(&self) -> I
- where N: 'a
- {
- self.iter() //~ ERROR mismatched types
- }
-}
-
-struct Stuff;
-
-impl Node for Stuff {
- fn zomg() {
- println!("zomg");
- }
-}
-
-fn iterate<N: Node, G: Graph<N>>(graph: &G) {
- for node in graph.iter() { //~ ERROR no method named `iter` found
- node.zomg();
- }
-}
-
-pub fn main() {
- let graph = Vec::new();
-
- graph.push(Stuff);
-
- iterate(graph); //~ ERROR mismatched types
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// error-pattern: cannot apply unary operator `!` to type `BytePos`
-
-// Very
-
-// sensitive
-pub struct BytePos(pub u32);
-
-// to particular
-
-// line numberings / offsets
-
-fn main() {
- let x = BytePos(1);
-
- assert!(x, x);
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// error-pattern:mismatched types
-
-fn main(){assert!(1,1);}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![deny(unreachable_patterns)]
-#![allow(unused_variables)]
-#![allow(non_snake_case)]
-
-pub enum E {
- A,
- B,
-}
-
-pub mod b {
- pub fn key(e: ::E) -> &'static str {
- match e {
- A => "A",
-//~^ WARN pattern binding `A` is named the same as one of the variants of the type `E`
- B => "B", //~ ERROR: unreachable pattern
-//~^ WARN pattern binding `B` is named the same as one of the variants of the type `E`
- }
- }
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![allow(safe_extern_statics, warnings)]
-
-extern {
- pub static symbol: ();
-}
-static CRASH: () = symbol;
-//~^ ERROR could not evaluate static initializer
-//~| tried to read from foreign (extern) static
-
-fn main() {}
+++ /dev/null
-// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Foo {
- fn dummy(&self) { }
-}
-
-struct A;
-
-impl Foo for A {}
-
-struct B<'a>(&'a (Foo+'a));
-
-fn foo<'a>(a: &Foo) -> B<'a> {
- B(a) //~ ERROR 22:5: 22:9: explicit lifetime required in the type of `a` [E0621]
-}
-
-fn main() {
- let _test = foo(&A);
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![deny(improper_ctypes)]
-#![allow(dead_code)]
-
-struct A {
- x: i32
-}
-
-#[repr(C, packed)]
-struct B {
- x: i32,
- y: A
-}
-
-#[repr(C)]
-struct C {
- x: i32
-}
-
-type A2 = A;
-type B2 = B;
-type C2 = C;
-
-#[repr(C)]
-struct D {
- x: C,
- y: A
-}
-
-extern "C" {
- fn foo(x: A); //~ ERROR type `A` which is not FFI-safe
- fn bar(x: B); //~ ERROR type `A`
- fn baz(x: C);
- fn qux(x: A2); //~ ERROR type `A`
- fn quux(x: B2); //~ ERROR type `A`
- fn corge(x: C2);
- fn fred(x: D); //~ ERROR type `A`
-}
-
-fn main() { }
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- let _x = "test" as &::std::any::Any;
- //~^ ERROR the size for values of type
-}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Regression test for issue #1448 and #1386
-
-fn foo(a: u32) -> u32 { a }
-
-fn main() {
- println!("{}", foo(10i32)); //~ ERROR mismatched types
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct vec2 { y: f32 }
-struct vec3 { y: f32, z: f32 }
-
-fn make(v: vec2) {
- let vec3 { y: _, z: _ } = v;
- //~^ ERROR mismatched types
- //~| expected type `vec2`
- //~| found type `vec3`
- //~| expected struct `vec2`, found struct `vec3`
-}
-
-fn main() { }
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- let foo = "str";
- println!("{}", foo.desc); //~ no field `desc` on type `&str`
-}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- println!("{}", x); //~ ERROR cannot find value `x` in this scope
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// compile-flags: --test
-
-#[test]
-mod foo {} //~ ERROR only functions may be used as tests
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-
-struct X {
- a: [u8; 1]
-}
-
-fn main() {
- let x = X { a: [0] };
- let _f = &x.a as *mut u8; //~ ERROR casting
-
- let local: [u8; 1] = [0];
- let _v = &local as *mut u8; //~ ERROR casting
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use std::fmt::Debug;
-
-trait Str {}
-
-trait Something: Sized {
- fn yay<T: Debug>(_: Option<Self>, thing: &[T]);
-}
-
-struct X { data: u32 }
-
-impl Something for X {
- fn yay<T: Str>(_:Option<X>, thing: &[T]) {
- //~^ ERROR E0276
- }
-}
-
-fn main() {
- let arr = &["one", "two", "three"];
- println!("{:?}", Something::yay(None::<X>, arr));
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(box_syntax)]
-
-fn main() {
- let x: Box<isize> = box 0;
-
- println!("{}", x + 1);
- //~^ ERROR binary operation `+` cannot be applied to type `std::boxed::Box<isize>`
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub struct Lexer<'a> {
- input: &'a str,
-}
-
-impl<'a> Lexer<'a> {
- pub fn new(input: &'a str) -> Lexer<'a> {
- Lexer { input: input }
- }
-}
-
-struct Parser<'a> {
- lexer: &'a mut Lexer<'a>,
-}
-
-impl<'a> Parser<'a> {
- pub fn new(lexer: &'a mut Lexer) -> Parser<'a> {
- Parser { lexer: lexer }
- //~^ ERROR 27:25: 27:30: explicit lifetime required in the type of `lexer` [E0621]
- }
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(fn_traits, unboxed_closures)]
-
-use std::{fmt, ops};
-
-struct Debuger<T> {
- x: T
-}
-
-impl<T: fmt::Debug> ops::FnOnce<(),> for Debuger<T> {
- type Output = ();
- fn call_once(self, _args: ()) {
- //~^ ERROR `call_once` has an incompatible type for trait
- //~| expected type `extern "rust-call" fn
- //~| found type `fn
- println!("{:?}", self.x);
- }
-}
-
-fn make_shower<T>(x: T) -> Debuger<T> {
- Debuger { x: x }
-}
-
-pub fn main() {
- let show3 = make_shower(3);
- show3();
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub enum T {
- T1(()),
- T2(())
-}
-
-pub enum V {
- V1(isize),
- V2(bool)
-}
-
-fn main() {
- match (T::T1(()), V::V2(true)) {
- //~^ ERROR non-exhaustive patterns: `(T1(()), V2(_))` not covered
- (T::T1(()), V::V1(i)) => (),
- (T::T2(()), V::V2(b)) => ()
- }
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// macro f should not be able to inject a reference to 'n'.
-
-macro_rules! f { () => (n) }
-//~^ ERROR cannot find value `n` in this scope
-//~| ERROR cannot find value `n` in this scope
-//~| ERROR cannot find value `n` in this scope
-//~| ERROR cannot find value `n` in this scope
-
-fn main() -> (){
- for n in 0..1 {
- println!("{}", f!());
- }
-
- if let Some(n) = None {
- println!("{}", f!());
- }
-
- if false {
- } else if let Some(n) = None {
- println!("{}", f!());
- }
-
- while let Some(n) = None {
- println!("{}", f!());
- }
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- loop {
- break.push(1) //~ ERROR no method named `push` found for type `!`
- ;
- }
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- let values: Vec<u8> = vec![1,2,3,4,5,6,7,8];
-
- for &[x,y,z] in values.chunks(3).filter(|&xs| xs.len() == 3) {
- //~^ ERROR refutable pattern in `for` loop binding: `&[]` not covered
- println!("y={}", y);
- }
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use std::slice::Chunks;
-use std::slice::ChunksMut;
-
-fn dft_iter<'a, T>(arg1: Chunks<'a,T>, arg2: ChunksMut<'a,T>)
-{
- for
- &mut something
- //~^ ERROR the size for values of type
- in arg2
- {
- }
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub fn foo(params: Option<&[&str]>) -> usize {
- params.unwrap().first().unwrap().len()
-}
-
-fn main() {
- let name = "Foo";
- let x = Some(&[name]);
- let msg = foo(x);
-//~^ ERROR mismatched types
-//~| expected type `std::option::Option<&[&str]>`
-//~| found type `std::option::Option<&[&str; 1]>`
-//~| expected slice, found array of 1 elements
- assert_eq!(msg, 3);
-}
+++ /dev/null
-// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Regression test for #15896. It used to ICE rustc.
-
-fn main() {
- enum R { REB(()) }
- struct Tau { t: usize }
- enum E { B(R, Tau) }
-
- let e = E::B(R::REB(()), Tau { t: 3 });
- let u = match e {
- E::B(
- Tau{t: x},
- //~^ ERROR mismatched types
- //~| expected type `main::R`
- //~| found type `main::Tau`
- //~| expected enum `main::R`, found struct `main::Tau`
- _) => x,
- };
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// error-pattern: too big for the current architecture
-
-#[cfg(target_pointer_width = "32")]
-fn main() {
- let x = [0usize; 0xffff_ffff];
-}
-
-#[cfg(target_pointer_width = "64")]
-fn main() {
- let x = [0usize; 0xffff_ffff_ffff_ffff];
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- return
- { return () }
-//~^ ERROR type annotations needed [E0282]
- ()
- ;
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait NoLifetime {
- fn get<'p, T : Test<'p>>(&self) -> T;
- //~^ NOTE lifetimes in impl do not match this method in trait
-}
-
-trait Test<'p> {
- fn new(buf: &'p mut [u8]) -> Self;
-}
-
-struct Foo<'a> {
- buf: &'a mut [u8],
-}
-
-impl<'a> Test<'a> for Foo<'a> {
- fn new(buf: &'a mut [u8]) -> Foo<'a> {
- Foo { buf: buf }
- }
-}
-
-impl<'a> NoLifetime for Foo<'a> {
- fn get<'p, T : Test<'a>>(&self) -> T {
- //~^ ERROR E0195
- //~| NOTE lifetimes do not match method in trait
- return *self as T;
- }
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-macro_rules! prob1 {
- (0) => {
- 0
- };
- ($n:expr) => {
- if ($n % 3 == 0) || ($n % 5 == 0) {
- $n + prob1!($n - 1); //~ ERROR recursion limit reached while expanding the macro `prob1`
- } else {
- prob1!($n - 1);
- }
- };
-}
-
-fn main() {
- println!("Problem 1: {}", prob1!(1000));
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-extern {
- static externalValue: isize;
-}
-
-fn main() {
- let boolValue = match 42 {
- externalValue => true,
- //~^ ERROR match bindings cannot shadow statics
- _ => false
- };
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![deny(warnings)]
-
-pub struct Foo;
-
-extern {
- pub fn foo(x: (Foo)); //~ ERROR unspecified layout
-}
-
-fn main() {
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Slice<T> {
- data: *const T,
- len: usize,
-}
-
-fn main() {
- let Slice { data: data, len: len } = "foo";
- //~^ ERROR mismatched types
- //~| found type `Slice<_>`
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Slice<T> {
- data: *const T,
- len: usize,
-}
-
-fn main() {
- match () {
- Slice { data: data, len: len } => (),
- //~^ ERROR mismatched types
- //~| expected type `()`
- //~| found type `Slice<_>`
- //~| expected (), found struct `Slice`
- _ => unreachable!()
- }
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![allow(safe_extern_statics)]
-
-mod Y {
- pub type X = usize;
- extern {
- pub static x: *const usize;
- }
- pub fn foo(value: *const X) -> *const X {
- value
- }
-}
-
-static foo: *const Y::X = Y::foo(Y::x as *const Y::X);
-//~^ ERROR `*const usize` cannot be shared between threads safely [E0277]
-//~| ERROR E0015
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait MatrixShape {}
-
-struct Col<D, C> {
- data: D,
- col: C,
-}
-
-trait Collection { fn len(&self) -> usize; }
-
-impl<T, M: MatrixShape> Collection for Col<M, usize> {
-//~^ ERROR type parameter `T` is not constrained
- fn len(&self) -> usize {
- unimplemented!()
- }
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait T<'a> {
- fn a(&'a self) -> &'a bool;
- fn b(&self) {
- self.a(); //~ ERROR cannot infer
- }
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use std::any::Any;
-
-fn foo<T: Any>(value: &T) -> Box<Any> {
- Box::new(value) as Box<Any>
- //~^ ERROR explicit lifetime required in the type of `value` [E0621]
-}
-
-fn main() {
- let _ = foo(&5);
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Make sure we don't ICE when making an overloaded call with the
-// wrong arity.
-
-fn _foo<F: Fn()> (f: F) {
- |t| f(t); //~ ERROR E0057
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// error-pattern:type annotations needed
-fn main() {
- panic!(
- std::default::Default::default()
- );
-}
+++ /dev/null
-// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Testing that we don't fail abnormally after hitting the errors
-
-use unresolved::*; //~ ERROR unresolved import `unresolved` [E0432]
- //~^ Maybe a missing `extern crate unresolved;`?
-
-fn main() {}
+++ /dev/null
-// 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.
-
-#![feature(rustc_attrs)]
-
-fn cb<'a,T>(_x: Box<Fn((&'a i32, &'a (Vec<&'static i32>, bool))) -> T>) -> T {
- panic!()
-}
-
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
- cb(Box::new(|(k, &(ref v, b))| (*k, v.clone(), b)));
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-mod foo {}
-
-fn main() {
- let p = foo { x: () }; //~ ERROR expected struct, variant or union type, found module `foo`
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-test the unsized enum no longer compiles
-
-enum A {
- B(char),
- C([Box<A>]),
-}
-
-fn c(c:char) {
- A::B(c);
- //~^ ERROR cannot move a value of type A: the size of A cannot be statically determined
-}
-
-pub fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn f<'r>(p: &'r mut fn(p: &mut ())) {
- (*p)(()) //~ ERROR mismatched types
- //~| expected type `&mut ()`
- //~| found type `()`
- //~| expected &mut (), found ()
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-const FOO: usize = FOO; //~ ERROR E0391
-
-fn main() {
- let _x: [u8; FOO]; // caused stack overflow prior to fix
- let _y: usize = 1 + {
- const BAR: usize = BAR;
- let _z: [u8; BAR]; // caused stack overflow prior to fix
- 1
- };
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(staged_api)]
-#![deny(deprecated)]
-
-#![unstable(feature = "test_feature", issue = "0")]
-
-struct Foo;
-
-impl Foo {
- #[unstable(feature = "test_feature", issue = "0")]
- #[rustc_deprecated(since = "1.0.0", reason = "text")]
- fn foo(self) {}
-}
-
-fn main() {
- Foo
- .foo(); //~ ERROR use of deprecated item
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- *return //~ ERROR type `!` cannot be dereferenced
- ;
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct X(isize);
-
-enum Enum {
- Variant1,
- Variant2
-}
-
-impl Drop for X {
- fn drop(&mut self) {}
-}
-impl Drop for Enum {
- fn drop(&mut self) {}
-}
-
-fn main() {
- let foo = X(1);
- drop(foo);
- match foo { //~ ERROR use of moved value
- X(1) => (),
- _ => unreachable!()
- }
-
- let e = Enum::Variant2;
- drop(e);
- match e { //~ ERROR use of moved value
- Enum::Variant1 => unreachable!(),
- Enum::Variant2 => ()
- }
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-enum Foo {
- Bar(isize)
-}
-
-fn main() {
- match Foo::Bar(1) {
- Foo { i } => () //~ ERROR expected struct, variant or union type, found enum `Foo`
- }
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Foo { foo: Option<Option<Foo>> }
-//~^ ERROR recursive type `Foo` has infinite size
-
-impl Foo { fn bar(&self) {} }
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Baz { q: Option<Foo> }
-//~^ ERROR recursive type `Baz` has infinite size
-
-struct Foo { q: Option<Baz> }
-//~^ ERROR recursive type `Foo` has infinite size
-
-impl Foo { fn bar(&self) {} }
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use std::sync::Mutex;
-
-struct Foo { foo: Mutex<Option<Foo>> }
-//~^ ERROR recursive type `Foo` has infinite size
-
-impl Foo { fn bar(&self) {} }
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use std::marker;
-
-struct Foo<T> { foo: Option<Option<Foo<T>>>, marker: marker::PhantomData<T> }
-//~^ ERROR recursive type `Foo` has infinite size
-
-impl<T> Foo<T> { fn bar(&self) {} }
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use std::marker;
-
-struct Foo { foo: Bar<Foo> }
-
-struct Bar<T> { x: Bar<Foo> , marker: marker::PhantomData<T> }
-//~^ ERROR recursive type `Bar` has infinite size
-
-impl Foo { fn foo(&self) {} }
-
-fn main() {
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use std::sync::Mutex;
-
-enum Foo { X(Mutex<Option<Foo>>) }
-//~^ ERROR recursive type `Foo` has infinite size
-
-impl Foo { fn bar(self) {} }
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-enum Foo { Voo(Option<Option<Foo>>) }
-//~^ ERROR recursive type `Foo` has infinite size
-
-impl Foo { fn bar(&self) {} }
-
-fn main() { }
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-enum Test {
- Foo = 0
-}
-
-fn main() {
- let _x = Test::Foo as *const isize;
- //~^ ERROR casting `Test` as `*const isize` is invalid
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-static X: usize = 0 as *const usize as usize;
-//~^ ERROR: raw pointers cannot be cast to integers in statics
-
-fn main() {
- assert_eq!(X, 0);
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(fn_traits)]
-
-fn id<T>(x: T) -> T { x }
-
-pub fn foo<'a, F: Fn(&'a ())>(bar: F) {
- bar.call((
- &id(()), //~ ERROR borrowed value does not live long enough
- ));
-}
-fn main() {}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use foo::MyEnum::Result;
-use foo::NoResult; // Through a re-export
-
-mod foo {
- pub use self::MyEnum::NoResult;
-
- pub enum MyEnum {
- Result,
- NoResult
- }
-
- fn new() -> NoResult<MyEnum, String> {
- //~^ ERROR expected type, found variant `NoResult`
- unimplemented!()
- }
-}
-
-mod bar {
- use foo::MyEnum::Result;
- use foo;
-
- fn new() -> Result<foo::MyEnum, String> {
- //~^ ERROR expected type, found variant `Result`
- unimplemented!()
- }
-}
-
-fn new() -> Result<foo::MyEnum, String> {
- //~^ ERROR expected type, found variant `Result`
- unimplemented!()
-}
-
-fn newer() -> NoResult<foo::MyEnum, String> {
- //~^ ERROR expected type, found variant `NoResult`
- unimplemented!()
-}
-
-fn main() {
- let _ = new();
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use std::marker;
-
-struct B<T>(marker::PhantomData<T>);
-
-fn main() {
- let foo = B(marker::PhantomData); //~ ERROR type annotations needed
- let closure = || foo;
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Test that moves of unsized values within closures are caught
-// and rejected.
-
-fn main() {
- (|| Box::new(*(&[0][..])))();
- //~^ ERROR the size for values of type
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-const C1: &'static mut [usize] = &mut [];
-//~^ ERROR: references in constants may only refer to immutable values
-
-static mut S: usize = 3;
-const C2: &'static mut usize = unsafe { &mut S };
-//~^ ERROR: constants cannot refer to statics
-//~| ERROR: references in constants may only refer to immutable values
-//~| ERROR: references in constants may only refer to immutable values
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use std::cell::UnsafeCell;
-
-const A: UnsafeCell<usize> = UnsafeCell::new(1);
-const B: &'static UnsafeCell<usize> = &A;
-//~^ ERROR: cannot borrow a constant which may contain interior mutability
-
-struct C { a: UnsafeCell<usize> }
-const D: C = C { a: UnsafeCell::new(1) };
-const E: &'static UnsafeCell<usize> = &D.a;
-//~^ ERROR: cannot borrow a constant which may contain interior mutability
-const F: &'static C = &D;
-//~^ ERROR: cannot borrow a constant which may contain interior mutability
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![warn(unused)]
-#[deny(warnings)]
-
-const foo: isize = 3;
-//~^ ERROR: should have an upper case name such as
-//~^^ ERROR: constant item is never used
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn id<T>(x: T) -> T { x }
-
-const FOO: usize = 3;
-
-fn foo() -> &'static usize { &id(FOO) }
-//~^ ERROR: borrowed value does not live long enough
-
-fn main() {
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-static A1: usize = 1;
-static mut A2: usize = 1;
-const A3: usize = 1;
-
-fn main() {
- match 1 {
- A1 => {} //~ ERROR: match bindings cannot shadow statics
- A2 => {} //~ ERROR: match bindings cannot shadow statics
- A3 => {}
- _ => {}
- }
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![allow(warnings)]
-
-struct Struct { a: usize }
-
-const C: usize = 1;
-static S: usize = 1;
-
-const T1: &'static usize = &C;
-const T2: &'static usize = &S; //~ ERROR: constants cannot refer to statics
-static T3: &'static usize = &C;
-static T4: &'static usize = &S;
-
-const T5: usize = C;
-const T6: usize = S; //~ ERROR: constants cannot refer to statics
-static T7: usize = C;
-static T8: usize = S;
-
-const T9: Struct = Struct { a: C };
-const T10: Struct = Struct { a: S };
-//~^ ERROR: constants cannot refer to statics
-static T11: Struct = Struct { a: C };
-static T12: Struct = Struct { a: S };
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Foo;
-const INIT: Foo = Foo;
-static FOO: Foo = INIT;
-
-fn main() {
- let _a = FOO; //~ ERROR: cannot move out of static item
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(optin_builtin_traits)]
-
-use std::marker::Sync;
-
-struct Foo;
-impl !Sync for Foo {}
-
-static FOO: usize = 3;
-static BAR: Foo = Foo;
-//~^ ERROR: `Foo` cannot be shared between threads safely [E0277]
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use std::fmt::{Debug, Formatter, Error};
-use std::collections::HashMap;
-
-trait HasInventory {
- fn getInventory<'s>(&'s self) -> &'s mut Inventory;
- fn addToInventory(&self, item: &Item);
- fn removeFromInventory(&self, itemName: &str) -> bool;
-}
-
-trait TraversesWorld {
- fn attemptTraverse(&self, room: &Room, directionStr: &str) -> Result<&Room, &str> {
- let direction = str_to_direction(directionStr);
- let maybe_room = room.direction_to_room.get(&direction);
- match maybe_room {
- Some(entry) => Ok(entry),
- //~^ ERROR 25:28: 25:37: lifetime mismatch [E0623]
- _ => Err("Direction does not exist in room.")
- }
- }
-}
-
-
-#[derive(Debug, Eq, PartialEq, Hash)]
-enum RoomDirection {
- West,
- East,
- North,
- South,
- Up,
- Down,
- In,
- Out,
-
- None
-}
-
-struct Room {
- description: String,
- items: Vec<Item>,
- direction_to_room: HashMap<RoomDirection, Room>,
-}
-
-impl Room {
- fn new(description: &'static str) -> Room {
- Room {
- description: description.to_string(),
- items: Vec::new(),
- direction_to_room: HashMap::new()
- }
- }
-
- fn add_direction(&mut self, direction: RoomDirection, room: Room) {
- self.direction_to_room.insert(direction, room);
- }
-}
-
-struct Item {
- name: String,
-}
-
-struct Inventory {
- items: Vec<Item>,
-}
-
-impl Inventory {
- fn new() -> Inventory {
- Inventory {
- items: Vec::new()
- }
- }
-}
-
-struct Player {
- name: String,
- inventory: Inventory,
-}
-
-impl Player {
- fn new(name: &'static str) -> Player {
- Player {
- name: name.to_string(),
- inventory: Inventory::new()
- }
- }
-}
-
-impl TraversesWorld for Player {
-}
-
-impl Debug for Player {
- fn fmt(&self, formatter: &mut Formatter) -> Result<(), Error> {
- formatter.write_str("Player{ name:");
- formatter.write_str(&self.name);
- formatter.write_str(" }");
- Ok(())
- }
-}
-
-fn str_to_direction(to_parse: &str) -> RoomDirection {
- match to_parse { //~ ERROR match arms have incompatible types
- "w" | "west" => RoomDirection::West,
- "e" | "east" => RoomDirection::East,
- "n" | "north" => RoomDirection::North,
- "s" | "south" => RoomDirection::South,
- "in" => RoomDirection::In,
- "out" => RoomDirection::Out,
- "up" => RoomDirection::Up,
- "down" => RoomDirection::Down,
- _ => None
- }
-}
-
-fn main() {
- let mut player = Player::new("Test player");
- let mut room = Room::new("A test room");
- println!("Made a player: {:?}", player);
- println!("Direction parse: {:?}", str_to_direction("east"));
- match player.attemptTraverse(&room, "west") {
- Ok(_) => println!("Was able to move west"),
- Err(msg) => println!("Not able to move west: {}", msg)
- };
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Foo<'a> {
- data: &'a[u8],
-}
-
-impl <'a> Foo<'a>{
- fn bar(self: &mut Foo) {
- //~^ mismatched method receiver
- //~| expected type `Foo<'a>`
- //~| found type `Foo<'_>`
- //~| lifetime mismatch
- //~| mismatched method receiver
- //~| expected type `Foo<'a>`
- //~| found type `Foo<'_>`
- //~| lifetime mismatch
- }
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Test that regionck suggestions in a provided method of a trait
-// don't ICE
-
-trait Foo<'a> {
- fn foo(&'a self);
- fn bar(&self) {
- self.foo();
- //~^ ERROR cannot infer
- }
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-enum MyOption<T> {
- MySome(T),
- MyNone,
-}
-
-fn main() {
- match MyOption::MySome(42) {
- MyOption::MySome { x: 42 } => (),
- //~^ ERROR variant `MyOption::MySome` does not have a field named `x`
- //~| ERROR pattern does not mention field `0`
- _ => (),
- }
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Test that we can parse a unit struct with a where clause, even if
-// it leads to an error later on since `T` is unused.
-
-struct Foo<T> where T: Copy; //~ ERROR parameter `T` is never used
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#[derive(Debug)]
-struct Pair<T, V> (T, V);
-
-impl Pair<
- &str, //~ ERROR missing lifetime specifier
- isize
-> {
- fn say(self: &Pair<&str, isize>) {
- println!("{}", self);
- }
-}
-
-fn main() {
- let result = &Pair("shane", 1);
- result.say();
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-
-// error-pattern: too big for the current architecture
-
-#![feature(box_syntax)]
-
-#[cfg(target_pointer_width = "64")]
-fn main() {
- let n = 0_usize;
- let a: Box<_> = box [&n; 0xF000000000000000_usize];
- println!("{}", a[0xFFFFFF_usize]);
-}
-
-#[cfg(target_pointer_width = "32")]
-fn main() {
- let n = 0_usize;
- let a: Box<_> = box [&n; 0xFFFFFFFF_usize];
- println!("{}", a[0xFFFFFF_usize]);
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub static X: usize = 1;
-
-fn main() {
- match 1 {
- self::X => { },
- //~^ ERROR expected unit struct/variant or constant, found static `self::X`
- _ => { },
- }
-}
+++ /dev/null
-// 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.
-
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
-#![feature(thread_local)]
-
-#[thread_local]
-static FOO: u8 = 3;
-
-fn main() {
- let a = &FOO;
- //[mir]~^ ERROR `FOO` does not live long enough [E0597]
- //[mir]~| does not live long enough
- //[mir]~| NOTE borrowed value must be valid for the static lifetime
- //[ast]~^^^^ ERROR borrowed value does not live long enough
- //[ast]~| does not live long enough
- //[ast]~| NOTE borrowed value must be valid for the static lifetime
-
- std::thread::spawn(move || {
- println!("{}", a);
- });
-}
-//[mir]~^ borrowed value only lives until here
-//[ast]~^^ temporary value only lives until here
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-extern crate core;
-
-use core::ops::Drop;
-
-trait Bar {}
-
-struct G<T: ?Sized> {
- _ptr: *const T
-}
-
-impl<T> Drop for G<T> {
-//~^ ERROR: The requirement `T: std::marker::Sized` is added only by the Drop impl. [E0367]
- fn drop(&mut self) {
- if !self._ptr.is_null() {
- }
- }
-}
-
-fn main() {
- let x:G<Bar>;
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Tr {}
-type Huh<T> where T: Tr = isize; //~ ERROR type parameter `T` is unused
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![deny(unused_variables)]
-
-fn main() {
- for _ in 1..101 {
- let x = (); //~ ERROR: unused variable: `x`
- match () {
- a => {} //~ ERROR: unused variable: `a`
- }
- }
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-impl Undefined {}
-//~^ ERROR cannot find type `Undefined` in this scope
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub trait AbstractRenderer {}
-
-fn _create_render(_: &()) ->
- AbstractRenderer
-//~^ ERROR the size for values of type
-{
- match 0 {
- _ => unimplemented!()
- }
-}
-
-fn main() {
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub fn main() {
- const z: &'static isize = {
- static p: isize = 3;
- &p
- //~^ ERROR constants cannot refer to statics, use a constant instead
- };
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub fn main() {
- const z: &'static isize = {
- //~^ ERROR let bindings in constants are unstable
- //~| ERROR statements in constants are unstable
- let p = 3;
- //~^ ERROR let bindings in constants are unstable
- //~| ERROR statements in constants are unstable
- &p //~ ERROR `p` does not live long enough
- //~^ ERROR let bindings in constants are unstable
- };
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-const X: u8 = 1;
-static Y: u8 = 1;
-fn foo() {}
-
-impl X {}
-//~^ ERROR expected type, found constant `X`
-impl Y {}
-//~^ ERROR expected type, found static `Y`
-impl foo {}
-//~^ ERROR expected type, found function `foo`
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- let x; //~ ERROR type annotations needed
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- const X: u32 = 1;
- const Y: usize = &X as *const u32 as usize; //~ ERROR E0018
- println!("{}", Y);
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use std::any::Any;
-use std::any::TypeId;
-
-trait Private<P, R> {
- fn call(&self, p: P, r: R);
-}
-pub trait Public: Private<
-//~^ ERROR private trait `Private<<Self as Public>::P, <Self as Public>::R>` in public interface
- <Self as Public>::P,
- <Self as Public>::R
-> {
- type P;
- type R;
-
- fn call_inner(&self);
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Set<T> {
- fn contains(&self, _: T) -> bool;
- fn set(&mut self, _: T);
-}
-
-impl<'a, T, S> Set<&'a [T]> for S where
- T: Copy,
- S: Set<T>,
-{
- fn contains(&self, bits: &[T]) -> bool {
- bits.iter().all(|&bit| self.contains(bit))
- }
-
- fn set(&mut self, bits: &[T]) {
- for &bit in bits {
- self.set(bit)
- }
- }
-}
-
-fn main() {
- let bits: &[_] = &[0, 1];
-
- 0.contains(bits);
- //~^ ERROR overflow
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Test that `Box` cannot be used with a lifetime parameter.
-
-struct Foo<'a> {
- x: Box<'a, isize> //~ ERROR wrong number of lifetime parameters
-}
-
-pub fn main() {
-}
+++ /dev/null
-// 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.
-
-// Test that name clashes between the method in an impl for the type
-// and the method in the trait when both are in the same scope.
-
-trait T {
- fn foo(&self);
-}
-
-impl<'a> T + 'a {
- fn foo(&self) {}
-}
-
-impl T for i32 {
- fn foo(&self) {}
-}
-
-fn main() {
- let x: &T = &0i32;
- x.foo(); //~ ERROR multiple applicable items in scope [E0034]
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Test that overloaded call parameter checking does not ICE
-// when a type error or unconstrained type variable propagates
-// into it.
-
-fn main() {
- (return)((),()); //~ ERROR expected function, found `!`
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use std::ops::Deref;
-
-struct MyPtr<'a>(&'a mut usize);
-impl<'a> Deref for MyPtr<'a> {
- type Target = usize;
-
- fn deref<'b>(&'b self) -> &'b usize { self.0 }
-}
-
-trait Tr {
- fn poke(&self, s: &mut usize);
-}
-
-impl Tr for usize {
- fn poke(&self, s: &mut usize) {
- *s = 2;
- }
-}
-
-fn main() {
- let s = &mut 1;
-
- MyPtr(s).poke(s);
- //~^ ERROR cannot borrow `*s` as mutable more than once at a time
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn add_state(op: <isize as HasState>::State) {
-//~^ ERROR `isize: HasState` is not satisfied
-}
-
-trait HasState {
- type State;
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Tests that we don't generate a spurious error about f.honk's type
-// being undeterminable
-fn main() {
- let f = 42;
-
- let _g = if f < 5 {
- f.honk() //~ ERROR no method named `honk` found
- }
- else {
- ()
- };
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use std::cell::RefCell;
-
-fn main() {
- let mut y = 1;
- let c = RefCell::new(vec![]);
- c.push(Box::new(|| y = 0));
- c.push(Box::new(|| y = 0));
-//~^ ERROR cannot borrow `y` as mutable more than once at a time
-}
-
-fn ufcs() {
- let mut y = 1;
- let c = RefCell::new(vec![]);
-
- Push::push(&c, Box::new(|| y = 0));
- Push::push(&c, Box::new(|| y = 0));
-//~^ ERROR cannot borrow `y` as mutable more than once at a time
-}
-
-trait Push<'c> {
- fn push<'f: 'c>(&self, push: Box<FnMut() + 'f>);
-}
-
-impl<'c> Push<'c> for RefCell<Vec<Box<FnMut() + 'c>>> {
- fn push<'f: 'c>(&self, fun: Box<FnMut() + 'f>) {
- self.borrow_mut().push(fun)
- }
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-type FuncType<'f> = Fn(&isize) -> isize + 'f;
-
-fn ho_func(f: Option<FuncType>) {
- //~^ ERROR the size for values of type
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Regression test for #18937.
-
-use std::fmt;
-
-#[derive(Debug)]
-struct MyString<'a>(&'a String);
-
-struct B {
- list: Vec<Box<fmt::Debug>>,
-}
-
-trait A<'a> {
- fn foo<F>(&mut self, f: F)
- where F: fmt::Debug + 'a,
- Self: Sized;
-}
-
-impl<'a> A<'a> for B {
- fn foo<F>(&mut self, f: F) //~ ERROR impl has stricter
- where F: fmt::Debug + 'static,
- {
- self.list.push(Box::new(f));
- }
-}
-
-fn main() {
- let mut b = B { list: Vec::new() };
-
- // Create a borrowed pointer, put it in `b`, then drop what's borrowing it
- let a = "hello".to_string();
- b.foo(MyString(&a));
-
- // Drop the data which `b` has a reference to
- drop(a);
-
- // Use the data, probably segfaulting
- for b in b.list.iter() {
- println!("{:?}", b);
- }
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub trait Foo { fn foo<T>(&self, ext_thing: &T); }
-pub trait Bar: Foo { }
-impl<T: Foo> Bar for T { }
-
-pub struct Thing;
-impl Foo for Thing {
- fn foo<T>(&self, _: &T) {}
-}
-
-#[inline(never)]
-fn foo(b: &Bar) {
- //~^ ERROR E0038
- b.foo(&0)
-}
-
-fn main() {
- let mut thing = Thing;
- let test: &Bar = &mut thing;
- foo(test);
-}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// error-pattern: `main` function is not allowed to have generic parameters
-fn main<T>() { }
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use Foo::FooB;
-
-enum Foo {
- FooB { x: i32, y: i32 }
-}
-
-fn main() {
- let f = FooB { x: 3, y: 4 };
- match f {
- FooB(a, b) => println!("{} {}", a, b),
- //~^ ERROR expected tuple struct/variant, found struct variant `FooB`
- }
-}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-const TUP: (usize,) = (42,);
-
-fn main() {
- let a: [isize; TUP.1];
- //~^ ERROR no field `1` on type `(usize,)`
-}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct MyStruct { field: usize }
-const STRUCT: MyStruct = MyStruct { field: 42 };
-
-fn main() {
- let a: [isize; STRUCT.nonexistent_field];
- //~^ no field `nonexistent_field` on type `MyStruct`
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Qiz {
- fn qiz();
-}
-
-struct Foo;
-impl Qiz for Foo {
- fn qiz() {}
-}
-
-struct Bar {
- foos: &'static [&'static (Qiz + 'static)]
-//~^ ERROR E0038
-}
-
-const FOO : Foo = Foo;
-const BAR : Bar = Bar { foos: &[&FOO]};
-
-fn main() { }
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Test that a partially specified trait object with unspecified associated
-// type does not type-check.
-
-trait Foo {
- type A;
-
- fn dummy(&self) { }
-}
-
-fn bar(x: &Foo) {}
-//~^ ERROR the associated type `A` (from the trait `Foo`) must be specified
-
-pub fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- "".homura()(); //~ ERROR no method named `homura` found
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Foo {
- fn foo<T>(&self, val: T);
-}
-
-trait Bar: Foo { }
-
-pub struct Thing;
-
-impl Foo for Thing {
- fn foo<T>(&self, val: T) { }
-}
-
-impl Bar for Thing { }
-
-fn main() {
- let mut thing = Thing;
- let test: &mut Bar = &mut thing;
- //~^ ERROR E0038
- //~| ERROR E0038
-}
+++ /dev/null
-// 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.
-
-#![feature(rustc_attrs)]
-#![allow(warnings)]
-
-trait A<T> {}
-struct B<T> where B<T>: A<B<T>> { t: T }
-
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// error-pattern: requires `copy` lang_item
-
-#![feature(lang_items, start, no_core)]
-#![no_core]
-
-#[lang = "sized"]
-trait Sized { }
-
-struct S;
-
-#[start]
-fn main(_: isize, _: *const *const u8) -> isize {
- let _ = S;
- 0
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Homura;
-
-fn akemi(homura: Homura) {
- let Some(ref madoka) = Some(homura.kaname()); //~ ERROR no method named `kaname` found
- madoka.clone();
-}
-
-fn main() { }
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {}
-
-struct Type;
-
-impl Type {
- undef!();
- //~^ ERROR cannot find macro `undef!` in this scope
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait From<Src> {
- type Output;
-
- fn from(src: Src) -> <Self as From<Src>>::Output;
-}
-
-trait To: Sized {
- fn to<Dst: From<Self>>(self) ->
- <Dst as From<Self>>::Dst
- //~^ ERROR cannot find associated type `Dst` in trait `From`
- {
- From::from(self)
- }
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(unboxed_closures)]
-
-struct Foo;
-
-impl Fn<(&(),)> for Foo { } //~ ERROR missing lifetime specifier
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Test if the sugared if-let construct correctly prints "missing an else clause" when an else
-// clause does not exist, instead of the unsympathetic "match arms have incompatible types"
-
-fn main() {
- if let Some(homura) = Some("madoka") { //~ ERROR missing an else clause
- //~| expected type `()`
- //~| found type `{integer}`
- //~| expected (), found integral variable
- 765
- };
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait From<Src> {
- type Result;
-
- fn from(src: Src) -> Self::Result;
-}
-
-trait To {
- fn to<Dst>( //~ ERROR the size for values of type
- self
- ) -> <Dst as From<Self>>::Result where Dst: From<Self> {
- From::from(self)
- }
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct X { x: i32 }
-
-fn main() {
- let mut b: Vec<X> = vec![];
- b.sort();
- //~^ ERROR `X: std::cmp::Ord` is not satisfied
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(fn_traits, unboxed_closures)]
-
-struct Foo;
-
-impl<'a, T> Fn<(&'a T,)> for Foo {
- extern "rust-call" fn call(&self, (_,): (T,)) {}
- //~^ ERROR: has an incompatible type for trait
- //~| expected reference
-}
-
-impl<'a, T> FnMut<(&'a T,)> for Foo {
- extern "rust-call" fn call_mut(&mut self, (_,): (T,)) {}
- //~^ ERROR: has an incompatible type for trait
- //~| expected reference
-}
-
-impl<'a, T> FnOnce<(&'a T,)> for Foo {
- type Output = ();
-
- extern "rust-call" fn call_once(self, (_,): (T,)) {}
- //~^ ERROR: has an incompatible type for trait
- //~| expected reference
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- // NB: this (almost) typechecks when default binding modes are enabled.
- for (ref i,) in [].iter() {
- i.clone();
- //~^ ERROR type annotations needed
- }
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-extern {
- #[link_name = "llvm.sqrt.f32"]
- fn sqrt(x: f32) -> f32; //~ ERROR linking to LLVM intrinsics is experimental
-}
-
-fn main(){
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Foo {
- fn answer(self);
-}
-
-struct NoData<T>;
-//~^ ERROR: parameter `T` is never used
-
-impl<T> Foo for T where NoData<T>: Foo {
-//~^ ERROR: overflow evaluating the requirement
- fn answer(self) {
- let val: NoData<T> = NoData;
- }
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {}
-
-struct The;
-
-impl The {
- fn iceman(c: Vec<[i32]>) {}
- //~^ ERROR the size for values of type
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn changer<'a>(mut things: Box<Iterator<Item=&'a mut u8>>) {
- for item in *things { *item = 0 }
-//~^ ERROR the size for values of type
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// We need all these 9 issue-20616-N.rs files
-// because we can only catch one parsing error at a time
-
-
-
-type Type_1_<'a, T> = &'a T;
-
-
-type Type_1<'a T> = &'a T; //~ error: expected one of `,`, `:`, or `>`, found `T`
-
-
-//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(`
-
-
-//type Type_3<T> = Box<T,,>; // error: expected type, found `,`
-
-
-//type Type_4<T> = Type_1_<'static,, T>; // error: expected type, found `,`
-
-
-type Type_5_<'a> = Type_1_<'a, ()>;
-
-
-//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,`
-
-
-//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,`
-
-
-//type Type_7 = Box<(),,>; // error: expected type, found `,`
-
-
-//type Type_8<'a,,> = &'a (); // error: expected ident, found `,`
-
-
-//type Type_9<T,,> = Box<T>; // error: expected ident, found `,`
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// We need all these 9 issue-20616-N.rs files
-// because we can only catch one parsing error at a time
-
-
-
-type Type_1_<'a, T> = &'a T;
-
-
-//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T`
-
-
-type Type_2 = Type_1_<'static ()>; //~ error: expected one of `,` or `>`, found `(`
-
-
-//type Type_3<T> = Box<T,,>; // error: expected type, found `,`
-
-
-//type Type_4<T> = Type_1_<'static,, T>; // error: expected type, found `,`
-
-
-type Type_5_<'a> = Type_1_<'a, ()>;
-
-
-//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,`
-
-
-//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,`
-
-
-//type Type_7 = Box<(),,>; // error: expected type, found `,`
-
-
-//type Type_8<'a,,> = &'a (); // error: expected ident, found `,`
-
-
-//type Type_9<T,,> = Box<T>; // error: expected ident, found `,`
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// We need all these 9 issue-20616-N.rs files
-// because we can only catch one parsing error at a time
-
-
-
-type Type_1_<'a, T> = &'a T;
-
-
-//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T`
-
-
-//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(`
-
-
-type Type_3<T> = Box<T,,>; //~ error: expected one of `>`, identifier, lifetime, or type, found `,`
-
-
-//type Type_4<T> = Type_1_<'static,, T>; // error: expected type, found `,`
-
-
-type Type_5_<'a> = Type_1_<'a, ()>;
-
-
-//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,`
-
-
-//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,`
-
-
-//type Type_7 = Box<(),,>; // error: expected type, found `,`
-
-
-//type Type_8<'a,,> = &'a (); // error: expected ident, found `,`
-
-
-//type Type_9<T,,> = Box<T>; // error: expected ident, found `,`
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// We need all these 9 issue-20616-N.rs files
-// because we can only catch one parsing error at a time
-
-
-
-type Type_1_<'a, T> = &'a T;
-
-
-//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T`
-
-
-//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(`
-
-
-//type Type_3<T> = Box<T,,>; // error: expected type, found `,`
-
-
-type Type_4<T> = Type_1_<'static,, T>;
-//~^ error: expected one of `>`, identifier, lifetime, or type, found `,`
-
-
-type Type_5_<'a> = Type_1_<'a, ()>;
-
-
-//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,`
-
-
-//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,`
-
-
-//type Type_7 = Box<(),,>; // error: expected type, found `,`
-
-
-//type Type_8<'a,,> = &'a (); // error: expected ident, found `,`
-
-
-//type Type_9<T,,> = Box<T>; // error: expected ident, found `,`
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// We need all these 9 issue-20616-N.rs files
-// because we can only catch one parsing error at a time
-
-
-
-type Type_1_<'a, T> = &'a T;
-
-
-//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T`
-
-
-//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(`
-
-
-//type Type_3<T> = Box<T,,>; // error: expected type, found `,`
-
-
-//type Type_4<T> = Type_1_<'static,, T>; // error: expected type, found `,`
-
-
-type Type_5_<'a> = Type_1_<'a, ()>;
-
-
-type Type_5<'a> = Type_1_<'a, (),,>;
-//~^ error: expected one of `>`, identifier, lifetime, or type, found `,`
-
-
-//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,`
-
-
-//type Type_7 = Box<(),,>; // error: expected type, found `,`
-
-
-//type Type_8<'a,,> = &'a (); // error: expected ident, found `,`
-
-
-//type Type_9<T,,> = Box<T>; // error: expected ident, found `,`
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// We need all these 9 issue-20616-N.rs files
-// because we can only catch one parsing error at a time
-
-
-
-type Type_1_<'a, T> = &'a T;
-
-
-//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T`
-
-
-//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(`
-
-
-//type Type_3<T> = Box<T,,>; // error: expected type, found `,`
-
-
-//type Type_4<T> = Type_1_<'static,, T>; // error: expected type, found `,`
-
-
-type Type_5_<'a> = Type_1_<'a, ()>;
-
-
-//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,`
-
-
-type Type_6 = Type_5_<'a,,>;
-//~^ error: expected one of `>`, identifier, lifetime, or type, found `,`
-
-
-//type Type_7 = Box<(),,>; // error: expected type, found `,`
-
-
-//type Type_8<'a,,> = &'a (); // error: expected ident, found `,`
-
-
-//type Type_9<T,,> = Box<T>; // error: expected ident, found `,`
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// We need all these 9 issue-20616-N.rs files
-// because we can only catch one parsing error at a time
-
-
-
-type Type_1_<'a, T> = &'a T;
-
-
-//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T`
-
-
-//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(`
-
-
-//type Type_3<T> = Box<T,,>; // error: expected type, found `,`
-
-
-//type Type_4<T> = Type_1_<'static,, T>; // error: expected type, found `,`
-
-
-type Type_5_<'a> = Type_1_<'a, ()>;
-
-
-//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,`
-
-
-//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,`
-
-
-type Type_7 = Box<(),,>; //~ error: expected one of `>`, identifier, lifetime, or type, found `,`
-
-
-//type Type_8<'a,,> = &'a (); // error: expected ident, found `,`
-
-
-//type Type_9<T,,> = Box<T>; // error: expected ident, found `,`
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// We need all these 9 issue-20616-N.rs files
-// because we can only catch one parsing error at a time
-
-
-
-type Type_1_<'a, T> = &'a T;
-
-
-//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T`
-
-
-//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(`
-
-
-//type Type_3<T> = Box<T,,>; // error: expected type, found `,`
-
-
-//type Type_4<T> = Type_1_<'static,, T>; // error: expected type, found `,`
-
-
-type Type_5_<'a> = Type_1_<'a, ()>;
-
-
-//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,`
-
-
-//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,`
-
-
-//type Type_7 = Box<(),,>; // error: expected type, found `,`
-
-
-type Type_8<'a,,> = &'a (); //~ error: expected one of `>`, identifier, or lifetime, found `,`
-
-
-//type Type_9<T,,> = Box<T>; // error: expected identifier, found `,`
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// We need all these 9 issue-20616-N.rs files
-// because we can only catch one parsing error at a time
-
-
-
-type Type_1_<'a, T> = &'a T;
-
-
-//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T`
-
-
-//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(`
-
-
-//type Type_3<T> = Box<T,,>; // error: expected type, found `,`
-
-
-//type Type_4<T> = Type_1_<'static,, T>; // error: expected type, found `,`
-
-
-type Type_5_<'a> = Type_1_<'a, ()>;
-
-
-//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,`
-
-
-//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,`
-
-
-//type Type_7 = Box<(),,>; // error: expected type, found `,`
-
-
-//type Type_8<'a,,> = &'a (); // error: expected identifier, found `,`
-
-
-type Type_9<T,,> = Box<T>; //~ error: expected one of `>`, identifier, or lifetime, found `,`
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct G;
-
-fn main() {
- let g = G(); //~ ERROR: expected function, found `G`
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait T : Iterator<Item=Self::Item>
-//~^ ERROR cycle detected
-//~| ERROR associated type `Item` not found for `Self`
-{}
-
-fn main() {}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// We used to ICE when moving out of a `*mut T` or `*const T`.
-
-struct T(u8);
-
-static mut GLOBAL_MUT_T: T = T(0);
-
-static GLOBAL_T: T = T(0);
-
-fn imm_ref() -> &'static T {
- unsafe { &GLOBAL_T }
-}
-
-fn mut_ref() -> &'static mut T {
- unsafe { &mut GLOBAL_MUT_T }
-}
-
-fn mut_ptr() -> *mut T {
- unsafe { 0 as *mut T }
-}
-
-fn const_ptr() -> *const T {
- unsafe { 0 as *const T }
-}
-
-pub fn main() {
- let a = unsafe { *mut_ref() };
- //~^ ERROR cannot move out of borrowed content
-
- let b = unsafe { *imm_ref() };
- //~^ ERROR cannot move out of borrowed content
-
- let c = unsafe { *mut_ptr() };
- //~^ ERROR cannot move out of dereference of raw pointer
-
- let d = unsafe { *const_ptr() };
- //~^ ERROR cannot move out of dereference of raw pointer
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub trait Subscriber {
- type Input;
-}
-
-pub trait Processor: Subscriber<Input = Self::Input> {
- //~^ ERROR cycle detected
- type Input;
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Regression test for #20831: debruijn index account was thrown off
-// by the (anonymous) lifetime in `<Self as Publisher>::Output`
-// below. Note that changing to a named lifetime made the problem go
-// away.
-
-use std::cell::RefCell;
-use std::ops::{Shl, Shr};
-
-pub trait Subscriber {
- type Input;
-}
-
-pub trait Publisher<'a> {
- type Output;
- fn subscribe(&mut self, _: Box<Subscriber<Input=Self::Output> + 'a>);
-}
-
-pub trait Processor<'a> : Subscriber + Publisher<'a> { }
-
-impl<'a, P> Processor<'a> for P where P : Subscriber + Publisher<'a> { }
-
-struct MyStruct<'a> {
- sub: Box<Subscriber<Input=u64> + 'a>
-}
-
-impl<'a> Publisher<'a> for MyStruct<'a> {
- type Output = u64;
- fn subscribe(&mut self, t : Box<Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
- // Not obvious, but there is an implicit lifetime here -------^
- //~^^ ERROR cannot infer
- //
- // The fact that `Publisher` is using an implicit lifetime is
- // what was causing the debruijn accounting to be off, so
- // leave it that way!
- self.sub = t;
- }
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Foo {}
-
-impl<'a> Foo for Foo+'a {}
-//~^ ERROR the object type `(dyn Foo + 'a)` automatically implements the trait `Foo`
-
-fn main() {}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn foo(a: Option<usize>, b: Option<usize>) {
- match (a,b) {
- //~^ ERROR: non-exhaustive patterns: `(None, None)` not covered
- (Some(a), Some(b)) if a == b => { }
- (Some(_), None) |
- (None, Some(_)) => { }
- }
-}
-
-fn main() {
- foo(None, None);
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Bar;
-
-impl Bar {
- fn hash<T>(&self, _: T) {}
-}
-
-#[derive(Hash)]
-struct Foo(Bar);
-//~^ error: `Bar: std::hash::Hash` is not satisfied
-
-fn main() {}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Trait<'a> {
- type A;
- type B;
-}
-
-fn foo<'a, T: Trait<'a>>(value: T::A) {
- let new: T::B = unsafe { std::mem::transmute(value) };
-//~^ ERROR: transmute called with types of different sizes
-}
-
-fn main() { }
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Trait {
- type A;
- type B;
-}
-
-fn foo<T: Trait<A = T::B>>() { }
-//~^ ERROR cycle detected
-//~| ERROR associated type `B` not found for `T`
-
-fn main() { }
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct S;
-
-impl Iterator for S {
- type Item = i32;
- fn next(&mut self) -> Result<i32, i32> { Ok(7) }
- //~^ ERROR method `next` has an incompatible type for trait
- //~| expected enum `std::option::Option`, found enum `std::result::Result`
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![allow(unused_macros)]
-
-macro_rules! test { ($wrong:t_ty ..) => () }
- //~^ ERROR: invalid fragment specifier `t_ty`
-
-fn main() {}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-mod MyMod {}
-
-fn main() {
- let myVar = MyMod { T: 0 };
- //~^ ERROR expected struct, variant or union type, found module `MyMod`
-}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait vec_monad<A> {
- fn bind<B, F>(&self, f: F) where F: FnMut(A) -> Vec<B>;
-}
-
-impl<A> vec_monad<A> for Vec<A> {
- fn bind<B, F>(&self, mut f: F) where F: FnMut(A) -> Vec<B> {
- let mut r = panic!();
- for elt in self { r = r + f(*elt); }
- //~^ ERROR E0277
- }
-}
-fn main() {
- ["hi"].bind(|x| [x] );
- //~^ ERROR no method named `bind` found for type `[&str; 1]` in the current scope
-}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![deny(unreachable_code)]
-#![allow(unused_variables)]
-#![allow(dead_code)]
-
-fn fail_len(v: Vec<isize> ) -> usize {
- let mut i = 3;
- panic!();
- for x in &v { i += 1; }
- //~^ ERROR: unreachable statement
- return i;
-}
-fn main() {}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- let x = panic!();
- x.clone(); //~ ERROR type annotations needed
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Inches(i32);
-
-fn main() {
- Inches as f32;
- //~^ ERROR casting
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn foo<U>(t: U) {
- let y = t();
-//~^ ERROR: expected function, found `U`
-}
-
-struct Bar;
-
-pub fn some_func() {
- let f = Bar();
-//~^ ERROR: expected function, found `Bar`
-}
-
-fn main() {
- foo(|| { 1 });
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Regression test for HashMap only impl'ing Send/Sync if its contents do
-
-use std::collections::HashMap;
-use std::rc::Rc;
-
-fn foo<T: Send>() {}
-
-fn main() {
- foo::<HashMap<Rc<()>, Rc<()>>>();
- //~^ ERROR `std::rc::Rc<()>` cannot be sent between threads safely
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub trait Bound {}
-pub struct Foo<T: Bound>(T);
-
-pub trait Trait1 {}
-impl<T: Bound> Trait1 for Foo<T> {}
-
-pub trait Trait2 {}
-impl<T> Trait2 for Foo<T> {} //~ ERROR the trait bound `T: Bound` is not satisfied
-
-fn main() {}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Foo {
- type A;
-}
-
-struct FooStruct;
-
-impl Foo for FooStruct {
-//~^ ERROR overflow evaluating the requirement `<FooStruct as Foo>::A`
- type A = <FooStruct as Foo>::A;
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Test that (for now) we report an ambiguity error here, because
-// specific trait relationships are ignored for the purposes of trait
-// matching. This behavior should likely be improved such that this
-// test passes. See #21974 for more details.
-
-trait Foo {
- fn foo(self);
-}
-
-fn foo<'a,'b,T>(x: &'a T, y: &'b T) //~ ERROR type annotations required
- where &'a T : Foo,
- &'b T : Foo
-{
- x.foo();
- y.foo();
-}
-
-fn main() { }
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(libc)]
-
-extern crate libc;
-
-fn main() {
- let ptr: *mut () = 0 as *mut _;
- let _: &mut Fn() = unsafe {
- &mut *(ptr as *mut Fn())
- //~^ ERROR `(): std::ops::Fn<()>` is not satisfied
- };
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait A {
- type Output;
- fn a(&self) -> <Self as A>::X;
- //~^ ERROR cannot find associated type `X` in trait `A`
-}
-
-impl A for u32 {
- type Output = u32;
- fn a(&self) -> u32 {
- 0
- }
-}
-
-fn main() {
- let a: u32 = 0;
- let b: u32 = a.a();
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- 0 as &std::any::Any; //~ ERROR non-primitive cast
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use std::ops::Index;
-
-pub trait Array2D: Index<usize> {
- fn rows(&self) -> usize;
- fn columns(&self) -> usize;
- fn get<'a>(&'a self, y: usize, x: usize) -> Option<&'a <Self as Index<usize>>::Output> {
- if y >= self.rows() || x >= self.columns() {
- return None;
- }
- let i = y * self.columns() + x;
- let indexer = &(*self as &Index<usize, Output = <Self as Index<usize>>::Output>);
- //~^ERROR non-primitive cast
- Some(indexer.index(i))
- }
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Trait {
- fn foo();
-}
-
-fn main() {
- <<i32 as Copy>::foobar as Trait>::foo();
- //~^ ERROR cannot find associated type `foobar` in trait `Copy`
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub trait Foo {
- type A;
-}
-
-type I<'a> = &'a (Foo + 'a);
-//~^ ERROR the value of the associated type `A` (from the trait `Foo`) must be specified
-
-fn main() {}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- let foo = "bar";
- let x = foo("baz");
- //~^ ERROR: expected function, found `&str`
-}
-
-fn foo(file: &str) -> bool {
- true
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![deny(unused_variables)]
-
-fn f(_: i32) {}
-
-fn main() {
- let mut v = 0;
- f(v);
- v = match 0 { a => 0 }; //~ ERROR: unused variable: `a`
- f(v);
-}
+++ /dev/null
-// 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.
-
-#![feature(unboxed_closures, fn_traits, rustc_attrs)]
-
-struct Foo;
-
-impl<A> FnOnce<(A,)> for Foo {
- type Output = ();
- extern "rust-call" fn call_once(self, (_,): (A,)) {
- }
-}
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
- println!("{:?}", Foo("bar"));
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Expr : PartialEq<Self::Item> {
- //~^ ERROR: cycle detected
- type Item;
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-mod foo {
- pub struct Foo;
- impl Foo {
- fn bar(&self) {}
- }
-
- pub trait Baz {
- fn bar(&self) -> bool { true }
- }
- impl Baz for Foo {}
-}
-
-fn main() {
- use foo::Baz;
-
- // Check that `bar` resolves to the trait method, not the inherent impl method.
- let _: () = foo::Foo.bar(); //~ ERROR mismatched types
-}
+++ /dev/null
-// 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 is_copy<T: ::std::marker<i32>::Copy>() {}
-//~^ ERROR type parameters are not allowed on this type [E0109]
-fn main() {}
+++ /dev/null
-// 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.
-
-#![feature(unboxed_closures, fn_traits, rustc_attrs)]
-
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
- let k = |x: i32| { x + 1 };
- Fn::call(&k, (0,));
-}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() { println!("{}", foobar); } //~ ERROR cannot find value `foobar` in this scope
+++ /dev/null
-// 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.
-
-struct Table {
- rows: [[String]],
- //~^ ERROR the size for values of type
-}
-
-fn f(table: &Table) -> &[String] {
- &table.rows[0]
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(rustc_attrs)]
-#![allow(warnings)]
-
-struct CNFParser {
- token: char,
-}
-
-impl CNFParser {
- fn is_whitespace(c: char) -> bool {
- c == ' ' || c == '\n'
- }
-
- fn consume_whitespace(&mut self) {
- self.consume_while(&(CNFParser::is_whitespace))
- }
-
- fn consume_while(&mut self, p: &Fn(char) -> bool) {
- while p(self.token) {
- return
- }
- }
-}
-
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-const FOO: [u32; u8::MIN as usize] = [];
-//~^ ERROR no associated item named `MIN` found for type `u8`
-
-fn main() {}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(box_syntax)]
-use std::any::Any;
-
-fn main()
-{
- fn h(x:i32) -> i32 {3*x}
- let mut vfnfer:Vec<Box<Any>> = vec![];
- vfnfer.push(box h);
- println!("{:?}",(vfnfer[0] as Fn)(3));
- //~^ ERROR the precise format of `Fn`-family traits'
- //~| ERROR wrong number of type arguments: expected 1, found 0 [E0243]
- //~| ERROR the value of the associated type `Output` (from the trait `std::ops::FnOnce`)
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub enum Expr<'var, VAR> {
- Let(Box<Expr<'var, VAR>>,
- Box<for<'v> Fn(Expr<'v, VAR>) -> Expr<'v, VAR> + 'var>)
-}
-
-pub fn add<'var, VAR>
- (a: Expr<'var, VAR>, b: Expr<'var, VAR>) -> Expr<'var, VAR> {
- loop {}
-}
-
-pub fn let_<'var, VAR, F: for<'v> Fn(Expr<'v, VAR>) -> Expr<'v, VAR>>
- (a: Expr<'var, VAR>, b: F) -> Expr<'var, VAR> {
- loop {}
-}
-
-fn main() {
- let ex = |x| { //~ ERROR type annotations needed
- let_(add(x,x), |y| {
- let_(add(x, x), |x|x)})};
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(associated_type_defaults)]
-
-trait Foo { type T; }
-trait Bar {
- type Foo: Foo;
- type FooT = <<Self as Bar>::Foo>::T; //~ ERROR ambiguous associated type
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-tidy-linelength
-
-//~^^^^^^^^^^^^ ERROR
-
-#![feature(optin_builtin_traits)]
-
-unsafe auto trait Trait {
-//~^ ERROR E0380
- type Output;
-}
-
-fn call_method<T: Trait>(x: T) {}
-
-fn main() {
- // ICE
- call_method(());
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-tidy-linelength
-
-#![feature(optin_builtin_traits)]
-
-unsafe auto trait Trait {
-//~^ ERROR E0380
- fn method(&self) {
- println!("Hello");
- }
-}
-
-fn call_method<T: Trait>(x: T) {
- x.method();
-}
-
-fn main() {
- // ICE
- call_method(());
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Next {
- type Next: Next;
-}
-
-struct GetNext<T: Next> { t: T }
-
-impl<T: Next> Next for GetNext<T> {
- //~^ ERROR overflow evaluating the requirement
- type Next = <GetNext<T> as Next>::Next;
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Next {
- type Next: Next;
-}
-
-struct GetNext<T: Next> { t: T }
-
-impl<T: Next> Next for GetNext<T> {
- //~^ ERROR overflow evaluating the requirement
- type Next = <GetNext<T::Next> as Next>::Next;
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-enum Foo { Bar }
-
-fn main() {
- Foo::Bar.a;
- //~^ no field `a` on type `Foo`
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-tidy-linelength
-
-pub struct Struct;
-
-impl Struct {
- pub fn function(funs: Vec<Fn() -> ()>) {}
- //~^ ERROR the size for values of type
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-enum chan { }
-
-trait channel<T> {
- fn send(&self, v: T);
-}
-
-// `chan` is not a trait, it's an enum
-impl chan for isize { //~ ERROR expected trait, found enum `chan`
- fn send(&self, v: isize) { panic!() }
-}
-
-fn main() {
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- let v: Vec(&str) = vec!['1', '2'];
- //~^ ERROR parenthesized parameters may only be used with a trait
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(associated_type_defaults)]
-
-use std::ops::{Index};
-
-trait Hierarchy {
- type Value;
- type ChildKey;
- type Children = Index<Self::ChildKey, Output=Hierarchy>;
- //~^ ERROR: the value of the associated type `ChildKey`
- //~^^ ERROR: the value of the associated type `Children`
- //~^^^ ERROR: the value of the associated type `Value`
-
- fn data(&self) -> Option<(Self::Value, Self::Children)>;
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(associated_type_defaults)]
-
-pub struct C<AType: A> {a:AType}
-
-pub trait A {
- type B = C<Self::anything_here_kills_it>;
- //~^ ERROR: associated type `anything_here_kills_it` not found for `Self`
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- "".chars().fold(|_, _| (), ());
- //~^ ERROR E0277
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- use std::mem::{transmute, swap};
- let a = 1;
- let b = 2;
- unsafe {swap::<&mut _>(transmute(&a), transmute(&b))};
- //~^ ERROR type annotations needed
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![allow(dead_code)]
-
-trait MultiDispatch<T> {
- type O;
-}
-
-trait Trait: Sized {
- type A: MultiDispatch<Self::B, O = Self>;
- type B;
-
- fn new<U>(u: U) -> <Self::A as MultiDispatch<U>>::O where Self::A : MultiDispatch<U>;
-}
-
-fn test<T: Trait<B=i32>>(b: i32) -> T where T::A: MultiDispatch<i32> { T::new(b) }
-//~^ ERROR type mismatch resolving
-
-fn main() {}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Ensure that we reject code when a nonlocal exit (`break`,
-// `continue`) causes us to pop over a needed assignment.
-
-pub fn main() {
- foo1();
- foo2();
-}
-
-pub fn foo1() {
- let x: i32;
- loop { x = break; }
- println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x`
-}
-
-pub fn foo2() {
- let x: i32;
- for _ in 0..10 { x = continue; }
- println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x`
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct B;
-
-impl B {
- fn func(&self) -> u32 { 42 }
-}
-
-fn main() {
- let x: &fn(&B) -> u32 = &B::func; //~ ERROR mismatched types
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- 1.0f64 - 1.0;
- 1.0f64 - 1 //~ ERROR E0277
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct NoCopy;
-fn main() {
- let x = NoCopy;
- let f = move || { let y = x; };
- //~^ NOTE value moved (into closure) here
- let z = x;
- //~^ ERROR use of moved value: `x`
- //~| NOTE value used here after move
- //~| NOTE move occurs because `x` has type `NoCopy`
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- 1.create_a_type_error[ //~ `{integer}` is a primitive type and therefore doesn't have fields
- ()+() //~ ERROR binary operation `+` cannot be applied
- // ^ ensure that we typeck the inner expression ^
- ];
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub enum Attribute {
- Code {attr_name_idx: u16},
-}
-
-pub enum Foo {
- Bar
-}
-
-fn test(a: Foo) {
- println!("{}", a.b); //~ no field `b` on type `Foo`
-}
-
-fn main() {
- let x = Attribute::Code {
- attr_name_idx: 42,
- };
- let z = (&x).attr_name_idx; //~ no field `attr_name_idx` on type `&Attribute`
- let y = x.attr_name_idx; //~ no field `attr_name_idx` on type `Attribute`
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- static foo: Fn() -> u32 = || -> u32 {
- //~^ ERROR mismatched types
- //~| ERROR the size for values of type
- 0
- };
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait A: Sized {
- type N;
- fn x() ->
- Self<
- N= //~ ERROR associated type bindings are not allowed here
- Self::N> {
- loop {}
- }
- fn y(&self) ->
- std
- <N=()> //~ ERROR associated type bindings are not allowed here
- ::option::Option<()>
- { None }
- fn z(&self) ->
- u32<N=()> //~ ERROR associated type bindings are not allowed here
- { 42 }
-
-}
-
-fn main() {
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use std::collections::HashSet;
-
-fn main() {
- let mut v = Vec::new();
- foo(&mut v);
- //~^ ERROR mismatched types
- //~| expected struct `std::collections::HashSet`, found struct `std::vec::Vec`
-}
-
-fn foo(h: &mut HashSet<u32>) {
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(rustc_attrs)]
-
-mod a {
- pub mod b { pub struct Foo; }
-
- pub mod c {
- use super::b;
- pub struct Bar(pub b::Foo);
- }
-
- pub use self::c::*;
-}
-
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
- let _ = a::c::Bar(a::b::Foo);
- let _ = a::Bar(a::b::Foo);
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct S;
-
-trait InOut<T> { type Out; }
-
-fn do_fold<B, F: InOut<B, Out=B>>(init: B, f: F) {}
-
-fn bot<T>() -> T { loop {} }
-
-fn main() {
- do_fold(bot(), ()); //~ ERROR `(): InOut<_>` is not satisfied
-}
+++ /dev/null
-// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-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::sync::mpsc::channel;
-use std::thread::spawn;
-use std::marker::PhantomData;
-
-struct Foo<T> {foo: PhantomData<T>}
-
-fn main() {
- let (tx, rx) = channel();
-
- spawn(move || {
- tx.send(Foo{ foo: PhantomData }); //~ ERROR E0282
- });
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-mod stuff {
- pub struct Item {
- c_object: Box<CObj>,
- }
- pub struct CObj {
- name: Option<String>,
- }
- impl Item {
- pub fn new() -> Item {
- Item {
- c_object: Box::new(CObj { name: None }),
- }
- }
- }
-}
-
-macro_rules! check_ptr_exist {
- ($var:expr, $member:ident) => (
- (*$var.c_object).$member.is_some()
- //~^ ERROR field `name` of struct `stuff::CObj` is private
- //~^^ ERROR field `c_object` of struct `stuff::Item` is private
- );
-}
-
-fn main() {
- let item = stuff::Item::new();
- println!("{}", check_ptr_exist!(item, name));
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use foo::baz;
-use bar::baz; //~ ERROR the name `baz` is defined multiple times
-
-use foo::Quux;
-use bar::Quux; //~ ERROR the name `Quux` is defined multiple times
-
-use foo::blah;
-use bar::blah; //~ ERROR the name `blah` is defined multiple times
-
-use foo::WOMP;
-use bar::WOMP; //~ ERROR the name `WOMP` is defined multiple times
-
-fn main() {}
-
-mod foo {
- pub mod baz {}
- pub trait Quux { }
- pub type blah = (f64, u32);
- pub const WOMP: u8 = 5;
-}
-
-mod bar {
- pub mod baz {}
- pub type Quux = i32;
- pub struct blah { x: i8 }
- pub const WOMP: i8 = -5;
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Helper<'a, F: 'a>(&'a F);
-
-fn fix<F>(f: F) -> i32 where F: Fn(Helper<F>, i32) -> i32 {
- f(Helper(&f), 8)
-}
-
-fn main() {
- fix(|_, x| x); //~ ERROR closure/generator type that references itself [E0644]
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
-#![feature(rustc_attrs)]
-
-enum Sexpression {
- Num(()),
- Cons(&'static mut Sexpression)
-}
-
-fn causes_error_in_ast(mut l: &mut Sexpression) {
- loop { match l {
- &mut Sexpression::Num(ref mut n) => {},
- &mut Sexpression::Cons(ref mut expr) => { //[ast]~ ERROR [E0499]
- l = &mut **expr; //[ast]~ ERROR [E0506]
- }
- }}
-}
-
-#[rustc_error]
-fn main() { //[mir]~ ERROR compilation successful
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct S<T: 'static>(Option<&'static T>);
-
-trait Tr { type Out; }
-impl<T> Tr for T { type Out = T; }
-
-impl<T: 'static> Copy for S<T> where S<T>: Tr<Out=T> {}
-impl<T: 'static> Clone for S<T> where S<T>: Tr<Out=T> {
- fn clone(&self) -> Self { *self }
-}
-fn main() {
- let t = S::<()>(None);
- drop(t);
- drop(t); //~ ERROR use of moved value
-}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-
-struct parser {
- tokens: Vec<isize> ,
-}
-
-trait parse {
- fn parse(&self) -> Vec<isize> ;
-}
-
-impl parse for parser {
- fn parse(&self) -> Vec<isize> {
- self.tokens //~ ERROR cannot move out of borrowed content
- }
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct A;
-struct B;
-
-static S: &'static B = &A;
-//~^ ERROR calls in statics are limited to constant functions
-
-use std::ops::Deref;
-
-impl Deref for A {
- type Target = B;
- fn deref(&self)->&B { static B_: B = B; &B_ }
-}
-
-fn main(){}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-macro_rules! some_macro {
- ($other: expr) => ({
- $other(None)
- //~^ this function takes 0 parameters but 1 parameter was supplied
- })
-}
-
-fn some_function() {}
-
-fn main() {
- some_macro!(some_function);
- //~^ in this expansion of some_macro!
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(slice_patterns)]
-
-fn main() {
- let x: &[u32] = &[];
- let &[[ref _a, ref _b..]..] = x; //~ ERROR refutable pattern
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn foo<T>() where for<'a> T: 'a {}
-
-fn main<'a>() {
- foo::<&'a i32>();
- //~^ ERROR the type `&'a i32` does not fulfill the required lifetime
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-macro_rules! macro_panic {
- ($not_a_function:expr, $some_argument:ident) => {
- $not_a_function($some_argument)
- //~^ ERROR expected function, found `{integer}`
- }
-}
-
-fn main() {
- let mut value_a = 0;
- let mut value_b = 0;
- macro_panic!(value_a, value_b);
- //~^ in this expansion of macro_panic!
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Check that projections don't count as constraining type parameters.
-
-struct S<T>(T);
-
-trait Tr { type Assoc; fn test(); }
-
-impl<T: Tr> S<T::Assoc> {
-//~^ ERROR the type parameter `T` is not constrained
- fn foo(self, _: T) {
- T::test();
- }
-}
-
-trait Trait1<T> { type Bar; }
-trait Trait2<'x> { type Foo; }
-
-impl<'a,T: Trait2<'a>> Trait1<<T as Trait2<'a>>::Foo> for T {
-//~^ ERROR the lifetime parameter `'a` is not constrained
- type Bar = &'a ();
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- match 'a' {
- char{ch} => true
- //~^ ERROR expected struct, variant or union type, found builtin type `char`
- };
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// error-pattern: cycle detected when computing layout of
-// note-pattern: ...which requires computing layout of
-// note-pattern: ...which again requires computing layout of
-
-trait Mirror { type It: ?Sized; }
-impl<T: ?Sized> Mirror for T { type It = Self; }
-struct S(Option<<S as Mirror>::It>);
-
-fn main() {
- let _s = S(None);
-}
+++ /dev/null
-// 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.
-
-#![feature(rustc_attrs)]
-#![allow(warnings)]
-
-trait Mirror {
- type It;
-}
-
-impl<T> Mirror for T {
- type It = Self;
-}
-
-
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
- let c: <u32 as Mirror>::It = 5;
- const CCCC: <u32 as Mirror>::It = 5;
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(default_type_parameter_fallback)]
-
-fn avg<T=T::Item>(_: T) {}
-//~^ ERROR type parameters with a default cannot use forward declared identifiers
-
-fn main() {}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(unsize, coerce_unsized)]
-
-// Verfies that non-PhantomData ZSTs still cause coercions to fail.
-// They might have additional semantics that we don't want to bulldoze.
-
-use std::marker::{Unsize, PhantomData};
-use std::ops::CoerceUnsized;
-
-struct NotPhantomData<T: ?Sized>(PhantomData<T>);
-
-struct MyRc<T: ?Sized> {
- _ptr: *const T,
- _boo: NotPhantomData<T>,
-}
-
-impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<MyRc<U>> for MyRc<T>{ } //~ERROR
-
-fn main() {
- let data = [1, 2, 3];
- let iter = data.iter();
- let x = MyRc { _ptr: &iter, _boo: NotPhantomData(PhantomData) };
- let _y: MyRc<Iterator<Item=&u32>> = x;
-}
-
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(rustc_attrs)]
-#![allow(unused)]
-
-extern crate core;
-use core as core_export;
-use self::x::*;
-mod x {}
-
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- enum Foo { A { x: u32 } }
- let orig = Foo::A { x: 5 };
- Foo::A { x: 6, ..orig };
- //~^ ERROR functional record update syntax requires a struct
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct S;
-
-fn main() {
- let b = [0; S];
- //~^ ERROR mismatched types
- //~| expected type `usize`
- //~| found type `S`
- //~| expected usize, found struct `S`
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- match Some(1) {
- None @ _ => {} //~ ERROR match bindings cannot shadow unit variants
- };
- const C: u8 = 1;
- match 1 {
- C @ 2 => { //~ ERROR match bindings cannot shadow constant
- println!("{}", C);
- }
- _ => {}
- };
-}
+++ /dev/null
-// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Regression test for #27042. Test that a loop's label is included in its span.
-
-fn main() {
- let _: i32 =
- 'a: // in this case, the citation is just the `break`:
- loop { break }; //~ ERROR mismatched types
- let _: i32 =
- 'b: //~ ERROR mismatched types
- while true { break }; // but here we cite the whole loop
- let _: i32 =
- 'c: //~ ERROR mismatched types
- for _ in None { break }; // but here we cite the whole loop
- let _: i32 =
- 'd: //~ ERROR mismatched types
- while let Some(_) = None { break };
-}
+++ /dev/null
-// 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.
-
-#[repr(packed)]
-pub struct Bad<T: ?Sized> {
- data: T, //~ ERROR the size for values of type
-}
-
-fn main() {}
+++ /dev/null
-// 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.
-
-#![feature(associated_consts)]
-
-trait Foo {
- const BAR: i32;
- fn foo(self) -> &'static i32 {
- //~^ ERROR the size for values of type
- &<Self>::BAR
- }
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub struct send_packet<T> {
- p: T
-}
-
-mod pingpong {
- use send_packet;
- pub type ping = send_packet<pong>;
- pub struct pong(send_packet<ping>);
- //~^ ERROR recursive type `pingpong::pong` has infinite size
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Foo;
-#[derive(Copy, Clone)]
-//~^ ERROR the trait `Copy` may not be implemented for this type
-struct Bar(Foo);
-
-fn main() {}
+++ /dev/null
-// 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 main() {
- let foo = 42u32;
- const FOO : u32 = foo;
- //~^ ERROR can't capture dynamic environment
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Regression test for issue #27592.
-
-fn write<'a, F: ::std::ops::FnOnce()->::std::fmt::Arguments<'a> + 'a>(fcn: F) {
- use std::fmt::Write;
- let _ = match fcn() { a => write!(&mut Stream, "{}", a), };
-}
-
-struct Stream;
-impl ::std::fmt::Write for Stream {
- fn write_str(&mut self, _s: &str) -> ::std::fmt::Result {
- Ok( () )
- }
-}
-
-fn main() {
- write(|| format_args!("{}", String::from("Hello world")));
- //~^ ERROR borrowed value does not live long enough
- //~| ERROR borrowed value does not live long enough
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-mod A {}
-
-fn main() {
- let u = A { x: 1 }; //~ ERROR expected struct, variant or union type, found module `A`
- let v = u32 { x: 1 }; //~ ERROR expected struct, variant or union type, found builtin type `u32`
- match () {
- A { x: 1 } => {}
- //~^ ERROR expected struct, variant or union type, found module `A`
- u32 { x: 1 } => {}
- //~^ ERROR expected struct, variant or union type, found builtin type `u32`
- }
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- let i = 5;
- let index = 6;
-
- match i {
- 0..=index => println!("winner"),
- //~^ ERROR runtime values cannot be referenced in patterns
- _ => println!("hello"),
- }
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- let _ = Iterator::next(&mut ());
- //~^ ERROR `(): std::iter::Iterator` is not satisfied
-
- for _ in false {}
- //~^ ERROR `bool: std::iter::Iterator` is not satisfied
-
- let _ = Iterator::next(&mut ());
- //~^ ERROR `(): std::iter::Iterator` is not satisfied
-
- other()
-}
-
-pub fn other() {
- // check errors are still reported globally
-
- let _ = Iterator::next(&mut ());
- //~^ ERROR `(): std::iter::Iterator` is not satisfied
-
- let _ = Iterator::next(&mut ());
- //~^ ERROR `(): std::iter::Iterator` is not satisfied
-
- for _ in false {}
- //~^ ERROR `bool: std::iter::Iterator` is not satisfied
-}
+++ /dev/null
-// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Make sure that a continue span actually contains the keyword.
-
-fn main() {
- continue //~ ERROR `continue` outside of loop
- ;
- break //~ ERROR `break` outside of loop
- ;
-}
+++ /dev/null
-// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Make sure that label for continue and break is spanned correctly
-
-fn main() {
- loop {
- continue
- 'b //~ ERROR use of undeclared label
- ;
- break
- 'c //~ ERROR use of undeclared label
- ;
- }
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![allow(warnings)]
-
-const X: u8 =
- || -> u8 { 5 }()
- //~^ ERROR calls in constants are limited to constant functions
-;
-
-fn main() {}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct C {
- x: isize,
-}
-
-impl Drop for C {
- fn drop(&mut self) {
- println!("dropping: {}", self.x);
- }
-}
-
-fn main() {
- let c = C{ x: 2};
- let _d = c.clone(); //~ ERROR no method named `clone` found
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![allow(safe_extern_statics)]
-
-extern {
- static error_message_count: u32;
-}
-
-pub static BAZ: u32 = *&error_message_count;
-//~^ ERROR could not evaluate static initializer
-//~| tried to read from foreign (extern) static
-
-fn main() {}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use std::ops::BitXor;
-
-fn main() {
- let x: u8 = BitXor::bitor(0 as u8, 0 as u8);
- //~^ ERROR must be specified
- //~| no function or associated item named
-
- let g = BitXor::bitor;
- //~^ ERROR must be specified
- //~| no function or associated item named
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// compile-flags: -Z continue-parse-after-error
-
-enum bird {
- pub duck,
- //~^ ERROR: expected identifier, found keyword `pub`
- //~| ERROR: expected
- goose
-}
-
-
-fn main() {
- let y = bird::goose;
-}
+++ /dev/null
-// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Check that the visibility modifier is included in the span of foreign items.
-
-extern {
- fn foo();
-
- pub //~ ERROR the name `foo` is defined multiple times
- fn foo();
-
- pub //~ ERROR the name `foo` is defined multiple times
- static mut foo: u32;
-}
-
-fn main() {
-}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-enum foo { alpha, beta(isize) }
-
-fn main() {
- match foo::alpha {
- foo::alpha | foo::beta(i) => {}
- //~^ ERROR variable `i` is not bound in all patterns
- }
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub trait Foo<RHS=Self> {
- type Assoc;
-}
-
-pub trait Bar: Foo<Assoc=()> {
- fn new(&self, b: &
- Bar //~ ERROR the trait `Bar` cannot be made into an object
- <Assoc=()>
- );
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Regression test for issue #28586
-
-pub trait Foo {}
-impl Foo for [u8; usize::BYTES] {}
-//~^ ERROR no associated item named `BYTES` found for type `usize`
-
-fn main() { }
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Bar {
- type Bar;
-}
-
-struct ArrayPeano<T: Bar> {
- data: T::Bar,
-}
-
-fn foo<T>(a: &ArrayPeano<T>) -> &[T] where T: Bar {
- unsafe { std::mem::transmute(a) } //~ ERROR transmute called with types of different sizes
-}
-
-impl Bar for () {
- type Bar = ();
-}
-
-fn main() {
- let x: ArrayPeano<()> = ArrayPeano { data: () };
- foo(&x);
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Can't use constants as tuple struct patterns
-
-
-const C1: i32 = 0;
-
-struct S;
-
-impl S {
- const C2: i32 = 0;
-}
-
-fn main() {
- if let C1(..) = 0 {} //~ ERROR expected tuple struct/variant, found constant `C1`
- if let S::C2(..) = 0 {}
- //~^ ERROR expected tuple struct/variant, found associated constant `<S>::C2`
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-macro_rules! foo {
- ($d:expr) => {{
- fn bar(d: u8) { }
- bar(&mut $d);
- //~^ ERROR mismatched types
- //~| expected u8, found &mut u8
- //~| expected type `u8`
- //~| found type `&mut u8`
- }}
-}
-
-fn main() {
- foo!(0u8);
- //~^ in this expansion of foo!
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![recursion_limit="1024"]
-
-pub struct S0<T>(T,T);
-pub struct S1<T>(Option<Box<S0<S0<T>>>>,Option<Box<S0<S0<T>>>>);
-pub struct S2<T>(Option<Box<S1<S1<T>>>>,Option<Box<S1<S1<T>>>>);
-pub struct S3<T>(Option<Box<S2<S2<T>>>>,Option<Box<S2<S2<T>>>>);
-pub struct S4<T>(Option<Box<S3<S3<T>>>>,Option<Box<S3<S3<T>>>>);
-pub struct S5<T>(Option<Box<S4<S4<T>>>>,Option<Box<S4<S4<T>>>>,Option<T>);
-
-trait Foo { fn xxx(&self); }
-trait Bar {} // anything local or #[fundamental]
-
-impl<T> Foo for T where T: Bar, T: Sync {
- fn xxx(&self) {}
-}
-
-impl Foo for S5<u32> { fn xxx(&self) {} }
-impl Foo for S5<u64> { fn xxx(&self) {} }
-
-fn main() {
- let _ = <S5<_>>::xxx; //~ ERROR cannot resolve `S5<_>: Foo`
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-mod a {
- struct A;
-
- impl Default for A {
- pub fn default() -> A { //~ ERROR unnecessary visibility qualifier
- A
- }
- }
-}
-
-
-fn main() {
- a::A::default();
- //~^ ERROR struct `A` is private
- }
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- let x: typeof(92) = 92; //~ ERROR `typeof` is a reserved keyword
-}
+++ /dev/null
-// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use m::f as x; //~ ERROR unresolved import `m::f` [E0432]
- //~^ no `f` in `m`
-
-mod m {}
-
-fn main() {}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn foo<T, U>(x: T, y: U) {
- let mut xx = x;
- xx = y;
- //~^ ERROR mismatched types
- //~| expected type `T`
- //~| found type `U`
- //~| expected type parameter, found a different type parameter
-}
-
-fn main() {
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-
-#![feature(rustc_attrs)]
-
-use std::marker::PhantomData;
-
-pub trait Foo<P> {}
-
-impl <P, T: Foo<P>> Foo<P> for Option<T> {}
-
-pub struct Qux<T> (PhantomData<*mut T>);
-
-impl<T> Foo<*mut T> for Option<Qux<T>> {}
-
-pub trait Bar {
- type Output: 'static;
-}
-
-impl<T: 'static, W: Bar<Output = T>> Foo<*mut T> for W {}
-
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub trait MakeRef<'a> {
- type Ref;
-}
-impl<'a, T: 'a> MakeRef<'a> for T {
- type Ref = &'a T;
-}
-
-pub trait MakeRef2 {
- type Ref2;
-}
-impl<'a, T: 'a> MakeRef2 for T {
-//~^ ERROR the lifetime parameter `'a` is not constrained
- type Ref2 = <T as MakeRef<'a>>::Ref;
-}
-
-fn foo() -> <String as MakeRef2>::Ref2 { &String::from("foo") }
-
-fn main() {
- println!("{}", foo());
-}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn bad (p: *const isize) {
- let _q: &isize = p as &isize; //~ ERROR non-primitive cast
-}
-
-fn main() { }
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct SemiPriv;
-
-mod m1 {
- struct Priv;
- impl ::SemiPriv {
- pub fn f(_: Priv) {} //~ WARN private type `m1::Priv` in public interface
- //~^ WARNING hard error
- }
-
- impl Priv {
- pub fn f(_: Priv) {} // ok
- }
-}
-
-mod m2 {
- struct Priv;
- impl ::std::ops::Deref for ::SemiPriv {
- type Target = Priv; //~ ERROR private type `m2::Priv` in public interface
- fn deref(&self) -> &Self::Target { unimplemented!() }
- }
-
- impl ::std::ops::Deref for Priv {
- type Target = Priv; // ok
- fn deref(&self) -> &Self::Target { unimplemented!() }
- }
-}
-
-trait SemiPrivTrait {
- type Assoc;
-}
-
-mod m3 {
- struct Priv;
- impl ::SemiPrivTrait for () {
- type Assoc = Priv; //~ ERROR private type `m3::Priv` in public interface
- }
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use std::marker;
-
-enum E1 { V1(E2<E1>), }
-enum E2<T> { V2(E2<E1>, marker::PhantomData<T>), }
-//~^ ERROR recursive type `E2` has infinite size
-
-impl E1 { fn foo(&self) {} }
-
-fn main() {
-}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn siphash(k0 : u64) {
-
- struct siphash {
- v0: u64,
- }
-
- impl siphash {
- pub fn reset(&mut self) {
- self.v0 = k0 ^ 0x736f6d6570736575; //~ ERROR can't capture dynamic environment
- }
- }
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn siphash<T>() {
-
- trait t {
- fn g(&self, x: T) -> T; //~ ERROR can't use type parameters from outer function
- //~^ ERROR can't use type parameters from outer function
- }
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait siphash {
- fn result(&self) -> u64;
- fn reset(&self);
-}
-
-fn siphash(k0 : u64, k1 : u64) {
- struct SipState {
- v0: u64,
- v1: u64,
- }
-
- fn mk_result(st : &SipState) -> u64 {
-
- let v0 = st.v0;
- let v1 = st.v1;
- return v0 ^ v1;
- }
-
- impl siphash for SipState {
- fn reset(&self) {
- self.v0 = k0 ^ 0x736f6d6570736575; //~ ERROR can't capture dynamic environment
- self.v1 = k1 ^ 0x646f72616e646f6d; //~ ERROR can't capture dynamic environment
- }
- fn result(&self) -> u64 { return mk_result(self); }
- }
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait SipHash {
- fn reset(&self);
-}
-
-fn siphash(k0 : u64) {
- struct SipState {
- v0: u64,
- }
-
- impl SipHash for SipState {
- fn reset(&self) {
- self.v0 = k0 ^ 0x736f6d6570736575; //~ ERROR can't capture dynamic environment
- }
- }
- panic!();
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Regression test for #30225, which was an ICE that would trigger as
-// a result of a poor interaction between trait result caching and
-// type inference. Specifically, at that time, unification could cause
-// unrelated type variables to become instantiated, if subtyping
-// relationships existed. These relationships are now propagated
-// through obligations and hence everything works out fine.
-
-trait Foo<U,V> : Sized {
- fn foo(self, u: Option<U>, v: Option<V>) {}
-}
-
-struct A;
-struct B;
-
-impl Foo<A, B> for () {} // impl A
-impl Foo<u32, u32> for u32 {} // impl B, creating ambiguity
-
-fn toxic() {
- // cache the resolution <() as Foo<$0,$1>> = impl A
- let u = None;
- let v = None;
- Foo::foo((), u, v);
-}
-
-fn bomb() {
- let mut u = None; // type is Option<$0>
- let mut v = None; // type is Option<$1>
- let mut x = None; // type is Option<$2>
-
- Foo::foo(x.unwrap(),u,v); // register <$2 as Foo<$0, $1>>
- u = v; // mark $0 and $1 in a subtype relationship
- //~^ ERROR mismatched types
- x = Some(()); // set $2 = (), allowing impl selection
- // to proceed for <() as Foo<$0, $1>> = impl A.
- // kaboom, this *used* to trigge an ICE
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-type Foo<
- Unused //~ ERROR type parameter `Unused` is unused
- > = u8;
-
-fn main() {
-
-}
-
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![deny(unreachable_patterns)]
-
-fn main() {
- match "world" {
- "hello" => {}
- _ => {},
- }
-
- match "world" {
- ref _x if false => {}
- "hello" => {}
- "hello" => {} //~ ERROR unreachable pattern
- _ => {},
- }
-}
-
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- match "world" { //~ ERROR non-exhaustive patterns: `&_`
- "hello" => {}
- }
-
- match "world" { //~ ERROR non-exhaustive patterns: `&_`
- ref _x if false => {}
- "hello" => {}
- }
-}
+++ /dev/null
-// 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.
-
-pub struct X([u8]);
-
-pub static Y: &'static X = {
- const Y: &'static [u8] = b"";
- &X(*Y)
- //~^ ERROR cannot move out
- //~^^ ERROR cannot move a
- //~^^^ ERROR cannot move a
-};
-
-fn main() {}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-enum f { g(isize, isize) }
-
-enum h { i(j, k) }
-
-enum j { l(isize, isize) }
-enum k { m(isize, isize) }
-
-fn main()
-{
-
- let _z = match f::g(1, 2) {
- f::g(x, x) => { println!("{}", x + x); }
- //~^ ERROR identifier `x` is bound more than once in the same pattern
- };
-
- let _z = match h::i(j::l(1, 2), k::m(3, 4)) {
- h::i(j::l(x, _), k::m(_, x))
- //~^ ERROR identifier `x` is bound more than once in the same pattern
- => { println!("{}", x + x); }
- };
-
- let _z = match (1, 2) {
- (x, x) => { x } //~ ERROR identifier `x` is bound more than once in the same pattern
- };
-
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Original regression test for Issue #30438.
-
-use std::ops::Index;
-
-struct Test<'a> {
- s: &'a String
-}
-
-impl <'a> Index<usize> for Test<'a> {
- type Output = Test<'a>;
- fn index(&self, _: usize) -> &Self::Output {
- return &Test { s: &self.s};
- //~^ ERROR: borrowed value does not live long enough
- }
-}
-
-fn main() {
- let s = "Hello World".to_string();
- let test = Test{s: &s};
- let r = &test[0];
- println!("{}", test.s); // OK since test is valid
- println!("{}", r.s); // Segfault since value pointed by r has already been dropped
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Modified regression test for Issue #30438 that exposed an
-// independent issue (see discussion on ticket).
-
-use std::ops::Index;
-
-struct Test<'a> {
- s: &'a String
-}
-
-impl <'a> Index<usize> for Test<'a> {
- type Output = Test<'a>;
- fn index(&self, _: usize) -> &Self::Output {
- &Test { s: &self.s}
- //~^ ERROR: borrowed value does not live long enough
- }
-}
-
-fn main() {
- let s = "Hello World".to_string();
- let test = Test{s: &s};
- let r = &test[0];
- println!("{}", test.s); // OK since test is valid
- println!("{}", r.s); // Segfault since value pointed by r has already been dropped
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Simplified regression test for #30438, inspired by arielb1.
-
-trait Trait { type Out; }
-
-struct Test<'a> { s: &'a str }
-
-fn silly<'y, 'z>(_s: &'y Test<'z>) -> &'y <Test<'z> as Trait>::Out where 'z: 'static {
- let x = Test { s: "this cannot last" };
- &x
- //~^ ERROR: `x` does not live long enough
-}
-
-impl<'b> Trait for Test<'b> { type Out = Test<'b>; }
-
-fn main() {
- let orig = Test { s: "Hello World" };
- let r = silly(&orig);
- println!("{}", orig.s); // OK since `orig` is valid
- println!("{}", r.s); // Segfault (method does not return a sane value)
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-type Alias = ();
-use Alias::*;
-//~^ ERROR unresolved import `Alias` [E0432]
-//~| Not a module `Alias`
-use std::io::Result::*;
-//~^ ERROR unresolved import `std::io::Result` [E0432]
-//~| Not a module `Result`
-
-trait T {}
-use T::*; //~ ERROR items in traits are not importable
-
-fn main() {}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use std::fmt;
-
-impl fmt::Display for DecoderError { //~ ERROR cannot find type `DecoderError` in this scope
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "Missing data: {}", self.0)
- }
-}
-fn main() {
-}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct x(());
-impl x {
- pub unsafe fn with(&self) { }
-}
-
-fn main() {
- x(()).with(); //~ ERROR requires unsafe function or block
-}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- match () { } //~ ERROR non-exhaustive
-}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-enum bottom { }
-
-fn main() {
- let x = &() as *const () as *const bottom;
- match x { } //~ ERROR non-exhaustive patterns
-}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-enum a { b, c }
-
-enum a { d, e } //~ ERROR the name `a` is defined multiple times
-
-fn main() {}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub mod a {}
-
-pub mod a {} //~ ERROR the name `a` is defined multiple times
-
-fn main() {}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn a(x: String) -> String {
- format!("First function with {}", x)
-}
-
-fn a(x: String, y: String) -> String { //~ ERROR the name `a` is defined multiple times
- format!("Second function with {} and {}", x, y)
-}
-
-fn main() {
- println!("Result: ");
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-macro_rules! log {
- ( $ctx:expr, $( $args:expr),* ) => {
- if $ctx.trace {
- //~^ no field `trace` on type `&T`
- println!( $( $args, )* );
- }
- }
-}
-
-// Create a structure.
-struct Foo {
- trace: bool,
-}
-
-// Generic wrapper calls log! with a structure.
-fn wrap<T>(context: &T) -> ()
-{
- log!(context, "entered wrapper");
- //~^ in this expansion of log!
-}
-
-fn main() {
- // Create a structure.
- let x = Foo { trace: true };
- log!(x, "run started");
- // Apply a closure which accesses internal fields.
- wrap(&x);
- log!(x, "run finished");
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- // FIXME(#31407) this error should go away, but in the meantime we test that it
- // is accompanied by a somewhat useful error message.
- let _: f64 = 1234567890123456789012345678901234567890e-340;
- //~^ ERROR could not evaluate float literal (see issue #31407)
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use std::vec::IntoIter;
-
-pub fn get_tok(it: &mut IntoIter<u8>) {
- let mut found_e = false;
-
- let temp: Vec<u8> = it.take_while(|&x| {
- found_e = true;
- false
- })
- .cloned()
- //~^ ERROR type mismatch resolving
- //~| expected type `u8`
- //~| found type `&_`
- .collect(); //~ ERROR no method named `collect`
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// This checks that a path that cannot be resolved because of an indeterminate import
-// does not trigger an ICE.
-
-mod foo {
- pub use self::*; //~ ERROR unresolved
-}
-
-fn main() {
- foo::f(); //~ ERROR cannot find function `f` in module `foo`
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// compile-flags: --cfg foo(bar)
-// error-pattern: invalid predicate in --cfg command line argument: `foo`
-fn main() {}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn cast_thin_to_fat(x: *const ()) {
- x as *const [u8];
- //~^ ERROR: cannot cast thin pointer `*const ()` to fat pointer `*const [u8]`
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct thing<'a, Q:'a> {
- x: &'a Q
-}
-
-fn thing<'a,Q>(x: &Q) -> thing<'a,Q> {
- thing{ x: x } //~ ERROR 16:5: 16:18: explicit lifetime required in the type of `x` [E0621]
-}
-
-fn main() {
- thing(&());
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-enum Thing {
- Foo(u8),
- Bar,
- Baz
-}
-
-fn main() {
- let Thing::Foo(y) = Thing::Foo(1);
- //~^ ERROR refutable pattern in local binding: `Bar` not covered
-}
+++ /dev/null
-// Copyright 2012-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.
-
-fn main() {
- #[inline] struct Foo; //~ ERROR attribute should be applied to function or closure
- #[repr(C)] fn foo() {} //~ ERROR attribute should be applied to struct, enum or union
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Test that error recovery in the parser to an EOF does not give an infinite
-// spew of errors.
-
-fn main() {
- let
-} //~ ERROR expected pattern, found `}`
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Checks lexical scopes cannot see through normal module boundries
-
-fn f() {
- fn g() {}
- mod foo {
- fn h() {
- g(); //~ ERROR cannot find function `g` in this scope
- }
- }
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-
-enum Enum<T: Trait> {
- X = Trait::Number,
- //~^ ERROR mismatched types
- //~| expected isize, found i32
-}
-
-trait Trait {
- const Number: i32 = 1;
-}
-
-fn main() {}
+++ /dev/null
-// 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.
-
-#![feature(rustc_attrs)]
-#![deny(non_snake_case)]
-
-#[no_mangle]
-pub extern "C" fn SparklingGenerationForeignFunctionInterface() {}
-
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-enum Foo {
- Bar(i32),
- Baz
-}
-
-struct S;
-
-fn main() {
- match Foo::Baz {
- Foo::Bar => {}
- //~^ ERROR expected unit struct/variant or constant, found tuple variant `Foo::Bar`
- _ => {}
- }
-
- match S {
- S(()) => {}
- //~^ ERROR expected tuple struct/variant, found unit struct `S`
- }
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct S(u8);
-const C: S = S(10);
-
-fn main() {
- let C(a) = S(11); //~ ERROR expected tuple struct/variant, found constant `C`
- let C(..) = S(11); //~ ERROR expected tuple struct/variant, found constant `C`
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(rustc_attrs)]
-#![allow(dead_code)]
-
-pub type T = ();
-mod foo { pub use super::T; }
-mod bar { pub use super::T; }
-
-pub use foo::*;
-pub use bar::*;
-
-mod baz {
- pub type T = ();
- mod foo { pub use super::T as S; }
- mod bar { pub use super::foo::S as T; }
- pub use self::bar::*;
-}
-
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn foo<T>() {
- struct foo {
- x: T, //~ ERROR can't use type parameters from outer function
- }
-
- impl<T> Drop for foo<T> {
- //~^ ERROR wrong number of type arguments
- fn drop(&mut self) {}
- }
-}
-fn main() { }
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-extern {
- fn foo(a: i32, ...);
-}
-
-fn bar(_: *const u8) {}
-
-fn main() {
- unsafe {
- foo(0, bar);
- //~^ ERROR can't pass `fn(*const u8) {bar}` to variadic function
- //~| HELP cast the value to `fn(*const u8)`
- }
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(rustc_attrs)]
-#![allow(warnings)]
-
-mod foo {
- pub fn bar() {}
-}
-
-pub use foo::*;
-use b::bar;
-
-mod foobar {
- use super::*;
-}
-
-mod a {
- pub mod bar {}
-}
-
-mod b {
- pub use a::bar;
-}
-
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub trait Tr<'a> {
- type Out;
-}
-
-pub fn f<'a, T: Tr<'a>>() -> <T as Tr<'a>>::Out {}
-//~^ ERROR mismatched types
-
-pub fn main() {}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use std::mem;
-use std::marker::PhantomData;
-
-trait Foo {
- type Error;
-}
-
-struct Bar<U: Foo> {
- stream: PhantomData<U::Error>,
-}
-
-fn foo<U: Foo>(x: [usize; 2]) -> Bar<U> {
- unsafe { mem::transmute(x) }
- //~^ ERROR transmute called with types of different sizes
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![allow(dead_code)]
-#![feature(rustc_attrs)]
-
-macro_rules! foo (
- () => (
- #[derive_Clone] //~ ERROR attributes of the form
- struct T;
- );
-);
-
-macro_rules! bar (
- ($e:item) => ($e)
-);
-
-foo!();
-
-bar!(
- #[derive_Clone] //~ ERROR attributes of the form
- struct S;
-);
-
-fn main() {}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Make sure that the span of try shorthand does not include the trailing
-// semicolon;
-fn a() -> Result<i32, ()> {
- Err(5)?; //~ ERROR 14:5: 14:12
- Ok(1)
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-macro_rules! bar (
- () => ()
-);
-
-macro_rules! foo (
- () => (
- #[allow_internal_unstable] //~ ERROR allow_internal_unstable side-steps
- bar!();
- );
-);
-
-foo!();
-fn main() {}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(rustc_attrs)]
-
-pub use bar::*;
-mod bar {
- pub use super::*;
-}
-
-pub use baz::*;
-mod baz {
- pub use main as f;
-}
-
-#[rustc_error]
-pub fn main() {} //~ ERROR compilation successful
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// error-pattern: calls in statics are limited
-
-static S : u64 = { { panic!("foo"); 0 } };
-
-fn main() {
- println!("{:?}", S);
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use bar::Foo; //~ ERROR unresolved import `bar::Foo` [E0432]
- //~^ no `Foo` in `bar`
-mod bar {
- use Foo;
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(rustc_attrs)]
-#![allow(warnings)]
-
-macro_rules! foo { () => {
- let x = 1;
- macro_rules! bar { () => {x} }
- let _ = bar!();
-}}
-
-macro_rules! m { // test issue #31856
- ($n:ident) => (
- let a = 1;
- let $n = a;
- )
-}
-
-macro_rules! baz {
- ($i:ident) => {
- let mut $i = 2;
- $i = $i + 1;
- }
-}
-
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
- foo! {};
- bar! {};
-
- let mut a = true;
- baz!(a);
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use std::mem;
-
-trait Misc {}
-
-fn size_of_copy<T: Copy+?Sized>() -> usize { mem::size_of::<T>() }
-
-fn main() {
- size_of_copy::<Misc+Copy>();
- //~^ ERROR only auto traits can be used as additional traits in a trait object
- //~| ERROR the trait bound `dyn Misc: std::marker::Copy` is not satisfied
-}
+++ /dev/null
-// 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.
-
-#![allow(unused)]
-
-fn main() {
- { fn f<X: ::std::marker()::Send>() {} }
- //~^ ERROR parenthesized parameters may only be used with a trait
- //~| WARN previously accepted
-
- { fn f() -> impl ::std::marker()::Send { } }
- //~^ ERROR parenthesized parameters may only be used with a trait
- //~| WARN previously accepted
-}
-
-#[derive(Clone)]
-struct X;
-
-impl ::std::marker()::Copy for X {}
-//~^ ERROR parenthesized parameters may only be used with a trait
-//~| WARN previously accepted
+++ /dev/null
-// 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.
-
-#![allow(unused)]
-
-fn main() {
- let x: usize() = 1;
- //~^ ERROR parenthesized parameters may only be used with a trait
- //~| WARN previously accepted
-
- let b: ::std::boxed()::Box<_> = Box::new(1);
- //~^ ERROR parenthesized parameters may only be used with a trait
- //~| WARN previously accepted
-
- let p = ::std::str::()::from_utf8(b"foo").unwrap();
- //~^ ERROR parenthesized parameters may only be used with a trait
- //~| WARN previously accepted
-
- let p = ::std::str::from_utf8::()(b"foo").unwrap();
- //~^ ERROR parenthesized parameters may only be used with a trait
- //~| WARN previously accepted
-
- let o : Box<::std::marker()::Send> = Box::new(1);
- //~^ ERROR parenthesized parameters may only be used with a trait
- //~| WARN previously accepted
-
- let o : Box<Send + ::std::marker()::Sync> = Box::new(1);
- //~^ ERROR parenthesized parameters may only be used with a trait
- //~| WARN previously accepted
-}
-
-fn foo<X:Default>() {
- let d : X() = Default::default();
- //~^ ERROR parenthesized parameters may only be used with a trait
- //~| WARN previously accepted
-}
+++ /dev/null
-// 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.
-
-#![feature(rustc_attrs)]
-
-use std::fmt;
-
-// CoerceUnsized is not implemented for tuples. You can still create
-// an unsized tuple by transmuting a trait object.
-fn any<T>() -> T { unreachable!() }
-
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
- let t: &(u8, fmt::Debug) = any();
- println!("{:?}", &t.1);
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- match 0 {
- aaa::bbb(_) => ()
- //~^ ERROR failed to resolve. Use of undeclared type or module `aaa`
- };
-}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#[derive(PartialEq)]
-struct thing(usize);
-impl PartialOrd for thing { //~ ERROR not all trait items implemented, missing: `partial_cmp`
- fn le(&self, other: &thing) -> bool { true }
- fn ge(&self, other: &thing) -> bool { true }
-}
-fn main() {}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Make sure that the spans of import errors are correct.
-
-use abc::one_el;
-//~^ ERROR 13:5: 13:8
-use abc::{a, bbb, cccccc};
-//~^ ERROR 15:5: 15:8
-use a_very_long_name::{el, el2};
-//~^ ERROR 17:5: 17:21
-
-fn main() {}
+++ /dev/null
-// 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.
-
-// Shadowing a unit-like enum in a closure
-
-struct Test;
-
-fn main() {
- || {
- let Test = 1; //~ ERROR mismatched types
- };
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#[derive(Clone,
- Sync, //~ ERROR this unsafe trait should be implemented explicitly
- Copy)]
-enum Foo {}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-fn main() {
- let mut op = Some(2);
- match op {
- Some(ref v) => { let a = &mut v; },
- //~^ ERROR:cannot borrow immutable
- //~| cannot borrow mutably
- None => {},
- }
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(rustc_attrs)]
-
-macro_rules! m {
- () => { #[cfg(any())] fn f() {} }
-}
-
-trait T {}
-impl T for () { m!(); }
-
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(rustc_attrs)]
-
-macro_rules! null { ($i:tt) => {} }
-macro_rules! apply_null {
- ($i:item) => { null! { $i } }
-}
-
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
- apply_null!(#[cfg(all())] fn f() {});
-}
+++ /dev/null
-// 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 main() {
- /// comment //~ ERROR found a documentation comment that doesn't document anything
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main () {
- let sr: Vec<(u32, _, _) = vec![]; //~ ERROR expected one of `,` or `>`, found `=`
- let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_receiver)| {}).collect();
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// This is a regression test for a problem encountered around upvar
-// inference and trait caching: in particular, we were entering a
-// temporary closure kind during inference, and then caching results
-// based on that temporary kind, which led to no error being reported
-// in this particular test.
-
-fn main() {
- let inc = || {};
- inc();
-
- fn apply<F>(f: F) where F: Fn() {
- f()
- }
-
- let mut farewell = "goodbye".to_owned();
- let diary = || { //~ ERROR E0525
- farewell.push_str("!!!");
- println!("Then I screamed {}.", farewell);
- };
-
- apply(diary);
-}
+++ /dev/null
-// 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.
-
-#![allow(warnings)]
-
-trait Trait<T> {
- fn foo(_: T) {}
-}
-
-pub struct Foo<T = Box<Trait<DefaultFoo>>>; //~ ERROR cycle detected
-type DefaultFoo = Foo;
-
-fn main() {
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(rustc_attrs)]
-#![allow(unused)]
-
-macro_rules! make_item {
- () => { fn f() {} }
-}
-
-macro_rules! make_stmt {
- () => { let x = 0; }
-}
-
-fn f() {
- make_item! {}
-}
-
-fn g() {
- make_stmt! {}
-}
-
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- let _p: char = 100;
- //~^ ERROR mismatched types
- //~| expected char, found u8
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(rustc_attrs)]
-#![allow(dead_code)]
-
-trait RegularExpression: Sized {
- type Text;
-}
-
-struct ExecNoSyncStr<'a>(&'a u8);
-
-impl<'c> RegularExpression for ExecNoSyncStr<'c> {
- type Text = u8;
-}
-
-struct FindCaptures<'t, R>(&'t R::Text) where R: RegularExpression, R::Text: 't;
-
-enum FindCapturesInner<'r, 't> {
- Dynamic(FindCaptures<'t, ExecNoSyncStr<'r>>),
-}
-
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Bar<T> {
- inner: Foo<T> //~ ERROR cannot find type `Foo` in this scope
-}
-
-enum Baz<T> {
- Foo(Foo<T>) //~ ERROR cannot find type `Foo` in this scope
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- let foo = 100;
-
- static y: isize = foo + 1;
- //~^ ERROR can't capture dynamic environment
-
- println!("{}", y);
-}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- let foo = 100;
-
- #[derive(Debug)]
- enum Stuff {
- Bar = foo
- //~^ ERROR attempt to use a non-constant value in a constant
- }
-
- println!("{:?}", Stuff::Bar);
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-macro_rules! m { ($($t:tt)*) => { $($t)* } }
-
-fn main() {
- m!($t); //~ ERROR expected expression
-}
+++ /dev/null
-// 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.
-
-#![feature(rustc_attrs)]
-
-use std::mem;
-
-trait Trait1<T> {}
-trait Trait2<'a> {
- type Ty;
-}
-
-fn _ice(param: Box<for <'a> Trait1<<() as Trait2<'a>>::Ty>>) {
- let _e: (usize, usize) = unsafe{mem::transmute(param)};
-}
-
-trait Lifetime<'a> {
- type Out;
-}
-impl<'a> Lifetime<'a> for () {
- type Out = &'a ();
-}
-fn foo<'a>(x: &'a ()) -> <() as Lifetime<'a>>::Out {
- x
-}
-
-fn takes_lifetime(_f: for<'a> fn(&'a ()) -> <() as Lifetime<'a>>::Out) {
-}
-
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
- takes_lifetime(foo);
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn func<'a, T>(a: &'a [T]) -> impl Iterator<Item=&'a T> {
- a.iter().map(|a| a*a)
- //~^ ERROR binary operation `*` cannot be applied to type `&T`
-}
-
-fn main() {
- let a = (0..30).collect::<Vec<_>>();
-
- for k in func(&a) {
- println!("{}", k);
- }
-}
+++ /dev/null
-// 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.
-
-enum E {
- V([Box<E>]),
- //~^ ERROR the size for values of type
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2012-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(box_patterns)]
-#![feature(box_syntax)]
-
-struct HTMLImageData {
- image: Option<String>
-}
-
-struct ElementData {
- kind: Box<ElementKind>
-}
-
-enum ElementKind {
- HTMLImageElement(HTMLImageData)
-}
-
-enum NodeKind {
- Element(ElementData)
-}
-
-struct NodeData {
- kind: Box<NodeKind>,
-}
-
-fn main() {
- let mut id = HTMLImageData { image: None };
- let ed = ElementData { kind: box ElementKind::HTMLImageElement(id) };
- let n = NodeData {kind : box NodeKind::Element(ed)};
- // n.b. span could be better
- match n.kind {
- box NodeKind::Element(ed) => match ed.kind { //~ ERROR non-exhaustive patterns
- box ElementKind::HTMLImageElement(ref d) if d.image.is_some() => { true }
- },
- };
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
-// FIXME(#49821) -- No tip about using a let binding
-
-use std::cell::RefCell;
-
-fn main() {
- let mut r = 0;
- let s = 0;
- let x = RefCell::new((&mut r,s));
-
- let val: &_ = x.borrow().0;
- //[ast]~^ ERROR borrowed value does not live long enough [E0597]
- //[ast]~| NOTE temporary value dropped here while still borrowed
- //[ast]~| NOTE temporary value does not live long enough
- //[ast]~| NOTE consider using a `let` binding to increase its lifetime
- //[mir]~^^^^^ ERROR borrowed value does not live long enough [E0597]
- //[mir]~| NOTE temporary value does not live long enough
- //[mir]~| NOTE temporary value only lives until here
- println!("{}", val);
- //[mir]~^ borrow later used here
-}
-//[ast]~^ NOTE temporary value needs to live until here
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Unnecessary path disambiguator is ok
-
-#![feature(rustc_attrs)]
-#![allow(unused)]
-
-macro_rules! m {
- ($p: path) => {
- let _ = $p(0);
- let _: $p;
- }
-}
-
-struct Foo<T> {
- _a: T,
-}
-
-struct S<T>(T);
-
-fn f() {
- let f = Some(Foo { _a: 42 }).map(|a| a as Foo::<i32>); //~ WARN unnecessary path disambiguator
- let g: Foo::<i32> = Foo { _a: 42 }; //~ WARN unnecessary path disambiguator
-
- m!(S::<u8>); // OK, no warning
-}
-
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Foo<'a, A> {}
-//~^ ERROR parameter `'a` is never used
-//~| ERROR parameter `A` is never used
-
-fn main() {}
+++ /dev/null
-// 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.
-
-#![feature(rustc_attrs)]
-
-fn _test() -> impl Default { }
-
-#[rustc_error]
-fn main() { } //~ ERROR compilation successful
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![derive(Copy)] //~ ERROR `derive` may only be applied to structs, enums and unions
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// compile-flags: -Z continue-parse-after-error
-
-struct Foo<Self>(Self);
-//~^ ERROR expected identifier, found keyword `Self`
-
-trait Bar<Self> {}
-//~^ ERROR expected identifier, found keyword `Self`
-
-fn main() {}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn f(x:isize) {
- static child: isize = x + 1;
- //~^ ERROR can't capture dynamic environment
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct P { child: Option<Box<P>> }
-trait PTrait {
- fn getChildOption(&self) -> Option<Box<P>>;
-}
-
-impl PTrait for P {
- fn getChildOption(&self) -> Option<Box<P>> {
- static childVal: Box<P> = self.child.get();
- //~^ ERROR can't capture dynamic environment
- panic!();
- }
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- match None {
- Err(_) => ()
- //~^ ERROR mismatched types
- //~| expected type `std::option::Option<_>`
- //~| found type `std::result::Result<_, _>`
- //~| expected enum `std::option::Option`, found enum `std::result::Result`
- }
-}
+++ /dev/null
-// 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.
-
-#![feature(rustc_attrs)]
-
-pub trait Foo {
- type Bar;
-}
-
-pub trait Broken {
- type Assoc;
- fn broken(&self) where Self::Assoc: Foo;
-}
-
-impl<T> Broken for T {
- type Assoc = ();
- fn broken(&self) where Self::Assoc: Foo {
- let _x: <Self::Assoc as Foo>::Bar;
- }
-}
-
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
- let _m: &Broken<Assoc=()> = &();
-}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub trait ToPrimitive {
- fn to_int(&self) -> isize { 0 }
-}
-
-impl ToPrimitive for i32 {}
-impl ToPrimitive for isize {}
-
-trait Add {
- fn to_int(&self) -> isize;
- fn add_dynamic(&self, other: &Add) -> isize;
-}
-
-impl Add for isize {
- fn to_int(&self) -> isize { *self }
- fn add_dynamic(&self, other: &Add) -> isize {
- self.to_int() + other.to_int() //~ ERROR multiple applicable items in scope
- }
-}
-
-fn main() { }
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// aux-build:empty-struct.rs
-
-extern crate empty_struct;
-
-fn main() {
- let empty_struct::XEmpty2 = (); //~ ERROR mismatched types
- let empty_struct::XEmpty6(..) = (); //~ ERROR mismatched types
-}
+++ /dev/null
-// 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.
-
-#![feature(rustc_attrs, associated_type_defaults)]
-#![allow(warnings)]
-
-trait State: Sized {
- type NextState: State = StateMachineEnded;
- fn execute(self) -> Option<Self::NextState>;
-}
-
-struct StateMachineEnded;
-
-impl State for StateMachineEnded {
- fn execute(self) -> Option<Self::NextState> {
- None
- }
-}
-
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
-}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Obj {
- member: usize
-}
-
-impl Obj {
- pub fn boom() -> bool {
- return 1+1 == 2
- }
- pub fn chirp(&self) {
- self.boom(); //~ ERROR no method named `boom` found for type `&Obj` in the current scope
- }
-}
-
-fn main() {
- let o = Obj { member: 0 };
- o.chirp();
- 1 + 1;
-}
+++ /dev/null
-// 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.
-
-#![feature(rustc_attrs)]
-#![allow(warnings)]
-
-#[derive(Debug)]
-struct Point {
-}
-
-struct NestedA<'a, 'b> {
- x: &'a NestedB<'b>
- //~^ ERROR E0491
-}
-
-struct NestedB<'a> {
- x: &'a i32,
-}
-
-fn main() {
-}
+++ /dev/null
-// 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.
-
-// ignore-emscripten
-
-#![feature(rustc_attrs, asm)]
-
-macro_rules! interrupt_handler {
- () => {
- unsafe fn _interrupt_handler() {
- asm!("pop eax" :::: "intel");
- }
- }
-}
-interrupt_handler!{}
-
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
-}
+++ /dev/null
-// 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.
-
-#![feature(rustc_attrs)]
-
-fn foo(_: &mut i32) -> bool { true }
-
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
- let opt = Some(92);
- let mut x = 62;
-
- if let Some(_) = opt {
-
- } else if foo(&mut x) {
-
- }
-}
+++ /dev/null
-// 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.
-
-#![feature(rustc_attrs)]
-#![warn(unused)]
-
-type Z = for<'x> Send;
-//~^ WARN type alias is never used
-
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Foo<T: ?Hash> { }
-//~^ ERROR cannot find trait `Hash` in this scope
-//~^^ ERROR parameter `T` is never used
-//~^^^ WARN default bound relaxed for a type parameter, but this does nothing
-
-fn main() { }
+++ /dev/null
-// 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.
-
-#![feature(const_fn)]
-
-const fn x() {
- let t = true;
- //~^ ERROR let bindings in constant functions are unstable
- //~| ERROR statements in constant functions are unstable
- let x = || t;
- //~^ ERROR let bindings in constant functions are unstable
- //~| ERROR statements in constant functions are unstable
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- 'test_1: while break 'test_1 {}
- while break {}
- //~^ ERROR `break` or `continue` with no label
-
- 'test_2: while let true = break 'test_2 {}
- while let true = break {}
- //~^ ERROR `break` or `continue` with no label
-
- loop { 'test_3: while break 'test_3 {} }
- loop { while break {} }
- //~^ ERROR `break` or `continue` with no label
-
- loop {
- 'test_4: while break 'test_4 {}
- break;
- }
- loop {
- while break {}
- //~^ ERROR `break` or `continue` with no label
- break;
- }
-
- 'test_5: while continue 'test_5 {}
- while continue {}
- //~^ ERROR `break` or `continue` with no label
-
- 'test_6: while let true = continue 'test_6 {}
- while let true = continue {}
- //~^ ERROR `break` or `continue` with no label
-
- loop { 'test_7: while continue 'test_7 {} }
- loop { while continue {} }
- //~^ ERROR `break` or `continue` with no label
-
- loop {
- 'test_8: while continue 'test_8 {}
- continue;
- }
- loop {
- while continue {}
- //~^ ERROR `break` or `continue` with no label
- continue;
- }
-}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-mod my_mod {
- pub struct MyStruct {
- priv_field: isize
- }
- pub fn MyStruct () -> MyStruct {
- MyStruct {priv_field: 4}
- }
- impl MyStruct {
- fn happyfun(&self) {}
- }
-}
-
-fn main() {
- let my_struct = my_mod::MyStruct();
- let _woohoo = (&my_struct).priv_field;
- //~^ ERROR field `priv_field` of struct `my_mod::MyStruct` is private
-
- let _woohoo = (Box::new(my_struct)).priv_field;
- //~^ ERROR field `priv_field` of struct `my_mod::MyStruct` is private
-
- (&my_struct).happyfun(); //~ ERROR method `happyfun` is private
-
- (Box::new(my_struct)).happyfun(); //~ ERROR method `happyfun` is private
- let nope = my_struct.priv_field;
- //~^ ERROR field `priv_field` of struct `my_mod::MyStruct` is private
-}
+++ /dev/null
-// 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.
-
-// compile-flags: -Z unpretty=mir
-// ignore-cloudabi no std::path
-
-use std::path::MAIN_SEPARATOR;
-
-fn main() {
- let mut foo : String = "hello".to_string();
- foo.push(MAIN_SEPARATOR);
- println!("{}", foo);
- let x: () = 0; //~ ERROR: mismatched types
-}
+++ /dev/null
-// 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 main() {
- extern crate libc; //~ ERROR use of unstable
- use libc::*; //~ ERROR unresolved import
-}
+++ /dev/null
-// 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.
-
-#![feature(associated_consts, rustc_attrs)]
-#![allow(warnings)]
-
-trait MyTrait {
- const MY_CONST: &'static str;
-}
-
-macro_rules! my_macro {
- () => {
- struct MyStruct;
-
- impl MyTrait for MyStruct {
- const MY_CONST: &'static str = stringify!(abc);
- }
- }
-}
-
-my_macro!();
-
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Thing {
- x: isize
-}
-
-impl Thing {
- fn mul(&self, c: &isize) -> Thing {
- Thing {x: self.x * *c}
- }
-}
-
-fn main() {
- let u = Thing {x: 2};
- let _v = u.mul(&3); // This is ok
- let w = u * 3; //~ ERROR binary operation `*` cannot be applied to type `Thing`
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Test that `fn foo::bar::{self}` only imports `bar` in the type namespace.
-
-mod foo {
- pub fn f() { }
-}
-use foo::f::{self}; //~ ERROR unresolved import `foo::f`
-
-mod bar {
- pub fn baz() {}
- pub mod baz {}
-}
-use bar::baz::{self};
-
-fn main() {
- baz(); //~ ERROR expected function, found module `baz`
-}
+++ /dev/null
-// 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.
-
-#![feature(rustc_attrs)]
-
-use std::ops::Deref;
-
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
- let _x: fn(&i32) -> <&i32 as Deref>::Target = unimplemented!();
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait A<T>: std::ops::Add<Self> + Sized {}
-trait B<T>: A<T> {}
-trait C<T>: A<B<T, Output=usize>> {}
-//~^ ERROR the trait `B` cannot be made into an object
-
-fn main() {}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- let Box(a) = loop { };
- //~^ ERROR expected tuple struct/variant, found struct `Box`
-
- // (The below is a trick to allow compiler to infer a type for
- // variable `a` without attempting to ascribe a type to the
- // pattern or otherwise attempting to name the Box type, which
- // would run afoul of issue #22207)
- let _b: *mut i32 = *a;
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-const x: () = {
- return; //~ ERROR return statement outside of function body
-};
-
-fn main() {}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Q<T:?Sized> {}
-trait Foo where u32: Q<Self> {
- fn foo(&self);
-}
-
-impl Q<()> for u32 {}
-impl Foo for () {
- fn foo(&self) {
- println!("foo!");
- }
-}
-
-fn main() {
- let _f: Box<Foo> = //~ ERROR `Foo` cannot be made into an object
- Box::new(()); //~ ERROR `Foo` cannot be made into an object
-}
+++ /dev/null
-// 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 main() {
- let a = std::sys::imp::process::process_common::StdioPipes { ..panic!() };
- //~^ ERROR failed to resolve. Could not find `imp` in `sys` [E0433]
- //~^^ ERROR module `sys` is private [E0603]
-}
+++ /dev/null
-// 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.
-
-pub struct List<T> {
- head: T,
-}
-
-impl Drop for List<i32> { //~ ERROR E0366
- fn drop(&mut self) {
- panic!()
- }
-}
-
-fn main() {
- List { head: 0 };
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn foo<T: Iterator>() {
- T::Item; //~ ERROR no associated item named `Item` found for type `T` in the current scope
-}
-
-fn main() { }
+++ /dev/null
-// 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 _test(ref _p: str) {}
-//~^ ERROR the size for values of type
-
-fn main() { }
+++ /dev/null
-// 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.
-
-#![feature(associated_consts)]
-
-trait VecN {
- const DIM: usize;
-}
-trait Mat {
- type Row: VecN;
-}
-
-fn m<M: Mat>() {
- let a = [3; M::Row::DIM]; //~ ERROR associated type `Row` not found for `M`
-}
-fn main() {
-}
+++ /dev/null
-// 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.
-
-enum Foo {
- Bar { bar: Bar, id: usize }
-}
-
-enum Bar {
- A, B, C, D, E, F
-}
-
-fn test(f: Foo) {
- match f {
- //~^ ERROR non-exhaustive patterns
- //~| patterns
- Foo::Bar { bar: Bar::A, .. } => (),
- Foo::Bar { bar: Bar::B, .. } => (),
- }
-}
-
-fn main() {}
+++ /dev/null
-// 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.
-
-#![allow(unused_macros)]
-
-macro_rules! assign {
- (($($a:tt)*) = ($($b:tt))*) => { //~ ERROR expected one of: `*`, `+`, or `?`
- $($a)* = $($b)*
- }
-}
-
-fn main() {}
+++ /dev/null
-// 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.
-
-#![allow(unused)]
-
-macro_rules! m { ($i) => {} }
-//~^ ERROR missing fragment specifier
-//~| WARN previously accepted
-
-fn main() {}
+++ /dev/null
-// 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.
-
-trait Dim {
- fn dim() -> usize;
-}
-
-enum Dim3 {}
-
-impl Dim for Dim3 {
- fn dim() -> usize {
- 3
- }
-}
-
-fn main() {
- let array: [usize; Dim3::dim()]
- //~^ ERROR E0015
- //~| ERROR E0080
- = [0; Dim3::dim()];
- //~^ ERROR E0015
- //~| ERROR E0080
-}
+++ /dev/null
-// 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.
-
-trait Dim {
- fn dim() -> usize;
-}
-
-enum Dim3 {}
-
-impl Dim for Dim3 {
- fn dim() -> usize {
- 3
- }
-}
-
-pub struct Vector<T, D: Dim> {
- entries: [T; D::dim()],
- //~^ ERROR no function or associated item named `dim` found for type `D` in the current scope
- _dummy: D,
-}
-
-fn main() {}
+++ /dev/null
-// 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(a: [0; 1]) {} //~ ERROR expected type, found `0`
-//~| ERROR expected one of `)`, `,`, `->`, `where`, or `{`, found `]`
-// FIXME(jseyfried): avoid emitting the second error (preexisting)
-
-fn main() {}
+++ /dev/null
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-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(fn_traits)]
-
-fn main() {
- <fn() as Fn()>::call;
- //~^ ERROR associated type bindings are not allowed here [E0229]
-}
+++ /dev/null
-// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Point {
- x: f64,
- y: f64,
-}
-
-trait ToString_ {
- fn to_string(&self) -> String;
-}
-
-impl ToString_ for Point {
- fn new(x: f64, y: f64) -> Point {
- //~^ ERROR method `new` is not a member of trait `ToString_`
- Point { x: x, y: y }
- }
-
- fn to_string(&self) -> String {
- format!("({}, {})", self.x, self.y)
- }
-}
-
-fn main() {
- let p = Point::new(0.0, 0.0);
- //~^ ERROR no function or associated item named `new` found for type `Point`
- println!("{}", p.to_string());
-}
+++ /dev/null
-// 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.
-
-macro_rules! get_opt {
- ($tgt:expr, $field:ident) => {
- if $tgt.has_$field() {}
- }
-}
-
-fn main() {
- get_opt!(bar, foo);
- //~^ ERROR expected `{`, found `foo`
-}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use zoo::fly; //~ ERROR: function `fly` is private
-
-mod zoo {
- fn fly() {}
-}
-
-
-fn main() {
- fly();
-}
+++ /dev/null
-// 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.
-
-trait Array<'a> {
- type Element: 'a;
-}
-
-trait Visit {
- fn visit() {}
-}
-
-impl<'a> Array<'a> for () {
- type Element = &'a ();
-}
-
-impl Visit for () where
- //(): for<'a> Array<'a, Element=&'a ()>, // No ICE
- (): for<'a> Array<'a, Element=()>, // ICE
-{}
-
-fn main() {
- <() as Visit>::visit();
- //~^ ERROR type mismatch resolving `for<'a> <() as Array<'a>>::Element == ()`
-}
+++ /dev/null
-// 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.
-
-const LENGTH: f64 = 2;
-
-struct Thing {
- f: [[f64; 2]; LENGTH],
- //~^ ERROR mismatched types
- //~| expected usize, found f64
-}
-
-fn main() {
- let _t = Thing { f: [[0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]] };
-}
+++ /dev/null
-// 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 main() {
- let bar: fn(&mut u32) = |_| {};
-
- fn foo(x: Box<Fn(&i32)>) {}
- let bar = Box::new(|x: &i32| {}) as Box<Fn(_)>;
- foo(bar); //~ ERROR mismatched types
- //~| expected concrete lifetime, found bound lifetime parameter
-}
+++ /dev/null
-// 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 prove_static<T: 'static + ?Sized>(_: &'static T) {}
-
-fn lifetime_transmute_slice<'a, T: ?Sized>(x: &'a T, y: &T) -> &'a T {
- let mut out = [x];
- {
- let slice: &mut [_] = &mut out;
- slice[0] = y;
- }
- out[0]
- //~^ ERROR 19:5: 19:11: explicit lifetime required in the type of `y` [E0621]
-}
-
-struct Struct<T, U: ?Sized> {
- head: T,
- _tail: U
-}
-
-fn lifetime_transmute_struct<'a, T: ?Sized>(x: &'a T, y: &T) -> &'a T {
- let mut out = Struct { head: x, _tail: [()] };
- {
- let dst: &mut Struct<_, [()]> = &mut out;
- dst.head = y;
- }
- out.head
- //~^ ERROR 34:5: 34:13: explicit lifetime required in the type of `y` [E0621]
-}
-
-fn main() {
- prove_static(lifetime_transmute_slice("", &String::from("foo")));
- prove_static(lifetime_transmute_struct("", &String::from("bar")));
-}
+++ /dev/null
-// 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 save_ref<'a>(refr: &'a i32, to: &mut [&'a i32]) {
- for val in &mut *to {
- *val = refr;
- }
-}
-
-fn main() {
- let ref init = 0i32;
- let ref mut refr = 1i32;
-
- let mut out = [init];
-
- save_ref(&*refr, &mut out);
-
- // This shouldn't be allowed as `refr` is borrowed
- *refr = 3; //~ ERROR cannot assign to `*refr` because it is borrowed
-
- // Prints 3?!
- println!("{:?}", out[0]);
-}
+++ /dev/null
-// 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.
-
-#![feature(rustc_attrs)]
-#![allow(warnings)]
-
-enum E {
- A = {
- enum F { B }
- 0
- }
-}
-
-#[rustc_error]
-fn main() {}
-//~^ ERROR compilation successful
-
+++ /dev/null
-// 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.
-
-#![feature(rustc_attrs)]
-#![allow(unused)]
-
-fn f() {
- let mut x: Box<()> = Box::new(());
-
- || {
- &mut x
- };
-}
-
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+++ /dev/null
-// 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.
-
-#![feature(rustc_attrs)]
-#![allow(unused)]
-
-fn f() {
- let x: Box<()> = Box::new(());
-
- || {
- &x
- };
-}
-
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+++ /dev/null
-// 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.
-
-#![feature(rustc_attrs)]
-#![allow(unused)]
-
-fn f() {
- let mut x: Vec<()> = Vec::new();
-
- || {
- || {
- x.push(())
- }
- };
-}
-
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+++ /dev/null
-// 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.
-
-#![feature(rustc_attrs)]
-#![allow(unused)]
-
-fn f() {
- let x: Vec<()> = Vec::new();
-
- || {
- || {
- x.len()
- }
- };
-}
-
-#[rustc_error]
-fn main() {} //~ ERROR compilation successful
+++ /dev/null
-// 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 f(_: &[f32]) {}
-
-fn main() {
- () + f(&[1.0]);
- //~^ ERROR binary operation `+` cannot be applied to type `()`
-}
+++ /dev/null
-// 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 main() {
- [0; ..10];
- //~^ ERROR mismatched types
- //~| expected type `usize`
- //~| found type `std::ops::RangeTo<{integer}>`
-}
+++ /dev/null
-// 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.
-
-trait T { m!(); } //~ ERROR cannot find macro `m!` in this scope
-
-struct S;
-impl S { m!(); } //~ ERROR cannot find macro `m!` in this scope
-
-fn main() {}
+++ /dev/null
-// 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 f(_: &[f32]) {}
-
-fn main() {
- ()[f(&[1.0])];
- //~^ ERROR cannot index into a value of type `()`
-}
+++ /dev/null
-// 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.
-
-trait Trait {}
-
-fn get_function<'a>() -> &'a Fn() -> Trait { panic!("") }
-
-fn main() {
- let t : &Trait = &get_function()();
- //~^ ERROR cannot move a value of type (dyn Trait + 'static)
-}
+++ /dev/null
-// 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.
-
-pub fn example(ref s: str) {}
-//~^ ERROR the size for values of type
-
-fn main() {}
+++ /dev/null
-// 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.
-
-// Matching against float literals should result in a linter error
-
-#![feature(exclusive_range_pattern)]
-#![allow(unused)]
-#![forbid(illegal_floating_point_literal_pattern)]
-
-fn main() {
- let x = 42.0;
- match x {
- 5.0 => {}, //~ ERROR floating-point types cannot be used in patterns
- //~| WARNING hard error
- 5.0f32 => {}, //~ ERROR floating-point types cannot be used in patterns
- //~| WARNING hard error
- -5.0 => {}, //~ ERROR floating-point types cannot be used in patterns
- //~| WARNING hard error
- 1.0 .. 33.0 => {}, //~ ERROR floating-point types cannot be used in patterns
- //~| WARNING hard error
- //~| ERROR floating-point types cannot be used in patterns
- //~| WARNING hard error
- 39.0 ..= 70.0 => {}, //~ ERROR floating-point types cannot be used in patterns
- //~| WARNING hard error
- //~| ERROR floating-point types cannot be used in patterns
- //~| WARNING hard error
- _ => {},
- };
- let y = 5.0;
- // Same for tuples
- match (x, 5) {
- (3.14, 1) => {}, //~ ERROR floating-point types cannot be used
- //~| WARNING hard error
- _ => {},
- }
- // Or structs
- struct Foo { x: f32 };
- match (Foo { x }) {
- Foo { x: 2.0 } => {}, //~ ERROR floating-point types cannot be used
- //~| WARNING hard error
- _ => {},
- }
-}
+++ /dev/null
-// 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.
-
-enum Foo {
- A = "" + 1
- //~^ ERROR binary operation `+` cannot be applied to type `&str`
-}
-
-enum Bar {
- A = Foo::A as isize
-}
-
-fn main() {}
+++ /dev/null
-// 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.
-
-use std::collections::HashMap;
-fn main() {
- let things: HashMap<String, Vec<String>> = HashMap::new();
- for src in things.keys() {
- things[src.as_str()].sort(); //~ ERROR cannot borrow immutable
- }
-}
+++ /dev/null
-// 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.
-
-use std::ops::{Index, IndexMut};
-
-struct S;
-struct H;
-
-impl S {
- fn f(&mut self) {}
-}
-
-impl Index<u32> for H {
- type Output = S;
- fn index(&self, index: u32) -> &S {
- unimplemented!()
- }
-}
-
-impl IndexMut<u32> for H {
- fn index_mut(&mut self, index: u32) -> &mut S {
- unimplemented!()
- }
-}
-
-fn main() {
- H["?"].f(); //~ ERROR mismatched types
-}
+++ /dev/null
-// 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 main() {
- include!(line!()); //~ ERROR argument must be a string literal
-}
+++ /dev/null
-// 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 iterate<T, F>(initial: T, f: F) -> Iterate<T, F> {
- Iterate {
- state: initial,
- f: f,
- }
-}
-
-pub struct Iterate<T, F> {
- state: T,
- f: F
-}
-
-impl<T: Clone, F> Iterator for Iterate<T, F> where F: Fn(&T) -> T {
- type Item = T;
-
- #[inline]
- fn next(&mut self) -> Option<Self::Item> {
- self.state = (self.f)(&self.state);
- Some(self.state.clone())
- }
- #[inline]
- fn size_hint(&self) -> (usize, Option<usize>) { (std::usize::MAX, None) }
-}
-
-fn main() {
- let a = iterate(0, |x| x+1);
- println!("{:?}", a.iter().take(10).collect::<Vec<usize>>());
- //~^ ERROR no method named `iter` found for type `Iterate<{integer}
-}
+++ /dev/null
-// 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.
-
-#[derive(Copy, Clone)]
-struct Flags;
-
-trait A {
-}
-
-impl<T> Drop for T where T: A { //~ ERROR E0119
- //~^ ERROR E0120
- //~| ERROR E0210
- fn drop(&mut self) {
- }
-}
-
-fn main() {}
+++ /dev/null
-// 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.
-
-#![feature(rustc_attrs)]
-
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
- if ('x' as char) < ('y' as char) {
- print!("x");
- } else {
- print!("y");
- }
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- let a = if true {
- 0
- } else if false {
-//~^ ERROR if may be missing an else clause
-//~| expected type `()`
-//~| found type `{integer}`
-//~| expected (), found integral variable
- 1
- };
-}
+++ /dev/null
-// 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.
-
-use std::ops::Deref;
-
-pub trait Foo {
- fn baz(_: Self::Target) where Self: Deref {}
- //~^ ERROR the size for values of type
-}
-
-pub fn f(_: ToString) {}
-//~^ ERROR the size for values of type
-
-fn main() { }
+++ /dev/null
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-static TAB: [&mut [u8]; 0] = [];
-
-pub unsafe fn test() {
- TAB[0].iter_mut(); //~ ERROR cannot borrow data mutably in a `&` reference [E0389]
-}
-
-pub fn main() {}
+++ /dev/null
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Foo {
- baz: usize
-}
-
-impl Foo {
- fn bar() {
- Foo { baz: 0 }.bar();
- }
-
- fn bar() { //~ ERROR duplicate definitions
- }
-}
-
-fn main() {}
+++ /dev/null
-// 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.
-
-#![feature(macro_vis_matcher)]
-
-macro_rules! foo {
- ($($p:vis)*) => {} //~ ERROR repetition matches empty token tree
-}
-
-foo!(a);
+++ /dev/null
-// 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.
-
-pub trait Mirror<Smoke> {
- type Image;
-}
-
-impl<T, Smoke> Mirror<Smoke> for T {
- type Image = T;
-}
-
-pub fn poison<S>(victim: String) where <String as Mirror<S>>::Image: Copy {
- loop { drop(victim); }
-}
-
-fn main() {
- let s = "Hello!".to_owned();
- let mut s_copy = s;
- s_copy.push_str("World!");
- "0wned!".to_owned();
- println!("{}", s); //~ ERROR use of moved value
-}
+++ /dev/null
-// 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.
-
-type Value = String;
-
-fn main() {
- let f = |&Value::String(_)| (); //~ ERROR no associated item named
-
- let vec: Vec<Value> = Vec::new();
- vec.last().map(f);
-}
+++ /dev/null
-// 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.
-
-struct S;
-
-impl S {
- #[derive(Debug)] //~ ERROR `derive` may only be applied to structs, enums and unions
- fn f() {
- file!();
- }
-}
-
-trait Tr1 {
- #[derive(Debug)] //~ ERROR `derive` may only be applied to structs, enums and unions
- fn f();
-}
-
-trait Tr2 {
- #[derive(Debug)] //~ ERROR `derive` may only be applied to structs, enums and unions
- type F;
-}
+++ /dev/null
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-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 xyz() -> u8 { 42 }
-
-const NUM: u8 = xyz();
-//~^ ERROR calls in constants are limited to constant functions, tuple structs and tuple variants
-
-fn main() {
- match 1 {
- NUM => unimplemented!(),
- //~^ ERROR could not evaluate constant pattern
- _ => unimplemented!(),
- }
-}
+++ /dev/null
-// 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 {
- //~^ ERROR E0308
- break true; //~ ERROR E0268
-}
-
-fn main() {
- break {}; //~ ERROR E0268
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- let tup = (true, true);
- println!("foo {:}", match tup { //~ ERROR non-exhaustive patterns: `(true, false)` not covered
- (false, false) => "foo",
- (false, true) => "bar",
- (true, true) => "baz"
- });
-}
+++ /dev/null
-// 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 main() {
- let mut y;
- const C: u32 = 0;
- macro_rules! m {
- ($a:expr) => {
- let $a = 0;
- }
- }
- m!(y);
- //~^ ERROR arbitrary expressions aren't allowed in patterns
- m!(C);
- //~^ ERROR arbitrary expressions aren't allowed in patterns
-}
+++ /dev/null
-// 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.
-
-pub trait Trait1<X> {
- type Output;
-}
-
-pub trait Trait2<X> {}
-
-pub struct A;
-
-impl<X, T> Trait1<X> for T where T: Trait2<X> {
- type Output = ();
-}
-
-impl<X> Trait1<Box<X>> for A {
-//~^ ERROR conflicting implementations of trait
-//~| hard error
-//~| downstream crates may implement trait `Trait2<std::boxed::Box<_>>` for type `A`
- type Output = i32;
-}
-
-fn main() {}
+++ /dev/null
-// 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.
-
-#![allow(unused)]
-
-macro_rules! m {
- ($attr_path: path) => {
- #[$attr_path]
- fn f() {}
- }
-}
-
-m!(inline<u8>); //~ ERROR: unexpected generic arguments in path
-
-fn main() {}
+++ /dev/null
-// 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.
-
-#![feature(fn_traits)]
-
-trait CallSingle<A, B> {
- fn call(&self, a: A) -> B where Self: Sized, Self: Fn(A) -> B;
-}
-
-impl<A, B, F: Fn(A) -> B> CallSingle<A, B> for F {
- fn call(&self, a: A) -> B {
- <Self as Fn(A) -> B>::call(self, (a,))
- //~^ ERROR associated type bindings are not allowed here
- }
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ensures that 'use foo:*' doesn't import non-public item
-
-use m1::*;
-
-mod foo {
- pub fn foo() {}
-}
-mod a {
- pub mod b {
- use foo::foo;
- type bar = isize;
- }
- pub mod sub {
- use a::b::*;
- fn sub() -> bar { 1 }
- //~^ ERROR cannot find type `bar` in this scope
- }
-}
-
-mod m1 {
- fn foo() {}
-}
-
-fn main() {
- foo(); //~ ERROR expected function, found module `foo`
-}
+++ /dev/null
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// regression test for issue 4366
-
-// ensures that 'use foo:*' doesn't import non-public 'use' statements in the
-// module 'foo'
-
-use m1::*;
-
-mod foo {
- pub fn foo() {}
-}
-mod a {
- pub mod b {
- use foo::foo;
- type bar = isize;
- }
- pub mod sub {
- use a::b::*;
- fn sub() -> isize { foo(); 1 } //~ ERROR cannot find function `foo` in this scope
- }
-}
-
-mod m1 {
- fn foo() {}
-}
-
-fn main() {}
+++ /dev/null
-// 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.
-
-#![feature(const_fn)]
-#![feature(cfg_target_thread_local, thread_local_internals)]
-
-// On platforms *without* `#[thread_local]`, use
-// a custom non-`Sync` type to fake the same error.
-#[cfg(not(target_thread_local))]
-struct Key<T> {
- _data: std::cell::UnsafeCell<Option<T>>,
- _flag: std::cell::Cell<bool>,
-}
-
-#[cfg(not(target_thread_local))]
-impl<T> Key<T> {
- const fn new() -> Self {
- Key {
- _data: std::cell::UnsafeCell::new(None),
- _flag: std::cell::Cell::new(false),
- }
- }
-}
-
-#[cfg(target_thread_local)]
-use std::thread::__FastLocalKeyInner as Key;
-
-static __KEY: Key<()> = Key::new();
-//~^ ERROR `std::cell::UnsafeCell<std::option::Option<()>>` cannot be shared between threads
-//~| ERROR `std::cell::Cell<bool>` cannot be shared between threads safely [E0277]
-
-fn main() {}
+++ /dev/null
-// 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.
-
-#![feature(const_fn)]
-#![feature(thread_local)]
-#![feature(cfg_target_thread_local, thread_local_internals)]
-
-type Foo = std::cell::RefCell<String>;
-
-#[cfg(target_thread_local)]
-#[thread_local]
-static __KEY: std::thread::__FastLocalKeyInner<Foo> =
- std::thread::__FastLocalKeyInner::new();
-
-#[cfg(not(target_thread_local))]
-static __KEY: std::thread::__OsLocalKeyInner<Foo> =
- std::thread::__OsLocalKeyInner::new();
-
-fn __getit() -> std::option::Option<
- &'static std::cell::UnsafeCell<
- std::option::Option<Foo>>>
-{
- __KEY.get() //~ ERROR call to unsafe function is unsafe
-}
-
-static FOO: std::thread::LocalKey<Foo> =
- std::thread::LocalKey::new(__getit, Default::default);
-//~^ ERROR call to unsafe function is unsafe
-
-fn main() {
- FOO.with(|foo| println!("{}", foo.borrow()));
- std::thread::spawn(|| {
- FOO.with(|foo| *foo.borrow_mut() += "foo");
- }).join().unwrap();
- FOO.with(|foo| println!("{}", foo.borrow()));
-}
+++ /dev/null
-// 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.
-
-pub trait Partial<X: ?Sized>: Copy {
-}
-
-pub trait Complete {
- type Assoc: Partial<Self>;
-}
-
-impl<T> Partial<T> for T::Assoc where
- T: Complete
-{
-}
-
-impl<T> Complete for T { //~ ERROR the trait bound `T: std::marker::Copy` is not satisfied
- type Assoc = T;
-}
+++ /dev/null
-// 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.
-
-pub trait Partial: Copy {
-}
-
-pub trait Complete: Partial {
-}
-
-impl<T> Partial for T where T: Complete {}
-impl<T> Complete for T {} //~ ERROR the trait bound `T: std::marker::Copy` is not satisfied
+++ /dev/null
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-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(attr_literals)]
-
-#[link(name="foo", cfg("rlib"))] //~ ERROR invalid argument for `cfg(..)`
-extern {}
-
-fn main() {}
+++ /dev/null
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#[link(name="foo", cfg())] //~ ERROR `cfg()` must have an argument
-extern {}
-
-fn main() {}
+++ /dev/null
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-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(stmt_expr_attributes)]
-
-fn main() {
-
- #[inline]
- let _a = 4;
- //~^^ ERROR attribute should be applied to function or closure
-
-
- #[inline(XYZ)]
- let _b = 4;
- //~^^ ERROR attribute should be applied to function or closure
-
- #[repr(nothing)]
- let _x = 0;
- //~^^ ERROR attribute should not be applied to a statement
-
- #[repr(something_not_real)]
- loop {
- ()
- };
- //~^^^^ ERROR attribute should not be applied to an expression
-
- #[repr]
- let _y = "123";
- //~^^ ERROR attribute should not be applied to a statement
- //~| WARN `repr` attribute must have a hint
-
-
- fn foo() {}
-
- #[inline(ABC)]
- foo();
- //~^^ ERROR attribute should be applied to function or closure
-
- let _z = #[repr] 1;
- //~^ ERROR attribute should not be applied to an expression
- //~| WARN `repr` attribute must have a hint
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct MyStruct;
-impl MyStruct {
- fn f() {|x, y} //~ ERROR expected one of `:`, `@`, or `|`, found `}`
-}
-
-fn main() {}
+++ /dev/null
-// 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 main() {
- let n = 0;
-
- struct Foo;
- impl Foo {
- const N: usize = n;
- //~^ ERROR attempt to use a non-constant value
- }
-}
+++ /dev/null
-// 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.
-
-
-static FOO: u32 = 50;
-
-fn main() {
- let _val: &'static [&'static u32] = &[&FOO]; //~ ERROR borrowed value does not live long enough
-}
+++ /dev/null
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// error-pattern: cycle detected when computing layout of
-
-#![feature(const_fn)]
-#![feature(core_intrinsics)]
-
-use std::intrinsics;
-
-struct Foo {
- bytes: [u8; unsafe { intrinsics::size_of::<Foo>() }],
- x: usize,
-}
-
-fn main() {}
+++ /dev/null
-// 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 main() {
- return;
- *(1 as *mut u32) = 42;
- //~^ ERROR dereference of raw pointer is unsafe
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn bar(int_param: usize) {}
-
-fn main() {
- let foo: [u8; 4] = [1; 4];
- bar(foo);
- //~^ ERROR mismatched types
- //~| expected type `usize`
- //~| found type `[u8; 4]`
- //~| expected usize, found array of 4 elements
-}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// revisions: ast mir
-//[mir]compile-flags: -Zborrowck=mir
-
-fn test_drop_replace() {
- let b: Box<isize>;
- //[mir]~^ NOTE consider changing this to `mut b`
- b = Box::new(1); //[ast]~ NOTE first assignment
- //[mir]~^ NOTE first assignment
- b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable variable
- //[mir]~^ ERROR cannot assign twice to immutable variable `b`
- //[ast]~| NOTE cannot assign twice to immutable
- //[mir]~| NOTE cannot assign twice to immutable
-}
-
-fn test_call() {
- let b = Box::new(1); //[ast]~ NOTE first assignment
- //[mir]~^ NOTE first assignment
- //[mir]~| NOTE consider changing this to `mut b`
- b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable variable
- //[mir]~^ ERROR cannot assign twice to immutable variable `b`
- //[ast]~| NOTE cannot assign twice to immutable
- //[mir]~| NOTE cannot assign twice to immutable
-}
-
-fn test_args(b: Box<i32>) { //[ast]~ NOTE first assignment
- //[mir]~^ NOTE consider changing this to `mut b`
- b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable variable
- //[mir]~^ ERROR cannot assign to immutable argument `b`
- //[ast]~| NOTE cannot assign twice to immutable
- //[mir]~| NOTE cannot assign to immutable argument
-}
-
-fn main() {}
+++ /dev/null
-// 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.
-
-#![feature(generators)]
-
-fn main() {
- let _ = || {
- *(1 as *mut u32) = 42;
- //~^ ERROR dereference of raw pointer is unsafe
- yield;
- };
-}
+++ /dev/null
-// 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.
-
-struct Params;
-
-pub trait Plugin<E: ?Sized> {
- type Error;
-}
-
-pub trait Pluggable {
- fn get_ref<P: Plugin<Self>>(&mut self) -> Option<P::Error> {
- None
- }
-}
-
-struct Foo;
-impl Plugin<Foo> for Params {
- type Error = ();
-}
-
-impl<T: Copy> Pluggable for T {}
-
-fn handle(req: &mut i32) {
- req.get_ref::<Params>();
- //~^ ERROR the trait bound `Params: Plugin<i32>` is not satisfied
-}
-
-fn main() {}
+++ /dev/null
-// 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 main() {
- let a = |r: f64| if r != 0.0(r != 0.0) { 1.0 } else { 0.0 };
- //~^ ERROR expected function, found `{float}`
-}
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// revisions: ast mir
-//[mir]compile-flags: -Z emit-end-regions -Z borrowck=mir
-
-fn main() {
- let x = 0;
-
- (move || {
- x = 1;
- //[mir]~^ ERROR cannot assign to immutable item `x` [E0594]
- //[ast]~^^ ERROR cannot assign to captured outer variable in an `FnMut` closure [E0594]
- })()
-}
+++ /dev/null
-// 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.
-
-// Issue 46036: [NLL] false edges on infinite loops
-// Infinite loops should create false edges to the cleanup block.
-#![feature(nll)]
-
-struct Foo { x: &'static u32 }
-
-fn foo() {
- let a = 3;
- let foo = Foo { x: &a }; //~ ERROR E0597
- loop { }
-}
-
-fn main() { }
+++ /dev/null
-// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- 'break: loop { //~ ERROR invalid label name `'break`
- }
-}
+++ /dev/null
-// 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.
-
-macro_rules! m {
- ($my_type: ty) => {
- impl $my_type for u8 {}
- }
-}
-
-trait Trait {}
-
-m!(Tr);
-
-m!(&'static u8); //~ ERROR expected a trait, found type
-
-fn main() {}
+++ /dev/null
-// 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.
-
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
-static buf: &mut [u8] = &mut [1u8,2,3,4,5,7]; //[ast]~ ERROR E0017
- //[mir]~^ ERROR E0017
-fn write<T: AsRef<[u8]>>(buffer: T) { }
-
-fn main() {
- write(&buf);
- buf[0]=2; //[ast]~ ERROR E0389
- //[mir]~^ ERROR E0594
-}
+++ /dev/null
-// 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 main() {
- struct Foo;
- (1 .. 2).find(|_| Foo(0) == 0); //~ ERROR expected function, found `main::Foo`
-}
+++ /dev/null
-// 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.
-
-enum Thing { This, That }
-
-fn non_const() -> Thing {
- Thing::This
-}
-
-pub const Q: i32 = match non_const() { //~ ERROR E0015
- Thing::This => 1, //~ ERROR unimplemented expression type
- Thing::That => 0
-};
-
-fn main() {}
+++ /dev/null
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Make sure that the mono-item collector does not crash when trying to
-// instantiate a default impl of a method with lifetime parameters.
-// See https://github.com/rust-lang/rust/issues/47309
-
-// compile-flags:-Clink-dead-code
-// compile-pass
-
-#![crate_type="rlib"]
-
-pub trait EnvFuture {
- type Item;
-
- fn boxed_result<'a>(self) where Self: Sized, Self::Item: 'a, {
- }
-}
-
-struct Foo;
-
-impl<'a> EnvFuture for &'a Foo {
- type Item = ();
-}
+++ /dev/null
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct NonCopyable(());
-
-fn main() {
- let z = NonCopyable{ p: () }; //~ ERROR struct `NonCopyable` has no field named `p`
-}
+++ /dev/null
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#[derive(Copy, Clone)]
-enum Void {}
-
-// Tests that we detect unsafe places (specifically, union fields and
-// raw pointer dereferences), even when they're matched on while having
-// an uninhabited type (equivalent to `std::intrinsics::unreachable()`).
-
-fn union_field() {
- union Union { unit: (), void: Void }
- let u = Union { unit: () };
- match u.void {}
- //~^ ERROR access to union field is unsafe
-}
-
-fn raw_ptr_deref() {
- let ptr = std::ptr::null::<Void>();
- match *ptr {}
- //~^ ERROR dereference of raw pointer is unsafe
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-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 {}
-
-trait Bar<T> {}
-
-trait Iterable {
- type Item;
-}
-
-struct Container<T: Iterable<Item = impl Foo>> {
- //~^ ERROR `impl Trait` not allowed
- field: T
-}
-
-enum Enum<T: Iterable<Item = impl Foo>> {
- //~^ ERROR `impl Trait` not allowed
- A(T),
-}
-
-union Union<T: Iterable<Item = impl Foo> + Copy> {
- //~^ ERROR `impl Trait` not allowed
- x: T,
-}
-
-type Type<T: Iterable<Item = impl Foo>> = T;
-//~^ ERROR `impl Trait` not allowed
-
-fn main() {
-}
+++ /dev/null
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-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 note is annotated because the purpose of the test
-// is to ensure that certain other notes are not generated.
-#![deny(unused_unsafe)] //~ NOTE
-
-// (test that no note is generated on this unsafe fn)
-pub unsafe fn a() {
- fn inner() {
- unsafe { /* unnecessary */ } //~ ERROR unnecessary `unsafe`
- //~^ NOTE
- }
-
- inner()
-}
-
-pub fn b() {
- // (test that no note is generated on this unsafe block)
- unsafe {
- fn inner() {
- unsafe { /* unnecessary */ } //~ ERROR unnecessary `unsafe`
- //~^ NOTE
- }
-
- let () = ::std::mem::uninitialized();
-
- inner()
- }
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-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 Functions {
- Square = |x| x, //~ ERROR mismatched types
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Regression test for issue #4968
-
-const A: (isize,isize) = (4,2);
-fn main() {
- match 42 { A => () }
- //~^ ERROR mismatched types
- //~| expected type `{integer}`
- //~| found type `(isize, isize)`
- //~| expected integral variable, found tuple
-}
+++ /dev/null
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(box_patterns)]
-#![feature(box_syntax)]
-
-trait MyTrait {
- fn dummy(&self) {}
-}
-
-pub enum TraitWrapper {
- A(Box<MyTrait+'static>),
-}
-
-fn get_tw_map(tw: &TraitWrapper) -> &MyTrait {
- match *tw {
- TraitWrapper::A(box ref map) => map, //~ ERROR cannot be dereferenced
- }
-}
-
-pub fn main() {}
+++ /dev/null
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-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-pass
-
-fn main() {
- assert!({false});
-
- assert!(r"\u{41}" == "A");
-
- assert!(r"\u{".is_empty());
-}
+++ /dev/null
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Foo (
- fn([u8; |x: u8| {}]), //~ ERROR mismatched types
-);
-
-fn main() {}
+++ /dev/null
-// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() { format!("{:?}", None); }
- //~^ ERROR type annotations needed [E0282]
+++ /dev/null
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![allow(unused_macros)]
-
-macro_rules! foo {
- ( $()* ) => {};
- //~^ ERROR repetition matches empty token tree
- ( $()+ ) => {};
- //~^ ERROR repetition matches empty token tree
-
- ( $(),* ) => {}; // PASS
- ( $(),+ ) => {}; // PASS
-
- ( [$()*] ) => {};
- //~^ ERROR repetition matches empty token tree
- ( [$()+] ) => {};
- //~^ ERROR repetition matches empty token tree
-
- ( [$(),*] ) => {}; // PASS
- ( [$(),+] ) => {}; // PASS
-
- ( $($()* $(),* $(a)* $(a),* )* ) => {};
- //~^ ERROR repetition matches empty token tree
- ( $($()* $(),* $(a)* $(a),* )+ ) => {};
- //~^ ERROR repetition matches empty token tree
-
- ( $(a $(),* $(a)* $(a),* )* ) => {}; // PASS
- ( $($(a)+ $(),* $(a)* $(a),* )+ ) => {}; // PASS
-
- ( $(a $()+)* ) => {};
- //~^ ERROR repetition matches empty token tree
- ( $(a $()*)+ ) => {};
- //~^ ERROR repetition matches empty token tree
-}
-
-
-// --- Original Issue --- //
-
-macro_rules! make_vec {
- (a $e1:expr $($(, a $e2:expr)*)*) => ([$e1 $($(, $e2)*)*]);
- //~^ ERROR repetition matches empty token tree
-}
-
-fn main() {
- let _ = make_vec![a 1, a 2, a 3];
-}
-
-
-// --- Minified Issue --- //
-
-macro_rules! m {
- ( $()* ) => {}
- //~^ ERROR repetition matches empty token tree
-}
-
-m!();
+++ /dev/null
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-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() {
- [1; || {}]; //~ ERROR mismatched types
-}
+++ /dev/null
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-
-trait B < A > { fn a() -> A { this.a } } //~ ERROR cannot find value `this` in this scope
-
-fn main() {}
+++ /dev/null
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(box_patterns)]
-#![feature(box_syntax)]
-
-enum A { B, C }
-
-fn main() {
- match (true, false) {
- A::B => (),
-//~^ ERROR mismatched types
-//~| expected type `(bool, bool)`
-//~| found type `A`
-//~| expected tuple, found enum `A`
- _ => ()
- }
-
- match (true, false) {
- (true, false, false) => ()
-//~^ ERROR mismatched types
-//~| expected type `(bool, bool)`
-//~| found type `(_, _, _)`
-//~| expected a tuple with 2 elements, found one with 3 elements
- }
-
- match (true, false) {
- (true, false, false) => ()
-//~^ ERROR mismatched types
-//~| expected type `(bool, bool)`
-//~| found type `(_, _, _)`
-//~| expected a tuple with 2 elements, found one with 3 elements
- }
-
- match (true, false) {
- box (true, false) => ()
-//~^ ERROR mismatched types
-//~| expected type `(bool, bool)`
-//~| found type `std::boxed::Box<_>`
- }
-
- match (true, false) {
- &(true, false) => ()
-//~^ ERROR mismatched types
-//~| expected type `(bool, bool)`
-//~| found type `&_`
-//~| expected tuple, found reference
- }
-
-
- let v = [('a', 'b') //~ ERROR expected function, found `(char, char)`
- ('c', 'd'),
- ('e', 'f')];
-
- for &(x,y) in &v {} // should be OK
-
- // Make sure none of the errors above were fatal
- let x: char = true; //~ ERROR mismatched types
- //~| expected char, found bool
-}
+++ /dev/null
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Foo {
- fn foo(self: Box<Self>);
-}
-
-impl Foo for isize {
- fn foo(self: Box<isize>) { }
-}
-
-fn main() {
- (&5isize as &Foo).foo();
- //~^ ERROR: no method named `foo` found for type `&dyn Foo` in the current scope
-}
+++ /dev/null
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn f() { }
-struct S(Box<FnMut()>);
-pub static C: S = S(f); //~ ERROR mismatched types
-
-
-fn g() { }
-type T = Box<FnMut()>;
-pub static D: T = g; //~ ERROR mismatched types
-
-fn main() {}
+++ /dev/null
-// 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 transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T {
- match (&t,) { //~ ERROR cannot infer an appropriate lifetime
- ((u,),) => u,
- }
-}
-
-fn main() {
- let x = {
- let y = Box::new((42,));
- transmute_lifetime(&y)
- };
-
- println!("{}", x);
-}
+++ /dev/null
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-enum Either<T, U> { Left(T), Right(U) }
-struct S(Either<usize, usize>);
-
-fn main() {
- match S(Either::Left(5)) {
- Either::Right(_) => {}
- //~^ ERROR mismatched types
- //~| expected type `S`
- //~| found type `Either<_, _>`
- //~| expected struct `S`, found enum `Either`
- _ => {}
- }
-}
+++ /dev/null
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(box_syntax)]
-
-struct Foo {
- foo: isize,
-}
-
-struct Bar {
- bar: isize,
-}
-
-impl Bar {
- fn make_foo (&self, i: isize) -> Box<Foo> {
- return box Foo { nonexistent: self, foo: i }; //~ ERROR: no field named
- }
-}
-
-fn main () {
- let bar = Bar { bar: 1 };
- let foo = bar.make_foo(2);
- println!("{}", foo.foo);
-}
+++ /dev/null
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait A {}
-
-struct Struct {
- r: A+'static
-}
-
-fn new_struct(r: A+'static)
- -> Struct { //~^ ERROR the size for values of type
- //~^ ERROR the size for values of type
- Struct { r: r }
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-
-fn main() {
- let z = match 3 {
- x(1) => x(1) //~ ERROR cannot find tuple struct/variant `x` in this scope
- //~^ ERROR cannot find function `x` in this scope
- };
- assert!(z == 3);
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn f<Z>() -> bool {
- enum E { V(Z) }
- //~^ ERROR can't use type parameters from outer function
- true
-}
-
-fn main() {
- let b = f::<isize>();
- assert!(b);
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn f<T>() -> bool {
- struct S(T); //~ ERROR can't use type parameters from outer function
-
- true
-}
-
-fn main() {
- let b = f::<isize>();
- assert!(b);
-}
+++ /dev/null
-// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- // Unconstrained type:
- format!("{:?}", None);
- //~^ ERROR type annotations needed [E0282]
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// error-pattern: unknown macro variable `nonexistent`
-
-macro_rules! e {
- ($inp:ident) => (
- $nonexistent
- );
-}
-
-fn main() {
- e!(foo);
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(macro_rules)]
-
-// error-pattern: unknown macro variable `nonexistent`
-
-macro_rules! g {
- ($inp:ident) => (
- { $inp $nonexistent }
- );
-}
-
-fn main() {
- g!(foo);
-}
+++ /dev/null
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct A;
-impl A {
- fn m(&self) {
- fn x() {
- self.m() //~ ERROR can't capture dynamic environment in a fn item
- }
- }
-}
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Foo<T> {
- x: T,
-}
-impl<T> Foo<T> {
- fn add(&mut self, v: Foo<T>){
- self.x += v.x;
- //~^ ERROR: binary assignment operation `+=` cannot be applied
- }
-}
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Creating a stack closure which references a box and then
-// transferring ownership of the box before invoking the stack
-// closure results in a crash.
-
-#![feature(box_syntax)]
-
-fn twice(x: Box<usize>) -> usize {
- *x * 2
-}
-
-fn invoke<F>(f: F) where F: FnOnce() -> usize {
- f();
-}
-
-fn main() {
- let x : Box<usize> = box 9;
- let sq = || { *x * *x };
-
- twice(x); //~ ERROR: cannot move out of
- invoke(sq);
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Matching against NaN should result in a warning
-
-#![allow(unused)]
-#![deny(illegal_floating_point_literal_pattern)]
-
-use std::f64::NAN;
-
-fn main() {
- let x = NAN;
- match x {
- NAN => {}, //~ ERROR floating-point types cannot be used
- //~^ WARN this was previously accepted by the compiler but is being phased out
- _ => {},
- };
-
- match [x, 1.0] {
- [NAN, _] => {}, //~ ERROR floating-point types cannot be used
- //~^ WARN this was previously accepted by the compiler but is being phased out
- _ => {},
- };
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct T;
-
-mod t1 {
- type Foo = ::T;
- mod Foo {} //~ ERROR the name `Foo` is defined multiple times
-}
-
-mod t2 {
- type Foo = ::T;
- struct Foo; //~ ERROR the name `Foo` is defined multiple times
-}
-
-mod t3 {
- type Foo = ::T;
- enum Foo {} //~ ERROR the name `Foo` is defined multiple times
-}
-
-mod t4 {
- type Foo = ::T;
- fn Foo() {} // ok
-}
-
-mod t5 {
- type Bar<T> = T;
- mod Bar {} //~ ERROR the name `Bar` is defined multiple times
-}
-
-mod t6 {
- type Foo = ::T;
- impl Foo {} // ok
-}
-
-
-fn main() {}
+++ /dev/null
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(box_syntax)]
-
-use std::cell::RefCell;
-use std::rc::Rc;
-
-trait Foo {
- fn set(&mut self, v: Rc<RefCell<A>>);
-}
-
-struct B {
- v: Option<Rc<RefCell<A>>>
-}
-
-impl Foo for B {
- fn set(&mut self, v: Rc<RefCell<A>>)
- {
- self.v = Some(v);
- }
-}
-
-struct A {
- v: Box<Foo + Send>,
-}
-
-fn main() {
- let a = A {v: box B{v: None} as Box<Foo+Send>};
- //~^ ERROR `std::rc::Rc<std::cell::RefCell<A>>` cannot be sent between threads safely
-}
+++ /dev/null
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-static X: isize = 0;
-struct X; //~ ERROR the name `X` is defined multiple times
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct BarStruct;
-
-impl<'a> BarStruct {
- fn foo(&'a mut self) -> Box<BarStruct> { self }
- //~^ ERROR mismatched types
- //~| expected type `std::boxed::Box<BarStruct>`
- //~| found type `&'a mut BarStruct`
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-enum Whatever {
-}
-
-fn foo(x: Whatever) {
- match x {
- Some(field) =>
-//~^ ERROR mismatched types
-//~| expected type `Whatever`
-//~| found type `std::option::Option<_>`
-//~| expected enum `Whatever`, found enum `std::option::Option`
- field.access(),
- }
-}
-
-fn main(){}
+++ /dev/null
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![deny(unreachable_code)]
-#![allow(dead_code)]
-
-use std::ptr;
-pub unsafe fn g() {
- return;
- if *ptr::null() {}; //~ ERROR unreachable
-}
-
-pub fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(box_syntax)]
-
-use std::cell::RefCell;
-
-// Regression test for issue 7364
-static boxed: Box<RefCell<isize>> = box RefCell::new(0);
-//~^ ERROR allocations are not allowed in statics
-//~| ERROR `std::cell::RefCell<isize>` cannot be shared between threads safely [E0277]
-
-fn main() { }
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Foo {
- x: isize
-}
-
-impl Fo { //~ ERROR cannot find type `Fo` in this scope
- fn foo() {}
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-enum A { B, C }
-
-mod foo { pub fn bar() {} }
-
-fn main() {
- match (true, false) {
- A::B => (),
- //~^ ERROR mismatched types
- //~| expected type `(bool, bool)`
- //~| found type `A`
- //~| expected tuple, found enum `A`
- _ => ()
- }
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// tests the good error message, not "missing module Foo" or something else unexpected
-
-struct Foo;
-
-fn main() {
- Foo::bar();
- //~^ ERROR no function or associated item named `bar` found for type `Foo`
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-macro_rules! one_arg_macro {
- ($fmt:expr) => (print!(concat!($fmt, "\n")));
-}
-
-fn main() {
- one_arg_macro!();
- //~^ ERROR unexpected end of macro invocation
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {}
-
-macro_rules! test {}
-//~^ ERROR unexpected end of macro invocation
+++ /dev/null
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Test that duplicate methods in impls are not allowed
-
-struct Foo;
-
-trait Bar {
- fn bar(&self) -> isize;
-}
-
-impl Bar for Foo {
- fn bar(&self) -> isize {1}
- fn bar(&self) -> isize {2} //~ ERROR duplicate definitions
-}
-
-fn main() {
- println!("{}", Foo.bar());
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use self::*; //~ ERROR: unresolved import `self::*` [E0432]
- //~^ Cannot glob-import a module into itself.
-
-mod foo {
- use foo::*; //~ ERROR: unresolved import `foo::*` [E0432]
- //~^ Cannot glob-import a module into itself.
-
- mod bar {
- use super::bar::*;
- //~^ ERROR: unresolved import `super::bar::*` [E0432]
- //~| Cannot glob-import a module into itself.
- }
-
-}
-
-fn main() {
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![deny(const_err)]
-
-use std::{isize, i8, i16, i32, i64};
-use std::thread;
-
-fn main() {
- assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err());
- //~^ ERROR attempt to divide with overflow
- //~| ERROR this expression will panic at runtime
- assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err());
- //~^ ERROR attempt to divide with overflow
- //~| ERROR this expression will panic at runtime
- assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err());
- //~^ ERROR attempt to divide with overflow
- //~| ERROR this expression will panic at runtime
- assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err());
- //~^ ERROR attempt to divide with overflow
- //~| ERROR this expression will panic at runtime
- assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err());
- //~^ ERROR attempt to divide with overflow
- //~| ERROR this expression will panic at runtime
- assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err());
- //~^ ERROR attempt to divide by zero
- //~| ERROR this expression will panic at runtime
- assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err());
- //~^ ERROR attempt to divide by zero
- //~| ERROR this expression will panic at runtime
- assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err());
- //~^ ERROR attempt to divide by zero
- //~| ERROR this expression will panic at runtime
- assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err());
- //~^ ERROR attempt to divide by zero
- //~| ERROR this expression will panic at runtime
- assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err());
- //~^ ERROR attempt to divide by zero
- //~| ERROR this expression will panic at runtime
- assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err());
- //~^ ERROR attempt to calculate the remainder with overflow
- //~| ERROR this expression will panic at runtime
- assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err());
- //~^ ERROR attempt to calculate the remainder with overflow
- //~| ERROR this expression will panic at runtime
- assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err());
- //~^ ERROR attempt to calculate the remainder with overflow
- //~| ERROR this expression will panic at runtime
- assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err());
- //~^ ERROR attempt to calculate the remainder with overflow
- //~| ERROR this expression will panic at runtime
- assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err());
- //~^ ERROR attempt to calculate the remainder with overflow
- //~| ERROR this expression will panic at runtime
- assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err());
- //~^ ERROR attempt to calculate the remainder with a divisor of zero
- //~| ERROR this expression will panic at runtime
- assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err());
- //~^ ERROR attempt to calculate the remainder with a divisor of zero
- //~| ERROR this expression will panic at runtime
- assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err());
- //~^ ERROR attempt to calculate the remainder with a divisor of zero
- //~| ERROR this expression will panic at runtime
- assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err());
- //~^ ERROR attempt to calculate the remainder with a divisor of zero
- //~| ERROR this expression will panic at runtime
- assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err());
- //~^ ERROR attempt to calculate the remainder with a divisor of zero
- //~| ERROR this expression will panic at runtime
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#[allow(unused_imports)]
-
-mod foo {
- use baz::bar;
- mod bar {}
- //~^ ERROR the name `bar` is defined multiple times
-}
-mod baz { pub mod bar {} }
-
-fn main() {}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// error-pattern:reached the recursion limit while instantiating `generic::<std::option::Option<
-
-// Verify the compiler fails with an error on infinite function
-// recursions.
-
-fn generic<T>() {
- generic::<Option<T>>();
-}
-
-
-fn main () {
- // Use generic<T> at least once to trigger instantiation.
- generic::<i32>();
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-enum Foo {
- A = 1i64,
- //~^ ERROR mismatched types
- //~| expected isize, found i64
- B = 2u8
- //~^ ERROR mismatched types
- //~| expected isize, found u8
-}
-
-fn main() {}
+++ /dev/null
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-impl B { //~ ERROR cannot find type `B` in this scope
-}
-
-fn main() {
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(start)]
-
-#[start]
-fn start(argc: isize, argv: *const *const u8, crate_map: *const u8) -> isize {
- //~^ start function has wrong type
- 0
-}
+++ /dev/null
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct A { foo: isize }
-
-fn main() {
- let A { foo, foo } = A { foo: 3 };
- //~^ ERROR: identifier `foo` is bound more than once in the same pattern
- //~^^ ERROR: field `foo` bound multiple times
-}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Verify that single-variant enums can't be de-referenced
-// Regression test for issue #9814
-
-enum Foo { Bar(isize) }
-
-fn main() {
- let _ = *Foo::Bar(2); //~ ERROR type `Foo` cannot be dereferenced
-}
+++ /dev/null
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-enum E {
- A,
- B,
-}
-
-fn main() {
- match None {
- None => {}
- Some(E::A(..)) => {} //~ ERROR expected tuple struct/variant, found unit variant `E::A`
- Some(E::B(..)) => {} //~ ERROR expected tuple struct/variant, found unit variant `E::B`
- }
-}
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn f() -> isize {
+ (return 1, return 2)
+//~^ ERROR mismatched types
+//~| expected type `isize`
+//~| found type `(!, !)`
+//~| expected isize, found tuple
+}
+
+fn main() {}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-10176.rs:12:5
+ |
+LL | fn f() -> isize {
+ | ----- expected `isize` because of return type
+LL | (return 1, return 2)
+ | ^^^^^^^^^^^^^^^^^^^^ expected isize, found tuple
+ |
+ = note: expected type `isize`
+ found type `(!, !)`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo(bool);
+fn foo(_: usize) -> Foo { Foo(false) }
+
+fn main() {
+ match Foo(true) {
+ foo(x) //~ ERROR expected tuple struct/variant, found function `foo`
+ => ()
+ }
+}
--- /dev/null
+error[E0532]: expected tuple struct/variant, found function `foo`
+ --> $DIR/issue-10200.rs:16:9
+ |
+LL | foo(x) //~ ERROR expected tuple struct/variant, found function `foo`
+ | ^^^ did you mean `Foo`?
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0532`.
--- /dev/null
+warning: not reporting region error due to nll
+ --> $DIR/issue-10291.rs:13:9
+ |
+LL | x //~ ERROR E0312
+ | ^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/issue-10291.rs:12:5
+ |
+LL | drop::<Box<for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ free region requires that `'x` must outlive `'static`
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn test<'x>(x: &'x isize) {
+ drop::<Box<for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| {
+ x //~ ERROR E0312
+ }));
+}
+
+fn main() {}
--- /dev/null
+error[E0312]: lifetime of reference outlives lifetime of borrowed content...
+ --> $DIR/issue-10291.rs:13:9
+ |
+LL | x //~ ERROR E0312
+ | ^
+ |
+note: ...the reference is valid for the anonymous lifetime #2 defined on the body at 12:65...
+ --> $DIR/issue-10291.rs:12:65
+ |
+LL | drop::<Box<for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| {
+ | _________________________________________________________________^
+LL | | x //~ ERROR E0312
+LL | | }));
+ | |_____^
+note: ...but the borrowed content is only valid for the lifetime 'x as defined on the function body at 11:9
+ --> $DIR/issue-10291.rs:11:9
+ |
+LL | fn test<'x>(x: &'x isize) {
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0312`.
--- /dev/null
+error[E0382]: use of moved value: `x`
+ --> $DIR/issue-10398.rs:17:14
+ |
+LL | let _a = x;
+ | - value moved here
+LL | drop(x);
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(box_syntax)]
+
+fn main() {
+ let x: Box<_> = box 1;
+ let f = move|| {
+ let _a = x;
+ drop(x);
+ //~^ ERROR: use of moved value: `x`
+ };
+ f();
+}
--- /dev/null
+error[E0382]: use of moved value: `x`
+ --> $DIR/issue-10398.rs:17:14
+ |
+LL | let _a = x;
+ | -- value moved here
+LL | drop(x);
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ let mut a = "a";
+ a += { "b" };
+ //~^ ERROR: binary assignment operation `+=` cannot be applied
+}
--- /dev/null
+error[E0368]: binary assignment operation `+=` cannot be applied to type `&str`
+ --> $DIR/issue-10401.rs:13:5
+ |
+LL | a += { "b" };
+ | -^^^^^^^^^^^
+ | |
+ | cannot use `+=` on type `&str`
+ | `+` can't be used to concatenate two `&str` strings
+help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
+ |
+LL | a.to_owned() += { "b" };
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0368`.
--- /dev/null
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Serializable<'self, T> { //~ ERROR lifetimes cannot use keyword names
+ fn serialize(val : &'self T) -> Vec<u8>; //~ ERROR lifetimes cannot use keyword names
+ fn deserialize(repr : &[u8]) -> &'self T; //~ ERROR lifetimes cannot use keyword names
+}
+
+impl<'self> Serializable<str> for &'self str { //~ ERROR lifetimes cannot use keyword names
+ //~^ ERROR lifetimes cannot use keyword names
+ //~| ERROR missing lifetime specifier
+ fn serialize(val : &'self str) -> Vec<u8> { //~ ERROR lifetimes cannot use keyword names
+ vec![1]
+ }
+ fn deserialize(repr: &[u8]) -> &'self str { //~ ERROR lifetimes cannot use keyword names
+ "hi"
+ }
+}
+
+fn main() {
+ println!("hello");
+ let x = "foo".to_string();
+ let y = x;
+ println!("{}", y);
+}
--- /dev/null
+error: lifetimes cannot use keyword names
+ --> $DIR/issue-10412.rs:11:20
+ |
+LL | trait Serializable<'self, T> { //~ ERROR lifetimes cannot use keyword names
+ | ^^^^^
+
+error: lifetimes cannot use keyword names
+ --> $DIR/issue-10412.rs:12:25
+ |
+LL | fn serialize(val : &'self T) -> Vec<u8>; //~ ERROR lifetimes cannot use keyword names
+ | ^^^^^
+
+error: lifetimes cannot use keyword names
+ --> $DIR/issue-10412.rs:13:38
+ |
+LL | fn deserialize(repr : &[u8]) -> &'self T; //~ ERROR lifetimes cannot use keyword names
+ | ^^^^^
+
+error: lifetimes cannot use keyword names
+ --> $DIR/issue-10412.rs:16:6
+ |
+LL | impl<'self> Serializable<str> for &'self str { //~ ERROR lifetimes cannot use keyword names
+ | ^^^^^
+
+error: lifetimes cannot use keyword names
+ --> $DIR/issue-10412.rs:16:36
+ |
+LL | impl<'self> Serializable<str> for &'self str { //~ ERROR lifetimes cannot use keyword names
+ | ^^^^^
+
+error: lifetimes cannot use keyword names
+ --> $DIR/issue-10412.rs:19:25
+ |
+LL | fn serialize(val : &'self str) -> Vec<u8> { //~ ERROR lifetimes cannot use keyword names
+ | ^^^^^
+
+error: lifetimes cannot use keyword names
+ --> $DIR/issue-10412.rs:22:37
+ |
+LL | fn deserialize(repr: &[u8]) -> &'self str { //~ ERROR lifetimes cannot use keyword names
+ | ^^^^^
+
+error[E0106]: missing lifetime specifier
+ --> $DIR/issue-10412.rs:16:13
+ |
+LL | impl<'self> Serializable<str> for &'self str { //~ ERROR lifetimes cannot use keyword names
+ | ^^^^^^^^^^^^^^^^^ expected lifetime parameter
+
+error: aborting due to 8 previous errors
+
+For more information about this error, try `rustc --explain E0106`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub mod a {
+ pub trait A {
+ fn foo(&self);
+ }
+
+}
+pub mod b {
+ use a::A;
+
+ pub struct B;
+ impl A for B { fn foo(&self) {} }
+
+ pub mod c {
+ use b::B;
+
+ fn foo(b: &B) {
+ b.foo(); //~ ERROR: no method named `foo` found
+ }
+ }
+
+}
+
+fn main() {}
--- /dev/null
+error[E0599]: no method named `foo` found for type `&b::B` in the current scope
+ --> $DIR/issue-10465.rs:27:15
+ |
+LL | b.foo(); //~ ERROR: no method named `foo` found
+ | ^^^
+ |
+ = help: items from traits can only be used if the trait is in scope
+ = note: the following trait is implemented but not in scope, perhaps add a `use` for it:
+ `use a::A;`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// We only want to assert that this doesn't ICE, we don't particularly care
+// about whether it nor it fails to compile.
+
+// error-pattern:
+
+macro_rules! foo{
+ () => {{
+ macro_rules! bar{() => (())}
+ 1
+ }}
+}
+
+pub fn main() {
+ foo!();
+
+ assert!({one! two()});
+ //~^ ERROR macros that expand to items must either be surrounded with braces or followed by a
+
+ // regardless of whether nested macro_rules works, the following should at
+ // least throw a conventional error.
+ assert!({one! two});
+ //~^ ERROR expected
+}
--- /dev/null
+error: macros that expand to items must either be surrounded with braces or followed by a semicolon
+ --> $DIR/issue-10536.rs:26:22
+ |
+LL | assert!({one! two()});
+ | ^^
+
+error: expected `(` or `{`, found `}`
+ --> $DIR/issue-10536.rs:31:22
+ |
+LL | assert!({one! two});
+ | ^ expected `(` or `{`
+
+error: aborting due to 2 previous errors
+
--- /dev/null
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+
+mod a {
+ struct S;
+ impl S { }
+}
+
+fn foo(_: a::S) { //~ ERROR: struct `S` is private
+}
+
+fn main() {}
--- /dev/null
+error[E0603]: struct `S` is private
+ --> $DIR/issue-10545.rs:17:11
+ |
+LL | fn foo(_: a::S) { //~ ERROR: struct `S` is private
+ | ^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0603`.
--- /dev/null
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![deny(missing_docs)]
+#![crate_type="lib"]
+//~^^ ERROR missing documentation for crate
--- /dev/null
+error: missing documentation for crate
+ --> $DIR/issue-10656.rs:11:1
+ |
+LL | / #![deny(missing_docs)]
+LL | | #![crate_type="lib"]
+ | |____________________^
+ |
+note: lint level defined here
+ --> $DIR/issue-10656.rs:11:9
+ |
+LL | #![deny(missing_docs)]
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags: -C linker=llllll -Z linker-flavor=ld
+// error-pattern: linker `llllll` not found
+
+fn main() {
+}
--- /dev/null
+error: linker `llllll` not found
+ |
+ = note: No such file or directory (os error 2)
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn f(_: extern "Rust" fn()) {}
+extern fn bar() {}
+
+fn main() { f(bar) }
+//~^ ERROR mismatched types
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-10764.rs:14:15
+ |
+LL | fn main() { f(bar) }
+ | ^^^ expected "Rust" fn, found "C" fn
+ |
+ = note: expected type `fn()`
+ found type `extern "C" fn() {bar}`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo { x: isize }
+extern {
+ fn foo(1: ());
+ //~^ ERROR: patterns aren't allowed in foreign function declarations
+ fn bar((): isize);
+ //~^ ERROR: patterns aren't allowed in foreign function declarations
+ fn baz(Foo { x }: isize);
+ //~^ ERROR: patterns aren't allowed in foreign function declarations
+ fn qux((x,y): ());
+ //~^ ERROR: patterns aren't allowed in foreign function declarations
+ fn this_is_actually_ok(a: usize);
+ fn and_so_is_this(_: usize);
+}
+fn main() {}
--- /dev/null
+error[E0130]: patterns aren't allowed in foreign function declarations
+ --> $DIR/issue-10877.rs:13:12
+ |
+LL | fn foo(1: ());
+ | ^ pattern not allowed in foreign function
+
+error[E0130]: patterns aren't allowed in foreign function declarations
+ --> $DIR/issue-10877.rs:15:12
+ |
+LL | fn bar((): isize);
+ | ^^ pattern not allowed in foreign function
+
+error[E0130]: patterns aren't allowed in foreign function declarations
+ --> $DIR/issue-10877.rs:17:12
+ |
+LL | fn baz(Foo { x }: isize);
+ | ^^^^^^^^^ pattern not allowed in foreign function
+
+error[E0130]: patterns aren't allowed in foreign function declarations
+ --> $DIR/issue-10877.rs:19:12
+ |
+LL | fn qux((x,y): ());
+ | ^^^^^ pattern not allowed in foreign function
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0130`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ let nil = ();
+ let _t = nil as usize; //~ ERROR: non-primitive cast: `()` as `usize`
+}
--- /dev/null
+error[E0605]: non-primitive cast: `()` as `usize`
+ --> $DIR/issue-10991.rs:13:14
+ |
+LL | let _t = nil as usize; //~ ERROR: non-primitive cast: `()` as `usize`
+ | ^^^^^^^^^^^^
+ |
+ = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0605`.
--- /dev/null
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags: -C lto -C prefer-dynamic
+
+// error-pattern: cannot prefer dynamic linking
+
+fn main() {}
--- /dev/null
+error: cannot prefer dynamic linking when performing LTO
+
+note: only 'staticlib', 'bin', and 'cdylib' outputs are supported with LTO
+
+error: aborting due to previous error
+
--- /dev/null
+error[E0502]: cannot borrow `*ptr` as immutable because it is also borrowed as mutable
+ --> $DIR/issue-11192.rs:30:10
+ |
+LL | let mut test = |foo: &Foo| {
+ | ----------- mutable borrow occurs here
+LL | println!("access {}", foo.x);
+LL | ptr = box Foo { x: ptr.x + 1 };
+ | --- previous borrow occurs due to use of `ptr` in closure
+...
+LL | test(&*ptr);
+ | -----^^^^^-
+ | | |
+ | | immutable borrow occurs here
+ | borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0502`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(box_syntax)]
+
+struct Foo {
+ x: isize
+}
+
+impl Drop for Foo {
+ fn drop(&mut self) {
+ println!("drop {}", self.x);
+ }
+}
+
+fn main() {
+ let mut ptr: Box<_> = box Foo { x: 0 };
+ let mut test = |foo: &Foo| {
+ println!("access {}", foo.x);
+ ptr = box Foo { x: ptr.x + 1 };
+ println!("access {}", foo.x);
+ };
+ test(&*ptr);
+ //~^ ERROR: cannot borrow `*ptr` as immutable
+}
--- /dev/null
+error[E0502]: cannot borrow `*ptr` as immutable because `ptr` is also borrowed as mutable
+ --> $DIR/issue-11192.rs:30:11
+ |
+LL | let mut test = |foo: &Foo| {
+ | ----------- mutable borrow occurs here
+LL | println!("access {}", foo.x);
+LL | ptr = box Foo { x: ptr.x + 1 };
+ | --- previous borrow occurs due to use of `ptr` in closure
+...
+LL | test(&*ptr);
+ | ^^^^ immutable borrow occurs here
+LL | //~^ ERROR: cannot borrow `*ptr` as immutable
+LL | }
+ | - mutable borrow ends here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0502`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::io::{self, Read};
+use std::vec;
+
+pub struct Container<'a> {
+ reader: &'a mut Read
+}
+
+impl<'a> Container<'a> {
+ pub fn wrap<'s>(reader: &'s mut io::Read) -> Container<'s> {
+ Container { reader: reader }
+ }
+
+ pub fn read_to(&mut self, vec: &mut [u8]) {
+ self.reader.read(vec);
+ }
+}
+
+pub fn for_stdin<'a>() -> Container<'a> {
+ let mut r = io::stdin();
+ Container::wrap(&mut r as &mut io::Read)
+}
+
+fn main() {
+ let mut c = for_stdin();
+ let mut v = Vec::new();
+ c.read_to(v); //~ ERROR E0308
+}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-11374.rs:36:15
+ |
+LL | c.read_to(v); //~ ERROR E0308
+ | ^
+ | |
+ | expected &mut [u8], found struct `std::vec::Vec`
+ | help: consider mutably borrowing here: `&mut v`
+ |
+ = note: expected type `&mut [u8]`
+ found type `std::vec::Vec<_>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+error[E0597]: borrowed value does not live long enough (Ast)
+ --> $DIR/issue-11493.rs:20:35
+ |
+LL | let y = x.as_ref().unwrap_or(&id(5));
+ | ^^^^^ - temporary value dropped here while still borrowed
+ | |
+ | temporary value does not live long enough
+...
+LL | }
+ | - temporary value needs to live until here
+ |
+ = note: consider using a `let` binding to increase its lifetime
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
--- /dev/null
+error[E0597]: borrowed value does not live long enough (Ast)
+ --> $DIR/issue-11493.rs:20:35
+ |
+LL | let y = x.as_ref().unwrap_or(&id(5));
+ | ^^^^^ - temporary value dropped here while still borrowed
+ | |
+ | temporary value does not live long enough
+...
+LL | }
+ | - temporary value needs to live until here
+ |
+ = note: consider using a `let` binding to increase its lifetime
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// This file must never have a trailing newline
+//
+// revisions: ast mir
+// compile-flags: -Z borrowck=compare
+
+fn id<T>(x: T) -> T { x }
+
+fn main() {
+ let x = Some(3);
+ let y = x.as_ref().unwrap_or(&id(5));
+ //[ast]~^ ERROR borrowed value does not live long enough (Ast)
+ //[mir]~^^ ERROR borrowed value does not live long enough (Ast)
+ // This actually passes in mir
+}
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(box_syntax)]
+
+struct Test {
+ func: Box<FnMut()+'static>
+}
+
+fn main() {
+ let closure: Box<Fn()+'static> = Box::new(|| ());
+ let test = box Test { func: closure }; //~ ERROR mismatched types
+}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-11515.rs:19:33
+ |
+LL | let test = box Test { func: closure }; //~ ERROR mismatched types
+ | ^^^^^^^ expected trait `std::ops::FnMut`, found trait `std::ops::Fn`
+ |
+ = note: expected type `std::boxed::Box<(dyn std::ops::FnMut() + 'static)>`
+ found type `std::boxed::Box<(dyn std::ops::Fn() + 'static)>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// This tests verifies that unary structs and enum variants
+// are treated as rvalues and their lifetime is not bounded to
+// the static scope.
+
+struct Test;
+
+impl Drop for Test {
+ fn drop (&mut self) {}
+}
+
+fn createTest<'a>() -> &'a Test {
+ let testValue = &Test; //~ ERROR borrowed value does not live long enough
+ return testValue;
+}
+
+
+pub fn main() {
+ createTest();
+}
--- /dev/null
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/issue-11681.rs:22:20
+ |
+LL | let testValue = &Test; //~ ERROR borrowed value does not live long enough
+ | ^^^^ temporary value does not live long enough
+LL | return testValue;
+LL | }
+ | - temporary value only lives until here
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 21:15...
+ --> $DIR/issue-11681.rs:21:15
+ |
+LL | fn createTest<'a>() -> &'a Test {
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ print!(test!());
+ //~^ ERROR: format argument must be a string literal
+}
--- /dev/null
+error: format argument must be a string literal.
+ --> $DIR/issue-11692-1.rs:12:12
+ |
+LL | print!(test!());
+ | ^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ concat!(test!());
+ //~^ ERROR cannot find macro `test!` in this scope
+}
--- /dev/null
+error: cannot find macro `test!` in this scope
+ --> $DIR/issue-11692-2.rs:12:13
+ |
+LL | concat!(test!());
+ | ^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// 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.
+
+#![feature(rustc_attrs)]
+#![allow(warnings)]
+
+struct Attr {
+ name: String,
+ value: String,
+}
+
+struct Element {
+ attrs: Vec<Box<Attr>>,
+}
+
+impl Element {
+ pub unsafe fn get_attr<'a>(&'a self, name: &str) {
+ self.attrs
+ .iter()
+ .find(|attr| {
+ let attr: &&Box<Attr> = std::mem::transmute(attr);
+ true
+ });
+ }
+}
+
+#[rustc_error]
+fn main() { //~ ERROR compilation successful
+ let element = Element { attrs: Vec::new() };
+ let _ = unsafe { element.get_attr("foo") };
+}
--- /dev/null
+error: compilation successful
+ --> $DIR/issue-11740.rs:35:1
+ |
+LL | / fn main() { //~ ERROR compilation successful
+LL | | let element = Element { attrs: Vec::new() };
+LL | | let _ = unsafe { element.get_attr("foo") };
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ let x = ();
+ 1 +
+ x //~^ ERROR E0277
+ ;
+
+ let x: () = ();
+ 1 +
+ x //~^ ERROR E0277
+ ;
+}
--- /dev/null
+error[E0277]: cannot add `()` to `{integer}`
+ --> $DIR/issue-11771.rs:13:7
+ |
+LL | 1 +
+ | ^ no implementation for `{integer} + ()`
+ |
+ = help: the trait `std::ops::Add<()>` is not implemented for `{integer}`
+
+error[E0277]: cannot add `()` to `{integer}`
+ --> $DIR/issue-11771.rs:18:7
+ |
+LL | 1 +
+ | ^ no implementation for `{integer} + ()`
+ |
+ = help: the trait `std::ops::Add<()>` is not implemented for `{integer}`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(box_syntax)]
+
+fn main() {
+ let a = Some(box 1);
+ match a {
+ Ok(a) => //~ ERROR: mismatched types
+ println!("{}",a),
+ None => panic!()
+ }
+}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-11844.rs:16:9
+ |
+LL | Ok(a) => //~ ERROR: mismatched types
+ | ^^^^^ expected enum `std::option::Option`, found enum `std::result::Result`
+ |
+ = note: expected type `std::option::Option<std::boxed::Box<{integer}>>`
+ found type `std::result::Result<_, _>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+error[E0505]: cannot move out of `v` because it is borrowed
+ --> $DIR/issue-11873.rs:14:14
+ |
+LL | let mut f = || v.push(2);
+ | ------------ borrow of `v` occurs here
+LL | let _w = v; //~ ERROR: cannot move out of `v`
+ | ^ move out of `v` occurs here
+LL |
+LL | f();
+ | - borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0505`.
--- /dev/null
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ let mut v = vec![1];
+ let mut f = || v.push(2);
+ let _w = v; //~ ERROR: cannot move out of `v`
+
+ f();
+}
--- /dev/null
+error[E0505]: cannot move out of `v` because it is borrowed
+ --> $DIR/issue-11873.rs:14:9
+ |
+LL | let mut f = || v.push(2);
+ | -- borrow of `v` occurs here
+LL | let _w = v; //~ ERROR: cannot move out of `v`
+ | ^^ move out of `v` occurs here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0505`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Test an example where we fail to infer the type parameter H. This
+// is because there is really nothing constraining it. At one time, we
+// would infer based on the where clauses in scope, but that no longer
+// works.
+
+trait Hash<H> {
+ fn hash2(&self, hasher: &H) -> u64;
+}
+
+trait Stream {
+ fn input(&mut self, bytes: &[u8]);
+ fn result(&self) -> u64;
+}
+
+trait StreamHasher {
+ type S : Stream;
+ fn stream(&self) -> Self::S;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+trait StreamHash<H: StreamHasher>: Hash<H> {
+ fn input_stream(&self, stream: &mut H::S);
+}
+
+impl<H: StreamHasher> Hash<H> for u8 {
+ fn hash2(&self, hasher: &H) -> u64 {
+ let mut stream = hasher.stream();
+ self.input_stream(&mut stream); //~ ERROR type annotations required
+ Stream::result(&stream)
+ }
+}
+
+impl<H: StreamHasher> StreamHash<H> for u8 {
+ fn input_stream(&self, stream: &mut H::S) {
+ Stream::input(stream, &[*self]);
+ }
+}
+
+fn main() {}
--- /dev/null
+error[E0284]: type annotations required: cannot resolve `<_ as StreamHasher>::S == <H as StreamHasher>::S`
+ --> $DIR/issue-12028.rs:39:14
+ |
+LL | self.input_stream(&mut stream); //~ ERROR type annotations required
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0284`.
--- /dev/null
+error[E0382]: use of moved value: `tx`
+ --> $DIR/issue-12041.rs:18:22
+ |
+LL | let tx = tx;
+ | ^^ value moved here in previous iteration of loop
+ |
+ = note: move occurs because `tx` has type `std::sync::mpsc::Sender<i32>`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::sync::mpsc::channel;
+use std::thread;
+
+fn main() {
+ let (tx, rx) = channel();
+ let _t = thread::spawn(move|| -> () {
+ loop {
+ let tx = tx;
+ //~^ ERROR: use of moved value: `tx`
+ tx.send(1);
+ }
+ });
+}
--- /dev/null
+error[E0382]: use of moved value: `tx`
+ --> $DIR/issue-12041.rs:18:17
+ |
+LL | let tx = tx;
+ | ^^ value moved here in previous iteration of loop
+ |
+ = note: move occurs because `tx` has type `std::sync::mpsc::Sender<i32>`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
--- /dev/null
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(box_patterns)]
+#![feature(box_syntax)]
+#![allow(dead_code)]
+#![allow(unused_variables)]
+#![deny(unreachable_patterns)]
+
+enum IntList {
+ Cons(isize, Box<IntList>),
+ Nil
+}
+
+fn tail(source_list: &IntList) -> IntList {
+ match source_list {
+ &IntList::Cons(val, box ref next_list) => tail(next_list),
+ &IntList::Cons(val, box IntList::Nil) => IntList::Cons(val, box IntList::Nil),
+//~^ ERROR unreachable pattern
+ _ => panic!()
+ }
+}
+
+fn main() {}
--- /dev/null
+error: unreachable pattern
+ --> $DIR/issue-12116.rs:25:9
+ |
+LL | &IntList::Cons(val, box IntList::Nil) => IntList::Cons(val, box IntList::Nil),
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/issue-12116.rs:15:9
+ |
+LL | #![deny(unreachable_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(box_syntax, unboxed_closures)]
+
+fn to_fn_once<A,F:FnOnce<A>>(f: F) -> F { f }
+fn do_it(x: &isize) { }
+
+fn main() {
+ let x: Box<_> = box 22;
+ let f = to_fn_once(move|| do_it(&*x));
+ to_fn_once(move|| {
+ f();
+ f();
+ //~^ ERROR: use of moved value: `f`
+ })()
+}
--- /dev/null
+error[E0382]: use of moved value: `f`
+ --> $DIR/issue-12127.rs:21:9
+ |
+LL | f();
+ | - value moved here
+LL | f();
+ | ^ value used here after move
+ |
+ = note: move occurs because `f` has type `[closure@$DIR/issue-12127.rs:18:24: 18:41 x:std::boxed::Box<isize>]`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(slice_patterns)]
+#![deny(unreachable_patterns)]
+
+fn main() {
+ let sl = vec![1,2,3];
+ let v: isize = match &*sl {
+ &[] => 0,
+ &[a,b,c] => 3,
+ &[a, ref rest..] => a,
+ &[10,a, ref rest..] => 10 //~ ERROR: unreachable pattern
+ };
+}
--- /dev/null
+error: unreachable pattern
+ --> $DIR/issue-12369.rs:20:9
+ |
+LL | &[10,a, ref rest..] => 10 //~ ERROR: unreachable pattern
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/issue-12369.rs:12:9
+ |
+LL | #![deny(unreachable_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+error[E0597]: `*b` does not live long enough
+ --> $DIR/issue-12470.rs:38:18
+ |
+LL | let bb: &B = &*b; //~ ERROR does not live long enough
+ | ^^^ borrowed value does not live long enough
+LL | make_a(bb)
+LL | }
+ | - borrowed value only lives until here
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 36:16...
+ --> $DIR/issue-12470.rs:36:16
+ |
+LL | fn make_make_a<'a>() -> A<'a> {
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
--- /dev/null
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(box_syntax)]
+
+trait X {
+ fn get_i(&self) -> isize;
+}
+
+
+struct B {
+ i: isize
+}
+
+impl X for B {
+ fn get_i(&self) -> isize {
+ self.i
+ }
+}
+
+struct A<'a> {
+ p: &'a (X+'a)
+}
+
+fn make_a<'a>(p: &'a X) -> A<'a> {
+ A { p: p }
+}
+
+fn make_make_a<'a>() -> A<'a> {
+ let b: Box<B> = box B {i:1};
+ let bb: &B = &*b; //~ ERROR does not live long enough
+ make_a(bb)
+}
+
+fn main() {
+ let _a = make_make_a();
+}
--- /dev/null
+error[E0597]: `*b` does not live long enough
+ --> $DIR/issue-12470.rs:38:19
+ |
+LL | let bb: &B = &*b; //~ ERROR does not live long enough
+ | ^^ borrowed value does not live long enough
+LL | make_a(bb)
+LL | }
+ | - borrowed value only lives until here
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 36:16...
+ --> $DIR/issue-12470.rs:36:16
+ |
+LL | fn make_make_a<'a>() -> A<'a> {
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// this code used to cause an ICE
+
+fn main() {
+ let t = Err(0);
+ match t {
+ Some(k) => match k { //~ ERROR mismatched types
+ a => println!("{}", a)
+ },
+ None => () //~ ERROR mismatched types
+ }
+}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-12552.rs:16:5
+ |
+LL | Some(k) => match k { //~ ERROR mismatched types
+ | ^^^^^^^ expected enum `std::result::Result`, found enum `std::option::Option`
+ |
+ = note: expected type `std::result::Result<_, {integer}>`
+ found type `std::option::Option<_>`
+
+error[E0308]: mismatched types
+ --> $DIR/issue-12552.rs:19:5
+ |
+LL | None => () //~ ERROR mismatched types
+ | ^^^^ expected enum `std::result::Result`, found enum `std::option::Option`
+ |
+ = note: expected type `std::result::Result<_, {integer}>`
+ found type `std::option::Option<_>`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+error[E0508]: cannot move out of type `[T]`, a non-copy slice
+ --> $DIR/issue-12567.rs:14:11
+ |
+LL | match (l1, l2) {
+ | ^^^^^^^^ cannot move out of here
+help: to prevent move, use ref or ref mut
+ |
+LL | (&[], &[ref hd, ..]) | (&[hd, ..], &[])
+ | ^^^^^^
+help: to prevent move, use ref or ref mut
+ |
+LL | (&[hd1, ..], &[ref hd2, ..])
+ | ^^^^^^^
+
+error[E0508]: cannot move out of type `[T]`, a non-copy slice
+ --> $DIR/issue-12567.rs:14:11
+ |
+LL | match (l1, l2) {
+ | ^^^^^^^^ cannot move out of here
+help: to prevent move, use ref or ref mut
+ |
+LL | (&[], &[ref hd, ..]) | (&[hd, ..], &[])
+ | ^^^^^^
+help: to prevent move, use ref or ref mut
+ |
+LL | (&[ref hd1, ..], &[hd2, ..])
+ | ^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0508`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(slice_patterns)]
+
+fn match_vecs<'a, T>(l1: &'a [T], l2: &'a [T]) {
+ match (l1, l2) {
+ (&[], &[]) => println!("both empty"),
+ (&[], &[hd, ..]) | (&[hd, ..], &[])
+ => println!("one empty"),
+ //~^^ ERROR: cannot move out of type `[T]`, a non-copy slice
+ //~^^^ ERROR: cannot move out of type `[T]`, a non-copy slice
+ (&[hd1, ..], &[hd2, ..])
+ => println!("both nonempty"),
+ //~^^ ERROR: cannot move out of type `[T]`, a non-copy slice
+ //~^^^ ERROR: cannot move out of type `[T]`, a non-copy slice
+ }
+}
+
+fn main() {}
--- /dev/null
+error[E0508]: cannot move out of type `[T]`, a non-copy slice
+ --> $DIR/issue-12567.rs:16:16
+ |
+LL | (&[], &[hd, ..]) | (&[hd, ..], &[])
+ | ^--^^^^^
+ | ||
+ | |hint: to prevent move, use `ref hd` or `ref mut hd`
+ | cannot move out of here
+
+error[E0508]: cannot move out of type `[T]`, a non-copy slice
+ --> $DIR/issue-12567.rs:16:30
+ |
+LL | (&[], &[hd, ..]) | (&[hd, ..], &[])
+ | ^--^^^^^
+ | ||
+ | |hint: to prevent move, use `ref hd` or `ref mut hd`
+ | cannot move out of here
+
+error[E0508]: cannot move out of type `[T]`, a non-copy slice
+ --> $DIR/issue-12567.rs:20:11
+ |
+LL | (&[hd1, ..], &[hd2, ..])
+ | ^---^^^^^
+ | ||
+ | |hint: to prevent move, use `ref hd1` or `ref mut hd1`
+ | cannot move out of here
+
+error[E0508]: cannot move out of type `[T]`, a non-copy slice
+ --> $DIR/issue-12567.rs:20:23
+ |
+LL | (&[hd1, ..], &[hd2, ..])
+ | ^---^^^^^
+ | ||
+ | |hint: to prevent move, use `ref hd2` or `ref mut hd2`
+ | cannot move out of here
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0508`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Trait {
+ fn outer(&self) {
+ fn inner(_: &Self) {
+ //~^ ERROR can't use type parameters from outer function
+ }
+ }
+}
+
+fn main() { }
--- /dev/null
+error[E0401]: can't use type parameters from outer function
+ --> $DIR/issue-12796.rs:13:22
+ |
+LL | fn inner(_: &Self) {
+ | ----- ^^^^ use of type variable from outer function
+ | |
+ | help: try using a local type parameter instead: `inner<Self>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0401`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+mod foo { pub fn bar() {} }
+
+fn main() {
+ match () {
+ foo::bar => {} //~ ERROR expected unit struct/variant or constant, found function `foo::bar`
+ }
+}
--- /dev/null
+error[E0532]: expected unit struct/variant or constant, found function `foo::bar`
+ --> $DIR/issue-12863.rs:15:9
+ |
+LL | foo::bar => {} //~ ERROR expected unit struct/variant or constant, found function `foo::bar`
+ | ^^^^^^^^ not a unit struct/variant or constant
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0532`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags: --test
+
+//! Test that makes sure wrongly-typed bench functions aren't ignored
+
+#[bench]
+fn foo() { } //~ ERROR functions used as benches
+
+#[bench]
+fn bar(x: isize, y: isize) { } //~ ERROR functions used as benches
--- /dev/null
+error: functions used as benches must have signature `fn(&mut Bencher) -> impl Termination`
+ --> $DIR/issue-12997-1.rs:16:1
+ |
+LL | fn foo() { } //~ ERROR functions used as benches
+ | ^^^^^^^^^^^^
+
+error: functions used as benches must have signature `fn(&mut Bencher) -> impl Termination`
+ --> $DIR/issue-12997-1.rs:19:1
+ |
+LL | fn bar(x: isize, y: isize) { } //~ ERROR functions used as benches
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags: --test
+
+//! Test that makes sure wrongly-typed bench functions are rejected
+
+#[bench]
+fn bar(x: isize) { }
+//~^ ERROR mismatched types
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-12997-2.rs:16:1
+ |
+LL | fn bar(x: isize) { }
+ | ^^^^^^^^^^^^^^^^^^^^ expected isize, found mutable reference
+ |
+ = note: expected type `isize`
+ found type `&mut __test::test::Bencher`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Foo {
+ fn bar(&mut self, other: &mut Foo);
+}
+
+struct Baz;
+
+impl Foo for Baz {
+ fn bar(&mut self, other: &Foo) {}
+ //~^ ERROR method `bar` has an incompatible type for trait
+ //~| expected type `fn(&mut Baz, &mut dyn Foo)`
+ //~| found type `fn(&mut Baz, &dyn Foo)`
+}
+
+fn main() {}
--- /dev/null
+error[E0053]: method `bar` has an incompatible type for trait
+ --> $DIR/issue-13033.rs:18:30
+ |
+LL | fn bar(&mut self, other: &mut Foo);
+ | -------- type in trait
+...
+LL | fn bar(&mut self, other: &Foo) {}
+ | ^^^^ types differ in mutability
+ |
+ = note: expected type `fn(&mut Baz, &mut dyn Foo)`
+ found type `fn(&mut Baz, &dyn Foo)`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0053`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-cloudabi no std::process
+
+fn foo(_: Box<FnMut()>) {}
+
+fn main() {
+ foo(loop {
+ std::process::exit(0);
+ });
+ 2_usize + (loop {});
+ //~^ ERROR E0277
+}
--- /dev/null
+error[E0277]: cannot add `()` to `usize`
+ --> $DIR/issue-13352.rs:19:13
+ |
+LL | 2_usize + (loop {});
+ | ^ no implementation for `usize + ()`
+ |
+ = help: the trait `std::ops::Add<()>` is not implemented for `usize`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn foo(_s: i16) { }
+
+fn bar(_s: u32) { }
+
+fn main() {
+ foo(1*(1 as isize));
+ //~^ ERROR mismatched types
+ //~| expected i16, found isize
+
+ bar(1*(1 as usize));
+ //~^ ERROR mismatched types
+ //~| expected u32, found usize
+}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-13359.rs:16:9
+ |
+LL | foo(1*(1 as isize));
+ | ^^^^^^^^^^^^^^ expected i16, found isize
+
+error[E0308]: mismatched types
+ --> $DIR/issue-13359.rs:20:9
+ |
+LL | bar(1*(1 as usize));
+ | ^^^^^^^^^^^^^^ expected u32, found usize
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use a::f;
+use b::f; //~ ERROR: unresolved import `b::f` [E0432]
+ //~^ no `f` in `b`
+
+mod a { pub fn f() {} }
+mod b { }
+
+fn main() {
+ f();
+}
--- /dev/null
+error[E0432]: unresolved import `b::f`
+ --> $DIR/issue-13404.rs:12:5
+ |
+LL | use b::f; //~ ERROR: unresolved import `b::f` [E0432]
+ | ^^^^ no `f` in `b`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0432`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+mod A {
+ struct C;
+}
+
+fn main() {
+ A::C = 1;
+ //~^ ERROR: invalid left-hand side expression
+ //~| ERROR: mismatched types
+ //~| ERROR: struct `C` is private
+}
--- /dev/null
+error[E0603]: unit struct `C` is private
+ --> $DIR/issue-13407.rs:16:5
+ |
+LL | A::C = 1;
+ | ^^^^
+
+error[E0308]: mismatched types
+ --> $DIR/issue-13407.rs:16:12
+ |
+LL | A::C = 1;
+ | ^ expected struct `A::C`, found integral variable
+ |
+ = note: expected type `A::C`
+ found type `{integer}`
+
+error[E0070]: invalid left-hand side expression
+ --> $DIR/issue-13407.rs:16:5
+ |
+LL | A::C = 1;
+ | ^^^^^^^^ left-hand of expression not valid
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0070, E0308, E0603.
+For more information about an error, try `rustc --explain E0070`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+
+// Used to cause ICE
+
+// error-pattern: mismatched types
+
+static VEC: [u32; 256] = vec![];
+
+fn main() {}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-13446.rs:16:26
+ |
+LL | static VEC: [u32; 256] = vec![];
+ | ^^^^^^ expected array of 256 elements, found struct `std::vec::Vec`
+ |
+ = note: expected type `[u32; 256]`
+ found type `std::vec::Vec<_>`
+ = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Regression test for #13466
+
+pub fn main() {
+ // The expected arm type `Option<T>` has one type parameter, while
+ // the actual arm `Result<T, E>` has two. typeck should not be
+ // tricked into looking up a non-existing second type parameter.
+ let _x: usize = match Some(1) {
+ Ok(u) => u,
+ //~^ ERROR mismatched types
+ //~| expected type `std::option::Option<{integer}>`
+ //~| found type `std::result::Result<_, _>`
+ //~| expected enum `std::option::Option`, found enum `std::result::Result`
+
+ Err(e) => panic!(e)
+ //~^ ERROR mismatched types
+ //~| expected type `std::option::Option<{integer}>`
+ //~| found type `std::result::Result<_, _>`
+ //~| expected enum `std::option::Option`, found enum `std::result::Result`
+ };
+}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-13466.rs:18:9
+ |
+LL | Ok(u) => u,
+ | ^^^^^ expected enum `std::option::Option`, found enum `std::result::Result`
+ |
+ = note: expected type `std::option::Option<{integer}>`
+ found type `std::result::Result<_, _>`
+
+error[E0308]: mismatched types
+ --> $DIR/issue-13466.rs:24:9
+ |
+LL | Err(e) => panic!(e)
+ | ^^^^^^ expected enum `std::option::Option`, found enum `std::result::Result`
+ |
+ = note: expected type `std::option::Option<{integer}>`
+ found type `std::result::Result<_, _>`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags:-Z verbose
+
+fn main() {
+ let x = [1,2];
+ let y = match x {
+ [] => None, //~ ERROR pattern requires 0 elements but array has 2
+ [a,_] => Some(a)
+ };
+}
--- /dev/null
+error[E0527]: pattern requires 0 elements but array has 2
+ --> $DIR/issue-13482-2.rs:16:9
+ |
+LL | [] => None, //~ ERROR pattern requires 0 elements but array has 2
+ | ^^ expected 2 elements
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0527`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ let x = [1,2];
+ let y = match x {
+ [] => None, //~ ERROR pattern requires 0 elements but array has 2
+ [a,_] => Some(a)
+ };
+}
--- /dev/null
+error[E0527]: pattern requires 0 elements but array has 2
+ --> $DIR/issue-13482.rs:14:5
+ |
+LL | [] => None, //~ ERROR pattern requires 0 elements but array has 2
+ | ^^ expected 2 elements
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0527`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn read_lines_borrowed<'a>() -> Vec<&'a str> {
+ let rawLines: Vec<String> = vec!["foo ".to_string(), " bar".to_string()];
+ rawLines //~ ERROR `rawLines` does not live long enough
+ .iter().map(|l| l.trim()).collect()
+}
+
+fn main() {}
--- /dev/null
+error[E0597]: `rawLines` does not live long enough
+ --> $DIR/issue-13497-2.rs:13:5
+ |
+LL | rawLines //~ ERROR `rawLines` does not live long enough
+ | ^^^^^^^^ borrowed value does not live long enough
+LL | .iter().map(|l| l.trim()).collect()
+LL | }
+ | - borrowed value only lives until here
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 11:24...
+ --> $DIR/issue-13497-2.rs:11:24
+ |
+LL | fn read_lines_borrowed<'a>() -> Vec<&'a str> {
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn read_lines_borrowed1() -> Vec<
+ &str //~ ERROR missing lifetime specifier
+> {
+ let rawLines: Vec<String> = vec!["foo ".to_string(), " bar".to_string()];
+ rawLines.iter().map(|l| l.trim()).collect()
+}
+
+fn main() {}
--- /dev/null
+error[E0106]: missing lifetime specifier
+ --> $DIR/issue-13497.rs:12:5
+ |
+LL | &str //~ ERROR missing lifetime specifier
+ | ^ expected lifetime parameter
+ |
+ = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
+ = help: consider giving it a 'static lifetime
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0106`.
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Regression test for issue #1362 - without that fix the span will be bogus
+// no-reformat
+fn main() {
+ let x: u32 = 20i32; //~ ERROR mismatched types
+}
+// NOTE: Do not add any extra lines as the line number the error is
+// on is significant; an error later in the source file might not
+// trigger the bug.
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-1362.rs:14:16
+ |
+LL | let x: u32 = 20i32; //~ ERROR mismatched types
+ | ^^^^^ expected u32, found i32
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+mod a {
+ struct Foo;
+ impl Foo { pub fn new() {} }
+ enum Bar {}
+ impl Bar { pub fn new() {} }
+}
+
+fn main() {
+ a::Foo::new();
+ //~^ ERROR: struct `Foo` is private
+ a::Bar::new();
+ //~^ ERROR: enum `Bar` is private
+}
--- /dev/null
+error[E0603]: struct `Foo` is private
+ --> $DIR/issue-13641.rs:19:5
+ |
+LL | a::Foo::new();
+ | ^^^^^^^^^^^
+
+error[E0603]: enum `Bar` is private
+ --> $DIR/issue-13641.rs:21:5
+ |
+LL | a::Bar::new();
+ | ^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0603`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![allow(overflowing_literals)]
+#![deny(unreachable_patterns)]
+
+fn test(val: u8) {
+ match val {
+ 256 => print!("0b1110\n"),
+ 512 => print!("0b1111\n"),
+ //~^ ERROR: unreachable pattern
+ _ => print!("fail\n"),
+ }
+}
+
+fn main() {
+ test(1);
+}
--- /dev/null
+error: unreachable pattern
+ --> $DIR/issue-13727.rs:17:5
+ |
+LL | 512 => print!("0b1111/n"),
+ | ^^^
+ |
+note: lint level defined here
+ --> $DIR/issue-13727.rs:12:9
+ |
+LL | #![deny(unreachable_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ return.is_failure //~ ERROR no field `is_failure` on type `!`
+}
--- /dev/null
+error[E0609]: no field `is_failure` on type `!`
+ --> $DIR/issue-13847.rs:12:12
+ |
+LL | return.is_failure //~ ERROR no field `is_failure` on type `!`
+ | ^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0609`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait FromStructReader<'a> { }
+trait ResponseHook {
+ fn get(&self);
+}
+fn foo(res : Box<ResponseHook>) { res.get } //~ ERROR attempted to take value of method
+fn main() {}
--- /dev/null
+error[E0615]: attempted to take value of method `get` on type `std::boxed::Box<(dyn ResponseHook + 'static)>`
+ --> $DIR/issue-13853-2.rs:15:39
+ |
+LL | fn foo(res : Box<ResponseHook>) { res.get } //~ ERROR attempted to take value of method
+ | ^^^
+ |
+ = help: maybe a `()` to call it is missing?
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0615`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Deserializer<'a> { }
+
+trait Deserializable {
+ fn deserialize_token<'a, D: Deserializer<'a>>(_: D, _: &'a str) -> Self;
+}
+
+impl<'a, T: Deserializable> Deserializable for &'a str {
+ //~^ ERROR type parameter `T` is not constrained
+ fn deserialize_token<D: Deserializer<'a>>(_x: D, _y: &'a str) -> &'a str {
+ }
+}
+
+fn main() {}
--- /dev/null
+error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates
+ --> $DIR/issue-13853-5.rs:17:10
+ |
+LL | impl<'a, T: Deserializable> Deserializable for &'a str {
+ | ^ unconstrained type parameter
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0207`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Node {
+ fn zomg();
+}
+
+trait Graph<N: Node> {
+ fn nodes<'a, I: Iterator<Item=&'a N>>(&'a self) -> I
+ where N: 'a;
+}
+
+impl<N: Node> Graph<N> for Vec<N> {
+ fn nodes<'a, I: Iterator<Item=&'a N>>(&self) -> I
+ where N: 'a
+ {
+ self.iter() //~ ERROR mismatched types
+ }
+}
+
+struct Stuff;
+
+impl Node for Stuff {
+ fn zomg() {
+ println!("zomg");
+ }
+}
+
+fn iterate<N: Node, G: Graph<N>>(graph: &G) {
+ for node in graph.iter() { //~ ERROR no method named `iter` found
+ node.zomg();
+ }
+}
+
+pub fn main() {
+ let graph = Vec::new();
+
+ graph.push(Stuff);
+
+ iterate(graph); //~ ERROR mismatched types
+}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-13853.rs:24:9
+ |
+LL | fn nodes<'a, I: Iterator<Item=&'a N>>(&self) -> I
+ | - expected `I` because of return type
+...
+LL | self.iter() //~ ERROR mismatched types
+ | ^^^^^^^^^^^ expected type parameter, found struct `std::slice::Iter`
+ |
+ = note: expected type `I`
+ found type `std::slice::Iter<'_, N>`
+
+error[E0599]: no method named `iter` found for type `&G` in the current scope
+ --> $DIR/issue-13853.rs:37:23
+ |
+LL | for node in graph.iter() { //~ ERROR no method named `iter` found
+ | ^^^^
+
+error[E0308]: mismatched types
+ --> $DIR/issue-13853.rs:47:13
+ |
+LL | iterate(graph); //~ ERROR mismatched types
+ | ^^^^^
+ | |
+ | expected reference, found struct `std::vec::Vec`
+ | help: consider borrowing here: `&graph`
+ |
+ = note: expected type `&_`
+ found type `std::vec::Vec<Stuff>`
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0308, E0599.
+For more information about an error, try `rustc --explain E0308`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//
+
+// Very
+
+// sensitive
+pub struct BytePos(pub u32);
+
+// to particular
+
+// line numberings / offsets
+
+fn main() {
+ let x = BytePos(1);
+
+ assert!(x, x);
+ //~^ ERROR cannot apply unary operator `!` to type `BytePos`
+}
--- /dev/null
+error[E0600]: cannot apply unary operator `!` to type `BytePos`
+ --> $DIR/issue-14091-2.rs:25:5
+ |
+LL | assert!(x, x);
+ | ^^^^^^^^^^^^^^ cannot apply unary operator `!`
+ |
+ = note: an implementation of `std::ops::Not` might be missing for `BytePos`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0600`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main(){
+ assert!(1,1);
+ //~^ ERROR mismatched types
+}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-14091.rs:12:5
+ |
+LL | assert!(1,1);
+ | ^^^^^^^^^^^^^ expected bool, found integral variable
+ |
+ = note: expected type `bool`
+ found type `{integer}`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![deny(unreachable_patterns)]
+#![allow(unused_variables)]
+#![allow(non_snake_case)]
+
+pub enum E {
+ A,
+ B,
+}
+
+pub mod b {
+ pub fn key(e: ::E) -> &'static str {
+ match e {
+ A => "A",
+//~^ WARN pattern binding `A` is named the same as one of the variants of the type `E`
+ B => "B", //~ ERROR: unreachable pattern
+//~^ WARN pattern binding `B` is named the same as one of the variants of the type `E`
+ }
+ }
+}
+
+fn main() {}
--- /dev/null
+warning[E0170]: pattern binding `A` is named the same as one of the variants of the type `E`
+ --> $DIR/issue-14221.rs:23:13
+ |
+LL | A => "A",
+ | ^ help: to match on the variant, qualify the path: `E::A`
+
+warning[E0170]: pattern binding `B` is named the same as one of the variants of the type `E`
+ --> $DIR/issue-14221.rs:25:13
+ |
+LL | B => "B", //~ ERROR: unreachable pattern
+ | ^ help: to match on the variant, qualify the path: `E::B`
+
+error: unreachable pattern
+ --> $DIR/issue-14221.rs:25:13
+ |
+LL | A => "A",
+ | - matches any value
+LL | //~^ WARN pattern binding `A` is named the same as one of the variants of the type `E`
+LL | B => "B", //~ ERROR: unreachable pattern
+ | ^ unreachable pattern
+ |
+note: lint level defined here
+ --> $DIR/issue-14221.rs:11:9
+ |
+LL | #![deny(unreachable_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0170`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![allow(safe_extern_statics, warnings)]
+
+extern {
+ pub static symbol: ();
+}
+static CRASH: () = symbol;
+//~^ ERROR could not evaluate static initializer
+//~| tried to read from foreign (extern) static
+
+fn main() {}
--- /dev/null
+error[E0080]: could not evaluate static initializer
+ --> $DIR/issue-14227.rs:16:20
+ |
+LL | static CRASH: () = symbol;
+ | ^^^^^^ tried to read from foreign (extern) static
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0080`.
--- /dev/null
+warning: not reporting region error due to nll
+ --> $DIR/issue-14285.rs:22:7
+ |
+LL | B(a) //~ ERROR 22:5: 22:9: explicit lifetime required in the type of `a` [E0621]
+ | ^
+
+error[E0621]: explicit lifetime required in the type of `a`
+ --> $DIR/issue-14285.rs:22:7
+ |
+LL | fn foo<'a>(a: &Foo) -> B<'a> {
+ | - consider changing the type of `a` to `&'a (dyn Foo + 'a)`
+LL | B(a) //~ ERROR 22:5: 22:9: explicit lifetime required in the type of `a` [E0621]
+ | ^ lifetime `'a` required
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
--- /dev/null
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Foo {
+ fn dummy(&self) { }
+}
+
+struct A;
+
+impl Foo for A {}
+
+struct B<'a>(&'a (Foo+'a));
+
+fn foo<'a>(a: &Foo) -> B<'a> {
+ B(a) //~ ERROR 22:5: 22:9: explicit lifetime required in the type of `a` [E0621]
+}
+
+fn main() {
+ let _test = foo(&A);
+}
--- /dev/null
+error[E0621]: explicit lifetime required in the type of `a`
+ --> $DIR/issue-14285.rs:22:5
+ |
+LL | fn foo<'a>(a: &Foo) -> B<'a> {
+ | - consider changing the type of `a` to `&'a (dyn Foo + 'a)`
+LL | B(a) //~ ERROR 22:5: 22:9: explicit lifetime required in the type of `a` [E0621]
+ | ^^^^ lifetime `'a` required
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![deny(improper_ctypes)]
+#![allow(dead_code)]
+
+struct A {
+ x: i32
+}
+
+#[repr(C, packed)]
+struct B {
+ x: i32,
+ y: A
+}
+
+#[repr(C)]
+struct C {
+ x: i32
+}
+
+type A2 = A;
+type B2 = B;
+type C2 = C;
+
+#[repr(C)]
+struct D {
+ x: C,
+ y: A
+}
+
+extern "C" {
+ fn foo(x: A); //~ ERROR type `A` which is not FFI-safe
+ fn bar(x: B); //~ ERROR type `A`
+ fn baz(x: C);
+ fn qux(x: A2); //~ ERROR type `A`
+ fn quux(x: B2); //~ ERROR type `A`
+ fn corge(x: C2);
+ fn fred(x: D); //~ ERROR type `A`
+}
+
+fn main() { }
--- /dev/null
+error: `extern` block uses type `A` which is not FFI-safe: this struct has unspecified layout
+ --> $DIR/issue-14309.rs:40:15
+ |
+LL | fn foo(x: A); //~ ERROR type `A` which is not FFI-safe
+ | ^
+ |
+note: lint level defined here
+ --> $DIR/issue-14309.rs:11:9
+ |
+LL | #![deny(improper_ctypes)]
+ | ^^^^^^^^^^^^^^^
+ = help: consider adding a #[repr(C)] or #[repr(transparent)] attribute to this struct
+note: type defined here
+ --> $DIR/issue-14309.rs:14:1
+ |
+LL | / struct A {
+LL | | x: i32
+LL | | }
+ | |_^
+
+error: `extern` block uses type `A` which is not FFI-safe: this struct has unspecified layout
+ --> $DIR/issue-14309.rs:41:15
+ |
+LL | fn bar(x: B); //~ ERROR type `A`
+ | ^
+ |
+ = help: consider adding a #[repr(C)] or #[repr(transparent)] attribute to this struct
+note: type defined here
+ --> $DIR/issue-14309.rs:14:1
+ |
+LL | / struct A {
+LL | | x: i32
+LL | | }
+ | |_^
+
+error: `extern` block uses type `A` which is not FFI-safe: this struct has unspecified layout
+ --> $DIR/issue-14309.rs:43:15
+ |
+LL | fn qux(x: A2); //~ ERROR type `A`
+ | ^^
+ |
+ = help: consider adding a #[repr(C)] or #[repr(transparent)] attribute to this struct
+note: type defined here
+ --> $DIR/issue-14309.rs:14:1
+ |
+LL | / struct A {
+LL | | x: i32
+LL | | }
+ | |_^
+
+error: `extern` block uses type `A` which is not FFI-safe: this struct has unspecified layout
+ --> $DIR/issue-14309.rs:44:16
+ |
+LL | fn quux(x: B2); //~ ERROR type `A`
+ | ^^
+ |
+ = help: consider adding a #[repr(C)] or #[repr(transparent)] attribute to this struct
+note: type defined here
+ --> $DIR/issue-14309.rs:14:1
+ |
+LL | / struct A {
+LL | | x: i32
+LL | | }
+ | |_^
+
+error: `extern` block uses type `A` which is not FFI-safe: this struct has unspecified layout
+ --> $DIR/issue-14309.rs:46:16
+ |
+LL | fn fred(x: D); //~ ERROR type `A`
+ | ^
+ |
+ = help: consider adding a #[repr(C)] or #[repr(transparent)] attribute to this struct
+note: type defined here
+ --> $DIR/issue-14309.rs:14:1
+ |
+LL | / struct A {
+LL | | x: i32
+LL | | }
+ | |_^
+
+error: aborting due to 5 previous errors
+
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ let _x = "test" as &::std::any::Any;
+ //~^ ERROR the size for values of type
+}
--- /dev/null
+error[E0277]: the size for values of type `str` cannot be known at compilation time
+ --> $DIR/issue-14366.rs:12:14
+ |
+LL | let _x = "test" as &::std::any::Any;
+ | ^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `str`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
+ = note: required for the cast to the object type `dyn std::any::Any`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Regression test for issue #1448 and #1386
+
+fn foo(a: u32) -> u32 { a }
+
+fn main() {
+ println!("{}", foo(10i32)); //~ ERROR mismatched types
+}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-1448-2.rs:16:24
+ |
+LL | println!("{}", foo(10i32)); //~ ERROR mismatched types
+ | ^^^^^ expected u32, found i32
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct vec2 { y: f32 }
+struct vec3 { y: f32, z: f32 }
+
+fn make(v: vec2) {
+ let vec3 { y: _, z: _ } = v;
+ //~^ ERROR mismatched types
+ //~| expected type `vec2`
+ //~| found type `vec3`
+ //~| expected struct `vec2`, found struct `vec3`
+}
+
+fn main() { }
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-14541.rs:15:9
+ |
+LL | let vec3 { y: _, z: _ } = v;
+ | ^^^^^^^^^^^^^^^^^^^ expected struct `vec2`, found struct `vec3`
+ |
+ = note: expected type `vec2`
+ found type `vec3`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ let foo = "str";
+ println!("{}", foo.desc); //~ no field `desc` on type `&str`
+}
--- /dev/null
+error[E0609]: no field `desc` on type `&str`
+ --> $DIR/issue-14721.rs:13:24
+ |
+LL | println!("{}", foo.desc); //~ no field `desc` on type `&str`
+ | ^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0609`.
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ println!("{}", x); //~ ERROR cannot find value `x` in this scope
+}
--- /dev/null
+error[E0425]: cannot find value `x` in this scope
+ --> $DIR/issue-1476.rs:12:20
+ |
+LL | println!("{}", x); //~ ERROR cannot find value `x` in this scope
+ | ^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0425`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags: --test
+
+#[test]
+mod foo {} //~ ERROR only functions may be used as tests
+
+fn main() {}
--- /dev/null
+error: only functions may be used as tests
+ --> $DIR/issue-14772.rs:14:1
+ |
+LL | mod foo {} //~ ERROR only functions may be used as tests
+ | ^^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+
+struct X {
+ a: [u8; 1]
+}
+
+fn main() {
+ let x = X { a: [0] };
+ let _f = &x.a as *mut u8; //~ ERROR casting
+
+ let local: [u8; 1] = [0];
+ let _v = &local as *mut u8; //~ ERROR casting
+}
--- /dev/null
+error[E0606]: casting `&[u8; 1]` as `*mut u8` is invalid
+ --> $DIR/issue-14845.rs:18:14
+ |
+LL | let _f = &x.a as *mut u8; //~ ERROR casting
+ | ^^^^^^^^^^^^^^^
+
+error[E0606]: casting `&[u8; 1]` as `*mut u8` is invalid
+ --> $DIR/issue-14845.rs:21:14
+ |
+LL | let _v = &local as *mut u8; //~ ERROR casting
+ | ^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0606`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::fmt::Debug;
+
+trait Str {}
+
+trait Something: Sized {
+ fn yay<T: Debug>(_: Option<Self>, thing: &[T]);
+}
+
+struct X { data: u32 }
+
+impl Something for X {
+ fn yay<T: Str>(_:Option<X>, thing: &[T]) {
+ //~^ ERROR E0276
+ }
+}
+
+fn main() {
+ let arr = &["one", "two", "three"];
+ println!("{:?}", Something::yay(None::<X>, arr));
+}
--- /dev/null
+error[E0276]: impl has stricter requirements than trait
+ --> $DIR/issue-14853.rs:22:5
+ |
+LL | fn yay<T: Debug>(_: Option<Self>, thing: &[T]);
+ | ----------------------------------------------- definition of `yay` from trait
+...
+LL | fn yay<T: Str>(_:Option<X>, thing: &[T]) {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: Str`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0276`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(box_syntax)]
+
+fn main() {
+ let x: Box<isize> = box 0;
+
+ println!("{}", x + 1);
+ //~^ ERROR binary operation `+` cannot be applied to type `std::boxed::Box<isize>`
+}
--- /dev/null
+error[E0369]: binary operation `+` cannot be applied to type `std::boxed::Box<isize>`
+ --> $DIR/issue-14915.rs:16:20
+ |
+LL | println!("{}", x + 1);
+ | ^^^^^
+ |
+ = note: an implementation of `std::ops::Add` might be missing for `std::boxed::Box<isize>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0369`.
--- /dev/null
+warning: not reporting region error due to nll
+ --> $DIR/issue-15034.rs:27:9
+ |
+LL | Parser { lexer: lexer }
+ | ^^^^^^
+
+error[E0621]: explicit lifetime required in the type of `lexer`
+ --> $DIR/issue-15034.rs:27:25
+ |
+LL | pub fn new(lexer: &'a mut Lexer) -> Parser<'a> {
+ | ----- consider changing the type of `lexer` to `&'a mut Lexer<'a>`
+LL | Parser { lexer: lexer }
+ | ^^^^^ lifetime `'a` required
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub struct Lexer<'a> {
+ input: &'a str,
+}
+
+impl<'a> Lexer<'a> {
+ pub fn new(input: &'a str) -> Lexer<'a> {
+ Lexer { input: input }
+ }
+}
+
+struct Parser<'a> {
+ lexer: &'a mut Lexer<'a>,
+}
+
+impl<'a> Parser<'a> {
+ pub fn new(lexer: &'a mut Lexer) -> Parser<'a> {
+ Parser { lexer: lexer }
+ //~^ ERROR 27:25: 27:30: explicit lifetime required in the type of `lexer` [E0621]
+ }
+}
+
+fn main() {}
--- /dev/null
+error[E0621]: explicit lifetime required in the type of `lexer`
+ --> $DIR/issue-15034.rs:27:25
+ |
+LL | pub fn new(lexer: &'a mut Lexer) -> Parser<'a> {
+ | ----- consider changing the type of `lexer` to `&'a mut Lexer<'a>`
+LL | Parser { lexer: lexer }
+ | ^^^^^ lifetime `'a` required
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(fn_traits, unboxed_closures)]
+
+use std::{fmt, ops};
+
+struct Debuger<T> {
+ x: T
+}
+
+impl<T: fmt::Debug> ops::FnOnce<(),> for Debuger<T> {
+ type Output = ();
+ fn call_once(self, _args: ()) {
+ //~^ ERROR `call_once` has an incompatible type for trait
+ //~| expected type `extern "rust-call" fn
+ //~| found type `fn
+ println!("{:?}", self.x);
+ }
+}
+
+fn make_shower<T>(x: T) -> Debuger<T> {
+ Debuger { x: x }
+}
+
+pub fn main() {
+ let show3 = make_shower(3);
+ show3();
+}
--- /dev/null
+error[E0053]: method `call_once` has an incompatible type for trait
+ --> $DIR/issue-15094.rs:21:5
+ |
+LL | fn call_once(self, _args: ()) {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected "rust-call" fn, found "Rust" fn
+ |
+ = note: expected type `extern "rust-call" fn(Debuger<T>, ())`
+ found type `fn(Debuger<T>, ())`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0053`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub enum T {
+ T1(()),
+ T2(())
+}
+
+pub enum V {
+ V1(isize),
+ V2(bool)
+}
+
+fn main() {
+ match (T::T1(()), V::V2(true)) {
+ //~^ ERROR non-exhaustive patterns: `(T1(()), V2(_))` not covered
+ (T::T1(()), V::V1(i)) => (),
+ (T::T2(()), V::V2(b)) => ()
+ }
+}
--- /dev/null
+error[E0004]: non-exhaustive patterns: `(T1(()), V2(_))` not covered
+ --> $DIR/issue-15129.rs:22:11
+ |
+LL | match (T::T1(()), V::V2(true)) {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `(T1(()), V2(_))` not covered
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0004`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// macro f should not be able to inject a reference to 'n'.
+
+macro_rules! f { () => (n) }
+//~^ ERROR cannot find value `n` in this scope
+//~| ERROR cannot find value `n` in this scope
+//~| ERROR cannot find value `n` in this scope
+//~| ERROR cannot find value `n` in this scope
+
+fn main() -> (){
+ for n in 0..1 {
+ println!("{}", f!());
+ }
+
+ if let Some(n) = None {
+ println!("{}", f!());
+ }
+
+ if false {
+ } else if let Some(n) = None {
+ println!("{}", f!());
+ }
+
+ while let Some(n) = None {
+ println!("{}", f!());
+ }
+}
--- /dev/null
+error[E0425]: cannot find value `n` in this scope
+ --> $DIR/issue-15167.rs:13:25
+ |
+LL | macro_rules! f { () => (n) }
+ | ^ not found in this scope
+...
+LL | println!("{}", f!());
+ | ---- in this macro invocation
+
+error[E0425]: cannot find value `n` in this scope
+ --> $DIR/issue-15167.rs:13:25
+ |
+LL | macro_rules! f { () => (n) }
+ | ^ not found in this scope
+...
+LL | println!("{}", f!());
+ | ---- in this macro invocation
+
+error[E0425]: cannot find value `n` in this scope
+ --> $DIR/issue-15167.rs:13:25
+ |
+LL | macro_rules! f { () => (n) }
+ | ^ not found in this scope
+...
+LL | println!("{}", f!());
+ | ---- in this macro invocation
+
+error[E0425]: cannot find value `n` in this scope
+ --> $DIR/issue-15167.rs:13:25
+ |
+LL | macro_rules! f { () => (n) }
+ | ^ not found in this scope
+...
+LL | println!("{}", f!());
+ | ---- in this macro invocation
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0425`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ loop {
+ break.push(1) //~ ERROR no method named `push` found for type `!`
+ ;
+ }
+}
--- /dev/null
+error[E0599]: no method named `push` found for type `!` in the current scope
+ --> $DIR/issue-15207.rs:13:15
+ |
+LL | break.push(1) //~ ERROR no method named `push` found for type `!`
+ | ^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ let values: Vec<u8> = vec![1,2,3,4,5,6,7,8];
+
+ for &[x,y,z] in values.chunks(3).filter(|&xs| xs.len() == 3) {
+ //~^ ERROR refutable pattern in `for` loop binding: `&[]` not covered
+ println!("y={}", y);
+ }
+}
--- /dev/null
+error[E0005]: refutable pattern in `for` loop binding: `&[]` not covered
+ --> $DIR/issue-15381.rs:14:9
+ |
+LL | for &[x,y,z] in values.chunks(3).filter(|&xs| xs.len() == 3) {
+ | ^^^^^^^^ pattern `&[]` not covered
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0005`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::slice::Chunks;
+use std::slice::ChunksMut;
+
+fn dft_iter<'a, T>(arg1: Chunks<'a,T>, arg2: ChunksMut<'a,T>)
+{
+ for
+ &mut something
+ //~^ ERROR the size for values of type
+ in arg2
+ {
+ }
+}
+
+fn main() {}
--- /dev/null
+error[E0277]: the size for values of type `[T]` cannot be known at compilation time
+ --> $DIR/issue-15756.rs:17:10
+ |
+LL | &mut something
+ | ^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `[T]`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
+ = note: all local variables must have a statically known size
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub fn foo(params: Option<&[&str]>) -> usize {
+ params.unwrap().first().unwrap().len()
+}
+
+fn main() {
+ let name = "Foo";
+ let x = Some(&[name]);
+ let msg = foo(x);
+//~^ ERROR mismatched types
+//~| expected type `std::option::Option<&[&str]>`
+//~| found type `std::option::Option<&[&str; 1]>`
+//~| expected slice, found array of 1 elements
+ assert_eq!(msg, 3);
+}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-15783.rs:18:19
+ |
+LL | let msg = foo(x);
+ | ^ expected slice, found array of 1 elements
+ |
+ = note: expected type `std::option::Option<&[&str]>`
+ found type `std::option::Option<&[&str; 1]>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Regression test for #15896. It used to ICE rustc.
+
+fn main() {
+ enum R { REB(()) }
+ struct Tau { t: usize }
+ enum E { B(R, Tau) }
+
+ let e = E::B(R::REB(()), Tau { t: 3 });
+ let u = match e {
+ E::B(
+ Tau{t: x},
+ //~^ ERROR mismatched types
+ //~| expected type `main::R`
+ //~| found type `main::Tau`
+ //~| expected enum `main::R`, found struct `main::Tau`
+ _) => x,
+ };
+}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-15896.rs:21:11
+ |
+LL | Tau{t: x},
+ | ^^^^^^^^^ expected enum `main::R`, found struct `main::Tau`
+ |
+ = note: expected type `main::R`
+ found type `main::Tau`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// error-pattern: too big for the current architecture
+
+#[cfg(target_pointer_width = "32")]
+fn main() {
+ let x = [0usize; 0xffff_ffff];
+}
+
+#[cfg(target_pointer_width = "64")]
+fn main() {
+ let x = [0usize; 0xffff_ffff_ffff_ffff];
+}
--- /dev/null
+error: the type `[usize; 18446744073709551615]` is too big for the current architecture
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ return
+ { return () }
+//~^ ERROR type annotations needed [E0282]
+ ()
+ ;
+}
--- /dev/null
+error[E0282]: type annotations needed
+ --> $DIR/issue-15965.rs:13:9
+ |
+LL | / { return () }
+LL | | //~^ ERROR type annotations needed [E0282]
+LL | | ()
+ | |______^ cannot infer type for `_`
+ |
+ = note: type must be known at this point
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0282`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait NoLifetime {
+ fn get<'p, T : Test<'p>>(&self) -> T;
+ //~^ NOTE lifetimes in impl do not match this method in trait
+}
+
+trait Test<'p> {
+ fn new(buf: &'p mut [u8]) -> Self;
+}
+
+struct Foo<'a> {
+ buf: &'a mut [u8],
+}
+
+impl<'a> Test<'a> for Foo<'a> {
+ fn new(buf: &'a mut [u8]) -> Foo<'a> {
+ Foo { buf: buf }
+ }
+}
+
+impl<'a> NoLifetime for Foo<'a> {
+ fn get<'p, T : Test<'a>>(&self) -> T {
+ //~^ ERROR E0195
+ //~| NOTE lifetimes do not match method in trait
+ return *self as T;
+ }
+}
+
+fn main() {}
--- /dev/null
+error[E0195]: lifetime parameters or bounds on method `get` do not match the trait declaration
+ --> $DIR/issue-16048.rs:31:11
+ |
+LL | fn get<'p, T : Test<'p>>(&self) -> T;
+ | ------------------ lifetimes in impl do not match this method in trait
+...
+LL | fn get<'p, T : Test<'a>>(&self) -> T {
+ | ^^^^^^^^^^^^^^^^^^ lifetimes do not match method in trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0195`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+macro_rules! prob1 {
+ (0) => {
+ 0
+ };
+ ($n:expr) => {
+ if ($n % 3 == 0) || ($n % 5 == 0) {
+ $n + prob1!($n - 1); //~ ERROR recursion limit reached while expanding the macro `prob1`
+ } else {
+ prob1!($n - 1);
+ }
+ };
+}
+
+fn main() {
+ println!("Problem 1: {}", prob1!(1000));
+}
--- /dev/null
+error: recursion limit reached while expanding the macro `prob1`
+ --> $DIR/issue-16098.rs:17:18
+ |
+LL | $n + prob1!($n - 1); //~ ERROR recursion limit reached while expanding the macro `prob1`
+ | ^^^^^^^^^^^^^^
+...
+LL | println!("Problem 1: {}", prob1!(1000));
+ | ------------ in this macro invocation
+ |
+ = help: consider adding a `#![recursion_limit="128"]` attribute to your crate
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+extern {
+ static externalValue: isize;
+}
+
+fn main() {
+ let boolValue = match 42 {
+ externalValue => true,
+ //~^ ERROR match bindings cannot shadow statics
+ _ => false
+ };
+}
--- /dev/null
+error[E0530]: match bindings cannot shadow statics
+ --> $DIR/issue-16149.rs:17:9
+ |
+LL | static externalValue: isize;
+ | ---------------------------- a static `externalValue` is defined here
+...
+LL | externalValue => true,
+ | ^^^^^^^^^^^^^ cannot be named the same as a static
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0530`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![deny(warnings)]
+
+pub struct Foo;
+
+extern {
+ pub fn foo(x: (Foo)); //~ ERROR unspecified layout
+}
+
+fn main() {
+}
--- /dev/null
+error: `extern` block uses type `Foo` which is not FFI-safe: this struct has unspecified layout
+ --> $DIR/issue-16250.rs:16:20
+ |
+LL | pub fn foo(x: (Foo)); //~ ERROR unspecified layout
+ | ^^^
+ |
+note: lint level defined here
+ --> $DIR/issue-16250.rs:11:9
+ |
+LL | #![deny(warnings)]
+ | ^^^^^^^^
+ = note: #[deny(improper_ctypes)] implied by #[deny(warnings)]
+ = help: consider adding a #[repr(C)] or #[repr(transparent)] attribute to this struct
+note: type defined here
+ --> $DIR/issue-16250.rs:13:1
+ |
+LL | pub struct Foo;
+ | ^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Slice<T> {
+ data: *const T,
+ len: usize,
+}
+
+fn main() {
+ let Slice { data: data, len: len } = "foo";
+ //~^ ERROR mismatched types
+ //~| found type `Slice<_>`
+}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-16338.rs:17:9
+ |
+LL | let Slice { data: data, len: len } = "foo";
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected str, found struct `Slice`
+ |
+ = note: expected type `str`
+ found type `Slice<_>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Slice<T> {
+ data: *const T,
+ len: usize,
+}
+
+fn main() {
+ match () {
+ Slice { data: data, len: len } => (),
+ //~^ ERROR mismatched types
+ //~| expected type `()`
+ //~| found type `Slice<_>`
+ //~| expected (), found struct `Slice`
+ _ => unreachable!()
+ }
+}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-16401.rs:18:9
+ |
+LL | Slice { data: data, len: len } => (),
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `Slice`
+ |
+ = note: expected type `()`
+ found type `Slice<_>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![allow(safe_extern_statics)]
+
+mod Y {
+ pub type X = usize;
+ extern {
+ pub static x: *const usize;
+ }
+ pub fn foo(value: *const X) -> *const X {
+ value
+ }
+}
+
+static foo: *const Y::X = Y::foo(Y::x as *const Y::X);
+//~^ ERROR `*const usize` cannot be shared between threads safely [E0277]
+//~| ERROR E0015
+
+fn main() {}
--- /dev/null
+error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants
+ --> $DIR/issue-16538.rs:23:27
+ |
+LL | static foo: *const Y::X = Y::foo(Y::x as *const Y::X);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: `*const usize` cannot be shared between threads safely
+ --> $DIR/issue-16538.rs:23:1
+ |
+LL | static foo: *const Y::X = Y::foo(Y::x as *const Y::X);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*const usize` cannot be shared between threads safely
+ |
+ = help: the trait `std::marker::Sync` is not implemented for `*const usize`
+ = note: shared static variables must have a type that implements `Sync`
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0015, E0277.
+For more information about an error, try `rustc --explain E0015`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait MatrixShape {}
+
+struct Col<D, C> {
+ data: D,
+ col: C,
+}
+
+trait Collection { fn len(&self) -> usize; }
+
+impl<T, M: MatrixShape> Collection for Col<M, usize> {
+//~^ ERROR type parameter `T` is not constrained
+ fn len(&self) -> usize {
+ unimplemented!()
+ }
+}
+
+fn main() {}
--- /dev/null
+error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates
+ --> $DIR/issue-16562.rs:20:6
+ |
+LL | impl<T, M: MatrixShape> Collection for Col<M, usize> {
+ | ^ unconstrained type parameter
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0207`.
--- /dev/null
+warning: not reporting region error due to nll
+ --> $DIR/issue-16683.rs:14:9
+ |
+LL | self.a(); //~ ERROR cannot infer
+ | ^^^^
+
+warning: not reporting region error due to nll
+ --> $DIR/issue-16683.rs:14:14
+ |
+LL | self.a(); //~ ERROR cannot infer
+ | ^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/issue-16683.rs:14:9
+ |
+LL | fn b(&self) {
+ | - let's call the lifetime of this reference `'1`
+LL | self.a(); //~ ERROR cannot infer
+ | ^^^^^^^^ argument requires that `'1` must outlive `'a`
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait T<'a> {
+ fn a(&'a self) -> &'a bool;
+ fn b(&self) {
+ self.a(); //~ ERROR cannot infer
+ }
+}
+
+fn main() {}
--- /dev/null
+error[E0495]: cannot infer an appropriate lifetime for autoref due to conflicting requirements
+ --> $DIR/issue-16683.rs:14:14
+ |
+LL | self.a(); //~ ERROR cannot infer
+ | ^
+ |
+note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the method body at 13:5...
+ --> $DIR/issue-16683.rs:13:5
+ |
+LL | / fn b(&self) {
+LL | | self.a(); //~ ERROR cannot infer
+LL | | }
+ | |_____^
+note: ...so that reference does not outlive borrowed content
+ --> $DIR/issue-16683.rs:14:9
+ |
+LL | self.a(); //~ ERROR cannot infer
+ | ^^^^
+note: but, the lifetime must be valid for the lifetime 'a as defined on the trait at 11:9...
+ --> $DIR/issue-16683.rs:11:9
+ |
+LL | trait T<'a> {
+ | ^^
+ = note: ...so that the types are compatible:
+ expected &'a Self
+ found &Self
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0495`.
--- /dev/null
+warning: not reporting region error due to nll
+ --> $DIR/issue-16922.rs:14:14
+ |
+LL | Box::new(value) as Box<Any>
+ | ^^^^^
+
+error[E0621]: explicit lifetime required in the type of `value`
+ --> $DIR/issue-16922.rs:14:5
+ |
+LL | fn foo<T: Any>(value: &T) -> Box<Any> {
+ | ----- consider changing the type of `value` to `&'static T`
+LL | Box::new(value) as Box<Any>
+ | ^^^^^^^^^^^^^^^ lifetime `'static` required
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::any::Any;
+
+fn foo<T: Any>(value: &T) -> Box<Any> {
+ Box::new(value) as Box<Any>
+ //~^ ERROR explicit lifetime required in the type of `value` [E0621]
+}
+
+fn main() {
+ let _ = foo(&5);
+}
--- /dev/null
+error[E0621]: explicit lifetime required in the type of `value`
+ --> $DIR/issue-16922.rs:14:5
+ |
+LL | fn foo<T: Any>(value: &T) -> Box<Any> {
+ | ----- consider changing the type of `value` to `&'static T`
+LL | Box::new(value) as Box<Any>
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'static` required
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Make sure we don't ICE when making an overloaded call with the
+// wrong arity.
+
+fn _foo<F: Fn()> (f: F) {
+ |t| f(t); //~ ERROR E0057
+}
+
+fn main() {}
--- /dev/null
+error[E0057]: this function takes 0 parameters but 1 parameter was supplied
+ --> $DIR/issue-16939.rs:15:9
+ |
+LL | |t| f(t); //~ ERROR E0057
+ | ^^^^ expected 0 parameters
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0057`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// error-pattern:type annotations needed
+fn main() {
+ panic!(
+ std::default::Default::default()
+ );
+}
--- /dev/null
+error[E0282]: type annotations needed
+ --> $DIR/issue-16966.rs:13:5
+ |
+LL | / panic!(
+LL | | std::default::Default::default()
+LL | | );
+ | |______^ cannot infer type for `M`
+ |
+ = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0282`.
--- /dev/null
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Testing that we don't fail abnormally after hitting the errors
+
+use unresolved::*; //~ ERROR unresolved import `unresolved` [E0432]
+ //~^ Maybe a missing `extern crate unresolved;`?
+
+fn main() {}
--- /dev/null
+error[E0432]: unresolved import `unresolved`
+ --> $DIR/issue-1697.rs:13:5
+ |
+LL | use unresolved::*; //~ ERROR unresolved import `unresolved` [E0432]
+ | ^^^^^^^^^^ Maybe a missing `extern crate unresolved;`?
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0432`.
--- /dev/null
+// 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.
+
+#![feature(rustc_attrs)]
+
+fn cb<'a,T>(_x: Box<Fn((&'a i32, &'a (Vec<&'static i32>, bool))) -> T>) -> T {
+ panic!()
+}
+
+#[rustc_error]
+fn main() { //~ ERROR compilation successful
+ cb(Box::new(|(k, &(ref v, b))| (*k, v.clone(), b)));
+}
--- /dev/null
+error: compilation successful
+ --> $DIR/issue-16994.rs:18:1
+ |
+LL | / fn main() { //~ ERROR compilation successful
+LL | | cb(Box::new(|(k, &(ref v, b))| (*k, v.clone(), b)));
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+mod foo {}
+
+fn main() {
+ let p = foo { x: () }; //~ ERROR expected struct, variant or union type, found module `foo`
+}
--- /dev/null
+error[E0574]: expected struct, variant or union type, found module `foo`
+ --> $DIR/issue-17001.rs:14:13
+ |
+LL | let p = foo { x: () }; //~ ERROR expected struct, variant or union type, found module `foo`
+ | ^^^ not a struct, variant or union type
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0574`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-test the unsized enum no longer compiles
+
+enum A {
+ B(char),
+ C([Box<A>]),
+}
+
+fn c(c:char) {
+ A::B(c);
+ //~^ ERROR cannot move a value of type A: the size of A cannot be statically determined
+}
+
+pub fn main() {}
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn f<'r>(p: &'r mut fn(p: &mut ())) {
+ (*p)(()) //~ ERROR mismatched types
+ //~| expected type `&mut ()`
+ //~| found type `()`
+ //~| expected &mut (), found ()
+}
+
+fn main() {}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-17033.rs:12:10
+ |
+LL | (*p)(()) //~ ERROR mismatched types
+ | ^^
+ | |
+ | expected &mut (), found ()
+ | help: consider mutably borrowing here: `&mut ()`
+ |
+ = note: expected type `&mut ()`
+ found type `()`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+const FOO: usize = FOO; //~ ERROR E0391
+
+fn main() {
+ let _x: [u8; FOO]; // caused stack overflow prior to fix
+ let _y: usize = 1 + {
+ const BAR: usize = BAR;
+ let _z: [u8; BAR]; // caused stack overflow prior to fix
+ 1
+ };
+}
--- /dev/null
+error[E0391]: cycle detected when processing `FOO`
+ --> $DIR/issue-17252.rs:11:20
+ |
+LL | const FOO: usize = FOO; //~ ERROR E0391
+ | ^^^
+ |
+ = note: ...which again requires processing `FOO`, completing the cycle
+note: cycle used when processing `main::{{constant}}`
+ --> $DIR/issue-17252.rs:14:18
+ |
+LL | let _x: [u8; FOO]; // caused stack overflow prior to fix
+ | ^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0391`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(staged_api)]
+#![deny(deprecated)]
+
+#![unstable(feature = "test_feature", issue = "0")]
+
+struct Foo;
+
+impl Foo {
+ #[unstable(feature = "test_feature", issue = "0")]
+ #[rustc_deprecated(since = "1.0.0", reason = "text")]
+ fn foo(self) {}
+}
+
+fn main() {
+ Foo
+ .foo(); //~ ERROR use of deprecated item
+}
--- /dev/null
+error: use of deprecated item 'Foo::foo': text
+ --> $DIR/issue-17337.rs:26:6
+ |
+LL | .foo(); //~ ERROR use of deprecated item
+ | ^^^
+ |
+note: lint level defined here
+ --> $DIR/issue-17337.rs:12:9
+ |
+LL | #![deny(deprecated)]
+ | ^^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ *return //~ ERROR type `!` cannot be dereferenced
+ ;
+}
--- /dev/null
+error[E0614]: type `!` cannot be dereferenced
+ --> $DIR/issue-17373.rs:12:5
+ |
+LL | *return //~ ERROR type `!` cannot be dereferenced
+ | ^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0614`.
--- /dev/null
+error[E0382]: use of moved value: `foo`
+ --> $DIR/issue-17385.rs:28:5
+ |
+LL | drop(foo);
+ | --- value moved here
+LL | / match foo { //~ ERROR use of moved value
+LL | | X(1) => (),
+LL | | _ => unreachable!()
+LL | | }
+ | |_____^ value used here after move
+ |
+ = note: move occurs because `foo` has type `X`, which does not implement the `Copy` trait
+
+error[E0382]: borrow of moved value: `foo`
+ --> $DIR/issue-17385.rs:28:5
+ |
+LL | drop(foo);
+ | --- value moved here
+LL | / match foo { //~ ERROR use of moved value
+LL | | X(1) => (),
+LL | | _ => unreachable!()
+LL | | }
+ | |_____^ value borrowed here after move
+ |
+ = note: move occurs because `foo` has type `X`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `foo.0`
+ --> $DIR/issue-17385.rs:29:11
+ |
+LL | drop(foo);
+ | --- value moved here
+LL | match foo { //~ ERROR use of moved value
+LL | X(1) => (),
+ | ^ value used here after move
+ |
+ = note: move occurs because `foo` has type `X`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `e`
+ --> $DIR/issue-17385.rs:35:5
+ |
+LL | drop(e);
+ | - value moved here
+LL | / match e { //~ ERROR use of moved value
+LL | | Enum::Variant1 => unreachable!(),
+LL | | Enum::Variant2 => ()
+LL | | }
+ | |_____^ value used here after move
+ |
+ = note: move occurs because `e` has type `Enum`, which does not implement the `Copy` trait
+
+error[E0382]: borrow of moved value: `e`
+ --> $DIR/issue-17385.rs:35:5
+ |
+LL | drop(e);
+ | - value moved here
+LL | / match e { //~ ERROR use of moved value
+LL | | Enum::Variant1 => unreachable!(),
+LL | | Enum::Variant2 => ()
+LL | | }
+ | |_____^ value borrowed here after move
+ |
+ = note: move occurs because `e` has type `Enum`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `e`
+ --> $DIR/issue-17385.rs:36:9
+ |
+LL | drop(e);
+ | - value moved here
+LL | match e { //~ ERROR use of moved value
+LL | Enum::Variant1 => unreachable!(),
+ | ^^^^^^^^^^^^^^ value used here after move
+ |
+ = note: move occurs because `e` has type `Enum`, which does not implement the `Copy` trait
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0382`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct X(isize);
+
+enum Enum {
+ Variant1,
+ Variant2
+}
+
+impl Drop for X {
+ fn drop(&mut self) {}
+}
+impl Drop for Enum {
+ fn drop(&mut self) {}
+}
+
+fn main() {
+ let foo = X(1);
+ drop(foo);
+ match foo { //~ ERROR use of moved value
+ X(1) => (),
+ _ => unreachable!()
+ }
+
+ let e = Enum::Variant2;
+ drop(e);
+ match e { //~ ERROR use of moved value
+ Enum::Variant1 => unreachable!(),
+ Enum::Variant2 => ()
+ }
+}
--- /dev/null
+error[E0382]: use of moved value: `foo`
+ --> $DIR/issue-17385.rs:28:11
+ |
+LL | drop(foo);
+ | --- value moved here
+LL | match foo { //~ ERROR use of moved value
+ | ^^^ value used here after move
+ |
+ = note: move occurs because `foo` has type `X`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `e`
+ --> $DIR/issue-17385.rs:35:11
+ |
+LL | drop(e);
+ | - value moved here
+LL | match e { //~ ERROR use of moved value
+ | ^ value used here after move
+ |
+ = note: move occurs because `e` has type `Enum`, which does not implement the `Copy` trait
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0382`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+enum Foo {
+ Bar(isize)
+}
+
+fn main() {
+ match Foo::Bar(1) {
+ Foo { i } => () //~ ERROR expected struct, variant or union type, found enum `Foo`
+ }
+}
--- /dev/null
+error[E0574]: expected struct, variant or union type, found enum `Foo`
+ --> $DIR/issue-17405.rs:17:9
+ |
+LL | Foo { i } => () //~ ERROR expected struct, variant or union type, found enum `Foo`
+ | ^^^ not a struct, variant or union type
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0574`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo { foo: Option<Option<Foo>> }
+//~^ ERROR recursive type `Foo` has infinite size
+
+impl Foo { fn bar(&self) {} }
+
+fn main() {}
--- /dev/null
+error[E0072]: recursive type `Foo` has infinite size
+ --> $DIR/issue-17431-1.rs:11:1
+ |
+LL | struct Foo { foo: Option<Option<Foo>> }
+ | ^^^^^^^^^^ ------------------------ recursive without indirection
+ | |
+ | recursive type has infinite size
+ |
+ = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Foo` representable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0072`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Baz { q: Option<Foo> }
+//~^ ERROR recursive type `Baz` has infinite size
+
+struct Foo { q: Option<Baz> }
+//~^ ERROR recursive type `Foo` has infinite size
+
+impl Foo { fn bar(&self) {} }
+
+fn main() {}
--- /dev/null
+error[E0072]: recursive type `Baz` has infinite size
+ --> $DIR/issue-17431-2.rs:11:1
+ |
+LL | struct Baz { q: Option<Foo> }
+ | ^^^^^^^^^^ -------------- recursive without indirection
+ | |
+ | recursive type has infinite size
+ |
+ = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Baz` representable
+
+error[E0072]: recursive type `Foo` has infinite size
+ --> $DIR/issue-17431-2.rs:14:1
+ |
+LL | struct Foo { q: Option<Baz> }
+ | ^^^^^^^^^^ -------------- recursive without indirection
+ | |
+ | recursive type has infinite size
+ |
+ = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Foo` representable
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0072`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::sync::Mutex;
+
+struct Foo { foo: Mutex<Option<Foo>> }
+//~^ ERROR recursive type `Foo` has infinite size
+
+impl Foo { fn bar(&self) {} }
+
+fn main() {}
--- /dev/null
+error[E0072]: recursive type `Foo` has infinite size
+ --> $DIR/issue-17431-3.rs:13:1
+ |
+LL | struct Foo { foo: Mutex<Option<Foo>> }
+ | ^^^^^^^^^^ ----------------------- recursive without indirection
+ | |
+ | recursive type has infinite size
+ |
+ = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Foo` representable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0072`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::marker;
+
+struct Foo<T> { foo: Option<Option<Foo<T>>>, marker: marker::PhantomData<T> }
+//~^ ERROR recursive type `Foo` has infinite size
+
+impl<T> Foo<T> { fn bar(&self) {} }
+
+fn main() {}
--- /dev/null
+error[E0072]: recursive type `Foo` has infinite size
+ --> $DIR/issue-17431-4.rs:13:1
+ |
+LL | struct Foo<T> { foo: Option<Option<Foo<T>>>, marker: marker::PhantomData<T> }
+ | ^^^^^^^^^^^^^ --------------------------- recursive without indirection
+ | |
+ | recursive type has infinite size
+ |
+ = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Foo` representable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0072`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::marker;
+
+struct Foo { foo: Bar<Foo> }
+
+struct Bar<T> { x: Bar<Foo> , marker: marker::PhantomData<T> }
+//~^ ERROR recursive type `Bar` has infinite size
+
+impl Foo { fn foo(&self) {} }
+
+fn main() {
+}
--- /dev/null
+error[E0072]: recursive type `Bar` has infinite size
+ --> $DIR/issue-17431-5.rs:15:1
+ |
+LL | struct Bar<T> { x: Bar<Foo> , marker: marker::PhantomData<T> }
+ | ^^^^^^^^^^^^^ ----------- recursive without indirection
+ | |
+ | recursive type has infinite size
+ |
+ = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Bar` representable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0072`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::sync::Mutex;
+
+enum Foo { X(Mutex<Option<Foo>>) }
+//~^ ERROR recursive type `Foo` has infinite size
+
+impl Foo { fn bar(self) {} }
+
+fn main() {}
--- /dev/null
+error[E0072]: recursive type `Foo` has infinite size
+ --> $DIR/issue-17431-6.rs:13:1
+ |
+LL | enum Foo { X(Mutex<Option<Foo>>) }
+ | ^^^^^^^^ ------------------ recursive without indirection
+ | |
+ | recursive type has infinite size
+ |
+ = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Foo` representable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0072`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+enum Foo { Voo(Option<Option<Foo>>) }
+//~^ ERROR recursive type `Foo` has infinite size
+
+impl Foo { fn bar(&self) {} }
+
+fn main() { }
--- /dev/null
+error[E0072]: recursive type `Foo` has infinite size
+ --> $DIR/issue-17431-7.rs:11:1
+ |
+LL | enum Foo { Voo(Option<Option<Foo>>) }
+ | ^^^^^^^^ ------------------- recursive without indirection
+ | |
+ | recursive type has infinite size
+ |
+ = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Foo` representable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0072`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+enum Test {
+ Foo = 0
+}
+
+fn main() {
+ let _x = Test::Foo as *const isize;
+ //~^ ERROR casting `Test` as `*const isize` is invalid
+}
--- /dev/null
+error[E0606]: casting `Test` as `*const isize` is invalid
+ --> $DIR/issue-17444.rs:16:14
+ |
+LL | let _x = Test::Foo as *const isize;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0606`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+static X: usize = 0 as *const usize as usize;
+//~^ ERROR: raw pointers cannot be cast to integers in statics
+
+fn main() {
+ assert_eq!(X, 0);
+}
--- /dev/null
+error[E0018]: raw pointers cannot be cast to integers in statics
+ --> $DIR/issue-17458.rs:11:19
+ |
+LL | static X: usize = 0 as *const usize as usize;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0018`.
--- /dev/null
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/issue-17545.rs:17:10
+ |
+LL | &id(()), //~ ERROR borrowed value does not live long enough
+ | ^^^^^^ temporary value does not live long enough
+LL | ));
+ | - temporary value only lives until here
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 15:12...
+ --> $DIR/issue-17545.rs:15:12
+ |
+LL | pub fn foo<'a, F: Fn(&'a ())>(bar: F) {
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(fn_traits)]
+
+fn id<T>(x: T) -> T { x }
+
+pub fn foo<'a, F: Fn(&'a ())>(bar: F) {
+ bar.call((
+ &id(()), //~ ERROR borrowed value does not live long enough
+ ));
+}
+fn main() {}
--- /dev/null
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/issue-17545.rs:17:10
+ |
+LL | &id(()), //~ ERROR borrowed value does not live long enough
+ | ^^^^^^ temporary value does not live long enough
+LL | ));
+ | - temporary value only lives until here
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 15:12...
+ --> $DIR/issue-17545.rs:15:12
+ |
+LL | pub fn foo<'a, F: Fn(&'a ())>(bar: F) {
+ | ^^
+ = note: consider using a `let` binding to increase its lifetime
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use foo::MyEnum::Result;
+use foo::NoResult; // Through a re-export
+
+mod foo {
+ pub use self::MyEnum::NoResult;
+
+ pub enum MyEnum {
+ Result,
+ NoResult
+ }
+
+ fn new() -> NoResult<MyEnum, String> {
+ //~^ ERROR expected type, found variant `NoResult`
+ unimplemented!()
+ }
+}
+
+mod bar {
+ use foo::MyEnum::Result;
+ use foo;
+
+ fn new() -> Result<foo::MyEnum, String> {
+ //~^ ERROR expected type, found variant `Result`
+ unimplemented!()
+ }
+}
+
+fn new() -> Result<foo::MyEnum, String> {
+ //~^ ERROR expected type, found variant `Result`
+ unimplemented!()
+}
+
+fn newer() -> NoResult<foo::MyEnum, String> {
+ //~^ ERROR expected type, found variant `NoResult`
+ unimplemented!()
+}
+
+fn main() {
+ let _ = new();
+}
--- /dev/null
+error[E0573]: expected type, found variant `NoResult`
+ --> $DIR/issue-17546.rs:22:17
+ |
+LL | fn new() -> NoResult<MyEnum, String> {
+ | --------^^^^^^^^^^^^^^^^
+ | |
+ | did you mean `Result`?
+ | help: you can try using the variant's enum: `foo::MyEnum`
+
+error[E0573]: expected type, found variant `Result`
+ --> $DIR/issue-17546.rs:32:17
+ |
+LL | fn new() -> Result<foo::MyEnum, String> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a type
+help: possible better candidates are found in other modules, you can import them into scope
+ |
+LL | use std::fmt::Result;
+ |
+LL | use std::io::Result;
+ |
+LL | use std::prelude::v1::Result;
+ |
+LL | use std::result::Result;
+ |
+and 1 other candidates
+
+error[E0573]: expected type, found variant `Result`
+ --> $DIR/issue-17546.rs:38:13
+ |
+LL | fn new() -> Result<foo::MyEnum, String> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a type
+help: possible better candidates are found in other modules, you can import them into scope
+ |
+LL | use std::fmt::Result;
+ |
+LL | use std::io::Result;
+ |
+LL | use std::prelude::v1::Result;
+ |
+LL | use std::result::Result;
+ |
+and 1 other candidates
+
+error[E0573]: expected type, found variant `NoResult`
+ --> $DIR/issue-17546.rs:43:15
+ |
+LL | fn newer() -> NoResult<foo::MyEnum, String> {
+ | --------^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | did you mean `Result`?
+ | help: you can try using the variant's enum: `foo::MyEnum`
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0573`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::marker;
+
+struct B<T>(marker::PhantomData<T>);
+
+fn main() {
+ let foo = B(marker::PhantomData); //~ ERROR type annotations needed
+ let closure = || foo;
+}
--- /dev/null
+error[E0282]: type annotations needed
+ --> $DIR/issue-17551.rs:16:15
+ |
+LL | let foo = B(marker::PhantomData); //~ ERROR type annotations needed
+ | --- ^ cannot infer type for `T`
+ | |
+ | consider giving `foo` a type
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0282`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Test that moves of unsized values within closures are caught
+// and rejected.
+
+fn main() {
+ (|| Box::new(*(&[0][..])))();
+ //~^ ERROR the size for values of type
+}
--- /dev/null
+error[E0277]: the size for values of type `[{integer}]` cannot be known at compilation time
+ --> $DIR/issue-17651.rs:15:9
+ |
+LL | (|| Box::new(*(&[0][..])))();
+ | ^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `[{integer}]`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
+ = note: required by `<std::boxed::Box<T>>::new`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+const C1: &'static mut [usize] = &mut [];
+//~^ ERROR: references in constants may only refer to immutable values
+
+static mut S: usize = 3;
+const C2: &'static mut usize = unsafe { &mut S };
+//~^ ERROR: constants cannot refer to statics
+//~| ERROR: references in constants may only refer to immutable values
+//~| ERROR: references in constants may only refer to immutable values
+
+fn main() {}
--- /dev/null
+error[E0017]: references in constants may only refer to immutable values
+ --> $DIR/issue-17718-const-bad-values.rs:11:34
+ |
+LL | const C1: &'static mut [usize] = &mut [];
+ | ^^^^^^^ constants require immutable values
+
+error[E0013]: constants cannot refer to statics, use a constant instead
+ --> $DIR/issue-17718-const-bad-values.rs:15:41
+ |
+LL | const C2: &'static mut usize = unsafe { &mut S };
+ | ^^^^^^
+
+error[E0017]: references in constants may only refer to immutable values
+ --> $DIR/issue-17718-const-bad-values.rs:15:41
+ |
+LL | const C2: &'static mut usize = unsafe { &mut S };
+ | ^^^^^^ constants require immutable values
+
+error[E0017]: references in constants may only refer to immutable values
+ --> $DIR/issue-17718-const-bad-values.rs:15:32
+ |
+LL | const C2: &'static mut usize = unsafe { &mut S };
+ | ^^^^^^^^^^^^^^^^^ constants require immutable values
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0013, E0017.
+For more information about an error, try `rustc --explain E0013`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::cell::UnsafeCell;
+
+const A: UnsafeCell<usize> = UnsafeCell::new(1);
+const B: &'static UnsafeCell<usize> = &A;
+//~^ ERROR: cannot borrow a constant which may contain interior mutability
+
+struct C { a: UnsafeCell<usize> }
+const D: C = C { a: UnsafeCell::new(1) };
+const E: &'static UnsafeCell<usize> = &D.a;
+//~^ ERROR: cannot borrow a constant which may contain interior mutability
+const F: &'static C = &D;
+//~^ ERROR: cannot borrow a constant which may contain interior mutability
+
+fn main() {}
--- /dev/null
+error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead
+ --> $DIR/issue-17718-const-borrow.rs:14:39
+ |
+LL | const B: &'static UnsafeCell<usize> = &A;
+ | ^^
+
+error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead
+ --> $DIR/issue-17718-const-borrow.rs:19:39
+ |
+LL | const E: &'static UnsafeCell<usize> = &D.a;
+ | ^^^^
+
+error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead
+ --> $DIR/issue-17718-const-borrow.rs:21:23
+ |
+LL | const F: &'static C = &D;
+ | ^^
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0492`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![warn(unused)]
+#[deny(warnings)]
+
+const foo: isize = 3;
+//~^ ERROR: should have an upper case name such as
+//~^^ ERROR: constant item is never used
+
+fn main() {}
--- /dev/null
+error: constant item is never used: `foo`
+ --> $DIR/issue-17718-const-naming.rs:14:1
+ |
+LL | const foo: isize = 3;
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/issue-17718-const-naming.rs:12:8
+ |
+LL | #[deny(warnings)]
+ | ^^^^^^^^
+ = note: #[deny(dead_code)] implied by #[deny(warnings)]
+
+error: constant `foo` should have an upper case name such as `FOO`
+ --> $DIR/issue-17718-const-naming.rs:14:1
+ |
+LL | const foo: isize = 3;
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/issue-17718-const-naming.rs:12:8
+ |
+LL | #[deny(warnings)]
+ | ^^^^^^^^
+ = note: #[deny(non_upper_case_globals)] implied by #[deny(warnings)]
+
+error: aborting due to 2 previous errors
+
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn id<T>(x: T) -> T { x }
+
+const FOO: usize = 3;
+
+fn foo() -> &'static usize { &id(FOO) }
+//~^ ERROR: borrowed value does not live long enough
+
+fn main() {
+}
--- /dev/null
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/issue-17718-constants-not-static.rs:15:31
+ |
+LL | fn foo() -> &'static usize { &id(FOO) }
+ | ^^^^^^^ - temporary value only lives until here
+ | |
+ | temporary value does not live long enough
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+static A1: usize = 1;
+static mut A2: usize = 1;
+const A3: usize = 1;
+
+fn main() {
+ match 1 {
+ A1 => {} //~ ERROR: match bindings cannot shadow statics
+ A2 => {} //~ ERROR: match bindings cannot shadow statics
+ A3 => {}
+ _ => {}
+ }
+}
--- /dev/null
+error[E0530]: match bindings cannot shadow statics
+ --> $DIR/issue-17718-patterns.rs:17:9
+ |
+LL | static A1: usize = 1;
+ | --------------------- a static `A1` is defined here
+...
+LL | A1 => {} //~ ERROR: match bindings cannot shadow statics
+ | ^^ cannot be named the same as a static
+
+error[E0530]: match bindings cannot shadow statics
+ --> $DIR/issue-17718-patterns.rs:18:9
+ |
+LL | static mut A2: usize = 1;
+ | ------------------------- a static `A2` is defined here
+...
+LL | A2 => {} //~ ERROR: match bindings cannot shadow statics
+ | ^^ cannot be named the same as a static
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0530`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![allow(warnings)]
+
+struct Struct { a: usize }
+
+const C: usize = 1;
+static S: usize = 1;
+
+const T1: &'static usize = &C;
+const T2: &'static usize = &S; //~ ERROR: constants cannot refer to statics
+static T3: &'static usize = &C;
+static T4: &'static usize = &S;
+
+const T5: usize = C;
+const T6: usize = S; //~ ERROR: constants cannot refer to statics
+static T7: usize = C;
+static T8: usize = S;
+
+const T9: Struct = Struct { a: C };
+const T10: Struct = Struct { a: S };
+//~^ ERROR: constants cannot refer to statics
+static T11: Struct = Struct { a: C };
+static T12: Struct = Struct { a: S };
+
+fn main() {}
--- /dev/null
+error[E0013]: constants cannot refer to statics, use a constant instead
+ --> $DIR/issue-17718-references.rs:19:28
+ |
+LL | const T2: &'static usize = &S; //~ ERROR: constants cannot refer to statics
+ | ^^
+
+error[E0013]: constants cannot refer to statics, use a constant instead
+ --> $DIR/issue-17718-references.rs:24:19
+ |
+LL | const T6: usize = S; //~ ERROR: constants cannot refer to statics
+ | ^
+
+error[E0013]: constants cannot refer to statics, use a constant instead
+ --> $DIR/issue-17718-references.rs:29:33
+ |
+LL | const T10: Struct = Struct { a: S };
+ | ^
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0013`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo;
+const INIT: Foo = Foo;
+static FOO: Foo = INIT;
+
+fn main() {
+ let _a = FOO; //~ ERROR: cannot move out of static item
+}
--- /dev/null
+error[E0507]: cannot move out of static item
+ --> $DIR/issue-17718-static-move.rs:16:14
+ |
+LL | let _a = FOO; //~ ERROR: cannot move out of static item
+ | ^^^
+ | |
+ | cannot move out of static item
+ | help: consider using a reference instead: `&FOO`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(optin_builtin_traits)]
+
+use std::marker::Sync;
+
+struct Foo;
+impl !Sync for Foo {}
+
+static FOO: usize = 3;
+static BAR: Foo = Foo;
+//~^ ERROR: `Foo` cannot be shared between threads safely [E0277]
+
+fn main() {}
--- /dev/null
+error[E0277]: `Foo` cannot be shared between threads safely
+ --> $DIR/issue-17718-static-sync.rs:19:1
+ |
+LL | static BAR: Foo = Foo;
+ | ^^^^^^^^^^^^^^^^^^^^^^ `Foo` cannot be shared between threads safely
+ |
+ = help: the trait `std::marker::Sync` is not implemented for `Foo`
+ = note: shared static variables must have a type that implements `Sync`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
--- /dev/null
+warning: not reporting region error due to nll
+ --> $DIR/issue-17728.rs:23:49
+ |
+LL | let maybe_room = room.direction_to_room.get(&direction);
+ | ^^^
+
+error[E0308]: match arms have incompatible types
+ --> $DIR/issue-17728.rs:110:5
+ |
+LL | / match to_parse { //~ ERROR match arms have incompatible types
+LL | | "w" | "west" => RoomDirection::West,
+LL | | "e" | "east" => RoomDirection::East,
+LL | | "n" | "north" => RoomDirection::North,
+... |
+LL | | _ => None
+ | | ---- match arm with an incompatible type
+LL | | }
+ | |_____^ expected enum `RoomDirection`, found enum `std::option::Option`
+ |
+ = note: expected type `RoomDirection`
+ found type `std::option::Option<_>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::fmt::{Debug, Formatter, Error};
+use std::collections::HashMap;
+
+trait HasInventory {
+ fn getInventory<'s>(&'s self) -> &'s mut Inventory;
+ fn addToInventory(&self, item: &Item);
+ fn removeFromInventory(&self, itemName: &str) -> bool;
+}
+
+trait TraversesWorld {
+ fn attemptTraverse(&self, room: &Room, directionStr: &str) -> Result<&Room, &str> {
+ let direction = str_to_direction(directionStr);
+ let maybe_room = room.direction_to_room.get(&direction);
+ match maybe_room {
+ Some(entry) => Ok(entry),
+ //~^ ERROR 25:28: 25:37: lifetime mismatch [E0623]
+ _ => Err("Direction does not exist in room.")
+ }
+ }
+}
+
+
+#[derive(Debug, Eq, PartialEq, Hash)]
+enum RoomDirection {
+ West,
+ East,
+ North,
+ South,
+ Up,
+ Down,
+ In,
+ Out,
+
+ None
+}
+
+struct Room {
+ description: String,
+ items: Vec<Item>,
+ direction_to_room: HashMap<RoomDirection, Room>,
+}
+
+impl Room {
+ fn new(description: &'static str) -> Room {
+ Room {
+ description: description.to_string(),
+ items: Vec::new(),
+ direction_to_room: HashMap::new()
+ }
+ }
+
+ fn add_direction(&mut self, direction: RoomDirection, room: Room) {
+ self.direction_to_room.insert(direction, room);
+ }
+}
+
+struct Item {
+ name: String,
+}
+
+struct Inventory {
+ items: Vec<Item>,
+}
+
+impl Inventory {
+ fn new() -> Inventory {
+ Inventory {
+ items: Vec::new()
+ }
+ }
+}
+
+struct Player {
+ name: String,
+ inventory: Inventory,
+}
+
+impl Player {
+ fn new(name: &'static str) -> Player {
+ Player {
+ name: name.to_string(),
+ inventory: Inventory::new()
+ }
+ }
+}
+
+impl TraversesWorld for Player {
+}
+
+impl Debug for Player {
+ fn fmt(&self, formatter: &mut Formatter) -> Result<(), Error> {
+ formatter.write_str("Player{ name:");
+ formatter.write_str(&self.name);
+ formatter.write_str(" }");
+ Ok(())
+ }
+}
+
+fn str_to_direction(to_parse: &str) -> RoomDirection {
+ match to_parse { //~ ERROR match arms have incompatible types
+ "w" | "west" => RoomDirection::West,
+ "e" | "east" => RoomDirection::East,
+ "n" | "north" => RoomDirection::North,
+ "s" | "south" => RoomDirection::South,
+ "in" => RoomDirection::In,
+ "out" => RoomDirection::Out,
+ "up" => RoomDirection::Up,
+ "down" => RoomDirection::Down,
+ _ => None
+ }
+}
+
+fn main() {
+ let mut player = Player::new("Test player");
+ let mut room = Room::new("A test room");
+ println!("Made a player: {:?}", player);
+ println!("Direction parse: {:?}", str_to_direction("east"));
+ match player.attemptTraverse(&room, "west") {
+ Ok(_) => println!("Was able to move west"),
+ Err(msg) => println!("Not able to move west: {}", msg)
+ };
+}
--- /dev/null
+error[E0623]: lifetime mismatch
+ --> $DIR/issue-17728.rs:25:28
+ |
+LL | fn attemptTraverse(&self, room: &Room, directionStr: &str) -> Result<&Room, &str> {
+ | ----- -------------------
+ | |
+ | this parameter and the return type are declared with different lifetimes...
+...
+LL | Some(entry) => Ok(entry),
+ | ^^^^^^^^^ ...but data from `room` is returned here
+
+error[E0308]: match arms have incompatible types
+ --> $DIR/issue-17728.rs:110:5
+ |
+LL | / match to_parse { //~ ERROR match arms have incompatible types
+LL | | "w" | "west" => RoomDirection::West,
+LL | | "e" | "east" => RoomDirection::East,
+LL | | "n" | "north" => RoomDirection::North,
+... |
+LL | | _ => None
+ | | ---- match arm with an incompatible type
+LL | | }
+ | |_____^ expected enum `RoomDirection`, found enum `std::option::Option`
+ |
+ = note: expected type `RoomDirection`
+ found type `std::option::Option<_>`
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0308, E0623.
+For more information about an error, try `rustc --explain E0308`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo<'a> {
+ data: &'a[u8],
+}
+
+impl <'a> Foo<'a>{
+ fn bar(self: &mut Foo) {
+ //~^ mismatched method receiver
+ //~| expected type `Foo<'a>`
+ //~| found type `Foo<'_>`
+ //~| lifetime mismatch
+ //~| mismatched method receiver
+ //~| expected type `Foo<'a>`
+ //~| found type `Foo<'_>`
+ //~| lifetime mismatch
+ }
+}
+
+fn main() {}
--- /dev/null
+error[E0308]: mismatched method receiver
+ --> $DIR/issue-17740.rs:16:18
+ |
+LL | fn bar(self: &mut Foo) {
+ | ^^^^^^^^ lifetime mismatch
+ |
+ = note: expected type `Foo<'a>`
+ found type `Foo<'_>`
+note: the anonymous lifetime #2 defined on the method body at 16:5...
+ --> $DIR/issue-17740.rs:16:5
+ |
+LL | / fn bar(self: &mut Foo) {
+LL | | //~^ mismatched method receiver
+LL | | //~| expected type `Foo<'a>`
+LL | | //~| found type `Foo<'_>`
+... |
+LL | | //~| lifetime mismatch
+LL | | }
+ | |_____^
+note: ...does not necessarily outlive the lifetime 'a as defined on the impl at 15:7
+ --> $DIR/issue-17740.rs:15:7
+ |
+LL | impl <'a> Foo<'a>{
+ | ^^
+
+error[E0308]: mismatched method receiver
+ --> $DIR/issue-17740.rs:16:18
+ |
+LL | fn bar(self: &mut Foo) {
+ | ^^^^^^^^ lifetime mismatch
+ |
+ = note: expected type `Foo<'a>`
+ found type `Foo<'_>`
+note: the lifetime 'a as defined on the impl at 15:7...
+ --> $DIR/issue-17740.rs:15:7
+ |
+LL | impl <'a> Foo<'a>{
+ | ^^
+note: ...does not necessarily outlive the anonymous lifetime #2 defined on the method body at 16:5
+ --> $DIR/issue-17740.rs:16:5
+ |
+LL | / fn bar(self: &mut Foo) {
+LL | | //~^ mismatched method receiver
+LL | | //~| expected type `Foo<'a>`
+LL | | //~| found type `Foo<'_>`
+... |
+LL | | //~| lifetime mismatch
+LL | | }
+ | |_____^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+warning: not reporting region error due to nll
+ --> $DIR/issue-17758.rs:17:9
+ |
+LL | self.foo();
+ | ^^^^
+
+warning: not reporting region error due to nll
+ --> $DIR/issue-17758.rs:17:14
+ |
+LL | self.foo();
+ | ^^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/issue-17758.rs:17:9
+ |
+LL | fn bar(&self) {
+ | - let's call the lifetime of this reference `'1`
+LL | self.foo();
+ | ^^^^^^^^^^ argument requires that `'1` must outlive `'a`
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Test that regionck suggestions in a provided method of a trait
+// don't ICE
+
+trait Foo<'a> {
+ fn foo(&'a self);
+ fn bar(&self) {
+ self.foo();
+ //~^ ERROR cannot infer
+ }
+}
+
+fn main() {}
--- /dev/null
+error[E0495]: cannot infer an appropriate lifetime for autoref due to conflicting requirements
+ --> $DIR/issue-17758.rs:17:14
+ |
+LL | self.foo();
+ | ^^^
+ |
+note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the method body at 16:5...
+ --> $DIR/issue-17758.rs:16:5
+ |
+LL | / fn bar(&self) {
+LL | | self.foo();
+LL | | //~^ ERROR cannot infer
+LL | | }
+ | |_____^
+note: ...so that reference does not outlive borrowed content
+ --> $DIR/issue-17758.rs:17:9
+ |
+LL | self.foo();
+ | ^^^^
+note: but, the lifetime must be valid for the lifetime 'a as defined on the trait at 14:11...
+ --> $DIR/issue-17758.rs:14:11
+ |
+LL | trait Foo<'a> {
+ | ^^
+ = note: ...so that the types are compatible:
+ expected &'a Self
+ found &Self
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0495`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+enum MyOption<T> {
+ MySome(T),
+ MyNone,
+}
+
+fn main() {
+ match MyOption::MySome(42) {
+ MyOption::MySome { x: 42 } => (),
+ //~^ ERROR variant `MyOption::MySome` does not have a field named `x`
+ //~| ERROR pattern does not mention field `0`
+ _ => (),
+ }
+}
--- /dev/null
+error[E0026]: variant `MyOption::MySome` does not have a field named `x`
+ --> $DIR/issue-17800.rs:18:28
+ |
+LL | MyOption::MySome { x: 42 } => (),
+ | ^^^^^ variant `MyOption::MySome` does not have this field
+
+error[E0027]: pattern does not mention field `0`
+ --> $DIR/issue-17800.rs:18:9
+ |
+LL | MyOption::MySome { x: 42 } => (),
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ missing field `0`
+ |
+ = note: trying to match a tuple variant with a struct variant pattern
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0026, E0027.
+For more information about an error, try `rustc --explain E0026`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Test that we can parse a unit struct with a where clause, even if
+// it leads to an error later on since `T` is unused.
+
+struct Foo<T> where T: Copy; //~ ERROR parameter `T` is never used
+
+fn main() {}
--- /dev/null
+error[E0392]: parameter `T` is never used
+ --> $DIR/issue-17904-2.rs:14:12
+ |
+LL | struct Foo<T> where T: Copy; //~ ERROR parameter `T` is never used
+ | ^ unused type parameter
+ |
+ = help: consider removing `T` or using a marker such as `std::marker::PhantomData`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0392`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#[derive(Debug)]
+struct Pair<T, V> (T, V);
+
+impl Pair<
+ &str, //~ ERROR missing lifetime specifier
+ isize
+> {
+ fn say(self: &Pair<&str, isize>) {
+ println!("{}", self);
+ }
+}
+
+fn main() {
+ let result = &Pair("shane", 1);
+ result.say();
+}
--- /dev/null
+error[E0106]: missing lifetime specifier
+ --> $DIR/issue-17905.rs:15:5
+ |
+LL | &str, //~ ERROR missing lifetime specifier
+ | ^ expected lifetime parameter
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0106`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+
+// error-pattern: too big for the current architecture
+
+#![feature(box_syntax)]
+
+#[cfg(target_pointer_width = "64")]
+fn main() {
+ let n = 0_usize;
+ let a: Box<_> = box [&n; 0xF000000000000000_usize];
+ println!("{}", a[0xFFFFFF_usize]);
+}
+
+#[cfg(target_pointer_width = "32")]
+fn main() {
+ let n = 0_usize;
+ let a: Box<_> = box [&n; 0xFFFFFFFF_usize];
+ println!("{}", a[0xFFFFFF_usize]);
+}
--- /dev/null
+error: the type `[&usize; 17293822569102704640]` is too big for the current architecture
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub static X: usize = 1;
+
+fn main() {
+ match 1 {
+ self::X => { },
+ //~^ ERROR expected unit struct/variant or constant, found static `self::X`
+ _ => { },
+ }
+}
--- /dev/null
+error[E0532]: expected unit struct/variant or constant, found static `self::X`
+ --> $DIR/issue-17933.rs:15:9
+ |
+LL | self::X => { },
+ | ^^^^^^^ not a unit struct/variant or constant
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0532`.
--- /dev/null
+error[E0597]: `FOO` does not live long enough
+ --> $DIR/issue-17954.rs:20:13
+ |
+LL | let a = &FOO;
+ | ^^^^ borrowed value does not live long enough
+...
+LL | }
+ | - borrowed value only lives until here
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
--- /dev/null
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/issue-17954.rs:20:14
+ |
+LL | let a = &FOO;
+ | ^^^ temporary value does not live long enough
+...
+LL | }
+ | - temporary value only lives until here
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
--- /dev/null
+error[E0597]: `FOO` does not live long enough
+ --> $DIR/issue-17954.rs:20:13
+ |
+LL | let a = &FOO;
+ | ^^^^ borrowed value does not live long enough
+...
+LL | }
+ | - borrowed value only lives until here
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
--- /dev/null
+// 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.
+
+// revisions: ast mir
+//[mir]compile-flags: -Z borrowck=mir
+
+#![feature(thread_local)]
+
+#[thread_local]
+static FOO: u8 = 3;
+
+fn main() {
+ let a = &FOO;
+ //[mir]~^ ERROR `FOO` does not live long enough [E0597]
+ //[mir]~| does not live long enough
+ //[mir]~| NOTE borrowed value must be valid for the static lifetime
+ //[ast]~^^^^ ERROR borrowed value does not live long enough
+ //[ast]~| does not live long enough
+ //[ast]~| NOTE borrowed value must be valid for the static lifetime
+
+ std::thread::spawn(move || {
+ println!("{}", a);
+ });
+}
+//[mir]~^ borrowed value only lives until here
+//[ast]~^^ temporary value only lives until here
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+extern crate core;
+
+use core::ops::Drop;
+
+trait Bar {}
+
+struct G<T: ?Sized> {
+ _ptr: *const T
+}
+
+impl<T> Drop for G<T> {
+//~^ ERROR: The requirement `T: std::marker::Sized` is added only by the Drop impl. [E0367]
+ fn drop(&mut self) {
+ if !self._ptr.is_null() {
+ }
+ }
+}
+
+fn main() {
+ let x:G<Bar>;
+}
--- /dev/null
+error[E0367]: The requirement `T: std::marker::Sized` is added only by the Drop impl.
+ --> $DIR/issue-17959.rs:21:1
+ |
+LL | / impl<T> Drop for G<T> {
+LL | | //~^ ERROR: The requirement `T: std::marker::Sized` is added only by the Drop impl. [E0367]
+LL | | fn drop(&mut self) {
+LL | | if !self._ptr.is_null() {
+LL | | }
+LL | | }
+LL | | }
+ | |_^
+ |
+note: The same requirement must be part of the struct/enum definition
+ --> $DIR/issue-17959.rs:17:1
+ |
+LL | / struct G<T: ?Sized> {
+LL | | _ptr: *const T
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0367`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Tr {}
+type Huh<T> where T: Tr = isize; //~ ERROR type parameter `T` is unused
+fn main() {}
--- /dev/null
+error[E0091]: type parameter `T` is unused
+ --> $DIR/issue-17994.rs:12:10
+ |
+LL | type Huh<T> where T: Tr = isize; //~ ERROR type parameter `T` is unused
+ | ^ unused type parameter
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0091`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![deny(unused_variables)]
+
+fn main() {
+ for _ in 1..101 {
+ let x = (); //~ ERROR: unused variable: `x`
+ match () {
+ a => {} //~ ERROR: unused variable: `a`
+ }
+ }
+}
--- /dev/null
+error: unused variable: `x`
+ --> $DIR/issue-17999.rs:15:13
+ |
+LL | let x = (); //~ ERROR: unused variable: `x`
+ | ^ help: consider using `_x` instead
+ |
+note: lint level defined here
+ --> $DIR/issue-17999.rs:11:9
+ |
+LL | #![deny(unused_variables)]
+ | ^^^^^^^^^^^^^^^^
+
+error: unused variable: `a`
+ --> $DIR/issue-17999.rs:17:13
+ |
+LL | a => {} //~ ERROR: unused variable: `a`
+ | ^ help: consider using `_a` instead
+
+error: aborting due to 2 previous errors
+
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+impl Undefined {}
+//~^ ERROR cannot find type `Undefined` in this scope
+
+fn main() {}
--- /dev/null
+error[E0412]: cannot find type `Undefined` in this scope
+ --> $DIR/issue-18058.rs:11:6
+ |
+LL | impl Undefined {}
+ | ^^^^^^^^^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0412`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub trait AbstractRenderer {}
+
+fn _create_render(_: &()) ->
+ AbstractRenderer
+//~^ ERROR the size for values of type
+{
+ match 0 {
+ _ => unimplemented!()
+ }
+}
+
+fn main() {
+}
--- /dev/null
+error[E0277]: the size for values of type `(dyn AbstractRenderer + 'static)` cannot be known at compilation time
+ --> $DIR/issue-18107.rs:14:5
+ |
+LL | AbstractRenderer
+ | ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `(dyn AbstractRenderer + 'static)`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
+ = note: the return type of a function must have a statically known size
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub fn main() {
+ const z: &'static isize = {
+ static p: isize = 3;
+ &p
+ //~^ ERROR constants cannot refer to statics, use a constant instead
+ };
+}
--- /dev/null
+error[E0013]: constants cannot refer to statics, use a constant instead
+ --> $DIR/issue-18118-2.rs:14:9
+ |
+LL | &p
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0013`.
--- /dev/null
+error[E0658]: let bindings in constants are unstable (see issue #48821)
+ --> $DIR/issue-18118.rs:15:17
+ |
+LL | let p = 3;
+ | ^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: statements in constants are unstable (see issue #48821)
+ --> $DIR/issue-18118.rs:15:17
+ |
+LL | let p = 3;
+ | ^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: let bindings in constants are unstable (see issue #48821)
+ --> $DIR/issue-18118.rs:18:9
+ |
+LL | &p //~ ERROR `p` does not live long enough
+ | ^^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: let bindings in constants are unstable (see issue #48821)
+ --> $DIR/issue-18118.rs:12:5
+ |
+LL | / const z: &'static isize = {
+LL | | //~^ ERROR let bindings in constants are unstable
+LL | | //~| ERROR statements in constants are unstable
+LL | | let p = 3;
+... |
+LL | | //~^ ERROR let bindings in constants are unstable
+LL | | };
+ | |______^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: statements in constants are unstable (see issue #48821)
+ --> $DIR/issue-18118.rs:12:5
+ |
+LL | / const z: &'static isize = {
+LL | | //~^ ERROR let bindings in constants are unstable
+LL | | //~| ERROR statements in constants are unstable
+LL | | let p = 3;
+... |
+LL | | //~^ ERROR let bindings in constants are unstable
+LL | | };
+ | |______^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0597]: `p` does not live long enough
+ --> $DIR/issue-18118.rs:18:9
+ |
+LL | &p //~ ERROR `p` does not live long enough
+ | ^^ borrowed value does not live long enough
+LL | //~^ ERROR let bindings in constants are unstable
+LL | };
+ | - borrowed value only lives until here
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to 6 previous errors
+
+Some errors occurred: E0597, E0658.
+For more information about an error, try `rustc --explain E0597`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub fn main() {
+ const z: &'static isize = {
+ //~^ ERROR let bindings in constants are unstable
+ //~| ERROR statements in constants are unstable
+ let p = 3;
+ //~^ ERROR let bindings in constants are unstable
+ //~| ERROR statements in constants are unstable
+ &p //~ ERROR `p` does not live long enough
+ //~^ ERROR let bindings in constants are unstable
+ };
+}
--- /dev/null
+error[E0658]: let bindings in constants are unstable (see issue #48821)
+ --> $DIR/issue-18118.rs:15:17
+ |
+LL | let p = 3;
+ | ^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: statements in constants are unstable (see issue #48821)
+ --> $DIR/issue-18118.rs:15:17
+ |
+LL | let p = 3;
+ | ^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: let bindings in constants are unstable (see issue #48821)
+ --> $DIR/issue-18118.rs:18:9
+ |
+LL | &p //~ ERROR `p` does not live long enough
+ | ^^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: let bindings in constants are unstable (see issue #48821)
+ --> $DIR/issue-18118.rs:12:5
+ |
+LL | / const z: &'static isize = {
+LL | | //~^ ERROR let bindings in constants are unstable
+LL | | //~| ERROR statements in constants are unstable
+LL | | let p = 3;
+... |
+LL | | //~^ ERROR let bindings in constants are unstable
+LL | | };
+ | |______^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: statements in constants are unstable (see issue #48821)
+ --> $DIR/issue-18118.rs:12:5
+ |
+LL | / const z: &'static isize = {
+LL | | //~^ ERROR let bindings in constants are unstable
+LL | | //~| ERROR statements in constants are unstable
+LL | | let p = 3;
+... |
+LL | | //~^ ERROR let bindings in constants are unstable
+LL | | };
+ | |______^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0597]: `p` does not live long enough
+ --> $DIR/issue-18118.rs:18:10
+ |
+LL | &p //~ ERROR `p` does not live long enough
+ | ^ borrowed value does not live long enough
+LL | //~^ ERROR let bindings in constants are unstable
+LL | };
+ | - borrowed value only lives until here
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to 6 previous errors
+
+Some errors occurred: E0597, E0658.
+For more information about an error, try `rustc --explain E0597`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+const X: u8 = 1;
+static Y: u8 = 1;
+fn foo() {}
+
+impl X {}
+//~^ ERROR expected type, found constant `X`
+impl Y {}
+//~^ ERROR expected type, found static `Y`
+impl foo {}
+//~^ ERROR expected type, found function `foo`
+
+fn main() {}
--- /dev/null
+error[E0573]: expected type, found constant `X`
+ --> $DIR/issue-18119.rs:15:6
+ |
+LL | impl X {}
+ | ^ not a type
+
+error[E0573]: expected type, found static `Y`
+ --> $DIR/issue-18119.rs:17:6
+ |
+LL | impl Y {}
+ | ^ not a type
+
+error[E0573]: expected type, found function `foo`
+ --> $DIR/issue-18119.rs:19:6
+ |
+LL | impl foo {}
+ | ^^^ not a type
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0573`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ let x; //~ ERROR type annotations needed
+}
--- /dev/null
+error[E0282]: type annotations needed
+ --> $DIR/issue-18159.rs:12:9
+ |
+LL | let x; //~ ERROR type annotations needed
+ | ^
+ | |
+ | cannot infer type for `_`
+ | consider giving `x` a type
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0282`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ const X: u32 = 1;
+ const Y: usize = &X as *const u32 as usize; //~ ERROR E0018
+ println!("{}", Y);
+}
--- /dev/null
+error[E0018]: raw pointers cannot be cast to integers in constants
+ --> $DIR/issue-18294.rs:13:22
+ |
+LL | const Y: usize = &X as *const u32 as usize; //~ ERROR E0018
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0018`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::any::Any;
+use std::any::TypeId;
+
+trait Private<P, R> {
+ fn call(&self, p: P, r: R);
+}
+pub trait Public: Private<
+//~^ ERROR private trait `Private<<Self as Public>::P, <Self as Public>::R>` in public interface
+ <Self as Public>::P,
+ <Self as Public>::R
+> {
+ type P;
+ type R;
+
+ fn call_inner(&self);
+}
+
+fn main() {}
--- /dev/null
+error[E0445]: private trait `Private<<Self as Public>::P, <Self as Public>::R>` in public interface
+ --> $DIR/issue-18389.rs:17:1
+ |
+LL | / pub trait Public: Private<
+LL | | //~^ ERROR private trait `Private<<Self as Public>::P, <Self as Public>::R>` in public interface
+LL | | <Self as Public>::P,
+LL | | <Self as Public>::R
+... |
+LL | | fn call_inner(&self);
+LL | | }
+ | |_^ can't leak private trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0445`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Set<T> {
+ fn contains(&self, _: T) -> bool;
+ fn set(&mut self, _: T);
+}
+
+impl<'a, T, S> Set<&'a [T]> for S where
+ T: Copy,
+ S: Set<T>,
+{
+ fn contains(&self, bits: &[T]) -> bool {
+ bits.iter().all(|&bit| self.contains(bit))
+ }
+
+ fn set(&mut self, bits: &[T]) {
+ for &bit in bits {
+ self.set(bit)
+ }
+ }
+}
+
+fn main() {
+ let bits: &[_] = &[0, 1];
+
+ 0.contains(bits);
+ //~^ ERROR overflow
+}
--- /dev/null
+error[E0275]: overflow evaluating the requirement `_: std::marker::Sized`
+ --> $DIR/issue-18400.rs:34:7
+ |
+LL | 0.contains(bits);
+ | ^^^^^^^^
+ |
+ = help: consider adding a `#![recursion_limit="128"]` attribute to your crate
+ = note: required because of the requirements on the impl of `Set<&[_]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[_]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[_]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[_]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[_]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[_]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[_]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[_]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[_]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+ = note: required because of the requirements on the impl of `Set<&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[&[_]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]>` for `{integer}`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0275`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Test that `Box` cannot be used with a lifetime parameter.
+
+struct Foo<'a> {
+ x: Box<'a, isize> //~ ERROR wrong number of lifetime parameters
+}
+
+pub fn main() {
+}
--- /dev/null
+error[E0107]: wrong number of lifetime parameters: expected 0, found 1
+ --> $DIR/issue-18423.rs:14:8
+ |
+LL | x: Box<'a, isize> //~ ERROR wrong number of lifetime parameters
+ | ^^^^^^^^^^^^^^ unexpected lifetime parameter
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0107`.
--- /dev/null
+// 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.
+
+// Test that name clashes between the method in an impl for the type
+// and the method in the trait when both are in the same scope.
+
+trait T {
+ fn foo(&self);
+}
+
+impl<'a> T + 'a {
+ fn foo(&self) {}
+}
+
+impl T for i32 {
+ fn foo(&self) {}
+}
+
+fn main() {
+ let x: &T = &0i32;
+ x.foo(); //~ ERROR multiple applicable items in scope [E0034]
+}
--- /dev/null
+error[E0034]: multiple applicable items in scope
+ --> $DIR/issue-18446.rs:28:7
+ |
+LL | x.foo(); //~ ERROR multiple applicable items in scope [E0034]
+ | ^^^ multiple `foo` found
+ |
+note: candidate #1 is defined in an impl for the type `dyn T`
+ --> $DIR/issue-18446.rs:19:5
+ |
+LL | fn foo(&self) {}
+ | ^^^^^^^^^^^^^
+note: candidate #2 is defined in the trait `T`
+ --> $DIR/issue-18446.rs:15:5
+ |
+LL | fn foo(&self);
+ | ^^^^^^^^^^^^^^
+ = help: to disambiguate the method call, write `T::foo(&x)` instead
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0034`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Test that overloaded call parameter checking does not ICE
+// when a type error or unconstrained type variable propagates
+// into it.
+
+fn main() {
+ (return)((),()); //~ ERROR expected function, found `!`
+}
--- /dev/null
+error[E0618]: expected function, found `!`
+ --> $DIR/issue-18532.rs:16:5
+ |
+LL | (return)((),()); //~ ERROR expected function, found `!`
+ | ^^^^^^^^^^^^^^^ not a function
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0618`.
--- /dev/null
+error[E0499]: cannot borrow `*s` as mutable more than once at a time
+ --> $DIR/issue-18566.rs:33:19
+ |
+LL | MyPtr(s).poke(s);
+ | --------------^-
+ | | | |
+ | | | second mutable borrow occurs here
+ | | first mutable borrow occurs here
+ | borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0499`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::ops::Deref;
+
+struct MyPtr<'a>(&'a mut usize);
+impl<'a> Deref for MyPtr<'a> {
+ type Target = usize;
+
+ fn deref<'b>(&'b self) -> &'b usize { self.0 }
+}
+
+trait Tr {
+ fn poke(&self, s: &mut usize);
+}
+
+impl Tr for usize {
+ fn poke(&self, s: &mut usize) {
+ *s = 2;
+ }
+}
+
+fn main() {
+ let s = &mut 1;
+
+ MyPtr(s).poke(s);
+ //~^ ERROR cannot borrow `*s` as mutable more than once at a time
+}
--- /dev/null
+error[E0499]: cannot borrow `*s` as mutable more than once at a time
+ --> $DIR/issue-18566.rs:33:19
+ |
+LL | MyPtr(s).poke(s);
+ | - ^- first borrow ends here
+ | | |
+ | | second mutable borrow occurs here
+ | first mutable borrow occurs here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0499`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn add_state(op: <isize as HasState>::State) {
+//~^ ERROR `isize: HasState` is not satisfied
+}
+
+trait HasState {
+ type State;
+}
+
+fn main() {}
--- /dev/null
+error[E0277]: the trait bound `isize: HasState` is not satisfied
+ --> $DIR/issue-18611.rs:11:1
+ |
+LL | / fn add_state(op: <isize as HasState>::State) {
+LL | | //~^ ERROR `isize: HasState` is not satisfied
+LL | | }
+ | |_^ the trait `HasState` is not implemented for `isize`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Tests that we don't generate a spurious error about f.honk's type
+// being undeterminable
+fn main() {
+ let f = 42;
+
+ let _g = if f < 5 {
+ f.honk() //~ ERROR no method named `honk` found
+ }
+ else {
+ ()
+ };
+}
--- /dev/null
+error[E0599]: no method named `honk` found for type `{integer}` in the current scope
+ --> $DIR/issue-1871.rs:17:9
+ |
+LL | f.honk() //~ ERROR no method named `honk` found
+ | ^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
--- /dev/null
+error[E0499]: cannot borrow `y` as mutable more than once at a time
+ --> $DIR/issue-18783.rs:17:21
+ |
+LL | c.push(Box::new(|| y = 0));
+ | -- - previous borrow occurs due to use of `y` in closure
+ | |
+ | first mutable borrow occurs here
+LL | c.push(Box::new(|| y = 0));
+ | ^^ - borrow occurs due to use of `y` in closure
+ | |
+ | second mutable borrow occurs here
+LL | //~^ ERROR cannot borrow `y` as mutable more than once at a time
+LL | }
+ | - borrow later used here, when `c` is dropped
+
+error[E0499]: cannot borrow `y` as mutable more than once at a time
+ --> $DIR/issue-18783.rs:26:29
+ |
+LL | Push::push(&c, Box::new(|| y = 0));
+ | -- - previous borrow occurs due to use of `y` in closure
+ | |
+ | first mutable borrow occurs here
+LL | Push::push(&c, Box::new(|| y = 0));
+ | ^^ - borrow occurs due to use of `y` in closure
+ | |
+ | second mutable borrow occurs here
+LL | //~^ ERROR cannot borrow `y` as mutable more than once at a time
+LL | }
+ | - borrow later used here, when `c` is dropped
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0499`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::cell::RefCell;
+
+fn main() {
+ let mut y = 1;
+ let c = RefCell::new(vec![]);
+ c.push(Box::new(|| y = 0));
+ c.push(Box::new(|| y = 0));
+//~^ ERROR cannot borrow `y` as mutable more than once at a time
+}
+
+fn ufcs() {
+ let mut y = 1;
+ let c = RefCell::new(vec![]);
+
+ Push::push(&c, Box::new(|| y = 0));
+ Push::push(&c, Box::new(|| y = 0));
+//~^ ERROR cannot borrow `y` as mutable more than once at a time
+}
+
+trait Push<'c> {
+ fn push<'f: 'c>(&self, push: Box<FnMut() + 'f>);
+}
+
+impl<'c> Push<'c> for RefCell<Vec<Box<FnMut() + 'c>>> {
+ fn push<'f: 'c>(&self, fun: Box<FnMut() + 'f>) {
+ self.borrow_mut().push(fun)
+ }
+}
--- /dev/null
+error[E0499]: cannot borrow `y` as mutable more than once at a time
+ --> $DIR/issue-18783.rs:17:21
+ |
+LL | c.push(Box::new(|| y = 0));
+ | -- - previous borrow occurs due to use of `y` in closure
+ | |
+ | first mutable borrow occurs here
+LL | c.push(Box::new(|| y = 0));
+ | ^^ - borrow occurs due to use of `y` in closure
+ | |
+ | second mutable borrow occurs here
+LL | //~^ ERROR cannot borrow `y` as mutable more than once at a time
+LL | }
+ | - first borrow ends here
+
+error[E0499]: cannot borrow `y` as mutable more than once at a time
+ --> $DIR/issue-18783.rs:26:29
+ |
+LL | Push::push(&c, Box::new(|| y = 0));
+ | -- - previous borrow occurs due to use of `y` in closure
+ | |
+ | first mutable borrow occurs here
+LL | Push::push(&c, Box::new(|| y = 0));
+ | ^^ - borrow occurs due to use of `y` in closure
+ | |
+ | second mutable borrow occurs here
+LL | //~^ ERROR cannot borrow `y` as mutable more than once at a time
+LL | }
+ | - first borrow ends here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0499`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+type FuncType<'f> = Fn(&isize) -> isize + 'f;
+
+fn ho_func(f: Option<FuncType>) {
+ //~^ ERROR the size for values of type
+}
+
+fn main() {}
--- /dev/null
+error[E0277]: the size for values of type `dyn for<'r> std::ops::Fn(&'r isize) -> isize` cannot be known at compilation time
+ --> $DIR/issue-18919.rs:13:1
+ |
+LL | / fn ho_func(f: Option<FuncType>) {
+LL | | //~^ ERROR the size for values of type
+LL | | }
+ | |_^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `dyn for<'r> std::ops::Fn(&'r isize) -> isize`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
+ = note: required by `std::option::Option`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Regression test for #18937.
+
+use std::fmt;
+
+#[derive(Debug)]
+struct MyString<'a>(&'a String);
+
+struct B {
+ list: Vec<Box<fmt::Debug>>,
+}
+
+trait A<'a> {
+ fn foo<F>(&mut self, f: F)
+ where F: fmt::Debug + 'a,
+ Self: Sized;
+}
+
+impl<'a> A<'a> for B {
+ fn foo<F>(&mut self, f: F) //~ ERROR impl has stricter
+ where F: fmt::Debug + 'static,
+ {
+ self.list.push(Box::new(f));
+ }
+}
+
+fn main() {
+ let mut b = B { list: Vec::new() };
+
+ // Create a borrowed pointer, put it in `b`, then drop what's borrowing it
+ let a = "hello".to_string();
+ b.foo(MyString(&a));
+
+ // Drop the data which `b` has a reference to
+ drop(a);
+
+ // Use the data, probably segfaulting
+ for b in b.list.iter() {
+ println!("{:?}", b);
+ }
+}
--- /dev/null
+error[E0276]: impl has stricter requirements than trait
+ --> $DIR/issue-18937.rs:29:5
+ |
+LL | / fn foo<F>(&mut self, f: F)
+LL | | where F: fmt::Debug + 'a,
+LL | | Self: Sized;
+ | |__________________________- definition of `foo` from trait
+...
+LL | / fn foo<F>(&mut self, f: F) //~ ERROR impl has stricter
+LL | | where F: fmt::Debug + 'static,
+LL | | {
+LL | | self.list.push(Box::new(f));
+LL | | }
+ | |_____^ impl has extra requirement `F: 'static`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0276`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub trait Foo { fn foo<T>(&self, ext_thing: &T); }
+pub trait Bar: Foo { }
+impl<T: Foo> Bar for T { }
+
+pub struct Thing;
+impl Foo for Thing {
+ fn foo<T>(&self, _: &T) {}
+}
+
+#[inline(never)]
+fn foo(b: &Bar) {
+ //~^ ERROR E0038
+ b.foo(&0)
+}
+
+fn main() {
+ let mut thing = Thing;
+ let test: &Bar = &mut thing;
+ foo(test);
+}
--- /dev/null
+error[E0038]: the trait `Bar` cannot be made into an object
+ --> $DIR/issue-18959.rs:21:1
+ |
+LL | fn foo(b: &Bar) {
+ | ^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object
+ |
+ = note: method `foo` has generic type parameters
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0038`.
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main<T>() { }
+//~^ ERROR `main` function is not allowed to have generic parameters
--- /dev/null
+error[E0131]: `main` function is not allowed to have generic parameters
+ --> $DIR/issue-1900.rs:11:8
+ |
+LL | fn main<T>() { }
+ | ^^^ `main` cannot have generic parameters
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0131`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use Foo::FooB;
+
+enum Foo {
+ FooB { x: i32, y: i32 }
+}
+
+fn main() {
+ let f = FooB { x: 3, y: 4 };
+ match f {
+ FooB(a, b) => println!("{} {}", a, b),
+ //~^ ERROR expected tuple struct/variant, found struct variant `FooB`
+ }
+}
--- /dev/null
+error[E0532]: expected tuple struct/variant, found struct variant `FooB`
+ --> $DIR/issue-19086.rs:20:9
+ |
+LL | FooB(a, b) => println!("{} {}", a, b),
+ | ^^^^ did you mean `FooB { /* fields */ }`?
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0532`.
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+const TUP: (usize,) = (42,);
+
+fn main() {
+ let a: [isize; TUP.1];
+ //~^ ERROR no field `1` on type `(usize,)`
+}
--- /dev/null
+error[E0609]: no field `1` on type `(usize,)`
+ --> $DIR/issue-19244-1.rs:14:24
+ |
+LL | let a: [isize; TUP.1];
+ | ^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0609`.
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct MyStruct { field: usize }
+const STRUCT: MyStruct = MyStruct { field: 42 };
+
+fn main() {
+ let a: [isize; STRUCT.nonexistent_field];
+ //~^ no field `nonexistent_field` on type `MyStruct`
+}
--- /dev/null
+error[E0609]: no field `nonexistent_field` on type `MyStruct`
+ --> $DIR/issue-19244-2.rs:15:27
+ |
+LL | let a: [isize; STRUCT.nonexistent_field];
+ | ^^^^^^^^^^^^^^^^^ unknown field
+ |
+ = note: available fields are: `field`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0609`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Qiz {
+ fn qiz();
+}
+
+struct Foo;
+impl Qiz for Foo {
+ fn qiz() {}
+}
+
+struct Bar {
+ foos: &'static [&'static (Qiz + 'static)]
+//~^ ERROR E0038
+}
+
+const FOO : Foo = Foo;
+const BAR : Bar = Bar { foos: &[&FOO]};
+
+fn main() { }
--- /dev/null
+error[E0038]: the trait `Qiz` cannot be made into an object
+ --> $DIR/issue-19380.rs:21:3
+ |
+LL | foos: &'static [&'static (Qiz + 'static)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Qiz` cannot be made into an object
+ |
+ = note: method `qiz` has no receiver
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0038`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Test that a partially specified trait object with unspecified associated
+// type does not type-check.
+
+trait Foo {
+ type A;
+
+ fn dummy(&self) { }
+}
+
+fn bar(x: &Foo) {}
+//~^ ERROR the associated type `A` (from the trait `Foo`) must be specified
+
+pub fn main() {}
--- /dev/null
+error[E0191]: the value of the associated type `A` (from the trait `Foo`) must be specified
+ --> $DIR/issue-19482.rs:20:12
+ |
+LL | fn bar(x: &Foo) {}
+ | ^^^ missing associated type `A` value
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0191`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ "".homura()(); //~ ERROR no method named `homura` found
+}
--- /dev/null
+error[E0599]: no method named `homura` found for type `&'static str` in the current scope
+ --> $DIR/issue-19521.rs:12:8
+ |
+LL | "".homura()(); //~ ERROR no method named `homura` found
+ | ^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Foo {
+ fn foo<T>(&self, val: T);
+}
+
+trait Bar: Foo { }
+
+pub struct Thing;
+
+impl Foo for Thing {
+ fn foo<T>(&self, val: T) { }
+}
+
+impl Bar for Thing { }
+
+fn main() {
+ let mut thing = Thing;
+ let test: &mut Bar = &mut thing;
+ //~^ ERROR E0038
+ //~| ERROR E0038
+}
--- /dev/null
+error[E0038]: the trait `Bar` cannot be made into an object
+ --> $DIR/issue-19538.rs:27:15
+ |
+LL | let test: &mut Bar = &mut thing;
+ | ^^^^^^^^ the trait `Bar` cannot be made into an object
+ |
+ = note: method `foo` has generic type parameters
+
+error[E0038]: the trait `Bar` cannot be made into an object
+ --> $DIR/issue-19538.rs:27:26
+ |
+LL | let test: &mut Bar = &mut thing;
+ | ^^^^^^^^^^ the trait `Bar` cannot be made into an object
+ |
+ = note: method `foo` has generic type parameters
+ = note: required because of the requirements on the impl of `std::ops::CoerceUnsized<&mut dyn Bar>` for `&mut Thing`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0038`.
--- /dev/null
+// 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.
+
+#![feature(rustc_attrs)]
+#![allow(warnings)]
+
+trait A<T> {}
+struct B<T> where B<T>: A<B<T>> { t: T }
+
+#[rustc_error]
+fn main() { //~ ERROR compilation successful
+}
--- /dev/null
+error: compilation successful
+ --> $DIR/issue-19601.rs:18:1
+ |
+LL | / fn main() { //~ ERROR compilation successful
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// error-pattern: requires `copy` lang_item
+
+#![feature(lang_items, start, no_core)]
+#![no_core]
+
+#[lang = "sized"]
+trait Sized { }
+
+struct S;
+
+#[start]
+fn main(_: isize, _: *const *const u8) -> isize {
+ let _ = S;
+ 0
+}
--- /dev/null
+error: requires `copy` lang_item
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Homura;
+
+fn akemi(homura: Homura) {
+ let Some(ref madoka) = Some(homura.kaname()); //~ ERROR no method named `kaname` found
+ madoka.clone();
+}
+
+fn main() { }
--- /dev/null
+error[E0599]: no method named `kaname` found for type `Homura` in the current scope
+ --> $DIR/issue-19692.rs:14:40
+ |
+LL | struct Homura;
+ | -------------- method `kaname` not found for this
+...
+LL | let Some(ref madoka) = Some(homura.kaname()); //~ ERROR no method named `kaname` found
+ | ^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {}
+
+struct Type;
+
+impl Type {
+ undef!();
+ //~^ ERROR cannot find macro `undef!` in this scope
+}
--- /dev/null
+error: cannot find macro `undef!` in this scope
+ --> $DIR/issue-19734.rs:16:5
+ |
+LL | undef!();
+ | ^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait From<Src> {
+ type Output;
+
+ fn from(src: Src) -> <Self as From<Src>>::Output;
+}
+
+trait To: Sized {
+ fn to<Dst: From<Self>>(self) ->
+ <Dst as From<Self>>::Dst
+ //~^ ERROR cannot find associated type `Dst` in trait `From`
+ {
+ From::from(self)
+ }
+}
+
+fn main() {}
--- /dev/null
+error[E0576]: cannot find associated type `Dst` in trait `From`
+ --> $DIR/issue-19883.rs:19:30
+ |
+LL | <Dst as From<Self>>::Dst
+ | ^^^ not found in `From`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0576`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(unboxed_closures)]
+
+struct Foo;
+
+impl Fn<(&(),)> for Foo { } //~ ERROR missing lifetime specifier
+
+fn main() {}
--- /dev/null
+error[E0106]: missing lifetime specifier
+ --> $DIR/issue-19982.rs:15:10
+ |
+LL | impl Fn<(&(),)> for Foo { } //~ ERROR missing lifetime specifier
+ | ^ expected lifetime parameter
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0106`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Test if the sugared if-let construct correctly prints "missing an else clause" when an else
+// clause does not exist, instead of the unsympathetic "match arms have incompatible types"
+
+fn main() {
+ if let Some(homura) = Some("madoka") { //~ ERROR missing an else clause
+ //~| expected type `()`
+ //~| found type `{integer}`
+ //~| expected (), found integral variable
+ 765
+ };
+}
--- /dev/null
+error[E0317]: if may be missing an else clause
+ --> $DIR/issue-19991.rs:15:5
+ |
+LL | / if let Some(homura) = Some("madoka") { //~ ERROR missing an else clause
+LL | | //~| expected type `()`
+LL | | //~| found type `{integer}`
+LL | | //~| expected (), found integral variable
+LL | | 765
+LL | | };
+ | |_____^ expected (), found integral variable
+ |
+ = note: expected type `()`
+ found type `{integer}`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0317`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait From<Src> {
+ type Result;
+
+ fn from(src: Src) -> Self::Result;
+}
+
+trait To {
+ fn to<Dst>( //~ ERROR the size for values of type
+ self
+ ) -> <Dst as From<Self>>::Result where Dst: From<Self> {
+ From::from(self)
+ }
+}
+
+fn main() {}
--- /dev/null
+error[E0277]: the size for values of type `Self` cannot be known at compilation time
+ --> $DIR/issue-20005.rs:18:5
+ |
+LL | / fn to<Dst>( //~ ERROR the size for values of type
+LL | | self
+LL | | ) -> <Dst as From<Self>>::Result where Dst: From<Self> {
+LL | | From::from(self)
+LL | | }
+ | |_____^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `Self`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
+ = help: consider adding a `where Self: std::marker::Sized` bound
+note: required by `From`
+ --> $DIR/issue-20005.rs:11:1
+ |
+LL | trait From<Src> {
+ | ^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct X { x: i32 }
+
+fn main() {
+ let mut b: Vec<X> = vec![];
+ b.sort();
+ //~^ ERROR `X: std::cmp::Ord` is not satisfied
+}
--- /dev/null
+error[E0277]: the trait bound `X: std::cmp::Ord` is not satisfied
+ --> $DIR/issue-20162.rs:15:7
+ |
+LL | b.sort();
+ | ^^^^ the trait `std::cmp::Ord` is not implemented for `X`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(fn_traits, unboxed_closures)]
+
+struct Foo;
+
+impl<'a, T> Fn<(&'a T,)> for Foo {
+ extern "rust-call" fn call(&self, (_,): (T,)) {}
+ //~^ ERROR: has an incompatible type for trait
+ //~| expected reference
+}
+
+impl<'a, T> FnMut<(&'a T,)> for Foo {
+ extern "rust-call" fn call_mut(&mut self, (_,): (T,)) {}
+ //~^ ERROR: has an incompatible type for trait
+ //~| expected reference
+}
+
+impl<'a, T> FnOnce<(&'a T,)> for Foo {
+ type Output = ();
+
+ extern "rust-call" fn call_once(self, (_,): (T,)) {}
+ //~^ ERROR: has an incompatible type for trait
+ //~| expected reference
+}
+
+fn main() {}
--- /dev/null
+error[E0053]: method `call` has an incompatible type for trait
+ --> $DIR/issue-20225.rs:16:3
+ |
+LL | extern "rust-call" fn call(&self, (_,): (T,)) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected reference, found type parameter
+ |
+ = note: expected type `extern "rust-call" fn(&Foo, (&'a T,))`
+ found type `extern "rust-call" fn(&Foo, (T,))`
+
+error[E0053]: method `call_mut` has an incompatible type for trait
+ --> $DIR/issue-20225.rs:22:3
+ |
+LL | extern "rust-call" fn call_mut(&mut self, (_,): (T,)) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected reference, found type parameter
+ |
+ = note: expected type `extern "rust-call" fn(&mut Foo, (&'a T,))`
+ found type `extern "rust-call" fn(&mut Foo, (T,))`
+
+error[E0053]: method `call_once` has an incompatible type for trait
+ --> $DIR/issue-20225.rs:30:3
+ |
+LL | extern "rust-call" fn call_once(self, (_,): (T,)) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected reference, found type parameter
+ |
+ = note: expected type `extern "rust-call" fn(Foo, (&'a T,))`
+ found type `extern "rust-call" fn(Foo, (T,))`
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0053`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ // NB: this (almost) typechecks when default binding modes are enabled.
+ for (ref i,) in [].iter() {
+ i.clone();
+ //~^ ERROR type annotations needed
+ }
+}
--- /dev/null
+error[E0282]: type annotations needed
+ --> $DIR/issue-20261.rs:14:11
+ |
+LL | for (ref i,) in [].iter() {
+ | -------- consider giving `__next` a type
+LL | i.clone();
+ | ^^^^^ cannot infer type for `_`
+ |
+ = note: type must be known at this point
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0282`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+extern {
+ #[link_name = "llvm.sqrt.f32"]
+ fn sqrt(x: f32) -> f32; //~ ERROR linking to LLVM intrinsics is experimental
+}
+
+fn main(){
+}
--- /dev/null
+error[E0658]: linking to LLVM intrinsics is experimental (see issue #29602)
+ --> $DIR/issue-20313.rs:13:5
+ |
+LL | fn sqrt(x: f32) -> f32; //~ ERROR linking to LLVM intrinsics is experimental
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(link_llvm_intrinsics)] to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Foo {
+ fn answer(self);
+}
+
+struct NoData<T>;
+//~^ ERROR: parameter `T` is never used
+
+impl<T> Foo for T where NoData<T>: Foo {
+//~^ ERROR: overflow evaluating the requirement
+ fn answer(self) {
+ let val: NoData<T> = NoData;
+ }
+}
+
+fn main() {}
--- /dev/null
+error[E0392]: parameter `T` is never used
+ --> $DIR/issue-20413.rs:15:15
+ |
+LL | struct NoData<T>;
+ | ^ unused type parameter
+ |
+ = help: consider removing `T` or using a marker such as `std::marker::PhantomData`
+
+error[E0275]: overflow evaluating the requirement `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: std::marker::Sized`
+ --> $DIR/issue-20413.rs:18:1
+ |
+LL | / impl<T> Foo for T where NoData<T>: Foo {
+LL | | //~^ ERROR: overflow evaluating the requirement
+LL | | fn answer(self) {
+LL | | let val: NoData<T> = NoData;
+LL | | }
+LL | | }
+ | |_^
+ |
+ = help: consider adding a `#![recursion_limit="128"]` attribute to your crate
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<T>>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<T>>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<T>>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<NoData<T>>`
+ = note: required because of the requirements on the impl of `Foo` for `NoData<T>`
+note: required by `Foo`
+ --> $DIR/issue-20413.rs:11:1
+ |
+LL | trait Foo {
+ | ^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0275, E0392.
+For more information about an error, try `rustc --explain E0275`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {}
+
+struct The;
+
+impl The {
+ fn iceman(c: Vec<[i32]>) {}
+ //~^ ERROR the size for values of type
+}
--- /dev/null
+error[E0277]: the size for values of type `[i32]` cannot be known at compilation time
+ --> $DIR/issue-20433.rs:16:5
+ |
+LL | fn iceman(c: Vec<[i32]>) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `[i32]`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
+ = note: required by `std::vec::Vec`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn changer<'a>(mut things: Box<Iterator<Item=&'a mut u8>>) {
+ for item in *things { *item = 0 }
+//~^ ERROR the size for values of type
+}
+
+fn main() {}
--- /dev/null
+error[E0277]: the size for values of type `dyn std::iter::Iterator<Item=&mut u8>` cannot be known at compilation time
+ --> $DIR/issue-20605.rs:12:17
+ |
+LL | for item in *things { *item = 0 }
+ | ^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `dyn std::iter::Iterator<Item=&mut u8>`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
+ = note: required by `std::iter::IntoIterator::into_iter`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// We need all these 9 issue-20616-N.rs files
+// because we can only catch one parsing error at a time
+
+
+
+type Type_1_<'a, T> = &'a T;
+
+
+type Type_1<'a T> = &'a T; //~ error: expected one of `,`, `:`, or `>`, found `T`
+
+
+//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(`
+
+
+//type Type_3<T> = Box<T,,>; // error: expected type, found `,`
+
+
+//type Type_4<T> = Type_1_<'static,, T>; // error: expected type, found `,`
+
+
+type Type_5_<'a> = Type_1_<'a, ()>;
+
+
+//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,`
+
+
+//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,`
+
+
+//type Type_7 = Box<(),,>; // error: expected type, found `,`
+
+
+//type Type_8<'a,,> = &'a (); // error: expected ident, found `,`
+
+
+//type Type_9<T,,> = Box<T>; // error: expected ident, found `,`
--- /dev/null
+error: expected one of `,`, `:`, or `>`, found `T`
+ --> $DIR/issue-20616-1.rs:19:16
+ |
+LL | type Type_1<'a T> = &'a T; //~ error: expected one of `,`, `:`, or `>`, found `T`
+ | ^ expected one of `,`, `:`, or `>` here
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// We need all these 9 issue-20616-N.rs files
+// because we can only catch one parsing error at a time
+
+
+
+type Type_1_<'a, T> = &'a T;
+
+
+//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T`
+
+
+type Type_2 = Type_1_<'static ()>; //~ error: expected one of `,` or `>`, found `(`
+
+
+//type Type_3<T> = Box<T,,>; // error: expected type, found `,`
+
+
+//type Type_4<T> = Type_1_<'static,, T>; // error: expected type, found `,`
+
+
+type Type_5_<'a> = Type_1_<'a, ()>;
+
+
+//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,`
+
+
+//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,`
+
+
+//type Type_7 = Box<(),,>; // error: expected type, found `,`
+
+
+//type Type_8<'a,,> = &'a (); // error: expected ident, found `,`
+
+
+//type Type_9<T,,> = Box<T>; // error: expected ident, found `,`
--- /dev/null
+error: expected one of `,` or `>`, found `(`
+ --> $DIR/issue-20616-2.rs:22:31
+ |
+LL | type Type_2 = Type_1_<'static ()>; //~ error: expected one of `,` or `>`, found `(`
+ | ^ expected one of `,` or `>` here
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// We need all these 9 issue-20616-N.rs files
+// because we can only catch one parsing error at a time
+
+
+
+type Type_1_<'a, T> = &'a T;
+
+
+//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T`
+
+
+//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(`
+
+
+type Type_3<T> = Box<T,,>; //~ error: expected one of `>`, identifier, lifetime, or type, found `,`
+
+
+//type Type_4<T> = Type_1_<'static,, T>; // error: expected type, found `,`
+
+
+type Type_5_<'a> = Type_1_<'a, ()>;
+
+
+//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,`
+
+
+//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,`
+
+
+//type Type_7 = Box<(),,>; // error: expected type, found `,`
+
+
+//type Type_8<'a,,> = &'a (); // error: expected ident, found `,`
+
+
+//type Type_9<T,,> = Box<T>; // error: expected ident, found `,`
--- /dev/null
+error: expected one of `>`, identifier, lifetime, or type, found `,`
+ --> $DIR/issue-20616-3.rs:25:24
+ |
+LL | type Type_3<T> = Box<T,,>; //~ error: expected one of `>`, identifier, lifetime, or type, found `,`
+ | ^ expected one of `>`, identifier, lifetime, or type here
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// We need all these 9 issue-20616-N.rs files
+// because we can only catch one parsing error at a time
+
+
+
+type Type_1_<'a, T> = &'a T;
+
+
+//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T`
+
+
+//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(`
+
+
+//type Type_3<T> = Box<T,,>; // error: expected type, found `,`
+
+
+type Type_4<T> = Type_1_<'static,, T>;
+//~^ error: expected one of `>`, identifier, lifetime, or type, found `,`
+
+
+type Type_5_<'a> = Type_1_<'a, ()>;
+
+
+//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,`
+
+
+//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,`
+
+
+//type Type_7 = Box<(),,>; // error: expected type, found `,`
+
+
+//type Type_8<'a,,> = &'a (); // error: expected ident, found `,`
+
+
+//type Type_9<T,,> = Box<T>; // error: expected ident, found `,`
--- /dev/null
+error: expected one of `>`, identifier, lifetime, or type, found `,`
+ --> $DIR/issue-20616-4.rs:28:34
+ |
+LL | type Type_4<T> = Type_1_<'static,, T>;
+ | ^ expected one of `>`, identifier, lifetime, or type here
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// We need all these 9 issue-20616-N.rs files
+// because we can only catch one parsing error at a time
+
+
+
+type Type_1_<'a, T> = &'a T;
+
+
+//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T`
+
+
+//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(`
+
+
+//type Type_3<T> = Box<T,,>; // error: expected type, found `,`
+
+
+//type Type_4<T> = Type_1_<'static,, T>; // error: expected type, found `,`
+
+
+type Type_5_<'a> = Type_1_<'a, ()>;
+
+
+type Type_5<'a> = Type_1_<'a, (),,>;
+//~^ error: expected one of `>`, identifier, lifetime, or type, found `,`
+
+
+//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,`
+
+
+//type Type_7 = Box<(),,>; // error: expected type, found `,`
+
+
+//type Type_8<'a,,> = &'a (); // error: expected ident, found `,`
+
+
+//type Type_9<T,,> = Box<T>; // error: expected ident, found `,`
--- /dev/null
+error: expected one of `>`, identifier, lifetime, or type, found `,`
+ --> $DIR/issue-20616-5.rs:34:34
+ |
+LL | type Type_5<'a> = Type_1_<'a, (),,>;
+ | ^ expected one of `>`, identifier, lifetime, or type here
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// We need all these 9 issue-20616-N.rs files
+// because we can only catch one parsing error at a time
+
+
+
+type Type_1_<'a, T> = &'a T;
+
+
+//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T`
+
+
+//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(`
+
+
+//type Type_3<T> = Box<T,,>; // error: expected type, found `,`
+
+
+//type Type_4<T> = Type_1_<'static,, T>; // error: expected type, found `,`
+
+
+type Type_5_<'a> = Type_1_<'a, ()>;
+
+
+//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,`
+
+
+type Type_6 = Type_5_<'a,,>;
+//~^ error: expected one of `>`, identifier, lifetime, or type, found `,`
+
+
+//type Type_7 = Box<(),,>; // error: expected type, found `,`
+
+
+//type Type_8<'a,,> = &'a (); // error: expected ident, found `,`
+
+
+//type Type_9<T,,> = Box<T>; // error: expected ident, found `,`
--- /dev/null
+error: expected one of `>`, identifier, lifetime, or type, found `,`
+ --> $DIR/issue-20616-6.rs:37:26
+ |
+LL | type Type_6 = Type_5_<'a,,>;
+ | ^ expected one of `>`, identifier, lifetime, or type here
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// We need all these 9 issue-20616-N.rs files
+// because we can only catch one parsing error at a time
+
+
+
+type Type_1_<'a, T> = &'a T;
+
+
+//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T`
+
+
+//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(`
+
+
+//type Type_3<T> = Box<T,,>; // error: expected type, found `,`
+
+
+//type Type_4<T> = Type_1_<'static,, T>; // error: expected type, found `,`
+
+
+type Type_5_<'a> = Type_1_<'a, ()>;
+
+
+//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,`
+
+
+//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,`
+
+
+type Type_7 = Box<(),,>; //~ error: expected one of `>`, identifier, lifetime, or type, found `,`
+
+
+//type Type_8<'a,,> = &'a (); // error: expected ident, found `,`
+
+
+//type Type_9<T,,> = Box<T>; // error: expected ident, found `,`
--- /dev/null
+error: expected one of `>`, identifier, lifetime, or type, found `,`
+ --> $DIR/issue-20616-7.rs:40:22
+ |
+LL | type Type_7 = Box<(),,>; //~ error: expected one of `>`, identifier, lifetime, or type, found `,`
+ | ^ expected one of `>`, identifier, lifetime, or type here
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// We need all these 9 issue-20616-N.rs files
+// because we can only catch one parsing error at a time
+
+
+
+type Type_1_<'a, T> = &'a T;
+
+
+//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T`
+
+
+//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(`
+
+
+//type Type_3<T> = Box<T,,>; // error: expected type, found `,`
+
+
+//type Type_4<T> = Type_1_<'static,, T>; // error: expected type, found `,`
+
+
+type Type_5_<'a> = Type_1_<'a, ()>;
+
+
+//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,`
+
+
+//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,`
+
+
+//type Type_7 = Box<(),,>; // error: expected type, found `,`
+
+
+type Type_8<'a,,> = &'a (); //~ error: expected one of `>`, identifier, or lifetime, found `,`
+
+
+//type Type_9<T,,> = Box<T>; // error: expected identifier, found `,`
--- /dev/null
+error: expected one of `>`, identifier, or lifetime, found `,`
+ --> $DIR/issue-20616-8.rs:43:16
+ |
+LL | type Type_8<'a,,> = &'a (); //~ error: expected one of `>`, identifier, or lifetime, found `,`
+ | ^ expected one of `>`, identifier, or lifetime here
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// We need all these 9 issue-20616-N.rs files
+// because we can only catch one parsing error at a time
+
+
+
+type Type_1_<'a, T> = &'a T;
+
+
+//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T`
+
+
+//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(`
+
+
+//type Type_3<T> = Box<T,,>; // error: expected type, found `,`
+
+
+//type Type_4<T> = Type_1_<'static,, T>; // error: expected type, found `,`
+
+
+type Type_5_<'a> = Type_1_<'a, ()>;
+
+
+//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,`
+
+
+//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,`
+
+
+//type Type_7 = Box<(),,>; // error: expected type, found `,`
+
+
+//type Type_8<'a,,> = &'a (); // error: expected identifier, found `,`
+
+
+type Type_9<T,,> = Box<T>; //~ error: expected one of `>`, identifier, or lifetime, found `,`
--- /dev/null
+error: expected one of `>`, identifier, or lifetime, found `,`
+ --> $DIR/issue-20616-9.rs:46:15
+ |
+LL | type Type_9<T,,> = Box<T>; //~ error: expected one of `>`, identifier, or lifetime, found `,`
+ | ^ expected one of `>`, identifier, or lifetime here
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct G;
+
+fn main() {
+ let g = G(); //~ ERROR: expected function, found `G`
+}
--- /dev/null
+error[E0618]: expected function, found `G`
+ --> $DIR/issue-20714.rs:14:13
+ |
+LL | struct G;
+ | --------- `G` defined here
+...
+LL | let g = G(); //~ ERROR: expected function, found `G`
+ | ^^^ not a function
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0618`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait T : Iterator<Item=Self::Item>
+//~^ ERROR cycle detected
+//~| ERROR associated type `Item` not found for `Self`
+{}
+
+fn main() {}
--- /dev/null
+error[E0391]: cycle detected when computing the supertraits of `T`
+ --> $DIR/issue-20772.rs:11:1
+ |
+LL | / trait T : Iterator<Item=Self::Item>
+LL | | //~^ ERROR cycle detected
+LL | | //~| ERROR associated type `Item` not found for `Self`
+LL | | {}
+ | |__^
+ |
+ = note: ...which again requires computing the supertraits of `T`, completing the cycle
+
+error[E0220]: associated type `Item` not found for `Self`
+ --> $DIR/issue-20772.rs:11:25
+ |
+LL | trait T : Iterator<Item=Self::Item>
+ | ^^^^^^^^^^ associated type `Item` not found
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0220, E0391.
+For more information about an error, try `rustc --explain E0220`.
--- /dev/null
+error: internal compiler error: Accessing `(*_8)` with the kind `Write(Move)` shouldn't be possible
+ --> $DIR/issue-20801.rs:45:22
+ |
+LL | let d = unsafe { *const_ptr() };
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// We used to ICE when moving out of a `*mut T` or `*const T`.
+
+struct T(u8);
+
+static mut GLOBAL_MUT_T: T = T(0);
+
+static GLOBAL_T: T = T(0);
+
+fn imm_ref() -> &'static T {
+ unsafe { &GLOBAL_T }
+}
+
+fn mut_ref() -> &'static mut T {
+ unsafe { &mut GLOBAL_MUT_T }
+}
+
+fn mut_ptr() -> *mut T {
+ unsafe { 0 as *mut T }
+}
+
+fn const_ptr() -> *const T {
+ unsafe { 0 as *const T }
+}
+
+pub fn main() {
+ let a = unsafe { *mut_ref() };
+ //~^ ERROR cannot move out of borrowed content
+
+ let b = unsafe { *imm_ref() };
+ //~^ ERROR cannot move out of borrowed content
+
+ let c = unsafe { *mut_ptr() };
+ //~^ ERROR cannot move out of dereference of raw pointer
+
+ let d = unsafe { *const_ptr() };
+ //~^ ERROR cannot move out of dereference of raw pointer
+}
--- /dev/null
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/issue-20801.rs:36:22
+ |
+LL | let a = unsafe { *mut_ref() };
+ | ^^^^^^^^^^ cannot move out of borrowed content
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/issue-20801.rs:39:22
+ |
+LL | let b = unsafe { *imm_ref() };
+ | ^^^^^^^^^^ cannot move out of borrowed content
+
+error[E0507]: cannot move out of dereference of raw pointer
+ --> $DIR/issue-20801.rs:42:22
+ |
+LL | let c = unsafe { *mut_ptr() };
+ | ^^^^^^^^^^ cannot move out of dereference of raw pointer
+
+error[E0507]: cannot move out of dereference of raw pointer
+ --> $DIR/issue-20801.rs:45:22
+ |
+LL | let d = unsafe { *const_ptr() };
+ | ^^^^^^^^^^^^ cannot move out of dereference of raw pointer
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0507`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub trait Subscriber {
+ type Input;
+}
+
+pub trait Processor: Subscriber<Input = Self::Input> {
+ //~^ ERROR cycle detected
+ type Input;
+}
+
+fn main() {}
--- /dev/null
+error[E0391]: cycle detected when computing the supertraits of `Processor`
+ --> $DIR/issue-20825.rs:15:1
+ |
+LL | pub trait Processor: Subscriber<Input = Self::Input> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: ...which again requires computing the supertraits of `Processor`, completing the cycle
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0391`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Regression test for #20831: debruijn index account was thrown off
+// by the (anonymous) lifetime in `<Self as Publisher>::Output`
+// below. Note that changing to a named lifetime made the problem go
+// away.
+
+use std::cell::RefCell;
+use std::ops::{Shl, Shr};
+
+pub trait Subscriber {
+ type Input;
+}
+
+pub trait Publisher<'a> {
+ type Output;
+ fn subscribe(&mut self, _: Box<Subscriber<Input=Self::Output> + 'a>);
+}
+
+pub trait Processor<'a> : Subscriber + Publisher<'a> { }
+
+impl<'a, P> Processor<'a> for P where P : Subscriber + Publisher<'a> { }
+
+struct MyStruct<'a> {
+ sub: Box<Subscriber<Input=u64> + 'a>
+}
+
+impl<'a> Publisher<'a> for MyStruct<'a> {
+ type Output = u64;
+ fn subscribe(&mut self, t : Box<Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
+ // Not obvious, but there is an implicit lifetime here -------^
+ //~^^ ERROR cannot infer
+ //
+ // The fact that `Publisher` is using an implicit lifetime is
+ // what was causing the debruijn accounting to be off, so
+ // leave it that way!
+ self.sub = t;
+ }
+}
+
+fn main() {}
--- /dev/null
+error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
+ --> $DIR/issue-20831-debruijn.rs:38:5
+ |
+LL | / fn subscribe(&mut self, t : Box<Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
+LL | | // Not obvious, but there is an implicit lifetime here -------^
+LL | | //~^^ ERROR cannot infer
+LL | | //
+... |
+LL | | self.sub = t;
+LL | | }
+ | |_____^
+ |
+note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the method body at 38:5...
+ --> $DIR/issue-20831-debruijn.rs:38:5
+ |
+LL | / fn subscribe(&mut self, t : Box<Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
+LL | | // Not obvious, but there is an implicit lifetime here -------^
+LL | | //~^^ ERROR cannot infer
+LL | | //
+... |
+LL | | self.sub = t;
+LL | | }
+ | |_____^
+note: ...but the lifetime must also be valid for the lifetime 'a as defined on the impl at 36:6...
+ --> $DIR/issue-20831-debruijn.rs:36:6
+ |
+LL | impl<'a> Publisher<'a> for MyStruct<'a> {
+ | ^^
+ = note: ...so that the types are compatible:
+ expected Publisher<'_>
+ found Publisher<'_>
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0495`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Foo {}
+
+impl<'a> Foo for Foo+'a {}
+//~^ ERROR the object type `(dyn Foo + 'a)` automatically implements the trait `Foo`
+
+fn main() {}
--- /dev/null
+error[E0371]: the object type `(dyn Foo + 'a)` automatically implements the trait `Foo`
+ --> $DIR/issue-20939.rs:13:1
+ |
+LL | impl<'a> Foo for Foo+'a {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Foo + 'a)` automatically implements trait `Foo`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0371`.
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn foo(a: Option<usize>, b: Option<usize>) {
+ match (a,b) {
+ //~^ ERROR: non-exhaustive patterns: `(None, None)` not covered
+ (Some(a), Some(b)) if a == b => { }
+ (Some(_), None) |
+ (None, Some(_)) => { }
+ }
+}
+
+fn main() {
+ foo(None, None);
+}
--- /dev/null
+error[E0004]: non-exhaustive patterns: `(None, None)` not covered
+ --> $DIR/issue-2111.rs:12:9
+ |
+LL | match (a,b) {
+ | ^^^^^ pattern `(None, None)` not covered
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0004`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Bar;
+
+impl Bar {
+ fn hash<T>(&self, _: T) {}
+}
+
+#[derive(Hash)]
+struct Foo(Bar);
+//~^ error: `Bar: std::hash::Hash` is not satisfied
+
+fn main() {}
--- /dev/null
+error[E0277]: the trait bound `Bar: std::hash::Hash` is not satisfied
+ --> $DIR/issue-21160.rs:18:12
+ |
+LL | struct Foo(Bar);
+ | ^^^ the trait `std::hash::Hash` is not implemented for `Bar`
+ |
+ = note: required by `std::hash::Hash::hash`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Trait<'a> {
+ type A;
+ type B;
+}
+
+fn foo<'a, T: Trait<'a>>(value: T::A) {
+ let new: T::B = unsafe { std::mem::transmute(value) };
+//~^ ERROR: transmute called with types of different sizes
+}
+
+fn main() { }
--- /dev/null
+error[E0512]: transmute called with types of different sizes
+ --> $DIR/issue-21174.rs:17:30
+ |
+LL | let new: T::B = unsafe { std::mem::transmute(value) };
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: source type: <T as Trait<'a>>::A (size can vary because of <T as Trait>::A)
+ = note: target type: <T as Trait<'a>>::B (size can vary because of <T as Trait>::B)
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0512`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Trait {
+ type A;
+ type B;
+}
+
+fn foo<T: Trait<A = T::B>>() { }
+//~^ ERROR cycle detected
+//~| ERROR associated type `B` not found for `T`
+
+fn main() { }
--- /dev/null
+error[E0391]: cycle detected when computing the bounds for type parameter `T`
+ --> $DIR/issue-21177.rs:16:21
+ |
+LL | fn foo<T: Trait<A = T::B>>() { }
+ | ^^^^
+ |
+ = note: ...which again requires computing the bounds for type parameter `T`, completing the cycle
+note: cycle used when processing `foo`
+ --> $DIR/issue-21177.rs:16:21
+ |
+LL | fn foo<T: Trait<A = T::B>>() { }
+ | ^^^^
+
+error[E0220]: associated type `B` not found for `T`
+ --> $DIR/issue-21177.rs:16:21
+ |
+LL | fn foo<T: Trait<A = T::B>>() { }
+ | ^^^^ associated type `B` not found
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0220, E0391.
+For more information about an error, try `rustc --explain E0220`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct S;
+
+impl Iterator for S {
+ type Item = i32;
+ fn next(&mut self) -> Result<i32, i32> { Ok(7) }
+ //~^ ERROR method `next` has an incompatible type for trait
+ //~| expected enum `std::option::Option`, found enum `std::result::Result`
+}
+
+fn main() {}
--- /dev/null
+error[E0053]: method `next` has an incompatible type for trait
+ --> $DIR/issue-21332.rs:15:5
+ |
+LL | fn next(&mut self) -> Result<i32, i32> { Ok(7) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `std::option::Option`, found enum `std::result::Result`
+ |
+ = note: expected type `fn(&mut S) -> std::option::Option<i32>`
+ found type `fn(&mut S) -> std::result::Result<i32, i32>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0053`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![allow(unused_macros)]
+
+macro_rules! test { ($wrong:t_ty ..) => () }
+ //~^ ERROR: invalid fragment specifier `t_ty`
+
+fn main() {}
--- /dev/null
+error: invalid fragment specifier `t_ty`
+ --> $DIR/issue-21356.rs:13:22
+ |
+LL | macro_rules! test { ($wrong:t_ty ..) => () }
+ | ^^^^^^^^^^^
+ |
+ = help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `literal`, `path`, `meta`, `tt`, `item` and `vis`
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+mod MyMod {}
+
+fn main() {
+ let myVar = MyMod { T: 0 };
+ //~^ ERROR expected struct, variant or union type, found module `MyMod`
+}
--- /dev/null
+error[E0574]: expected struct, variant or union type, found module `MyMod`
+ --> $DIR/issue-21449.rs:14:17
+ |
+LL | let myVar = MyMod { T: 0 };
+ | ^^^^^ not a struct, variant or union type
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0574`.
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait vec_monad<A> {
+ fn bind<B, F>(&self, f: F) where F: FnMut(A) -> Vec<B>;
+}
+
+impl<A> vec_monad<A> for Vec<A> {
+ fn bind<B, F>(&self, mut f: F) where F: FnMut(A) -> Vec<B> {
+ let mut r = panic!();
+ for elt in self { r = r + f(*elt); }
+ //~^ ERROR E0277
+ }
+}
+fn main() {
+ ["hi"].bind(|x| [x] );
+ //~^ ERROR no method named `bind` found for type `[&str; 1]` in the current scope
+}
--- /dev/null
+error[E0277]: cannot add `std::vec::Vec<B>` to `()`
+ --> $DIR/issue-2149.rs:18:33
+ |
+LL | for elt in self { r = r + f(*elt); }
+ | ^ no implementation for `() + std::vec::Vec<B>`
+ |
+ = help: the trait `std::ops::Add<std::vec::Vec<B>>` is not implemented for `()`
+
+error[E0599]: no method named `bind` found for type `[&str; 1]` in the current scope
+ --> $DIR/issue-2149.rs:23:12
+ |
+LL | ["hi"].bind(|x| [x] );
+ | ^^^^
+ |
+ = help: items from traits can only be used if the trait is implemented and in scope
+ = note: the following trait defines an item `bind`, perhaps you need to implement it:
+ candidate #1: `vec_monad`
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0277, E0599.
+For more information about an error, try `rustc --explain E0277`.
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![deny(unreachable_code)]
+#![allow(unused_variables)]
+#![allow(dead_code)]
+
+fn fail_len(v: Vec<isize> ) -> usize {
+ let mut i = 3;
+ panic!();
+ for x in &v { i += 1; }
+ //~^ ERROR: unreachable statement
+ return i;
+}
+fn main() {}
--- /dev/null
+error: unreachable statement
+ --> $DIR/issue-2150.rs:18:5
+ |
+LL | for x in &v { i += 1; }
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/issue-2150.rs:11:9
+ |
+LL | #![deny(unreachable_code)]
+ | ^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ let x = panic!();
+ x.clone(); //~ ERROR type annotations needed
+}
--- /dev/null
+error[E0282]: type annotations needed
+ --> $DIR/issue-2151.rs:13:5
+ |
+LL | let x = panic!();
+ | - consider giving `x` a type
+LL | x.clone(); //~ ERROR type annotations needed
+ | ^ cannot infer type for `_`
+ |
+ = note: type must be known at this point
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0282`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Inches(i32);
+
+fn main() {
+ Inches as f32;
+ //~^ ERROR casting
+}
--- /dev/null
+error[E0606]: casting `fn(i32) -> Inches {Inches::{{constructor}}}` as `f32` is invalid
+ --> $DIR/issue-21554.rs:14:5
+ |
+LL | Inches as f32;
+ | ^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0606`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn foo<U>(t: U) {
+ let y = t();
+//~^ ERROR: expected function, found `U`
+}
+
+struct Bar;
+
+pub fn some_func() {
+ let f = Bar();
+//~^ ERROR: expected function, found `Bar`
+}
+
+fn main() {
+ foo(|| { 1 });
+}
--- /dev/null
+error[E0618]: expected function, found `U`
+ --> $DIR/issue-21701.rs:12:13
+ |
+LL | fn foo<U>(t: U) {
+ | - `U` defined here
+LL | let y = t();
+ | ^^^ not a function
+
+error[E0618]: expected function, found `Bar`
+ --> $DIR/issue-21701.rs:19:13
+ |
+LL | struct Bar;
+ | ----------- `Bar` defined here
+...
+LL | let f = Bar();
+ | ^^^^^ not a function
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0618`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Regression test for HashMap only impl'ing Send/Sync if its contents do
+
+use std::collections::HashMap;
+use std::rc::Rc;
+
+fn foo<T: Send>() {}
+
+fn main() {
+ foo::<HashMap<Rc<()>, Rc<()>>>();
+ //~^ ERROR `std::rc::Rc<()>` cannot be sent between threads safely
+}
--- /dev/null
+error[E0277]: `std::rc::Rc<()>` cannot be sent between threads safely
+ --> $DIR/issue-21763.rs:19:5
+ |
+LL | foo::<HashMap<Rc<()>, Rc<()>>>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::rc::Rc<()>` cannot be sent between threads safely
+ |
+ = help: within `std::collections::HashMap<std::rc::Rc<()>, std::rc::Rc<()>>`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<()>`
+ = note: required because it appears within the type `(std::rc::Rc<()>, std::rc::Rc<()>)`
+ = note: required because it appears within the type `std::marker::PhantomData<(std::rc::Rc<()>, std::rc::Rc<()>)>`
+ = note: required because it appears within the type `std::collections::hash::table::RawTable<std::rc::Rc<()>, std::rc::Rc<()>>`
+ = note: required because it appears within the type `std::collections::HashMap<std::rc::Rc<()>, std::rc::Rc<()>>`
+note: required by `foo`
+ --> $DIR/issue-21763.rs:16:1
+ |
+LL | fn foo<T: Send>() {}
+ | ^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub trait Bound {}
+pub struct Foo<T: Bound>(T);
+
+pub trait Trait1 {}
+impl<T: Bound> Trait1 for Foo<T> {}
+
+pub trait Trait2 {}
+impl<T> Trait2 for Foo<T> {} //~ ERROR the trait bound `T: Bound` is not satisfied
+
+fn main() {}
--- /dev/null
+error[E0277]: the trait bound `T: Bound` is not satisfied
+ --> $DIR/issue-21837.rs:18:9
+ |
+LL | impl<T> Trait2 for Foo<T> {} //~ ERROR the trait bound `T: Bound` is not satisfied
+ | ^^^^^^ the trait `Bound` is not implemented for `T`
+ |
+ = help: consider adding a `where T: Bound` bound
+note: required by `Foo`
+ --> $DIR/issue-21837.rs:12:1
+ |
+LL | pub struct Foo<T: Bound>(T);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Foo {
+ type A;
+}
+
+struct FooStruct;
+
+impl Foo for FooStruct {
+//~^ ERROR overflow evaluating the requirement `<FooStruct as Foo>::A`
+ type A = <FooStruct as Foo>::A;
+}
+
+fn main() {}
--- /dev/null
+error[E0275]: overflow evaluating the requirement `<FooStruct as Foo>::A`
+ --> $DIR/issue-21946.rs:17:6
+ |
+LL | impl Foo for FooStruct {
+ | ^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0275`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Test that (for now) we report an ambiguity error here, because
+// specific trait relationships are ignored for the purposes of trait
+// matching. This behavior should likely be improved such that this
+// test passes. See #21974 for more details.
+
+trait Foo {
+ fn foo(self);
+}
+
+fn foo<'a,'b,T>(x: &'a T, y: &'b T) //~ ERROR type annotations required
+ where &'a T : Foo,
+ &'b T : Foo
+{
+ x.foo();
+ y.foo();
+}
+
+fn main() { }
--- /dev/null
+error[E0283]: type annotations required: cannot resolve `&'a T: Foo`
+ --> $DIR/issue-21974.rs:20:1
+ |
+LL | / fn foo<'a,'b,T>(x: &'a T, y: &'b T) //~ ERROR type annotations required
+LL | | where &'a T : Foo,
+LL | | &'b T : Foo
+LL | | {
+LL | | x.foo();
+LL | | y.foo();
+LL | | }
+ | |_^
+ |
+note: required by `Foo`
+ --> $DIR/issue-21974.rs:16:1
+ |
+LL | trait Foo {
+ | ^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0283`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(libc)]
+
+extern crate libc;
+
+fn main() {
+ let ptr: *mut () = 0 as *mut _;
+ let _: &mut Fn() = unsafe {
+ &mut *(ptr as *mut Fn())
+ //~^ ERROR `(): std::ops::Fn<()>` is not satisfied
+ };
+}
--- /dev/null
+error[E0277]: the trait bound `(): std::ops::Fn<()>` is not satisfied
+ --> $DIR/issue-22034.rs:18:16
+ |
+LL | &mut *(ptr as *mut Fn())
+ | ^^^ the trait `std::ops::Fn<()>` is not implemented for `()`
+ |
+ = note: required for the cast to the object type `dyn std::ops::Fn()`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait A {
+ type Output;
+ fn a(&self) -> <Self as A>::X;
+ //~^ ERROR cannot find associated type `X` in trait `A`
+}
+
+impl A for u32 {
+ type Output = u32;
+ fn a(&self) -> u32 {
+ 0
+ }
+}
+
+fn main() {
+ let a: u32 = 0;
+ let b: u32 = a.a();
+}
--- /dev/null
+error[E0576]: cannot find associated type `X` in trait `A`
+ --> $DIR/issue-22037.rs:13:33
+ |
+LL | fn a(&self) -> <Self as A>::X;
+ | ^ not found in `A`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0576`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ 0 as &std::any::Any; //~ ERROR non-primitive cast
+}
--- /dev/null
+error[E0605]: non-primitive cast: `i32` as `&(dyn std::any::Any + 'static)`
+ --> $DIR/issue-22289.rs:12:5
+ |
+LL | 0 as &std::any::Any; //~ ERROR non-primitive cast
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0605`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::ops::Index;
+
+pub trait Array2D: Index<usize> {
+ fn rows(&self) -> usize;
+ fn columns(&self) -> usize;
+ fn get<'a>(&'a self, y: usize, x: usize) -> Option<&'a <Self as Index<usize>>::Output> {
+ if y >= self.rows() || x >= self.columns() {
+ return None;
+ }
+ let i = y * self.columns() + x;
+ let indexer = &(*self as &Index<usize, Output = <Self as Index<usize>>::Output>);
+ //~^ERROR non-primitive cast
+ Some(indexer.index(i))
+ }
+}
+
+fn main() {}
--- /dev/null
+error[E0605]: non-primitive cast: `Self` as `&dyn std::ops::Index<usize, Output=<Self as std::ops::Index<usize>>::Output>`
+ --> $DIR/issue-22312.rs:21:24
+ |
+LL | let indexer = &(*self as &Index<usize, Output = <Self as Index<usize>>::Output>);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0605`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Trait {
+ fn foo();
+}
+
+fn main() {
+ <<i32 as Copy>::foobar as Trait>::foo();
+ //~^ ERROR cannot find associated type `foobar` in trait `Copy`
+}
--- /dev/null
+error[E0576]: cannot find associated type `foobar` in trait `Copy`
+ --> $DIR/issue-22384.rs:16:21
+ |
+LL | <<i32 as Copy>::foobar as Trait>::foo();
+ | ^^^^^^ not found in `Copy`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0576`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub trait Foo {
+ type A;
+}
+
+type I<'a> = &'a (Foo + 'a);
+//~^ ERROR the value of the associated type `A` (from the trait `Foo`) must be specified
+
+fn main() {}
--- /dev/null
+error[E0191]: the value of the associated type `A` (from the trait `Foo`) must be specified
+ --> $DIR/issue-22434.rs:15:19
+ |
+LL | type I<'a> = &'a (Foo + 'a);
+ | ^^^^^^^^ missing associated type `A` value
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0191`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ let foo = "bar";
+ let x = foo("baz");
+ //~^ ERROR: expected function, found `&str`
+}
+
+fn foo(file: &str) -> bool {
+ true
+}
--- /dev/null
+error[E0618]: expected function, found `&str`
+ --> $DIR/issue-22468.rs:13:13
+ |
+LL | let foo = "bar";
+ | --- `&str` defined here
+LL | let x = foo("baz");
+ | ^^^^^^^^^^ not a function
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0618`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![deny(unused_variables)]
+
+fn f(_: i32) {}
+
+fn main() {
+ let mut v = 0;
+ f(v);
+ v = match 0 { a => 0 }; //~ ERROR: unused variable: `a`
+ f(v);
+}
--- /dev/null
+error: unused variable: `a`
+ --> $DIR/issue-22599.rs:18:19
+ |
+LL | v = match 0 { a => 0 }; //~ ERROR: unused variable: `a`
+ | ^ help: consider using `_a` instead
+ |
+note: lint level defined here
+ --> $DIR/issue-22599.rs:11:9
+ |
+LL | #![deny(unused_variables)]
+ | ^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// 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.
+
+#![feature(unboxed_closures, fn_traits, rustc_attrs)]
+
+struct Foo;
+
+impl<A> FnOnce<(A,)> for Foo {
+ type Output = ();
+ extern "rust-call" fn call_once(self, (_,): (A,)) {
+ }
+}
+#[rustc_error]
+fn main() { //~ ERROR compilation successful
+ println!("{:?}", Foo("bar"));
+}
--- /dev/null
+error: compilation successful
+ --> $DIR/issue-22603.rs:21:1
+ |
+LL | / fn main() { //~ ERROR compilation successful
+LL | | println!("{:?}", Foo("bar"));
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Expr : PartialEq<Self::Item> {
+ //~^ ERROR: cycle detected
+ type Item;
+}
+
+fn main() {}
--- /dev/null
+error[E0391]: cycle detected when computing the supertraits of `Expr`
+ --> $DIR/issue-22673.rs:11:1
+ |
+LL | trait Expr : PartialEq<Self::Item> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: ...which again requires computing the supertraits of `Expr`, completing the cycle
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0391`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+mod foo {
+ pub struct Foo;
+ impl Foo {
+ fn bar(&self) {}
+ }
+
+ pub trait Baz {
+ fn bar(&self) -> bool { true }
+ }
+ impl Baz for Foo {}
+}
+
+fn main() {
+ use foo::Baz;
+
+ // Check that `bar` resolves to the trait method, not the inherent impl method.
+ let _: () = foo::Foo.bar(); //~ ERROR mismatched types
+}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-22684.rs:27:17
+ |
+LL | let _: () = foo::Foo.bar(); //~ ERROR mismatched types
+ | ^^^^^^^^^^^^^^ expected (), found bool
+ |
+ = note: expected type `()`
+ found type `bool`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// 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 is_copy<T: ::std::marker<i32>::Copy>() {}
+//~^ ERROR type parameters are not allowed on this type [E0109]
+fn main() {}
--- /dev/null
+error[E0109]: type parameters are not allowed on this type
+ --> $DIR/issue-22706.rs:11:29
+ |
+LL | fn is_copy<T: ::std::marker<i32>::Copy>() {}
+ | ^^^ type parameter not allowed
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0109`.
--- /dev/null
+// 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.
+
+#![feature(unboxed_closures, fn_traits, rustc_attrs)]
+
+#[rustc_error]
+fn main() { //~ ERROR compilation successful
+ let k = |x: i32| { x + 1 };
+ Fn::call(&k, (0,));
+}
--- /dev/null
+error: compilation successful
+ --> $DIR/issue-22789.rs:14:1
+ |
+LL | / fn main() { //~ ERROR compilation successful
+LL | | let k = |x: i32| { x + 1 };
+LL | | Fn::call(&k, (0,));
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() { println!("{}", foobar); } //~ ERROR cannot find value `foobar` in this scope
--- /dev/null
+error[E0425]: cannot find value `foobar` in this scope
+ --> $DIR/issue-2281-part1.rs:11:28
+ |
+LL | fn main() { println!("{}", foobar); } //~ ERROR cannot find value `foobar` in this scope
+ | ^^^^^^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0425`.
--- /dev/null
+// 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.
+
+struct Table {
+ rows: [[String]],
+ //~^ ERROR the size for values of type
+}
+
+fn f(table: &Table) -> &[String] {
+ &table.rows[0]
+}
+
+fn main() {}
--- /dev/null
+error[E0277]: the size for values of type `[std::string::String]` cannot be known at compilation time
+ --> $DIR/issue-22874.rs:12:5
+ |
+LL | rows: [[String]],
+ | ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `[std::string::String]`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
+ = note: slice and array elements must have `Sized` type
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(rustc_attrs)]
+#![allow(warnings)]
+
+struct CNFParser {
+ token: char,
+}
+
+impl CNFParser {
+ fn is_whitespace(c: char) -> bool {
+ c == ' ' || c == '\n'
+ }
+
+ fn consume_whitespace(&mut self) {
+ self.consume_while(&(CNFParser::is_whitespace))
+ }
+
+ fn consume_while(&mut self, p: &Fn(char) -> bool) {
+ while p(self.token) {
+ return
+ }
+ }
+}
+
+#[rustc_error]
+fn main() {} //~ ERROR compilation successful
--- /dev/null
+error: compilation successful
+ --> $DIR/issue-22933-1.rs:35:1
+ |
+LL | fn main() {} //~ ERROR compilation successful
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+const FOO: [u32; u8::MIN as usize] = [];
+//~^ ERROR no associated item named `MIN` found for type `u8`
+
+fn main() {}
--- /dev/null
+error[E0599]: no associated item named `MIN` found for type `u8` in the current scope
+ --> $DIR/issue-22933-3.rs:11:18
+ |
+LL | const FOO: [u32; u8::MIN as usize] = [];
+ | ^^^^^^^ associated item not found in `u8`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(box_syntax)]
+use std::any::Any;
+
+fn main()
+{
+ fn h(x:i32) -> i32 {3*x}
+ let mut vfnfer:Vec<Box<Any>> = vec![];
+ vfnfer.push(box h);
+ println!("{:?}",(vfnfer[0] as Fn)(3));
+ //~^ ERROR the precise format of `Fn`-family traits'
+ //~| ERROR wrong number of type arguments: expected 1, found 0 [E0243]
+ //~| ERROR the value of the associated type `Output` (from the trait `std::ops::FnOnce`)
+}
--- /dev/null
+error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change. Use parenthetical notation (Fn(Foo, Bar) -> Baz) instead (see issue #29625)
+ --> $DIR/issue-23024.rs:19:35
+ |
+LL | println!("{:?}",(vfnfer[0] as Fn)(3));
+ | ^^
+ |
+ = help: add #![feature(unboxed_closures)] to the crate attributes to enable
+
+error[E0243]: wrong number of type arguments: expected 1, found 0
+ --> $DIR/issue-23024.rs:19:35
+ |
+LL | println!("{:?}",(vfnfer[0] as Fn)(3));
+ | ^^ expected 1 type argument
+
+error[E0191]: the value of the associated type `Output` (from the trait `std::ops::FnOnce`) must be specified
+ --> $DIR/issue-23024.rs:19:35
+ |
+LL | println!("{:?}",(vfnfer[0] as Fn)(3));
+ | ^^ missing associated type `Output` value
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0191, E0243, E0658.
+For more information about an error, try `rustc --explain E0191`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub enum Expr<'var, VAR> {
+ Let(Box<Expr<'var, VAR>>,
+ Box<for<'v> Fn(Expr<'v, VAR>) -> Expr<'v, VAR> + 'var>)
+}
+
+pub fn add<'var, VAR>
+ (a: Expr<'var, VAR>, b: Expr<'var, VAR>) -> Expr<'var, VAR> {
+ loop {}
+}
+
+pub fn let_<'var, VAR, F: for<'v> Fn(Expr<'v, VAR>) -> Expr<'v, VAR>>
+ (a: Expr<'var, VAR>, b: F) -> Expr<'var, VAR> {
+ loop {}
+}
+
+fn main() {
+ let ex = |x| { //~ ERROR type annotations needed
+ let_(add(x,x), |y| {
+ let_(add(x, x), |x|x)})};
+}
--- /dev/null
+error[E0282]: type annotations needed
+ --> $DIR/issue-23046.rs:27:15
+ |
+LL | let ex = |x| { //~ ERROR type annotations needed
+ | ^ consider giving this closure parameter a type
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0282`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(associated_type_defaults)]
+
+trait Foo { type T; }
+trait Bar {
+ type Foo: Foo;
+ type FooT = <<Self as Bar>::Foo>::T; //~ ERROR ambiguous associated type
+}
+
+fn main() {}
--- /dev/null
+error[E0223]: ambiguous associated type
+ --> $DIR/issue-23073.rs:16:17
+ |
+LL | type FooT = <<Self as Bar>::Foo>::T; //~ ERROR ambiguous associated type
+ | ^^^^^^^^^^^^^^^^^^^^^^^ ambiguous associated type
+ |
+ = note: specify the type using the syntax `<<Self as Bar>::Foo as Trait>::T`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0223`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-tidy-linelength
+
+//~^^^^^^^^^^^^ ERROR
+
+#![feature(optin_builtin_traits)]
+
+unsafe auto trait Trait {
+//~^ ERROR E0380
+ type Output;
+}
+
+fn call_method<T: Trait>(x: T) {}
+
+fn main() {
+ // ICE
+ call_method(());
+}
--- /dev/null
+error[E0380]: auto traits cannot have methods or associated items
+ --> $DIR/issue-23080-2.rs:17:1
+ |
+LL | / unsafe auto trait Trait {
+LL | | //~^ ERROR E0380
+LL | | type Output;
+LL | | }
+ | |_^
+
+error[E0275]: overflow evaluating the requirement `<() as Trait>::Output`
+ |
+ = note: required because of the requirements on the impl of `Trait` for `()`
+ = note: required because of the requirements on the impl of `Trait` for `()`
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0275, E0380.
+For more information about an error, try `rustc --explain E0275`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-tidy-linelength
+
+#![feature(optin_builtin_traits)]
+
+unsafe auto trait Trait {
+//~^ ERROR E0380
+ fn method(&self) {
+ println!("Hello");
+ }
+}
+
+fn call_method<T: Trait>(x: T) {
+ x.method();
+}
+
+fn main() {
+ // ICE
+ call_method(());
+}
--- /dev/null
+error[E0380]: auto traits cannot have methods or associated items
+ --> $DIR/issue-23080.rs:15:1
+ |
+LL | / unsafe auto trait Trait {
+LL | | //~^ ERROR E0380
+LL | | fn method(&self) {
+LL | | println!("Hello");
+LL | | }
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0380`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Next {
+ type Next: Next;
+}
+
+struct GetNext<T: Next> { t: T }
+
+impl<T: Next> Next for GetNext<T> {
+ //~^ ERROR overflow evaluating the requirement
+ type Next = <GetNext<T> as Next>::Next;
+}
+
+fn main() {}
--- /dev/null
+error[E0275]: overflow evaluating the requirement `<GetNext<T> as Next>::Next`
+ --> $DIR/issue-23122-1.rs:17:15
+ |
+LL | impl<T: Next> Next for GetNext<T> {
+ | ^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0275`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Next {
+ type Next: Next;
+}
+
+struct GetNext<T: Next> { t: T }
+
+impl<T: Next> Next for GetNext<T> {
+ //~^ ERROR overflow evaluating the requirement
+ type Next = <GetNext<T::Next> as Next>::Next;
+}
+
+fn main() {}
--- /dev/null
+error[E0275]: overflow evaluating the requirement `<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<T as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next`
+ --> $DIR/issue-23122-2.rs:17:15
+ |
+LL | impl<T: Next> Next for GetNext<T> {
+ | ^^^^
+ |
+ = help: consider adding a `#![recursion_limit="128"]` attribute to your crate
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0275`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+enum Foo { Bar }
+
+fn main() {
+ Foo::Bar.a;
+ //~^ no field `a` on type `Foo`
+}
--- /dev/null
+error[E0609]: no field `a` on type `Foo`
+ --> $DIR/issue-23253.rs:14:14
+ |
+LL | Foo::Bar.a;
+ | ^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0609`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-tidy-linelength
+
+pub struct Struct;
+
+impl Struct {
+ pub fn function(funs: Vec<Fn() -> ()>) {}
+ //~^ ERROR the size for values of type
+}
+
+fn main() {}
--- /dev/null
+error[E0277]: the size for values of type `(dyn std::ops::Fn() + 'static)` cannot be known at compilation time
+ --> $DIR/issue-23281.rs:16:5
+ |
+LL | pub fn function(funs: Vec<Fn() -> ()>) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `(dyn std::ops::Fn() + 'static)`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
+ = note: required by `std::vec::Vec`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+enum chan { }
+
+trait channel<T> {
+ fn send(&self, v: T);
+}
+
+// `chan` is not a trait, it's an enum
+impl chan for isize { //~ ERROR expected trait, found enum `chan`
+ fn send(&self, v: isize) { panic!() }
+}
+
+fn main() {
+}
--- /dev/null
+error[E0404]: expected trait, found enum `chan`
+ --> $DIR/issue-2330.rs:18:6
+ |
+LL | impl chan for isize { //~ ERROR expected trait, found enum `chan`
+ | ^^^^ not a trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0404`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ let v: Vec(&str) = vec!['1', '2'];
+ //~^ ERROR parenthesized parameters may only be used with a trait
+}
--- /dev/null
+error[E0214]: parenthesized parameters may only be used with a trait
+ --> $DIR/issue-23589.rs:12:15
+ |
+LL | let v: Vec(&str) = vec!['1', '2'];
+ | ^^^^^^ only traits may use parentheses
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0214`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(associated_type_defaults)]
+
+use std::ops::{Index};
+
+trait Hierarchy {
+ type Value;
+ type ChildKey;
+ type Children = Index<Self::ChildKey, Output=Hierarchy>;
+ //~^ ERROR: the value of the associated type `ChildKey`
+ //~^^ ERROR: the value of the associated type `Children`
+ //~^^^ ERROR: the value of the associated type `Value`
+
+ fn data(&self) -> Option<(Self::Value, Self::Children)>;
+}
+
+fn main() {}
--- /dev/null
+error[E0191]: the value of the associated type `ChildKey` (from the trait `Hierarchy`) must be specified
+ --> $DIR/issue-23595-1.rs:18:50
+ |
+LL | type Children = Index<Self::ChildKey, Output=Hierarchy>;
+ | ^^^^^^^^^ missing associated type `ChildKey` value
+
+error[E0191]: the value of the associated type `Children` (from the trait `Hierarchy`) must be specified
+ --> $DIR/issue-23595-1.rs:18:50
+ |
+LL | type Children = Index<Self::ChildKey, Output=Hierarchy>;
+ | ^^^^^^^^^ missing associated type `Children` value
+
+error[E0191]: the value of the associated type `Value` (from the trait `Hierarchy`) must be specified
+ --> $DIR/issue-23595-1.rs:18:50
+ |
+LL | type Children = Index<Self::ChildKey, Output=Hierarchy>;
+ | ^^^^^^^^^ missing associated type `Value` value
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0191`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(associated_type_defaults)]
+
+pub struct C<AType: A> {a:AType}
+
+pub trait A {
+ type B = C<Self::anything_here_kills_it>;
+ //~^ ERROR: associated type `anything_here_kills_it` not found for `Self`
+}
+
+fn main() {}
--- /dev/null
+error[E0220]: associated type `anything_here_kills_it` not found for `Self`
+ --> $DIR/issue-23595-2.rs:16:16
+ |
+LL | type B = C<Self::anything_here_kills_it>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ associated type `anything_here_kills_it` not found
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0220`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ "".chars().fold(|_, _| (), ());
+ //~^ ERROR E0277
+}
--- /dev/null
+error[E0277]: the trait bound `(): std::ops::FnMut<(_, char)>` is not satisfied
+ --> $DIR/issue-23966.rs:12:16
+ |
+LL | "".chars().fold(|_, _| (), ());
+ | ^^^^ the trait `std::ops::FnMut<(_, char)>` is not implemented for `()`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ use std::mem::{transmute, swap};
+ let a = 1;
+ let b = 2;
+ unsafe {swap::<&mut _>(transmute(&a), transmute(&b))};
+ //~^ ERROR type annotations needed
+}
--- /dev/null
+error[E0282]: type annotations needed
+ --> $DIR/issue-24013.rs:15:20
+ |
+LL | unsafe {swap::<&mut _>(transmute(&a), transmute(&b))};
+ | ^^^^^^ cannot infer type for `_`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0282`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![allow(dead_code)]
+
+trait MultiDispatch<T> {
+ type O;
+}
+
+trait Trait: Sized {
+ type A: MultiDispatch<Self::B, O = Self>;
+ type B;
+
+ fn new<U>(u: U) -> <Self::A as MultiDispatch<U>>::O where Self::A : MultiDispatch<U>;
+}
+
+fn test<T: Trait<B=i32>>(b: i32) -> T where T::A: MultiDispatch<i32> { T::new(b) }
+//~^ ERROR type mismatch resolving
+
+fn main() {}
--- /dev/null
+error[E0271]: type mismatch resolving `<<T as Trait>::A as MultiDispatch<i32>>::O == T`
+ --> $DIR/issue-24204.rs:24:1
+ |
+LL | fn test<T: Trait<B=i32>>(b: i32) -> T where T::A: MultiDispatch<i32> { T::new(b) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected associated type, found type parameter
+ |
+ = note: expected type `<<T as Trait>::A as MultiDispatch<i32>>::O`
+ found type `T`
+note: required by `Trait`
+ --> $DIR/issue-24204.rs:17:1
+ |
+LL | trait Trait: Sized {
+ | ^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0271`.
--- /dev/null
+error[E0381]: borrow of possibly uninitialized variable: `x`
+ --> $DIR/issue-24267-flow-exit.rs:22:20
+ |
+LL | println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x`
+ | ^ use of possibly uninitialized `x`
+
+error[E0381]: borrow of possibly uninitialized variable: `x`
+ --> $DIR/issue-24267-flow-exit.rs:28:20
+ |
+LL | println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x`
+ | ^ use of possibly uninitialized `x`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0381`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Ensure that we reject code when a nonlocal exit (`break`,
+// `continue`) causes us to pop over a needed assignment.
+
+pub fn main() {
+ foo1();
+ foo2();
+}
+
+pub fn foo1() {
+ let x: i32;
+ loop { x = break; }
+ println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x`
+}
+
+pub fn foo2() {
+ let x: i32;
+ for _ in 0..10 { x = continue; }
+ println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x`
+}
--- /dev/null
+error[E0381]: use of possibly uninitialized variable: `x`
+ --> $DIR/issue-24267-flow-exit.rs:22:20
+ |
+LL | println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x`
+ | ^ use of possibly uninitialized `x`
+
+error[E0381]: use of possibly uninitialized variable: `x`
+ --> $DIR/issue-24267-flow-exit.rs:28:20
+ |
+LL | println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x`
+ | ^ use of possibly uninitialized `x`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0381`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct B;
+
+impl B {
+ fn func(&self) -> u32 { 42 }
+}
+
+fn main() {
+ let x: &fn(&B) -> u32 = &B::func; //~ ERROR mismatched types
+}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-24322.rs:18:29
+ |
+LL | let x: &fn(&B) -> u32 = &B::func; //~ ERROR mismatched types
+ | ^^^^^^^^ expected fn pointer, found fn item
+ |
+ = note: expected type `&for<'r> fn(&'r B) -> u32`
+ found type `&for<'r> fn(&'r B) -> u32 {B::func}`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ 1.0f64 - 1.0;
+ 1.0f64 - 1 //~ ERROR E0277
+}
--- /dev/null
+error[E0277]: cannot subtract `{integer}` from `f64`
+ --> $DIR/issue-24352.rs:13:12
+ |
+LL | 1.0f64 - 1 //~ ERROR E0277
+ | ^ no implementation for `f64 - {integer}`
+ |
+ = help: the trait `std::ops::Sub<{integer}>` is not implemented for `f64`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
--- /dev/null
+error[E0382]: use of moved value: `x`
+ --> $DIR/issue-24357.rs:16:12
+ |
+LL | let f = move || { let y = x; };
+ | ---------------------- value moved here
+LL | //~^ NOTE value moved (into closure) here
+LL | let z = x;
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `NoCopy`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct NoCopy;
+fn main() {
+ let x = NoCopy;
+ let f = move || { let y = x; };
+ //~^ NOTE value moved (into closure) here
+ let z = x;
+ //~^ ERROR use of moved value: `x`
+ //~| NOTE value used here after move
+ //~| NOTE move occurs because `x` has type `NoCopy`
+}
--- /dev/null
+error[E0382]: use of moved value: `x`
+ --> $DIR/issue-24357.rs:16:8
+ |
+LL | let f = move || { let y = x; };
+ | ------- value moved (into closure) here
+LL | //~^ NOTE value moved (into closure) here
+LL | let z = x;
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `NoCopy`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ 1.create_a_type_error[ //~ `{integer}` is a primitive type and therefore doesn't have fields
+ ()+() //~ ERROR binary operation `+` cannot be applied
+ // ^ ensure that we typeck the inner expression ^
+ ];
+}
--- /dev/null
+error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
+ --> $DIR/issue-24363.rs:12:7
+ |
+LL | 1.create_a_type_error[ //~ `{integer}` is a primitive type and therefore doesn't have fields
+ | ^^^^^^^^^^^^^^^^^^^
+
+error[E0369]: binary operation `+` cannot be applied to type `()`
+ --> $DIR/issue-24363.rs:13:9
+ |
+LL | ()+() //~ ERROR binary operation `+` cannot be applied
+ | ^^^^^
+ |
+ = note: an implementation of `std::ops::Add` might be missing for `()`
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0369, E0610.
+For more information about an error, try `rustc --explain E0369`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub enum Attribute {
+ Code {attr_name_idx: u16},
+}
+
+pub enum Foo {
+ Bar
+}
+
+fn test(a: Foo) {
+ println!("{}", a.b); //~ no field `b` on type `Foo`
+}
+
+fn main() {
+ let x = Attribute::Code {
+ attr_name_idx: 42,
+ };
+ let z = (&x).attr_name_idx; //~ no field `attr_name_idx` on type `&Attribute`
+ let y = x.attr_name_idx; //~ no field `attr_name_idx` on type `Attribute`
+}
--- /dev/null
+error[E0609]: no field `b` on type `Foo`
+ --> $DIR/issue-24365.rs:20:22
+ |
+LL | println!("{}", a.b); //~ no field `b` on type `Foo`
+ | ^
+
+error[E0609]: no field `attr_name_idx` on type `&Attribute`
+ --> $DIR/issue-24365.rs:27:18
+ |
+LL | let z = (&x).attr_name_idx; //~ no field `attr_name_idx` on type `&Attribute`
+ | ^^^^^^^^^^^^^
+
+error[E0609]: no field `attr_name_idx` on type `Attribute`
+ --> $DIR/issue-24365.rs:28:15
+ |
+LL | let y = x.attr_name_idx; //~ no field `attr_name_idx` on type `Attribute`
+ | ^^^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0609`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ static foo: Fn() -> u32 = || -> u32 {
+ //~^ ERROR mismatched types
+ //~| ERROR the size for values of type
+ 0
+ };
+}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-24446.rs:12:31
+ |
+LL | static foo: Fn() -> u32 = || -> u32 {
+ | _______________________________^
+LL | | //~^ ERROR mismatched types
+LL | | //~| ERROR the size for values of type
+LL | | 0
+LL | | };
+ | |_____^ expected trait std::ops::Fn, found closure
+ |
+ = note: expected type `(dyn std::ops::Fn() -> u32 + 'static)`
+ found type `[closure@$DIR/issue-24446.rs:12:31: 16:6]`
+
+error[E0277]: the size for values of type `(dyn std::ops::Fn() -> u32 + 'static)` cannot be known at compilation time
+ --> $DIR/issue-24446.rs:12:31
+ |
+LL | static foo: Fn() -> u32 = || -> u32 {
+ | _______________________________^
+LL | | //~^ ERROR mismatched types
+LL | | //~| ERROR the size for values of type
+LL | | 0
+LL | | };
+ | |_____^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `(dyn std::ops::Fn() -> u32 + 'static)`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
+ = note: constant expressions must have a statically known size
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0277, E0308.
+For more information about an error, try `rustc --explain E0277`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait A: Sized {
+ type N;
+ fn x() ->
+ Self<
+ N= //~ ERROR associated type bindings are not allowed here
+ Self::N> {
+ loop {}
+ }
+ fn y(&self) ->
+ std
+ <N=()> //~ ERROR associated type bindings are not allowed here
+ ::option::Option<()>
+ { None }
+ fn z(&self) ->
+ u32<N=()> //~ ERROR associated type bindings are not allowed here
+ { 42 }
+
+}
+
+fn main() {
+}
--- /dev/null
+error[E0229]: associated type bindings are not allowed here
+ --> $DIR/issue-24682.rs:15:11
+ |
+LL | / N= //~ ERROR associated type bindings are not allowed here
+LL | | Self::N> {
+ | |_________________^ associated type not allowed here
+
+error[E0229]: associated type bindings are not allowed here
+ --> $DIR/issue-24682.rs:21:13
+ |
+LL | <N=()> //~ ERROR associated type bindings are not allowed here
+ | ^^^^ associated type not allowed here
+
+error[E0229]: associated type bindings are not allowed here
+ --> $DIR/issue-24682.rs:25:13
+ |
+LL | u32<N=()> //~ ERROR associated type bindings are not allowed here
+ | ^^^^ associated type not allowed here
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0229`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::collections::HashSet;
+
+fn main() {
+ let mut v = Vec::new();
+ foo(&mut v);
+ //~^ ERROR mismatched types
+ //~| expected struct `std::collections::HashSet`, found struct `std::vec::Vec`
+}
+
+fn foo(h: &mut HashSet<u32>) {
+}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-24819.rs:15:9
+ |
+LL | foo(&mut v);
+ | ^^^^^^ expected struct `std::collections::HashSet`, found struct `std::vec::Vec`
+ |
+ = note: expected type `&mut std::collections::HashSet<u32>`
+ found type `&mut std::vec::Vec<_>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(rustc_attrs)]
+
+mod a {
+ pub mod b { pub struct Foo; }
+
+ pub mod c {
+ use super::b;
+ pub struct Bar(pub b::Foo);
+ }
+
+ pub use self::c::*;
+}
+
+#[rustc_error]
+fn main() { //~ ERROR compilation successful
+ let _ = a::c::Bar(a::b::Foo);
+ let _ = a::Bar(a::b::Foo);
+}
--- /dev/null
+error: compilation successful
+ --> $DIR/issue-24883.rs:25:1
+ |
+LL | / fn main() { //~ ERROR compilation successful
+LL | | let _ = a::c::Bar(a::b::Foo);
+LL | | let _ = a::Bar(a::b::Foo);
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct S;
+
+trait InOut<T> { type Out; }
+
+fn do_fold<B, F: InOut<B, Out=B>>(init: B, f: F) {}
+
+fn bot<T>() -> T { loop {} }
+
+fn main() {
+ do_fold(bot(), ()); //~ ERROR `(): InOut<_>` is not satisfied
+}
--- /dev/null
+error[E0277]: the trait bound `(): InOut<_>` is not satisfied
+ --> $DIR/issue-25076.rs:20:5
+ |
+LL | do_fold(bot(), ()); //~ ERROR `(): InOut<_>` is not satisfied
+ | ^^^^^^^ the trait `InOut<_>` is not implemented for `()`
+ |
+note: required by `do_fold`
+ --> $DIR/issue-25076.rs:15:1
+ |
+LL | fn do_fold<B, F: InOut<B, Out=B>>(init: B, f: F) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
--- /dev/null
+// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-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::sync::mpsc::channel;
+use std::thread::spawn;
+use std::marker::PhantomData;
+
+struct Foo<T> {foo: PhantomData<T>}
+
+fn main() {
+ let (tx, rx) = channel();
+
+ spawn(move || {
+ tx.send(Foo{ foo: PhantomData }); //~ ERROR E0282
+ });
+}
--- /dev/null
+error[E0282]: type annotations needed
+ --> $DIR/issue-25368.rs:21:17
+ |
+LL | let (tx, rx) = channel();
+ | -------- consider giving the pattern a type
+...
+LL | tx.send(Foo{ foo: PhantomData }); //~ ERROR E0282
+ | ^^^ cannot infer type for `T`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0282`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+mod stuff {
+ pub struct Item {
+ c_object: Box<CObj>,
+ }
+ pub struct CObj {
+ name: Option<String>,
+ }
+ impl Item {
+ pub fn new() -> Item {
+ Item {
+ c_object: Box::new(CObj { name: None }),
+ }
+ }
+ }
+}
+
+macro_rules! check_ptr_exist {
+ ($var:expr, $member:ident) => (
+ (*$var.c_object).$member.is_some()
+ //~^ ERROR field `name` of struct `stuff::CObj` is private
+ //~^^ ERROR field `c_object` of struct `stuff::Item` is private
+ );
+}
+
+fn main() {
+ let item = stuff::Item::new();
+ println!("{}", check_ptr_exist!(item, name));
+}
--- /dev/null
+error[E0616]: field `c_object` of struct `stuff::Item` is private
+ --> $DIR/issue-25386.rs:29:11
+ |
+LL | (*$var.c_object).$member.is_some()
+ | ^^^^^^^^^^^^^
+...
+LL | println!("{}", check_ptr_exist!(item, name));
+ | ---------------------------- in this macro invocation
+
+error[E0616]: field `name` of struct `stuff::CObj` is private
+ --> $DIR/issue-25386.rs:29:9
+ |
+LL | (*$var.c_object).$member.is_some()
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | println!("{}", check_ptr_exist!(item, name));
+ | ---------------------------- in this macro invocation
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0616`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use foo::baz;
+use bar::baz; //~ ERROR the name `baz` is defined multiple times
+
+use foo::Quux;
+use bar::Quux; //~ ERROR the name `Quux` is defined multiple times
+
+use foo::blah;
+use bar::blah; //~ ERROR the name `blah` is defined multiple times
+
+use foo::WOMP;
+use bar::WOMP; //~ ERROR the name `WOMP` is defined multiple times
+
+fn main() {}
+
+mod foo {
+ pub mod baz {}
+ pub trait Quux { }
+ pub type blah = (f64, u32);
+ pub const WOMP: u8 = 5;
+}
+
+mod bar {
+ pub mod baz {}
+ pub type Quux = i32;
+ pub struct blah { x: i8 }
+ pub const WOMP: i8 = -5;
+}
--- /dev/null
+error[E0252]: the name `baz` is defined multiple times
+ --> $DIR/issue-25396.rs:12:5
+ |
+LL | use foo::baz;
+ | -------- previous import of the module `baz` here
+LL | use bar::baz; //~ ERROR the name `baz` is defined multiple times
+ | ^^^^^^^^ `baz` reimported here
+ |
+ = note: `baz` must be defined only once in the type namespace of this module
+help: You can use `as` to change the binding name of the import
+ |
+LL | use bar::baz as other_baz; //~ ERROR the name `baz` is defined multiple times
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error[E0252]: the name `Quux` is defined multiple times
+ --> $DIR/issue-25396.rs:15:5
+ |
+LL | use foo::Quux;
+ | --------- previous import of the trait `Quux` here
+LL | use bar::Quux; //~ ERROR the name `Quux` is defined multiple times
+ | ^^^^^^^^^ `Quux` reimported here
+ |
+ = note: `Quux` must be defined only once in the type namespace of this module
+help: You can use `as` to change the binding name of the import
+ |
+LL | use bar::Quux as OtherQuux; //~ ERROR the name `Quux` is defined multiple times
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0252]: the name `blah` is defined multiple times
+ --> $DIR/issue-25396.rs:18:5
+ |
+LL | use foo::blah;
+ | --------- previous import of the type `blah` here
+LL | use bar::blah; //~ ERROR the name `blah` is defined multiple times
+ | ^^^^^^^^^ `blah` reimported here
+ |
+ = note: `blah` must be defined only once in the type namespace of this module
+help: You can use `as` to change the binding name of the import
+ |
+LL | use bar::blah as other_blah; //~ ERROR the name `blah` is defined multiple times
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0252]: the name `WOMP` is defined multiple times
+ --> $DIR/issue-25396.rs:21:5
+ |
+LL | use foo::WOMP;
+ | --------- previous import of the value `WOMP` here
+LL | use bar::WOMP; //~ ERROR the name `WOMP` is defined multiple times
+ | ^^^^^^^^^ `WOMP` reimported here
+ |
+ = note: `WOMP` must be defined only once in the value namespace of this module
+help: You can use `as` to change the binding name of the import
+ |
+LL | use bar::WOMP as OtherWOMP; //~ ERROR the name `WOMP` is defined multiple times
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0252`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Helper<'a, F: 'a>(&'a F);
+
+fn fix<F>(f: F) -> i32 where F: Fn(Helper<F>, i32) -> i32 {
+ f(Helper(&f), 8)
+}
+
+fn main() {
+ fix(|_, x| x); //~ ERROR closure/generator type that references itself [E0644]
+}
--- /dev/null
+error[E0644]: closure/generator type that references itself
+ --> $DIR/issue-25439.rs:18:9
+ |
+LL | fix(|_, x| x); //~ ERROR closure/generator type that references itself [E0644]
+ | ^^^^^^^^ cyclic type of infinite size
+ |
+ = note: closures cannot capture themselves or take themselves as argument;
+ this error may be the result of a recent compiler bug-fix,
+ see https://github.com/rust-lang/rust/issues/46062 for more details
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0644`.
--- /dev/null
+error: compilation successful
+ --> $DIR/issue-25579.rs:31:1
+ |
+LL | / fn main() { //[mir]~ ERROR compilation successful
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
--- /dev/null
+error[E0499]: cannot borrow `l.0` as mutable more than once at a time
+ --> $DIR/issue-25579.rs:24:32
+ |
+LL | &mut Sexpression::Cons(ref mut expr) => { //[ast]~ ERROR [E0499]
+ | ^^^^^^^^^^^^ mutable borrow starts here in previous iteration of loop
+...
+LL | }
+ | - mutable borrow ends here
+
+error[E0506]: cannot assign to `l` because it is borrowed
+ --> $DIR/issue-25579.rs:25:13
+ |
+LL | &mut Sexpression::Cons(ref mut expr) => { //[ast]~ ERROR [E0499]
+ | ------------ borrow of `l` occurs here
+LL | l = &mut **expr; //[ast]~ ERROR [E0506]
+ | ^^^^^^^^^^^^^^^ assignment to borrowed `l` occurs here
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0499, E0506.
+For more information about an error, try `rustc --explain E0499`.
--- /dev/null
+error: compilation successful
+ --> $DIR/issue-25579.rs:31:1
+ |
+LL | / fn main() { //[mir]~ ERROR compilation successful
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// revisions: ast mir
+//[mir]compile-flags: -Z borrowck=mir
+
+#![feature(rustc_attrs)]
+
+enum Sexpression {
+ Num(()),
+ Cons(&'static mut Sexpression)
+}
+
+fn causes_error_in_ast(mut l: &mut Sexpression) {
+ loop { match l {
+ &mut Sexpression::Num(ref mut n) => {},
+ &mut Sexpression::Cons(ref mut expr) => { //[ast]~ ERROR [E0499]
+ l = &mut **expr; //[ast]~ ERROR [E0506]
+ }
+ }}
+}
+
+#[rustc_error]
+fn main() { //[mir]~ ERROR compilation successful
+}
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct S<T: 'static>(Option<&'static T>);
+
+trait Tr { type Out; }
+impl<T> Tr for T { type Out = T; }
+
+impl<T: 'static> Copy for S<T> where S<T>: Tr<Out=T> {}
+impl<T: 'static> Clone for S<T> where S<T>: Tr<Out=T> {
+ fn clone(&self) -> Self { *self }
+}
+fn main() {
+ let t = S::<()>(None);
+ drop(t);
+ drop(t); //~ ERROR use of moved value
+}
--- /dev/null
+error[E0382]: use of moved value: `t`
+ --> $DIR/issue-25700.rs:23:10
+ |
+LL | drop(t);
+ | - value moved here
+LL | drop(t); //~ ERROR use of moved value
+ | ^ value used here after move
+ |
+ = note: move occurs because `t` has type `S<()>`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
--- /dev/null
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/issue-2590.rs:22:9
+ |
+LL | self.tokens //~ ERROR cannot move out of borrowed content
+ | ^^^^^^^^^^^ cannot move out of borrowed content
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+
+struct parser {
+ tokens: Vec<isize> ,
+}
+
+trait parse {
+ fn parse(&self) -> Vec<isize> ;
+}
+
+impl parse for parser {
+ fn parse(&self) -> Vec<isize> {
+ self.tokens //~ ERROR cannot move out of borrowed content
+ }
+}
+
+fn main() {}
--- /dev/null
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/issue-2590.rs:22:9
+ |
+LL | self.tokens //~ ERROR cannot move out of borrowed content
+ | ^^^^ cannot move out of borrowed content
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct A;
+struct B;
+
+static S: &'static B = &A;
+//~^ ERROR calls in statics are limited to constant functions
+
+use std::ops::Deref;
+
+impl Deref for A {
+ type Target = B;
+ fn deref(&self)->&B { static B_: B = B; &B_ }
+}
+
+fn main(){}
--- /dev/null
+error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants
+ --> $DIR/issue-25901.rs:14:24
+ |
+LL | static S: &'static B = &A;
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0015`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+macro_rules! some_macro {
+ ($other: expr) => ({
+ $other(None)
+ //~^ this function takes 0 parameters but 1 parameter was supplied
+ })
+}
+
+fn some_function() {}
+
+fn main() {
+ some_macro!(some_function);
+ //~^ in this expansion of some_macro!
+}
--- /dev/null
+error[E0061]: this function takes 0 parameters but 1 parameter was supplied
+ --> $DIR/issue-26094.rs:13:9
+ |
+LL | $other(None)
+ | ^^^^^^^^^^^^ expected 0 parameters
+...
+LL | fn some_function() {}
+ | ------------------ defined here
+...
+LL | some_macro!(some_function);
+ | --------------------------- in this macro invocation
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0061`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(slice_patterns)]
+
+fn main() {
+ let x: &[u32] = &[];
+ let &[[ref _a, ref _b..]..] = x; //~ ERROR refutable pattern
+}
--- /dev/null
+error[E0005]: refutable pattern in local binding: `&[]` not covered
+ --> $DIR/issue-26158.rs:15:9
+ |
+LL | let &[[ref _a, ref _b..]..] = x; //~ ERROR refutable pattern
+ | ^^^^^^^^^^^^^^^^^^^^^^^ pattern `&[]` not covered
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0005`.
--- /dev/null
+warning: not reporting region error due to nll
+ --> $DIR/issue-26217.rs:14:5
+ |
+LL | foo::<&'a i32>();
+ | ^^^^^^^^^^^^^^
+
+error[E0131]: `main` function is not allowed to have generic parameters
+ --> $DIR/issue-26217.rs:13:8
+ |
+LL | fn main<'a>() {
+ | ^^^^ `main` cannot have generic parameters
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0131`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn foo<T>() where for<'a> T: 'a {}
+
+fn main<'a>() {
+ foo::<&'a i32>();
+ //~^ ERROR the type `&'a i32` does not fulfill the required lifetime
+}
--- /dev/null
+error[E0477]: the type `&'a i32` does not fulfill the required lifetime
+ --> $DIR/issue-26217.rs:14:5
+ |
+LL | foo::<&'a i32>();
+ | ^^^^^^^^^^^^^^
+ |
+ = note: type must satisfy the static lifetime
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0477`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+macro_rules! macro_panic {
+ ($not_a_function:expr, $some_argument:ident) => {
+ $not_a_function($some_argument)
+ //~^ ERROR expected function, found `{integer}`
+ }
+}
+
+fn main() {
+ let mut value_a = 0;
+ let mut value_b = 0;
+ macro_panic!(value_a, value_b);
+ //~^ in this expansion of macro_panic!
+}
--- /dev/null
+error[E0618]: expected function, found `{integer}`
+ --> $DIR/issue-26237.rs:13:9
+ |
+LL | $not_a_function($some_argument)
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a function
+...
+LL | let mut value_a = 0;
+ | ----------- `{integer}` defined here
+LL | let mut value_b = 0;
+LL | macro_panic!(value_a, value_b);
+ | ------------------------------- in this macro invocation
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0618`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Check that projections don't count as constraining type parameters.
+
+struct S<T>(T);
+
+trait Tr { type Assoc; fn test(); }
+
+impl<T: Tr> S<T::Assoc> {
+//~^ ERROR the type parameter `T` is not constrained
+ fn foo(self, _: T) {
+ T::test();
+ }
+}
+
+trait Trait1<T> { type Bar; }
+trait Trait2<'x> { type Foo; }
+
+impl<'a,T: Trait2<'a>> Trait1<<T as Trait2<'a>>::Foo> for T {
+//~^ ERROR the lifetime parameter `'a` is not constrained
+ type Bar = &'a ();
+}
+
+fn main() {}
--- /dev/null
+error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates
+ --> $DIR/issue-26262.rs:17:6
+ |
+LL | impl<T: Tr> S<T::Assoc> {
+ | ^ unconstrained type parameter
+
+error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
+ --> $DIR/issue-26262.rs:27:6
+ |
+LL | impl<'a,T: Trait2<'a>> Trait1<<T as Trait2<'a>>::Foo> for T {
+ | ^^ unconstrained lifetime parameter
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0207`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ match 'a' {
+ char{ch} => true
+ //~^ ERROR expected struct, variant or union type, found builtin type `char`
+ };
+}
--- /dev/null
+error[E0574]: expected struct, variant or union type, found builtin type `char`
+ --> $DIR/issue-26459.rs:13:9
+ |
+LL | char{ch} => true
+ | ^^^^ not a struct, variant or union type
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0574`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//~^^^^^^^^^^ ERROR cycle detected when computing layout of
+//~| NOTE ...which requires computing layout of
+//~| NOTE ...which again requires computing layout of
+//~| NOTE cycle used when compile_codegen_unit
+
+trait Mirror { type It: ?Sized; }
+impl<T: ?Sized> Mirror for T { type It = Self; }
+struct S(Option<<S as Mirror>::It>);
+
+fn main() {
+ let _s = S(None);
+}
--- /dev/null
+error[E0391]: cycle detected when computing layout of `std::option::Option<S>`
+ |
+note: ...which requires computing layout of `S`...
+ = note: ...which again requires computing layout of `std::option::Option<S>`, completing the cycle
+note: cycle used when compile_codegen_unit
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0391`.
--- /dev/null
+// 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.
+
+#![feature(rustc_attrs)]
+#![allow(warnings)]
+
+trait Mirror {
+ type It;
+}
+
+impl<T> Mirror for T {
+ type It = Self;
+}
+
+
+#[rustc_error]
+fn main() { //~ ERROR compilation successful
+ let c: <u32 as Mirror>::It = 5;
+ const CCCC: <u32 as Mirror>::It = 5;
+}
--- /dev/null
+error: compilation successful
+ --> $DIR/issue-26614.rs:24:1
+ |
+LL | / fn main() { //~ ERROR compilation successful
+LL | | let c: <u32 as Mirror>::It = 5;
+LL | | const CCCC: <u32 as Mirror>::It = 5;
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(default_type_parameter_fallback)]
+
+fn avg<T=T::Item>(_: T) {}
+//~^ ERROR type parameters with a default cannot use forward declared identifiers
+
+fn main() {}
--- /dev/null
+error[E0128]: type parameters with a default cannot use forward declared identifiers
+ --> $DIR/issue-26812.rs:13:10
+ |
+LL | fn avg<T=T::Item>(_: T) {}
+ | ^^^^^^^ defaulted type parameters cannot be forward declared
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0128`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(unsize, coerce_unsized)]
+
+// Verfies that non-PhantomData ZSTs still cause coercions to fail.
+// They might have additional semantics that we don't want to bulldoze.
+
+use std::marker::{Unsize, PhantomData};
+use std::ops::CoerceUnsized;
+
+struct NotPhantomData<T: ?Sized>(PhantomData<T>);
+
+struct MyRc<T: ?Sized> {
+ _ptr: *const T,
+ _boo: NotPhantomData<T>,
+}
+
+impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<MyRc<U>> for MyRc<T>{ } //~ERROR
+
+fn main() {
+ let data = [1, 2, 3];
+ let iter = data.iter();
+ let x = MyRc { _ptr: &iter, _boo: NotPhantomData(PhantomData) };
+ let _y: MyRc<Iterator<Item=&u32>> = x;
+}
+
--- /dev/null
+error[E0375]: implementing the trait `CoerceUnsized` requires multiple coercions
+ --> $DIR/issue-26905.rs:26:40
+ |
+LL | impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<MyRc<U>> for MyRc<T>{ } //~ERROR
+ | ^^^^^^^^^^^^^^^^^^^^^^ requires multiple coercions
+ |
+ = note: `CoerceUnsized` may only be implemented for a coercion between structures with one field being coerced
+ = note: currently, 2 fields need coercions: _ptr (*const T to *const U), _boo (NotPhantomData<T> to NotPhantomData<U>)
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0375`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(rustc_attrs)]
+#![allow(unused)]
+
+extern crate core;
+use core as core_export;
+use self::x::*;
+mod x {}
+
+#[rustc_error]
+fn main() {} //~ ERROR compilation successful
--- /dev/null
+error: compilation successful
+ --> $DIR/issue-26930.rs:20:1
+ |
+LL | fn main() {} //~ ERROR compilation successful
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ enum Foo { A { x: u32 } }
+ let orig = Foo::A { x: 5 };
+ Foo::A { x: 6, ..orig };
+ //~^ ERROR functional record update syntax requires a struct
+}
--- /dev/null
+error[E0436]: functional record update syntax requires a struct
+ --> $DIR/issue-26948.rs:14:22
+ |
+LL | Foo::A { x: 6, ..orig };
+ | ^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0436`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct S;
+
+fn main() {
+ let b = [0; S];
+ //~^ ERROR mismatched types
+ //~| expected type `usize`
+ //~| found type `S`
+ //~| expected usize, found struct `S`
+}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-27008.rs:14:17
+ |
+LL | let b = [0; S];
+ | ^ expected usize, found struct `S`
+ |
+ = note: expected type `usize`
+ found type `S`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ match Some(1) {
+ None @ _ => {} //~ ERROR match bindings cannot shadow unit variants
+ };
+ const C: u8 = 1;
+ match 1 {
+ C @ 2 => { //~ ERROR match bindings cannot shadow constant
+ println!("{}", C);
+ }
+ _ => {}
+ };
+}
--- /dev/null
+error[E0530]: match bindings cannot shadow unit variants
+ --> $DIR/issue-27033.rs:13:9
+ |
+LL | None @ _ => {} //~ ERROR match bindings cannot shadow unit variants
+ | ^^^^ cannot be named the same as a unit variant
+
+error[E0530]: match bindings cannot shadow constants
+ --> $DIR/issue-27033.rs:17:9
+ |
+LL | const C: u8 = 1;
+ | ---------------- a constant `C` is defined here
+LL | match 1 {
+LL | C @ 2 => { //~ ERROR match bindings cannot shadow constant
+ | ^ cannot be named the same as a constant
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0530`.
--- /dev/null
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Regression test for #27042. Test that a loop's label is included in its span.
+
+fn main() {
+ let _: i32 =
+ 'a: // in this case, the citation is just the `break`:
+ loop { break }; //~ ERROR mismatched types
+ let _: i32 =
+ 'b: //~ ERROR mismatched types
+ while true { break }; // but here we cite the whole loop
+ let _: i32 =
+ 'c: //~ ERROR mismatched types
+ for _ in None { break }; // but here we cite the whole loop
+ let _: i32 =
+ 'd: //~ ERROR mismatched types
+ while let Some(_) = None { break };
+}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-27042.rs:16:16
+ |
+LL | loop { break }; //~ ERROR mismatched types
+ | ^^^^^ expected (), found i32
+ |
+ = note: expected type `()`
+ found type `i32`
+
+error[E0308]: mismatched types
+ --> $DIR/issue-27042.rs:18:9
+ |
+LL | / 'b: //~ ERROR mismatched types
+LL | | while true { break }; // but here we cite the whole loop
+ | |____________________________^ expected i32, found ()
+ |
+ = note: expected type `i32`
+ found type `()`
+
+error[E0308]: mismatched types
+ --> $DIR/issue-27042.rs:21:9
+ |
+LL | / 'c: //~ ERROR mismatched types
+LL | | for _ in None { break }; // but here we cite the whole loop
+ | |_______________________________^ expected i32, found ()
+ |
+ = note: expected type `i32`
+ found type `()`
+
+error[E0308]: mismatched types
+ --> $DIR/issue-27042.rs:24:9
+ |
+LL | / 'd: //~ ERROR mismatched types
+LL | | while let Some(_) = None { break };
+ | |__________________________________________^ expected i32, found ()
+ |
+ = note: expected type `i32`
+ found type `()`
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// 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.
+
+#[repr(packed)]
+pub struct Bad<T: ?Sized> {
+ data: T, //~ ERROR the size for values of type
+}
+
+fn main() {}
--- /dev/null
+error[E0277]: the size for values of type `T` cannot be known at compilation time
+ --> $DIR/issue-27060-2.rs:13:5
+ |
+LL | data: T, //~ ERROR the size for values of type
+ | ^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `T`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
+ = help: consider adding a `where T: std::marker::Sized` bound
+ = note: only the last field of a struct may have a dynamically sized type
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
--- /dev/null
+// 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.
+
+#![feature(associated_consts)]
+
+trait Foo {
+ const BAR: i32;
+ fn foo(self) -> &'static i32 {
+ //~^ ERROR the size for values of type
+ &<Self>::BAR
+ }
+}
+
+fn main() {}
--- /dev/null
+error[E0277]: the size for values of type `Self` cannot be known at compilation time
+ --> $DIR/issue-27078.rs:15:12
+ |
+LL | fn foo(self) -> &'static i32 {
+ | ^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `Self`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
+ = help: consider adding a `where Self: std::marker::Sized` bound
+ = note: all local variables must have a statically known size
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
--- /dev/null
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub struct send_packet<T> {
+ p: T
+}
+
+mod pingpong {
+ use send_packet;
+ pub type ping = send_packet<pong>;
+ pub struct pong(send_packet<ping>);
+ //~^ ERROR recursive type `pingpong::pong` has infinite size
+}
+
+fn main() {}
--- /dev/null
+error[E0072]: recursive type `pingpong::pong` has infinite size
+ --> $DIR/issue-2718-a.rs:18:5
+ |
+LL | pub struct pong(send_packet<ping>);
+ | ^^^^^^^^^^^^^^^^-----------------^^
+ | | |
+ | | recursive without indirection
+ | recursive type has infinite size
+ |
+ = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `pingpong::pong` representable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0072`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo;
+#[derive(Copy, Clone)]
+//~^ ERROR the trait `Copy` may not be implemented for this type
+struct Bar(Foo);
+
+fn main() {}
--- /dev/null
+error[E0204]: the trait `Copy` may not be implemented for this type
+ --> $DIR/issue-27340.rs:12:10
+ |
+LL | #[derive(Copy, Clone)]
+ | ^^^^
+LL | //~^ ERROR the trait `Copy` may not be implemented for this type
+LL | struct Bar(Foo);
+ | --- this field does not implement `Copy`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0204`.
--- /dev/null
+// 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 main() {
+ let foo = 42u32;
+ const FOO : u32 = foo;
+ //~^ ERROR can't capture dynamic environment
+}
--- /dev/null
+error[E0434]: can't capture dynamic environment in a fn item
+ --> $DIR/issue-27433.rs:13:23
+ |
+LL | const FOO : u32 = foo;
+ | ^^^
+ |
+ = help: use the `|| { ... }` closure form instead
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0434`.
--- /dev/null
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/issue-27592.rs:26:33
+ |
+LL | write(|| format_args!("{}", String::from("Hello world")));
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value only lives until here
+ | |
+ | temporary value does not live long enough
+
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/issue-27592.rs:26:27
+ |
+LL | write(|| format_args!("{}", String::from("Hello world")));
+ | ^^^^ - temporary value only lives until here
+ | |
+ | temporary value does not live long enough
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Regression test for issue #27592.
+
+fn write<'a, F: ::std::ops::FnOnce()->::std::fmt::Arguments<'a> + 'a>(fcn: F) {
+ use std::fmt::Write;
+ let _ = match fcn() { a => write!(&mut Stream, "{}", a), };
+}
+
+struct Stream;
+impl ::std::fmt::Write for Stream {
+ fn write_str(&mut self, _s: &str) -> ::std::fmt::Result {
+ Ok( () )
+ }
+}
+
+fn main() {
+ write(|| format_args!("{}", String::from("Hello world")));
+ //~^ ERROR borrowed value does not live long enough
+ //~| ERROR borrowed value does not live long enough
+}
--- /dev/null
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/issue-27592.rs:26:27
+ |
+LL | write(|| format_args!("{}", String::from("Hello world")));
+ | ^^^^ -- temporary value needs to live until here
+ | | |
+ | | temporary value dropped here while still borrowed
+ | temporary value does not live long enough
+
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/issue-27592.rs:26:33
+ |
+LL | write(|| format_args!("{}", String::from("Hello world")));
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^-- temporary value needs to live until here
+ | | |
+ | | temporary value dropped here while still borrowed
+ | temporary value does not live long enough
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+mod A {}
+
+fn main() {
+ let u = A { x: 1 }; //~ ERROR expected struct, variant or union type, found module `A`
+ let v = u32 { x: 1 }; //~ ERROR expected struct, variant or union type, found builtin type `u32`
+ match () {
+ A { x: 1 } => {}
+ //~^ ERROR expected struct, variant or union type, found module `A`
+ u32 { x: 1 } => {}
+ //~^ ERROR expected struct, variant or union type, found builtin type `u32`
+ }
+}
--- /dev/null
+error[E0574]: expected struct, variant or union type, found module `A`
+ --> $DIR/issue-27815.rs:14:13
+ |
+LL | let u = A { x: 1 }; //~ ERROR expected struct, variant or union type, found module `A`
+ | ^ not a struct, variant or union type
+
+error[E0574]: expected struct, variant or union type, found builtin type `u32`
+ --> $DIR/issue-27815.rs:15:13
+ |
+LL | let v = u32 { x: 1 }; //~ ERROR expected struct, variant or union type, found builtin type `u32`
+ | ^^^ not a struct, variant or union type
+
+error[E0574]: expected struct, variant or union type, found module `A`
+ --> $DIR/issue-27815.rs:17:9
+ |
+LL | A { x: 1 } => {}
+ | ^ not a struct, variant or union type
+
+error[E0574]: expected struct, variant or union type, found builtin type `u32`
+ --> $DIR/issue-27815.rs:19:9
+ |
+LL | u32 { x: 1 } => {}
+ | ^^^ not a struct, variant or union type
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0574`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ let i = 5;
+ let index = 6;
+
+ match i {
+ 0..=index => println!("winner"),
+ //~^ ERROR runtime values cannot be referenced in patterns
+ _ => println!("hello"),
+ }
+}
--- /dev/null
+error[E0080]: runtime values cannot be referenced in patterns
+ --> $DIR/issue-27895.rs:16:13
+ |
+LL | 0..=index => println!("winner"),
+ | ^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0080`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ let _ = Iterator::next(&mut ());
+ //~^ ERROR `(): std::iter::Iterator` is not satisfied
+
+ for _ in false {}
+ //~^ ERROR `bool: std::iter::Iterator` is not satisfied
+
+ let _ = Iterator::next(&mut ());
+ //~^ ERROR `(): std::iter::Iterator` is not satisfied
+
+ other()
+}
+
+pub fn other() {
+ // check errors are still reported globally
+
+ let _ = Iterator::next(&mut ());
+ //~^ ERROR `(): std::iter::Iterator` is not satisfied
+
+ let _ = Iterator::next(&mut ());
+ //~^ ERROR `(): std::iter::Iterator` is not satisfied
+
+ for _ in false {}
+ //~^ ERROR `bool: std::iter::Iterator` is not satisfied
+}
--- /dev/null
+error[E0277]: the trait bound `(): std::iter::Iterator` is not satisfied
+ --> $DIR/issue-28098.rs:12:13
+ |
+LL | let _ = Iterator::next(&mut ());
+ | ^^^^^^^^^^^^^^ `()` is not an iterator; maybe try calling `.iter()` or a similar method
+ |
+ = help: the trait `std::iter::Iterator` is not implemented for `()`
+ = note: required by `std::iter::Iterator::next`
+
+error[E0277]: the trait bound `bool: std::iter::Iterator` is not satisfied
+ --> $DIR/issue-28098.rs:15:14
+ |
+LL | for _ in false {}
+ | ^^^^^ `bool` is not an iterator; maybe try calling `.iter()` or a similar method
+ |
+ = help: the trait `std::iter::Iterator` is not implemented for `bool`
+ = note: required by `std::iter::IntoIterator::into_iter`
+
+error[E0277]: the trait bound `(): std::iter::Iterator` is not satisfied
+ --> $DIR/issue-28098.rs:18:13
+ |
+LL | let _ = Iterator::next(&mut ());
+ | ^^^^^^^^^^^^^^ `()` is not an iterator; maybe try calling `.iter()` or a similar method
+ |
+ = help: the trait `std::iter::Iterator` is not implemented for `()`
+ = note: required by `std::iter::Iterator::next`
+
+error[E0277]: the trait bound `(): std::iter::Iterator` is not satisfied
+ --> $DIR/issue-28098.rs:27:13
+ |
+LL | let _ = Iterator::next(&mut ());
+ | ^^^^^^^^^^^^^^ `()` is not an iterator; maybe try calling `.iter()` or a similar method
+ |
+ = help: the trait `std::iter::Iterator` is not implemented for `()`
+ = note: required by `std::iter::Iterator::next`
+
+error[E0277]: the trait bound `(): std::iter::Iterator` is not satisfied
+ --> $DIR/issue-28098.rs:30:13
+ |
+LL | let _ = Iterator::next(&mut ());
+ | ^^^^^^^^^^^^^^ `()` is not an iterator; maybe try calling `.iter()` or a similar method
+ |
+ = help: the trait `std::iter::Iterator` is not implemented for `()`
+ = note: required by `std::iter::Iterator::next`
+
+error[E0277]: the trait bound `bool: std::iter::Iterator` is not satisfied
+ --> $DIR/issue-28098.rs:33:14
+ |
+LL | for _ in false {}
+ | ^^^^^ `bool` is not an iterator; maybe try calling `.iter()` or a similar method
+ |
+ = help: the trait `std::iter::Iterator` is not implemented for `bool`
+ = note: required by `std::iter::IntoIterator::into_iter`
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
--- /dev/null
+// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Make sure that a continue span actually contains the keyword.
+
+fn main() {
+ continue //~ ERROR `continue` outside of loop
+ ;
+ break //~ ERROR `break` outside of loop
+ ;
+}
--- /dev/null
+error[E0268]: `continue` outside of loop
+ --> $DIR/issue-28105.rs:14:5
+ |
+LL | continue //~ ERROR `continue` outside of loop
+ | ^^^^^^^^ cannot break outside of a loop
+
+error[E0268]: `break` outside of loop
+ --> $DIR/issue-28105.rs:16:5
+ |
+LL | break //~ ERROR `break` outside of loop
+ | ^^^^^ cannot break outside of a loop
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0268`.
--- /dev/null
+// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Make sure that label for continue and break is spanned correctly
+
+fn main() {
+ loop {
+ continue
+ 'b //~ ERROR use of undeclared label
+ ;
+ break
+ 'c //~ ERROR use of undeclared label
+ ;
+ }
+}
--- /dev/null
+error[E0426]: use of undeclared label `'b`
+ --> $DIR/issue-28109.rs:16:9
+ |
+LL | 'b //~ ERROR use of undeclared label
+ | ^^ undeclared label `'b`
+
+error[E0426]: use of undeclared label `'c`
+ --> $DIR/issue-28109.rs:19:9
+ |
+LL | 'c //~ ERROR use of undeclared label
+ | ^^ undeclared label `'c`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0426`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![allow(warnings)]
+
+const X: u8 =
+ || -> u8 { 5 }()
+ //~^ ERROR calls in constants are limited to constant functions
+;
+
+fn main() {}
--- /dev/null
+error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants
+ --> $DIR/issue-28113.rs:14:5
+ |
+LL | || -> u8 { 5 }()
+ | ^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0015`.
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct C {
+ x: isize,
+}
+
+impl Drop for C {
+ fn drop(&mut self) {
+ println!("dropping: {}", self.x);
+ }
+}
+
+fn main() {
+ let c = C{ x: 2};
+ let _d = c.clone(); //~ ERROR no method named `clone` found
+}
--- /dev/null
+error[E0599]: no method named `clone` found for type `C` in the current scope
+ --> $DIR/issue-2823.rs:23:16
+ |
+LL | struct C {
+ | -------- method `clone` not found for this
+...
+LL | let _d = c.clone(); //~ ERROR no method named `clone` found
+ | ^^^^^
+ |
+ = help: items from traits can only be used if the trait is implemented and in scope
+ = note: the following trait defines an item `clone`, perhaps you need to implement it:
+ candidate #1: `std::clone::Clone`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![allow(safe_extern_statics)]
+
+extern {
+ static error_message_count: u32;
+}
+
+pub static BAZ: u32 = *&error_message_count;
+//~^ ERROR could not evaluate static initializer
+//~| tried to read from foreign (extern) static
+
+fn main() {}
--- /dev/null
+error[E0080]: could not evaluate static initializer
+ --> $DIR/issue-28324.rs:17:23
+ |
+LL | pub static BAZ: u32 = *&error_message_count;
+ | ^^^^^^^^^^^^^^^^^^^^^ tried to read from foreign (extern) static
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0080`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::ops::BitXor;
+
+fn main() {
+ let x: u8 = BitXor::bitor(0 as u8, 0 as u8);
+ //~^ ERROR must be specified
+ //~| no function or associated item named
+
+ let g = BitXor::bitor;
+ //~^ ERROR must be specified
+ //~| no function or associated item named
+}
--- /dev/null
+error[E0191]: the value of the associated type `Output` (from the trait `std::ops::BitXor`) must be specified
+ --> $DIR/issue-28344.rs:14:17
+ |
+LL | let x: u8 = BitXor::bitor(0 as u8, 0 as u8);
+ | ^^^^^^^^^^^^^ missing associated type `Output` value
+
+error[E0599]: no function or associated item named `bitor` found for type `dyn std::ops::BitXor<_>` in the current scope
+ --> $DIR/issue-28344.rs:14:17
+ |
+LL | let x: u8 = BitXor::bitor(0 as u8, 0 as u8);
+ | ^^^^^^^^^^^^^ function or associated item not found in `dyn std::ops::BitXor<_>`
+ |
+ = help: did you mean `bitxor`?
+
+error[E0191]: the value of the associated type `Output` (from the trait `std::ops::BitXor`) must be specified
+ --> $DIR/issue-28344.rs:18:13
+ |
+LL | let g = BitXor::bitor;
+ | ^^^^^^^^^^^^^ missing associated type `Output` value
+
+error[E0599]: no function or associated item named `bitor` found for type `dyn std::ops::BitXor<_>` in the current scope
+ --> $DIR/issue-28344.rs:18:13
+ |
+LL | let g = BitXor::bitor;
+ | ^^^^^^^^^^^^^ function or associated item not found in `dyn std::ops::BitXor<_>`
+ |
+ = help: did you mean `bitxor`?
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0191, E0599.
+For more information about an error, try `rustc --explain E0191`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags: -Z continue-parse-after-error
+
+enum bird {
+ pub duck,
+ //~^ ERROR: expected identifier, found keyword `pub`
+ //~| ERROR: expected
+ goose
+}
+
+
+fn main() {
+ let y = bird::goose;
+}
--- /dev/null
+error: expected identifier, found keyword `pub`
+ --> $DIR/issue-28433.rs:14:5
+ |
+LL | pub duck,
+ | ^^^ expected identifier, found keyword
+
+error: expected one of `(`, `,`, `=`, `{`, or `}`, found `duck`
+ --> $DIR/issue-28433.rs:14:9
+ |
+LL | pub duck,
+ | ^^^^ expected one of `(`, `,`, `=`, `{`, or `}` here
+
+error: aborting due to 2 previous errors
+
--- /dev/null
+// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Check that the visibility modifier is included in the span of foreign items.
+
+extern {
+ fn foo();
+
+ pub //~ ERROR the name `foo` is defined multiple times
+ fn foo();
+
+ pub //~ ERROR the name `foo` is defined multiple times
+ static mut foo: u32;
+}
+
+fn main() {
+}
--- /dev/null
+error[E0428]: the name `foo` is defined multiple times
+ --> $DIR/issue-28472.rs:16:3
+ |
+LL | fn foo();
+ | --------- previous definition of the value `foo` here
+LL |
+LL | / pub //~ ERROR the name `foo` is defined multiple times
+LL | | fn foo();
+ | |___________^ `foo` redefined here
+ |
+ = note: `foo` must be defined only once in the value namespace of this module
+
+error[E0428]: the name `foo` is defined multiple times
+ --> $DIR/issue-28472.rs:19:3
+ |
+LL | fn foo();
+ | --------- previous definition of the value `foo` here
+...
+LL | / pub //~ ERROR the name `foo` is defined multiple times
+LL | | static mut foo: u32;
+ | |______________________^ `foo` redefined here
+ |
+ = note: `foo` must be defined only once in the value namespace of this module
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0428`.
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+enum foo { alpha, beta(isize) }
+
+fn main() {
+ match foo::alpha {
+ foo::alpha | foo::beta(i) => {}
+ //~^ ERROR variable `i` is not bound in all patterns
+ }
+}
--- /dev/null
+error[E0408]: variable `i` is not bound in all patterns
+ --> $DIR/issue-2849.rs:15:7
+ |
+LL | foo::alpha | foo::beta(i) => {}
+ | ^^^^^^^^^^ - variable not in all patterns
+ | |
+ | pattern doesn't bind `i`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0408`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub trait Foo<RHS=Self> {
+ type Assoc;
+}
+
+pub trait Bar: Foo<Assoc=()> {
+ fn new(&self, b: &
+ Bar //~ ERROR the trait `Bar` cannot be made into an object
+ <Assoc=()>
+ );
+}
+
+fn main() {}
--- /dev/null
+error[E0038]: the trait `Bar` cannot be made into an object
+ --> $DIR/issue-28576.rs:17:12
+ |
+LL | / Bar //~ ERROR the trait `Bar` cannot be made into an object
+LL | | <Assoc=()>
+ | |________________________^ the trait `Bar` cannot be made into an object
+ |
+ = note: the trait cannot use `Self` as a type parameter in the supertraits or where-clauses
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0038`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Regression test for issue #28586
+
+pub trait Foo {}
+impl Foo for [u8; usize::BYTES] {}
+//~^ ERROR no associated item named `BYTES` found for type `usize`
+
+fn main() { }
--- /dev/null
+error[E0599]: no associated item named `BYTES` found for type `usize` in the current scope
+ --> $DIR/issue-28586.rs:14:19
+ |
+LL | impl Foo for [u8; usize::BYTES] {}
+ | ^^^^^^^^^^^^ associated item not found in `usize`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Bar {
+ type Bar;
+}
+
+struct ArrayPeano<T: Bar> {
+ data: T::Bar,
+}
+
+fn foo<T>(a: &ArrayPeano<T>) -> &[T] where T: Bar {
+ unsafe { std::mem::transmute(a) } //~ ERROR transmute called with types of different sizes
+}
+
+impl Bar for () {
+ type Bar = ();
+}
+
+fn main() {
+ let x: ArrayPeano<()> = ArrayPeano { data: () };
+ foo(&x);
+}
--- /dev/null
+error[E0512]: transmute called with types of different sizes
+ --> $DIR/issue-28625.rs:20:14
+ |
+LL | unsafe { std::mem::transmute(a) } //~ ERROR transmute called with types of different sizes
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: source type: &ArrayPeano<T> (64 bits)
+ = note: target type: &[T] (128 bits)
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0512`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Can't use constants as tuple struct patterns
+
+
+const C1: i32 = 0;
+
+struct S;
+
+impl S {
+ const C2: i32 = 0;
+}
+
+fn main() {
+ if let C1(..) = 0 {} //~ ERROR expected tuple struct/variant, found constant `C1`
+ if let S::C2(..) = 0 {}
+ //~^ ERROR expected tuple struct/variant, found associated constant `<S>::C2`
+}
--- /dev/null
+error[E0532]: expected tuple struct/variant, found constant `C1`
+ --> $DIR/issue-28992-empty.rs:23:12
+ |
+LL | if let C1(..) = 0 {} //~ ERROR expected tuple struct/variant, found constant `C1`
+ | ^^ not a tuple struct/variant
+
+error[E0164]: expected tuple struct/variant, found associated constant `<S>::C2`
+ --> $DIR/issue-28992-empty.rs:24:12
+ |
+LL | if let S::C2(..) = 0 {}
+ | ^^^^^^^^^ not a tuple variant or struct
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0164, E0532.
+For more information about an error, try `rustc --explain E0164`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+macro_rules! foo {
+ ($d:expr) => {{
+ fn bar(d: u8) { }
+ bar(&mut $d);
+ //~^ ERROR mismatched types
+ //~| expected u8, found &mut u8
+ //~| expected type `u8`
+ //~| found type `&mut u8`
+ }}
+}
+
+fn main() {
+ foo!(0u8);
+ //~^ in this expansion of foo!
+}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-29084.rs:14:13
+ |
+LL | bar(&mut $d);
+ | ^^^^^^^ expected u8, found &mut u8
+...
+LL | foo!(0u8);
+ | ---------- in this macro invocation
+ |
+ = note: expected type `u8`
+ found type `&mut u8`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![recursion_limit="1024"]
+
+pub struct S0<T>(T,T);
+pub struct S1<T>(Option<Box<S0<S0<T>>>>,Option<Box<S0<S0<T>>>>);
+pub struct S2<T>(Option<Box<S1<S1<T>>>>,Option<Box<S1<S1<T>>>>);
+pub struct S3<T>(Option<Box<S2<S2<T>>>>,Option<Box<S2<S2<T>>>>);
+pub struct S4<T>(Option<Box<S3<S3<T>>>>,Option<Box<S3<S3<T>>>>);
+pub struct S5<T>(Option<Box<S4<S4<T>>>>,Option<Box<S4<S4<T>>>>,Option<T>);
+
+trait Foo { fn xxx(&self); }
+trait Bar {} // anything local or #[fundamental]
+
+impl<T> Foo for T where T: Bar, T: Sync {
+ fn xxx(&self) {}
+}
+
+impl Foo for S5<u32> { fn xxx(&self) {} }
+impl Foo for S5<u64> { fn xxx(&self) {} }
+
+fn main() {
+ let _ = <S5<_>>::xxx; //~ ERROR cannot resolve `S5<_>: Foo`
+}
--- /dev/null
+error[E0283]: type annotations required: cannot resolve `S5<_>: Foo`
+ --> $DIR/issue-29147.rs:31:13
+ |
+LL | let _ = <S5<_>>::xxx; //~ ERROR cannot resolve `S5<_>: Foo`
+ | ^^^^^^^^^^^^
+ |
+note: required by `Foo::xxx`
+ --> $DIR/issue-29147.rs:20:13
+ |
+LL | trait Foo { fn xxx(&self); }
+ | ^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0283`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+mod a {
+ struct A;
+
+ impl Default for A {
+ pub fn default() -> A { //~ ERROR unnecessary visibility qualifier
+ A
+ }
+ }
+}
+
+
+fn main() {
+ a::A::default();
+ //~^ ERROR struct `A` is private
+ }
--- /dev/null
+error[E0449]: unnecessary visibility qualifier
+ --> $DIR/issue-29161.rs:15:9
+ |
+LL | pub fn default() -> A { //~ ERROR unnecessary visibility qualifier
+ | ^^^ `pub` not permitted here because it's implied
+
+error[E0603]: struct `A` is private
+ --> $DIR/issue-29161.rs:23:5
+ |
+LL | a::A::default();
+ | ^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0449, E0603.
+For more information about an error, try `rustc --explain E0449`.
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ let x: typeof(92) = 92; //~ ERROR `typeof` is a reserved keyword
+}
--- /dev/null
+error[E0516]: `typeof` is a reserved keyword but unimplemented
+ --> $DIR/issue-29184.rs:12:12
+ |
+LL | let x: typeof(92) = 92; //~ ERROR `typeof` is a reserved keyword
+ | ^^^^^^^^^^ reserved keyword
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0516`.
--- /dev/null
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use m::f as x; //~ ERROR unresolved import `m::f` [E0432]
+ //~^ no `f` in `m`
+
+mod m {}
+
+fn main() {}
--- /dev/null
+error[E0432]: unresolved import `m::f`
+ --> $DIR/issue-2937.rs:11:5
+ |
+LL | use m::f as x; //~ ERROR unresolved import `m::f` [E0432]
+ | ^^^^^^^^^ no `f` in `m`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0432`.
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn foo<T, U>(x: T, y: U) {
+ let mut xx = x;
+ xx = y;
+ //~^ ERROR mismatched types
+ //~| expected type `T`
+ //~| found type `U`
+ //~| expected type parameter, found a different type parameter
+}
+
+fn main() {
+}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-2951.rs:13:10
+ |
+LL | xx = y;
+ | ^ expected type parameter, found a different type parameter
+ |
+ = note: expected type `T`
+ found type `U`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+
+#![feature(rustc_attrs)]
+
+use std::marker::PhantomData;
+
+pub trait Foo<P> {}
+
+impl <P, T: Foo<P>> Foo<P> for Option<T> {}
+
+pub struct Qux<T> (PhantomData<*mut T>);
+
+impl<T> Foo<*mut T> for Option<Qux<T>> {}
+
+pub trait Bar {
+ type Output: 'static;
+}
+
+impl<T: 'static, W: Bar<Output = T>> Foo<*mut T> for W {}
+
+#[rustc_error]
+fn main() {} //~ ERROR compilation successful
--- /dev/null
+error: compilation successful
+ --> $DIR/issue-29857.rs:31:1
+ |
+LL | fn main() {} //~ ERROR compilation successful
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub trait MakeRef<'a> {
+ type Ref;
+}
+impl<'a, T: 'a> MakeRef<'a> for T {
+ type Ref = &'a T;
+}
+
+pub trait MakeRef2 {
+ type Ref2;
+}
+impl<'a, T: 'a> MakeRef2 for T {
+//~^ ERROR the lifetime parameter `'a` is not constrained
+ type Ref2 = <T as MakeRef<'a>>::Ref;
+}
+
+fn foo() -> <String as MakeRef2>::Ref2 { &String::from("foo") }
+
+fn main() {
+ println!("{}", foo());
+}
--- /dev/null
+error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
+ --> $DIR/issue-29861.rs:21:6
+ |
+LL | impl<'a, T: 'a> MakeRef2 for T {
+ | ^^ unconstrained lifetime parameter
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0207`.
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn bad (p: *const isize) {
+ let _q: &isize = p as &isize; //~ ERROR non-primitive cast
+}
+
+fn main() { }
--- /dev/null
+error[E0605]: non-primitive cast: `*const isize` as `&isize`
+ --> $DIR/issue-2995.rs:12:22
+ |
+LL | let _q: &isize = p as &isize; //~ ERROR non-primitive cast
+ | ^^^^^^^^^^^
+ |
+ = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0605`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct SemiPriv;
+
+mod m1 {
+ struct Priv;
+ impl ::SemiPriv {
+ pub fn f(_: Priv) {} //~ WARN private type `m1::Priv` in public interface
+ //~^ WARNING hard error
+ }
+
+ impl Priv {
+ pub fn f(_: Priv) {} // ok
+ }
+}
+
+mod m2 {
+ struct Priv;
+ impl ::std::ops::Deref for ::SemiPriv {
+ type Target = Priv; //~ ERROR private type `m2::Priv` in public interface
+ fn deref(&self) -> &Self::Target { unimplemented!() }
+ }
+
+ impl ::std::ops::Deref for Priv {
+ type Target = Priv; // ok
+ fn deref(&self) -> &Self::Target { unimplemented!() }
+ }
+}
+
+trait SemiPrivTrait {
+ type Assoc;
+}
+
+mod m3 {
+ struct Priv;
+ impl ::SemiPrivTrait for () {
+ type Assoc = Priv; //~ ERROR private type `m3::Priv` in public interface
+ }
+}
+
+fn main() {}
--- /dev/null
+warning: private type `m1::Priv` in public interface (error E0446)
+ --> $DIR/issue-30079.rs:16:9
+ |
+LL | pub fn f(_: Priv) {} //~ WARN private type `m1::Priv` in public interface
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: #[warn(private_in_public)] on by default
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+
+error[E0446]: private type `m2::Priv` in public interface
+ --> $DIR/issue-30079.rs:28:9
+ |
+LL | struct Priv;
+ | - `m2::Priv` declared as private
+LL | impl ::std::ops::Deref for ::SemiPriv {
+LL | type Target = Priv; //~ ERROR private type `m2::Priv` in public interface
+ | ^^^^^^^^^^^^^^^^^^^ can't leak private type
+
+error[E0446]: private type `m3::Priv` in public interface
+ --> $DIR/issue-30079.rs:45:9
+ |
+LL | struct Priv;
+ | - `m3::Priv` declared as private
+LL | impl ::SemiPrivTrait for () {
+LL | type Assoc = Priv; //~ ERROR private type `m3::Priv` in public interface
+ | ^^^^^^^^^^^^^^^^^^ can't leak private type
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0446`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::marker;
+
+enum E1 { V1(E2<E1>), }
+enum E2<T> { V2(E2<E1>, marker::PhantomData<T>), }
+//~^ ERROR recursive type `E2` has infinite size
+
+impl E1 { fn foo(&self) {} }
+
+fn main() {
+}
--- /dev/null
+error[E0072]: recursive type `E2` has infinite size
+ --> $DIR/issue-3008-3.rs:14:1
+ |
+LL | enum E2<T> { V2(E2<E1>, marker::PhantomData<T>), }
+ | ^^^^^^^^^^ ------ recursive without indirection
+ | |
+ | recursive type has infinite size
+ |
+ = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `E2` representable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0072`.
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn siphash(k0 : u64) {
+
+ struct siphash {
+ v0: u64,
+ }
+
+ impl siphash {
+ pub fn reset(&mut self) {
+ self.v0 = k0 ^ 0x736f6d6570736575; //~ ERROR can't capture dynamic environment
+ }
+ }
+}
+
+fn main() {}
--- /dev/null
+error[E0434]: can't capture dynamic environment in a fn item
+ --> $DIR/issue-3021-b.rs:19:22
+ |
+LL | self.v0 = k0 ^ 0x736f6d6570736575; //~ ERROR can't capture dynamic environment
+ | ^^
+ |
+ = help: use the `|| { ... }` closure form instead
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0434`.
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn siphash<T>() {
+
+ trait t {
+ fn g(&self, x: T) -> T; //~ ERROR can't use type parameters from outer function
+ //~^ ERROR can't use type parameters from outer function
+ }
+}
+
+fn main() {}
--- /dev/null
+error[E0401]: can't use type parameters from outer function
+ --> $DIR/issue-3021-c.rs:14:24
+ |
+LL | fn siphash<T>() {
+ | - type variable from outer function
+...
+LL | fn g(&self, x: T) -> T; //~ ERROR can't use type parameters from outer function
+ | - ^ use of type variable from outer function
+ | |
+ | help: try using a local type parameter instead: `g<T>`
+
+error[E0401]: can't use type parameters from outer function
+ --> $DIR/issue-3021-c.rs:14:30
+ |
+LL | fn siphash<T>() {
+ | - type variable from outer function
+...
+LL | fn g(&self, x: T) -> T; //~ ERROR can't use type parameters from outer function
+ | - ^ use of type variable from outer function
+ | |
+ | help: try using a local type parameter instead: `g<T>`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0401`.
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait siphash {
+ fn result(&self) -> u64;
+ fn reset(&self);
+}
+
+fn siphash(k0 : u64, k1 : u64) {
+ struct SipState {
+ v0: u64,
+ v1: u64,
+ }
+
+ fn mk_result(st : &SipState) -> u64 {
+
+ let v0 = st.v0;
+ let v1 = st.v1;
+ return v0 ^ v1;
+ }
+
+ impl siphash for SipState {
+ fn reset(&self) {
+ self.v0 = k0 ^ 0x736f6d6570736575; //~ ERROR can't capture dynamic environment
+ self.v1 = k1 ^ 0x646f72616e646f6d; //~ ERROR can't capture dynamic environment
+ }
+ fn result(&self) -> u64 { return mk_result(self); }
+ }
+}
+
+fn main() {}
--- /dev/null
+error[E0434]: can't capture dynamic environment in a fn item
+ --> $DIR/issue-3021-d.rs:31:23
+ |
+LL | self.v0 = k0 ^ 0x736f6d6570736575; //~ ERROR can't capture dynamic environment
+ | ^^
+ |
+ = help: use the `|| { ... }` closure form instead
+
+error[E0434]: can't capture dynamic environment in a fn item
+ --> $DIR/issue-3021-d.rs:32:23
+ |
+LL | self.v1 = k1 ^ 0x646f72616e646f6d; //~ ERROR can't capture dynamic environment
+ | ^^
+ |
+ = help: use the `|| { ... }` closure form instead
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0434`.
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait SipHash {
+ fn reset(&self);
+}
+
+fn siphash(k0 : u64) {
+ struct SipState {
+ v0: u64,
+ }
+
+ impl SipHash for SipState {
+ fn reset(&self) {
+ self.v0 = k0 ^ 0x736f6d6570736575; //~ ERROR can't capture dynamic environment
+ }
+ }
+ panic!();
+}
+
+fn main() {}
--- /dev/null
+error[E0434]: can't capture dynamic environment in a fn item
+ --> $DIR/issue-3021.rs:22:22
+ |
+LL | self.v0 = k0 ^ 0x736f6d6570736575; //~ ERROR can't capture dynamic environment
+ | ^^
+ |
+ = help: use the `|| { ... }` closure form instead
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0434`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Regression test for #30225, which was an ICE that would trigger as
+// a result of a poor interaction between trait result caching and
+// type inference. Specifically, at that time, unification could cause
+// unrelated type variables to become instantiated, if subtyping
+// relationships existed. These relationships are now propagated
+// through obligations and hence everything works out fine.
+
+trait Foo<U,V> : Sized {
+ fn foo(self, u: Option<U>, v: Option<V>) {}
+}
+
+struct A;
+struct B;
+
+impl Foo<A, B> for () {} // impl A
+impl Foo<u32, u32> for u32 {} // impl B, creating ambiguity
+
+fn toxic() {
+ // cache the resolution <() as Foo<$0,$1>> = impl A
+ let u = None;
+ let v = None;
+ Foo::foo((), u, v);
+}
+
+fn bomb() {
+ let mut u = None; // type is Option<$0>
+ let mut v = None; // type is Option<$1>
+ let mut x = None; // type is Option<$2>
+
+ Foo::foo(x.unwrap(),u,v); // register <$2 as Foo<$0, $1>>
+ u = v; // mark $0 and $1 in a subtype relationship
+ //~^ ERROR mismatched types
+ x = Some(()); // set $2 = (), allowing impl selection
+ // to proceed for <() as Foo<$0, $1>> = impl A.
+ // kaboom, this *used* to trigge an ICE
+}
+
+fn main() {}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-30225.rs:41:9
+ |
+LL | u = v; // mark $0 and $1 in a subtype relationship
+ | ^ expected struct `A`, found struct `B`
+ |
+ = note: expected type `A`
+ found type `B`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+type Foo<
+ Unused //~ ERROR type parameter `Unused` is unused
+ > = u8;
+
+fn main() {
+
+}
+
--- /dev/null
+error[E0091]: type parameter `Unused` is unused
+ --> $DIR/issue-30236.rs:12:5
+ |
+LL | Unused //~ ERROR type parameter `Unused` is unused
+ | ^^^^^^ unused type parameter
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0091`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![deny(unreachable_patterns)]
+
+fn main() {
+ match "world" {
+ "hello" => {}
+ _ => {},
+ }
+
+ match "world" {
+ ref _x if false => {}
+ "hello" => {}
+ "hello" => {} //~ ERROR unreachable pattern
+ _ => {},
+ }
+}
+
--- /dev/null
+error: unreachable pattern
+ --> $DIR/issue-30240-b.rs:22:9
+ |
+LL | "hello" => {} //~ ERROR unreachable pattern
+ | ^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/issue-30240-b.rs:11:9
+ |
+LL | #![deny(unreachable_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ match "world" { //~ ERROR non-exhaustive patterns: `&_`
+ "hello" => {}
+ }
+
+ match "world" { //~ ERROR non-exhaustive patterns: `&_`
+ ref _x if false => {}
+ "hello" => {}
+ }
+}
--- /dev/null
+error[E0004]: non-exhaustive patterns: `&_` not covered
+ --> $DIR/issue-30240.rs:12:11
+ |
+LL | match "world" { //~ ERROR non-exhaustive patterns: `&_`
+ | ^^^^^^^ pattern `&_` not covered
+
+error[E0004]: non-exhaustive patterns: `&_` not covered
+ --> $DIR/issue-30240.rs:16:11
+ |
+LL | match "world" { //~ ERROR non-exhaustive patterns: `&_`
+ | ^^^^^^^ pattern `&_` not covered
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0004`.
--- /dev/null
+error[E0508]: cannot move out of type `[u8]`, a non-copy slice
+ --> $DIR/issue-30355.rs:15:8
+ |
+LL | &X(*Y)
+ | ^^ cannot move out of here
+
+error[E0161]: cannot move a value of type X: the size of X cannot be statically determined
+ --> $DIR/issue-30355.rs:15:6
+ |
+LL | &X(*Y)
+ | ^^^^^
+
+error[E0161]: cannot move a value of type [u8]: the size of [u8] cannot be statically determined
+ --> $DIR/issue-30355.rs:15:8
+ |
+LL | &X(*Y)
+ | ^^
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0161, E0508.
+For more information about an error, try `rustc --explain E0161`.
--- /dev/null
+// 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.
+
+pub struct X([u8]);
+
+pub static Y: &'static X = {
+ const Y: &'static [u8] = b"";
+ &X(*Y)
+ //~^ ERROR cannot move out
+ //~^^ ERROR cannot move a
+ //~^^^ ERROR cannot move a
+};
+
+fn main() {}
--- /dev/null
+error[E0161]: cannot move a value of type X: the size of X cannot be statically determined
+ --> $DIR/issue-30355.rs:15:6
+ |
+LL | &X(*Y)
+ | ^^^^^
+
+error[E0161]: cannot move a value of type [u8]: the size of [u8] cannot be statically determined
+ --> $DIR/issue-30355.rs:15:8
+ |
+LL | &X(*Y)
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/issue-30355.rs:15:8
+ |
+LL | &X(*Y)
+ | ^^ cannot move out of borrowed content
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0161, E0507.
+For more information about an error, try `rustc --explain E0161`.
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+enum f { g(isize, isize) }
+
+enum h { i(j, k) }
+
+enum j { l(isize, isize) }
+enum k { m(isize, isize) }
+
+fn main()
+{
+
+ let _z = match f::g(1, 2) {
+ f::g(x, x) => { println!("{}", x + x); }
+ //~^ ERROR identifier `x` is bound more than once in the same pattern
+ };
+
+ let _z = match h::i(j::l(1, 2), k::m(3, 4)) {
+ h::i(j::l(x, _), k::m(_, x))
+ //~^ ERROR identifier `x` is bound more than once in the same pattern
+ => { println!("{}", x + x); }
+ };
+
+ let _z = match (1, 2) {
+ (x, x) => { x } //~ ERROR identifier `x` is bound more than once in the same pattern
+ };
+
+}
--- /dev/null
+error[E0416]: identifier `x` is bound more than once in the same pattern
+ --> $DIR/issue-3038.rs:22:15
+ |
+LL | f::g(x, x) => { println!("{}", x + x); }
+ | ^ used in a pattern more than once
+
+error[E0416]: identifier `x` is bound more than once in the same pattern
+ --> $DIR/issue-3038.rs:27:32
+ |
+LL | h::i(j::l(x, _), k::m(_, x))
+ | ^ used in a pattern more than once
+
+error[E0416]: identifier `x` is bound more than once in the same pattern
+ --> $DIR/issue-3038.rs:33:13
+ |
+LL | (x, x) => { x } //~ ERROR identifier `x` is bound more than once in the same pattern
+ | ^ used in a pattern more than once
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0416`.
--- /dev/null
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/issue-30438-a.rs:22:17
+ |
+LL | return &Test { s: &self.s};
+ | ^^^^^^^^^^^^^^^^^^- temporary value only lives until here
+ | |
+ | temporary value does not live long enough
+ |
+note: borrowed value must be valid for the anonymous lifetime #1 defined on the method body at 21:5...
+ --> $DIR/issue-30438-a.rs:21:5
+ |
+LL | / fn index(&self, _: usize) -> &Self::Output {
+LL | | return &Test { s: &self.s};
+LL | | //~^ ERROR: borrowed value does not live long enough
+LL | | }
+ | |_____^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Original regression test for Issue #30438.
+
+use std::ops::Index;
+
+struct Test<'a> {
+ s: &'a String
+}
+
+impl <'a> Index<usize> for Test<'a> {
+ type Output = Test<'a>;
+ fn index(&self, _: usize) -> &Self::Output {
+ return &Test { s: &self.s};
+ //~^ ERROR: borrowed value does not live long enough
+ }
+}
+
+fn main() {
+ let s = "Hello World".to_string();
+ let test = Test{s: &s};
+ let r = &test[0];
+ println!("{}", test.s); // OK since test is valid
+ println!("{}", r.s); // Segfault since value pointed by r has already been dropped
+}
--- /dev/null
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/issue-30438-a.rs:22:17
+ |
+LL | return &Test { s: &self.s};
+ | ^^^^^^^^^^^^^^^^^^- temporary value only lives until here
+ | |
+ | temporary value does not live long enough
+ |
+note: borrowed value must be valid for the anonymous lifetime #1 defined on the method body at 21:5...
+ --> $DIR/issue-30438-a.rs:21:5
+ |
+LL | / fn index(&self, _: usize) -> &Self::Output {
+LL | | return &Test { s: &self.s};
+LL | | //~^ ERROR: borrowed value does not live long enough
+LL | | }
+ | |_____^
+ = note: consider using a `let` binding to increase its lifetime
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Modified regression test for Issue #30438 that exposed an
+// independent issue (see discussion on ticket).
+
+use std::ops::Index;
+
+struct Test<'a> {
+ s: &'a String
+}
+
+impl <'a> Index<usize> for Test<'a> {
+ type Output = Test<'a>;
+ fn index(&self, _: usize) -> &Self::Output {
+ &Test { s: &self.s}
+ //~^ ERROR: borrowed value does not live long enough
+ }
+}
+
+fn main() {
+ let s = "Hello World".to_string();
+ let test = Test{s: &s};
+ let r = &test[0];
+ println!("{}", test.s); // OK since test is valid
+ println!("{}", r.s); // Segfault since value pointed by r has already been dropped
+}
--- /dev/null
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/issue-30438-b.rs:23:10
+ |
+LL | &Test { s: &self.s}
+ | ^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
+LL | //~^ ERROR: borrowed value does not live long enough
+LL | }
+ | - temporary value only lives until here
+ |
+note: borrowed value must be valid for the anonymous lifetime #1 defined on the method body at 22:5...
+ --> $DIR/issue-30438-b.rs:22:5
+ |
+LL | / fn index(&self, _: usize) -> &Self::Output {
+LL | | &Test { s: &self.s}
+LL | | //~^ ERROR: borrowed value does not live long enough
+LL | | }
+ | |_____^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
--- /dev/null
+error[E0597]: `x` does not live long enough
+ --> $DIR/issue-30438-c.rs:19:5
+ |
+LL | &x
+ | ^^ borrowed value does not live long enough
+LL | //~^ ERROR: `x` does not live long enough
+LL | }
+ | - borrowed value only lives until here
+ |
+note: borrowed value must be valid for the lifetime 'y as defined on the function body at 17:10...
+ --> $DIR/issue-30438-c.rs:17:10
+ |
+LL | fn silly<'y, 'z>(_s: &'y Test<'z>) -> &'y <Test<'z> as Trait>::Out where 'z: 'static {
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Simplified regression test for #30438, inspired by arielb1.
+
+trait Trait { type Out; }
+
+struct Test<'a> { s: &'a str }
+
+fn silly<'y, 'z>(_s: &'y Test<'z>) -> &'y <Test<'z> as Trait>::Out where 'z: 'static {
+ let x = Test { s: "this cannot last" };
+ &x
+ //~^ ERROR: `x` does not live long enough
+}
+
+impl<'b> Trait for Test<'b> { type Out = Test<'b>; }
+
+fn main() {
+ let orig = Test { s: "Hello World" };
+ let r = silly(&orig);
+ println!("{}", orig.s); // OK since `orig` is valid
+ println!("{}", r.s); // Segfault (method does not return a sane value)
+}
--- /dev/null
+error[E0597]: `x` does not live long enough
+ --> $DIR/issue-30438-c.rs:19:6
+ |
+LL | &x
+ | ^ borrowed value does not live long enough
+LL | //~^ ERROR: `x` does not live long enough
+LL | }
+ | - borrowed value only lives until here
+ |
+note: borrowed value must be valid for the lifetime 'y as defined on the function body at 17:10...
+ --> $DIR/issue-30438-c.rs:17:10
+ |
+LL | fn silly<'y, 'z>(_s: &'y Test<'z>) -> &'y <Test<'z> as Trait>::Out where 'z: 'static {
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+type Alias = ();
+use Alias::*;
+//~^ ERROR unresolved import `Alias` [E0432]
+//~| Not a module `Alias`
+use std::io::Result::*;
+//~^ ERROR unresolved import `std::io::Result` [E0432]
+//~| Not a module `Result`
+
+trait T {}
+use T::*; //~ ERROR items in traits are not importable
+
+fn main() {}
--- /dev/null
+error: items in traits are not importable.
+ --> $DIR/issue-30560.rs:20:5
+ |
+LL | use T::*; //~ ERROR items in traits are not importable
+ | ^^^^
+
+error[E0432]: unresolved import `Alias`
+ --> $DIR/issue-30560.rs:12:5
+ |
+LL | use Alias::*;
+ | ^^^^^ Not a module `Alias`
+
+error[E0432]: unresolved import `std::io::Result`
+ --> $DIR/issue-30560.rs:15:14
+ |
+LL | use std::io::Result::*;
+ | ^^^^^^ Not a module `Result`
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0432`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::fmt;
+
+impl fmt::Display for DecoderError { //~ ERROR cannot find type `DecoderError` in this scope
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ write!(f, "Missing data: {}", self.0)
+ }
+}
+fn main() {
+}
--- /dev/null
+error[E0412]: cannot find type `DecoderError` in this scope
+ --> $DIR/issue-30589.rs:13:23
+ |
+LL | impl fmt::Display for DecoderError { //~ ERROR cannot find type `DecoderError` in this scope
+ | ^^^^^^^^^^^^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0412`.
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct x(());
+impl x {
+ pub unsafe fn with(&self) { }
+}
+
+fn main() {
+ x(()).with(); //~ ERROR requires unsafe function or block
+}
--- /dev/null
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/issue-3080.rs:17:5
+ |
+LL | x(()).with(); //~ ERROR requires unsafe function or block
+ | ^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0133`.
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ match () { } //~ ERROR non-exhaustive
+}
--- /dev/null
+error[E0004]: non-exhaustive patterns: type () is non-empty
+ --> $DIR/issue-3096-1.rs:12:11
+ |
+LL | match () { } //~ ERROR non-exhaustive
+ | ^^
+ |
+help: Please ensure that all possible cases are being handled; possibly adding wildcards or more match arms.
+ --> $DIR/issue-3096-1.rs:12:11
+ |
+LL | match () { } //~ ERROR non-exhaustive
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0004`.
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+enum bottom { }
+
+fn main() {
+ let x = &() as *const () as *const bottom;
+ match x { } //~ ERROR non-exhaustive patterns
+}
--- /dev/null
+error[E0004]: non-exhaustive patterns: type *const bottom is non-empty
+ --> $DIR/issue-3096-2.rs:15:11
+ |
+LL | match x { } //~ ERROR non-exhaustive patterns
+ | ^
+ |
+help: Please ensure that all possible cases are being handled; possibly adding wildcards or more match arms.
+ --> $DIR/issue-3096-2.rs:15:11
+ |
+LL | match x { } //~ ERROR non-exhaustive patterns
+ | ^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0004`.
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+enum a { b, c }
+
+enum a { d, e } //~ ERROR the name `a` is defined multiple times
+
+fn main() {}
--- /dev/null
+error[E0428]: the name `a` is defined multiple times
+ --> $DIR/issue-3099-a.rs:13:1
+ |
+LL | enum a { b, c }
+ | ------ previous definition of the type `a` here
+LL |
+LL | enum a { d, e } //~ ERROR the name `a` is defined multiple times
+ | ^^^^^^ `a` redefined here
+ |
+ = note: `a` must be defined only once in the type namespace of this module
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0428`.
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub mod a {}
+
+pub mod a {} //~ ERROR the name `a` is defined multiple times
+
+fn main() {}
--- /dev/null
+error[E0428]: the name `a` is defined multiple times
+ --> $DIR/issue-3099-b.rs:13:1
+ |
+LL | pub mod a {}
+ | --------- previous definition of the module `a` here
+LL |
+LL | pub mod a {} //~ ERROR the name `a` is defined multiple times
+ | ^^^^^^^^^ `a` redefined here
+ |
+ = note: `a` must be defined only once in the type namespace of this module
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0428`.
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn a(x: String) -> String {
+ format!("First function with {}", x)
+}
+
+fn a(x: String, y: String) -> String { //~ ERROR the name `a` is defined multiple times
+ format!("Second function with {} and {}", x, y)
+}
+
+fn main() {
+ println!("Result: ");
+}
--- /dev/null
+error[E0428]: the name `a` is defined multiple times
+ --> $DIR/issue-3099.rs:15:1
+ |
+LL | fn a(x: String) -> String {
+ | ------------------------- previous definition of the value `a` here
+...
+LL | fn a(x: String, y: String) -> String { //~ ERROR the name `a` is defined multiple times
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `a` redefined here
+ |
+ = note: `a` must be defined only once in the value namespace of this module
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0428`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+macro_rules! log {
+ ( $ctx:expr, $( $args:expr),* ) => {
+ if $ctx.trace {
+ //~^ no field `trace` on type `&T`
+ println!( $( $args, )* );
+ }
+ }
+}
+
+// Create a structure.
+struct Foo {
+ trace: bool,
+}
+
+// Generic wrapper calls log! with a structure.
+fn wrap<T>(context: &T) -> ()
+{
+ log!(context, "entered wrapper");
+ //~^ in this expansion of log!
+}
+
+fn main() {
+ // Create a structure.
+ let x = Foo { trace: true };
+ log!(x, "run started");
+ // Apply a closure which accesses internal fields.
+ wrap(&x);
+ log!(x, "run finished");
+}
--- /dev/null
+error[E0609]: no field `trace` on type `&T`
+ --> $DIR/issue-31011.rs:13:17
+ |
+LL | if $ctx.trace {
+ | ^^^^^
+...
+LL | log!(context, "entered wrapper");
+ | --------------------------------- in this macro invocation
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0609`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ // FIXME(#31407) this error should go away, but in the meantime we test that it
+ // is accompanied by a somewhat useful error message.
+ let _: f64 = 1234567890123456789012345678901234567890e-340;
+ //~^ ERROR could not evaluate float literal (see issue #31407)
+}
--- /dev/null
+error: could not evaluate float literal (see issue #31407)
+ --> $DIR/issue-31109.rs:14:18
+ |
+LL | let _: f64 = 1234567890123456789012345678901234567890e-340;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::vec::IntoIter;
+
+pub fn get_tok(it: &mut IntoIter<u8>) {
+ let mut found_e = false;
+
+ let temp: Vec<u8> = it.take_while(|&x| {
+ found_e = true;
+ false
+ })
+ .cloned()
+ //~^ ERROR type mismatch resolving
+ //~| expected type `u8`
+ //~| found type `&_`
+ .collect(); //~ ERROR no method named `collect`
+}
+
+fn main() {}
--- /dev/null
+error[E0271]: type mismatch resolving `<std::iter::TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:16:39: 19:6 found_e:_]> as std::iter::Iterator>::Item == &_`
+ --> $DIR/issue-31173.rs:20:10
+ |
+LL | .cloned()
+ | ^^^^^^ expected u8, found reference
+ |
+ = note: expected type `u8`
+ found type `&_`
+
+error[E0599]: no method named `collect` found for type `std::iter::Cloned<std::iter::TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:16:39: 19:6 found_e:_]>>` in the current scope
+ --> $DIR/issue-31173.rs:24:10
+ |
+LL | .collect(); //~ ERROR no method named `collect`
+ | ^^^^^^^
+ |
+ = note: the method `collect` exists but the following trait bounds were not satisfied:
+ `std::iter::Cloned<std::iter::TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:16:39: 19:6 found_e:_]>> : std::iter::Iterator`
+ `&mut std::iter::Cloned<std::iter::TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:16:39: 19:6 found_e:_]>> : std::iter::Iterator`
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0271, E0599.
+For more information about an error, try `rustc --explain E0271`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// This checks that a path that cannot be resolved because of an indeterminate import
+// does not trigger an ICE.
+
+mod foo {
+ pub use self::*; //~ ERROR unresolved
+}
+
+fn main() {
+ foo::f(); //~ ERROR cannot find function `f` in module `foo`
+}
--- /dev/null
+error[E0432]: unresolved import `self::*`
+ --> $DIR/issue-31212.rs:15:13
+ |
+LL | pub use self::*; //~ ERROR unresolved
+ | ^^^^^^^ Cannot glob-import a module into itself.
+
+error[E0425]: cannot find function `f` in module `foo`
+ --> $DIR/issue-31212.rs:19:10
+ |
+LL | foo::f(); //~ ERROR cannot find function `f` in module `foo`
+ | ^ not found in `foo`
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0425, E0432.
+For more information about an error, try `rustc --explain E0425`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags: --cfg foo(bar)
+// error-pattern: invalid predicate in --cfg command line argument: `foo`
+fn main() {}
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn cast_thin_to_fat(x: *const ()) {
+ x as *const [u8];
+ //~^ ERROR: cannot cast thin pointer `*const ()` to fat pointer `*const [u8]`
+}
+
+fn main() {}
--- /dev/null
+error[E0607]: cannot cast thin pointer `*const ()` to fat pointer `*const [u8]`
+ --> $DIR/issue-31511.rs:12:5
+ |
+LL | x as *const [u8];
+ | ^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0607`.
--- /dev/null
+warning: not reporting region error due to nll
+ --> $DIR/issue-3154.rs:16:15
+ |
+LL | thing{ x: x } //~ ERROR 16:5: 16:18: explicit lifetime required in the type of `x` [E0621]
+ | ^
+
+warning: not reporting region error due to nll
+ --> $DIR/issue-3154.rs:16:5
+ |
+LL | thing{ x: x } //~ ERROR 16:5: 16:18: explicit lifetime required in the type of `x` [E0621]
+ | ^^^^^
+
+error[E0621]: explicit lifetime required in the type of `x`
+ --> $DIR/issue-3154.rs:16:15
+ |
+LL | fn thing<'a,Q>(x: &Q) -> thing<'a,Q> {
+ | - consider changing the type of `x` to `&'a Q`
+LL | thing{ x: x } //~ ERROR 16:5: 16:18: explicit lifetime required in the type of `x` [E0621]
+ | ^ lifetime `'a` required
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct thing<'a, Q:'a> {
+ x: &'a Q
+}
+
+fn thing<'a,Q>(x: &Q) -> thing<'a,Q> {
+ thing{ x: x } //~ ERROR 16:5: 16:18: explicit lifetime required in the type of `x` [E0621]
+}
+
+fn main() {
+ thing(&());
+}
--- /dev/null
+error[E0621]: explicit lifetime required in the type of `x`
+ --> $DIR/issue-3154.rs:16:5
+ |
+LL | fn thing<'a,Q>(x: &Q) -> thing<'a,Q> {
+ | - consider changing the type of `x` to `&'a Q`
+LL | thing{ x: x } //~ ERROR 16:5: 16:18: explicit lifetime required in the type of `x` [E0621]
+ | ^^^^^^^^^^^^^ lifetime `'a` required
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+enum Thing {
+ Foo(u8),
+ Bar,
+ Baz
+}
+
+fn main() {
+ let Thing::Foo(y) = Thing::Foo(1);
+ //~^ ERROR refutable pattern in local binding: `Bar` not covered
+}
--- /dev/null
+error[E0005]: refutable pattern in local binding: `Bar` not covered
+ --> $DIR/issue-31561.rs:18:9
+ |
+LL | let Thing::Foo(y) = Thing::Foo(1);
+ | ^^^^^^^^^^^^^ pattern `Bar` not covered
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0005`.
--- /dev/null
+// Copyright 2012-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.
+
+fn main() {
+ #[inline] struct Foo; //~ ERROR attribute should be applied to function or closure
+ #[repr(C)] fn foo() {} //~ ERROR attribute should be applied to struct, enum or union
+}
--- /dev/null
+error[E0518]: attribute should be applied to function or closure
+ --> $DIR/issue-31769.rs:12:5
+ |
+LL | #[inline] struct Foo; //~ ERROR attribute should be applied to function or closure
+ | ^^^^^^^^^ ----------- not a function or closure
+
+error[E0517]: attribute should be applied to struct, enum or union
+ --> $DIR/issue-31769.rs:13:12
+ |
+LL | #[repr(C)] fn foo() {} //~ ERROR attribute should be applied to struct, enum or union
+ | ^ ----------- not a struct, enum or union
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0517, E0518.
+For more information about an error, try `rustc --explain E0517`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Test that error recovery in the parser to an EOF does not give an infinite
+// spew of errors.
+
+fn main() {
+ let
+} //~ ERROR expected pattern, found `}`
--- /dev/null
+error: expected pattern, found `}`
+ --> $DIR/issue-31804.rs:16:1
+ |
+LL | } //~ ERROR expected pattern, found `}`
+ | ^ expected pattern
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Checks lexical scopes cannot see through normal module boundries
+
+fn f() {
+ fn g() {}
+ mod foo {
+ fn h() {
+ g(); //~ ERROR cannot find function `g` in this scope
+ }
+ }
+}
+
+fn main() {}
--- /dev/null
+error[E0425]: cannot find function `g` in this scope
+ --> $DIR/issue-31845.rs:17:12
+ |
+LL | g(); //~ ERROR cannot find function `g` in this scope
+ | ^ did you mean `h`?
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0425`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+
+enum Enum<T: Trait> {
+ X = Trait::Number,
+ //~^ ERROR mismatched types
+ //~| expected isize, found i32
+}
+
+trait Trait {
+ const Number: i32 = 1;
+}
+
+fn main() {}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-31910.rs:13:9
+ |
+LL | X = Trait::Number,
+ | ^^^^^^^^^^^^^ expected isize, found i32
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// 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.
+
+#![feature(rustc_attrs)]
+#![deny(non_snake_case)]
+
+#[no_mangle]
+pub extern "C" fn SparklingGenerationForeignFunctionInterface() {}
+
+#[rustc_error]
+fn main() {} //~ ERROR compilation successful
--- /dev/null
+error: compilation successful
+ --> $DIR/issue-31924-non-snake-ffi.rs:18:1
+ |
+LL | fn main() {} //~ ERROR compilation successful
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+enum Foo {
+ Bar(i32),
+ Baz
+}
+
+struct S;
+
+fn main() {
+ match Foo::Baz {
+ Foo::Bar => {}
+ //~^ ERROR expected unit struct/variant or constant, found tuple variant `Foo::Bar`
+ _ => {}
+ }
+
+ match S {
+ S(()) => {}
+ //~^ ERROR expected tuple struct/variant, found unit struct `S`
+ }
+}
--- /dev/null
+error[E0532]: expected unit struct/variant or constant, found tuple variant `Foo::Bar`
+ --> $DIR/issue-32004.rs:20:9
+ |
+LL | Foo::Bar => {}
+ | ^^^^^---
+ | |
+ | did you mean `Baz`?
+
+error[E0532]: expected tuple struct/variant, found unit struct `S`
+ --> $DIR/issue-32004.rs:26:9
+ |
+LL | S(()) => {}
+ | ^ not a tuple struct/variant
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0532`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct S(u8);
+const C: S = S(10);
+
+fn main() {
+ let C(a) = S(11); //~ ERROR expected tuple struct/variant, found constant `C`
+ let C(..) = S(11); //~ ERROR expected tuple struct/variant, found constant `C`
+}
--- /dev/null
+error[E0532]: expected tuple struct/variant, found constant `C`
+ --> $DIR/issue-32086.rs:15:9
+ |
+LL | let C(a) = S(11); //~ ERROR expected tuple struct/variant, found constant `C`
+ | ^ did you mean `S`?
+
+error[E0532]: expected tuple struct/variant, found constant `C`
+ --> $DIR/issue-32086.rs:16:9
+ |
+LL | let C(..) = S(11); //~ ERROR expected tuple struct/variant, found constant `C`
+ | ^ did you mean `S`?
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0532`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(rustc_attrs)]
+#![allow(dead_code)]
+
+pub type T = ();
+mod foo { pub use super::T; }
+mod bar { pub use super::T; }
+
+pub use foo::*;
+pub use bar::*;
+
+mod baz {
+ pub type T = ();
+ mod foo { pub use super::T as S; }
+ mod bar { pub use super::foo::S as T; }
+ pub use self::bar::*;
+}
+
+#[rustc_error]
+fn main() {} //~ ERROR compilation successful
--- /dev/null
+error: compilation successful
+ --> $DIR/issue-32119.rs:29:1
+ |
+LL | fn main() {} //~ ERROR compilation successful
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn foo<T>() {
+ struct foo {
+ x: T, //~ ERROR can't use type parameters from outer function
+ }
+
+ impl<T> Drop for foo<T> {
+ //~^ ERROR wrong number of type arguments
+ fn drop(&mut self) {}
+ }
+}
+fn main() { }
--- /dev/null
+error[E0401]: can't use type parameters from outer function
+ --> $DIR/issue-3214.rs:13:12
+ |
+LL | fn foo<T>() {
+ | --- - type variable from outer function
+ | |
+ | try adding a local type parameter in this method instead
+LL | struct foo {
+LL | x: T, //~ ERROR can't use type parameters from outer function
+ | ^ use of type variable from outer function
+
+error[E0244]: wrong number of type arguments: expected 0, found 1
+ --> $DIR/issue-3214.rs:16:22
+ |
+LL | impl<T> Drop for foo<T> {
+ | ^^^^^^ expected no type arguments
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0244, E0401.
+For more information about an error, try `rustc --explain E0244`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+extern {
+ fn foo(a: i32, ...);
+}
+
+fn bar(_: *const u8) {}
+
+fn main() {
+ unsafe {
+ foo(0, bar);
+ //~^ ERROR can't pass `fn(*const u8) {bar}` to variadic function
+ //~| HELP cast the value to `fn(*const u8)`
+ }
+}
--- /dev/null
+error[E0617]: can't pass `fn(*const u8) {bar}` to variadic function
+ --> $DIR/issue-32201.rs:19:16
+ |
+LL | foo(0, bar);
+ | ^^^ help: cast the value to `fn(*const u8)`: `bar as fn(*const u8)`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0617`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(rustc_attrs)]
+#![allow(warnings)]
+
+mod foo {
+ pub fn bar() {}
+}
+
+pub use foo::*;
+use b::bar;
+
+mod foobar {
+ use super::*;
+}
+
+mod a {
+ pub mod bar {}
+}
+
+mod b {
+ pub use a::bar;
+}
+
+#[rustc_error]
+fn main() {} //~ ERROR compilation successful
--- /dev/null
+error: compilation successful
+ --> $DIR/issue-32222.rs:34:1
+ |
+LL | fn main() {} //~ ERROR compilation successful
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub trait Tr<'a> {
+ type Out;
+}
+
+pub fn f<'a, T: Tr<'a>>() -> <T as Tr<'a>>::Out {}
+//~^ ERROR mismatched types
+
+pub fn main() {}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-32323.rs:15:49
+ |
+LL | pub fn f<'a, T: Tr<'a>>() -> <T as Tr<'a>>::Out {}
+ | ^^ expected associated type, found ()
+ |
+ = note: expected type `<T as Tr<'a>>::Out`
+ found type `()`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::mem;
+use std::marker::PhantomData;
+
+trait Foo {
+ type Error;
+}
+
+struct Bar<U: Foo> {
+ stream: PhantomData<U::Error>,
+}
+
+fn foo<U: Foo>(x: [usize; 2]) -> Bar<U> {
+ unsafe { mem::transmute(x) }
+ //~^ ERROR transmute called with types of different sizes
+}
+
+fn main() {}
--- /dev/null
+error[E0512]: transmute called with types of different sizes
+ --> $DIR/issue-32377.rs:23:14
+ |
+LL | unsafe { mem::transmute(x) }
+ | ^^^^^^^^^^^^^^
+ |
+ = note: source type: [usize; 2] (128 bits)
+ = note: target type: Bar<U> (0 bits)
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0512`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![allow(dead_code)]
+#![feature(rustc_attrs)]
+
+macro_rules! foo (
+ () => (
+ #[derive_Clone] //~ ERROR attributes of the form
+ struct T;
+ );
+);
+
+macro_rules! bar (
+ ($e:item) => ($e)
+);
+
+foo!();
+
+bar!(
+ #[derive_Clone] //~ ERROR attributes of the form
+ struct S;
+);
+
+fn main() {}
--- /dev/null
+error[E0658]: attributes of the form `#[derive_*]` are reserved for the compiler (see issue #29644)
+ --> $DIR/issue-32655.rs:16:9
+ |
+LL | #[derive_Clone] //~ ERROR attributes of the form
+ | ^^^^^^^^^^^^^^^
+...
+LL | foo!();
+ | ------- in this macro invocation
+ |
+ = help: add #![feature(custom_derive)] to the crate attributes to enable
+
+error[E0658]: attributes of the form `#[derive_*]` are reserved for the compiler (see issue #29644)
+ --> $DIR/issue-32655.rs:28:5
+ |
+LL | #[derive_Clone] //~ ERROR attributes of the form
+ | ^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(custom_derive)] to the crate attributes to enable
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Make sure that the span of try shorthand does not include the trailing
+// semicolon;
+fn a() -> Result<i32, ()> {
+ Err(5)?; //~ ERROR 14:5: 14:12
+ Ok(1)
+}
+
+fn main() {}
--- /dev/null
+error[E0277]: the trait bound `(): std::convert::From<{integer}>` is not satisfied
+ --> $DIR/issue-32709.rs:14:5
+ |
+LL | Err(5)?; //~ ERROR 14:5: 14:12
+ | ^^^^^^^ the trait `std::convert::From<{integer}>` is not implemented for `()`
+ |
+ = note: required by `std::convert::From::from`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+macro_rules! bar (
+ () => ()
+);
+
+macro_rules! foo (
+ () => (
+ #[allow_internal_unstable] //~ ERROR allow_internal_unstable side-steps
+ bar!();
+ );
+);
+
+foo!();
+fn main() {}
--- /dev/null
+error[E0658]: allow_internal_unstable side-steps feature gating and stability checks
+ --> $DIR/issue-32782.rs:17:9
+ |
+LL | #[allow_internal_unstable] //~ ERROR allow_internal_unstable side-steps
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | foo!();
+ | ------- in this macro invocation
+ |
+ = help: add #![feature(allow_internal_unstable)] to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(rustc_attrs)]
+
+pub use bar::*;
+mod bar {
+ pub use super::*;
+}
+
+pub use baz::*;
+mod baz {
+ pub use main as f;
+}
+
+#[rustc_error]
+pub fn main() {} //~ ERROR compilation successful
--- /dev/null
+error: compilation successful
+ --> $DIR/issue-32797.rs:24:1
+ |
+LL | pub fn main() {} //~ ERROR compilation successful
+ | ^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// error-pattern: calls in statics are limited
+
+static S : u64 = { { panic!("foo"); 0 } };
+
+fn main() {
+ println!("{:?}", S);
+}
--- /dev/null
+error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants
+ --> $DIR/issue-32829.rs:13:22
+ |
+LL | static S : u64 = { { panic!("foo"); 0 } };
+ | ^^^^^^^^^^^^^^
+ |
+ = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0015`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use bar::Foo; //~ ERROR unresolved import `bar::Foo` [E0432]
+ //~^ no `Foo` in `bar`
+mod bar {
+ use Foo;
+}
+
+fn main() {}
--- /dev/null
+error[E0432]: unresolved import `bar::Foo`
+ --> $DIR/issue-32833.rs:11:5
+ |
+LL | use bar::Foo; //~ ERROR unresolved import `bar::Foo` [E0432]
+ | ^^^^^^^^ no `Foo` in `bar`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0432`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(rustc_attrs)]
+#![allow(warnings)]
+
+macro_rules! foo { () => {
+ let x = 1;
+ macro_rules! bar { () => {x} }
+ let _ = bar!();
+}}
+
+macro_rules! m { // test issue #31856
+ ($n:ident) => (
+ let a = 1;
+ let $n = a;
+ )
+}
+
+macro_rules! baz {
+ ($i:ident) => {
+ let mut $i = 2;
+ $i = $i + 1;
+ }
+}
+
+#[rustc_error]
+fn main() { //~ ERROR compilation successful
+ foo! {};
+ bar! {};
+
+ let mut a = true;
+ baz!(a);
+}
--- /dev/null
+error: compilation successful
+ --> $DIR/issue-32922.rs:35:1
+ |
+LL | / fn main() { //~ ERROR compilation successful
+LL | | foo! {};
+LL | | bar! {};
+LL | |
+LL | | let mut a = true;
+LL | | baz!(a);
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::mem;
+
+trait Misc {}
+
+fn size_of_copy<T: Copy+?Sized>() -> usize { mem::size_of::<T>() }
+
+fn main() {
+ size_of_copy::<Misc+Copy>();
+ //~^ ERROR only auto traits can be used as additional traits in a trait object
+ //~| ERROR the trait bound `dyn Misc: std::marker::Copy` is not satisfied
+}
--- /dev/null
+error[E0225]: only auto traits can be used as additional traits in a trait object
+ --> $DIR/issue-32963.rs:18:25
+ |
+LL | size_of_copy::<Misc+Copy>();
+ | ^^^^ non-auto additional trait
+
+error[E0277]: the trait bound `dyn Misc: std::marker::Copy` is not satisfied
+ --> $DIR/issue-32963.rs:18:5
+ |
+LL | size_of_copy::<Misc+Copy>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `dyn Misc`
+ |
+note: required by `size_of_copy`
+ --> $DIR/issue-32963.rs:15:1
+ |
+LL | fn size_of_copy<T: Copy+?Sized>() -> usize { mem::size_of::<T>() }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0225, E0277.
+For more information about an error, try `rustc --explain E0225`.
--- /dev/null
+// 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.
+
+#![allow(unused)]
+
+fn main() {
+ { fn f<X: ::std::marker()::Send>() {} }
+ //~^ ERROR parenthesized parameters may only be used with a trait
+ //~| WARN previously accepted
+
+ { fn f() -> impl ::std::marker()::Send { } }
+ //~^ ERROR parenthesized parameters may only be used with a trait
+ //~| WARN previously accepted
+}
+
+#[derive(Clone)]
+struct X;
+
+impl ::std::marker()::Copy for X {}
+//~^ ERROR parenthesized parameters may only be used with a trait
+//~| WARN previously accepted
--- /dev/null
+error: parenthesized parameters may only be used with a trait
+ --> $DIR/issue-32995-2.rs:14:28
+ |
+LL | { fn f<X: ::std::marker()::Send>() {} }
+ | ^^
+ |
+ = note: #[deny(parenthesized_params_in_types_and_modules)] on by default
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #42238 <https://github.com/rust-lang/rust/issues/42238>
+
+error: parenthesized parameters may only be used with a trait
+ --> $DIR/issue-32995-2.rs:18:35
+ |
+LL | { fn f() -> impl ::std::marker()::Send { } }
+ | ^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #42238 <https://github.com/rust-lang/rust/issues/42238>
+
+error: parenthesized parameters may only be used with a trait
+ --> $DIR/issue-32995-2.rs:26:19
+ |
+LL | impl ::std::marker()::Copy for X {}
+ | ^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #42238 <https://github.com/rust-lang/rust/issues/42238>
+
+error: aborting due to 3 previous errors
+
--- /dev/null
+// 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.
+
+#![allow(unused)]
+
+fn main() {
+ let x: usize() = 1;
+ //~^ ERROR parenthesized parameters may only be used with a trait
+ //~| WARN previously accepted
+
+ let b: ::std::boxed()::Box<_> = Box::new(1);
+ //~^ ERROR parenthesized parameters may only be used with a trait
+ //~| WARN previously accepted
+
+ let p = ::std::str::()::from_utf8(b"foo").unwrap();
+ //~^ ERROR parenthesized parameters may only be used with a trait
+ //~| WARN previously accepted
+
+ let p = ::std::str::from_utf8::()(b"foo").unwrap();
+ //~^ ERROR parenthesized parameters may only be used with a trait
+ //~| WARN previously accepted
+
+ let o : Box<::std::marker()::Send> = Box::new(1);
+ //~^ ERROR parenthesized parameters may only be used with a trait
+ //~| WARN previously accepted
+
+ let o : Box<Send + ::std::marker()::Sync> = Box::new(1);
+ //~^ ERROR parenthesized parameters may only be used with a trait
+ //~| WARN previously accepted
+}
+
+fn foo<X:Default>() {
+ let d : X() = Default::default();
+ //~^ ERROR parenthesized parameters may only be used with a trait
+ //~| WARN previously accepted
+}
--- /dev/null
+error: parenthesized parameters may only be used with a trait
+ --> $DIR/issue-32995.rs:14:17
+ |
+LL | let x: usize() = 1;
+ | ^^
+ |
+ = note: #[deny(parenthesized_params_in_types_and_modules)] on by default
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #42238 <https://github.com/rust-lang/rust/issues/42238>
+
+error: parenthesized parameters may only be used with a trait
+ --> $DIR/issue-32995.rs:18:24
+ |
+LL | let b: ::std::boxed()::Box<_> = Box::new(1);
+ | ^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #42238 <https://github.com/rust-lang/rust/issues/42238>
+
+error: parenthesized parameters may only be used with a trait
+ --> $DIR/issue-32995.rs:22:23
+ |
+LL | let p = ::std::str::()::from_utf8(b"foo").unwrap();
+ | ^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #42238 <https://github.com/rust-lang/rust/issues/42238>
+
+error: parenthesized parameters may only be used with a trait
+ --> $DIR/issue-32995.rs:26:34
+ |
+LL | let p = ::std::str::from_utf8::()(b"foo").unwrap();
+ | ^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #42238 <https://github.com/rust-lang/rust/issues/42238>
+
+error: parenthesized parameters may only be used with a trait
+ --> $DIR/issue-32995.rs:30:30
+ |
+LL | let o : Box<::std::marker()::Send> = Box::new(1);
+ | ^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #42238 <https://github.com/rust-lang/rust/issues/42238>
+
+error: parenthesized parameters may only be used with a trait
+ --> $DIR/issue-32995.rs:34:37
+ |
+LL | let o : Box<Send + ::std::marker()::Sync> = Box::new(1);
+ | ^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #42238 <https://github.com/rust-lang/rust/issues/42238>
+
+error: parenthesized parameters may only be used with a trait
+ --> $DIR/issue-32995.rs:40:14
+ |
+LL | let d : X() = Default::default();
+ | ^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #42238 <https://github.com/rust-lang/rust/issues/42238>
+
+error: aborting due to 7 previous errors
+
--- /dev/null
+// 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.
+
+#![feature(rustc_attrs)]
+
+use std::fmt;
+
+// CoerceUnsized is not implemented for tuples. You can still create
+// an unsized tuple by transmuting a trait object.
+fn any<T>() -> T { unreachable!() }
+
+#[rustc_error]
+fn main() { //~ ERROR compilation successful
+ let t: &(u8, fmt::Debug) = any();
+ println!("{:?}", &t.1);
+}
--- /dev/null
+error: compilation successful
+ --> $DIR/issue-33241.rs:20:1
+ |
+LL | / fn main() { //~ ERROR compilation successful
+LL | | let t: &(u8, fmt::Debug) = any();
+LL | | println!("{:?}", &t.1);
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ match 0 {
+ aaa::bbb(_) => ()
+ //~^ ERROR failed to resolve. Use of undeclared type or module `aaa`
+ };
+}
--- /dev/null
+error[E0433]: failed to resolve. Use of undeclared type or module `aaa`
+ --> $DIR/issue-33293.rs:13:9
+ |
+LL | aaa::bbb(_) => ()
+ | ^^^ Use of undeclared type or module `aaa`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0433`.
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#[derive(PartialEq)]
+struct thing(usize);
+impl PartialOrd for thing { //~ ERROR not all trait items implemented, missing: `partial_cmp`
+ fn le(&self, other: &thing) -> bool { true }
+ fn ge(&self, other: &thing) -> bool { true }
+}
+fn main() {}
--- /dev/null
+error[E0046]: not all trait items implemented, missing: `partial_cmp`
+ --> $DIR/issue-3344.rs:13:1
+ |
+LL | impl PartialOrd for thing { //~ ERROR not all trait items implemented, missing: `partial_cmp`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ missing `partial_cmp` in implementation
+ |
+ = note: `partial_cmp` from trait: `fn(&Self, &Rhs) -> std::option::Option<std::cmp::Ordering>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0046`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Make sure that the spans of import errors are correct.
+
+use abc::one_el;
+//~^ ERROR 13:5: 13:8
+use abc::{a, bbb, cccccc};
+//~^ ERROR 15:5: 15:8
+use a_very_long_name::{el, el2};
+//~^ ERROR 17:5: 17:21
+
+fn main() {}
--- /dev/null
+error[E0432]: unresolved import `abc`
+ --> $DIR/issue-33464.rs:13:5
+ |
+LL | use abc::one_el;
+ | ^^^ Maybe a missing `extern crate abc;`?
+
+error[E0432]: unresolved import `abc`
+ --> $DIR/issue-33464.rs:15:5
+ |
+LL | use abc::{a, bbb, cccccc};
+ | ^^^ Maybe a missing `extern crate abc;`?
+
+error[E0432]: unresolved import `a_very_long_name`
+ --> $DIR/issue-33464.rs:17:5
+ |
+LL | use a_very_long_name::{el, el2};
+ | ^^^^^^^^^^^^^^^^ Maybe a missing `extern crate a_very_long_name;`?
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0432`.
--- /dev/null
+// 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.
+
+// Shadowing a unit-like enum in a closure
+
+struct Test;
+
+fn main() {
+ || {
+ let Test = 1; //~ ERROR mismatched types
+ };
+}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-33504.rs:17:13
+ |
+LL | let Test = 1; //~ ERROR mismatched types
+ | ^^^^ expected integral variable, found struct `Test`
+ |
+ = note: expected type `{integer}`
+ found type `Test`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#[derive(Clone,
+ Sync, //~ ERROR this unsafe trait should be implemented explicitly
+ Copy)]
+enum Foo {}
--- /dev/null
+error: this unsafe trait should be implemented explicitly
+ --> $DIR/issue-33571.rs:12:10
+ |
+LL | Sync, //~ ERROR this unsafe trait should be implemented explicitly
+ | ^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+error[E0596]: cannot borrow immutable item `v` as mutable
+ --> $DIR/issue-33819.rs:13:34
+ |
+LL | Some(ref v) => { let a = &mut v; },
+ | ^^^^^^
+ | |
+ | cannot borrow as mutable
+ | try removing `&mut` here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+fn main() {
+ let mut op = Some(2);
+ match op {
+ Some(ref v) => { let a = &mut v; },
+ //~^ ERROR:cannot borrow immutable
+ //~| cannot borrow mutably
+ None => {},
+ }
+}
--- /dev/null
+error[E0596]: cannot borrow immutable local variable `v` as mutable
+ --> $DIR/issue-33819.rs:13:39
+ |
+LL | Some(ref v) => { let a = &mut v; },
+ | ^ cannot borrow mutably
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(rustc_attrs)]
+
+macro_rules! m {
+ () => { #[cfg(any())] fn f() {} }
+}
+
+trait T {}
+impl T for () { m!(); }
+
+#[rustc_error]
+fn main() {} //~ ERROR compilation successful
--- /dev/null
+error: compilation successful
+ --> $DIR/issue-34028.rs:21:1
+ |
+LL | fn main() {} //~ ERROR compilation successful
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(rustc_attrs)]
+
+macro_rules! null { ($i:tt) => {} }
+macro_rules! apply_null {
+ ($i:item) => { null! { $i } }
+}
+
+#[rustc_error]
+fn main() { //~ ERROR compilation successful
+ apply_null!(#[cfg(all())] fn f() {});
+}
--- /dev/null
+error: compilation successful
+ --> $DIR/issue-34171.rs:19:1
+ |
+LL | / fn main() { //~ ERROR compilation successful
+LL | | apply_null!(#[cfg(all())] fn f() {});
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
--- /dev/null
+// 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 main() {
+ /// comment //~ ERROR found a documentation comment that doesn't document anything
+}
--- /dev/null
+error[E0585]: found a documentation comment that doesn't document anything
+ --> $DIR/issue-34222-1.rs:12:5
+ |
+LL | /// comment //~ ERROR found a documentation comment that doesn't document anything
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: doc comments must come before what they document, maybe a comment was intended with `//`?
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0585`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main () {
+ let sr: Vec<(u32, _, _) = vec![]; //~ ERROR expected one of `,` or `>`, found `=`
+ let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_receiver)| {}).collect();
+}
--- /dev/null
+error: expected one of `,` or `>`, found `=`
+ --> $DIR/issue-34334.rs:12:29
+ |
+LL | let sr: Vec<(u32, _, _) = vec![]; //~ ERROR expected one of `,` or `>`, found `=`
+ | -- ^ expected one of `,` or `>` here
+ | |
+ | while parsing the type for `sr`
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// This is a regression test for a problem encountered around upvar
+// inference and trait caching: in particular, we were entering a
+// temporary closure kind during inference, and then caching results
+// based on that temporary kind, which led to no error being reported
+// in this particular test.
+
+fn main() {
+ let inc = || {};
+ inc();
+
+ fn apply<F>(f: F) where F: Fn() {
+ f()
+ }
+
+ let mut farewell = "goodbye".to_owned();
+ let diary = || { //~ ERROR E0525
+ farewell.push_str("!!!");
+ println!("Then I screamed {}.", farewell);
+ };
+
+ apply(diary);
+}
--- /dev/null
+error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnMut`
+ --> $DIR/issue-34349.rs:26:17
+ |
+LL | let diary = || { //~ ERROR E0525
+ | ^^ this closure implements `FnMut`, not `Fn`
+LL | farewell.push_str("!!!");
+ | -------- closure is `FnMut` because it mutates the variable `farewell` here
+...
+LL | apply(diary);
+ | ----- the requirement to implement `Fn` derives from here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0525`.
--- /dev/null
+// 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.
+
+#![allow(warnings)]
+
+trait Trait<T> {
+ fn foo(_: T) {}
+}
+
+pub struct Foo<T = Box<Trait<DefaultFoo>>>; //~ ERROR cycle detected
+type DefaultFoo = Foo;
+
+fn main() {
+}
--- /dev/null
+error[E0391]: cycle detected when processing `Foo::T`
+ --> $DIR/issue-34373.rs:17:30
+ |
+LL | pub struct Foo<T = Box<Trait<DefaultFoo>>>; //~ ERROR cycle detected
+ | ^^^^^^^^^^
+ |
+note: ...which requires processing `DefaultFoo`...
+ --> $DIR/issue-34373.rs:18:19
+ |
+LL | type DefaultFoo = Foo;
+ | ^^^
+ = note: ...which again requires processing `Foo::T`, completing the cycle
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0391`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(rustc_attrs)]
+#![allow(unused)]
+
+macro_rules! make_item {
+ () => { fn f() {} }
+}
+
+macro_rules! make_stmt {
+ () => { let x = 0; }
+}
+
+fn f() {
+ make_item! {}
+}
+
+fn g() {
+ make_stmt! {}
+}
+
+#[rustc_error]
+fn main() {} //~ ERROR compilation successful
--- /dev/null
+error: compilation successful
+ --> $DIR/issue-34418.rs:31:1
+ |
+LL | fn main() {} //~ ERROR compilation successful
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ let _p: char = 100;
+ //~^ ERROR mismatched types
+ //~| expected char, found u8
+}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-3477.rs:12:20
+ |
+LL | let _p: char = 100;
+ | ^^^ expected char, found u8
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(rustc_attrs)]
+#![allow(dead_code)]
+
+trait RegularExpression: Sized {
+ type Text;
+}
+
+struct ExecNoSyncStr<'a>(&'a u8);
+
+impl<'c> RegularExpression for ExecNoSyncStr<'c> {
+ type Text = u8;
+}
+
+struct FindCaptures<'t, R>(&'t R::Text) where R: RegularExpression, R::Text: 't;
+
+enum FindCapturesInner<'r, 't> {
+ Dynamic(FindCaptures<'t, ExecNoSyncStr<'r>>),
+}
+
+#[rustc_error]
+fn main() {} //~ ERROR compilation successful
--- /dev/null
+error: compilation successful
+ --> $DIR/issue-34839.rs:31:1
+ |
+LL | fn main() {} //~ ERROR compilation successful
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Bar<T> {
+ inner: Foo<T> //~ ERROR cannot find type `Foo` in this scope
+}
+
+enum Baz<T> {
+ Foo(Foo<T>) //~ ERROR cannot find type `Foo` in this scope
+}
+
+fn main() {}
--- /dev/null
+error[E0412]: cannot find type `Foo` in this scope
+ --> $DIR/issue-35075.rs:12:12
+ |
+LL | inner: Foo<T> //~ ERROR cannot find type `Foo` in this scope
+ | ^^^---
+ | |
+ | not found in this scope
+ | help: you can try using the variant's enum: `Baz`
+
+error[E0412]: cannot find type `Foo` in this scope
+ --> $DIR/issue-35075.rs:16:9
+ |
+LL | Foo(Foo<T>) //~ ERROR cannot find type `Foo` in this scope
+ | ^^^---
+ | |
+ | not found in this scope
+ | help: you can try using the variant's enum: `Baz`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0412`.
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ let foo = 100;
+
+ static y: isize = foo + 1;
+ //~^ ERROR can't capture dynamic environment
+
+ println!("{}", y);
+}
--- /dev/null
+error[E0434]: can't capture dynamic environment in a fn item
+ --> $DIR/issue-3521-2.rs:14:23
+ |
+LL | static y: isize = foo + 1;
+ | ^^^
+ |
+ = help: use the `|| { ... }` closure form instead
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0434`.
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ let foo = 100;
+
+ #[derive(Debug)]
+ enum Stuff {
+ Bar = foo
+ //~^ ERROR attempt to use a non-constant value in a constant
+ }
+
+ println!("{:?}", Stuff::Bar);
+}
--- /dev/null
+error[E0435]: attempt to use a non-constant value in a constant
+ --> $DIR/issue-3521.rs:16:15
+ |
+LL | Bar = foo
+ | ^^^ non-constant value
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0435`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+macro_rules! m { ($($t:tt)*) => { $($t)* } }
+
+fn main() {
+ m!($t); //~ ERROR expected expression
+}
--- /dev/null
+error: expected expression, found `$`
+ --> $DIR/issue-35450.rs:14:8
+ |
+LL | m!($t); //~ ERROR expected expression
+ | ^ expected expression
+
+error: aborting due to previous error
+
--- /dev/null
+// 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.
+
+#![feature(rustc_attrs)]
+
+use std::mem;
+
+trait Trait1<T> {}
+trait Trait2<'a> {
+ type Ty;
+}
+
+fn _ice(param: Box<for <'a> Trait1<<() as Trait2<'a>>::Ty>>) {
+ let _e: (usize, usize) = unsafe{mem::transmute(param)};
+}
+
+trait Lifetime<'a> {
+ type Out;
+}
+impl<'a> Lifetime<'a> for () {
+ type Out = &'a ();
+}
+fn foo<'a>(x: &'a ()) -> <() as Lifetime<'a>>::Out {
+ x
+}
+
+fn takes_lifetime(_f: for<'a> fn(&'a ()) -> <() as Lifetime<'a>>::Out) {
+}
+
+#[rustc_error]
+fn main() { //~ ERROR compilation successful
+ takes_lifetime(foo);
+}
--- /dev/null
+error: compilation successful
+ --> $DIR/issue-35570.rs:38:1
+ |
+LL | / fn main() { //~ ERROR compilation successful
+LL | | takes_lifetime(foo);
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn func<'a, T>(a: &'a [T]) -> impl Iterator<Item=&'a T> {
+ a.iter().map(|a| a*a)
+ //~^ ERROR binary operation `*` cannot be applied to type `&T`
+}
+
+fn main() {
+ let a = (0..30).collect::<Vec<_>>();
+
+ for k in func(&a) {
+ println!("{}", k);
+ }
+}
--- /dev/null
+error[E0369]: binary operation `*` cannot be applied to type `&T`
+ --> $DIR/issue-35668.rs:12:22
+ |
+LL | a.iter().map(|a| a*a)
+ | ^^^
+ |
+ = note: an implementation of `std::ops::Mul` might be missing for `&T`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0369`.
--- /dev/null
+// 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.
+
+enum E {
+ V([Box<E>]),
+ //~^ ERROR the size for values of type
+}
+
+fn main() {}
--- /dev/null
+error[E0277]: the size for values of type `[std::boxed::Box<E>]` cannot be known at compilation time
+ --> $DIR/issue-35988.rs:12:7
+ |
+LL | V([Box<E>]),
+ | ^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `[std::boxed::Box<E>]`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
+ = note: no field of an enum variant may have a dynamically sized type
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
--- /dev/null
+// Copyright 2012-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(box_patterns)]
+#![feature(box_syntax)]
+
+struct HTMLImageData {
+ image: Option<String>
+}
+
+struct ElementData {
+ kind: Box<ElementKind>
+}
+
+enum ElementKind {
+ HTMLImageElement(HTMLImageData)
+}
+
+enum NodeKind {
+ Element(ElementData)
+}
+
+struct NodeData {
+ kind: Box<NodeKind>,
+}
+
+fn main() {
+ let mut id = HTMLImageData { image: None };
+ let ed = ElementData { kind: box ElementKind::HTMLImageElement(id) };
+ let n = NodeData {kind : box NodeKind::Element(ed)};
+ // n.b. span could be better
+ match n.kind {
+ box NodeKind::Element(ed) => match ed.kind { //~ ERROR non-exhaustive patterns
+ box ElementKind::HTMLImageElement(ref d) if d.image.is_some() => { true }
+ },
+ };
+}
--- /dev/null
+error[E0004]: non-exhaustive patterns: `_` not covered
+ --> $DIR/issue-3601.rs:40:44
+ |
+LL | box NodeKind::Element(ed) => match ed.kind { //~ ERROR non-exhaustive patterns
+ | ^^^^^^^ pattern `_` not covered
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0004`.
--- /dev/null
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/issue-36082.rs:23:19
+ |
+LL | let val: &_ = x.borrow().0;
+ | ^^^^^^^^^^ - temporary value only lives until here
+ | |
+ | temporary value does not live long enough
+...
+LL | println!("{}", val);
+ | --- borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
--- /dev/null
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/issue-36082.rs:23:19
+ |
+LL | let val: &_ = x.borrow().0;
+ | ^^^^^^^^^^ - temporary value dropped here while still borrowed
+ | |
+ | temporary value does not live long enough
+...
+LL | }
+ | - temporary value needs to live until here
+ |
+ = note: consider using a `let` binding to increase its lifetime
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
--- /dev/null
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/issue-36082.rs:23:19
+ |
+LL | let val: &_ = x.borrow().0;
+ | ^^^^^^^^^^ - temporary value only lives until here
+ | |
+ | temporary value does not live long enough
+...
+LL | println!("{}", val);
+ | --- borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// revisions: ast mir
+//[mir]compile-flags: -Z borrowck=mir
+
+// FIXME(#49821) -- No tip about using a let binding
+
+use std::cell::RefCell;
+
+fn main() {
+ let mut r = 0;
+ let s = 0;
+ let x = RefCell::new((&mut r,s));
+
+ let val: &_ = x.borrow().0;
+ //[ast]~^ ERROR borrowed value does not live long enough [E0597]
+ //[ast]~| NOTE temporary value dropped here while still borrowed
+ //[ast]~| NOTE temporary value does not live long enough
+ //[ast]~| NOTE consider using a `let` binding to increase its lifetime
+ //[mir]~^^^^^ ERROR borrowed value does not live long enough [E0597]
+ //[mir]~| NOTE temporary value does not live long enough
+ //[mir]~| NOTE temporary value only lives until here
+ println!("{}", val);
+ //[mir]~^ borrow later used here
+}
+//[ast]~^ NOTE temporary value needs to live until here
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Unnecessary path disambiguator is ok
+
+#![feature(rustc_attrs)]
+#![allow(unused)]
+
+macro_rules! m {
+ ($p: path) => {
+ let _ = $p(0);
+ let _: $p;
+ }
+}
+
+struct Foo<T> {
+ _a: T,
+}
+
+struct S<T>(T);
+
+fn f() {
+ let f = Some(Foo { _a: 42 }).map(|a| a as Foo::<i32>); //~ WARN unnecessary path disambiguator
+ let g: Foo::<i32> = Foo { _a: 42 }; //~ WARN unnecessary path disambiguator
+
+ m!(S::<u8>); // OK, no warning
+}
+
+#[rustc_error]
+fn main() {} //~ ERROR compilation successful
--- /dev/null
+warning: unnecessary path disambiguator
+ --> $DIR/issue-36116.rs:30:50
+ |
+LL | let f = Some(Foo { _a: 42 }).map(|a| a as Foo::<i32>); //~ WARN unnecessary path disambiguator
+ | ^^ try removing `::`
+
+warning: unnecessary path disambiguator
+ --> $DIR/issue-36116.rs:31:15
+ |
+LL | let g: Foo::<i32> = Foo { _a: 42 }; //~ WARN unnecessary path disambiguator
+ | ^^ try removing `::`
+
+error: compilation successful
+ --> $DIR/issue-36116.rs:37:1
+ |
+LL | fn main() {} //~ ERROR compilation successful
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo<'a, A> {}
+//~^ ERROR parameter `'a` is never used
+//~| ERROR parameter `A` is never used
+
+fn main() {}
--- /dev/null
+error[E0392]: parameter `'a` is never used
+ --> $DIR/issue-36299.rs:11:12
+ |
+LL | struct Foo<'a, A> {}
+ | ^^ unused type parameter
+ |
+ = help: consider removing `'a` or using a marker such as `std::marker::PhantomData`
+
+error[E0392]: parameter `A` is never used
+ --> $DIR/issue-36299.rs:11:16
+ |
+LL | struct Foo<'a, A> {}
+ | ^ unused type parameter
+ |
+ = help: consider removing `A` or using a marker such as `std::marker::PhantomData`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0392`.
--- /dev/null
+// 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.
+
+#![feature(rustc_attrs)]
+
+fn _test() -> impl Default { }
+
+#[rustc_error]
+fn main() { } //~ ERROR compilation successful
--- /dev/null
+error: compilation successful
+ --> $DIR/issue-36379.rs:16:1
+ |
+LL | fn main() { } //~ ERROR compilation successful
+ | ^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![derive(Copy)] //~ ERROR `derive` may only be applied to structs, enums and unions
--- /dev/null
+error: `derive` may only be applied to structs, enums and unions
+ --> $DIR/issue-36617.rs:11:1
+ |
+LL | #![derive(Copy)] //~ ERROR `derive` may only be applied to structs, enums and unions
+ | ^^^^^^^^^^^^^^^^ help: try an outer attribute: `#[derive(Copy)]`
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags: -Z continue-parse-after-error
+
+struct Foo<Self>(Self);
+//~^ ERROR expected identifier, found keyword `Self`
+
+trait Bar<Self> {}
+//~^ ERROR expected identifier, found keyword `Self`
+
+fn main() {}
--- /dev/null
+error: expected identifier, found keyword `Self`
+ --> $DIR/issue-36638.rs:13:12
+ |
+LL | struct Foo<Self>(Self);
+ | ^^^^ expected identifier, found keyword
+
+error: expected identifier, found keyword `Self`
+ --> $DIR/issue-36638.rs:16:11
+ |
+LL | trait Bar<Self> {}
+ | ^^^^ expected identifier, found keyword
+
+error: aborting due to 2 previous errors
+
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn f(x:isize) {
+ static child: isize = x + 1;
+ //~^ ERROR can't capture dynamic environment
+}
+
+fn main() {}
--- /dev/null
+error[E0434]: can't capture dynamic environment in a fn item
+ --> $DIR/issue-3668-2.rs:12:27
+ |
+LL | static child: isize = x + 1;
+ | ^
+ |
+ = help: use the `|| { ... }` closure form instead
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0434`.
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct P { child: Option<Box<P>> }
+trait PTrait {
+ fn getChildOption(&self) -> Option<Box<P>>;
+}
+
+impl PTrait for P {
+ fn getChildOption(&self) -> Option<Box<P>> {
+ static childVal: Box<P> = self.child.get();
+ //~^ ERROR can't capture dynamic environment
+ panic!();
+ }
+}
+
+fn main() {}
--- /dev/null
+error[E0434]: can't capture dynamic environment in a fn item
+ --> $DIR/issue-3668.rs:18:34
+ |
+LL | static childVal: Box<P> = self.child.get();
+ | ^^^^
+ |
+ = help: use the `|| { ... }` closure form instead
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0434`.
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ match None {
+ Err(_) => ()
+ //~^ ERROR mismatched types
+ //~| expected type `std::option::Option<_>`
+ //~| found type `std::result::Result<_, _>`
+ //~| expected enum `std::option::Option`, found enum `std::result::Result`
+ }
+}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-3680.rs:13:9
+ |
+LL | Err(_) => ()
+ | ^^^^^^ expected enum `std::option::Option`, found enum `std::result::Result`
+ |
+ = note: expected type `std::option::Option<_>`
+ found type `std::result::Result<_, _>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// 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.
+
+#![feature(rustc_attrs)]
+
+pub trait Foo {
+ type Bar;
+}
+
+pub trait Broken {
+ type Assoc;
+ fn broken(&self) where Self::Assoc: Foo;
+}
+
+impl<T> Broken for T {
+ type Assoc = ();
+ fn broken(&self) where Self::Assoc: Foo {
+ let _x: <Self::Assoc as Foo>::Bar;
+ }
+}
+
+#[rustc_error]
+fn main() { //~ ERROR compilation successful
+ let _m: &Broken<Assoc=()> = &();
+}
--- /dev/null
+error: compilation successful
+ --> $DIR/issue-36839.rs:30:1
+ |
+LL | / fn main() { //~ ERROR compilation successful
+LL | | let _m: &Broken<Assoc=()> = &();
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub trait ToPrimitive {
+ fn to_int(&self) -> isize { 0 }
+}
+
+impl ToPrimitive for i32 {}
+impl ToPrimitive for isize {}
+
+trait Add {
+ fn to_int(&self) -> isize;
+ fn add_dynamic(&self, other: &Add) -> isize;
+}
+
+impl Add for isize {
+ fn to_int(&self) -> isize { *self }
+ fn add_dynamic(&self, other: &Add) -> isize {
+ self.to_int() + other.to_int() //~ ERROR multiple applicable items in scope
+ }
+}
+
+fn main() { }
--- /dev/null
+error[E0034]: multiple applicable items in scope
+ --> $DIR/issue-3702-2.rs:26:14
+ |
+LL | self.to_int() + other.to_int() //~ ERROR multiple applicable items in scope
+ | ^^^^^^ multiple `to_int` found
+ |
+note: candidate #1 is defined in an impl of the trait `ToPrimitive` for the type `isize`
+ --> $DIR/issue-3702-2.rs:12:5
+ |
+LL | fn to_int(&self) -> isize { 0 }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+note: candidate #2 is defined in an impl of the trait `Add` for the type `isize`
+ --> $DIR/issue-3702-2.rs:24:5
+ |
+LL | fn to_int(&self) -> isize { *self }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0034`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// aux-build:empty-struct.rs
+
+extern crate empty_struct;
+
+fn main() {
+ let empty_struct::XEmpty2 = (); //~ ERROR mismatched types
+ let empty_struct::XEmpty6(..) = (); //~ ERROR mismatched types
+}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-37026.rs:16:9
+ |
+LL | let empty_struct::XEmpty2 = (); //~ ERROR mismatched types
+ | ^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `empty_struct::XEmpty2`
+ |
+ = note: expected type `()`
+ found type `empty_struct::XEmpty2`
+
+error[E0308]: mismatched types
+ --> $DIR/issue-37026.rs:17:9
+ |
+LL | let empty_struct::XEmpty6(..) = (); //~ ERROR mismatched types
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `empty_struct::XEmpty6`
+ |
+ = note: expected type `()`
+ found type `empty_struct::XEmpty6`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// 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.
+
+#![feature(rustc_attrs, associated_type_defaults)]
+#![allow(warnings)]
+
+trait State: Sized {
+ type NextState: State = StateMachineEnded;
+ fn execute(self) -> Option<Self::NextState>;
+}
+
+struct StateMachineEnded;
+
+impl State for StateMachineEnded {
+ fn execute(self) -> Option<Self::NextState> {
+ None
+ }
+}
+
+#[rustc_error]
+fn main() { //~ ERROR compilation successful
+}
--- /dev/null
+error: compilation successful
+ --> $DIR/issue-37051.rs:28:1
+ |
+LL | / fn main() { //~ ERROR compilation successful
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Obj {
+ member: usize
+}
+
+impl Obj {
+ pub fn boom() -> bool {
+ return 1+1 == 2
+ }
+ pub fn chirp(&self) {
+ self.boom(); //~ ERROR no method named `boom` found for type `&Obj` in the current scope
+ }
+}
+
+fn main() {
+ let o = Obj { member: 0 };
+ o.chirp();
+ 1 + 1;
+}
--- /dev/null
+error[E0599]: no method named `boom` found for type `&Obj` in the current scope
+ --> $DIR/issue-3707.rs:20:14
+ |
+LL | self.boom(); //~ ERROR no method named `boom` found for type `&Obj` in the current scope
+ | -----^^^^
+ | | |
+ | | this is an associated function, not a method
+ | help: use associated function syntax instead: `&Obj::boom`
+ |
+ = note: found the following associated functions; to be used as methods, functions must have a `self` parameter
+note: the candidate is defined in an impl for the type `Obj`
+ --> $DIR/issue-3707.rs:16:5
+ |
+LL | pub fn boom() -> bool {
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
--- /dev/null
+// 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.
+
+#![feature(rustc_attrs)]
+#![allow(warnings)]
+
+#[derive(Debug)]
+struct Point {
+}
+
+struct NestedA<'a, 'b> {
+ x: &'a NestedB<'b>
+ //~^ ERROR E0491
+}
+
+struct NestedB<'a> {
+ x: &'a i32,
+}
+
+fn main() {
+}
--- /dev/null
+error[E0491]: in type `&'a NestedB<'b>`, reference has a longer lifetime than the data it references
+ --> $DIR/issue-37323.rs:19:5
+ |
+LL | x: &'a NestedB<'b>
+ | ^^^^^^^^^^^^^^^^^^
+ |
+note: the pointer is valid for the lifetime 'a as defined on the struct at 18:16
+ --> $DIR/issue-37323.rs:18:16
+ |
+LL | struct NestedA<'a, 'b> {
+ | ^^
+note: but the referenced data is only valid for the lifetime 'b as defined on the struct at 18:20
+ --> $DIR/issue-37323.rs:18:20
+ |
+LL | struct NestedA<'a, 'b> {
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0491`.
--- /dev/null
+// 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.
+
+// ignore-emscripten
+
+#![feature(rustc_attrs, asm)]
+
+macro_rules! interrupt_handler {
+ () => {
+ unsafe fn _interrupt_handler() {
+ asm!("pop eax" :::: "intel");
+ }
+ }
+}
+interrupt_handler!{}
+
+#[rustc_error]
+fn main() { //~ ERROR compilation successful
+}
--- /dev/null
+error: compilation successful
+ --> $DIR/issue-37366.rs:25:1
+ |
+LL | / fn main() { //~ ERROR compilation successful
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
--- /dev/null
+// 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.
+
+#![feature(rustc_attrs)]
+
+fn foo(_: &mut i32) -> bool { true }
+
+#[rustc_error]
+fn main() { //~ ERROR compilation successful
+ let opt = Some(92);
+ let mut x = 62;
+
+ if let Some(_) = opt {
+
+ } else if foo(&mut x) {
+
+ }
+}
--- /dev/null
+error: compilation successful
+ --> $DIR/issue-37510.rs:16:1
+ |
+LL | / fn main() { //~ ERROR compilation successful
+LL | | let opt = Some(92);
+LL | | let mut x = 62;
+LL | |
+... |
+LL | | }
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
--- /dev/null
+// 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.
+
+#![feature(rustc_attrs)]
+#![warn(unused)]
+
+type Z = for<'x> Send;
+//~^ WARN type alias is never used
+
+#[rustc_error]
+fn main() { //~ ERROR compilation successful
+}
--- /dev/null
+warning: type alias is never used: `Z`
+ --> $DIR/issue-37515.rs:14:1
+ |
+LL | type Z = for<'x> Send;
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/issue-37515.rs:12:9
+ |
+LL | #![warn(unused)]
+ | ^^^^^^
+ = note: #[warn(dead_code)] implied by #[warn(unused)]
+
+error: compilation successful
+ --> $DIR/issue-37515.rs:18:1
+ |
+LL | / fn main() { //~ ERROR compilation successful
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo<T: ?Hash> { }
+//~^ ERROR cannot find trait `Hash` in this scope
+//~^^ ERROR parameter `T` is never used
+//~^^^ WARN default bound relaxed for a type parameter, but this does nothing
+
+fn main() { }
--- /dev/null
+error[E0405]: cannot find trait `Hash` in this scope
+ --> $DIR/issue-37534.rs:11:16
+ |
+LL | struct Foo<T: ?Hash> { }
+ | ^^^^ not found in this scope
+help: possible candidate is found in another module, you can import it into scope
+ |
+LL | use std::hash::Hash;
+ |
+
+warning: default bound relaxed for a type parameter, but this does nothing because the given bound is not a default. Only `?Sized` is supported
+ --> $DIR/issue-37534.rs:11:12
+ |
+LL | struct Foo<T: ?Hash> { }
+ | ^
+
+error[E0392]: parameter `T` is never used
+ --> $DIR/issue-37534.rs:11:12
+ |
+LL | struct Foo<T: ?Hash> { }
+ | ^ unused type parameter
+ |
+ = help: consider removing `T` or using a marker such as `std::marker::PhantomData`
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0392, E0405.
+For more information about an error, try `rustc --explain E0392`.
--- /dev/null
+// 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.
+
+#![feature(const_fn)]
+
+const fn x() {
+ let t = true;
+ //~^ ERROR let bindings in constant functions are unstable
+ //~| ERROR statements in constant functions are unstable
+ let x = || t;
+ //~^ ERROR let bindings in constant functions are unstable
+ //~| ERROR statements in constant functions are unstable
+}
+
+fn main() {}
--- /dev/null
+error[E0658]: let bindings in constant functions are unstable (see issue #48821)
+ --> $DIR/issue-37550.rs:14:13
+ |
+LL | let t = true;
+ | ^^^^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: statements in constant functions are unstable (see issue #48821)
+ --> $DIR/issue-37550.rs:14:13
+ |
+LL | let t = true;
+ | ^^^^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: let bindings in constant functions are unstable (see issue #48821)
+ --> $DIR/issue-37550.rs:17:13
+ |
+LL | let x = || t;
+ | ^^^^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: statements in constant functions are unstable (see issue #48821)
+ --> $DIR/issue-37550.rs:17:13
+ |
+LL | let x = || t;
+ | ^^^^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ 'test_1: while break 'test_1 {}
+ while break {}
+ //~^ ERROR `break` or `continue` with no label
+
+ 'test_2: while let true = break 'test_2 {}
+ while let true = break {}
+ //~^ ERROR `break` or `continue` with no label
+
+ loop { 'test_3: while break 'test_3 {} }
+ loop { while break {} }
+ //~^ ERROR `break` or `continue` with no label
+
+ loop {
+ 'test_4: while break 'test_4 {}
+ break;
+ }
+ loop {
+ while break {}
+ //~^ ERROR `break` or `continue` with no label
+ break;
+ }
+
+ 'test_5: while continue 'test_5 {}
+ while continue {}
+ //~^ ERROR `break` or `continue` with no label
+
+ 'test_6: while let true = continue 'test_6 {}
+ while let true = continue {}
+ //~^ ERROR `break` or `continue` with no label
+
+ loop { 'test_7: while continue 'test_7 {} }
+ loop { while continue {} }
+ //~^ ERROR `break` or `continue` with no label
+
+ loop {
+ 'test_8: while continue 'test_8 {}
+ continue;
+ }
+ loop {
+ while continue {}
+ //~^ ERROR `break` or `continue` with no label
+ continue;
+ }
+}
--- /dev/null
+error[E0590]: `break` or `continue` with no label in the condition of a `while` loop
+ --> $DIR/issue-37576.rs:13:11
+ |
+LL | while break {}
+ | ^^^^^ unlabeled `break` in the condition of a `while` loop
+
+error[E0590]: `break` or `continue` with no label in the condition of a `while` loop
+ --> $DIR/issue-37576.rs:17:22
+ |
+LL | while let true = break {}
+ | ^^^^^ unlabeled `break` in the condition of a `while` loop
+
+error[E0590]: `break` or `continue` with no label in the condition of a `while` loop
+ --> $DIR/issue-37576.rs:21:18
+ |
+LL | loop { while break {} }
+ | ^^^^^ unlabeled `break` in the condition of a `while` loop
+
+error[E0590]: `break` or `continue` with no label in the condition of a `while` loop
+ --> $DIR/issue-37576.rs:29:15
+ |
+LL | while break {}
+ | ^^^^^ unlabeled `break` in the condition of a `while` loop
+
+error[E0590]: `break` or `continue` with no label in the condition of a `while` loop
+ --> $DIR/issue-37576.rs:35:11
+ |
+LL | while continue {}
+ | ^^^^^^^^ unlabeled `continue` in the condition of a `while` loop
+
+error[E0590]: `break` or `continue` with no label in the condition of a `while` loop
+ --> $DIR/issue-37576.rs:39:22
+ |
+LL | while let true = continue {}
+ | ^^^^^^^^ unlabeled `continue` in the condition of a `while` loop
+
+error[E0590]: `break` or `continue` with no label in the condition of a `while` loop
+ --> $DIR/issue-37576.rs:43:18
+ |
+LL | loop { while continue {} }
+ | ^^^^^^^^ unlabeled `continue` in the condition of a `while` loop
+
+error[E0590]: `break` or `continue` with no label in the condition of a `while` loop
+ --> $DIR/issue-37576.rs:51:15
+ |
+LL | while continue {}
+ | ^^^^^^^^ unlabeled `continue` in the condition of a `while` loop
+
+error: aborting due to 8 previous errors
+
+For more information about this error, try `rustc --explain E0590`.
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+mod my_mod {
+ pub struct MyStruct {
+ priv_field: isize
+ }
+ pub fn MyStruct () -> MyStruct {
+ MyStruct {priv_field: 4}
+ }
+ impl MyStruct {
+ fn happyfun(&self) {}
+ }
+}
+
+fn main() {
+ let my_struct = my_mod::MyStruct();
+ let _woohoo = (&my_struct).priv_field;
+ //~^ ERROR field `priv_field` of struct `my_mod::MyStruct` is private
+
+ let _woohoo = (Box::new(my_struct)).priv_field;
+ //~^ ERROR field `priv_field` of struct `my_mod::MyStruct` is private
+
+ (&my_struct).happyfun(); //~ ERROR method `happyfun` is private
+
+ (Box::new(my_struct)).happyfun(); //~ ERROR method `happyfun` is private
+ let nope = my_struct.priv_field;
+ //~^ ERROR field `priv_field` of struct `my_mod::MyStruct` is private
+}
--- /dev/null
+error[E0616]: field `priv_field` of struct `my_mod::MyStruct` is private
+ --> $DIR/issue-3763.rs:25:19
+ |
+LL | let _woohoo = (&my_struct).priv_field;
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0616]: field `priv_field` of struct `my_mod::MyStruct` is private
+ --> $DIR/issue-3763.rs:28:19
+ |
+LL | let _woohoo = (Box::new(my_struct)).priv_field;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0624]: method `happyfun` is private
+ --> $DIR/issue-3763.rs:31:18
+ |
+LL | (&my_struct).happyfun(); //~ ERROR method `happyfun` is private
+ | ^^^^^^^^
+
+error[E0624]: method `happyfun` is private
+ --> $DIR/issue-3763.rs:33:27
+ |
+LL | (Box::new(my_struct)).happyfun(); //~ ERROR method `happyfun` is private
+ | ^^^^^^^^
+
+error[E0616]: field `priv_field` of struct `my_mod::MyStruct` is private
+ --> $DIR/issue-3763.rs:34:16
+ |
+LL | let nope = my_struct.priv_field;
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 5 previous errors
+
+Some errors occurred: E0616, E0624.
+For more information about an error, try `rustc --explain E0616`.
--- /dev/null
+// 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.
+
+// compile-flags: -Z unpretty=mir
+// ignore-cloudabi no std::path
+
+use std::path::MAIN_SEPARATOR;
+
+fn main() {
+ let mut foo : String = "hello".to_string();
+ foo.push(MAIN_SEPARATOR);
+ println!("{}", foo);
+ let x: () = 0; //~ ERROR: mismatched types
+}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-37665.rs:20:17
+ |
+LL | let x: () = 0; //~ ERROR: mismatched types
+ | ^ expected (), found integral variable
+ |
+ = note: expected type `()`
+ found type `{integer}`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// 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 main() {
+ extern crate libc; //~ ERROR use of unstable
+ use libc::*; //~ ERROR unresolved import
+}
--- /dev/null
+error[E0432]: unresolved import `libc`
+ --> $DIR/issue-37887.rs:13:9
+ |
+LL | use libc::*; //~ ERROR unresolved import
+ | ^^^^ Maybe a missing `extern crate libc;`?
+
+error[E0658]: use of unstable library feature 'libc': use `libc` from crates.io (see issue #27783)
+ --> $DIR/issue-37887.rs:12:5
+ |
+LL | extern crate libc; //~ ERROR use of unstable
+ | ^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(libc)] to the crate attributes to enable
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0432, E0658.
+For more information about an error, try `rustc --explain E0432`.
--- /dev/null
+// 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.
+
+#![feature(associated_consts, rustc_attrs)]
+#![allow(warnings)]
+
+trait MyTrait {
+ const MY_CONST: &'static str;
+}
+
+macro_rules! my_macro {
+ () => {
+ struct MyStruct;
+
+ impl MyTrait for MyStruct {
+ const MY_CONST: &'static str = stringify!(abc);
+ }
+ }
+}
+
+my_macro!();
+
+#[rustc_error]
+fn main() {} //~ ERROR compilation successful
--- /dev/null
+error: compilation successful
+ --> $DIR/issue-38160.rs:31:1
+ |
+LL | fn main() {} //~ ERROR compilation successful
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Thing {
+ x: isize
+}
+
+impl Thing {
+ fn mul(&self, c: &isize) -> Thing {
+ Thing {x: self.x * *c}
+ }
+}
+
+fn main() {
+ let u = Thing {x: 2};
+ let _v = u.mul(&3); // This is ok
+ let w = u * 3; //~ ERROR binary operation `*` cannot be applied to type `Thing`
+}
--- /dev/null
+error[E0369]: binary operation `*` cannot be applied to type `Thing`
+ --> $DIR/issue-3820.rs:24:13
+ |
+LL | let w = u * 3; //~ ERROR binary operation `*` cannot be applied to type `Thing`
+ | ^^^^^
+ |
+ = note: an implementation of `std::ops::Mul` might be missing for `Thing`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0369`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Test that `fn foo::bar::{self}` only imports `bar` in the type namespace.
+
+mod foo {
+ pub fn f() { }
+}
+use foo::f::{self}; //~ ERROR unresolved import `foo::f`
+
+mod bar {
+ pub fn baz() {}
+ pub mod baz {}
+}
+use bar::baz::{self};
+
+fn main() {
+ baz(); //~ ERROR expected function, found module `baz`
+}
--- /dev/null
+error[E0432]: unresolved import `foo::f`
+ --> $DIR/issue-38293.rs:16:14
+ |
+LL | use foo::f::{self}; //~ ERROR unresolved import `foo::f`
+ | ^^^^ no `f` in `foo`
+
+error[E0423]: expected function, found module `baz`
+ --> $DIR/issue-38293.rs:25:5
+ |
+LL | baz(); //~ ERROR expected function, found module `baz`
+ | ^^^ not a function
+help: possible better candidate is found in another module, you can import it into scope
+ |
+LL | use bar::baz;
+ |
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0423, E0432.
+For more information about an error, try `rustc --explain E0423`.
--- /dev/null
+// 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.
+
+#![feature(rustc_attrs)]
+
+use std::ops::Deref;
+
+#[rustc_error]
+fn main() { //~ ERROR compilation successful
+ let _x: fn(&i32) -> <&i32 as Deref>::Target = unimplemented!();
+}
--- /dev/null
+error: compilation successful
+ --> $DIR/issue-38381.rs:16:1
+ |
+LL | / fn main() { //~ ERROR compilation successful
+LL | | let _x: fn(&i32) -> <&i32 as Deref>::Target = unimplemented!();
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait A<T>: std::ops::Add<Self> + Sized {}
+trait B<T>: A<T> {}
+trait C<T>: A<B<T, Output=usize>> {}
+//~^ ERROR the trait `B` cannot be made into an object
+
+fn main() {}
--- /dev/null
+error[E0038]: the trait `B` cannot be made into an object
+ --> $DIR/issue-38404.rs:13:15
+ |
+LL | trait C<T>: A<B<T, Output=usize>> {}
+ | ^^^^^^^^^^^^^^^^^^ the trait `B` cannot be made into an object
+ |
+ = note: the trait cannot use `Self` as a type parameter in the supertraits or where-clauses
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0038`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ let Box(a) = loop { };
+ //~^ ERROR expected tuple struct/variant, found struct `Box`
+
+ // (The below is a trick to allow compiler to infer a type for
+ // variable `a` without attempting to ascribe a type to the
+ // pattern or otherwise attempting to name the Box type, which
+ // would run afoul of issue #22207)
+ let _b: *mut i32 = *a;
+}
--- /dev/null
+error[E0532]: expected tuple struct/variant, found struct `Box`
+ --> $DIR/issue-38412.rs:12:9
+ |
+LL | let Box(a) = loop { };
+ | ^^^ constructor is not visible here due to private fields
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0532`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+const x: () = {
+ return; //~ ERROR return statement outside of function body
+};
+
+fn main() {}
--- /dev/null
+error[E0572]: return statement outside of function body
+ --> $DIR/issue-38458.rs:12:5
+ |
+LL | return; //~ ERROR return statement outside of function body
+ | ^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0572`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Q<T:?Sized> {}
+trait Foo where u32: Q<Self> {
+ fn foo(&self);
+}
+
+impl Q<()> for u32 {}
+impl Foo for () {
+ fn foo(&self) {
+ println!("foo!");
+ }
+}
+
+fn main() {
+ let _f: Box<Foo> = //~ ERROR `Foo` cannot be made into an object
+ Box::new(()); //~ ERROR `Foo` cannot be made into an object
+}
--- /dev/null
+error[E0038]: the trait `Foo` cannot be made into an object
+ --> $DIR/issue-38604.rs:24:13
+ |
+LL | let _f: Box<Foo> = //~ ERROR `Foo` cannot be made into an object
+ | ^^^^^^^^ the trait `Foo` cannot be made into an object
+ |
+ = note: the trait cannot use `Self` as a type parameter in the supertraits or where-clauses
+
+error[E0038]: the trait `Foo` cannot be made into an object
+ --> $DIR/issue-38604.rs:25:9
+ |
+LL | Box::new(()); //~ ERROR `Foo` cannot be made into an object
+ | ^^^^^^^^^^^^ the trait `Foo` cannot be made into an object
+ |
+ = note: the trait cannot use `Self` as a type parameter in the supertraits or where-clauses
+ = note: required because of the requirements on the impl of `std::ops::CoerceUnsized<std::boxed::Box<dyn Foo>>` for `std::boxed::Box<()>`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0038`.
--- /dev/null
+// 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 main() {
+ let a = std::sys::imp::process::process_common::StdioPipes { ..panic!() };
+ //~^ ERROR failed to resolve. Could not find `imp` in `sys` [E0433]
+ //~^^ ERROR module `sys` is private [E0603]
+}
--- /dev/null
+error[E0433]: failed to resolve. Could not find `imp` in `sys`
+ --> $DIR/issue-38857.rs:12:23
+ |
+LL | let a = std::sys::imp::process::process_common::StdioPipes { ..panic!() };
+ | ^^^ Could not find `imp` in `sys`
+
+error[E0603]: module `sys` is private
+ --> $DIR/issue-38857.rs:12:13
+ |
+LL | let a = std::sys::imp::process::process_common::StdioPipes { ..panic!() };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0433, E0603.
+For more information about an error, try `rustc --explain E0433`.
--- /dev/null
+// 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.
+
+pub struct List<T> {
+ head: T,
+}
+
+impl Drop for List<i32> { //~ ERROR E0366
+ fn drop(&mut self) {
+ panic!()
+ }
+}
+
+fn main() {
+ List { head: 0 };
+}
--- /dev/null
+error[E0366]: Implementations of Drop cannot be specialized
+ --> $DIR/issue-38868.rs:15:1
+ |
+LL | / impl Drop for List<i32> { //~ ERROR E0366
+LL | | fn drop(&mut self) {
+LL | | panic!()
+LL | | }
+LL | | }
+ | |_^
+ |
+note: Use same sequence of generic type and region parameters that is on the struct/enum definition
+ --> $DIR/issue-38868.rs:11:1
+ |
+LL | / pub struct List<T> {
+LL | | head: T,
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0366`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn foo<T: Iterator>() {
+ T::Item; //~ ERROR no associated item named `Item` found for type `T` in the current scope
+}
+
+fn main() { }
--- /dev/null
+error[E0599]: no associated item named `Item` found for type `T` in the current scope
+ --> $DIR/issue-38919.rs:12:5
+ |
+LL | T::Item; //~ ERROR no associated item named `Item` found for type `T` in the current scope
+ | ^^^^^^^ associated item not found in `T`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
--- /dev/null
+// 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 _test(ref _p: str) {}
+//~^ ERROR the size for values of type
+
+fn main() { }
--- /dev/null
+error[E0277]: the size for values of type `str` cannot be known at compilation time
+ --> $DIR/issue-38954.rs:11:23
+ |
+LL | fn _test(ref _p: str) {}
+ | ^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `str`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
--- /dev/null
+// 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.
+
+#![feature(associated_consts)]
+
+trait VecN {
+ const DIM: usize;
+}
+trait Mat {
+ type Row: VecN;
+}
+
+fn m<M: Mat>() {
+ let a = [3; M::Row::DIM]; //~ ERROR associated type `Row` not found for `M`
+}
+fn main() {
+}
--- /dev/null
+error[E0220]: associated type `Row` not found for `M`
+ --> $DIR/issue-39211.rs:21:17
+ |
+LL | let a = [3; M::Row::DIM]; //~ ERROR associated type `Row` not found for `M`
+ | ^^^^^^^^^^^ associated type `Row` not found
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0220`.
--- /dev/null
+// 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.
+
+enum Foo {
+ Bar { bar: Bar, id: usize }
+}
+
+enum Bar {
+ A, B, C, D, E, F
+}
+
+fn test(f: Foo) {
+ match f {
+ //~^ ERROR non-exhaustive patterns
+ //~| patterns
+ Foo::Bar { bar: Bar::A, .. } => (),
+ Foo::Bar { bar: Bar::B, .. } => (),
+ }
+}
+
+fn main() {}
--- /dev/null
+error[E0004]: non-exhaustive patterns: `Bar { bar: C, .. }`, `Bar { bar: D, .. }`, `Bar { bar: E, .. }` and 1 more not covered
+ --> $DIR/issue-39362.rs:20:11
+ |
+LL | match f {
+ | ^ patterns `Bar { bar: C, .. }`, `Bar { bar: D, .. }`, `Bar { bar: E, .. }` and 1 more not covered
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0004`.
--- /dev/null
+// 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.
+
+#![allow(unused_macros)]
+
+macro_rules! assign {
+ (($($a:tt)*) = ($($b:tt))*) => { //~ ERROR expected one of: `*`, `+`, or `?`
+ $($a)* = $($b)*
+ }
+}
+
+fn main() {}
--- /dev/null
+error: expected one of: `*`, `+`, or `?`
+ --> $DIR/issue-39388.rs:14:22
+ |
+LL | (($($a:tt)*) = ($($b:tt))*) => { //~ ERROR expected one of: `*`, `+`, or `?`
+ | ^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// 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.
+
+#![allow(unused)]
+
+macro_rules! m { ($i) => {} }
+//~^ ERROR missing fragment specifier
+//~| WARN previously accepted
+
+fn main() {}
--- /dev/null
+error: missing fragment specifier
+ --> $DIR/issue-39404.rs:13:19
+ |
+LL | macro_rules! m { ($i) => {} }
+ | ^^
+ |
+ = note: #[deny(missing_fragment_specifier)] on by default
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
+
+error: aborting due to previous error
+
--- /dev/null
+// 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.
+
+trait Dim {
+ fn dim() -> usize;
+}
+
+enum Dim3 {}
+
+impl Dim for Dim3 {
+ fn dim() -> usize {
+ 3
+ }
+}
+
+fn main() {
+ let array: [usize; Dim3::dim()]
+ //~^ ERROR E0015
+ //~| ERROR E0080
+ = [0; Dim3::dim()];
+ //~^ ERROR E0015
+ //~| ERROR E0080
+}
--- /dev/null
+error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants
+ --> $DIR/issue-39559-2.rs:24:24
+ |
+LL | let array: [usize; Dim3::dim()]
+ | ^^^^^^^^^^^
+
+error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants
+ --> $DIR/issue-39559-2.rs:27:15
+ |
+LL | = [0; Dim3::dim()];
+ | ^^^^^^^^^^^
+
+error[E0080]: could not evaluate repeat length
+ --> $DIR/issue-39559-2.rs:27:15
+ |
+LL | = [0; Dim3::dim()];
+ | ^^^^^^^^^^^ calling non-const fn `<Dim3 as Dim>::dim`
+
+error[E0080]: could not evaluate constant expression
+ --> $DIR/issue-39559-2.rs:24:16
+ |
+LL | let array: [usize; Dim3::dim()]
+ | ^^^^^^^^-----------^
+ | |
+ | calling non-const fn `<Dim3 as Dim>::dim`
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0015, E0080.
+For more information about an error, try `rustc --explain E0015`.
--- /dev/null
+// 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.
+
+trait Dim {
+ fn dim() -> usize;
+}
+
+enum Dim3 {}
+
+impl Dim for Dim3 {
+ fn dim() -> usize {
+ 3
+ }
+}
+
+pub struct Vector<T, D: Dim> {
+ entries: [T; D::dim()],
+ //~^ ERROR no function or associated item named `dim` found for type `D` in the current scope
+ _dummy: D,
+}
+
+fn main() {}
--- /dev/null
+error[E0599]: no function or associated item named `dim` found for type `D` in the current scope
+ --> $DIR/issue-39559.rs:24:18
+ |
+LL | entries: [T; D::dim()],
+ | ^^^^^^ function or associated item not found in `D`
+ |
+ = help: items from traits can only be used if the trait is implemented and in scope
+ = note: the following trait defines an item `dim`, perhaps you need to implement it:
+ candidate #1: `Dim`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
--- /dev/null
+// 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(a: [0; 1]) {} //~ ERROR expected type, found `0`
+//~| ERROR expected one of `)`, `,`, `->`, `where`, or `{`, found `]`
+// FIXME(jseyfried): avoid emitting the second error (preexisting)
+
+fn main() {}
--- /dev/null
+error: expected type, found `0`
+ --> $DIR/issue-39616.rs:11:12
+ |
+LL | fn foo(a: [0; 1]) {} //~ ERROR expected type, found `0`
+ | ^
+
+error: expected one of `)`, `,`, `->`, `where`, or `{`, found `]`
+ --> $DIR/issue-39616.rs:11:16
+ |
+LL | fn foo(a: [0; 1]) {} //~ ERROR expected type, found `0`
+ | ^ expected one of `)`, `,`, `->`, `where`, or `{` here
+
+error: aborting due to 2 previous errors
+
--- /dev/null
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-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(fn_traits)]
+
+fn main() {
+ <fn() as Fn()>::call;
+ //~^ ERROR associated type bindings are not allowed here [E0229]
+}
--- /dev/null
+error[E0229]: associated type bindings are not allowed here
+ --> $DIR/issue-39687.rs:14:16
+ |
+LL | <fn() as Fn()>::call;
+ | ^^ associated type not allowed here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0229`.
--- /dev/null
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Point {
+ x: f64,
+ y: f64,
+}
+
+trait ToString_ {
+ fn to_string(&self) -> String;
+}
+
+impl ToString_ for Point {
+ fn new(x: f64, y: f64) -> Point {
+ //~^ ERROR method `new` is not a member of trait `ToString_`
+ Point { x: x, y: y }
+ }
+
+ fn to_string(&self) -> String {
+ format!("({}, {})", self.x, self.y)
+ }
+}
+
+fn main() {
+ let p = Point::new(0.0, 0.0);
+ //~^ ERROR no function or associated item named `new` found for type `Point`
+ println!("{}", p.to_string());
+}
--- /dev/null
+error[E0407]: method `new` is not a member of trait `ToString_`
+ --> $DIR/issue-3973.rs:21:5
+ |
+LL | / fn new(x: f64, y: f64) -> Point {
+LL | | //~^ ERROR method `new` is not a member of trait `ToString_`
+LL | | Point { x: x, y: y }
+LL | | }
+ | |_____^ not a member of trait `ToString_`
+
+error[E0599]: no function or associated item named `new` found for type `Point` in the current scope
+ --> $DIR/issue-3973.rs:32:13
+ |
+LL | struct Point {
+ | ------------ function or associated item `new` not found for this
+...
+LL | let p = Point::new(0.0, 0.0);
+ | ^^^^^^^^^^ function or associated item not found in `Point`
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0407, E0599.
+For more information about an error, try `rustc --explain E0407`.
--- /dev/null
+// 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.
+
+macro_rules! get_opt {
+ ($tgt:expr, $field:ident) => {
+ if $tgt.has_$field() {}
+ }
+}
+
+fn main() {
+ get_opt!(bar, foo);
+ //~^ ERROR expected `{`, found `foo`
+}
--- /dev/null
+error: expected `{`, found `foo`
+ --> $DIR/issue-39848.rs:18:19
+ |
+LL | if $tgt.has_$field() {}
+ | -- - help: try placing this code inside a block: `{ foo(); }`
+ | |
+ | this `if` statement has a condition, but no block
+...
+LL | get_opt!(bar, foo);
+ | ^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use zoo::fly; //~ ERROR: function `fly` is private
+
+mod zoo {
+ fn fly() {}
+}
+
+
+fn main() {
+ fly();
+}
--- /dev/null
+error[E0603]: function `fly` is private
+ --> $DIR/issue-3993.rs:11:5
+ |
+LL | use zoo::fly; //~ ERROR: function `fly` is private
+ | ^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0603`.
--- /dev/null
+// 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.
+
+trait Array<'a> {
+ type Element: 'a;
+}
+
+trait Visit {
+ fn visit() {}
+}
+
+impl<'a> Array<'a> for () {
+ type Element = &'a ();
+}
+
+impl Visit for () where
+ //(): for<'a> Array<'a, Element=&'a ()>, // No ICE
+ (): for<'a> Array<'a, Element=()>, // ICE
+{}
+
+fn main() {
+ <() as Visit>::visit();
+ //~^ ERROR type mismatch resolving `for<'a> <() as Array<'a>>::Element == ()`
+}
--- /dev/null
+error[E0271]: type mismatch resolving `for<'a> <() as Array<'a>>::Element == ()`
+ --> $DIR/issue-39970.rs:29:5
+ |
+LL | <() as Visit>::visit();
+ | ^^^^^^^^^^^^^^^^^^^^ expected &(), found ()
+ |
+ = note: expected type `&()`
+ found type `()`
+ = note: required because of the requirements on the impl of `Visit` for `()`
+note: required by `Visit::visit`
+ --> $DIR/issue-39970.rs:16:5
+ |
+LL | fn visit() {}
+ | ^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0271`.
--- /dev/null
+// 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.
+
+const LENGTH: f64 = 2;
+
+struct Thing {
+ f: [[f64; 2]; LENGTH],
+ //~^ ERROR mismatched types
+ //~| expected usize, found f64
+}
+
+fn main() {
+ let _t = Thing { f: [[0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]] };
+}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-39974.rs:14:19
+ |
+LL | f: [[f64; 2]; LENGTH],
+ | ^^^^^^ expected usize, found f64
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// 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 main() {
+ let bar: fn(&mut u32) = |_| {};
+
+ fn foo(x: Box<Fn(&i32)>) {}
+ let bar = Box::new(|x: &i32| {}) as Box<Fn(_)>;
+ foo(bar); //~ ERROR mismatched types
+ //~| expected concrete lifetime, found bound lifetime parameter
+}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-40000.rs:16:9
+ |
+LL | foo(bar); //~ ERROR mismatched types
+ | ^^^ expected concrete lifetime, found bound lifetime parameter
+ |
+ = note: expected type `std::boxed::Box<(dyn for<'r> std::ops::Fn(&'r i32) + 'static)>`
+ found type `std::boxed::Box<dyn std::ops::Fn(_)>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+warning: not reporting region error due to nll
+ --> $DIR/issue-40288-2.rs:17:20
+ |
+LL | slice[0] = y;
+ | ^
+
+warning: not reporting region error due to nll
+ --> $DIR/issue-40288-2.rs:16:20
+ |
+LL | let slice: &mut [_] = &mut out;
+ | ^^^^^^^^
+
+warning: not reporting region error due to nll
+ --> $DIR/issue-40288-2.rs:14:19
+ |
+LL | let mut out = [x];
+ | ^^^
+
+warning: not reporting region error due to nll
+ --> $DIR/issue-40288-2.rs:32:20
+ |
+LL | dst.head = y;
+ | ^
+
+warning: not reporting region error due to nll
+ --> $DIR/issue-40288-2.rs:31:18
+ |
+LL | let dst: &mut Struct<_, [()]> = &mut out;
+ | ^^^^^^^^^^^^^^^^^^^^
+
+warning: not reporting region error due to nll
+ --> $DIR/issue-40288-2.rs:29:19
+ |
+LL | let mut out = Struct { head: x, _tail: [()] };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0621]: explicit lifetime required in the type of `y`
+ --> $DIR/issue-40288-2.rs:14:9
+ |
+LL | fn lifetime_transmute_slice<'a, T: ?Sized>(x: &'a T, y: &T) -> &'a T {
+ | - consider changing the type of `y` to `&'a T`
+LL | let mut out = [x];
+ | ^^^^^^^ lifetime `'a` required
+
+error[E0621]: explicit lifetime required in the type of `y`
+ --> $DIR/issue-40288-2.rs:29:9
+ |
+LL | fn lifetime_transmute_struct<'a, T: ?Sized>(x: &'a T, y: &T) -> &'a T {
+ | - consider changing the type of `y` to `&'a T`
+LL | let mut out = Struct { head: x, _tail: [()] };
+ | ^^^^^^^ lifetime `'a` required
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0621`.
--- /dev/null
+// 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 prove_static<T: 'static + ?Sized>(_: &'static T) {}
+
+fn lifetime_transmute_slice<'a, T: ?Sized>(x: &'a T, y: &T) -> &'a T {
+ let mut out = [x];
+ {
+ let slice: &mut [_] = &mut out;
+ slice[0] = y;
+ }
+ out[0]
+ //~^ ERROR 19:5: 19:11: explicit lifetime required in the type of `y` [E0621]
+}
+
+struct Struct<T, U: ?Sized> {
+ head: T,
+ _tail: U
+}
+
+fn lifetime_transmute_struct<'a, T: ?Sized>(x: &'a T, y: &T) -> &'a T {
+ let mut out = Struct { head: x, _tail: [()] };
+ {
+ let dst: &mut Struct<_, [()]> = &mut out;
+ dst.head = y;
+ }
+ out.head
+ //~^ ERROR 34:5: 34:13: explicit lifetime required in the type of `y` [E0621]
+}
+
+fn main() {
+ prove_static(lifetime_transmute_slice("", &String::from("foo")));
+ prove_static(lifetime_transmute_struct("", &String::from("bar")));
+}
--- /dev/null
+error[E0621]: explicit lifetime required in the type of `y`
+ --> $DIR/issue-40288-2.rs:19:5
+ |
+LL | fn lifetime_transmute_slice<'a, T: ?Sized>(x: &'a T, y: &T) -> &'a T {
+ | - consider changing the type of `y` to `&'a T`
+...
+LL | out[0]
+ | ^^^^^^ lifetime `'a` required
+
+error[E0621]: explicit lifetime required in the type of `y`
+ --> $DIR/issue-40288-2.rs:34:5
+ |
+LL | fn lifetime_transmute_struct<'a, T: ?Sized>(x: &'a T, y: &T) -> &'a T {
+ | - consider changing the type of `y` to `&'a T`
+...
+LL | out.head
+ | ^^^^^^^^ lifetime `'a` required
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0621`.
--- /dev/null
+error[E0506]: cannot assign to `*refr` because it is borrowed
+ --> $DIR/issue-40288.rs:26:5
+ |
+LL | save_ref(&*refr, &mut out);
+ | ------ borrow of `*refr` occurs here
+...
+LL | *refr = 3; //~ ERROR cannot assign to `*refr` because it is borrowed
+ | ^^^^^^^^^ assignment to borrowed `*refr` occurs here
+...
+LL | println!("{:?}", out[0]);
+ | ------ borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0506`.
--- /dev/null
+// 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 save_ref<'a>(refr: &'a i32, to: &mut [&'a i32]) {
+ for val in &mut *to {
+ *val = refr;
+ }
+}
+
+fn main() {
+ let ref init = 0i32;
+ let ref mut refr = 1i32;
+
+ let mut out = [init];
+
+ save_ref(&*refr, &mut out);
+
+ // This shouldn't be allowed as `refr` is borrowed
+ *refr = 3; //~ ERROR cannot assign to `*refr` because it is borrowed
+
+ // Prints 3?!
+ println!("{:?}", out[0]);
+}
--- /dev/null
+error[E0506]: cannot assign to `*refr` because it is borrowed
+ --> $DIR/issue-40288.rs:26:5
+ |
+LL | save_ref(&*refr, &mut out);
+ | ----- borrow of `*refr` occurs here
+...
+LL | *refr = 3; //~ ERROR cannot assign to `*refr` because it is borrowed
+ | ^^^^^^^^^ assignment to borrowed `*refr` occurs here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0506`.
--- /dev/null
+// 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.
+
+#![feature(rustc_attrs)]
+#![allow(warnings)]
+
+enum E {
+ A = {
+ enum F { B }
+ 0
+ }
+}
+
+#[rustc_error]
+fn main() {}
+//~^ ERROR compilation successful
+
--- /dev/null
+error: compilation successful
+ --> $DIR/issue-40350.rs:22:1
+ |
+LL | fn main() {}
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+error: unsatisfied lifetime constraints
+ --> $DIR/issue-40510-1.rs:18:9
+ |
+LL | || {
+ | _____-
+ | |_____|
+ | ||
+LL | || &mut x
+ | || ^^^^^^ free region requires that `'1` must outlive `'2`
+LL | || };
+ | || -
+ | ||_____|
+ | |______lifetime `'1` represents the closure body
+ | lifetime `'2` appears in return type
+
+error: aborting due to previous error
+
--- /dev/null
+// 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.
+
+#![feature(rustc_attrs)]
+#![allow(unused)]
+
+fn f() {
+ let mut x: Box<()> = Box::new(());
+
+ || {
+ &mut x
+ };
+}
+
+#[rustc_error]
+fn main() {} //~ ERROR compilation successful
--- /dev/null
+error: compilation successful
+ --> $DIR/issue-40510-1.rs:23:1
+ |
+LL | fn main() {} //~ ERROR compilation successful
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// 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.
+
+#![feature(rustc_attrs)]
+#![allow(unused)]
+
+fn f() {
+ let x: Box<()> = Box::new(());
+
+ || {
+ &x
+ };
+}
+
+#[rustc_error]
+fn main() {} //~ ERROR compilation successful
--- /dev/null
+error: compilation successful
+ --> $DIR/issue-40510-2.rs:23:1
+ |
+LL | fn main() {} //~ ERROR compilation successful
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+error: unsatisfied lifetime constraints
+ --> $DIR/issue-40510-3.rs:18:9
+ |
+LL | || {
+ | _____-
+ | |_____|
+ | ||
+LL | || || {
+ | ||_________^
+LL | ||| x.push(())
+LL | ||| }
+ | |||_________^ free region requires that `'1` must outlive `'2`
+LL | || };
+ | || -
+ | ||_____|
+ | |______lifetime `'1` represents the closure body
+ | lifetime `'2` appears in return type
+
+error: aborting due to previous error
+
--- /dev/null
+// 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.
+
+#![feature(rustc_attrs)]
+#![allow(unused)]
+
+fn f() {
+ let mut x: Vec<()> = Vec::new();
+
+ || {
+ || {
+ x.push(())
+ }
+ };
+}
+
+#[rustc_error]
+fn main() {} //~ ERROR compilation successful
--- /dev/null
+error: compilation successful
+ --> $DIR/issue-40510-3.rs:25:1
+ |
+LL | fn main() {} //~ ERROR compilation successful
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// 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.
+
+#![feature(rustc_attrs)]
+#![allow(unused)]
+
+fn f() {
+ let x: Vec<()> = Vec::new();
+
+ || {
+ || {
+ x.len()
+ }
+ };
+}
+
+#[rustc_error]
+fn main() {} //~ ERROR compilation successful
--- /dev/null
+error: compilation successful
+ --> $DIR/issue-40510-4.rs:25:1
+ |
+LL | fn main() {} //~ ERROR compilation successful
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// 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 f(_: &[f32]) {}
+
+fn main() {
+ () + f(&[1.0]);
+ //~^ ERROR binary operation `+` cannot be applied to type `()`
+}
--- /dev/null
+error[E0369]: binary operation `+` cannot be applied to type `()`
+ --> $DIR/issue-40610.rs:14:5
+ |
+LL | () + f(&[1.0]);
+ | ^^^^^^^^^^^^^^
+ |
+ = note: an implementation of `std::ops::Add` might be missing for `()`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0369`.
--- /dev/null
+// 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 main() {
+ [0; ..10];
+ //~^ ERROR mismatched types
+ //~| expected type `usize`
+ //~| found type `std::ops::RangeTo<{integer}>`
+}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-40749.rs:12:9
+ |
+LL | [0; ..10];
+ | ^^^^ expected usize, found struct `std::ops::RangeTo`
+ |
+ = note: expected type `usize`
+ found type `std::ops::RangeTo<{integer}>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// 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.
+
+trait T { m!(); } //~ ERROR cannot find macro `m!` in this scope
+
+struct S;
+impl S { m!(); } //~ ERROR cannot find macro `m!` in this scope
+
+fn main() {}
--- /dev/null
+error: cannot find macro `m!` in this scope
+ --> $DIR/issue-40845.rs:14:10
+ |
+LL | impl S { m!(); } //~ ERROR cannot find macro `m!` in this scope
+ | ^
+
+error: cannot find macro `m!` in this scope
+ --> $DIR/issue-40845.rs:11:11
+ |
+LL | trait T { m!(); } //~ ERROR cannot find macro `m!` in this scope
+ | ^
+
+error: aborting due to 2 previous errors
+
--- /dev/null
+// 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 f(_: &[f32]) {}
+
+fn main() {
+ ()[f(&[1.0])];
+ //~^ ERROR cannot index into a value of type `()`
+}
--- /dev/null
+error[E0608]: cannot index into a value of type `()`
+ --> $DIR/issue-40861.rs:14:5
+ |
+LL | ()[f(&[1.0])];
+ | ^^^^^^^^^^^^^
+ |
+ = help: to access tuple elements, use tuple indexing syntax (e.g. `tuple.0`)
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0608`.
--- /dev/null
+error[E0161]: cannot move a value of type dyn Trait: the size of dyn Trait cannot be statically determined
+ --> $DIR/issue-41139.rs:16:23
+ |
+LL | let t : &Trait = &get_function()();
+ | ^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0161`.
--- /dev/null
+// 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.
+
+trait Trait {}
+
+fn get_function<'a>() -> &'a Fn() -> Trait { panic!("") }
+
+fn main() {
+ let t : &Trait = &get_function()();
+ //~^ ERROR cannot move a value of type (dyn Trait + 'static)
+}
--- /dev/null
+error[E0161]: cannot move a value of type (dyn Trait + 'static): the size of (dyn Trait + 'static) cannot be statically determined
+ --> $DIR/issue-41139.rs:16:23
+ |
+LL | let t : &Trait = &get_function()();
+ | ^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0161`.
--- /dev/null
+// 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.
+
+pub fn example(ref s: str) {}
+//~^ ERROR the size for values of type
+
+fn main() {}
--- /dev/null
+error[E0277]: the size for values of type `str` cannot be known at compilation time
+ --> $DIR/issue-41229-ref-str.rs:11:28
+ |
+LL | pub fn example(ref s: str) {}
+ | ^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `str`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
--- /dev/null
+// 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.
+
+// Matching against float literals should result in a linter error
+
+#![feature(exclusive_range_pattern)]
+#![allow(unused)]
+#![forbid(illegal_floating_point_literal_pattern)]
+
+fn main() {
+ let x = 42.0;
+ match x {
+ 5.0 => {}, //~ ERROR floating-point types cannot be used in patterns
+ //~| WARNING hard error
+ 5.0f32 => {}, //~ ERROR floating-point types cannot be used in patterns
+ //~| WARNING hard error
+ -5.0 => {}, //~ ERROR floating-point types cannot be used in patterns
+ //~| WARNING hard error
+ 1.0 .. 33.0 => {}, //~ ERROR floating-point types cannot be used in patterns
+ //~| WARNING hard error
+ //~| ERROR floating-point types cannot be used in patterns
+ //~| WARNING hard error
+ 39.0 ..= 70.0 => {}, //~ ERROR floating-point types cannot be used in patterns
+ //~| WARNING hard error
+ //~| ERROR floating-point types cannot be used in patterns
+ //~| WARNING hard error
+ _ => {},
+ };
+ let y = 5.0;
+ // Same for tuples
+ match (x, 5) {
+ (3.14, 1) => {}, //~ ERROR floating-point types cannot be used
+ //~| WARNING hard error
+ _ => {},
+ }
+ // Or structs
+ struct Foo { x: f32 };
+ match (Foo { x }) {
+ Foo { x: 2.0 } => {}, //~ ERROR floating-point types cannot be used
+ //~| WARNING hard error
+ _ => {},
+ }
+}
--- /dev/null
+error: floating-point types cannot be used in patterns
+ --> $DIR/issue-41255.rs:20:9
+ |
+LL | 5.0 => {}, //~ ERROR floating-point types cannot be used in patterns
+ | ^^^
+ |
+note: lint level defined here
+ --> $DIR/issue-41255.rs:15:11
+ |
+LL | #![forbid(illegal_floating_point_literal_pattern)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620>
+
+error: floating-point types cannot be used in patterns
+ --> $DIR/issue-41255.rs:22:9
+ |
+LL | 5.0f32 => {}, //~ ERROR floating-point types cannot be used in patterns
+ | ^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620>
+
+error: floating-point types cannot be used in patterns
+ --> $DIR/issue-41255.rs:24:10
+ |
+LL | -5.0 => {}, //~ ERROR floating-point types cannot be used in patterns
+ | ^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620>
+
+error: floating-point types cannot be used in patterns
+ --> $DIR/issue-41255.rs:26:9
+ |
+LL | 1.0 .. 33.0 => {}, //~ ERROR floating-point types cannot be used in patterns
+ | ^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620>
+
+error: floating-point types cannot be used in patterns
+ --> $DIR/issue-41255.rs:26:16
+ |
+LL | 1.0 .. 33.0 => {}, //~ ERROR floating-point types cannot be used in patterns
+ | ^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620>
+
+error: floating-point types cannot be used in patterns
+ --> $DIR/issue-41255.rs:30:9
+ |
+LL | 39.0 ..= 70.0 => {}, //~ ERROR floating-point types cannot be used in patterns
+ | ^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620>
+
+error: floating-point types cannot be used in patterns
+ --> $DIR/issue-41255.rs:30:18
+ |
+LL | 39.0 ..= 70.0 => {}, //~ ERROR floating-point types cannot be used in patterns
+ | ^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620>
+
+error: floating-point types cannot be used in patterns
+ --> $DIR/issue-41255.rs:39:10
+ |
+LL | (3.14, 1) => {}, //~ ERROR floating-point types cannot be used
+ | ^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620>
+
+error: floating-point types cannot be used in patterns
+ --> $DIR/issue-41255.rs:46:18
+ |
+LL | Foo { x: 2.0 } => {}, //~ ERROR floating-point types cannot be used
+ | ^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620>
+
+error: aborting due to 9 previous errors
+
--- /dev/null
+// 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.
+
+enum Foo {
+ A = "" + 1
+ //~^ ERROR binary operation `+` cannot be applied to type `&str`
+}
+
+enum Bar {
+ A = Foo::A as isize
+}
+
+fn main() {}
--- /dev/null
+error[E0369]: binary operation `+` cannot be applied to type `&str`
+ --> $DIR/issue-41394.rs:12:9
+ |
+LL | A = "" + 1
+ | ^^^^^^
+ |
+ = note: an implementation of `std::ops::Add` might be missing for `&str`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0369`.
--- /dev/null
+error[E0596]: cannot borrow immutable item as mutable
+ --> $DIR/issue-41726.rs:15:9
+ |
+LL | things[src.as_str()].sort(); //~ ERROR cannot borrow immutable
+ | ^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
--- /dev/null
+// 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.
+
+use std::collections::HashMap;
+fn main() {
+ let things: HashMap<String, Vec<String>> = HashMap::new();
+ for src in things.keys() {
+ things[src.as_str()].sort(); //~ ERROR cannot borrow immutable
+ }
+}
--- /dev/null
+error[E0596]: cannot borrow immutable indexed content as mutable
+ --> $DIR/issue-41726.rs:15:9
+ |
+LL | things[src.as_str()].sort(); //~ ERROR cannot borrow immutable
+ | ^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
--- /dev/null
+// 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.
+
+use std::ops::{Index, IndexMut};
+
+struct S;
+struct H;
+
+impl S {
+ fn f(&mut self) {}
+}
+
+impl Index<u32> for H {
+ type Output = S;
+ fn index(&self, index: u32) -> &S {
+ unimplemented!()
+ }
+}
+
+impl IndexMut<u32> for H {
+ fn index_mut(&mut self, index: u32) -> &mut S {
+ unimplemented!()
+ }
+}
+
+fn main() {
+ H["?"].f(); //~ ERROR mismatched types
+}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-41742.rs:34:7
+ |
+LL | H["?"].f(); //~ ERROR mismatched types
+ | ^^^ expected u32, found reference
+ |
+ = note: expected type `u32`
+ found type `&'static str`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// 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 main() {
+ include!(line!()); //~ ERROR argument must be a string literal
+}
--- /dev/null
+error: argument must be a string literal
+ --> $DIR/issue-41776.rs:12:14
+ |
+LL | include!(line!()); //~ ERROR argument must be a string literal
+ | ^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// 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 iterate<T, F>(initial: T, f: F) -> Iterate<T, F> {
+ Iterate {
+ state: initial,
+ f: f,
+ }
+}
+
+pub struct Iterate<T, F> {
+ state: T,
+ f: F
+}
+
+impl<T: Clone, F> Iterator for Iterate<T, F> where F: Fn(&T) -> T {
+ type Item = T;
+
+ #[inline]
+ fn next(&mut self) -> Option<Self::Item> {
+ self.state = (self.f)(&self.state);
+ Some(self.state.clone())
+ }
+ #[inline]
+ fn size_hint(&self) -> (usize, Option<usize>) { (std::usize::MAX, None) }
+}
+
+fn main() {
+ let a = iterate(0, |x| x+1);
+ println!("{:?}", a.iter().take(10).collect::<Vec<usize>>());
+ //~^ ERROR no method named `iter` found for type `Iterate<{integer}
+}
--- /dev/null
+error[E0599]: no method named `iter` found for type `Iterate<{integer}, [closure@$DIR/issue-41880.rs:36:24: 36:31]>` in the current scope
+ --> $DIR/issue-41880.rs:37:24
+ |
+LL | pub struct Iterate<T, F> {
+ | ------------------------ method `iter` not found for this
+...
+LL | println!("{:?}", a.iter().take(10).collect::<Vec<usize>>());
+ | ^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
--- /dev/null
+// 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.
+
+#[derive(Copy, Clone)]
+struct Flags;
+
+trait A {
+}
+
+impl<T> Drop for T where T: A { //~ ERROR E0119
+ //~^ ERROR E0120
+ //~| ERROR E0210
+ fn drop(&mut self) {
+ }
+}
+
+fn main() {}
--- /dev/null
+error[E0119]: conflicting implementations of trait `std::ops::Drop` for type `std::boxed::Box<_>`:
+ --> $DIR/issue-41974.rs:17:1
+ |
+LL | impl<T> Drop for T where T: A { //~ ERROR E0119
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: conflicting implementation in crate `alloc`:
+ - impl<T> std::ops::Drop for std::boxed::Box<T>
+ where T: ?Sized;
+ = note: downstream crates may implement trait `A` for type `std::boxed::Box<_>`
+
+error[E0120]: the Drop trait may only be implemented on structures
+ --> $DIR/issue-41974.rs:17:18
+ |
+LL | impl<T> Drop for T where T: A { //~ ERROR E0119
+ | ^ implementing Drop requires a struct
+
+error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct<T>`)
+ --> $DIR/issue-41974.rs:17:1
+ |
+LL | impl<T> Drop for T where T: A { //~ ERROR E0119
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+ |
+ = note: only traits defined in the current crate can be implemented for a type parameter
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0119, E0120, E0210.
+For more information about an error, try `rustc --explain E0119`.
--- /dev/null
+// 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.
+
+#![feature(rustc_attrs)]
+
+#[rustc_error]
+fn main() { //~ ERROR compilation successful
+ if ('x' as char) < ('y' as char) {
+ print!("x");
+ } else {
+ print!("y");
+ }
+}
--- /dev/null
+error: compilation successful
+ --> $DIR/issue-41998.rs:14:1
+ |
+LL | / fn main() { //~ ERROR compilation successful
+LL | | if ('x' as char) < ('y' as char) {
+LL | | print!("x");
+LL | | } else {
+LL | | print!("y");
+LL | | }
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ let a = if true {
+ 0
+ } else if false {
+//~^ ERROR if may be missing an else clause
+//~| expected type `()`
+//~| found type `{integer}`
+//~| expected (), found integral variable
+ 1
+ };
+}
--- /dev/null
+error[E0317]: if may be missing an else clause
+ --> $DIR/issue-4201.rs:14:12
+ |
+LL | } else if false {
+ | ____________^
+LL | | //~^ ERROR if may be missing an else clause
+LL | | //~| expected type `()`
+LL | | //~| found type `{integer}`
+LL | | //~| expected (), found integral variable
+LL | | 1
+LL | | };
+ | |_____^ expected (), found integral variable
+ |
+ = note: expected type `()`
+ found type `{integer}`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0317`.
--- /dev/null
+// 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.
+
+use std::ops::Deref;
+
+pub trait Foo {
+ fn baz(_: Self::Target) where Self: Deref {}
+ //~^ ERROR the size for values of type
+}
+
+pub fn f(_: ToString) {}
+//~^ ERROR the size for values of type
+
+fn main() { }
--- /dev/null
+error[E0277]: the size for values of type `<Self as std::ops::Deref>::Target` cannot be known at compilation time
+ --> $DIR/issue-42312.rs:14:29
+ |
+LL | fn baz(_: Self::Target) where Self: Deref {}
+ | ^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `<Self as std::ops::Deref>::Target`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
+ = help: consider adding a `where <Self as std::ops::Deref>::Target: std::marker::Sized` bound
+
+error[E0277]: the size for values of type `(dyn std::string::ToString + 'static)` cannot be known at compilation time
+ --> $DIR/issue-42312.rs:18:23
+ |
+LL | pub fn f(_: ToString) {}
+ | ^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `(dyn std::string::ToString + 'static)`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
--- /dev/null
+error[E0596]: cannot borrow immutable item `*TAB[..]` as mutable
+ --> $DIR/issue-42344.rs:14:5
+ |
+LL | TAB[0].iter_mut(); //~ ERROR cannot borrow data mutably in a `&` reference [E0389]
+ | ^^^^^^ cannot borrow as mutable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
--- /dev/null
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+static TAB: [&mut [u8]; 0] = [];
+
+pub unsafe fn test() {
+ TAB[0].iter_mut(); //~ ERROR cannot borrow data mutably in a `&` reference [E0389]
+}
+
+pub fn main() {}
--- /dev/null
+error[E0389]: cannot borrow data mutably in a `&` reference
+ --> $DIR/issue-42344.rs:14:5
+ |
+LL | TAB[0].iter_mut(); //~ ERROR cannot borrow data mutably in a `&` reference [E0389]
+ | ^^^^^^ assignment into an immutable reference
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0389`.
--- /dev/null
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo {
+ baz: usize
+}
+
+impl Foo {
+ fn bar() {
+ Foo { baz: 0 }.bar();
+ }
+
+ fn bar() { //~ ERROR duplicate definitions
+ }
+}
+
+fn main() {}
--- /dev/null
+error[E0201]: duplicate definitions with name `bar`:
+ --> $DIR/issue-4265.rs:20:5
+ |
+LL | / fn bar() {
+LL | | Foo { baz: 0 }.bar();
+LL | | }
+ | |_____- previous definition of `bar` here
+LL |
+LL | / fn bar() { //~ ERROR duplicate definitions
+LL | | }
+ | |_____^ duplicate definition
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0201`.
--- /dev/null
+// 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.
+
+#![feature(macro_vis_matcher)]
+
+macro_rules! foo {
+ ($($p:vis)*) => {} //~ ERROR repetition matches empty token tree
+}
+
+foo!(a);
--- /dev/null
+error: repetition matches empty token tree
+ --> $DIR/issue-42755.rs:14:7
+ |
+LL | ($($p:vis)*) => {} //~ ERROR repetition matches empty token tree
+ | ^^^^^^^^
+
+error[E0601]: `main` function not found in crate `issue_42755`
+ |
+ = note: consider adding a `main` function to `$DIR/issue-42755.rs`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0601`.
--- /dev/null
+error[E0382]: borrow of moved value: `s`
+ --> $DIR/issue-42796.rs:28:20
+ |
+LL | let mut s_copy = s;
+ | - value moved here
+...
+LL | println!("{}", s); //~ ERROR use of moved value
+ | ^ value borrowed here after move
+ |
+ = note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
--- /dev/null
+// 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.
+
+pub trait Mirror<Smoke> {
+ type Image;
+}
+
+impl<T, Smoke> Mirror<Smoke> for T {
+ type Image = T;
+}
+
+pub fn poison<S>(victim: String) where <String as Mirror<S>>::Image: Copy {
+ loop { drop(victim); }
+}
+
+fn main() {
+ let s = "Hello!".to_owned();
+ let mut s_copy = s;
+ s_copy.push_str("World!");
+ "0wned!".to_owned();
+ println!("{}", s); //~ ERROR use of moved value
+}
--- /dev/null
+error[E0382]: use of moved value: `s`
+ --> $DIR/issue-42796.rs:28:20
+ |
+LL | let mut s_copy = s;
+ | ---------- value moved here
+...
+LL | println!("{}", s); //~ ERROR use of moved value
+ | ^ value used here after move
+ |
+ = note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
--- /dev/null
+// 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.
+
+type Value = String;
+
+fn main() {
+ let f = |&Value::String(_)| (); //~ ERROR no associated item named
+
+ let vec: Vec<Value> = Vec::new();
+ vec.last().map(f);
+}
--- /dev/null
+error[E0599]: no associated item named `String` found for type `std::string::String` in the current scope
+ --> $DIR/issue-42880.rs:14:15
+ |
+LL | let f = |&Value::String(_)| (); //~ ERROR no associated item named
+ | ^^^^^^^^^^^^^^^^ associated item not found in `std::string::String`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
--- /dev/null
+// 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.
+
+struct S;
+
+impl S {
+ #[derive(Debug)] //~ ERROR `derive` may only be applied to structs, enums and unions
+ fn f() {
+ file!();
+ }
+}
+
+trait Tr1 {
+ #[derive(Debug)] //~ ERROR `derive` may only be applied to structs, enums and unions
+ fn f();
+}
+
+trait Tr2 {
+ #[derive(Debug)] //~ ERROR `derive` may only be applied to structs, enums and unions
+ type F;
+}
--- /dev/null
+error: `derive` may only be applied to structs, enums and unions
+ --> $DIR/issue-43023.rs:14:5
+ |
+LL | #[derive(Debug)] //~ ERROR `derive` may only be applied to structs, enums and unions
+ | ^^^^^^^^^^^^^^^^
+
+error: `derive` may only be applied to structs, enums and unions
+ --> $DIR/issue-43023.rs:21:5
+ |
+LL | #[derive(Debug)] //~ ERROR `derive` may only be applied to structs, enums and unions
+ | ^^^^^^^^^^^^^^^^
+
+error: `derive` may only be applied to structs, enums and unions
+ --> $DIR/issue-43023.rs:26:5
+ |
+LL | #[derive(Debug)] //~ ERROR `derive` may only be applied to structs, enums and unions
+ | ^^^^^^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
--- /dev/null
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-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 xyz() -> u8 { 42 }
+
+const NUM: u8 = xyz();
+//~^ ERROR calls in constants are limited to constant functions, tuple structs and tuple variants
+
+fn main() {
+ match 1 {
+ NUM => unimplemented!(),
+ //~^ ERROR could not evaluate constant pattern
+ _ => unimplemented!(),
+ }
+}
--- /dev/null
+error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants
+ --> $DIR/issue-43105.rs:13:17
+ |
+LL | const NUM: u8 = xyz();
+ | ^^^^^
+
+error[E0080]: could not evaluate constant pattern
+ --> $DIR/issue-43105.rs:18:9
+ |
+LL | const NUM: u8 = xyz();
+ | ----- calling non-const fn `xyz`
+...
+LL | NUM => unimplemented!(),
+ | ^^^
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0015, E0080.
+For more information about an error, try `rustc --explain E0015`.
--- /dev/null
+// 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 {
+ //~^ ERROR E0308
+ break true; //~ ERROR E0268
+}
+
+fn main() {
+ break {}; //~ ERROR E0268
+}
--- /dev/null
+error[E0268]: `break` outside of loop
+ --> $DIR/issue-43162.rs:13:5
+ |
+LL | break true; //~ ERROR E0268
+ | ^^^^^^^^^^ cannot break outside of a loop
+
+error[E0268]: `break` outside of loop
+ --> $DIR/issue-43162.rs:17:5
+ |
+LL | break {}; //~ ERROR E0268
+ | ^^^^^^^^ cannot break outside of a loop
+
+error[E0308]: mismatched types
+ --> $DIR/issue-43162.rs:11:18
+ |
+LL | fn foo() -> bool {
+ | __________________^
+LL | | //~^ ERROR E0308
+LL | | break true; //~ ERROR E0268
+ | | - help: consider removing this semicolon
+LL | | }
+ | |_^ expected bool, found ()
+ |
+ = note: expected type `bool`
+ found type `()`
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0268, E0308.
+For more information about an error, try `rustc --explain E0268`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ let tup = (true, true);
+ println!("foo {:}", match tup { //~ ERROR non-exhaustive patterns: `(true, false)` not covered
+ (false, false) => "foo",
+ (false, true) => "bar",
+ (true, true) => "baz"
+ });
+}
--- /dev/null
+error[E0004]: non-exhaustive patterns: `(true, false)` not covered
+ --> $DIR/issue-4321.rs:13:31
+ |
+LL | println!("foo {:}", match tup { //~ ERROR non-exhaustive patterns: `(true, false)` not covered
+ | ^^^ pattern `(true, false)` not covered
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0004`.
--- /dev/null
+// 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 main() {
+ let mut y;
+ const C: u32 = 0;
+ macro_rules! m {
+ ($a:expr) => {
+ let $a = 0;
+ }
+ }
+ m!(y);
+ //~^ ERROR arbitrary expressions aren't allowed in patterns
+ m!(C);
+ //~^ ERROR arbitrary expressions aren't allowed in patterns
+}
--- /dev/null
+error: arbitrary expressions aren't allowed in patterns
+ --> $DIR/issue-43250.rs:19:8
+ |
+LL | m!(y);
+ | ^
+
+error: arbitrary expressions aren't allowed in patterns
+ --> $DIR/issue-43250.rs:21:8
+ |
+LL | m!(C);
+ | ^
+
+error: aborting due to 2 previous errors
+
--- /dev/null
+// 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.
+
+pub trait Trait1<X> {
+ type Output;
+}
+
+pub trait Trait2<X> {}
+
+pub struct A;
+
+impl<X, T> Trait1<X> for T where T: Trait2<X> {
+ type Output = ();
+}
+
+impl<X> Trait1<Box<X>> for A {
+//~^ ERROR conflicting implementations of trait
+//~| hard error
+//~| downstream crates may implement trait `Trait2<std::boxed::Box<_>>` for type `A`
+ type Output = i32;
+}
+
+fn main() {}
--- /dev/null
+error: conflicting implementations of trait `Trait1<std::boxed::Box<_>>` for type `A`: (E0119)
+ --> $DIR/issue-43355.rs:23:1
+ |
+LL | impl<X, T> Trait1<X> for T where T: Trait2<X> {
+ | --------------------------------------------- first implementation here
+...
+LL | impl<X> Trait1<Box<X>> for A {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `A`
+ |
+ = note: #[deny(incoherent_fundamental_impls)] on by default
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #46205 <https://github.com/rust-lang/rust/issues/46205>
+ = note: downstream crates may implement trait `Trait2<std::boxed::Box<_>>` for type `A`
+
+error: aborting due to previous error
+
--- /dev/null
+// 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.
+
+#![allow(unused)]
+
+macro_rules! m {
+ ($attr_path: path) => {
+ #[$attr_path]
+ fn f() {}
+ }
+}
+
+m!(inline<u8>); //~ ERROR: unexpected generic arguments in path
+
+fn main() {}
--- /dev/null
+error: unexpected generic arguments in path
+ --> $DIR/issue-43424.rs:20:4
+ |
+LL | m!(inline<u8>); //~ ERROR: unexpected generic arguments in path
+ | ^^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// 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.
+
+#![feature(fn_traits)]
+
+trait CallSingle<A, B> {
+ fn call(&self, a: A) -> B where Self: Sized, Self: Fn(A) -> B;
+}
+
+impl<A, B, F: Fn(A) -> B> CallSingle<A, B> for F {
+ fn call(&self, a: A) -> B {
+ <Self as Fn(A) -> B>::call(self, (a,))
+ //~^ ERROR associated type bindings are not allowed here
+ }
+}
+
+fn main() {}
--- /dev/null
+error[E0229]: associated type bindings are not allowed here
+ --> $DIR/issue-43431.rs:19:27
+ |
+LL | <Self as Fn(A) -> B>::call(self, (a,))
+ | ^ associated type not allowed here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0229`.
--- /dev/null
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ensures that 'use foo:*' doesn't import non-public item
+
+use m1::*;
+
+mod foo {
+ pub fn foo() {}
+}
+mod a {
+ pub mod b {
+ use foo::foo;
+ type bar = isize;
+ }
+ pub mod sub {
+ use a::b::*;
+ fn sub() -> bar { 1 }
+ //~^ ERROR cannot find type `bar` in this scope
+ }
+}
+
+mod m1 {
+ fn foo() {}
+}
+
+fn main() {
+ foo(); //~ ERROR expected function, found module `foo`
+}
--- /dev/null
+error[E0412]: cannot find type `bar` in this scope
+ --> $DIR/issue-4366-2.rs:25:21
+ |
+LL | fn sub() -> bar { 1 }
+ | ^^^ not found in this scope
+help: possible candidate is found in another module, you can import it into scope
+ |
+LL | use a::b::bar;
+ |
+
+error[E0423]: expected function, found module `foo`
+ --> $DIR/issue-4366-2.rs:35:5
+ |
+LL | foo(); //~ ERROR expected function, found module `foo`
+ | ^^^ not a function
+help: possible better candidates are found in other modules, you can import them into scope
+ |
+LL | use foo::foo;
+ |
+LL | use m1::foo;
+ |
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0412, E0423.
+For more information about an error, try `rustc --explain E0412`.
--- /dev/null
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// regression test for issue 4366
+
+// ensures that 'use foo:*' doesn't import non-public 'use' statements in the
+// module 'foo'
+
+use m1::*;
+
+mod foo {
+ pub fn foo() {}
+}
+mod a {
+ pub mod b {
+ use foo::foo;
+ type bar = isize;
+ }
+ pub mod sub {
+ use a::b::*;
+ fn sub() -> isize { foo(); 1 } //~ ERROR cannot find function `foo` in this scope
+ }
+}
+
+mod m1 {
+ fn foo() {}
+}
+
+fn main() {}
--- /dev/null
+error[E0425]: cannot find function `foo` in this scope
+ --> $DIR/issue-4366.rs:28:29
+ |
+LL | fn sub() -> isize { foo(); 1 } //~ ERROR cannot find function `foo` in this scope
+ | ^^^ not found in this scope
+help: possible candidates are found in other modules, you can import them into scope
+ |
+LL | use foo::foo;
+ |
+LL | use m1::foo;
+ |
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0425`.
--- /dev/null
+// 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.
+
+#![feature(const_fn)]
+#![feature(cfg_target_thread_local, thread_local_internals)]
+
+// On platforms *without* `#[thread_local]`, use
+// a custom non-`Sync` type to fake the same error.
+#[cfg(not(target_thread_local))]
+struct Key<T> {
+ _data: std::cell::UnsafeCell<Option<T>>,
+ _flag: std::cell::Cell<bool>,
+}
+
+#[cfg(not(target_thread_local))]
+impl<T> Key<T> {
+ const fn new() -> Self {
+ Key {
+ _data: std::cell::UnsafeCell::new(None),
+ _flag: std::cell::Cell::new(false),
+ }
+ }
+}
+
+#[cfg(target_thread_local)]
+use std::thread::__FastLocalKeyInner as Key;
+
+static __KEY: Key<()> = Key::new();
+//~^ ERROR `std::cell::UnsafeCell<std::option::Option<()>>` cannot be shared between threads
+//~| ERROR `std::cell::Cell<bool>` cannot be shared between threads safely [E0277]
+
+fn main() {}
--- /dev/null
+error[E0277]: `std::cell::UnsafeCell<std::option::Option<()>>` cannot be shared between threads safely
+ --> $DIR/issue-43733-2.rs:35:1
+ |
+LL | static __KEY: Key<()> = Key::new();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::cell::UnsafeCell<std::option::Option<()>>` cannot be shared between threads safely
+ |
+ = help: within `std::thread::Key<()>`, the trait `std::marker::Sync` is not implemented for `std::cell::UnsafeCell<std::option::Option<()>>`
+ = note: required because it appears within the type `std::thread::Key<()>`
+ = note: shared static variables must have a type that implements `Sync`
+
+error[E0277]: `std::cell::Cell<bool>` cannot be shared between threads safely
+ --> $DIR/issue-43733-2.rs:35:1
+ |
+LL | static __KEY: Key<()> = Key::new();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::cell::Cell<bool>` cannot be shared between threads safely
+ |
+ = help: within `std::thread::Key<()>`, the trait `std::marker::Sync` is not implemented for `std::cell::Cell<bool>`
+ = note: required because it appears within the type `std::thread::Key<()>`
+ = note: shared static variables must have a type that implements `Sync`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
--- /dev/null
+// 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.
+
+#![feature(const_fn)]
+#![feature(thread_local)]
+#![feature(cfg_target_thread_local, thread_local_internals)]
+
+type Foo = std::cell::RefCell<String>;
+
+#[cfg(target_thread_local)]
+#[thread_local]
+static __KEY: std::thread::__FastLocalKeyInner<Foo> =
+ std::thread::__FastLocalKeyInner::new();
+
+#[cfg(not(target_thread_local))]
+static __KEY: std::thread::__OsLocalKeyInner<Foo> =
+ std::thread::__OsLocalKeyInner::new();
+
+fn __getit() -> std::option::Option<
+ &'static std::cell::UnsafeCell<
+ std::option::Option<Foo>>>
+{
+ __KEY.get() //~ ERROR call to unsafe function is unsafe
+}
+
+static FOO: std::thread::LocalKey<Foo> =
+ std::thread::LocalKey::new(__getit, Default::default);
+//~^ ERROR call to unsafe function is unsafe
+
+fn main() {
+ FOO.with(|foo| println!("{}", foo.borrow()));
+ std::thread::spawn(|| {
+ FOO.with(|foo| *foo.borrow_mut() += "foo");
+ }).join().unwrap();
+ FOO.with(|foo| println!("{}", foo.borrow()));
+}
--- /dev/null
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/issue-43733.rs:30:5
+ |
+LL | __KEY.get() //~ ERROR call to unsafe function is unsafe
+ | ^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/issue-43733.rs:34:5
+ |
+LL | std::thread::LocalKey::new(__getit, Default::default);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0133`.
--- /dev/null
+// 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.
+
+pub trait Partial<X: ?Sized>: Copy {
+}
+
+pub trait Complete {
+ type Assoc: Partial<Self>;
+}
+
+impl<T> Partial<T> for T::Assoc where
+ T: Complete
+{
+}
+
+impl<T> Complete for T { //~ ERROR the trait bound `T: std::marker::Copy` is not satisfied
+ type Assoc = T;
+}
--- /dev/null
+error[E0601]: `main` function not found in crate `issue_43784_associated_type`
+ |
+ = note: consider adding a `main` function to `$DIR/issue-43784-associated-type.rs`
+
+error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
+ --> $DIR/issue-43784-associated-type.rs:23:9
+ |
+LL | impl<T> Complete for T { //~ ERROR the trait bound `T: std::marker::Copy` is not satisfied
+ | ^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`
+ |
+ = help: consider adding a `where T: std::marker::Copy` bound
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0277, E0601.
+For more information about an error, try `rustc --explain E0277`.
--- /dev/null
+// 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.
+
+pub trait Partial: Copy {
+}
+
+pub trait Complete: Partial {
+}
+
+impl<T> Partial for T where T: Complete {}
+impl<T> Complete for T {} //~ ERROR the trait bound `T: std::marker::Copy` is not satisfied
--- /dev/null
+error[E0601]: `main` function not found in crate `issue_43784_supertrait`
+ |
+ = note: consider adding a `main` function to `$DIR/issue-43784-supertrait.rs`
+
+error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
+ --> $DIR/issue-43784-supertrait.rs:18:9
+ |
+LL | impl<T> Complete for T {} //~ ERROR the trait bound `T: std::marker::Copy` is not satisfied
+ | ^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`
+ |
+ = help: consider adding a `where T: std::marker::Copy` bound
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0277, E0601.
+For more information about an error, try `rustc --explain E0277`.
--- /dev/null
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-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(attr_literals)]
+
+#[link(name="foo", cfg("rlib"))] //~ ERROR invalid argument for `cfg(..)`
+extern {}
+
+fn main() {}
--- /dev/null
+error: invalid argument for `cfg(..)`
+ --> $DIR/issue-43925.rs:13:24
+ |
+LL | #[link(name="foo", cfg("rlib"))] //~ ERROR invalid argument for `cfg(..)`
+ | ^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#[link(name="foo", cfg())] //~ ERROR `cfg()` must have an argument
+extern {}
+
+fn main() {}
--- /dev/null
+error: `cfg()` must have an argument
+ --> $DIR/issue-43926.rs:11:1
+ |
+LL | #[link(name="foo", cfg())] //~ ERROR `cfg()` must have an argument
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-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(stmt_expr_attributes)]
+
+fn main() {
+
+ #[inline]
+ let _a = 4;
+ //~^^ ERROR attribute should be applied to function or closure
+
+
+ #[inline(XYZ)]
+ let _b = 4;
+ //~^^ ERROR attribute should be applied to function or closure
+
+ #[repr(nothing)]
+ let _x = 0;
+ //~^^ ERROR attribute should not be applied to a statement
+
+ #[repr(something_not_real)]
+ loop {
+ ()
+ };
+ //~^^^^ ERROR attribute should not be applied to an expression
+
+ #[repr]
+ let _y = "123";
+ //~^^ ERROR attribute should not be applied to a statement
+ //~| WARN `repr` attribute must have a hint
+
+
+ fn foo() {}
+
+ #[inline(ABC)]
+ foo();
+ //~^^ ERROR attribute should be applied to function or closure
+
+ let _z = #[repr] 1;
+ //~^ ERROR attribute should not be applied to an expression
+ //~| WARN `repr` attribute must have a hint
+}
--- /dev/null
+warning: `repr` attribute must have a hint
+ --> $DIR/issue-43988.rs:34:5
+ |
+LL | #[repr]
+ | ^^^^^^^ needs a hint
+ |
+ = note: #[warn(bad_repr)] on by default
+ = help: valid hints include `#[repr(C)]`, `#[repr(packed)]`, `#[repr(rust)]` and `#[repr(transparent)]`
+ = note: for more information, visit <https://doc.rust-lang.org/reference/type-layout.html>
+
+warning: `repr` attribute must have a hint
+ --> $DIR/issue-43988.rs:46:14
+ |
+LL | let _z = #[repr] 1;
+ | ^^^^^^^ needs a hint
+ |
+ = help: valid hints include `#[repr(C)]`, `#[repr(packed)]`, `#[repr(rust)]` and `#[repr(transparent)]`
+ = note: for more information, visit <https://doc.rust-lang.org/reference/type-layout.html>
+
+error[E0518]: attribute should be applied to function or closure
+ --> $DIR/issue-43988.rs:15:5
+ |
+LL | #[inline]
+ | ^^^^^^^^^
+LL | let _a = 4;
+ | ----------- not a function or closure
+
+error[E0518]: attribute should be applied to function or closure
+ --> $DIR/issue-43988.rs:20:5
+ |
+LL | #[inline(XYZ)]
+ | ^^^^^^^^^^^^^^
+LL | let _b = 4;
+ | ----------- not a function or closure
+
+error[E0517]: attribute should not be applied to a statement
+ --> $DIR/issue-43988.rs:24:5
+ |
+LL | #[repr(nothing)]
+ | ^^^^^^^^^^^^^^^^
+LL | let _x = 0;
+ | ----------- not a struct, enum or union
+
+error[E0517]: attribute should not be applied to an expression
+ --> $DIR/issue-43988.rs:28:5
+ |
+LL | #[repr(something_not_real)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | / loop {
+LL | | ()
+LL | | };
+ | |_____- not defining a struct, enum or union
+
+error[E0517]: attribute should not be applied to a statement
+ --> $DIR/issue-43988.rs:34:5
+ |
+LL | #[repr]
+ | ^^^^^^^
+LL | let _y = "123";
+ | --------------- not a struct, enum or union
+
+error[E0518]: attribute should be applied to function or closure
+ --> $DIR/issue-43988.rs:42:5
+ |
+LL | #[inline(ABC)]
+ | ^^^^^^^^^^^^^^
+LL | foo();
+ | ----- not a function or closure
+
+error[E0517]: attribute should not be applied to an expression
+ --> $DIR/issue-43988.rs:46:14
+ |
+LL | let _z = #[repr] 1;
+ | ^^^^^^^ - not defining a struct, enum or union
+
+error: aborting due to 7 previous errors
+
+Some errors occurred: E0517, E0518.
+For more information about an error, try `rustc --explain E0517`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct MyStruct;
+impl MyStruct {
+ fn f() {|x, y} //~ ERROR expected one of `:`, `@`, or `|`, found `}`
+}
+
+fn main() {}
--- /dev/null
+error: expected one of `:`, `@`, or `|`, found `}`
+ --> $DIR/issue-44021.rs:13:18
+ |
+LL | fn f() {|x, y} //~ ERROR expected one of `:`, `@`, or `|`, found `}`
+ | ^ expected one of `:`, `@`, or `|` here
+
+error: aborting due to previous error
+
--- /dev/null
+// 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 main() {
+ let n = 0;
+
+ struct Foo;
+ impl Foo {
+ const N: usize = n;
+ //~^ ERROR attempt to use a non-constant value
+ }
+}
--- /dev/null
+error[E0435]: attempt to use a non-constant value in a constant
+ --> $DIR/issue-44239.rs:16:26
+ |
+LL | const N: usize = n;
+ | ^ non-constant value
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0435`.
--- /dev/null
+// 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.
+
+
+static FOO: u32 = 50;
+
+fn main() {
+ let _val: &'static [&'static u32] = &[&FOO]; //~ ERROR borrowed value does not live long enough
+}
--- /dev/null
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/issue-44373.rs:15:42
+ |
+LL | let _val: &'static [&'static u32] = &[&FOO]; //~ ERROR borrowed value does not live long enough
+ | ^^^^^^ temporary value does not live long enough
+LL | }
+ | - temporary value only lives until here
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
--- /dev/null
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//~^^^^^^^^^^ ERROR cycle detected when computing layout of
+
+#![feature(const_fn)]
+#![feature(core_intrinsics)]
+
+use std::intrinsics;
+
+struct Foo {
+ bytes: [u8; unsafe { intrinsics::size_of::<Foo>() }],
+ x: usize,
+}
+
+fn main() {}
--- /dev/null
+error[E0391]: cycle detected when computing layout of `Foo`
+ |
+note: ...which requires normalizing `ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: All }, value: [u8; _] }`...
+note: ...which requires const-evaluating `Foo::bytes::{{constant}}`...
+ --> $DIR/issue-44415.rs:19:26
+ |
+LL | bytes: [u8; unsafe { intrinsics::size_of::<Foo>() }],
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = note: ...which again requires computing layout of `Foo`, completing the cycle
+note: cycle used when const-evaluating `Foo::bytes::{{constant}}`
+ --> $DIR/issue-44415.rs:19:26
+ |
+LL | bytes: [u8; unsafe { intrinsics::size_of::<Foo>() }],
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0391`.
--- /dev/null
+// 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 main() {
+ return;
+ *(1 as *mut u32) = 42;
+ //~^ ERROR dereference of raw pointer is unsafe
+}
--- /dev/null
+error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
+ --> $DIR/issue-45087-unreachable-unsafe.rs:13:5
+ |
+LL | *(1 as *mut u32) = 42;
+ | ^^^^^^^^^^^^^^^^^^^^^ dereference of raw pointer
+ |
+ = note: raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0133`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn bar(int_param: usize) {}
+
+fn main() {
+ let foo: [u8; 4] = [1; 4];
+ bar(foo);
+ //~^ ERROR mismatched types
+ //~| expected type `usize`
+ //~| found type `[u8; 4]`
+ //~| expected usize, found array of 4 elements
+}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-4517.rs:15:9
+ |
+LL | bar(foo);
+ | ^^^ expected usize, found array of 4 elements
+ |
+ = note: expected type `usize`
+ found type `[u8; 4]`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+error[E0384]: cannot assign twice to immutable variable `b`
+ --> $DIR/issue-45199.rs:19:5
+ |
+LL | let b: Box<isize>;
+ | - consider changing this to `mut b`
+LL | //[mir]~^ NOTE consider changing this to `mut b`
+LL | b = Box::new(1); //[ast]~ NOTE first assignment
+ | - first assignment to `b`
+LL | //[mir]~^ NOTE first assignment
+LL | b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable variable
+ | ^ cannot assign twice to immutable variable
+
+error[E0384]: cannot assign twice to immutable variable `b`
+ --> $DIR/issue-45199.rs:29:5
+ |
+LL | let b = Box::new(1); //[ast]~ NOTE first assignment
+ | -
+ | |
+ | first assignment to `b`
+ | consider changing this to `mut b`
+...
+LL | b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable variable
+ | ^ cannot assign twice to immutable variable
+
+error[E0384]: cannot assign to immutable argument `b`
+ --> $DIR/issue-45199.rs:37:5
+ |
+LL | fn test_args(b: Box<i32>) { //[ast]~ NOTE first assignment
+ | - consider changing this to `mut b`
+LL | //[mir]~^ NOTE consider changing this to `mut b`
+LL | b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable variable
+ | ^ cannot assign to immutable argument
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0384`.
--- /dev/null
+error[E0384]: cannot assign twice to immutable variable `b`
+ --> $DIR/issue-45199.rs:19:5
+ |
+LL | b = Box::new(1); //[ast]~ NOTE first assignment
+ | --------------- first assignment to `b`
+LL | //[mir]~^ NOTE first assignment
+LL | b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable variable
+ | ^^^^^^^^^^^^^^^ cannot assign twice to immutable variable
+
+error[E0384]: cannot assign twice to immutable variable `b`
+ --> $DIR/issue-45199.rs:29:5
+ |
+LL | let b = Box::new(1); //[ast]~ NOTE first assignment
+ | - first assignment to `b`
+...
+LL | b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable variable
+ | ^^^^^^^^^^^^^^^ cannot assign twice to immutable variable
+
+error[E0384]: cannot assign twice to immutable variable `b`
+ --> $DIR/issue-45199.rs:37:5
+ |
+LL | fn test_args(b: Box<i32>) { //[ast]~ NOTE first assignment
+ | - first assignment to `b`
+LL | //[mir]~^ NOTE consider changing this to `mut b`
+LL | b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable variable
+ | ^^^^^^^^^^^^^^^ cannot assign twice to immutable variable
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0384`.
--- /dev/null
+error[E0384]: cannot assign twice to immutable variable `b`
+ --> $DIR/issue-45199.rs:19:5
+ |
+LL | let b: Box<isize>;
+ | - consider changing this to `mut b`
+LL | //[mir]~^ NOTE consider changing this to `mut b`
+LL | b = Box::new(1); //[ast]~ NOTE first assignment
+ | - first assignment to `b`
+LL | //[mir]~^ NOTE first assignment
+LL | b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable variable
+ | ^ cannot assign twice to immutable variable
+
+error[E0384]: cannot assign twice to immutable variable `b`
+ --> $DIR/issue-45199.rs:29:5
+ |
+LL | let b = Box::new(1); //[ast]~ NOTE first assignment
+ | -
+ | |
+ | first assignment to `b`
+ | consider changing this to `mut b`
+...
+LL | b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable variable
+ | ^ cannot assign twice to immutable variable
+
+error[E0384]: cannot assign to immutable argument `b`
+ --> $DIR/issue-45199.rs:37:5
+ |
+LL | fn test_args(b: Box<i32>) { //[ast]~ NOTE first assignment
+ | - consider changing this to `mut b`
+LL | //[mir]~^ NOTE consider changing this to `mut b`
+LL | b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable variable
+ | ^ cannot assign to immutable argument
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0384`.
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// revisions: ast mir
+//[mir]compile-flags: -Zborrowck=mir
+
+fn test_drop_replace() {
+ let b: Box<isize>;
+ //[mir]~^ NOTE consider changing this to `mut b`
+ b = Box::new(1); //[ast]~ NOTE first assignment
+ //[mir]~^ NOTE first assignment
+ b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable variable
+ //[mir]~^ ERROR cannot assign twice to immutable variable `b`
+ //[ast]~| NOTE cannot assign twice to immutable
+ //[mir]~| NOTE cannot assign twice to immutable
+}
+
+fn test_call() {
+ let b = Box::new(1); //[ast]~ NOTE first assignment
+ //[mir]~^ NOTE first assignment
+ //[mir]~| NOTE consider changing this to `mut b`
+ b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable variable
+ //[mir]~^ ERROR cannot assign twice to immutable variable `b`
+ //[ast]~| NOTE cannot assign twice to immutable
+ //[mir]~| NOTE cannot assign twice to immutable
+}
+
+fn test_args(b: Box<i32>) { //[ast]~ NOTE first assignment
+ //[mir]~^ NOTE consider changing this to `mut b`
+ b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable variable
+ //[mir]~^ ERROR cannot assign to immutable argument `b`
+ //[ast]~| NOTE cannot assign twice to immutable
+ //[mir]~| NOTE cannot assign to immutable argument
+}
+
+fn main() {}
--- /dev/null
+// 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.
+
+#![feature(generators)]
+
+fn main() {
+ let _ = || {
+ *(1 as *mut u32) = 42;
+ //~^ ERROR dereference of raw pointer is unsafe
+ yield;
+ };
+}
--- /dev/null
+error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
+ --> $DIR/issue-45729-unsafe-in-generator.rs:15:9
+ |
+LL | *(1 as *mut u32) = 42;
+ | ^^^^^^^^^^^^^^^^^^^^^ dereference of raw pointer
+ |
+ = note: raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0133`.
--- /dev/null
+// 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.
+
+struct Params;
+
+pub trait Plugin<E: ?Sized> {
+ type Error;
+}
+
+pub trait Pluggable {
+ fn get_ref<P: Plugin<Self>>(&mut self) -> Option<P::Error> {
+ None
+ }
+}
+
+struct Foo;
+impl Plugin<Foo> for Params {
+ type Error = ();
+}
+
+impl<T: Copy> Pluggable for T {}
+
+fn handle(req: &mut i32) {
+ req.get_ref::<Params>();
+ //~^ ERROR the trait bound `Params: Plugin<i32>` is not satisfied
+}
+
+fn main() {}
--- /dev/null
+error[E0277]: the trait bound `Params: Plugin<i32>` is not satisfied
+ --> $DIR/issue-45801.rs:31:9
+ |
+LL | req.get_ref::<Params>();
+ | ^^^^^^^ the trait `Plugin<i32>` is not implemented for `Params`
+ |
+ = help: the following implementations were found:
+ <Params as Plugin<Foo>>
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
--- /dev/null
+// 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 main() {
+ let a = |r: f64| if r != 0.0(r != 0.0) { 1.0 } else { 0.0 };
+ //~^ ERROR expected function, found `{float}`
+}
--- /dev/null
+error[E0618]: expected function, found `{float}`
+ --> $DIR/issue-45965.rs:12:30
+ |
+LL | let a = |r: f64| if r != 0.0(r != 0.0) { 1.0 } else { 0.0 };
+ | ^^^^^^^^^^^^^ not a function
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0618`.
--- /dev/null
+error[E0594]: cannot assign to immutable item `x`
+ --> $DIR/issue-46023.rs:18:9
+ |
+LL | x = 1;
+ | ^^^^^ cannot assign
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0594`.
--- /dev/null
+error[E0594]: cannot assign to captured outer variable in an `FnMut` closure
+ --> $DIR/issue-46023.rs:18:9
+ |
+LL | let x = 0;
+ | - help: consider making `x` mutable: `mut x`
+...
+LL | x = 1;
+ | ^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0594`.
--- /dev/null
+error[E0594]: cannot assign to immutable item `x`
+ --> $DIR/issue-46023.rs:18:9
+ |
+LL | x = 1;
+ | ^^^^^ cannot assign
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0594`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// revisions: ast mir
+//[mir]compile-flags: -Z emit-end-regions -Z borrowck=mir
+
+fn main() {
+ let x = 0;
+
+ (move || {
+ x = 1;
+ //[mir]~^ ERROR cannot assign to immutable item `x` [E0594]
+ //[ast]~^^ ERROR cannot assign to captured outer variable in an `FnMut` closure [E0594]
+ })()
+}
--- /dev/null
+// 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.
+
+// Issue 46036: [NLL] false edges on infinite loops
+// Infinite loops should create false edges to the cleanup block.
+#![feature(nll)]
+
+struct Foo { x: &'static u32 }
+
+fn foo() {
+ let a = 3;
+ let foo = Foo { x: &a }; //~ ERROR E0597
+ loop { }
+}
+
+fn main() { }
--- /dev/null
+error[E0597]: `a` does not live long enough
+ --> $DIR/issue-46036.rs:19:24
+ |
+LL | let foo = Foo { x: &a }; //~ ERROR E0597
+ | ^^ borrowed value does not live long enough
+LL | loop { }
+LL | }
+ | - borrowed value only lives until here
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
--- /dev/null
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ 'break: loop { //~ ERROR invalid label name `'break`
+ }
+}
--- /dev/null
+error: invalid label name `'break`
+ --> $DIR/issue-46311.rs:12:5
+ |
+LL | 'break: loop { //~ ERROR invalid label name `'break`
+ | ^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// 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.
+
+macro_rules! m {
+ ($my_type: ty) => {
+ impl $my_type for u8 {}
+ }
+}
+
+trait Trait {}
+
+m!(Tr);
+
+m!(&'static u8); //~ ERROR expected a trait, found type
+
+fn main() {}
--- /dev/null
+error: expected a trait, found type
+ --> $DIR/issue-46438.rs:21:4
+ |
+LL | m!(&'static u8); //~ ERROR expected a trait, found type
+ | ^^^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+error[E0017]: references in statics may only refer to immutable values
+ --> $DIR/issue-46604.rs:14:25
+ |
+LL | static buf: &mut [u8] = &mut [1u8,2,3,4,5,7]; //[ast]~ ERROR E0017
+ | ^^^^^^^^^^^^^^^^^^^^ statics require immutable values
+
+error[E0594]: cannot assign to immutable item `buf[..]`
+ --> $DIR/issue-46604.rs:20:5
+ |
+LL | buf[0]=2; //[ast]~ ERROR E0389
+ | ^^^^^^^^ cannot assign
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0017, E0594.
+For more information about an error, try `rustc --explain E0017`.
--- /dev/null
+error[E0017]: references in statics may only refer to immutable values
+ --> $DIR/issue-46604.rs:14:25
+ |
+LL | static buf: &mut [u8] = &mut [1u8,2,3,4,5,7]; //[ast]~ ERROR E0017
+ | ^^^^^^^^^^^^^^^^^^^^ statics require immutable values
+
+error[E0389]: cannot assign to data in a `&` reference
+ --> $DIR/issue-46604.rs:20:5
+ |
+LL | buf[0]=2; //[ast]~ ERROR E0389
+ | ^^^^^^^^ assignment into an immutable reference
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0017, E0389.
+For more information about an error, try `rustc --explain E0017`.
--- /dev/null
+error[E0017]: references in statics may only refer to immutable values
+ --> $DIR/issue-46604.rs:14:25
+ |
+LL | static buf: &mut [u8] = &mut [1u8,2,3,4,5,7]; //[ast]~ ERROR E0017
+ | ^^^^^^^^^^^^^^^^^^^^ statics require immutable values
+
+error[E0594]: cannot assign to immutable item `buf[..]`
+ --> $DIR/issue-46604.rs:20:5
+ |
+LL | buf[0]=2; //[ast]~ ERROR E0389
+ | ^^^^^^^^ cannot assign
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0017, E0594.
+For more information about an error, try `rustc --explain E0017`.
--- /dev/null
+// 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.
+
+// revisions: ast mir
+//[mir]compile-flags: -Z borrowck=mir
+
+static buf: &mut [u8] = &mut [1u8,2,3,4,5,7]; //[ast]~ ERROR E0017
+ //[mir]~^ ERROR E0017
+fn write<T: AsRef<[u8]>>(buffer: T) { }
+
+fn main() {
+ write(&buf);
+ buf[0]=2; //[ast]~ ERROR E0389
+ //[mir]~^ ERROR E0594
+}
--- /dev/null
+// 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 main() {
+ struct Foo;
+ (1 .. 2).find(|_| Foo(0) == 0); //~ ERROR expected function, found `main::Foo`
+}
--- /dev/null
+error[E0618]: expected function, found `main::Foo`
+ --> $DIR/issue-46771.rs:13:23
+ |
+LL | struct Foo;
+ | ----------- `main::Foo` defined here
+LL | (1 .. 2).find(|_| Foo(0) == 0); //~ ERROR expected function, found `main::Foo`
+ | ^^^^^^ not a function
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0618`.
--- /dev/null
+// 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.
+
+enum Thing { This, That }
+
+fn non_const() -> Thing {
+ Thing::This
+}
+
+pub const Q: i32 = match non_const() { //~ ERROR E0015
+ Thing::This => 1, //~ ERROR unimplemented expression type
+ Thing::That => 0
+};
+
+fn main() {}
--- /dev/null
+error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants
+ --> $DIR/issue-46843.rs:17:26
+ |
+LL | pub const Q: i32 = match non_const() { //~ ERROR E0015
+ | ^^^^^^^^^^^
+
+error[E0019]: constant contains unimplemented expression type
+ --> $DIR/issue-46843.rs:18:5
+ |
+LL | Thing::This => 1, //~ ERROR unimplemented expression type
+ | ^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0015, E0019.
+For more information about an error, try `rustc --explain E0015`.
--- /dev/null
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Make sure that the mono-item collector does not crash when trying to
+// instantiate a default impl of a method with lifetime parameters.
+// See https://github.com/rust-lang/rust/issues/47309
+
+// compile-flags:-Clink-dead-code
+// compile-pass
+
+#![crate_type="rlib"]
+
+pub trait EnvFuture {
+ type Item;
+
+ fn boxed_result<'a>(self) where Self: Sized, Self::Item: 'a, {
+ }
+}
+
+struct Foo;
+
+impl<'a> EnvFuture for &'a Foo {
+ type Item = ();
+}
--- /dev/null
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct NonCopyable(());
+
+fn main() {
+ let z = NonCopyable{ p: () }; //~ ERROR struct `NonCopyable` has no field named `p`
+}
--- /dev/null
+error[E0560]: struct `NonCopyable` has no field named `p`
+ --> $DIR/issue-4736.rs:14:26
+ |
+LL | let z = NonCopyable{ p: () }; //~ ERROR struct `NonCopyable` has no field named `p`
+ | ^ field does not exist - did you mean `0`?
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0560`.
--- /dev/null
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#[derive(Copy, Clone)]
+enum Void {}
+
+// Tests that we detect unsafe places (specifically, union fields and
+// raw pointer dereferences), even when they're matched on while having
+// an uninhabited type (equivalent to `std::intrinsics::unreachable()`).
+
+fn union_field() {
+ union Union { unit: (), void: Void }
+ let u = Union { unit: () };
+ match u.void {}
+ //~^ ERROR access to union field is unsafe
+}
+
+fn raw_ptr_deref() {
+ let ptr = std::ptr::null::<Void>();
+ match *ptr {}
+ //~^ ERROR dereference of raw pointer is unsafe
+}
+
+fn main() {}
--- /dev/null
+error[E0133]: access to union field is unsafe and requires unsafe function or block
+ --> $DIR/issue-47412.rs:21:5
+ |
+LL | match u.void {}
+ | ^^^^^^^^^^^^^^^ access to union field
+ |
+ = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
+
+error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
+ --> $DIR/issue-47412.rs:27:5
+ |
+LL | match *ptr {}
+ | ^^^^^^^^^^^^^ dereference of raw pointer
+ |
+ = note: raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0133`.
--- /dev/null
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-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 {}
+
+trait Bar<T> {}
+
+trait Iterable {
+ type Item;
+}
+
+struct Container<T: Iterable<Item = impl Foo>> {
+ //~^ ERROR `impl Trait` not allowed
+ field: T
+}
+
+enum Enum<T: Iterable<Item = impl Foo>> {
+ //~^ ERROR `impl Trait` not allowed
+ A(T),
+}
+
+union Union<T: Iterable<Item = impl Foo> + Copy> {
+ //~^ ERROR `impl Trait` not allowed
+ x: T,
+}
+
+type Type<T: Iterable<Item = impl Foo>> = T;
+//~^ ERROR `impl Trait` not allowed
+
+fn main() {
+}
--- /dev/null
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/issue-47715.rs:19:37
+ |
+LL | struct Container<T: Iterable<Item = impl Foo>> {
+ | ^^^^^^^^
+
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/issue-47715.rs:24:30
+ |
+LL | enum Enum<T: Iterable<Item = impl Foo>> {
+ | ^^^^^^^^
+
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/issue-47715.rs:29:32
+ |
+LL | union Union<T: Iterable<Item = impl Foo> + Copy> {
+ | ^^^^^^^^
+
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/issue-47715.rs:34:30
+ |
+LL | type Type<T: Iterable<Item = impl Foo>> = T;
+ | ^^^^^^^^
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0562`.
--- /dev/null
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-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 note is annotated because the purpose of the test
+// is to ensure that certain other notes are not generated.
+#![deny(unused_unsafe)] //~ NOTE
+
+// (test that no note is generated on this unsafe fn)
+pub unsafe fn a() {
+ fn inner() {
+ unsafe { /* unnecessary */ } //~ ERROR unnecessary `unsafe`
+ //~^ NOTE
+ }
+
+ inner()
+}
+
+pub fn b() {
+ // (test that no note is generated on this unsafe block)
+ unsafe {
+ fn inner() {
+ unsafe { /* unnecessary */ } //~ ERROR unnecessary `unsafe`
+ //~^ NOTE
+ }
+
+ let () = ::std::mem::uninitialized();
+
+ inner()
+ }
+}
+
+fn main() {}
--- /dev/null
+error: unnecessary `unsafe` block
+ --> $DIR/issue-48131.rs:18:9
+ |
+LL | unsafe { /* unnecessary */ } //~ ERROR unnecessary `unsafe`
+ | ^^^^^^ unnecessary `unsafe` block
+ |
+note: lint level defined here
+ --> $DIR/issue-48131.rs:13:9
+ |
+LL | #![deny(unused_unsafe)] //~ NOTE
+ | ^^^^^^^^^^^^^
+
+error: unnecessary `unsafe` block
+ --> $DIR/issue-48131.rs:29:13
+ |
+LL | unsafe { /* unnecessary */ } //~ ERROR unnecessary `unsafe`
+ | ^^^^^^ unnecessary `unsafe` block
+
+error: aborting due to 2 previous errors
+
--- /dev/null
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-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 Functions {
+ Square = |x| x, //~ ERROR mismatched types
+}
+
+fn main() {}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-48838.rs:12:14
+ |
+LL | Square = |x| x, //~ ERROR mismatched types
+ | ^^^^^ expected isize, found closure
+ |
+ = note: expected type `isize`
+ found type `[closure@$DIR/issue-48838.rs:12:14: 12:19]`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Regression test for issue #4968
+
+const A: (isize,isize) = (4,2);
+fn main() {
+ match 42 { A => () }
+ //~^ ERROR mismatched types
+ //~| expected type `{integer}`
+ //~| found type `(isize, isize)`
+ //~| expected integral variable, found tuple
+}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-4968.rs:15:16
+ |
+LL | match 42 { A => () }
+ | ^ expected integral variable, found tuple
+ |
+ = note: expected type `{integer}`
+ found type `(isize, isize)`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(box_patterns)]
+#![feature(box_syntax)]
+
+trait MyTrait {
+ fn dummy(&self) {}
+}
+
+pub enum TraitWrapper {
+ A(Box<MyTrait+'static>),
+}
+
+fn get_tw_map(tw: &TraitWrapper) -> &MyTrait {
+ match *tw {
+ TraitWrapper::A(box ref map) => map, //~ ERROR cannot be dereferenced
+ }
+}
+
+pub fn main() {}
--- /dev/null
+error[E0033]: type `std::boxed::Box<(dyn MyTrait + 'static)>` cannot be dereferenced
+ --> $DIR/issue-4972.rs:24:25
+ |
+LL | TraitWrapper::A(box ref map) => map, //~ ERROR cannot be dereferenced
+ | ^^^^^^^^^^^ type `std::boxed::Box<(dyn MyTrait + 'static)>` cannot be dereferenced
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0033`.
--- /dev/null
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-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-pass
+
+fn main() {
+ assert!({false});
+
+ assert!(r"\u{41}" == "A");
+
+ assert!(r"\u{".is_empty());
+}
--- /dev/null
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo (
+ fn([u8; |x: u8| {}]), //~ ERROR mismatched types
+);
+
+fn main() {}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-50600.rs:12:13
+ |
+LL | fn([u8; |x: u8| {}]), //~ ERROR mismatched types
+ | ^^^^^^^^^^ expected usize, found closure
+ |
+ = note: expected type `usize`
+ found type `[closure@$DIR/issue-50600.rs:12:13: 12:23]`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() { format!("{:?}", None); }
+ //~^ ERROR type annotations needed [E0282]
--- /dev/null
+error[E0282]: type annotations needed
+ --> $DIR/issue-5062.rs:11:29
+ |
+LL | fn main() { format!("{:?}", None); }
+ | ^^^^ cannot infer type for `T`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0282`.
--- /dev/null
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![allow(unused_macros)]
+
+macro_rules! foo {
+ ( $()* ) => {};
+ //~^ ERROR repetition matches empty token tree
+ ( $()+ ) => {};
+ //~^ ERROR repetition matches empty token tree
+
+ ( $(),* ) => {}; // PASS
+ ( $(),+ ) => {}; // PASS
+
+ ( [$()*] ) => {};
+ //~^ ERROR repetition matches empty token tree
+ ( [$()+] ) => {};
+ //~^ ERROR repetition matches empty token tree
+
+ ( [$(),*] ) => {}; // PASS
+ ( [$(),+] ) => {}; // PASS
+
+ ( $($()* $(),* $(a)* $(a),* )* ) => {};
+ //~^ ERROR repetition matches empty token tree
+ ( $($()* $(),* $(a)* $(a),* )+ ) => {};
+ //~^ ERROR repetition matches empty token tree
+
+ ( $(a $(),* $(a)* $(a),* )* ) => {}; // PASS
+ ( $($(a)+ $(),* $(a)* $(a),* )+ ) => {}; // PASS
+
+ ( $(a $()+)* ) => {};
+ //~^ ERROR repetition matches empty token tree
+ ( $(a $()*)+ ) => {};
+ //~^ ERROR repetition matches empty token tree
+}
+
+
+// --- Original Issue --- //
+
+macro_rules! make_vec {
+ (a $e1:expr $($(, a $e2:expr)*)*) => ([$e1 $($(, $e2)*)*]);
+ //~^ ERROR repetition matches empty token tree
+}
+
+fn main() {
+ let _ = make_vec![a 1, a 2, a 3];
+}
+
+
+// --- Minified Issue --- //
+
+macro_rules! m {
+ ( $()* ) => {}
+ //~^ ERROR repetition matches empty token tree
+}
+
+m!();
--- /dev/null
+error: repetition matches empty token tree
+ --> $DIR/issue-5067.rs:14:8
+ |
+LL | ( $()* ) => {};
+ | ^^
+
+error: repetition matches empty token tree
+ --> $DIR/issue-5067.rs:16:8
+ |
+LL | ( $()+ ) => {};
+ | ^^
+
+error: repetition matches empty token tree
+ --> $DIR/issue-5067.rs:22:9
+ |
+LL | ( [$()*] ) => {};
+ | ^^
+
+error: repetition matches empty token tree
+ --> $DIR/issue-5067.rs:24:9
+ |
+LL | ( [$()+] ) => {};
+ | ^^
+
+error: repetition matches empty token tree
+ --> $DIR/issue-5067.rs:30:8
+ |
+LL | ( $($()* $(),* $(a)* $(a),* )* ) => {};
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: repetition matches empty token tree
+ --> $DIR/issue-5067.rs:32:8
+ |
+LL | ( $($()* $(),* $(a)* $(a),* )+ ) => {};
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: repetition matches empty token tree
+ --> $DIR/issue-5067.rs:38:12
+ |
+LL | ( $(a $()+)* ) => {};
+ | ^^
+
+error: repetition matches empty token tree
+ --> $DIR/issue-5067.rs:40:12
+ |
+LL | ( $(a $()*)+ ) => {};
+ | ^^
+
+error: repetition matches empty token tree
+ --> $DIR/issue-5067.rs:48:18
+ |
+LL | (a $e1:expr $($(, a $e2:expr)*)*) => ([$e1 $($(, $e2)*)*]);
+ | ^^^^^^^^^^^^^^^^^^
+
+error: repetition matches empty token tree
+ --> $DIR/issue-5067.rs:60:8
+ |
+LL | ( $()* ) => {}
+ | ^^
+
+error: aborting due to 10 previous errors
+
--- /dev/null
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-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() {
+ [1; || {}]; //~ ERROR mismatched types
+}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-50688.rs:12:9
+ |
+LL | [1; || {}]; //~ ERROR mismatched types
+ | ^^^^^ expected usize, found closure
+ |
+ = note: expected type `usize`
+ found type `[closure@$DIR/issue-50688.rs:12:9: 12:14]`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+
+trait B < A > { fn a() -> A { this.a } } //~ ERROR cannot find value `this` in this scope
+
+fn main() {}
--- /dev/null
+error[E0425]: cannot find value `this` in this scope
+ --> $DIR/issue-5099.rs:12:31
+ |
+LL | trait B < A > { fn a() -> A { this.a } } //~ ERROR cannot find value `this` in this scope
+ | ^^^^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0425`.
--- /dev/null
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(box_patterns)]
+#![feature(box_syntax)]
+
+enum A { B, C }
+
+fn main() {
+ match (true, false) {
+ A::B => (),
+//~^ ERROR mismatched types
+//~| expected type `(bool, bool)`
+//~| found type `A`
+//~| expected tuple, found enum `A`
+ _ => ()
+ }
+
+ match (true, false) {
+ (true, false, false) => ()
+//~^ ERROR mismatched types
+//~| expected type `(bool, bool)`
+//~| found type `(_, _, _)`
+//~| expected a tuple with 2 elements, found one with 3 elements
+ }
+
+ match (true, false) {
+ (true, false, false) => ()
+//~^ ERROR mismatched types
+//~| expected type `(bool, bool)`
+//~| found type `(_, _, _)`
+//~| expected a tuple with 2 elements, found one with 3 elements
+ }
+
+ match (true, false) {
+ box (true, false) => ()
+//~^ ERROR mismatched types
+//~| expected type `(bool, bool)`
+//~| found type `std::boxed::Box<_>`
+ }
+
+ match (true, false) {
+ &(true, false) => ()
+//~^ ERROR mismatched types
+//~| expected type `(bool, bool)`
+//~| found type `&_`
+//~| expected tuple, found reference
+ }
+
+
+ let v = [('a', 'b') //~ ERROR expected function, found `(char, char)`
+ ('c', 'd'),
+ ('e', 'f')];
+
+ for &(x,y) in &v {} // should be OK
+
+ // Make sure none of the errors above were fatal
+ let x: char = true; //~ ERROR mismatched types
+ //~| expected char, found bool
+}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-5100.rs:18:9
+ |
+LL | A::B => (),
+ | ^^^^ expected tuple, found enum `A`
+ |
+ = note: expected type `(bool, bool)`
+ found type `A`
+
+error[E0308]: mismatched types
+ --> $DIR/issue-5100.rs:27:9
+ |
+LL | (true, false, false) => ()
+ | ^^^^^^^^^^^^^^^^^^^^ expected a tuple with 2 elements, found one with 3 elements
+ |
+ = note: expected type `(bool, bool)`
+ found type `(_, _, _)`
+
+error[E0308]: mismatched types
+ --> $DIR/issue-5100.rs:35:9
+ |
+LL | (true, false, false) => ()
+ | ^^^^^^^^^^^^^^^^^^^^ expected a tuple with 2 elements, found one with 3 elements
+ |
+ = note: expected type `(bool, bool)`
+ found type `(_, _, _)`
+
+error[E0308]: mismatched types
+ --> $DIR/issue-5100.rs:43:9
+ |
+LL | box (true, false) => ()
+ | ^^^^^^^^^^^^^^^^^ expected tuple, found struct `std::boxed::Box`
+ |
+ = note: expected type `(bool, bool)`
+ found type `std::boxed::Box<_>`
+
+error[E0308]: mismatched types
+ --> $DIR/issue-5100.rs:50:9
+ |
+LL | &(true, false) => ()
+ | ^^^^^^^^^^^^^^ expected tuple, found reference
+ |
+ = note: expected type `(bool, bool)`
+ found type `&_`
+
+error[E0618]: expected function, found `(char, char)`
+ --> $DIR/issue-5100.rs:58:14
+ |
+LL | let v = [('a', 'b') //~ ERROR expected function, found `(char, char)`
+ | ______________^
+LL | | ('c', 'd'),
+ | |_______________________^ not a function
+
+error[E0308]: mismatched types
+ --> $DIR/issue-5100.rs:65:19
+ |
+LL | let x: char = true; //~ ERROR mismatched types
+ | ^^^^ expected char, found bool
+
+error: aborting due to 7 previous errors
+
+Some errors occurred: E0308, E0618.
+For more information about an error, try `rustc --explain E0308`.
--- /dev/null
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait Foo {
+ fn foo(self: Box<Self>);
+}
+
+impl Foo for isize {
+ fn foo(self: Box<isize>) { }
+}
+
+fn main() {
+ (&5isize as &Foo).foo();
+ //~^ ERROR: no method named `foo` found for type `&dyn Foo` in the current scope
+}
--- /dev/null
+error[E0599]: no method named `foo` found for type `&dyn Foo` in the current scope
+ --> $DIR/issue-5153.rs:20:23
+ |
+LL | (&5isize as &Foo).foo();
+ | ^^^
+ |
+ = help: items from traits can only be used if the trait is implemented and in scope
+ = note: the following trait defines an item `foo`, perhaps you need to implement it:
+ candidate #1: `Foo`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
--- /dev/null
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn f() { }
+struct S(Box<FnMut()>);
+pub static C: S = S(f); //~ ERROR mismatched types
+
+
+fn g() { }
+type T = Box<FnMut()>;
+pub static D: T = g; //~ ERROR mismatched types
+
+fn main() {}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-5216.rs:13:21
+ |
+LL | pub static C: S = S(f); //~ ERROR mismatched types
+ | ^ expected struct `std::boxed::Box`, found fn item
+ |
+ = note: expected type `std::boxed::Box<(dyn std::ops::FnMut() + 'static)>`
+ found type `fn() {f}`
+
+error[E0308]: mismatched types
+ --> $DIR/issue-5216.rs:18:19
+ |
+LL | pub static D: T = g; //~ ERROR mismatched types
+ | ^ expected struct `std::boxed::Box`, found fn item
+ |
+ = note: expected type `std::boxed::Box<(dyn std::ops::FnMut() + 'static)>`
+ found type `fn() {g}`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+warning: not reporting region error due to nll
+ --> $DIR/issue-52213.rs:12:11
+ |
+LL | match (&t,) { //~ ERROR cannot infer an appropriate lifetime
+ | ^^^^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/issue-52213.rs:13:11
+ |
+LL | ((u,),) => u,
+ | ^ free region requires that `'a` must outlive `'b`
+
+error: aborting due to previous error
+
--- /dev/null
+// 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 transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T {
+ match (&t,) { //~ ERROR cannot infer an appropriate lifetime
+ ((u,),) => u,
+ }
+}
+
+fn main() {
+ let x = {
+ let y = Box::new((42,));
+ transmute_lifetime(&y)
+ };
+
+ println!("{}", x);
+}
--- /dev/null
+error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
+ --> $DIR/issue-52213.rs:12:11
+ |
+LL | match (&t,) { //~ ERROR cannot infer an appropriate lifetime
+ | ^^^^^
+ |
+note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 11:23...
+ --> $DIR/issue-52213.rs:11:23
+ |
+LL | fn transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T {
+ | ^^
+ = note: ...so that the types are compatible:
+ expected (&&(T,),)
+ found (&&'a (T,),)
+note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 11:27...
+ --> $DIR/issue-52213.rs:11:27
+ |
+LL | fn transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T {
+ | ^^
+note: ...so that reference does not outlive borrowed content
+ --> $DIR/issue-52213.rs:13:20
+ |
+LL | ((u,),) => u,
+ | ^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0495`.
--- /dev/null
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+enum Either<T, U> { Left(T), Right(U) }
+struct S(Either<usize, usize>);
+
+fn main() {
+ match S(Either::Left(5)) {
+ Either::Right(_) => {}
+ //~^ ERROR mismatched types
+ //~| expected type `S`
+ //~| found type `Either<_, _>`
+ //~| expected struct `S`, found enum `Either`
+ _ => {}
+ }
+}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-5358-1.rs:16:9
+ |
+LL | Either::Right(_) => {}
+ | ^^^^^^^^^^^^^^^^ expected struct `S`, found enum `Either`
+ |
+ = note: expected type `S`
+ found type `Either<_, _>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(box_syntax)]
+
+struct Foo {
+ foo: isize,
+}
+
+struct Bar {
+ bar: isize,
+}
+
+impl Bar {
+ fn make_foo (&self, i: isize) -> Box<Foo> {
+ return box Foo { nonexistent: self, foo: i }; //~ ERROR: no field named
+ }
+}
+
+fn main () {
+ let bar = Bar { bar: 1 };
+ let foo = bar.make_foo(2);
+ println!("{}", foo.foo);
+}
--- /dev/null
+error[E0560]: struct `Foo` has no field named `nonexistent`
+ --> $DIR/issue-5439.rs:23:26
+ |
+LL | return box Foo { nonexistent: self, foo: i }; //~ ERROR: no field named
+ | ^^^^^^^^^^^ `Foo` does not have this field
+ |
+ = note: available fields are: `foo`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0560`.
--- /dev/null
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait A {}
+
+struct Struct {
+ r: A+'static
+}
+
+fn new_struct(r: A+'static)
+ -> Struct { //~^ ERROR the size for values of type
+ //~^ ERROR the size for values of type
+ Struct { r: r }
+}
+
+fn main() {}
--- /dev/null
+error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time
+ --> $DIR/issue-5883.rs:17:15
+ |
+LL | fn new_struct(r: A+'static)
+ | ^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `(dyn A + 'static)`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
+ = note: all local variables must have a statically known size
+
+error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time
+ --> $DIR/issue-5883.rs:18:8
+ |
+LL | -> Struct { //~^ ERROR the size for values of type
+ | ^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: within `Struct`, the trait `std::marker::Sized` is not implemented for `(dyn A + 'static)`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
+ = note: required because it appears within the type `Struct`
+ = note: the return type of a function must have a statically known size
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+
+fn main() {
+ let z = match 3 {
+ x(1) => x(1) //~ ERROR cannot find tuple struct/variant `x` in this scope
+ //~^ ERROR cannot find function `x` in this scope
+ };
+ assert!(z == 3);
+}
--- /dev/null
+error[E0531]: cannot find tuple struct/variant `x` in this scope
+ --> $DIR/issue-5927.rs:14:9
+ |
+LL | x(1) => x(1) //~ ERROR cannot find tuple struct/variant `x` in this scope
+ | ^ not found in this scope
+
+error[E0425]: cannot find function `x` in this scope
+ --> $DIR/issue-5927.rs:14:17
+ |
+LL | x(1) => x(1) //~ ERROR cannot find tuple struct/variant `x` in this scope
+ | ^ not found in this scope
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0425, E0531.
+For more information about an error, try `rustc --explain E0425`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn f<Z>() -> bool {
+ enum E { V(Z) }
+ //~^ ERROR can't use type parameters from outer function
+ true
+}
+
+fn main() {
+ let b = f::<isize>();
+ assert!(b);
+}
--- /dev/null
+error[E0401]: can't use type parameters from outer function
+ --> $DIR/issue-5997-enum.rs:12:16
+ |
+LL | fn f<Z>() -> bool {
+ | - - type variable from outer function
+ | |
+ | try adding a local type parameter in this method instead
+LL | enum E { V(Z) }
+ | ^ use of type variable from outer function
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0401`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn f<T>() -> bool {
+ struct S(T); //~ ERROR can't use type parameters from outer function
+
+ true
+}
+
+fn main() {
+ let b = f::<isize>();
+ assert!(b);
+}
--- /dev/null
+error[E0401]: can't use type parameters from outer function
+ --> $DIR/issue-5997-struct.rs:12:14
+ |
+LL | fn f<T>() -> bool {
+ | - - type variable from outer function
+ | |
+ | try adding a local type parameter in this method instead
+LL | struct S(T); //~ ERROR can't use type parameters from outer function
+ | ^ use of type variable from outer function
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0401`.
--- /dev/null
+// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ // Unconstrained type:
+ format!("{:?}", None);
+ //~^ ERROR type annotations needed [E0282]
+}
--- /dev/null
+error[E0282]: type annotations needed
+ --> $DIR/issue-6458-2.rs:13:21
+ |
+LL | format!("{:?}", None);
+ | ^^^^ cannot infer type for `T`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0282`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+
+macro_rules! e {
+ ($inp:ident) => (
+ $nonexistent
+ //~^ ERROR unknown macro variable `nonexistent`
+ );
+}
+
+fn main() {
+ e!(foo);
+}
--- /dev/null
+error: unknown macro variable `nonexistent`
+ --> $DIR/issue-6596-1.rs:14:9
+ |
+LL | $nonexistent
+ | ^^^^^^^^^^^^ unknown macro variable
+...
+LL | e!(foo);
+ | -------- in this macro invocation
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(macro_rules)]
+
+macro_rules! g {
+ ($inp:ident) => (
+ { $inp $nonexistent }
+ //~^ ERROR unknown macro variable `nonexistent`
+ //~| ERROR expected one of
+ );
+}
+
+fn main() {
+ g!(foo);
+}
--- /dev/null
+error: unknown macro variable `nonexistent`
+ --> $DIR/issue-6596-2.rs:15:16
+ |
+LL | { $inp $nonexistent }
+ | ^^^^^^^^^^^^ unknown macro variable
+...
+LL | g!(foo);
+ | -------- in this macro invocation
+
+error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `nonexistent`
+ --> $DIR/issue-6596-2.rs:15:16
+ |
+LL | { $inp $nonexistent }
+ | ^^^^^^^^^^^^ expected one of 8 possible tokens here
+...
+LL | g!(foo);
+ | -------- in this macro invocation
+
+error: aborting due to 2 previous errors
+
--- /dev/null
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct A;
+impl A {
+ fn m(&self) {
+ fn x() {
+ self.m() //~ ERROR can't capture dynamic environment in a fn item
+ }
+ }
+}
+fn main() {}
--- /dev/null
+error[E0434]: can't capture dynamic environment in a fn item
+ --> $DIR/issue-6642.rs:15:13
+ |
+LL | self.m() //~ ERROR can't capture dynamic environment in a fn item
+ | ^^^^
+ |
+ = help: use the `|| { ... }` closure form instead
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0434`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo<T> {
+ x: T,
+}
+impl<T> Foo<T> {
+ fn add(&mut self, v: Foo<T>){
+ self.x += v.x;
+ //~^ ERROR: binary assignment operation `+=` cannot be applied
+ }
+}
+fn main() {}
--- /dev/null
+error[E0368]: binary assignment operation `+=` cannot be applied to type `T`
+ --> $DIR/issue-6738.rs:16:9
+ |
+LL | self.x += v.x;
+ | ------^^^^^^^
+ | |
+ | cannot use `+=` on type `T`
+ |
+ = note: `T` might need a bound for `std::ops::AddAssign`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0368`.
--- /dev/null
+error[E0505]: cannot move out of `x` because it is borrowed
+ --> $DIR/issue-6801.rs:29:13
+ |
+LL | let sq = || { *x * *x };
+ | -------------- borrow of `x` occurs here
+LL |
+LL | twice(x); //~ ERROR: cannot move out of
+ | ^ move out of `x` occurs here
+LL | invoke(sq);
+ | -- borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0505`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Creating a stack closure which references a box and then
+// transferring ownership of the box before invoking the stack
+// closure results in a crash.
+
+#![feature(box_syntax)]
+
+fn twice(x: Box<usize>) -> usize {
+ *x * 2
+}
+
+fn invoke<F>(f: F) where F: FnOnce() -> usize {
+ f();
+}
+
+fn main() {
+ let x : Box<usize> = box 9;
+ let sq = || { *x * *x };
+
+ twice(x); //~ ERROR: cannot move out of
+ invoke(sq);
+}
--- /dev/null
+error[E0505]: cannot move out of `x` because it is borrowed
+ --> $DIR/issue-6801.rs:29:13
+ |
+LL | let sq = || { *x * *x };
+ | -- borrow of `x` occurs here
+LL |
+LL | twice(x); //~ ERROR: cannot move out of
+ | ^ move out of `x` occurs here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0505`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Matching against NaN should result in a warning
+
+#![allow(unused)]
+#![deny(illegal_floating_point_literal_pattern)]
+
+use std::f64::NAN;
+
+fn main() {
+ let x = NAN;
+ match x {
+ NAN => {}, //~ ERROR floating-point types cannot be used
+ //~^ WARN this was previously accepted by the compiler but is being phased out
+ _ => {},
+ };
+
+ match [x, 1.0] {
+ [NAN, _] => {}, //~ ERROR floating-point types cannot be used
+ //~^ WARN this was previously accepted by the compiler but is being phased out
+ _ => {},
+ };
+}
--- /dev/null
+error: floating-point types cannot be used in patterns
+ --> $DIR/issue-6804.rs:21:9
+ |
+LL | NAN => {}, //~ ERROR floating-point types cannot be used
+ | ^^^
+ |
+note: lint level defined here
+ --> $DIR/issue-6804.rs:14:9
+ |
+LL | #![deny(illegal_floating_point_literal_pattern)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620>
+
+error: floating-point types cannot be used in patterns
+ --> $DIR/issue-6804.rs:27:10
+ |
+LL | [NAN, _] => {}, //~ ERROR floating-point types cannot be used
+ | ^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620>
+
+error: aborting due to 2 previous errors
+
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct T;
+
+mod t1 {
+ type Foo = ::T;
+ mod Foo {} //~ ERROR the name `Foo` is defined multiple times
+}
+
+mod t2 {
+ type Foo = ::T;
+ struct Foo; //~ ERROR the name `Foo` is defined multiple times
+}
+
+mod t3 {
+ type Foo = ::T;
+ enum Foo {} //~ ERROR the name `Foo` is defined multiple times
+}
+
+mod t4 {
+ type Foo = ::T;
+ fn Foo() {} // ok
+}
+
+mod t5 {
+ type Bar<T> = T;
+ mod Bar {} //~ ERROR the name `Bar` is defined multiple times
+}
+
+mod t6 {
+ type Foo = ::T;
+ impl Foo {} // ok
+}
+
+
+fn main() {}
--- /dev/null
+error[E0428]: the name `Foo` is defined multiple times
+ --> $DIR/issue-6936.rs:15:5
+ |
+LL | type Foo = ::T;
+ | --------------- previous definition of the type `Foo` here
+LL | mod Foo {} //~ ERROR the name `Foo` is defined multiple times
+ | ^^^^^^^ `Foo` redefined here
+ |
+ = note: `Foo` must be defined only once in the type namespace of this module
+
+error[E0428]: the name `Foo` is defined multiple times
+ --> $DIR/issue-6936.rs:20:5
+ |
+LL | type Foo = ::T;
+ | --------------- previous definition of the type `Foo` here
+LL | struct Foo; //~ ERROR the name `Foo` is defined multiple times
+ | ^^^^^^^^^^^ `Foo` redefined here
+ |
+ = note: `Foo` must be defined only once in the type namespace of this module
+
+error[E0428]: the name `Foo` is defined multiple times
+ --> $DIR/issue-6936.rs:25:5
+ |
+LL | type Foo = ::T;
+ | --------------- previous definition of the type `Foo` here
+LL | enum Foo {} //~ ERROR the name `Foo` is defined multiple times
+ | ^^^^^^^^ `Foo` redefined here
+ |
+ = note: `Foo` must be defined only once in the type namespace of this module
+
+error[E0428]: the name `Bar` is defined multiple times
+ --> $DIR/issue-6936.rs:35:5
+ |
+LL | type Bar<T> = T;
+ | ---------------- previous definition of the type `Bar` here
+LL | mod Bar {} //~ ERROR the name `Bar` is defined multiple times
+ | ^^^^^^^ `Bar` redefined here
+ |
+ = note: `Bar` must be defined only once in the type namespace of this module
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0428`.
--- /dev/null
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(box_syntax)]
+
+use std::cell::RefCell;
+use std::rc::Rc;
+
+trait Foo {
+ fn set(&mut self, v: Rc<RefCell<A>>);
+}
+
+struct B {
+ v: Option<Rc<RefCell<A>>>
+}
+
+impl Foo for B {
+ fn set(&mut self, v: Rc<RefCell<A>>)
+ {
+ self.v = Some(v);
+ }
+}
+
+struct A {
+ v: Box<Foo + Send>,
+}
+
+fn main() {
+ let a = A {v: box B{v: None} as Box<Foo+Send>};
+ //~^ ERROR `std::rc::Rc<std::cell::RefCell<A>>` cannot be sent between threads safely
+}
--- /dev/null
+error[E0277]: `std::rc::Rc<std::cell::RefCell<A>>` cannot be sent between threads safely
+ --> $DIR/issue-7013.rs:36:19
+ |
+LL | let a = A {v: box B{v: None} as Box<Foo+Send>};
+ | ^^^^^^^^^^^^^^ `std::rc::Rc<std::cell::RefCell<A>>` cannot be sent between threads safely
+ |
+ = help: within `B`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<std::cell::RefCell<A>>`
+ = note: required because it appears within the type `std::option::Option<std::rc::Rc<std::cell::RefCell<A>>>`
+ = note: required because it appears within the type `B`
+ = note: required for the cast to the object type `dyn Foo + std::marker::Send`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
--- /dev/null
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+static X: isize = 0;
+struct X; //~ ERROR the name `X` is defined multiple times
+
+fn main() {}
--- /dev/null
+error[E0428]: the name `X` is defined multiple times
+ --> $DIR/issue-7044.rs:12:1
+ |
+LL | static X: isize = 0;
+ | -------------------- previous definition of the value `X` here
+LL | struct X; //~ ERROR the name `X` is defined multiple times
+ | ^^^^^^^^^ `X` redefined here
+ |
+ = note: `X` must be defined only once in the value namespace of this module
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0428`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct BarStruct;
+
+impl<'a> BarStruct {
+ fn foo(&'a mut self) -> Box<BarStruct> { self }
+ //~^ ERROR mismatched types
+ //~| expected type `std::boxed::Box<BarStruct>`
+ //~| found type `&'a mut BarStruct`
+}
+
+fn main() {}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-7061.rs:14:46
+ |
+LL | fn foo(&'a mut self) -> Box<BarStruct> { self }
+ | -------------- ^^^^ expected struct `std::boxed::Box`, found mutable reference
+ | |
+ | expected `std::boxed::Box<BarStruct>` because of return type
+ |
+ = note: expected type `std::boxed::Box<BarStruct>`
+ found type `&'a mut BarStruct`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+enum Whatever {
+}
+
+fn foo(x: Whatever) {
+ match x {
+ Some(field) =>
+//~^ ERROR mismatched types
+//~| expected type `Whatever`
+//~| found type `std::option::Option<_>`
+//~| expected enum `Whatever`, found enum `std::option::Option`
+ field.access(),
+ }
+}
+
+fn main(){}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-7092.rs:16:9
+ |
+LL | Some(field) =>
+ | ^^^^^^^^^^^ expected enum `Whatever`, found enum `std::option::Option`
+ |
+ = note: expected type `Whatever`
+ found type `std::option::Option<_>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![deny(unreachable_code)]
+#![allow(dead_code)]
+
+use std::ptr;
+pub unsafe fn g() {
+ return;
+ if *ptr::null() {}; //~ ERROR unreachable
+}
+
+pub fn main() {}
--- /dev/null
+error: unreachable statement
+ --> $DIR/issue-7246.rs:17:5
+ |
+LL | if *ptr::null() {}; //~ ERROR unreachable
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/issue-7246.rs:11:9
+ |
+LL | #![deny(unreachable_code)]
+ | ^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(box_syntax)]
+
+use std::cell::RefCell;
+
+// Regression test for issue 7364
+static boxed: Box<RefCell<isize>> = box RefCell::new(0);
+//~^ ERROR allocations are not allowed in statics
+//~| ERROR `std::cell::RefCell<isize>` cannot be shared between threads safely [E0277]
+
+fn main() { }
--- /dev/null
+error[E0010]: allocations are not allowed in statics
+ --> $DIR/issue-7364.rs:16:37
+ |
+LL | static boxed: Box<RefCell<isize>> = box RefCell::new(0);
+ | ^^^^^^^^^^^^^^^^^^^ allocation not allowed in statics
+
+error[E0277]: `std::cell::RefCell<isize>` cannot be shared between threads safely
+ --> $DIR/issue-7364.rs:16:1
+ |
+LL | static boxed: Box<RefCell<isize>> = box RefCell::new(0);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::cell::RefCell<isize>` cannot be shared between threads safely
+ |
+ = help: the trait `std::marker::Sync` is not implemented for `std::cell::RefCell<isize>`
+ = note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<std::cell::RefCell<isize>>`
+ = note: required because it appears within the type `std::boxed::Box<std::cell::RefCell<isize>>`
+ = note: shared static variables must have a type that implements `Sync`
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0010, E0277.
+For more information about an error, try `rustc --explain E0010`.
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct Foo {
+ x: isize
+}
+
+impl Fo { //~ ERROR cannot find type `Fo` in this scope
+ fn foo() {}
+}
+
+fn main() {}
--- /dev/null
+error[E0412]: cannot find type `Fo` in this scope
+ --> $DIR/issue-7607-1.rs:15:6
+ |
+LL | impl Fo { //~ ERROR cannot find type `Fo` in this scope
+ | ^^ did you mean `Fn`?
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0412`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+enum A { B, C }
+
+mod foo { pub fn bar() {} }
+
+fn main() {
+ match (true, false) {
+ A::B => (),
+ //~^ ERROR mismatched types
+ //~| expected type `(bool, bool)`
+ //~| found type `A`
+ //~| expected tuple, found enum `A`
+ _ => ()
+ }
+}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-7867.rs:17:9
+ |
+LL | A::B => (),
+ | ^^^^ expected tuple, found enum `A`
+ |
+ = note: expected type `(bool, bool)`
+ found type `A`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// tests the good error message, not "missing module Foo" or something else unexpected
+
+struct Foo;
+
+fn main() {
+ Foo::bar();
+ //~^ ERROR no function or associated item named `bar` found for type `Foo`
+}
--- /dev/null
+error[E0599]: no function or associated item named `bar` found for type `Foo` in the current scope
+ --> $DIR/issue-7950.rs:16:5
+ |
+LL | struct Foo;
+ | ----------- function or associated item `bar` not found for this
+...
+LL | Foo::bar();
+ | ^^^^^^^^ function or associated item not found in `Foo`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+macro_rules! one_arg_macro {
+ ($fmt:expr) => (print!(concat!($fmt, "\n")));
+}
+
+fn main() {
+ one_arg_macro!();
+ //~^ ERROR unexpected end of macro invocation
+}
--- /dev/null
+error: unexpected end of macro invocation
+ --> $DIR/issue-7970a.rs:16:5
+ |
+LL | one_arg_macro!();
+ | ^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {}
+
+macro_rules! test {}
+//~^ ERROR unexpected end of macro invocation
--- /dev/null
+error: unexpected end of macro invocation
+ --> $DIR/issue-7970b.rs:13:1
+ |
+LL | macro_rules! test {}
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Test that duplicate methods in impls are not allowed
+
+struct Foo;
+
+trait Bar {
+ fn bar(&self) -> isize;
+}
+
+impl Bar for Foo {
+ fn bar(&self) -> isize {1}
+ fn bar(&self) -> isize {2} //~ ERROR duplicate definitions
+}
+
+fn main() {
+ println!("{}", Foo.bar());
+}
--- /dev/null
+error[E0201]: duplicate definitions with name `bar`:
+ --> $DIR/issue-8153.rs:21:5
+ |
+LL | fn bar(&self) -> isize {1}
+ | -------------------------- previous definition of `bar` here
+LL | fn bar(&self) -> isize {2} //~ ERROR duplicate definitions
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ duplicate definition
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0201`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use self::*; //~ ERROR: unresolved import `self::*` [E0432]
+ //~^ Cannot glob-import a module into itself.
+
+mod foo {
+ use foo::*; //~ ERROR: unresolved import `foo::*` [E0432]
+ //~^ Cannot glob-import a module into itself.
+
+ mod bar {
+ use super::bar::*;
+ //~^ ERROR: unresolved import `super::bar::*` [E0432]
+ //~| Cannot glob-import a module into itself.
+ }
+
+}
+
+fn main() {
+}
--- /dev/null
+error[E0432]: unresolved import `self::*`
+ --> $DIR/issue-8208.rs:11:5
+ |
+LL | use self::*; //~ ERROR: unresolved import `self::*` [E0432]
+ | ^^^^^^^ Cannot glob-import a module into itself.
+
+error[E0432]: unresolved import `foo::*`
+ --> $DIR/issue-8208.rs:15:9
+ |
+LL | use foo::*; //~ ERROR: unresolved import `foo::*` [E0432]
+ | ^^^^^^ Cannot glob-import a module into itself.
+
+error[E0432]: unresolved import `super::bar::*`
+ --> $DIR/issue-8208.rs:19:13
+ |
+LL | use super::bar::*;
+ | ^^^^^^^^^^^^^ Cannot glob-import a module into itself.
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0432`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![deny(const_err)]
+
+use std::{isize, i8, i16, i32, i64};
+use std::thread;
+
+fn main() {
+ assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err());
+ //~^ ERROR attempt to divide with overflow
+ //~| ERROR this expression will panic at runtime
+ assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err());
+ //~^ ERROR attempt to divide with overflow
+ //~| ERROR this expression will panic at runtime
+ assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err());
+ //~^ ERROR attempt to divide with overflow
+ //~| ERROR this expression will panic at runtime
+ assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err());
+ //~^ ERROR attempt to divide with overflow
+ //~| ERROR this expression will panic at runtime
+ assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err());
+ //~^ ERROR attempt to divide with overflow
+ //~| ERROR this expression will panic at runtime
+ assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err());
+ //~^ ERROR attempt to divide by zero
+ //~| ERROR this expression will panic at runtime
+ assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err());
+ //~^ ERROR attempt to divide by zero
+ //~| ERROR this expression will panic at runtime
+ assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err());
+ //~^ ERROR attempt to divide by zero
+ //~| ERROR this expression will panic at runtime
+ assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err());
+ //~^ ERROR attempt to divide by zero
+ //~| ERROR this expression will panic at runtime
+ assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err());
+ //~^ ERROR attempt to divide by zero
+ //~| ERROR this expression will panic at runtime
+ assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err());
+ //~^ ERROR attempt to calculate the remainder with overflow
+ //~| ERROR this expression will panic at runtime
+ assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err());
+ //~^ ERROR attempt to calculate the remainder with overflow
+ //~| ERROR this expression will panic at runtime
+ assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err());
+ //~^ ERROR attempt to calculate the remainder with overflow
+ //~| ERROR this expression will panic at runtime
+ assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err());
+ //~^ ERROR attempt to calculate the remainder with overflow
+ //~| ERROR this expression will panic at runtime
+ assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err());
+ //~^ ERROR attempt to calculate the remainder with overflow
+ //~| ERROR this expression will panic at runtime
+ assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err());
+ //~^ ERROR attempt to calculate the remainder with a divisor of zero
+ //~| ERROR this expression will panic at runtime
+ assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err());
+ //~^ ERROR attempt to calculate the remainder with a divisor of zero
+ //~| ERROR this expression will panic at runtime
+ assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err());
+ //~^ ERROR attempt to calculate the remainder with a divisor of zero
+ //~| ERROR this expression will panic at runtime
+ assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err());
+ //~^ ERROR attempt to calculate the remainder with a divisor of zero
+ //~| ERROR this expression will panic at runtime
+ assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err());
+ //~^ ERROR attempt to calculate the remainder with a divisor of zero
+ //~| ERROR this expression will panic at runtime
+}
--- /dev/null
+error: attempt to divide with overflow
+ --> $DIR/issue-8460-const.rs:17:36
+ |
+LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err());
+ | ^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/issue-8460-const.rs:11:9
+ |
+LL | #![deny(const_err)]
+ | ^^^^^^^^^
+
+error: this expression will panic at runtime
+ --> $DIR/issue-8460-const.rs:17:36
+ |
+LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err());
+ | ^^^^^^^^^^^^^^^ attempt to divide with overflow
+
+error: attempt to divide with overflow
+ --> $DIR/issue-8460-const.rs:20:36
+ |
+LL | assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err());
+ | ^^^^^^^^^^^^
+
+error: this expression will panic at runtime
+ --> $DIR/issue-8460-const.rs:20:36
+ |
+LL | assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err());
+ | ^^^^^^^^^^^^ attempt to divide with overflow
+
+error: attempt to divide with overflow
+ --> $DIR/issue-8460-const.rs:23:36
+ |
+LL | assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err());
+ | ^^^^^^^^^^^^^
+
+error: this expression will panic at runtime
+ --> $DIR/issue-8460-const.rs:23:36
+ |
+LL | assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err());
+ | ^^^^^^^^^^^^^ attempt to divide with overflow
+
+error: attempt to divide with overflow
+ --> $DIR/issue-8460-const.rs:26:36
+ |
+LL | assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err());
+ | ^^^^^^^^^^^^^
+
+error: this expression will panic at runtime
+ --> $DIR/issue-8460-const.rs:26:36
+ |
+LL | assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err());
+ | ^^^^^^^^^^^^^ attempt to divide with overflow
+
+error: attempt to divide with overflow
+ --> $DIR/issue-8460-const.rs:29:36
+ |
+LL | assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err());
+ | ^^^^^^^^^^^^^
+
+error: this expression will panic at runtime
+ --> $DIR/issue-8460-const.rs:29:36
+ |
+LL | assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err());
+ | ^^^^^^^^^^^^^ attempt to divide with overflow
+
+error: attempt to divide by zero
+ --> $DIR/issue-8460-const.rs:32:36
+ |
+LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err());
+ | ^^^^^^^^^^
+
+error: this expression will panic at runtime
+ --> $DIR/issue-8460-const.rs:32:36
+ |
+LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err());
+ | ^^^^^^^^^^ attempt to divide by zero
+
+error: attempt to divide by zero
+ --> $DIR/issue-8460-const.rs:35:36
+ |
+LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err());
+ | ^^^^^^^
+
+error: this expression will panic at runtime
+ --> $DIR/issue-8460-const.rs:35:36
+ |
+LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err());
+ | ^^^^^^^ attempt to divide by zero
+
+error: attempt to divide by zero
+ --> $DIR/issue-8460-const.rs:38:36
+ |
+LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err());
+ | ^^^^^^^^
+
+error: this expression will panic at runtime
+ --> $DIR/issue-8460-const.rs:38:36
+ |
+LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err());
+ | ^^^^^^^^ attempt to divide by zero
+
+error: attempt to divide by zero
+ --> $DIR/issue-8460-const.rs:41:36
+ |
+LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err());
+ | ^^^^^^^^
+
+error: this expression will panic at runtime
+ --> $DIR/issue-8460-const.rs:41:36
+ |
+LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err());
+ | ^^^^^^^^ attempt to divide by zero
+
+error: attempt to divide by zero
+ --> $DIR/issue-8460-const.rs:44:36
+ |
+LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err());
+ | ^^^^^^^^
+
+error: this expression will panic at runtime
+ --> $DIR/issue-8460-const.rs:44:36
+ |
+LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err());
+ | ^^^^^^^^ attempt to divide by zero
+
+error: attempt to calculate the remainder with overflow
+ --> $DIR/issue-8460-const.rs:47:36
+ |
+LL | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err());
+ | ^^^^^^^^^^^^^^^
+
+error: this expression will panic at runtime
+ --> $DIR/issue-8460-const.rs:47:36
+ |
+LL | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err());
+ | ^^^^^^^^^^^^^^^ attempt to calculate the remainder with overflow
+
+error: attempt to calculate the remainder with overflow
+ --> $DIR/issue-8460-const.rs:50:36
+ |
+LL | assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err());
+ | ^^^^^^^^^^^^
+
+error: this expression will panic at runtime
+ --> $DIR/issue-8460-const.rs:50:36
+ |
+LL | assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err());
+ | ^^^^^^^^^^^^ attempt to calculate the remainder with overflow
+
+error: attempt to calculate the remainder with overflow
+ --> $DIR/issue-8460-const.rs:53:36
+ |
+LL | assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err());
+ | ^^^^^^^^^^^^^
+
+error: this expression will panic at runtime
+ --> $DIR/issue-8460-const.rs:53:36
+ |
+LL | assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err());
+ | ^^^^^^^^^^^^^ attempt to calculate the remainder with overflow
+
+error: attempt to calculate the remainder with overflow
+ --> $DIR/issue-8460-const.rs:56:36
+ |
+LL | assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err());
+ | ^^^^^^^^^^^^^
+
+error: this expression will panic at runtime
+ --> $DIR/issue-8460-const.rs:56:36
+ |
+LL | assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err());
+ | ^^^^^^^^^^^^^ attempt to calculate the remainder with overflow
+
+error: attempt to calculate the remainder with overflow
+ --> $DIR/issue-8460-const.rs:59:36
+ |
+LL | assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err());
+ | ^^^^^^^^^^^^^
+
+error: this expression will panic at runtime
+ --> $DIR/issue-8460-const.rs:59:36
+ |
+LL | assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err());
+ | ^^^^^^^^^^^^^ attempt to calculate the remainder with overflow
+
+error: attempt to calculate the remainder with a divisor of zero
+ --> $DIR/issue-8460-const.rs:62:36
+ |
+LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err());
+ | ^^^^^^^^^^
+
+error: this expression will panic at runtime
+ --> $DIR/issue-8460-const.rs:62:36
+ |
+LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err());
+ | ^^^^^^^^^^ attempt to calculate the remainder with a divisor of zero
+
+error: attempt to calculate the remainder with a divisor of zero
+ --> $DIR/issue-8460-const.rs:65:36
+ |
+LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err());
+ | ^^^^^^^
+
+error: this expression will panic at runtime
+ --> $DIR/issue-8460-const.rs:65:36
+ |
+LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err());
+ | ^^^^^^^ attempt to calculate the remainder with a divisor of zero
+
+error: attempt to calculate the remainder with a divisor of zero
+ --> $DIR/issue-8460-const.rs:68:36
+ |
+LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err());
+ | ^^^^^^^^
+
+error: this expression will panic at runtime
+ --> $DIR/issue-8460-const.rs:68:36
+ |
+LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err());
+ | ^^^^^^^^ attempt to calculate the remainder with a divisor of zero
+
+error: attempt to calculate the remainder with a divisor of zero
+ --> $DIR/issue-8460-const.rs:71:36
+ |
+LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err());
+ | ^^^^^^^^
+
+error: this expression will panic at runtime
+ --> $DIR/issue-8460-const.rs:71:36
+ |
+LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err());
+ | ^^^^^^^^ attempt to calculate the remainder with a divisor of zero
+
+error: attempt to calculate the remainder with a divisor of zero
+ --> $DIR/issue-8460-const.rs:74:36
+ |
+LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err());
+ | ^^^^^^^^
+
+error: this expression will panic at runtime
+ --> $DIR/issue-8460-const.rs:74:36
+ |
+LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err());
+ | ^^^^^^^^ attempt to calculate the remainder with a divisor of zero
+
+error: aborting due to 40 previous errors
+
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#[allow(unused_imports)]
+
+mod foo {
+ use baz::bar;
+ mod bar {}
+ //~^ ERROR the name `bar` is defined multiple times
+}
+mod baz { pub mod bar {} }
+
+fn main() {}
--- /dev/null
+error[E0255]: the name `bar` is defined multiple times
+ --> $DIR/issue-8640.rs:15:5
+ |
+LL | use baz::bar;
+ | -------- previous import of the module `bar` here
+LL | mod bar {}
+ | ^^^^^^^ `bar` redefined here
+ |
+ = note: `bar` must be defined only once in the type namespace of this module
+help: You can use `as` to change the binding name of the import
+ |
+LL | use baz::bar as other_bar;
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0255`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Verify the compiler fails with an error on infinite function
+// recursions.
+
+fn generic<T>() {
+ generic::<Option<T>>();
+}
+//~^^^ ERROR reached the recursion limit while instantiating `generic::<std::option::Option<
+//~| WARN function cannot return without recurring
+
+
+
+fn main () {
+ // Use generic<T> at least once to trigger instantiation.
+ generic::<i32>();
+}
--- /dev/null
+warning: function cannot return without recurring
+ --> $DIR/issue-8727.rs:14:1
+ |
+LL | fn generic<T>() {
+ | ^^^^^^^^^^^^^^^ cannot return without recurring
+LL | generic::<Option<T>>();
+ | ---------------------- recursive call site
+ |
+ = note: #[warn(unconditional_recursion)] on by default
+ = help: a `loop` may express intention better if this is on purpose
+
+error: reached the recursion limit while instantiating `generic::<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<i32>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ --> $DIR/issue-8727.rs:14:1
+ |
+LL | / fn generic<T>() {
+LL | | generic::<Option<T>>();
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+enum Foo {
+ A = 1i64,
+ //~^ ERROR mismatched types
+ //~| expected isize, found i64
+ B = 2u8
+ //~^ ERROR mismatched types
+ //~| expected isize, found u8
+}
+
+fn main() {}
--- /dev/null
+error[E0308]: mismatched types
+ --> $DIR/issue-8761.rs:12:9
+ |
+LL | A = 1i64,
+ | ^^^^ expected isize, found i64
+
+error[E0308]: mismatched types
+ --> $DIR/issue-8761.rs:15:9
+ |
+LL | B = 2u8
+ | ^^^ expected isize, found u8
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+impl B { //~ ERROR cannot find type `B` in this scope
+}
+
+fn main() {
+}
--- /dev/null
+error[E0412]: cannot find type `B` in this scope
+ --> $DIR/issue-8767.rs:11:6
+ |
+LL | impl B { //~ ERROR cannot find type `B` in this scope
+ | ^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0412`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(start)]
+
+#[start]
+fn start(argc: isize, argv: *const *const u8, crate_map: *const u8) -> isize {
+ //~^ start function has wrong type
+ 0
+}
--- /dev/null
+error[E0308]: start function has wrong type
+ --> $DIR/issue-9575.rs:14:1
+ |
+LL | fn start(argc: isize, argv: *const *const u8, crate_map: *const u8) -> isize {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters
+ |
+ = note: expected type `fn(isize, *const *const u8) -> isize`
+ found type `fn(isize, *const *const u8, *const u8) -> isize`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
--- /dev/null
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct A { foo: isize }
+
+fn main() {
+ let A { foo, foo } = A { foo: 3 };
+ //~^ ERROR: identifier `foo` is bound more than once in the same pattern
+ //~^^ ERROR: field `foo` bound multiple times
+}
--- /dev/null
+error[E0416]: identifier `foo` is bound more than once in the same pattern
+ --> $DIR/issue-9725.rs:14:18
+ |
+LL | let A { foo, foo } = A { foo: 3 };
+ | ^^^ used in a pattern more than once
+
+error[E0025]: field `foo` bound multiple times in the pattern
+ --> $DIR/issue-9725.rs:14:18
+ |
+LL | let A { foo, foo } = A { foo: 3 };
+ | --- ^^^ multiple uses of `foo` in pattern
+ | |
+ | first use of `foo`
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0025, E0416.
+For more information about an error, try `rustc --explain E0025`.
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Verify that single-variant enums can't be de-referenced
+// Regression test for issue #9814
+
+enum Foo { Bar(isize) }
+
+fn main() {
+ let _ = *Foo::Bar(2); //~ ERROR type `Foo` cannot be dereferenced
+}
--- /dev/null
+error[E0614]: type `Foo` cannot be dereferenced
+ --> $DIR/issue-9814.rs:17:13
+ |
+LL | let _ = *Foo::Bar(2); //~ ERROR type `Foo` cannot be dereferenced
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0614`.
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+enum E {
+ A,
+ B,
+}
+
+fn main() {
+ match None {
+ None => {}
+ Some(E::A(..)) => {} //~ ERROR expected tuple struct/variant, found unit variant `E::A`
+ Some(E::B(..)) => {} //~ ERROR expected tuple struct/variant, found unit variant `E::B`
+ }
+}
--- /dev/null
+error[E0532]: expected tuple struct/variant, found unit variant `E::A`
+ --> $DIR/issue-pr29383.rs:19:14
+ |
+LL | Some(E::A(..)) => {} //~ ERROR expected tuple struct/variant, found unit variant `E::A`
+ | ^^^^ not a tuple struct/variant
+
+error[E0532]: expected tuple struct/variant, found unit variant `E::B`
+ --> $DIR/issue-pr29383.rs:20:14
+ |
+LL | Some(E::B(..)) => {} //~ ERROR expected tuple struct/variant, found unit variant `E::B`
+ | ^^^^ not a tuple struct/variant
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0532`.