address comments
This commit is contained in:
parent
d9d69212c3
commit
7d3a6f1655
@ -659,11 +659,12 @@ fn infer_placeholder_type(
|
||||
format!("{}: {}", item_ident, ty),
|
||||
Applicability::MachineApplicable,
|
||||
)
|
||||
.emit_unless(matches!(ty.kind(), ty::Error(_)));
|
||||
.emit_unless(ty.references_error());
|
||||
}
|
||||
None => {
|
||||
let mut diag = bad_placeholder_type(tcx, vec![span]);
|
||||
if !matches!(ty.kind(), ty::Error(_)) {
|
||||
|
||||
if !ty.references_error() {
|
||||
diag.span_suggestion(
|
||||
span,
|
||||
"replace `_` with the correct type",
|
||||
@ -671,6 +672,7 @@ fn infer_placeholder_type(
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
}
|
||||
|
||||
diag.emit();
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +0,0 @@
|
||||
fn main() {
|
||||
const FOO = "hello" + 1;
|
||||
//^~ ERROR cannot add `{integer}` to `&str`
|
||||
println!("{}", FOO);
|
||||
}
|
@ -4,4 +4,3 @@ fn main() {}
|
||||
|
||||
const A: u8; //~ ERROR free constant item without body
|
||||
const B; //~ ERROR free constant item without body
|
||||
//~^ ERROR missing type for `const` item
|
||||
|
@ -4,8 +4,6 @@ fn main() {}
|
||||
|
||||
static A: u8; //~ ERROR free static item without body
|
||||
static B; //~ ERROR free static item without body
|
||||
//~^ ERROR missing type for `static` item
|
||||
|
||||
static mut C: u8; //~ ERROR free static item without body
|
||||
static mut D; //~ ERROR free static item without body
|
||||
//~^ ERROR missing type for `static mut` item
|
||||
|
@ -15,7 +15,7 @@ LL | static B;
|
||||
| help: provide a definition for the static: `= <expr>;`
|
||||
|
||||
error: free static item without body
|
||||
--> $DIR/item-free-static-no-body-semantic-fail.rs:9:1
|
||||
--> $DIR/item-free-static-no-body-semantic-fail.rs:8:1
|
||||
|
|
||||
LL | static mut C: u8;
|
||||
| ^^^^^^^^^^^^^^^^-
|
||||
@ -23,7 +23,7 @@ LL | static mut C: u8;
|
||||
| help: provide a definition for the static: `= <expr>;`
|
||||
|
||||
error: free static item without body
|
||||
--> $DIR/item-free-static-no-body-semantic-fail.rs:10:1
|
||||
--> $DIR/item-free-static-no-body-semantic-fail.rs:9:1
|
||||
|
|
||||
LL | static mut D;
|
||||
| ^^^^^^^^^^^^-
|
||||
|
5
src/test/ui/typeck/issue-79040.rs
Normal file
5
src/test/ui/typeck/issue-79040.rs
Normal file
@ -0,0 +1,5 @@
|
||||
fn main() {
|
||||
const FOO = "hello" + 1; //~ ERROR cannot add `{integer}` to `&str`
|
||||
//~^ ERROR cannot add `{integer}` to `&str`
|
||||
println!("{}", FOO);
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
error[E0369]: cannot add `{integer}` to `&str`
|
||||
--> $DIR/79040.rs:2:25
|
||||
--> $DIR/issue-79040.rs:2:25
|
||||
|
|
||||
LL | const FOO = "hello" + 1;
|
||||
| ------- ^ - {integer}
|
||||
@ -7,7 +7,7 @@ LL | const FOO = "hello" + 1;
|
||||
| &str
|
||||
|
||||
error[E0369]: cannot add `{integer}` to `&str`
|
||||
--> $DIR/79040.rs:2:25
|
||||
--> $DIR/issue-79040.rs:2:25
|
||||
|
|
||||
LL | const FOO = "hello" + 1;
|
||||
| ------- ^ - {integer}
|
Loading…
Reference in New Issue
Block a user