Resolve merge conflict
This commit is contained in:
commit
8a3ea01bca
110 changed files with 1691 additions and 713 deletions
|
|
@ -0,0 +1,23 @@
|
|||
// 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.
|
||||
|
||||
// force-host
|
||||
// no-prefer-dynamic
|
||||
|
||||
#![crate_type = "proc-macro"]
|
||||
#![feature(proc_macro)]
|
||||
|
||||
extern crate proc_macro;
|
||||
use proc_macro::TokenStream;
|
||||
|
||||
#[proc_macro_attribute]
|
||||
pub fn emit_unchanged(_args: TokenStream, input: TokenStream) -> TokenStream {
|
||||
input
|
||||
}
|
||||
22
src/test/compile-fail-fulldeps/proc-macro/issue-41211.rs
Normal file
22
src/test/compile-fail-fulldeps/proc-macro/issue-41211.rs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
// 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.
|
||||
|
||||
// aux-build:issue-41211.rs
|
||||
|
||||
// FIXME: https://github.com/rust-lang/rust/issues/41430
|
||||
// This is a temporary regression test for the ICE reported in #41211
|
||||
|
||||
#![feature(proc_macro)]
|
||||
#![emit_unchanged]
|
||||
//~^ ERROR: cannot find attribute macro `emit_unchanged` in this scope
|
||||
extern crate issue_41211;
|
||||
use issue_41211::emit_unchanged;
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -9,6 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
#![allow(dead_code)]
|
||||
#![feature(attr_literals)]
|
||||
#![feature(repr_simd)]
|
||||
|
||||
#[repr(C)] //~ ERROR: attribute should be applied to struct, enum or union
|
||||
|
|
@ -29,6 +30,9 @@ struct SInt(f64, f64);
|
|||
#[repr(C)]
|
||||
enum EExtern { A, B }
|
||||
|
||||
#[repr(align(8))] //~ ERROR: attribute should be applied to struct
|
||||
enum EAlign { A, B }
|
||||
|
||||
#[repr(packed)] //~ ERROR: attribute should be applied to struct
|
||||
enum EPacked { A, B }
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,5 @@ fn main() {
|
|||
let _: &[i32] = [0];
|
||||
//~^ ERROR mismatched types
|
||||
//~| expected type `&[i32]`
|
||||
//~| found type `[{integer}; 1]`
|
||||
//~| expected &[i32], found array of 1 elements
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,9 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
#![allow(dead_code)]
|
||||
#![feature(attr_literals)]
|
||||
#![feature(repr_align)]
|
||||
|
||||
#[repr(C)]
|
||||
enum A { A }
|
||||
|
|
@ -26,5 +27,7 @@ enum D { D }
|
|||
#[repr(C, packed)]
|
||||
struct E(i32);
|
||||
|
||||
#[rustc_error]
|
||||
fn main() {} //~ ERROR compilation successful
|
||||
#[repr(packed, align(8))] //~ ERROR conflicting packed and align representation hints
|
||||
struct F(i32);
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ impl Trait for Foo {}
|
|||
|
||||
pub fn main() {
|
||||
let x: Box<Trait> = Box::new(Foo);
|
||||
let _y: &Trait = x; //~ ERROR mismatched types
|
||||
let _y: &Trait = x; //~ ERROR E0308
|
||||
//~| expected type `&Trait`
|
||||
//~| found type `std::boxed::Box<Trait>`
|
||||
}
|
||||
|
|
|
|||
15
src/test/compile-fail/feature-gate-repr_align.rs
Normal file
15
src/test/compile-fail/feature-gate-repr_align.rs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// 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(attr_literals)]
|
||||
|
||||
#[repr(align(64))]
|
||||
struct Foo(u64, u64); //~ error: the struct `#[repr(align(u16))]` attribute is experimental
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -33,5 +33,5 @@ pub fn for_stdin<'a>() -> Container<'a> {
|
|||
fn main() {
|
||||
let mut c = for_stdin();
|
||||
let mut v = Vec::new();
|
||||
c.read_to(v); //~ ERROR mismatched types
|
||||
c.read_to(v); //~ ERROR E0308
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,4 +35,5 @@ fn check<'r, I: Iterator<Item=usize>, T: Itble<'r, usize, I>>(cont: &T) -> bool
|
|||
fn main() {
|
||||
check((3, 5));
|
||||
//~^ ERROR mismatched types
|
||||
//~| HELP try with `&(3, 5)`
|
||||
}
|
||||
|
|
|
|||
23
src/test/compile-fail/repr-align.rs
Normal file
23
src/test/compile-fail/repr-align.rs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
// 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(dead_code)]
|
||||
#![feature(attr_literals)]
|
||||
#![feature(repr_align)]
|
||||
|
||||
#[repr(align(16.0))] //~ ERROR: invalid `repr(align)` attribute: not an unsuffixed integer
|
||||
struct A(i32);
|
||||
|
||||
#[repr(align(15))] //~ ERROR: invalid `repr(align)` attribute: not a power of two
|
||||
struct B(i32);
|
||||
|
||||
#[repr(align(65536))] //~ ERROR: invalid `repr(align)` attribute: larger than 32768
|
||||
struct C(i32);
|
||||
|
||||
fn main() {}
|
||||
25
src/test/compile-fail/repr-packed-contains-align.rs
Normal file
25
src/test/compile-fail/repr-packed-contains-align.rs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
// 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(attr_literals)]
|
||||
#![feature(repr_align)]
|
||||
#![allow(dead_code)]
|
||||
|
||||
#[repr(align(16))]
|
||||
struct A(i32);
|
||||
|
||||
struct B(A);
|
||||
|
||||
#[repr(packed)]
|
||||
struct C(A); //~ ERROR: packed struct cannot transitively contain a `[repr(align)]` struct
|
||||
|
||||
#[repr(packed)]
|
||||
struct D(B); //~ ERROR: packed struct cannot transitively contain a `[repr(align)]` struct
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
#![crate_type = "lib"]
|
||||
// we can compile to a variety of platforms, because we don't need
|
||||
// cross-compiled standard libraries.
|
||||
#![feature(no_core)]
|
||||
#![feature(no_core, optin_builtin_traits)]
|
||||
#![no_core]
|
||||
|
||||
#![feature(repr_simd, simd_ffi, link_llvm_intrinsics, lang_items)]
|
||||
|
|
@ -78,3 +78,7 @@ pub trait Copy { }
|
|||
pub mod marker {
|
||||
pub use Copy;
|
||||
}
|
||||
|
||||
#[lang = "freeze"]
|
||||
trait Freeze {}
|
||||
impl Freeze for .. {}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(lang_items, no_core)]
|
||||
#![feature(lang_items, no_core, optin_builtin_traits)]
|
||||
#![no_core]
|
||||
|
||||
#[lang="copy"]
|
||||
|
|
@ -17,6 +17,10 @@ trait Copy { }
|
|||
#[lang="sized"]
|
||||
trait Sized { }
|
||||
|
||||
#[lang = "freeze"]
|
||||
trait Freeze {}
|
||||
impl Freeze for .. {}
|
||||
|
||||
#[lang="start"]
|
||||
fn start(_main: *const u8, _argc: isize, _argv: *const *const u8) -> isize { 0 }
|
||||
|
||||
|
|
|
|||
196
src/test/run-pass/align-struct.rs
Normal file
196
src/test/run-pass/align-struct.rs
Normal file
|
|
@ -0,0 +1,196 @@
|
|||
// 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(attr_literals)]
|
||||
#![feature(repr_align)]
|
||||
|
||||
use std::mem;
|
||||
|
||||
// Raising alignment
|
||||
#[repr(align(16))]
|
||||
struct Align16(i32);
|
||||
|
||||
// Lowering has no effect
|
||||
#[repr(align(1))]
|
||||
struct Align1(i32);
|
||||
|
||||
// Multiple attributes take the max
|
||||
#[repr(align(4))]
|
||||
#[repr(align(16))]
|
||||
#[repr(align(8))]
|
||||
struct AlignMany(i32);
|
||||
|
||||
// Raising alignment may not alter size.
|
||||
#[repr(align(8))]
|
||||
#[allow(dead_code)]
|
||||
struct Align8Many {
|
||||
a: i32,
|
||||
b: i32,
|
||||
c: i32,
|
||||
d: u8,
|
||||
}
|
||||
|
||||
enum Enum {
|
||||
#[allow(dead_code)]
|
||||
A(i32),
|
||||
B(Align16)
|
||||
}
|
||||
|
||||
// Nested alignment - use `#[repr(C)]` to suppress field reordering for sizeof test
|
||||
#[repr(C)]
|
||||
struct Nested {
|
||||
a: i32,
|
||||
b: i32,
|
||||
c: Align16,
|
||||
d: i8,
|
||||
}
|
||||
|
||||
#[repr(packed)]
|
||||
struct Packed(i32);
|
||||
|
||||
#[repr(align(16))]
|
||||
struct AlignContainsPacked {
|
||||
a: Packed,
|
||||
b: Packed,
|
||||
}
|
||||
|
||||
impl Align16 {
|
||||
// return aligned type
|
||||
pub fn new(i: i32) -> Align16 {
|
||||
Align16(i)
|
||||
}
|
||||
// pass aligned type
|
||||
pub fn consume(a: Align16) -> i32 {
|
||||
a.0
|
||||
}
|
||||
}
|
||||
|
||||
const CONST_ALIGN16: Align16 = Align16(7);
|
||||
static STATIC_ALIGN16: Align16 = Align16(8);
|
||||
|
||||
// Check the actual address is aligned
|
||||
fn is_aligned_to<T>(p: &T, align: usize) -> bool {
|
||||
let addr = p as *const T as usize;
|
||||
(addr & (align - 1)) == 0
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
// check alignment and size by type and value
|
||||
assert_eq!(mem::align_of::<Align16>(), 16);
|
||||
assert_eq!(mem::size_of::<Align16>(), 16);
|
||||
|
||||
let a = Align16(7);
|
||||
assert_eq!(a.0, 7);
|
||||
assert_eq!(mem::align_of_val(&a), 16);
|
||||
assert_eq!(mem::size_of_val(&a), 16);
|
||||
|
||||
assert!(is_aligned_to(&a, 16));
|
||||
|
||||
// lowering should have no effect
|
||||
assert_eq!(mem::align_of::<Align1>(), 4);
|
||||
assert_eq!(mem::size_of::<Align1>(), 4);
|
||||
let a = Align1(7);
|
||||
assert_eq!(a.0, 7);
|
||||
assert_eq!(mem::align_of_val(&a), 4);
|
||||
assert_eq!(mem::size_of_val(&a), 4);
|
||||
assert!(is_aligned_to(&a, 4));
|
||||
|
||||
// when multiple attributes are specified the max should be used
|
||||
assert_eq!(mem::align_of::<AlignMany>(), 16);
|
||||
assert_eq!(mem::size_of::<AlignMany>(), 16);
|
||||
let a = AlignMany(7);
|
||||
assert_eq!(a.0, 7);
|
||||
assert_eq!(mem::align_of_val(&a), 16);
|
||||
assert_eq!(mem::size_of_val(&a), 16);
|
||||
assert!(is_aligned_to(&a, 16));
|
||||
|
||||
// raising alignment should not reduce size
|
||||
assert_eq!(mem::align_of::<Align8Many>(), 8);
|
||||
assert_eq!(mem::size_of::<Align8Many>(), 16);
|
||||
let a = Align8Many { a: 1, b: 2, c: 3, d: 4 };
|
||||
assert_eq!(a.a, 1);
|
||||
assert_eq!(mem::align_of_val(&a), 8);
|
||||
assert_eq!(mem::size_of_val(&a), 16);
|
||||
assert!(is_aligned_to(&a, 8));
|
||||
|
||||
// return type
|
||||
let a = Align16::new(1);
|
||||
assert_eq!(mem::align_of_val(&a), 16);
|
||||
assert_eq!(mem::size_of_val(&a), 16);
|
||||
assert_eq!(a.0, 1);
|
||||
assert!(is_aligned_to(&a, 16));
|
||||
assert_eq!(Align16::consume(a), 1);
|
||||
|
||||
// check const alignment, size and value
|
||||
assert_eq!(mem::align_of_val(&CONST_ALIGN16), 16);
|
||||
assert_eq!(mem::size_of_val(&CONST_ALIGN16), 16);
|
||||
assert_eq!(CONST_ALIGN16.0, 7);
|
||||
assert!(is_aligned_to(&CONST_ALIGN16, 16));
|
||||
|
||||
// check global static alignment, size and value
|
||||
assert_eq!(mem::align_of_val(&STATIC_ALIGN16), 16);
|
||||
assert_eq!(mem::size_of_val(&STATIC_ALIGN16), 16);
|
||||
assert_eq!(STATIC_ALIGN16.0, 8);
|
||||
assert!(is_aligned_to(&STATIC_ALIGN16, 16));
|
||||
|
||||
// Note that the size of Nested may change if struct field re-ordering is enabled
|
||||
assert_eq!(mem::align_of::<Nested>(), 16);
|
||||
assert_eq!(mem::size_of::<Nested>(), 48);
|
||||
let a = Nested{ a: 1, b: 2, c: Align16(3), d: 4};
|
||||
assert_eq!(mem::align_of_val(&a), 16);
|
||||
assert_eq!(mem::align_of_val(&a.b), 4);
|
||||
assert_eq!(mem::align_of_val(&a.c), 16);
|
||||
assert_eq!(mem::size_of_val(&a), 48);
|
||||
assert!(is_aligned_to(&a, 16));
|
||||
// check the correct fields are indexed
|
||||
assert_eq!(a.a, 1);
|
||||
assert_eq!(a.b, 2);
|
||||
assert_eq!(a.c.0, 3);
|
||||
assert_eq!(a.d, 4);
|
||||
|
||||
// enum should be aligned to max alignment
|
||||
assert_eq!(mem::align_of::<Enum>(), 16);
|
||||
assert_eq!(mem::align_of_val(&Enum::B(Align16(0))), 16);
|
||||
let e = Enum::B(Align16(15));
|
||||
match e {
|
||||
Enum::B(ref a) => {
|
||||
assert_eq!(a.0, 15);
|
||||
assert_eq!(mem::align_of_val(a), 16);
|
||||
assert_eq!(mem::size_of_val(a), 16);
|
||||
},
|
||||
_ => ()
|
||||
}
|
||||
assert!(is_aligned_to(&e, 16));
|
||||
|
||||
// arrays of aligned elements should also be aligned
|
||||
assert_eq!(mem::align_of::<[Align16;2]>(), 16);
|
||||
assert_eq!(mem::size_of::<[Align16;2]>(), 32);
|
||||
|
||||
let a = [Align16(0), Align16(1)];
|
||||
assert_eq!(mem::align_of_val(&a[0]), 16);
|
||||
assert_eq!(mem::align_of_val(&a[1]), 16);
|
||||
assert!(is_aligned_to(&a, 16));
|
||||
|
||||
// check heap value is aligned
|
||||
assert_eq!(mem::align_of_val(Box::new(Align16(0)).as_ref()), 16);
|
||||
|
||||
// check heap array is aligned
|
||||
let a = vec!(Align16(0), Align16(1));
|
||||
assert_eq!(mem::align_of_val(&a[0]), 16);
|
||||
assert_eq!(mem::align_of_val(&a[1]), 16);
|
||||
|
||||
assert_eq!(mem::align_of::<AlignContainsPacked>(), 16);
|
||||
assert_eq!(mem::size_of::<AlignContainsPacked>(), 16);
|
||||
let a = AlignContainsPacked { a: Packed(1), b: Packed(2) };
|
||||
assert_eq!(mem::align_of_val(&a), 16);
|
||||
assert_eq!(mem::align_of_val(&a.a), 1);
|
||||
assert_eq!(mem::align_of_val(&a.b), 1);
|
||||
assert_eq!(mem::size_of_val(&a), 16);
|
||||
assert!(is_aligned_to(&a, 16));
|
||||
}
|
||||
|
|
@ -4,12 +4,11 @@ error[E0276]: impl has stricter requirements than trait
|
|||
15 | fn renew<'b: 'a>(self) -> &'b mut [T];
|
||||
| -------------------------------------- definition of `renew` from trait
|
||||
...
|
||||
19 | fn renew<'b: 'a>(self) -> &'b mut [T] where 'a: 'b {
|
||||
| _____^ starting here...
|
||||
19 | / fn renew<'b: 'a>(self) -> &'b mut [T] where 'a: 'b {
|
||||
20 | | //~^ ERROR E0276
|
||||
21 | | &mut self[..]
|
||||
22 | | }
|
||||
| |_____^ ...ending here: impl has extra requirement `'a: 'b`
|
||||
| |_____^ impl has extra requirement `'a: 'b`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -4,12 +4,11 @@ error[E0276]: impl has stricter requirements than trait
|
|||
19 | fn zip<B, U: Iterator<U>>(self, other: U) -> ZipIterator<Self, U>;
|
||||
| ------------------------------------------------------------------ definition of `zip` from trait
|
||||
...
|
||||
23 | fn zip<B, U: Iterator<B>>(self, other: U) -> ZipIterator<T, U> {
|
||||
| _____^ starting here...
|
||||
23 | / fn zip<B, U: Iterator<B>>(self, other: U) -> ZipIterator<T, U> {
|
||||
24 | | //~^ ERROR E0276
|
||||
25 | | ZipIterator{a: self, b: other}
|
||||
26 | | }
|
||||
| |_____^ ...ending here: impl has extra requirement `U: Iterator<B>`
|
||||
| |_____^ impl has extra requirement `U: Iterator<B>`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -2,17 +2,17 @@ error: missing `fn`, `type`, or `const` for impl-item declaration
|
|||
--> $DIR/issue-40006.rs:11:9
|
||||
|
|
||||
11 | impl X {
|
||||
| _________^ starting here...
|
||||
| _________^
|
||||
12 | | Y
|
||||
| |____^ ...ending here: missing `fn`, `type`, or `const`
|
||||
| |____^ missing `fn`, `type`, or `const`
|
||||
|
||||
error: missing `fn`, `type`, or `const` for trait-item declaration
|
||||
--> $DIR/issue-40006.rs:17:10
|
||||
|
|
||||
17 | trait X {
|
||||
| __________^ starting here...
|
||||
| __________^
|
||||
18 | | X() {}
|
||||
| |____^ ...ending here: missing `fn`, `type`, or `const`
|
||||
| |____^ missing `fn`, `type`, or `const`
|
||||
|
||||
error: expected `[`, found `#`
|
||||
--> $DIR/issue-40006.rs:19:17
|
||||
|
|
@ -24,17 +24,17 @@ error: missing `fn`, `type`, or `const` for trait-item declaration
|
|||
--> $DIR/issue-40006.rs:19:21
|
||||
|
|
||||
19 | fn xxx() { ### }
|
||||
| _____________________^ starting here...
|
||||
| _____________________^
|
||||
20 | | L = M;
|
||||
| |____^ ...ending here: missing `fn`, `type`, or `const`
|
||||
| |____^ missing `fn`, `type`, or `const`
|
||||
|
||||
error: missing `fn`, `type`, or `const` for trait-item declaration
|
||||
--> $DIR/issue-40006.rs:20:11
|
||||
|
|
||||
20 | L = M;
|
||||
| ___________^ starting here...
|
||||
| ___________^
|
||||
21 | | Z = { 2 + 3 };
|
||||
| |____^ ...ending here: missing `fn`, `type`, or `const`
|
||||
| |____^ missing `fn`, `type`, or `const`
|
||||
|
||||
error: expected one of `const`, `extern`, `fn`, `type`, `unsafe`, or `}`, found `;`
|
||||
--> $DIR/issue-40006.rs:21:18
|
||||
|
|
|
|||
|
|
@ -1,26 +1,24 @@
|
|||
error[E0569]: requires an `unsafe impl` declaration due to `#[may_dangle]` attribute
|
||||
--> $DIR/dropck-eyepatch-implies-unsafe-impl.rs:32:1
|
||||
|
|
||||
32 | impl<#[may_dangle] A, B: fmt::Debug> Drop for Pt<A, B> {
|
||||
| _^ starting here...
|
||||
32 | / impl<#[may_dangle] A, B: fmt::Debug> Drop for Pt<A, B> {
|
||||
33 | | //~^ ERROR requires an `unsafe impl` declaration due to `#[may_dangle]` attribute
|
||||
34 | |
|
||||
35 | | // (unsafe to access self.1 due to #[may_dangle] on A)
|
||||
36 | | fn drop(&mut self) { println!("drop {} {:?}", self.0, self.2); }
|
||||
37 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
||||
error[E0569]: requires an `unsafe impl` declaration due to `#[may_dangle]` attribute
|
||||
--> $DIR/dropck-eyepatch-implies-unsafe-impl.rs:38:1
|
||||
|
|
||||
38 | impl<#[may_dangle] 'a, 'b, B: fmt::Debug> Drop for Pr<'a, 'b, B> {
|
||||
| _^ starting here...
|
||||
38 | / impl<#[may_dangle] 'a, 'b, B: fmt::Debug> Drop for Pr<'a, 'b, B> {
|
||||
39 | | //~^ ERROR requires an `unsafe impl` declaration due to `#[may_dangle]` attribute
|
||||
40 | |
|
||||
41 | | // (unsafe to access self.1 due to #[may_dangle] on 'a)
|
||||
42 | | fn drop(&mut self) { println!("drop {} {:?}", self.0, self.2); }
|
||||
43 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
error: reached the type-length limit while instantiating `<T as Foo><(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(), &()), &(&()...`
|
||||
--> $DIR/issue-37311.rs:23:5
|
||||
|
|
||||
23 | fn recurse(&self) {
|
||||
| _____^ starting here...
|
||||
23 | / fn recurse(&self) {
|
||||
24 | | (self, self).recurse();
|
||||
25 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
|
||||
= note: consider adding a `#![type_length_limit="2097152"]` attribute to your crate
|
||||
|
||||
|
|
|
|||
|
|
@ -8,18 +8,18 @@ note: ...the reference is valid for the lifetime 'a as defined on the body at 11
|
|||
--> $DIR/ex1-return-one-existing-name-if-else.rs:11:44
|
||||
|
|
||||
11 | fn foo<'a>(x: &'a i32, y: &i32) -> &'a i32 {
|
||||
| ____________________________________________^ starting here...
|
||||
| ____________________________________________^
|
||||
12 | | if x > y { x } else { y }
|
||||
13 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
note: ...but the borrowed content is only valid for the anonymous lifetime #1 defined on the body at 11:43
|
||||
--> $DIR/ex1-return-one-existing-name-if-else.rs:11:44
|
||||
|
|
||||
11 | fn foo<'a>(x: &'a i32, y: &i32) -> &'a i32 {
|
||||
| ____________________________________________^ starting here...
|
||||
| ____________________________________________^
|
||||
12 | | if x > y { x } else { y }
|
||||
13 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -10,18 +10,18 @@ note: the anonymous lifetime #2 defined on the body at 15:51...
|
|||
--> $DIR/ex2a-push-one-existing-name.rs:15:52
|
||||
|
|
||||
15 | fn foo<'a>(x: &mut Vec<Ref<'a, i32>>, y: Ref<i32>) {
|
||||
| ____________________________________________________^ starting here...
|
||||
| ____________________________________________________^
|
||||
16 | | x.push(y);
|
||||
17 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
note: ...does not necessarily outlive the lifetime 'a as defined on the body at 15:51
|
||||
--> $DIR/ex2a-push-one-existing-name.rs:15:52
|
||||
|
|
||||
15 | fn foo<'a>(x: &mut Vec<Ref<'a, i32>>, y: Ref<i32>) {
|
||||
| ____________________________________________________^ starting here...
|
||||
| ____________________________________________________^
|
||||
16 | | x.push(y);
|
||||
17 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -10,18 +10,18 @@ note: the anonymous lifetime #3 defined on the body at 15:43...
|
|||
--> $DIR/ex2b-push-no-existing-names.rs:15:44
|
||||
|
|
||||
15 | fn foo(x: &mut Vec<Ref<i32>>, y: Ref<i32>) {
|
||||
| ____________________________________________^ starting here...
|
||||
| ____________________________________________^
|
||||
16 | | x.push(y);
|
||||
17 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
note: ...does not necessarily outlive the anonymous lifetime #2 defined on the body at 15:43
|
||||
--> $DIR/ex2b-push-no-existing-names.rs:15:44
|
||||
|
|
||||
15 | fn foo(x: &mut Vec<Ref<i32>>, y: Ref<i32>) {
|
||||
| ____________________________________________^ starting here...
|
||||
| ____________________________________________^
|
||||
16 | | x.push(y);
|
||||
17 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@ note: first, the lifetime cannot outlive the lifetime 'c as defined on the body
|
|||
--> $DIR/ex2c-push-inference-variable.rs:15:67
|
||||
|
|
||||
15 | fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {
|
||||
| ___________________________________________________________________^ starting here...
|
||||
| ___________________________________________________________________^
|
||||
16 | | let z = Ref { data: y.data };
|
||||
17 | | x.push(z);
|
||||
18 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
note: ...so that reference does not outlive borrowed content
|
||||
--> $DIR/ex2c-push-inference-variable.rs:16:25
|
||||
|
|
||||
|
|
@ -22,11 +22,11 @@ note: but, the lifetime must be valid for the lifetime 'b as defined on the body
|
|||
--> $DIR/ex2c-push-inference-variable.rs:15:67
|
||||
|
|
||||
15 | fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {
|
||||
| ___________________________________________________________________^ starting here...
|
||||
| ___________________________________________________________________^
|
||||
16 | | let z = Ref { data: y.data };
|
||||
17 | | x.push(z);
|
||||
18 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
note: ...so that expression is assignable (expected Ref<'b, _>, found Ref<'_, _>)
|
||||
--> $DIR/ex2c-push-inference-variable.rs:17:12
|
||||
|
|
||||
|
|
|
|||
|
|
@ -8,12 +8,12 @@ note: first, the lifetime cannot outlive the lifetime 'c as defined on the body
|
|||
--> $DIR/ex2d-push-inference-variable-2.rs:15:67
|
||||
|
|
||||
15 | fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {
|
||||
| ___________________________________________________________________^ starting here...
|
||||
| ___________________________________________________________________^
|
||||
16 | | let a: &mut Vec<Ref<i32>> = x;
|
||||
17 | | let b = Ref { data: y.data };
|
||||
18 | | a.push(b);
|
||||
19 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
note: ...so that reference does not outlive borrowed content
|
||||
--> $DIR/ex2d-push-inference-variable-2.rs:17:25
|
||||
|
|
||||
|
|
@ -23,12 +23,12 @@ note: but, the lifetime must be valid for the lifetime 'b as defined on the body
|
|||
--> $DIR/ex2d-push-inference-variable-2.rs:15:67
|
||||
|
|
||||
15 | fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {
|
||||
| ___________________________________________________________________^ starting here...
|
||||
| ___________________________________________________________________^
|
||||
16 | | let a: &mut Vec<Ref<i32>> = x;
|
||||
17 | | let b = Ref { data: y.data };
|
||||
18 | | a.push(b);
|
||||
19 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
note: ...so that expression is assignable (expected &mut std::vec::Vec<Ref<'_, i32>>, found &mut std::vec::Vec<Ref<'b, i32>>)
|
||||
--> $DIR/ex2d-push-inference-variable-2.rs:16:33
|
||||
|
|
||||
|
|
|
|||
|
|
@ -8,12 +8,12 @@ note: first, the lifetime cannot outlive the lifetime 'c as defined on the body
|
|||
--> $DIR/ex2e-push-inference-variable-3.rs:15:67
|
||||
|
|
||||
15 | fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {
|
||||
| ___________________________________________________________________^ starting here...
|
||||
| ___________________________________________________________________^
|
||||
16 | | let a: &mut Vec<Ref<i32>> = x;
|
||||
17 | | let b = Ref { data: y.data };
|
||||
18 | | Vec::push(a, b);
|
||||
19 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
note: ...so that reference does not outlive borrowed content
|
||||
--> $DIR/ex2e-push-inference-variable-3.rs:17:25
|
||||
|
|
||||
|
|
@ -23,12 +23,12 @@ note: but, the lifetime must be valid for the lifetime 'b as defined on the body
|
|||
--> $DIR/ex2e-push-inference-variable-3.rs:15:67
|
||||
|
|
||||
15 | fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {
|
||||
| ___________________________________________________________________^ starting here...
|
||||
| ___________________________________________________________________^
|
||||
16 | | let a: &mut Vec<Ref<i32>> = x;
|
||||
17 | | let b = Ref { data: y.data };
|
||||
18 | | Vec::push(a, b);
|
||||
19 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
note: ...so that expression is assignable (expected &mut std::vec::Vec<Ref<'_, i32>>, found &mut std::vec::Vec<Ref<'b, i32>>)
|
||||
--> $DIR/ex2e-push-inference-variable-3.rs:16:33
|
||||
|
|
||||
|
|
|
|||
|
|
@ -37,15 +37,14 @@ error[E0308]: mismatched types
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/abridged.rs:42:5
|
||||
|
|
||||
42 | X {
|
||||
| _____^ starting here...
|
||||
42 | / X {
|
||||
43 | | x: X {
|
||||
44 | | x: "".to_string(),
|
||||
45 | | y: 2,
|
||||
46 | | },
|
||||
47 | | y: 3,
|
||||
48 | | }
|
||||
| |_____^ ...ending here: expected struct `std::string::String`, found integral variable
|
||||
| |_____^ expected struct `std::string::String`, found integral variable
|
||||
|
|
||||
= note: expected type `X<X<_, std::string::String>, std::string::String>`
|
||||
found type `X<X<_, {integer}>, {integer}>`
|
||||
|
|
@ -53,15 +52,14 @@ error[E0308]: mismatched types
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/abridged.rs:52:5
|
||||
|
|
||||
52 | X {
|
||||
| _____^ starting here...
|
||||
52 | / X {
|
||||
53 | | x: X {
|
||||
54 | | x: "".to_string(),
|
||||
55 | | y: 2,
|
||||
56 | | },
|
||||
57 | | y: "".to_string(),
|
||||
58 | | }
|
||||
| |_____^ ...ending here: expected struct `std::string::String`, found integral variable
|
||||
| |_____^ expected struct `std::string::String`, found integral variable
|
||||
|
|
||||
= note: expected type `X<X<_, std::string::String>, _>`
|
||||
found type `X<X<_, {integer}>, _>`
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@ error[E0308]: mismatched types
|
|||
--> $DIR/main.rs:12:18
|
||||
|
|
||||
12 | let x: u32 = (
|
||||
| __________________^ starting here...
|
||||
| __________________^
|
||||
13 | | );
|
||||
| |_____^ ...ending here: expected u32, found ()
|
||||
| |_____^ expected u32, found ()
|
||||
|
|
||||
= note: expected type `u32`
|
||||
found type `()`
|
||||
|
|
|
|||
|
|
@ -3,10 +3,9 @@ error: main function not found
|
|||
error[E0046]: not all trait items implemented, missing: `CONSTANT`, `Type`, `method`
|
||||
--> $DIR/m2.rs:20:1
|
||||
|
|
||||
20 | impl m1::X for X {
|
||||
| _^ starting here...
|
||||
20 | / impl m1::X for X {
|
||||
21 | | }
|
||||
| |_^ ...ending here: missing `CONSTANT`, `Type`, `method` in implementation
|
||||
| |_^ missing `CONSTANT`, `Type`, `method` in implementation
|
||||
|
|
||||
= note: `CONSTANT` from trait: `const CONSTANT: u32;`
|
||||
= note: `Type` from trait: `type Type;`
|
||||
|
|
|
|||
43
src/test/ui/print_type_sizes/repr-align.rs
Normal file
43
src/test/ui/print_type_sizes/repr-align.rs
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
// 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 print-type-sizes
|
||||
|
||||
// This file illustrates how padding is handled: alignment
|
||||
// requirements can lead to the introduction of padding, either before
|
||||
// fields or at the end of the structure as a whole.
|
||||
//
|
||||
// It avoids using u64/i64 because on some targets that is only 4-byte
|
||||
// aligned (while on most it is 8-byte aligned) and so the resulting
|
||||
// padding and overall computed sizes can be quite different.
|
||||
#![feature(attr_literals)]
|
||||
#![feature(repr_align)]
|
||||
#![allow(dead_code)]
|
||||
|
||||
#[repr(align(16))]
|
||||
#[derive(Default)]
|
||||
struct A(i32);
|
||||
|
||||
enum E {
|
||||
A(i32),
|
||||
B(A)
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
struct S {
|
||||
a: i32,
|
||||
b: i32,
|
||||
c: A,
|
||||
d: i8,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let _s: S = Default::default();
|
||||
}
|
||||
16
src/test/ui/print_type_sizes/repr-align.stdout
Normal file
16
src/test/ui/print_type_sizes/repr-align.stdout
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
print-type-size type: `E`: 32 bytes, alignment: 16 bytes
|
||||
print-type-size discriminant: 4 bytes
|
||||
print-type-size variant `A`: 4 bytes
|
||||
print-type-size field `.0`: 4 bytes
|
||||
print-type-size variant `B`: 28 bytes
|
||||
print-type-size padding: 12 bytes
|
||||
print-type-size field `.0`: 16 bytes, alignment: 16 bytes
|
||||
print-type-size type: `S`: 32 bytes, alignment: 16 bytes
|
||||
print-type-size field `.c`: 16 bytes
|
||||
print-type-size field `.a`: 4 bytes
|
||||
print-type-size field `.b`: 4 bytes
|
||||
print-type-size field `.d`: 1 bytes
|
||||
print-type-size end padding: 7 bytes
|
||||
print-type-size type: `A`: 16 bytes, alignment: 16 bytes
|
||||
print-type-size field `.0`: 4 bytes
|
||||
print-type-size end padding: 12 bytes
|
||||
|
|
@ -32,7 +32,6 @@ fn main() {
|
|||
//~| NOTE types differ in mutability
|
||||
//~| NOTE expected type `&mut std::string::String`
|
||||
//~| NOTE found type `&std::string::String`
|
||||
//~| HELP try with `&mut y`
|
||||
test2(&y);
|
||||
//~^ ERROR E0308
|
||||
//~| NOTE types differ in mutability
|
||||
|
|
|
|||
|
|
@ -18,11 +18,7 @@ error[E0308]: mismatched types
|
|||
|
|
||||
= note: expected type `&str`
|
||||
found type `std::string::String`
|
||||
= help: here are some functions which might fulfill your needs:
|
||||
- .as_str()
|
||||
- .trim()
|
||||
- .trim_left()
|
||||
- .trim_right()
|
||||
= help: try with `&String::new()`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/coerce-suggestions.rs:30:10
|
||||
|
|
@ -34,18 +30,18 @@ error[E0308]: mismatched types
|
|||
found type `&std::string::String`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/coerce-suggestions.rs:36:11
|
||||
--> $DIR/coerce-suggestions.rs:35:11
|
||||
|
|
||||
36 | test2(&y);
|
||||
35 | test2(&y);
|
||||
| ^^ types differ in mutability
|
||||
|
|
||||
= note: expected type `&mut i32`
|
||||
found type `&std::string::String`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/coerce-suggestions.rs:42:9
|
||||
--> $DIR/coerce-suggestions.rs:41:9
|
||||
|
|
||||
42 | f = box f;
|
||||
41 | f = box f;
|
||||
| ^^^^^ cyclic type of infinite size
|
||||
|
|
||||
= note: expected type `_`
|
||||
|
|
|
|||
|
|
@ -19,15 +19,14 @@ error[E0046]: not all trait items implemented, missing: `bar`
|
|||
16 | fn bar(&self);
|
||||
| -------------- `bar` from trait
|
||||
...
|
||||
22 | impl Foo for FooConstForMethod {
|
||||
| _^ starting here...
|
||||
22 | / impl Foo for FooConstForMethod {
|
||||
23 | | //~^ ERROR E0046
|
||||
24 | | //~| NOTE missing `bar` in implementation
|
||||
25 | | const bar: u64 = 1;
|
||||
... |
|
||||
28 | | const MY_CONST: u32 = 1;
|
||||
29 | | }
|
||||
| |_^ ...ending here: missing `bar` in implementation
|
||||
| |_^ missing `bar` in implementation
|
||||
|
||||
error[E0324]: item `MY_CONST` is an associated method, which doesn't match its trait `Foo`
|
||||
--> $DIR/impl-wrong-item-for-trait.rs:37:5
|
||||
|
|
@ -44,15 +43,14 @@ error[E0046]: not all trait items implemented, missing: `MY_CONST`
|
|||
17 | const MY_CONST: u32;
|
||||
| -------------------- `MY_CONST` from trait
|
||||
...
|
||||
33 | impl Foo for FooMethodForConst {
|
||||
| _^ starting here...
|
||||
33 | / impl Foo for FooMethodForConst {
|
||||
34 | | //~^ ERROR E0046
|
||||
35 | | //~| NOTE missing `MY_CONST` in implementation
|
||||
36 | | fn bar(&self) {}
|
||||
... |
|
||||
39 | | //~| NOTE does not match trait
|
||||
40 | | }
|
||||
| |_^ ...ending here: missing `MY_CONST` in implementation
|
||||
| |_^ missing `MY_CONST` in implementation
|
||||
|
||||
error[E0325]: item `bar` is an associated type, which doesn't match its trait `Foo`
|
||||
--> $DIR/impl-wrong-item-for-trait.rs:47:5
|
||||
|
|
@ -69,23 +67,21 @@ error[E0046]: not all trait items implemented, missing: `bar`
|
|||
16 | fn bar(&self);
|
||||
| -------------- `bar` from trait
|
||||
...
|
||||
44 | impl Foo for FooTypeForMethod {
|
||||
| _^ starting here...
|
||||
44 | / impl Foo for FooTypeForMethod {
|
||||
45 | | //~^ ERROR E0046
|
||||
46 | | //~| NOTE missing `bar` in implementation
|
||||
47 | | type bar = u64;
|
||||
... |
|
||||
50 | | const MY_CONST: u32 = 1;
|
||||
51 | | }
|
||||
| |_^ ...ending here: missing `bar` in implementation
|
||||
| |_^ missing `bar` in implementation
|
||||
|
||||
error[E0046]: not all trait items implemented, missing: `fmt`
|
||||
--> $DIR/impl-wrong-item-for-trait.rs:53:1
|
||||
|
|
||||
53 | impl Debug for FooTypeForMethod {
|
||||
| _^ starting here...
|
||||
53 | / impl Debug for FooTypeForMethod {
|
||||
54 | | }
|
||||
| |_^ ...ending here: missing `fmt` in implementation
|
||||
| |_^ missing `fmt` in implementation
|
||||
|
|
||||
= note: `fmt` from trait: `fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error>`
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +1,14 @@
|
|||
error[E0046]: not all trait items implemented, missing: `Item`
|
||||
--> $DIR/issue-23729.rs:20:9
|
||||
|
|
||||
20 | impl Iterator for Recurrence {
|
||||
| _________^ starting here...
|
||||
20 | / impl Iterator for Recurrence {
|
||||
21 | | //~^ ERROR E0046
|
||||
22 | | //~| NOTE missing `Item` in implementation
|
||||
23 | | //~| NOTE `Item` from trait: `type Item;`
|
||||
... |
|
||||
36 | | }
|
||||
37 | | }
|
||||
| |_________^ ...ending here: missing `Item` in implementation
|
||||
| |_________^ missing `Item` in implementation
|
||||
|
|
||||
= note: `Item` from trait: `type Item;`
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +1,14 @@
|
|||
error[E0046]: not all trait items implemented, missing: `Output`
|
||||
--> $DIR/issue-23827.rs:36:1
|
||||
|
|
||||
36 | impl<C: Component> FnOnce<(C,)> for Prototype {
|
||||
| _^ starting here...
|
||||
36 | / impl<C: Component> FnOnce<(C,)> for Prototype {
|
||||
37 | | //~^ ERROR E0046
|
||||
38 | | //~| NOTE missing `Output` in implementation
|
||||
39 | | //~| NOTE `Output` from trait: `type Output;`
|
||||
... |
|
||||
42 | | }
|
||||
43 | | }
|
||||
| |_^ ...ending here: missing `Output` in implementation
|
||||
| |_^ missing `Output` in implementation
|
||||
|
|
||||
= note: `Output` from trait: `type Output;`
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,13 @@
|
|||
error[E0046]: not all trait items implemented, missing: `Target`
|
||||
--> $DIR/issue-24356.rs:30:9
|
||||
|
|
||||
30 | impl Deref for Thing {
|
||||
| _________^ starting here...
|
||||
30 | / impl Deref for Thing {
|
||||
31 | | //~^ ERROR E0046
|
||||
32 | | //~| NOTE missing `Target` in implementation
|
||||
33 | | //~| NOTE `Target` from trait: `type Target;`
|
||||
34 | | fn deref(&self) -> i8 { self.0 }
|
||||
35 | | }
|
||||
| |_________^ ...ending here: missing `Target` in implementation
|
||||
| |_________^ missing `Target` in implementation
|
||||
|
|
||||
= note: `Target` from trait: `type Target;`
|
||||
|
||||
|
|
|
|||
27
src/test/ui/span/issue-33884.rs
Normal file
27
src/test/ui/span/issue-33884.rs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
// 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::net::TcpListener;
|
||||
use std::net::TcpStream;
|
||||
use std::io::{self, Read, Write};
|
||||
|
||||
fn handle_client(stream: TcpStream) -> io::Result<()> {
|
||||
stream.write_fmt(format!("message received"))
|
||||
}
|
||||
|
||||
fn main() {
|
||||
if let Ok(listener) = TcpListener::bind("127.0.0.1:8080") {
|
||||
for incoming in listener.incoming() {
|
||||
if let Ok(stream) = incoming {
|
||||
handle_client(stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
12
src/test/ui/span/issue-33884.stderr
Normal file
12
src/test/ui/span/issue-33884.stderr
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-33884.rs:16:22
|
||||
|
|
||||
16 | stream.write_fmt(format!("message received"))
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `std::fmt::Arguments`, found struct `std::string::String`
|
||||
|
|
||||
= note: expected type `std::fmt::Arguments<'_>`
|
||||
found type `std::string::String`
|
||||
= note: this error originates in a macro outside of the current crate
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
@ -38,11 +38,10 @@ error: no method named `fff` found for type `Myisize` in the current scope
|
|||
note: candidate #1 is defined in an impl for the type `Myisize`
|
||||
--> $DIR/issue-7575.rs:51:5
|
||||
|
|
||||
51 | fn fff(i: isize) -> isize { //~ NOTE candidate
|
||||
| _____^ starting here...
|
||||
51 | / fn fff(i: isize) -> isize { //~ NOTE candidate
|
||||
52 | | i
|
||||
53 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
||||
error: no method named `is_str` found for type `T` in the current scope
|
||||
--> $DIR/issue-7575.rs:85:7
|
||||
|
|
@ -54,11 +53,10 @@ error: no method named `is_str` found for type `T` in the current scope
|
|||
note: candidate #1 is defined in the trait `ManyImplTrait`
|
||||
--> $DIR/issue-7575.rs:57:5
|
||||
|
|
||||
57 | fn is_str() -> bool { //~ NOTE candidate
|
||||
| _____^ starting here...
|
||||
57 | / fn is_str() -> bool { //~ NOTE candidate
|
||||
58 | | false
|
||||
59 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
= help: to disambiguate the method call, write `ManyImplTrait::is_str(t)` instead
|
||||
= help: items from traits can only be used if the trait is implemented and in scope; the following trait defines an item `is_str`, perhaps you need to implement it:
|
||||
= help: candidate #1: `ManyImplTrait`
|
||||
|
|
|
|||
|
|
@ -49,68 +49,62 @@ note: because it's nested under this `unsafe` fn
|
|||
error: unnecessary `unsafe` block
|
||||
--> $DIR/lint-unused-unsafe.rs:33:9
|
||||
|
|
||||
33 | unsafe { //~ ERROR: unnecessary `unsafe` block
|
||||
| _________^ starting here...
|
||||
33 | / unsafe { //~ ERROR: unnecessary `unsafe` block
|
||||
34 | | unsf()
|
||||
35 | | }
|
||||
| |_________^ ...ending here: unnecessary `unsafe` block
|
||||
| |_________^ unnecessary `unsafe` block
|
||||
|
|
||||
note: because it's nested under this `unsafe` block
|
||||
--> $DIR/lint-unused-unsafe.rs:32:5
|
||||
|
|
||||
32 | unsafe { // don't put the warning here
|
||||
| _____^ starting here...
|
||||
32 | / unsafe { // don't put the warning here
|
||||
33 | | unsafe { //~ ERROR: unnecessary `unsafe` block
|
||||
34 | | unsf()
|
||||
35 | | }
|
||||
36 | | }
|
||||
| |_____^ ...ending here
|
||||
| |_____^
|
||||
|
||||
error: unnecessary `unsafe` block
|
||||
--> $DIR/lint-unused-unsafe.rs:39:5
|
||||
|
|
||||
39 | unsafe { //~ ERROR: unnecessary `unsafe` block
|
||||
| _____^ starting here...
|
||||
39 | / unsafe { //~ ERROR: unnecessary `unsafe` block
|
||||
40 | | unsafe { //~ ERROR: unnecessary `unsafe` block
|
||||
41 | | unsf()
|
||||
42 | | }
|
||||
43 | | }
|
||||
| |_____^ ...ending here: unnecessary `unsafe` block
|
||||
| |_____^ unnecessary `unsafe` block
|
||||
|
|
||||
note: because it's nested under this `unsafe` fn
|
||||
--> $DIR/lint-unused-unsafe.rs:38:1
|
||||
|
|
||||
38 | unsafe fn bad7() {
|
||||
| _^ starting here...
|
||||
38 | / unsafe fn bad7() {
|
||||
39 | | unsafe { //~ ERROR: unnecessary `unsafe` block
|
||||
40 | | unsafe { //~ ERROR: unnecessary `unsafe` block
|
||||
41 | | unsf()
|
||||
42 | | }
|
||||
43 | | }
|
||||
44 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
||||
error: unnecessary `unsafe` block
|
||||
--> $DIR/lint-unused-unsafe.rs:40:9
|
||||
|
|
||||
40 | unsafe { //~ ERROR: unnecessary `unsafe` block
|
||||
| _________^ starting here...
|
||||
40 | / unsafe { //~ ERROR: unnecessary `unsafe` block
|
||||
41 | | unsf()
|
||||
42 | | }
|
||||
| |_________^ ...ending here: unnecessary `unsafe` block
|
||||
| |_________^ unnecessary `unsafe` block
|
||||
|
|
||||
note: because it's nested under this `unsafe` fn
|
||||
--> $DIR/lint-unused-unsafe.rs:38:1
|
||||
|
|
||||
38 | unsafe fn bad7() {
|
||||
| _^ starting here...
|
||||
38 | / unsafe fn bad7() {
|
||||
39 | | unsafe { //~ ERROR: unnecessary `unsafe` block
|
||||
40 | | unsafe { //~ ERROR: unnecessary `unsafe` block
|
||||
41 | | unsf()
|
||||
42 | | }
|
||||
43 | | }
|
||||
44 | | }
|
||||
| |_^ ...ending here
|
||||
| |_^
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,13 @@
|
|||
error[E0072]: recursive type `ListNode` has infinite size
|
||||
--> $DIR/multiline-span-E0072.rs:12:1
|
||||
|
|
||||
12 | struct
|
||||
| _^ starting here...
|
||||
12 | / struct
|
||||
13 | | ListNode
|
||||
14 | | {
|
||||
15 | | head: u8,
|
||||
16 | | tail: Option<ListNode>,
|
||||
17 | | }
|
||||
| |_^ ...ending here: recursive type has infinite size
|
||||
| |_^ recursive type has infinite size
|
||||
|
|
||||
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `ListNode` representable
|
||||
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@ error[E0277]: the trait bound `u32: std::ops::Add<()>` is not satisfied
|
|||
--> $DIR/multiline-span-simple.rs:23:9
|
||||
|
|
||||
23 | foo(1 as u32 +
|
||||
| _________^ starting here...
|
||||
| _________^
|
||||
24 | |
|
||||
25 | | bar(x,
|
||||
26 | |
|
||||
27 | | y),
|
||||
| |______________^ ...ending here: the trait `std::ops::Add<()>` is not implemented for `u32`
|
||||
| |______________^ the trait `std::ops::Add<()>` is not implemented for `u32`
|
||||
|
|
||||
= note: no implementation for `u32 + ()`
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +1,14 @@
|
|||
error[E0282]: type annotations needed
|
||||
--> $DIR/issue-40294.rs:15:1
|
||||
|
|
||||
15 | fn foo<'a,'b,T>(x: &'a T, y: &'b T)
|
||||
| _^ starting here...
|
||||
15 | / fn foo<'a,'b,T>(x: &'a T, y: &'b T)
|
||||
16 | | where &'a T : Foo,
|
||||
17 | | &'b T : Foo
|
||||
18 | | {
|
||||
19 | | x.foo();
|
||||
20 | | y.foo();
|
||||
21 | | }
|
||||
| |_^ ...ending here: cannot infer type for `&'a T`
|
||||
| |_^ cannot infer type for `&'a T`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue