No fallback in structurally_resolve_types. Further refactoring.
Put all fallback in `apply_fallback_if_possible`.
This commit is contained in:
parent
f3cd4a7f64
commit
02084f3304
7 changed files with 59 additions and 54 deletions
|
|
@ -7,6 +7,7 @@
|
|||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
// compile-flags: --error-format=human
|
||||
|
||||
extern {
|
||||
fn write(fildes: i32, buf: *const i8, nbyte: u64) -> i64;
|
||||
|
|
@ -28,12 +29,7 @@ macro_rules! write {
|
|||
}}
|
||||
}
|
||||
|
||||
macro_rules! cast {
|
||||
($x:expr) => ($x as ()) //~ ERROR non-primitive cast
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let hello = ['H', 'e', 'y'];
|
||||
write!(hello);
|
||||
cast!(2);
|
||||
}
|
||||
11
src/test/ui/mismatched_types/issue-26480-1.stderr
Normal file
11
src/test/ui/mismatched_types/issue-26480-1.stderr
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-26480-1.rs:27:19
|
||||
|
|
||||
27 | $arr.len() * size_of($arr[0])); //~ ERROR mismatched types
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u64, found usize
|
||||
...
|
||||
34 | write!(hello);
|
||||
| -------------- in this macro invocation
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
18
src/test/ui/mismatched_types/issue-26480-2.rs
Normal file
18
src/test/ui/mismatched_types/issue-26480-2.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
// 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: --error-format=human
|
||||
|
||||
macro_rules! cast {
|
||||
($x:expr) => ($x as ()) //~ ERROR non-primitive cast
|
||||
}
|
||||
|
||||
fn main() {
|
||||
cast!(2);
|
||||
}
|
||||
13
src/test/ui/mismatched_types/issue-26480-2.stderr
Normal file
13
src/test/ui/mismatched_types/issue-26480-2.stderr
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
error[E0605]: non-primitive cast: `i32` as `()`
|
||||
--> $DIR/issue-26480-2.rs:13:19
|
||||
|
|
||||
13 | ($x:expr) => ($x as ()) //~ ERROR non-primitive cast
|
||||
| ^^^^^^^^
|
||||
...
|
||||
17 | cast!(2);
|
||||
| --------- in this macro invocation
|
||||
|
|
||||
= note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
@ -7,16 +7,5 @@ error[E0308]: mismatched types
|
|||
37 | write!(hello);
|
||||
| -------------- in this macro invocation
|
||||
|
||||
error[E0605]: non-primitive cast: `i32` as `()`
|
||||
--> $DIR/issue-26480.rs:32:19
|
||||
|
|
||||
32 | ($x:expr) => ($x as ()) //~ ERROR non-primitive cast
|
||||
| ^^^^^^^^
|
||||
...
|
||||
38 | cast!(2);
|
||||
| --------- in this macro invocation
|
||||
|
|
||||
= note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue