diff options
| author | bors <bors@rust-lang.org> | 2021-11-09 08:21:10 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-11-09 08:21:10 +0000 |
| commit | 214cd1f228a463b59f73ee46c8ae3b30f85de253 (patch) | |
| tree | 14e0374a49bca45bd553d17d94ec6fb0c530e94d /src/test/ui/impl-trait | |
| parent | 60952bc3da442cf2ea11dcc9c80a461a659bbcd7 (diff) | |
| parent | ebf8966156ab5d2831dd4cd1b34bc5a906d0f895 (diff) | |
| download | rust-214cd1f228a463b59f73ee46c8ae3b30f85de253.tar.gz rust-214cd1f228a463b59f73ee46c8ae3b30f85de253.zip | |
Auto merge of #87337 - jyn514:lint-error, r=oli-obk,flip1995
Don't abort compilation after giving a lint error The only reason to use `abort_if_errors` is when the program is so broken that either: 1. later passes get confused and ICE 2. any diagnostics from later passes would be noise This is never the case for lints, because the compiler has to be able to deal with `allow`-ed lints. So it can continue to lint and compile even if there are lint errors. Closes https://github.com/rust-lang/rust/issues/82761. This is a WIP because I have a feeling it will exit with 0 even if there were lint errors; I don't have a computer that can build rustc locally at the moment.
Diffstat (limited to 'src/test/ui/impl-trait')
| -rw-r--r-- | src/test/ui/impl-trait/where-allowed.rs | 1 | ||||
| -rw-r--r-- | src/test/ui/impl-trait/where-allowed.stderr | 22 |
2 files changed, 16 insertions, 7 deletions
diff --git a/src/test/ui/impl-trait/where-allowed.rs b/src/test/ui/impl-trait/where-allowed.rs index 4605e76ac96..35fb42d6213 100644 --- a/src/test/ui/impl-trait/where-allowed.rs +++ b/src/test/ui/impl-trait/where-allowed.rs @@ -235,6 +235,7 @@ impl <T = impl Debug> T {} //~^ ERROR defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions //~| WARNING this was previously accepted by the compiler but is being phased out //~| ERROR `impl Trait` not allowed outside of function and method return types +//~| ERROR no nominal type found // Disallowed fn in_method_generic_param_default<T = impl Debug>(_: T) {} diff --git a/src/test/ui/impl-trait/where-allowed.stderr b/src/test/ui/impl-trait/where-allowed.stderr index 7f11d30dbaa..236cf449e85 100644 --- a/src/test/ui/impl-trait/where-allowed.stderr +++ b/src/test/ui/impl-trait/where-allowed.stderr @@ -272,19 +272,19 @@ LL | impl <T = impl Debug> T {} | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and method return types - --> $DIR/where-allowed.rs:240:40 + --> $DIR/where-allowed.rs:241:40 | LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {} | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and method return types - --> $DIR/where-allowed.rs:246:29 + --> $DIR/where-allowed.rs:247:29 | LL | let _in_local_variable: impl Fn() = || {}; | ^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and method return types - --> $DIR/where-allowed.rs:248:46 + --> $DIR/where-allowed.rs:249:46 | LL | let _in_return_in_local_variable = || -> impl Fn() { || {} }; | ^^^^^^^^^ @@ -300,7 +300,7 @@ LL | impl <T = impl Debug> T {} = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887> error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions - --> $DIR/where-allowed.rs:240:36 + --> $DIR/where-allowed.rs:241:36 | LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {} | ^ @@ -308,7 +308,15 @@ LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {} = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887> -error: aborting due to 48 previous errors +error[E0118]: no nominal type found for inherent implementation + --> $DIR/where-allowed.rs:234:23 + | +LL | impl <T = impl Debug> T {} + | ^ impl requires a nominal type + | + = note: either implement a trait on it or create a newtype to wrap it instead + +error: aborting due to 49 previous errors -Some errors have detailed explanations: E0562, E0658, E0666. -For more information about an error, try `rustc --explain E0562`. +Some errors have detailed explanations: E0118, E0562, E0658, E0666. +For more information about an error, try `rustc --explain E0118`. |
