Only check locally for reported errors

This commit is contained in:
Oli Scherer 2024-06-17 08:15:43 +00:00
parent af3d1004c7
commit a183989e88
5 changed files with 41 additions and 6 deletions

View File

@ -793,7 +793,7 @@ impl<'cx, 'tcx> Resolver<'cx, 'tcx> {
}
fn report_error(&self, p: impl Into<ty::GenericArg<'tcx>>) -> ErrorGuaranteed {
if let Some(guar) = self.fcx.dcx().has_errors() {
if let Some(guar) = self.fcx.tainted_by_errors() {
guar
} else {
self.fcx

View File

@ -4,4 +4,5 @@ fn main() {
//~| ERROR cannot find type `T` in this scope
//~| ERROR const and type arguments are not allowed on builtin type `str`
//~| ERROR expected unit struct, unit variant or constant, found associated function `str<
//~| ERROR type annotations needed
}

View File

@ -32,7 +32,18 @@ error[E0533]: expected unit struct, unit variant or constant, found associated f
LL | let str::<{fn str() { let str::T>>::as_bytes; }}, T>::as_bytes;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a unit struct, unit variant or constant
error: aborting due to 4 previous errors
error[E0282]: type annotations needed
--> $DIR/ensure-overriding-bindings-in-pattern-with-ty-err-doesnt-ice.rs:2:31
|
LL | let str::<{fn str() { let str::T>>::as_bytes; }}, T>::as_bytes;
| ^^^^^^^^^^^^^^^^^^
|
help: consider giving this pattern a type
|
LL | let str::<{fn str() { let str::T>>::as_bytes: /* Type */; }}, T>::as_bytes;
| ++++++++++++
Some errors have detailed explanations: E0109, E0412, E0533.
error: aborting due to 5 previous errors
Some errors have detailed explanations: E0109, E0282, E0412, E0533.
For more information about an error, try `rustc --explain E0109`.

View File

@ -5,6 +5,7 @@ struct Ty;
impl TryFrom<Ty> for u8 {
type Error = Ty;
fn try_from(_: Ty) -> Result<Self, Self::Error> {
//~^ ERROR type annotations needed
loop {}
}
}
@ -13,6 +14,7 @@ impl TryFrom<Ty> for u8 {
//~^ ERROR conflicting implementations of trait
type Error = Ty;
fn try_from(_: Ty) -> Result<Self, Self::Error> {
//~^ ERROR type annotations needed
loop {}
}
}

View File

@ -1,5 +1,5 @@
error[E0119]: conflicting implementations of trait `TryFrom<Ty>` for type `u8`
--> $DIR/conflicting-impls.rs:12:1
--> $DIR/conflicting-impls.rs:13:1
|
LL | impl TryFrom<Ty> for u8 {
| ----------------------- first implementation here
@ -7,6 +7,27 @@ LL | impl TryFrom<Ty> for u8 {
LL | impl TryFrom<Ty> for u8 {
| ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `u8`
error: aborting due to 1 previous error
error[E0282]: type annotations needed
--> $DIR/conflicting-impls.rs:7:53
|
LL | fn try_from(_: Ty) -> Result<Self, Self::Error> {
| _____________________________________________________^
LL | |
LL | | loop {}
LL | | }
| |_____^ cannot infer type for enum `Result<u8, _>`
For more information about this error, try `rustc --explain E0119`.
error[E0282]: type annotations needed
--> $DIR/conflicting-impls.rs:16:53
|
LL | fn try_from(_: Ty) -> Result<Self, Self::Error> {
| _____________________________________________________^
LL | |
LL | | loop {}
LL | | }
| |_____^ cannot infer type for enum `Result<u8, _>`
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0119, E0282.
For more information about an error, try `rustc --explain E0119`.