mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
make non_camel_case_types an early lint
This commit is contained in:
parent
ddab10a692
commit
6474de904c
@ -123,6 +123,7 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) {
|
||||
UnusedDocComment,
|
||||
BadRepr,
|
||||
EllipsisInclusiveRangePatterns,
|
||||
NonCamelCaseTypes,
|
||||
);
|
||||
|
||||
add_early_builtin_with_new!(sess,
|
||||
@ -138,7 +139,6 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) {
|
||||
UnusedAttributes: UnusedAttributes,
|
||||
PathStatements: PathStatements,
|
||||
UnusedResults: UnusedResults,
|
||||
NonCamelCaseTypes: NonCamelCaseTypes,
|
||||
NonSnakeCase: NonSnakeCase,
|
||||
NonUpperCaseGlobals: NonUpperCaseGlobals,
|
||||
NonShorthandFieldPatterns: NonShorthandFieldPatterns,
|
||||
|
@ -13,8 +13,8 @@ use rustc::hir::def::Def;
|
||||
use rustc::hir::intravisit::FnKind;
|
||||
use rustc::ty;
|
||||
use rustc_target::spec::abi::Abi;
|
||||
use lint::{LateContext, LintContext, LintArray};
|
||||
use lint::{LintPass, LateLintPass};
|
||||
use lint::{EarlyContext, LateContext, LintContext, LintArray};
|
||||
use lint::{EarlyLintPass, LintPass, LateLintPass};
|
||||
use syntax::ast;
|
||||
use syntax::attr;
|
||||
use syntax_pos::Span;
|
||||
@ -50,7 +50,7 @@ declare_lint! {
|
||||
pub struct NonCamelCaseTypes;
|
||||
|
||||
impl NonCamelCaseTypes {
|
||||
fn check_case(&self, cx: &LateContext, sort: &str, name: ast::Name, span: Span) {
|
||||
fn check_case(&self, cx: &EarlyContext, sort: &str, name: ast::Name, span: Span) {
|
||||
fn char_has_case(c: char) -> bool {
|
||||
c.is_lowercase() || c.is_uppercase()
|
||||
}
|
||||
@ -114,12 +114,12 @@ impl LintPass for NonCamelCaseTypes {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonCamelCaseTypes {
|
||||
fn check_item(&mut self, cx: &LateContext, it: &hir::Item) {
|
||||
impl EarlyLintPass for NonCamelCaseTypes {
|
||||
fn check_item(&mut self, cx: &EarlyContext, it: &ast::Item) {
|
||||
let has_repr_c = it.attrs
|
||||
.iter()
|
||||
.any(|attr| {
|
||||
attr::find_repr_attrs(&cx.tcx.sess.parse_sess, attr)
|
||||
attr::find_repr_attrs(&cx.sess.parse_sess, attr)
|
||||
.iter()
|
||||
.any(|r| r == &attr::ReprC)
|
||||
});
|
||||
@ -129,27 +129,22 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonCamelCaseTypes {
|
||||
}
|
||||
|
||||
match it.node {
|
||||
hir::ItemKind::Ty(..) |
|
||||
hir::ItemKind::Enum(..) |
|
||||
hir::ItemKind::Struct(..) |
|
||||
hir::ItemKind::Union(..) => self.check_case(cx, "type", it.name, it.span),
|
||||
hir::ItemKind::Trait(..) => self.check_case(cx, "trait", it.name, it.span),
|
||||
ast::ItemKind::Ty(..) |
|
||||
ast::ItemKind::Enum(..) |
|
||||
ast::ItemKind::Struct(..) |
|
||||
ast::ItemKind::Union(..) => self.check_case(cx, "type", it.ident.name, it.span),
|
||||
ast::ItemKind::Trait(..) => self.check_case(cx, "trait", it.ident.name, it.span),
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
||||
fn check_variant(&mut self, cx: &LateContext, v: &hir::Variant, _: &hir::Generics) {
|
||||
self.check_case(cx, "variant", v.node.name, v.span);
|
||||
fn check_variant(&mut self, cx: &EarlyContext, v: &ast::Variant, _: &ast::Generics) {
|
||||
self.check_case(cx, "variant", v.node.ident.name, v.span);
|
||||
}
|
||||
|
||||
fn check_generic_param(&mut self, cx: &LateContext, param: &hir::GenericParam) {
|
||||
match param.kind {
|
||||
GenericParamKind::Lifetime { .. } => {}
|
||||
GenericParamKind::Type { synthetic, .. } => {
|
||||
if synthetic.is_none() {
|
||||
self.check_case(cx, "type parameter", param.name.ident().name, param.span);
|
||||
}
|
||||
}
|
||||
fn check_generic_param(&mut self, cx: &EarlyContext, param: &ast::GenericParam) {
|
||||
if let ast::GenericParamKind::Type { .. } = param.kind {
|
||||
self.check_case(cx, "type parameter", param.ident.name, param.ident.span);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +1,17 @@
|
||||
error[E0507]: cannot move out of borrowed content
|
||||
--> $DIR/access-mode-in-closures.rs:19:15
|
||||
--> $DIR/access-mode-in-closures.rs:18:15
|
||||
|
|
||||
LL | match *s { sty(v) => v } //~ ERROR cannot move out
|
||||
| ^^ - data moved here
|
||||
LL | match *s { S(v) => v } //~ ERROR cannot move out
|
||||
| ^^ - data moved here
|
||||
| |
|
||||
| cannot move out of borrowed content
|
||||
| help: consider removing the `*`: `s`
|
||||
|
|
||||
note: move occurs because `v` has type `std::vec::Vec<isize>`, which does not implement the `Copy` trait
|
||||
--> $DIR/access-mode-in-closures.rs:19:24
|
||||
--> $DIR/access-mode-in-closures.rs:18:22
|
||||
|
|
||||
LL | match *s { sty(v) => v } //~ ERROR cannot move out
|
||||
| ^
|
||||
LL | match *s { S(v) => v } //~ ERROR cannot move out
|
||||
| ^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -8,14 +8,13 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
struct S(Vec<isize>);
|
||||
|
||||
struct sty(Vec<isize> );
|
||||
|
||||
fn unpack<F>(_unpack: F) where F: FnOnce(&sty) -> Vec<isize> {}
|
||||
fn unpack<F>(_unpack: F) where F: FnOnce(&S) -> Vec<isize> {}
|
||||
|
||||
fn main() {
|
||||
let _foo = unpack(|s| {
|
||||
// Test that `s` is moved here.
|
||||
match *s { sty(v) => v } //~ ERROR cannot move out
|
||||
match *s { S(v) => v } //~ ERROR cannot move out
|
||||
});
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
error[E0507]: cannot move out of borrowed content
|
||||
--> $DIR/access-mode-in-closures.rs:19:15
|
||||
--> $DIR/access-mode-in-closures.rs:18:15
|
||||
|
|
||||
LL | match *s { sty(v) => v } //~ ERROR cannot move out
|
||||
| ^^ - hint: to prevent move, use `ref v` or `ref mut v`
|
||||
LL | match *s { S(v) => v } //~ ERROR cannot move out
|
||||
| ^^ - hint: to prevent move, use `ref v` or `ref mut v`
|
||||
| |
|
||||
| cannot move out of borrowed content
|
||||
|
||||
|
@ -8,24 +8,24 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
struct cat {
|
||||
struct Cat {
|
||||
meows : usize,
|
||||
|
||||
how_hungry : isize,
|
||||
}
|
||||
|
||||
impl cat {
|
||||
impl Cat {
|
||||
pub fn speak(&self) { self.meows += 1; }
|
||||
}
|
||||
|
||||
fn cat(in_x : usize, in_y : isize) -> cat {
|
||||
cat {
|
||||
fn cat(in_x : usize, in_y : isize) -> Cat {
|
||||
Cat {
|
||||
meows: in_x,
|
||||
how_hungry: in_y
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let nyan : cat = cat(52, 99);
|
||||
let nyan : Cat = cat(52, 99);
|
||||
nyan.speak = || println!("meow"); //~ ERROR attempted to take value of method
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
error[E0615]: attempted to take value of method `speak` on type `cat`
|
||||
error[E0615]: attempted to take value of method `speak` on type `Cat`
|
||||
--> $DIR/assign-to-method.rs:30:8
|
||||
|
|
||||
LL | nyan.speak = || println!("meow"); //~ ERROR attempted to take value of method
|
||||
|
@ -10,24 +10,24 @@
|
||||
|
||||
#![feature(box_syntax)]
|
||||
|
||||
struct clam {
|
||||
struct Clam {
|
||||
x: Box<isize>,
|
||||
y: Box<isize>,
|
||||
}
|
||||
|
||||
struct fish {
|
||||
struct Fish {
|
||||
a: Box<isize>,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let a: clam = clam{x: box 1, y: box 2};
|
||||
let b: clam = clam{x: box 10, y: box 20};
|
||||
let a: Clam = Clam{x: box 1, y: box 2};
|
||||
let b: Clam = Clam{x: box 10, y: box 20};
|
||||
let z: isize = a.x + b.y;
|
||||
//~^ ERROR binary operation `+` cannot be applied to type `std::boxed::Box<isize>`
|
||||
println!("{}", z);
|
||||
assert_eq!(z, 21);
|
||||
let forty: fish = fish{a: box 40};
|
||||
let two: fish = fish{a: box 2};
|
||||
let forty: Fish = Fish{a: box 40};
|
||||
let two: Fish = Fish{a: box 2};
|
||||
let answer: isize = forty.a + two.a;
|
||||
//~^ ERROR binary operation `+` cannot be applied to type `std::boxed::Box<isize>`
|
||||
println!("{}", answer);
|
||||
|
@ -12,11 +12,11 @@ fn foo<T:'static>() {
|
||||
1.bar::<T>(); //~ ERROR `T` cannot be sent between threads safely
|
||||
}
|
||||
|
||||
trait bar {
|
||||
trait Bar {
|
||||
fn bar<T:Send>(&self);
|
||||
}
|
||||
|
||||
impl bar for usize {
|
||||
impl Bar for usize {
|
||||
fn bar<T:Send>(&self) {
|
||||
}
|
||||
}
|
||||
|
@ -16,13 +16,13 @@ impl Drop for X {
|
||||
}
|
||||
}
|
||||
|
||||
enum double_option<T,U> { some2(T,U), none2 }
|
||||
enum DoubleOption<T,U> { Some2(T,U), None2 }
|
||||
|
||||
fn main() {
|
||||
let x = double_option::some2(X { x: () }, X { x: () });
|
||||
let x = DoubleOption::Some2(X { x: () }, X { x: () });
|
||||
match x {
|
||||
double_option::some2(ref _y, _z) => { },
|
||||
DoubleOption::Some2(ref _y, _z) => { },
|
||||
//~^ ERROR cannot bind by-move and by-ref in the same pattern
|
||||
double_option::none2 => panic!()
|
||||
DoubleOption::None2 => panic!()
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
error[E0009]: cannot bind by-move and by-ref in the same pattern
|
||||
--> $DIR/bind-by-move-neither-can-live-while-the-other-survives-3.rs:24:38
|
||||
--> $DIR/bind-by-move-neither-can-live-while-the-other-survives-3.rs:24:37
|
||||
|
|
||||
LL | double_option::some2(ref _y, _z) => { },
|
||||
| ------ ^^ by-move pattern here
|
||||
| |
|
||||
| both by-ref and by-move used
|
||||
LL | DoubleOption::Some2(ref _y, _z) => { },
|
||||
| ------ ^^ by-move pattern here
|
||||
| |
|
||||
| both by-ref and by-move used
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![allow(non_camel_case_types)]
|
||||
|
||||
mod foo { pub struct bar; }
|
||||
|
||||
fn main() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/blind-item-block-middle.rs:14:9
|
||||
--> $DIR/blind-item-block-middle.rs:16:9
|
||||
|
|
||||
LL | let bar = 5;
|
||||
| ^^^ expected integral variable, found struct `foo::bar`
|
||||
|
@ -8,9 +8,9 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
struct r;
|
||||
struct R;
|
||||
|
||||
impl Drop for r {
|
||||
impl Drop for R {
|
||||
fn drop(&mut self) {
|
||||
true //~ ERROR mismatched types
|
||||
}
|
||||
|
@ -8,14 +8,13 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
|
||||
enum color { rgb(isize, isize, isize), rgba(isize, isize, isize, isize), }
|
||||
enum Color { Rgb(isize, isize, isize), Rgba(isize, isize, isize, isize), }
|
||||
|
||||
fn main() {
|
||||
let red: color = color::rgb(255, 0, 0);
|
||||
let red: Color = Color::Rgb(255, 0, 0);
|
||||
match red {
|
||||
color::rgb(r, g, b) => { println!("rgb"); }
|
||||
color::hsl(h, s, l) => { println!("hsl"); }
|
||||
Color::Rgb(r, g, b) => { println!("rgb"); }
|
||||
Color::Hsl(h, s, l) => { println!("hsl"); }
|
||||
//~^ ERROR no variant
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
error[E0599]: no variant named `hsl` found for type `color` in the current scope
|
||||
--> $DIR/bogus-tag.rs:18:7
|
||||
error[E0599]: no variant named `Hsl` found for type `Color` in the current scope
|
||||
--> $DIR/bogus-tag.rs:17:7
|
||||
|
|
||||
LL | enum color { rgb(isize, isize, isize), rgba(isize, isize, isize, isize), }
|
||||
| ---------- variant `hsl` not found here
|
||||
LL | enum Color { Rgb(isize, isize, isize), Rgba(isize, isize, isize, isize), }
|
||||
| ---------- variant `Hsl` not found here
|
||||
...
|
||||
LL | color::hsl(h, s, l) => { println!("hsl"); }
|
||||
| ^^^^^^^^^^^^^^^^^^^ variant not found in `color`
|
||||
LL | Color::Hsl(h, s, l) => { println!("hsl"); }
|
||||
| ^^^^^^^^^^^^^^^^^^^ variant not found in `Color`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -15,7 +15,7 @@ error[E0506]: cannot assign to `p` because it is borrowed
|
||||
|
|
||||
LL | let q = &p.y;
|
||||
| ---- borrow of `p` occurs here
|
||||
LL | p = point {x: 5, y: 7};//[ast]~ ERROR cannot assign to `p`
|
||||
LL | p = Point {x: 5, y: 7};//[ast]~ ERROR cannot assign to `p`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `p` occurs here
|
||||
...
|
||||
LL | *q; // stretch loan
|
||||
|
@ -12,7 +12,7 @@ error[E0506]: cannot assign to `p` because it is borrowed
|
||||
|
|
||||
LL | let q = &p.y;
|
||||
| --- borrow of `p` occurs here
|
||||
LL | p = point {x: 5, y: 7};//[ast]~ ERROR cannot assign to `p`
|
||||
LL | p = Point {x: 5, y: 7};//[ast]~ ERROR cannot assign to `p`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `p` occurs here
|
||||
|
||||
error[E0506]: cannot assign to `p.y` because it is borrowed
|
||||
|
@ -15,7 +15,7 @@ error[E0506]: cannot assign to `p` because it is borrowed
|
||||
|
|
||||
LL | let q = &p.y;
|
||||
| ---- borrow of `p` occurs here
|
||||
LL | p = point {x: 5, y: 7};//[ast]~ ERROR cannot assign to `p`
|
||||
LL | p = Point {x: 5, y: 7};//[ast]~ ERROR cannot assign to `p`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `p` occurs here
|
||||
...
|
||||
LL | *q; // stretch loan
|
||||
|
@ -11,10 +11,10 @@
|
||||
// revisions: ast mir
|
||||
//[mir]compile-flags: -Z borrowck=mir
|
||||
|
||||
struct point { x: isize, y: isize }
|
||||
struct Point { x: isize, y: isize }
|
||||
|
||||
fn a() {
|
||||
let mut p = point {x: 3, y: 4};
|
||||
let mut p = Point {x: 3, y: 4};
|
||||
let q = &p;
|
||||
|
||||
// This assignment is illegal because the field x is not
|
||||
@ -29,9 +29,9 @@ fn c() {
|
||||
// this is sort of the opposite. We take a loan to the interior of `p`
|
||||
// and then try to overwrite `p` as a whole.
|
||||
|
||||
let mut p = point {x: 3, y: 4};
|
||||
let mut p = Point {x: 3, y: 4};
|
||||
let q = &p.y;
|
||||
p = point {x: 5, y: 7};//[ast]~ ERROR cannot assign to `p`
|
||||
p = Point {x: 5, y: 7};//[ast]~ ERROR cannot assign to `p`
|
||||
//[mir]~^ ERROR cannot assign to `p` because it is borrowed
|
||||
p.x; // silence warning
|
||||
*q; // stretch loan
|
||||
@ -41,7 +41,7 @@ fn d() {
|
||||
// just for completeness's sake, the easy case, where we take the
|
||||
// address of a subcomponent and then modify that subcomponent:
|
||||
|
||||
let mut p = point {x: 3, y: 4};
|
||||
let mut p = Point {x: 3, y: 4};
|
||||
let q = &p.y;
|
||||
p.y = 5; //[ast]~ ERROR cannot assign to `p.y`
|
||||
//[mir]~^ ERROR cannot assign to `p.y` because it is borrowed
|
||||
|
@ -1,7 +1,7 @@
|
||||
error[E0716]: temporary value dropped while borrowed
|
||||
--> $DIR/borrowck-borrowed-uniq-rvalue-2.rs:32:20
|
||||
--> $DIR/borrowck-borrowed-uniq-rvalue-2.rs:30:20
|
||||
|
|
||||
LL | let x = defer(&vec!["Goodbye", "world!"]);
|
||||
LL | let x = defer(&vec!["Goodbye", "world!"]); //~ ERROR borrowed value does not live long enough
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ - temporary value is freed at the end of this statement
|
||||
| |
|
||||
| creates a temporary which is freed while still in use
|
||||
|
@ -8,13 +8,11 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// error-pattern: borrowed value does not live long enough
|
||||
|
||||
struct defer<'a> {
|
||||
struct Defer<'a> {
|
||||
x: &'a [&'a str],
|
||||
}
|
||||
|
||||
impl<'a> Drop for defer<'a> {
|
||||
impl<'a> Drop for Defer<'a> {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
println!("{:?}", self.x);
|
||||
@ -22,13 +20,13 @@ impl<'a> Drop for defer<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
fn defer<'r>(x: &'r [&'r str]) -> defer<'r> {
|
||||
defer {
|
||||
fn defer<'r>(x: &'r [&'r str]) -> Defer<'r> {
|
||||
Defer {
|
||||
x: x
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let x = defer(&vec!["Goodbye", "world!"]);
|
||||
let x = defer(&vec!["Goodbye", "world!"]); //~ ERROR borrowed value does not live long enough
|
||||
x.x[0];
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
error[E0597]: borrowed value does not live long enough
|
||||
--> $DIR/borrowck-borrowed-uniq-rvalue-2.rs:32:20
|
||||
--> $DIR/borrowck-borrowed-uniq-rvalue-2.rs:30:20
|
||||
|
|
||||
LL | let x = defer(&vec!["Goodbye", "world!"]);
|
||||
LL | let x = defer(&vec!["Goodbye", "world!"]); //~ ERROR borrowed value does not live long enough
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ - temporary value dropped here while still borrowed
|
||||
| |
|
||||
| temporary value does not live long enough
|
||||
|
@ -1,8 +1,8 @@
|
||||
error[E0381]: use of possibly uninitialized variable: `origin`
|
||||
--> $DIR/borrowck-init-in-fru.rs:22:5
|
||||
|
|
||||
LL | origin = point {x: 10,.. origin};
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use of possibly uninitialized `origin.y`
|
||||
LL | origin = Point { x: 10, ..origin };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use of possibly uninitialized `origin.y`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
error[E0381]: use of possibly uninitialized variable: `origin.y`
|
||||
--> $DIR/borrowck-init-in-fru.rs:22:30
|
||||
--> $DIR/borrowck-init-in-fru.rs:22:31
|
||||
|
|
||||
LL | origin = point {x: 10,.. origin};
|
||||
| ^^^^^^ use of possibly uninitialized `origin.y`
|
||||
LL | origin = Point { x: 10, ..origin };
|
||||
| ^^^^^^ use of possibly uninitialized `origin.y`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
error[E0381]: use of possibly uninitialized variable: `origin`
|
||||
--> $DIR/borrowck-init-in-fru.rs:22:5
|
||||
|
|
||||
LL | origin = point {x: 10,.. origin};
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use of possibly uninitialized `origin.y`
|
||||
LL | origin = Point { x: 10, ..origin };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use of possibly uninitialized `origin.y`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -12,14 +12,14 @@
|
||||
//[mir]compile-flags: -Z borrowck=mir
|
||||
|
||||
#[derive(Clone)]
|
||||
struct point {
|
||||
struct Point {
|
||||
x: isize,
|
||||
y: isize,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let mut origin: point;
|
||||
origin = point {x: 10,.. origin};
|
||||
let mut origin: Point;
|
||||
origin = Point { x: 10, ..origin };
|
||||
//[ast]~^ ERROR use of possibly uninitialized variable: `origin.y` [E0381]
|
||||
//[mir]~^^ ERROR [E0381]
|
||||
origin.clone();
|
||||
|
@ -6,7 +6,7 @@ LL | let _y = {x} + x.clone(); // the `{x}` forces a move to occur
|
||||
| |
|
||||
| value moved here
|
||||
|
|
||||
= note: move occurs because `x` has type `foo`, which does not implement the `Copy` trait
|
||||
= note: move occurs because `x` has type `Foo`, which does not implement the `Copy` trait
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -14,20 +14,20 @@
|
||||
use std::ops::Add;
|
||||
|
||||
#[derive(Clone)]
|
||||
struct foo(Box<usize>);
|
||||
struct Foo(Box<usize>);
|
||||
|
||||
impl Add for foo {
|
||||
type Output = foo;
|
||||
impl Add for Foo {
|
||||
type Output = Foo;
|
||||
|
||||
fn add(self, f: foo) -> foo {
|
||||
let foo(box i) = self;
|
||||
let foo(box j) = f;
|
||||
foo(box (i + j))
|
||||
fn add(self, f: Foo) -> Foo {
|
||||
let Foo(box i) = self;
|
||||
let Foo(box j) = f;
|
||||
Foo(box (i + j))
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let x = foo(box 3);
|
||||
let x = Foo(box 3);
|
||||
let _y = {x} + x.clone(); // the `{x}` forces a move to occur
|
||||
//~^ ERROR use of moved value: `x`
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ LL | let _y = {x} + x.clone(); // the `{x}` forces a move to occur
|
||||
| |
|
||||
| value moved here
|
||||
|
|
||||
= note: move occurs because `x` has type `foo`, which does not implement the `Copy` trait
|
||||
= note: move occurs because `x` has type `Foo`, which does not implement the `Copy` trait
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-loan-rcvr.rs:34:14
|
||||
--> $DIR/borrowck-loan-rcvr.rs:33:14
|
||||
|
|
||||
LL | p.blockm(|| { //~ ERROR cannot borrow `p` as mutable
|
||||
| - ------ ^^ mutable borrow occurs here
|
||||
@ -10,7 +10,7 @@ LL | p.x = 10;
|
||||
| - second borrow occurs due to use of `p` in closure
|
||||
|
||||
error[E0502]: cannot borrow `p` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-loan-rcvr.rs:45:5
|
||||
--> $DIR/borrowck-loan-rcvr.rs:44:5
|
||||
|
|
||||
LL | let l = &mut p;
|
||||
| ------ mutable borrow occurs here
|
||||
|
@ -8,15 +8,14 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
struct Point { x: isize, y: isize }
|
||||
|
||||
struct point { x: isize, y: isize }
|
||||
|
||||
trait methods {
|
||||
trait Methods {
|
||||
fn impurem(&self);
|
||||
fn blockm<F>(&self, f: F) where F: FnOnce();
|
||||
}
|
||||
|
||||
impl methods for point {
|
||||
impl Methods for Point {
|
||||
fn impurem(&self) {
|
||||
}
|
||||
|
||||
@ -24,7 +23,7 @@ impl methods for point {
|
||||
}
|
||||
|
||||
fn a() {
|
||||
let mut p = point {x: 3, y: 4};
|
||||
let mut p = Point {x: 3, y: 4};
|
||||
|
||||
// Here: it's ok to call even though receiver is mutable, because we
|
||||
// can loan it out.
|
||||
@ -37,7 +36,7 @@ fn a() {
|
||||
}
|
||||
|
||||
fn b() {
|
||||
let mut p = point {x: 3, y: 4};
|
||||
let mut p = Point {x: 3, y: 4};
|
||||
|
||||
// Here I create an outstanding loan and check that we get conflicts:
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-loan-rcvr.rs:34:14
|
||||
--> $DIR/borrowck-loan-rcvr.rs:33:14
|
||||
|
|
||||
LL | p.blockm(|| { //~ ERROR cannot borrow `p` as mutable
|
||||
| - ^^ mutable borrow occurs here
|
||||
@ -11,7 +11,7 @@ LL | })
|
||||
| - immutable borrow ends here
|
||||
|
||||
error[E0502]: cannot borrow `p` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-loan-rcvr.rs:45:5
|
||||
--> $DIR/borrowck-loan-rcvr.rs:44:5
|
||||
|
|
||||
LL | let l = &mut p;
|
||||
| - mutable borrow occurs here
|
||||
|
@ -1,7 +1,7 @@
|
||||
error[E0505]: cannot move out of `x` because it is borrowed
|
||||
--> $DIR/borrowck-no-cycle-in-exchange-heap.rs:26:15
|
||||
|
|
||||
LL | cycle::node(ref mut y) => {
|
||||
LL | Cycle::Node(ref mut y) => {
|
||||
| --------- borrow of `x.0` occurs here
|
||||
LL | y.a = x; //~ ERROR cannot move out of
|
||||
| --- ^ move out of `x` occurs here
|
||||
|
@ -10,21 +10,21 @@
|
||||
|
||||
#![feature(box_syntax)]
|
||||
|
||||
struct node_ {
|
||||
a: Box<cycle>
|
||||
struct Node_ {
|
||||
a: Box<Cycle>
|
||||
}
|
||||
|
||||
enum cycle {
|
||||
node(node_),
|
||||
empty
|
||||
enum Cycle {
|
||||
Node(Node_),
|
||||
Empty,
|
||||
}
|
||||
fn main() {
|
||||
let mut x: Box<_> = box cycle::node(node_ {a: box cycle::empty});
|
||||
let mut x: Box<_> = box Cycle::Node(Node_ {a: box Cycle::Empty});
|
||||
// Create a cycle!
|
||||
match *x {
|
||||
cycle::node(ref mut y) => {
|
||||
Cycle::Node(ref mut y) => {
|
||||
y.a = x; //~ ERROR cannot move out of
|
||||
}
|
||||
cycle::empty => {}
|
||||
Cycle::Empty => {}
|
||||
};
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
error[E0505]: cannot move out of `x` because it is borrowed
|
||||
--> $DIR/borrowck-no-cycle-in-exchange-heap.rs:26:15
|
||||
|
|
||||
LL | cycle::node(ref mut y) => {
|
||||
LL | Cycle::Node(ref mut y) => {
|
||||
| --------- borrow of `x.0` occurs here
|
||||
LL | y.a = x; //~ ERROR cannot move out of
|
||||
| ^ move out of `x` occurs here
|
||||
|
@ -10,18 +10,18 @@
|
||||
|
||||
#![feature(box_syntax)]
|
||||
|
||||
trait noisy {
|
||||
trait Noisy {
|
||||
fn speak(&self);
|
||||
}
|
||||
|
||||
struct cat {
|
||||
struct Cat {
|
||||
meows : usize,
|
||||
|
||||
how_hungry : isize,
|
||||
name : String,
|
||||
}
|
||||
|
||||
impl cat {
|
||||
impl Cat {
|
||||
pub fn eat(&self) -> bool {
|
||||
if self.how_hungry > 0 {
|
||||
println!("OM NOM NOM");
|
||||
@ -35,12 +35,12 @@ impl cat {
|
||||
}
|
||||
}
|
||||
|
||||
impl noisy for cat {
|
||||
impl Noisy for Cat {
|
||||
fn speak(&self) { self.meow(); }
|
||||
|
||||
}
|
||||
|
||||
impl cat {
|
||||
impl Cat {
|
||||
fn meow(&self) {
|
||||
println!("Meow");
|
||||
self.meows += 1;
|
||||
@ -50,8 +50,8 @@ impl cat {
|
||||
}
|
||||
}
|
||||
|
||||
fn cat(in_x : usize, in_y : isize, in_name: String) -> cat {
|
||||
cat {
|
||||
fn cat(in_x : usize, in_y : isize, in_name: String) -> Cat {
|
||||
Cat {
|
||||
meows: in_x,
|
||||
how_hungry: in_y,
|
||||
name: in_name
|
||||
@ -59,6 +59,6 @@ fn cat(in_x : usize, in_y : isize, in_name: String) -> cat {
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let nyan: Box<noisy> = box cat(0, 2, "nyan".to_string()) as Box<noisy>;
|
||||
let nyan: Box<Noisy> = box cat(0, 2, "nyan".to_string()) as Box<Noisy>;
|
||||
nyan.eat(); //~ ERROR no method named `eat` found
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
error[E0599]: no method named `eat` found for type `std::boxed::Box<dyn noisy>` in the current scope
|
||||
error[E0599]: no method named `eat` found for type `std::boxed::Box<dyn Noisy>` in the current scope
|
||||
--> $DIR/class-cast-to-trait.rs:63:8
|
||||
|
|
||||
LL | nyan.eat(); //~ ERROR no method named `eat` found
|
||||
|
@ -8,20 +8,20 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
trait animal {
|
||||
trait Animal {
|
||||
fn eat(&self);
|
||||
}
|
||||
|
||||
struct cat {
|
||||
struct Cat {
|
||||
meows: usize,
|
||||
}
|
||||
|
||||
impl animal for cat {
|
||||
impl Animal for Cat {
|
||||
//~^ ERROR not all trait items implemented, missing: `eat`
|
||||
}
|
||||
|
||||
fn cat(in_x : usize) -> cat {
|
||||
cat {
|
||||
fn cat(in_x : usize) -> Cat {
|
||||
Cat {
|
||||
meows: in_x
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ error[E0046]: not all trait items implemented, missing: `eat`
|
||||
LL | fn eat(&self);
|
||||
| -------------- `eat` from trait
|
||||
...
|
||||
LL | impl animal for cat {
|
||||
LL | impl Animal for Cat {
|
||||
| ^^^^^^^^^^^^^^^^^^^ missing `eat` in implementation
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -8,11 +8,11 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
struct cat {
|
||||
struct Cat {
|
||||
meows : usize,
|
||||
}
|
||||
|
||||
impl cat {
|
||||
impl Cat {
|
||||
fn sleep(&self) { loop{} }
|
||||
fn meow(&self) {
|
||||
println!("Meow");
|
||||
|
@ -9,16 +9,16 @@
|
||||
// except according to those terms.
|
||||
|
||||
#[derive(Debug)]
|
||||
struct foo {
|
||||
struct Foo {
|
||||
i: isize,
|
||||
}
|
||||
|
||||
impl Drop for foo {
|
||||
impl Drop for Foo {
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
fn foo(i:isize) -> foo {
|
||||
foo {
|
||||
fn foo(i:isize) -> Foo {
|
||||
Foo {
|
||||
i: i
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
error[E0599]: no method named `clone` found for type `foo` in the current scope
|
||||
error[E0599]: no method named `clone` found for type `Foo` in the current scope
|
||||
--> $DIR/copy-a-resource.rs:28:16
|
||||
|
|
||||
LL | struct foo {
|
||||
LL | struct Foo {
|
||||
| ---------- method `clone` not found for this
|
||||
...
|
||||
LL | let _y = x.clone();
|
||||
|
@ -8,6 +8,8 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![allow(non_camel_case_types)]
|
||||
|
||||
struct hello(isize);
|
||||
|
||||
fn main() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0530]: let bindings cannot shadow tuple structs
|
||||
--> $DIR/enum-in-scope.rs:14:9
|
||||
--> $DIR/enum-in-scope.rs:16:9
|
||||
|
|
||||
LL | struct hello(isize);
|
||||
| -------------------- the tuple struct `hello` is defined here
|
||||
|
@ -8,6 +8,8 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![allow(non_camel_case_types)]
|
||||
|
||||
use foo::baz;
|
||||
use bar::baz; //~ ERROR E0252
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0252]: the name `baz` is defined multiple times
|
||||
--> $DIR/E0252.rs:12:5
|
||||
--> $DIR/E0252.rs:14:5
|
||||
|
|
||||
LL | use foo::baz;
|
||||
| -------- previous import of the type `baz` here
|
||||
|
@ -9,7 +9,7 @@
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(alloc)]
|
||||
#![allow(unused_extern_crates)]
|
||||
#![allow(unused_extern_crates, non_camel_case_types)]
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#![feature(repr_simd)]
|
||||
#![feature(platform_intrinsics)]
|
||||
#![allow(non_camel_case_types)]
|
||||
|
||||
#[repr(simd)]
|
||||
struct f64x2(f64, f64);
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0440]: platform-specific intrinsic has wrong number of type parameters: found 1, expected 0
|
||||
--> $DIR/E0440.rs:18:5
|
||||
--> $DIR/E0440.rs:19:5
|
||||
|
|
||||
LL | fn x86_mm_movemask_pd<T>(x: f64x2) -> i32; //~ ERROR E0440
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#![feature(repr_simd)]
|
||||
#![feature(platform_intrinsics)]
|
||||
#![allow(non_camel_case_types)]
|
||||
|
||||
#[repr(simd)]
|
||||
struct i16x8(i16, i16, i16, i16, i16, i16, i16, i16);
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0441]: unrecognized platform-specific intrinsic function: `x86_mm_adds_ep16`
|
||||
--> $DIR/E0441.rs:18:5
|
||||
--> $DIR/E0441.rs:19:5
|
||||
|
|
||||
LL | fn x86_mm_adds_ep16(x: i16x8, y: i16x8) -> i16x8; //~ ERROR E0441
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#![feature(repr_simd)]
|
||||
#![feature(platform_intrinsics)]
|
||||
#![allow(non_camel_case_types)]
|
||||
|
||||
#[repr(simd)]
|
||||
struct i8x16(i8, i8, i8, i8, i8, i8, i8, i8,
|
||||
|
@ -1,17 +1,17 @@
|
||||
error[E0442]: intrinsic argument 1 has wrong type: found vector with length 16, expected length 8
|
||||
--> $DIR/E0442.rs:23:5
|
||||
--> $DIR/E0442.rs:24:5
|
||||
|
|
||||
LL | fn x86_mm_adds_epi16(x: i8x16, y: i32x4) -> i64x2;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0442]: intrinsic argument 2 has wrong type: found vector with length 4, expected length 8
|
||||
--> $DIR/E0442.rs:23:5
|
||||
--> $DIR/E0442.rs:24:5
|
||||
|
|
||||
LL | fn x86_mm_adds_epi16(x: i8x16, y: i32x4) -> i64x2;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0442]: intrinsic return value has wrong type: found vector with length 2, expected length 8
|
||||
--> $DIR/E0442.rs:23:5
|
||||
--> $DIR/E0442.rs:24:5
|
||||
|
|
||||
LL | fn x86_mm_adds_epi16(x: i8x16, y: i32x4) -> i64x2;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#![feature(repr_simd)]
|
||||
#![feature(platform_intrinsics)]
|
||||
#![allow(non_camel_case_types)]
|
||||
|
||||
#[repr(simd)]
|
||||
struct i16x8(i16, i16, i16, i16, i16, i16, i16, i16);
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0443]: intrinsic return value has wrong type: found `i64x8`, expected `i16x8` which was used for this vector type previously in this signature
|
||||
--> $DIR/E0443.rs:20:5
|
||||
--> $DIR/E0443.rs:21:5
|
||||
|
|
||||
LL | fn x86_mm_adds_epi16(x: i16x8, y: i16x8) -> i64x8; //~ ERROR E0443
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#![feature(repr_simd)]
|
||||
#![feature(platform_intrinsics)]
|
||||
#![allow(non_camel_case_types)]
|
||||
|
||||
#[repr(simd)]
|
||||
struct f64x2(f64, f64);
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0444]: platform-specific intrinsic has invalid number of arguments: found 3, expected 1
|
||||
--> $DIR/E0444.rs:18:5
|
||||
--> $DIR/E0444.rs:19:5
|
||||
|
|
||||
LL | fn x86_mm_movemask_pd(x: f64x2, y: f64x2, z: f64x2) -> i32; //~ ERROR E0444
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -11,7 +11,7 @@
|
||||
mod foo {
|
||||
pub fn x() { }
|
||||
|
||||
enum y { y1, }
|
||||
enum Y { Y1 }
|
||||
}
|
||||
|
||||
fn main() { let z = foo::y::y1; } //~ ERROR: enum `y` is private
|
||||
fn main() { let z = foo::Y::Y1; } //~ ERROR: enum `Y` is private
|
||||
|
@ -1,7 +1,7 @@
|
||||
error[E0603]: enum `y` is private
|
||||
error[E0603]: enum `Y` is private
|
||||
--> $DIR/export-tag-variant.rs:17:26
|
||||
|
|
||||
LL | fn main() { let z = foo::y::y1; } //~ ERROR: enum `y` is private
|
||||
LL | fn main() { let z = foo::Y::Y1; } //~ ERROR: enum `Y` is private
|
||||
| ^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -11,19 +11,19 @@
|
||||
// Test that we use fully-qualified type names in error messages.
|
||||
|
||||
mod x {
|
||||
pub enum foo { }
|
||||
pub enum Foo { }
|
||||
}
|
||||
|
||||
mod y {
|
||||
pub enum foo { }
|
||||
pub enum Foo { }
|
||||
}
|
||||
|
||||
fn bar(x: x::foo) -> y::foo {
|
||||
fn bar(x: x::Foo) -> y::Foo {
|
||||
return x;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected type `y::foo`
|
||||
//~| found type `x::foo`
|
||||
//~| expected enum `y::foo`, found enum `x::foo`
|
||||
//~| expected type `y::Foo`
|
||||
//~| found type `x::Foo`
|
||||
//~| expected enum `y::Foo`, found enum `x::Foo`
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
@ -2,10 +2,10 @@ error[E0308]: mismatched types
|
||||
--> $DIR/fully-qualified-type-name2.rs:22:12
|
||||
|
|
||||
LL | return x;
|
||||
| ^ expected enum `y::foo`, found enum `x::foo`
|
||||
| ^ expected enum `y::Foo`, found enum `x::Foo`
|
||||
|
|
||||
= note: expected type `y::foo`
|
||||
found type `x::foo`
|
||||
= note: expected type `y::Foo`
|
||||
found type `x::Foo`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
enum mlist { cons(isize, mlist), nil, }
|
||||
//~^ ERROR recursive type `mlist` has infinite size
|
||||
enum MList { Cons(isize, MList), Nil }
|
||||
//~^ ERROR recursive type `MList` has infinite size
|
||||
|
||||
fn main() { let a = mlist::cons(10, mlist::cons(11, mlist::nil)); }
|
||||
fn main() { let a = MList::Cons(10, MList::Cons(11, MList::Nil)); }
|
||||
|
@ -1,12 +1,12 @@
|
||||
error[E0072]: recursive type `mlist` has infinite size
|
||||
error[E0072]: recursive type `MList` has infinite size
|
||||
--> $DIR/infinite-tag-type-recursion.rs:11:1
|
||||
|
|
||||
LL | enum mlist { cons(isize, mlist), nil, }
|
||||
LL | enum MList { Cons(isize, MList), Nil }
|
||||
| ^^^^^^^^^^ ----- recursive without indirection
|
||||
| |
|
||||
| recursive type has infinite size
|
||||
|
|
||||
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `mlist` representable
|
||||
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `MList` representable
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
type x = Vec<x>;
|
||||
type X = Vec<X>;
|
||||
//~^ ERROR cycle detected
|
||||
|
||||
fn main() { let b: x = Vec::new(); }
|
||||
fn main() { let b: X = Vec::new(); }
|
||||
|
@ -1,10 +1,10 @@
|
||||
error[E0391]: cycle detected when processing `x`
|
||||
error[E0391]: cycle detected when processing `X`
|
||||
--> $DIR/infinite-vec-type-recursion.rs:11:14
|
||||
|
|
||||
LL | type x = Vec<x>;
|
||||
LL | type X = Vec<X>;
|
||||
| ^
|
||||
|
|
||||
= note: ...which again requires processing `x`, completing the cycle
|
||||
= note: ...which again requires processing `X`, completing the cycle
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
// This is the error E0444
|
||||
|
||||
#![feature(repr_simd, platform_intrinsics)]
|
||||
#![allow(non_camel_case_types)]
|
||||
|
||||
#[repr(simd)]
|
||||
struct f64x2(f64, f64);
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0444]: platform-specific intrinsic has invalid number of arguments: found 3, expected 1
|
||||
--> $DIR/intrinsic-invalid-number-of-arguments.rs:20:5
|
||||
--> $DIR/intrinsic-invalid-number-of-arguments.rs:21:5
|
||||
|
|
||||
LL | fn x86_mm_movemask_pd(x: f64x2, y: f64x2, z: f64x2) -> i32; //~ platform-specific intrinsic
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -8,11 +8,11 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
trait t1 : t2 {
|
||||
trait T1 : T2 {
|
||||
//~^ ERROR cycle detected
|
||||
}
|
||||
|
||||
trait t2 : t1 {
|
||||
trait T2 : T1 {
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
|
@ -1,15 +1,15 @@
|
||||
error[E0391]: cycle detected when computing the supertraits of `t1`
|
||||
error[E0391]: cycle detected when computing the supertraits of `T1`
|
||||
--> $DIR/issue-12511.rs:11:12
|
||||
|
|
||||
LL | trait t1 : t2 {
|
||||
LL | trait T1 : T2 {
|
||||
| ^^
|
||||
|
|
||||
note: ...which requires computing the supertraits of `t2`...
|
||||
note: ...which requires computing the supertraits of `T2`...
|
||||
--> $DIR/issue-12511.rs:15:12
|
||||
|
|
||||
LL | trait t2 : t1 {
|
||||
LL | trait T2 : T1 {
|
||||
| ^^
|
||||
= note: ...which again requires computing the supertraits of `t1`, completing the cycle
|
||||
= note: ...which again requires computing the supertraits of `T1`, completing the cycle
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -8,15 +8,15 @@
|
||||
// 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 }
|
||||
struct Vec2 { y: f32 }
|
||||
struct Vec3 { y: f32, z: f32 }
|
||||
|
||||
fn make(v: vec2) {
|
||||
let vec3 { y: _, z: _ } = v;
|
||||
fn make(v: Vec2) {
|
||||
let Vec3 { y: _, z: _ } = v;
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected type `vec2`
|
||||
//~| found type `vec3`
|
||||
//~| expected struct `vec2`, found struct `vec3`
|
||||
//~| expected type `Vec2`
|
||||
//~| found type `Vec3`
|
||||
//~| expected struct `Vec2`, found struct `Vec3`
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
|
@ -1,11 +1,11 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-14541.rs:15:9
|
||||
|
|
||||
LL | let vec3 { y: _, z: _ } = v;
|
||||
| ^^^^^^^^^^^^^^^^^^^ expected struct `vec2`, found struct `vec3`
|
||||
LL | let Vec3 { y: _, z: _ } = v;
|
||||
| ^^^^^^^^^^^^^^^^^^^ expected struct `Vec2`, found struct `Vec3`
|
||||
|
|
||||
= note: expected type `vec2`
|
||||
found type `vec3`
|
||||
= note: expected type `Vec2`
|
||||
found type `Vec3`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
type foo = fn(&u8, &u8) -> &u8; //~ ERROR missing lifetime specifier
|
||||
type Foo = fn(&u8, &u8) -> &u8; //~ ERROR missing lifetime specifier
|
||||
|
||||
fn bar<F: Fn(&u8, &u8) -> &u8>(f: &F) {} //~ ERROR missing lifetime specifier
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/issue-19707.rs:13:28
|
||||
|
|
||||
LL | type foo = fn(&u8, &u8) -> &u8; //~ ERROR missing lifetime specifier
|
||||
LL | type Foo = fn(&u8, &u8) -> &u8; //~ ERROR missing lifetime specifier
|
||||
| ^ expected lifetime parameter
|
||||
|
|
||||
= help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from argument 1 or argument 2
|
||||
|
@ -8,11 +8,11 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
trait vec_monad<A> {
|
||||
trait VecMonad<A> {
|
||||
fn bind<B, F>(&self, f: F) where F: FnMut(A) -> Vec<B>;
|
||||
}
|
||||
|
||||
impl<A> vec_monad<A> for Vec<A> {
|
||||
impl<A> VecMonad<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); }
|
||||
|
@ -14,7 +14,7 @@ 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`
|
||||
candidate #1: `VecMonad`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -8,14 +8,14 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
enum chan { }
|
||||
enum Chan { }
|
||||
|
||||
trait channel<T> {
|
||||
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`
|
||||
// `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!() }
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
error[E0404]: expected trait, found enum `chan`
|
||||
error[E0404]: expected trait, found enum `Chan`
|
||||
--> $DIR/issue-2330.rs:18:6
|
||||
|
|
||||
LL | impl chan for isize { //~ ERROR expected trait, found enum `chan`
|
||||
LL | impl Chan for isize { //~ ERROR expected trait, found enum `Chan`
|
||||
| ^^^^ not a trait
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -8,6 +8,8 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![allow(non_camel_case_types)]
|
||||
|
||||
use foo::baz;
|
||||
use bar::baz; //~ ERROR the name `baz` is defined multiple times
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0252]: the name `baz` is defined multiple times
|
||||
--> $DIR/issue-25396.rs:12:5
|
||||
--> $DIR/issue-25396.rs:14:5
|
||||
|
|
||||
LL | use foo::baz;
|
||||
| -------- previous import of the module `baz` here
|
||||
@ -13,7 +13,7 @@ LL | use bar::baz as other_baz; //~ ERROR the name `baz` is defined multiple tim
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0252]: the name `Quux` is defined multiple times
|
||||
--> $DIR/issue-25396.rs:15:5
|
||||
--> $DIR/issue-25396.rs:17:5
|
||||
|
|
||||
LL | use foo::Quux;
|
||||
| --------- previous import of the trait `Quux` here
|
||||
@ -27,7 +27,7 @@ LL | use bar::Quux as OtherQuux; //~ ERROR the name `Quux` is defined multiple t
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0252]: the name `blah` is defined multiple times
|
||||
--> $DIR/issue-25396.rs:18:5
|
||||
--> $DIR/issue-25396.rs:20:5
|
||||
|
|
||||
LL | use foo::blah;
|
||||
| --------- previous import of the type `blah` here
|
||||
@ -41,7 +41,7 @@ LL | use bar::blah as other_blah; //~ ERROR the name `blah` is defined multiple
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0252]: the name `WOMP` is defined multiple times
|
||||
--> $DIR/issue-25396.rs:21:5
|
||||
--> $DIR/issue-25396.rs:23:5
|
||||
|
|
||||
LL | use foo::WOMP;
|
||||
| --------- previous import of the value `WOMP` here
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0507]: cannot move out of borrowed content
|
||||
--> $DIR/issue-2590.rs:22:9
|
||||
--> $DIR/issue-2590.rs:21:9
|
||||
|
|
||||
LL | self.tokens //~ ERROR cannot move out of borrowed content
|
||||
| ^^^^^^^^^^^ cannot move out of borrowed content
|
||||
|
@ -8,16 +8,15 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
|
||||
struct parser {
|
||||
struct Parser {
|
||||
tokens: Vec<isize> ,
|
||||
}
|
||||
|
||||
trait parse {
|
||||
trait Parse {
|
||||
fn parse(&self) -> Vec<isize> ;
|
||||
}
|
||||
|
||||
impl parse for parser {
|
||||
impl Parse for Parser {
|
||||
fn parse(&self) -> Vec<isize> {
|
||||
self.tokens //~ ERROR cannot move out of borrowed content
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0507]: cannot move out of borrowed content
|
||||
--> $DIR/issue-2590.rs:22:9
|
||||
--> $DIR/issue-2590.rs:21:9
|
||||
|
|
||||
LL | self.tokens //~ ERROR cannot move out of borrowed content
|
||||
| ^^^^ cannot move out of borrowed content
|
||||
|
@ -8,15 +8,15 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
pub struct send_packet<T> {
|
||||
pub struct SendPacket<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
|
||||
use SendPacket;
|
||||
pub type Ping = SendPacket<Pong>;
|
||||
pub struct Pong(SendPacket<Ping>);
|
||||
//~^ ERROR recursive type `pingpong::Pong` has infinite size
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,13 +1,13 @@
|
||||
error[E0072]: recursive type `pingpong::pong` has infinite size
|
||||
error[E0072]: recursive type `pingpong::Pong` has infinite size
|
||||
--> $DIR/issue-2718-a.rs:18:5
|
||||
|
|
||||
LL | pub struct pong(send_packet<ping>);
|
||||
| ^^^^^^^^^^^^^^^^-----------------^^
|
||||
LL | pub struct Pong(SendPacket<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
|
||||
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `pingpong::Pong` representable
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
|
||||
mod bar {
|
||||
pub enum foo {
|
||||
alpha,
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0408]: variable `beta` is not bound in all patterns
|
||||
--> $DIR/issue-2848.rs:22:7
|
||||
--> $DIR/issue-2848.rs:24:7
|
||||
|
|
||||
LL | alpha | beta => {} //~ ERROR variable `beta` is not bound in all patterns
|
||||
| ^^^^^ ---- variable not in all patterns
|
||||
|
@ -8,11 +8,11 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
enum foo { alpha, beta(isize) }
|
||||
enum Foo { Alpha, Beta(isize) }
|
||||
|
||||
fn main() {
|
||||
match foo::alpha {
|
||||
foo::alpha | foo::beta(i) => {}
|
||||
match Foo::Alpha {
|
||||
Foo::Alpha | Foo::Beta(i) => {}
|
||||
//~^ ERROR variable `i` is not bound in all patterns
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
error[E0408]: variable `i` is not bound in all patterns
|
||||
--> $DIR/issue-2849.rs:15:7
|
||||
|
|
||||
LL | foo::alpha | foo::beta(i) => {}
|
||||
LL | Foo::Alpha | Foo::Beta(i) => {}
|
||||
| ^^^^^^^^^^ - variable not in all patterns
|
||||
| |
|
||||
| pattern doesn't bind `i`
|
||||
|
@ -8,22 +8,22 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
struct ret;
|
||||
struct obj;
|
||||
struct Ret;
|
||||
struct Obj;
|
||||
|
||||
impl obj {
|
||||
fn func() -> ret {
|
||||
ret
|
||||
impl Obj {
|
||||
fn func() -> Ret {
|
||||
Ret
|
||||
}
|
||||
}
|
||||
|
||||
fn func() -> ret {
|
||||
ret
|
||||
fn func() -> Ret {
|
||||
Ret
|
||||
}
|
||||
|
||||
fn main() {
|
||||
obj::func.x();
|
||||
//~^ ERROR no method named `x` found for type `fn() -> ret {obj::func}` in the current scope
|
||||
Obj::func.x();
|
||||
//~^ ERROR no method named `x` found for type `fn() -> Ret {Obj::func}` in the current scope
|
||||
func.x();
|
||||
//~^ ERROR no method named `x` found for type `fn() -> ret {func}` in the current scope
|
||||
//~^ ERROR no method named `x` found for type `fn() -> Ret {func}` in the current scope
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
error[E0599]: no method named `x` found for type `fn() -> ret {obj::func}` in the current scope
|
||||
error[E0599]: no method named `x` found for type `fn() -> Ret {Obj::func}` in the current scope
|
||||
--> $DIR/issue-29124.rs:25:15
|
||||
|
|
||||
LL | obj::func.x();
|
||||
LL | Obj::func.x();
|
||||
| ^
|
||||
|
|
||||
= note: obj::func is a function, perhaps you wish to call it
|
||||
= note: Obj::func is a function, perhaps you wish to call it
|
||||
|
||||
error[E0599]: no method named `x` found for type `fn() -> ret {func}` in the current scope
|
||||
error[E0599]: no method named `x` found for type `fn() -> Ret {func}` in the current scope
|
||||
--> $DIR/issue-29124.rs:27:10
|
||||
|
|
||||
LL | func.x();
|
||||
|
@ -8,8 +8,8 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
enum foo { foo_(bar) }
|
||||
struct bar { x: bar }
|
||||
enum Foo { Foo_(Bar) }
|
||||
struct Bar { x: Bar }
|
||||
//~^ ERROR E0072
|
||||
|
||||
fn main() {
|
||||
|
@ -1,12 +1,12 @@
|
||||
error[E0072]: recursive type `bar` has infinite size
|
||||
error[E0072]: recursive type `Bar` has infinite size
|
||||
--> $DIR/issue-3008-2.rs:12:1
|
||||
|
|
||||
LL | struct bar { x: bar }
|
||||
LL | struct Bar { x: Bar }
|
||||
| ^^^^^^^^^^ ------ recursive without indirection
|
||||
| |
|
||||
| recursive type has infinite size
|
||||
|
|
||||
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `bar` representable
|
||||
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Bar` representable
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -10,11 +10,11 @@
|
||||
|
||||
fn siphash(k0 : u64) {
|
||||
|
||||
struct siphash {
|
||||
struct SipHash {
|
||||
v0: u64,
|
||||
}
|
||||
|
||||
impl siphash {
|
||||
impl SipHash {
|
||||
pub fn reset(&mut self) {
|
||||
self.v0 = k0 ^ 0x736f6d6570736575; //~ ERROR can't capture dynamic environment
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
fn siphash<T>() {
|
||||
|
||||
trait t {
|
||||
trait U {
|
||||
fn g(&self, x: T) -> T; //~ ERROR can't use type parameters from outer function
|
||||
//~^ ERROR can't use type parameters from outer function
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
trait siphash {
|
||||
trait SipHash {
|
||||
fn result(&self) -> u64;
|
||||
fn reset(&self);
|
||||
}
|
||||
@ -26,7 +26,7 @@ fn siphash(k0 : u64, k1 : u64) {
|
||||
return v0 ^ v1;
|
||||
}
|
||||
|
||||
impl siphash for SipState {
|
||||
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
|
||||
|
@ -8,23 +8,23 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
enum f { g(isize, isize) }
|
||||
enum F { G(isize, isize) }
|
||||
|
||||
enum h { i(j, k) }
|
||||
enum H { I(J, K) }
|
||||
|
||||
enum j { l(isize, isize) }
|
||||
enum k { m(isize, isize) }
|
||||
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); }
|
||||
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))
|
||||
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); }
|
||||
};
|
||||
|
@ -1,13 +1,13 @@
|
||||
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); }
|
||||
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))
|
||||
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
|
||||
|
@ -8,11 +8,11 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
struct x(());
|
||||
impl x {
|
||||
struct X(());
|
||||
impl X {
|
||||
pub unsafe fn with(&self) { }
|
||||
}
|
||||
|
||||
fn main() {
|
||||
x(()).with(); //~ ERROR requires unsafe function or block
|
||||
X(()).with(); //~ ERROR requires unsafe function or block
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
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
|
||||
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
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user