diff options
| author | bors <bors@rust-lang.org> | 2020-03-06 12:32:33 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-03-06 12:32:33 +0000 |
| commit | b08d07143d2b61777d341f8658281adc0f2ac809 (patch) | |
| tree | 5bb97568442703a61f57d3733bc63b947de50ee4 /src | |
| parent | 4e1c5f0e9769a588b91c977e3d81e140209ef3a2 (diff) | |
| parent | cead378b97b72e1ee8648e92ec2540da89c0cc4f (diff) | |
| download | rust-b08d07143d2b61777d341f8658281adc0f2ac809.tar.gz rust-b08d07143d2b61777d341f8658281adc0f2ac809.zip | |
Auto merge of #69748 - Mark-Simulacrum:beta-next, r=Mark-Simulacrum
[beta] another round of backports for 1.42 This backports the following pull requests: * Fix a leak in `DiagnosticBuilder::into_diagnostic`. #69628 * stash API: remove panic to fix ICE. #69623 * Do not ICE on invalid type node after parse recovery #69583 * Backport only: avoid ICE on bad placeholder type #69324 * add regression test for issue #68794 #69168 * Update compiler-builtins to 0.1.25 #69086 * Update RELEASES.md for 1.42.0 #68989
Diffstat (limited to 'src')
17 files changed, 157 insertions, 770 deletions
diff --git a/src/librustc_errors/diagnostic_builder.rs b/src/librustc_errors/diagnostic_builder.rs index 3c217c1d643..0796c46e0d5 100644 --- a/src/librustc_errors/diagnostic_builder.rs +++ b/src/librustc_errors/diagnostic_builder.rs @@ -132,12 +132,11 @@ impl<'a> DiagnosticBuilder<'a> { let handler = self.0.handler; - // We need to use `ptr::read` because `DiagnosticBuilder` implements `Drop`. - let diagnostic; - unsafe { - diagnostic = std::ptr::read(&self.0.diagnostic); - std::mem::forget(self); - }; + // We must use `Level::Cancelled` for `dummy` to avoid an ICE about an + // unused diagnostic. + let dummy = Diagnostic::new(Level::Cancelled, ""); + let diagnostic = std::mem::replace(&mut self.0.diagnostic, dummy); + // Logging here is useful to help track down where in logs an error was // actually emitted. debug!("buffer: diagnostic={:?}", diagnostic); diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs index 17b293401f8..19f72e3a3e2 100644 --- a/src/librustc_errors/lib.rs +++ b/src/librustc_errors/lib.rs @@ -446,22 +446,12 @@ impl Handler { } /// Stash a given diagnostic with the given `Span` and `StashKey` as the key for later stealing. - /// If the diagnostic with this `(span, key)` already exists, this will result in an ICE. pub fn stash_diagnostic(&self, span: Span, key: StashKey, diag: Diagnostic) { let mut inner = self.inner.borrow_mut(); - if let Some(mut old_diag) = inner.stashed_diagnostics.insert((span, key), diag) { - // We are removing a previously stashed diagnostic which should not happen. - old_diag.level = Bug; - old_diag.note(&format!( - "{}:{}: already existing stashed diagnostic with (span = {:?}, key = {:?})", - file!(), - line!(), - span, - key - )); - inner.emit_diag_at_span(old_diag, span); - panic!(ExplicitBug); - } + // FIXME(Centril, #69537): Consider reintroducing panic on overwriting a stashed diagnostic + // if/when we have a more robust macro-friendly replacement for `(span, key)` as a key. + // See the PR for a discussion. + inner.stashed_diagnostics.insert((span, key), diag); } /// Steal a previously stashed diagnostic with the given `Span` and `StashKey` as the key. diff --git a/src/librustc_typeck/check/expr.rs b/src/librustc_typeck/check/expr.rs index b4c2b85241f..2d704145e96 100644 --- a/src/librustc_typeck/check/expr.rs +++ b/src/librustc_typeck/check/expr.rs @@ -1311,6 +1311,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ty_span: Span, ) { if variant.recovered { + self.set_tainted_by_errors(); return; } let mut err = self.type_error_struct_with_diag( diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 843872d0ff9..cdf2304b839 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -316,7 +316,7 @@ impl AstConv<'tcx> for ItemCtxt<'tcx> { } fn ty_infer(&self, _: Option<&ty::GenericParamDef>, span: Span) -> Ty<'tcx> { - self.tcx().sess.delay_span_bug(span, "bad placeholder type"); + placeholder_type_error(self.tcx(), span, &[], vec![span], false); self.tcx().types.err } diff --git a/src/test/run-make-fulldeps/issue-68794-textrel-on-minimal-lib/Makefile b/src/test/run-make-fulldeps/issue-68794-textrel-on-minimal-lib/Makefile new file mode 100644 index 00000000000..2f16ad32859 --- /dev/null +++ b/src/test/run-make-fulldeps/issue-68794-textrel-on-minimal-lib/Makefile @@ -0,0 +1,17 @@ +# Regression test for issue #68794 +# +# Verify that no text relocations are accidentally introduced by linking a +# minimal rust staticlib. +# +# The test links a rust static library into a shared library, and checks that +# the linker doesn't have to flag the resulting file as containing TEXTRELs. + +-include ../tools.mk + +# only-linux + +all: + $(RUSTC) foo.rs + $(CC) bar.c $(call STATICLIB,foo) -fPIC -shared -o $(call DYLIB,bar) \ + $(EXTRACFLAGS) $(EXTRACXXFLAGS) + readelf -d $(call DYLIB,bar) | grep TEXTREL; test $$? -eq 1 diff --git a/src/test/run-make-fulldeps/issue-68794-textrel-on-minimal-lib/bar.c b/src/test/run-make-fulldeps/issue-68794-textrel-on-minimal-lib/bar.c new file mode 100644 index 00000000000..bb4036b06e1 --- /dev/null +++ b/src/test/run-make-fulldeps/issue-68794-textrel-on-minimal-lib/bar.c @@ -0,0 +1,6 @@ +void foo(); + +int main() { + foo(); + return 0; +} diff --git a/src/test/run-make-fulldeps/issue-68794-textrel-on-minimal-lib/foo.rs b/src/test/run-make-fulldeps/issue-68794-textrel-on-minimal-lib/foo.rs new file mode 100644 index 00000000000..a3e865b638e --- /dev/null +++ b/src/test/run-make-fulldeps/issue-68794-textrel-on-minimal-lib/foo.rs @@ -0,0 +1,8 @@ +#![crate_type = "staticlib"] + +#[no_mangle] +pub extern "C" fn foo(x: u32) { + // using the println! makes it so that enough code from the standard + // library is included (see issue #68794) + println!("foo: {}", x); +} diff --git a/src/test/ui/did_you_mean/bad-assoc-ty.rs b/src/test/ui/did_you_mean/bad-assoc-ty.rs index fccfb7911ce..f02931eeb6f 100644 --- a/src/test/ui/did_you_mean/bad-assoc-ty.rs +++ b/src/test/ui/did_you_mean/bad-assoc-ty.rs @@ -17,6 +17,7 @@ type D = (u8, u8)::AssocTy; type E = _::AssocTy; //~^ ERROR missing angle brackets in associated item path //~| ERROR the type placeholder `_` is not allowed within types on item signatures +//~| ERROR the type placeholder `_` is not allowed within types on item signatures type F = &'static (u8)::AssocTy; //~^ ERROR missing angle brackets in associated item path diff --git a/src/test/ui/did_you_mean/bad-assoc-ty.stderr b/src/test/ui/did_you_mean/bad-assoc-ty.stderr index 7d3c99bda6b..4fdd407bff3 100644 --- a/src/test/ui/did_you_mean/bad-assoc-ty.stderr +++ b/src/test/ui/did_you_mean/bad-assoc-ty.stderr @@ -29,25 +29,25 @@ LL | type E = _::AssocTy; | ^^^^^^^^^^ help: try: `<_>::AssocTy` error: missing angle brackets in associated item path - --> $DIR/bad-assoc-ty.rs:21:19 + --> $DIR/bad-assoc-ty.rs:22:19 | LL | type F = &'static (u8)::AssocTy; | ^^^^^^^^^^^^^ help: try: `<(u8)>::AssocTy` error: missing angle brackets in associated item path - --> $DIR/bad-assoc-ty.rs:27:10 + --> $DIR/bad-assoc-ty.rs:28:10 | LL | type G = dyn 'static + (Send)::AssocTy; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `<dyn 'static + (Send)>::AssocTy` error: missing angle brackets in associated item path - --> $DIR/bad-assoc-ty.rs:44:10 + --> $DIR/bad-assoc-ty.rs:45:10 | LL | type I = ty!()::AssocTy; | ^^^^^^^^^^^^^^ help: try: `<ty!()>::AssocTy` error: missing angle brackets in associated item path - --> $DIR/bad-assoc-ty.rs:37:19 + --> $DIR/bad-assoc-ty.rs:38:19 | LL | ($ty: ty) => ($ty::AssocTy); | ^^^^^^^^^^^^ help: try: `<$ty>::AssocTy` @@ -85,26 +85,32 @@ error[E0121]: the type placeholder `_` is not allowed within types on item signa LL | type E = _::AssocTy; | ^ not allowed in type signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/bad-assoc-ty.rs:17:10 + | +LL | type E = _::AssocTy; + | ^ not allowed in type signatures + error[E0223]: ambiguous associated type - --> $DIR/bad-assoc-ty.rs:21:19 + --> $DIR/bad-assoc-ty.rs:22:19 | LL | type F = &'static (u8)::AssocTy; | ^^^^^^^^^^^^^ help: use fully-qualified syntax: `<u8 as Trait>::AssocTy` error[E0223]: ambiguous associated type - --> $DIR/bad-assoc-ty.rs:27:10 + --> $DIR/bad-assoc-ty.rs:28:10 | LL | type G = dyn 'static + (Send)::AssocTy; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<(dyn std::marker::Send + 'static) as Trait>::AssocTy` error[E0223]: ambiguous associated type - --> $DIR/bad-assoc-ty.rs:33:10 + --> $DIR/bad-assoc-ty.rs:34:10 | LL | type H = Fn(u8) -> (u8)::Output; | ^^^^^^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<(dyn std::ops::Fn(u8) -> u8 + 'static) as Trait>::Output` error[E0223]: ambiguous associated type - --> $DIR/bad-assoc-ty.rs:37:19 + --> $DIR/bad-assoc-ty.rs:38:19 | LL | ($ty: ty) => ($ty::AssocTy); | ^^^^^^^^^^^^ help: use fully-qualified syntax: `<u8 as Trait>::AssocTy` @@ -113,12 +119,12 @@ LL | type J = ty!(u8); | ------- in this macro invocation error[E0223]: ambiguous associated type - --> $DIR/bad-assoc-ty.rs:44:10 + --> $DIR/bad-assoc-ty.rs:45:10 | LL | type I = ty!()::AssocTy; | ^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<u8 as Trait>::AssocTy` -error: aborting due to 19 previous errors +error: aborting due to 20 previous errors Some errors have detailed explanations: E0121, E0223. For more information about an error, try `rustc --explain E0121`. diff --git a/src/test/ui/issues/issue-69396-const-no-type-in-macro.rs b/src/test/ui/issues/issue-69396-const-no-type-in-macro.rs new file mode 100644 index 00000000000..69fc0c1cbb9 --- /dev/null +++ b/src/test/ui/issues/issue-69396-const-no-type-in-macro.rs @@ -0,0 +1,17 @@ +macro_rules! suite { + ( $( $fn:ident; )* ) => { + $( + const A = "A".$fn(); + //~^ ERROR the name `A` is defined multiple times + //~| ERROR missing type for `const` item + //~| ERROR the type placeholder `_` is not allowed within types + )* + } +} + +suite! { + len; + is_empty; +} + +fn main() {} diff --git a/src/test/ui/issues/issue-69396-const-no-type-in-macro.stderr b/src/test/ui/issues/issue-69396-const-no-type-in-macro.stderr new file mode 100644 index 00000000000..c12ce166efe --- /dev/null +++ b/src/test/ui/issues/issue-69396-const-no-type-in-macro.stderr @@ -0,0 +1,48 @@ +error[E0428]: the name `A` is defined multiple times + --> $DIR/issue-69396-const-no-type-in-macro.rs:4:13 + | +LL | const A = "A".$fn(); + | ^^^^^^^^^^^^^^^^^^^^ + | | + | `A` redefined here + | previous definition of the value `A` here +... +LL | / suite! { +LL | | len; +LL | | is_empty; +LL | | } + | |_- in this macro invocation + | + = note: `A` must be defined only once in the value namespace of this module + +error: missing type for `const` item + --> $DIR/issue-69396-const-no-type-in-macro.rs:4:19 + | +LL | const A = "A".$fn(); + | ^ help: provide a type for the item: `A: usize` +... +LL | / suite! { +LL | | len; +LL | | is_empty; +LL | | } + | |_- in this macro invocation + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/issue-69396-const-no-type-in-macro.rs:4:19 + | +LL | const A = "A".$fn(); + | ^ + | | + | not allowed in type signatures + | help: replace `_` with the correct type: `bool` +... +LL | / suite! { +LL | | len; +LL | | is_empty; +LL | | } + | |_- in this macro invocation + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0121, E0428. +For more information about an error, try `rustc --explain E0121`. diff --git a/src/test/ui/self/self-infer.rs b/src/test/ui/self/self-infer.rs index 0956f2a5691..77c80521236 100644 --- a/src/test/ui/self/self-infer.rs +++ b/src/test/ui/self/self-infer.rs @@ -2,7 +2,9 @@ struct S; impl S { fn f(self: _) {} //~ERROR the type placeholder `_` is not allowed within types on item sig + //~^ ERROR the type placeholder `_` is not allowed within types on item sig fn g(self: &_) {} //~ERROR the type placeholder `_` is not allowed within types on item sig + //~^ ERROR the type placeholder `_` is not allowed within types on item sig } fn main() {} diff --git a/src/test/ui/self/self-infer.stderr b/src/test/ui/self/self-infer.stderr index 1475b212b56..d6bf8b44d60 100644 --- a/src/test/ui/self/self-infer.stderr +++ b/src/test/ui/self/self-infer.stderr @@ -3,6 +3,12 @@ error[E0121]: the type placeholder `_` is not allowed within types on item signa | LL | fn f(self: _) {} | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/self-infer.rs:4:16 + | +LL | fn f(self: _) {} + | ^ not allowed in type signatures | help: use type parameters instead | @@ -10,7 +16,13 @@ LL | fn f<T>(self: T) {} | ^^^ ^ error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/self-infer.rs:5:17 + --> $DIR/self-infer.rs:6:17 + | +LL | fn g(self: &_) {} + | ^ not allowed in type signatures + +error[E0121]: the type placeholder `_` is not allowed within types on item signatures + --> $DIR/self-infer.rs:6:17 | LL | fn g(self: &_) {} | ^ not allowed in type signatures @@ -20,6 +32,6 @@ help: use type parameters instead LL | fn g<T>(self: &T) {} | ^^^ ^ -error: aborting due to 2 previous errors +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0121`. diff --git a/src/test/ui/typeck/issue-69378-ice-on-invalid-type-node-after-recovery.rs b/src/test/ui/typeck/issue-69378-ice-on-invalid-type-node-after-recovery.rs new file mode 100644 index 00000000000..571692a5374 --- /dev/null +++ b/src/test/ui/typeck/issue-69378-ice-on-invalid-type-node-after-recovery.rs @@ -0,0 +1,9 @@ +// Regression test for #69378: no type for node after struct parse recovery + +struct Foo { 0: u8 } //~ ERROR expected identifier + +fn test(f: Foo) { + Foo{foo: 4, ..f}; +} + +fn main() {} diff --git a/src/test/ui/typeck/issue-69378-ice-on-invalid-type-node-after-recovery.stderr b/src/test/ui/typeck/issue-69378-ice-on-invalid-type-node-after-recovery.stderr new file mode 100644 index 00000000000..6bc9c8498c9 --- /dev/null +++ b/src/test/ui/typeck/issue-69378-ice-on-invalid-type-node-after-recovery.stderr @@ -0,0 +1,8 @@ +error: expected identifier, found `0` + --> $DIR/issue-69378-ice-on-invalid-type-node-after-recovery.rs:3:14 + | +LL | struct Foo { 0: u8 } + | ^ expected identifier + +error: aborting due to previous error + diff --git a/src/test/ui/typeck/typeck_type_placeholder_item.rs b/src/test/ui/typeck/typeck_type_placeholder_item.rs deleted file mode 100644 index 86c7c52b271..00000000000 --- a/src/test/ui/typeck/typeck_type_placeholder_item.rs +++ /dev/null @@ -1,185 +0,0 @@ -#![feature(type_alias_impl_trait)] // Needed for single test `type Y = impl Trait<_>` -// This test checks that it is not possible to enable global type -// inference by using the `_` type placeholder. - -fn test() -> _ { 5 } -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures - -fn test2() -> (_, _) { (5, 5) } -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures - -static TEST3: _ = "test"; -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures - -static TEST4: _ = 145; -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures - -static TEST5: (_, _) = (1, 2); -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures - -fn test6(_: _) { } -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures - -fn test6_b<T>(_: _, _: T) { } -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures - -fn test6_c<T, K, L, A, B>(_: _, _: (T, K, L, A, B)) { } -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures - -fn test7(x: _) { let _x: usize = x; } -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures - -fn test8(_f: fn() -> _) { } -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures -//~| ERROR the type placeholder `_` is not allowed within types on item signatures - -struct Test9; - -impl Test9 { - fn test9(&self) -> _ { () } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - - fn test10(&self, _x : _) { } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures -} - -fn test11(x: &usize) -> &_ { -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures - &x -} - -unsafe fn test12(x: *const usize) -> *const *const _ { -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures - &x -} - -impl Clone for Test9 { - fn clone(&self) -> _ { Test9 } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - - fn clone_from(&mut self, other: _) { *self = Test9; } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures -} - -struct Test10 { - a: _, - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - b: (_, _), -} - -pub fn main() { - static A = 42; - //~^ ERROR missing type for `static` item - static B: _ = 42; - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - static C: Option<_> = Some(42); - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - - fn fn_test() -> _ { 5 } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - - fn fn_test2() -> (_, _) { (5, 5) } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - - static FN_TEST3: _ = "test"; - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - - static FN_TEST4: _ = 145; - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - - static FN_TEST5: (_, _) = (1, 2); - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - - fn fn_test6(_: _) { } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - - fn fn_test7(x: _) { let _x: usize = x; } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - - fn fn_test8(_f: fn() -> _) { } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| ERROR the type placeholder `_` is not allowed within types on item signatures - - struct FnTest9; - - impl FnTest9 { - fn fn_test9(&self) -> _ { () } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - - fn fn_test10(&self, _x : _) { } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - } - - impl Clone for FnTest9 { - fn clone(&self) -> _ { FnTest9 } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - - fn clone_from(&mut self, other: _) { *self = FnTest9; } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - } - - struct FnTest10 { - a: _, - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - b: (_, _), - } - - fn fn_test11(_: _) -> (_, _) { panic!() } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - //~| ERROR type annotations needed - - fn fn_test12(x: i32) -> (_, _) { (x, x) } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - - fn fn_test13(x: _) -> (i32, _) { (x, x) } - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures -} - -trait T { - fn method_test1(&self, x: _); - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - fn method_test2(&self, x: _) -> _; - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - fn method_test3(&self) -> _; - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - fn assoc_fn_test1(x: _); - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - fn assoc_fn_test2(x: _) -> _; - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures - fn assoc_fn_test3() -> _; - //~^ ERROR the type placeholder `_` is not allowed within types on item signatures -} - -struct BadStruct<_>(_); -//~^ ERROR expected identifier, found reserved identifier `_` -//~| ERROR the type placeholder `_` is not allowed within types on item signatures -trait BadTrait<_> {} -//~^ ERROR expected identifier, found reserved identifier `_` -impl BadTrait<_> for BadStruct<_> {} -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures - -fn impl_trait() -> impl BadTrait<_> { -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures - unimplemented!() -} - -struct BadStruct1<_, _>(_); -//~^ ERROR expected identifier, found reserved identifier `_` -//~| ERROR expected identifier, found reserved identifier `_` -//~| ERROR the name `_` is already used -//~| ERROR the type placeholder `_` is not allowed within types on item signatures -struct BadStruct2<_, T>(_, T); -//~^ ERROR expected identifier, found reserved identifier `_` -//~| ERROR the type placeholder `_` is not allowed within types on item signatures - -type X = Box<_>; -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures - -struct Struct; -trait Trait<T> {} -impl Trait<usize> for Struct {} -type Y = impl Trait<_>; -//~^ ERROR the type placeholder `_` is not allowed within types on item signatures -fn foo() -> Y { - Struct -} diff --git a/src/test/ui/typeck/typeck_type_placeholder_item.stderr b/src/test/ui/typeck/typeck_type_placeholder_item.stderr deleted file mode 100644 index f740a9f7f34..00000000000 --- a/src/test/ui/typeck/typeck_type_placeholder_item.stderr +++ /dev/null @@ -1,552 +0,0 @@ -error: expected identifier, found reserved identifier `_` - --> $DIR/typeck_type_placeholder_item.rs:153:18 - | -LL | struct BadStruct<_>(_); - | ^ expected identifier, found reserved identifier - -error: expected identifier, found reserved identifier `_` - --> $DIR/typeck_type_placeholder_item.rs:156:16 - | -LL | trait BadTrait<_> {} - | ^ expected identifier, found reserved identifier - -error: expected identifier, found reserved identifier `_` - --> $DIR/typeck_type_placeholder_item.rs:166:19 - | -LL | struct BadStruct1<_, _>(_); - | ^ expected identifier, found reserved identifier - -error: expected identifier, found reserved identifier `_` - --> $DIR/typeck_type_placeholder_item.rs:166:22 - | -LL | struct BadStruct1<_, _>(_); - | ^ expected identifier, found reserved identifier - -error: expected identifier, found reserved identifier `_` - --> $DIR/typeck_type_placeholder_item.rs:171:19 - | -LL | struct BadStruct2<_, T>(_, T); - | ^ expected identifier, found reserved identifier - -error[E0403]: the name `_` is already used for a generic parameter in this item's generic parameters - --> $DIR/typeck_type_placeholder_item.rs:166:22 - | -LL | struct BadStruct1<_, _>(_); - | - ^ already used - | | - | first use of `_` - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:5:14 - | -LL | fn test() -> _ { 5 } - | ^ - | | - | not allowed in type signatures - | help: replace with the correct return type: `i32` - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:8:16 - | -LL | fn test2() -> (_, _) { (5, 5) } - | -^--^- - | || | - | || not allowed in type signatures - | |not allowed in type signatures - | help: replace with the correct return type: `(i32, i32)` - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:11:15 - | -LL | static TEST3: _ = "test"; - | ^ - | | - | not allowed in type signatures - | help: replace `_` with the correct type: `&'static str` - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:14:15 - | -LL | static TEST4: _ = 145; - | ^ - | | - | not allowed in type signatures - | help: replace `_` with the correct type: `i32` - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:17:15 - | -LL | static TEST5: (_, _) = (1, 2); - | ^^^^^^ not allowed in type signatures - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:20:13 - | -LL | fn test6(_: _) { } - | ^ not allowed in type signatures - | -help: use type parameters instead - | -LL | fn test6<T>(_: T) { } - | ^^^ ^ - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:23:18 - | -LL | fn test6_b<T>(_: _, _: T) { } - | ^ not allowed in type signatures - | -help: use type parameters instead - | -LL | fn test6_b<T, K>(_: K, _: T) { } - | ^^^ ^ - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:26:30 - | -LL | fn test6_c<T, K, L, A, B>(_: _, _: (T, K, L, A, B)) { } - | ^ not allowed in type signatures - | -help: use type parameters instead - | -LL | fn test6_c<T, K, L, A, B, C>(_: C, _: (T, K, L, A, B)) { } - | ^^^ ^ - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:29:13 - | -LL | fn test7(x: _) { let _x: usize = x; } - | ^ not allowed in type signatures - | -help: use type parameters instead - | -LL | fn test7<T>(x: T) { let _x: usize = x; } - | ^^^ ^ - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:32:22 - | -LL | fn test8(_f: fn() -> _) { } - | ^ not allowed in type signatures - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:32:22 - | -LL | fn test8(_f: fn() -> _) { } - | ^ not allowed in type signatures - | -help: use type parameters instead - | -LL | fn test8<T>(_f: fn() -> T) { } - | ^^^ ^ - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:46:26 - | -LL | fn test11(x: &usize) -> &_ { - | -^ - | || - | |not allowed in type signatures - | help: replace with the correct return type: `&&usize` - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:51:52 - | -LL | unsafe fn test12(x: *const usize) -> *const *const _ { - | --------------^ - | | | - | | not allowed in type signatures - | help: replace with the correct return type: `*const *const usize` - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:65:8 - | -LL | a: _, - | ^ not allowed in type signatures -LL | -LL | b: (_, _), - | ^ ^ not allowed in type signatures - | | - | not allowed in type signatures - | -help: use type parameters instead - | -LL | struct Test10<T> { -LL | a: T, -LL | -LL | b: (T, T), - | - -error: missing type for `static` item - --> $DIR/typeck_type_placeholder_item.rs:71:12 - | -LL | static A = 42; - | ^ help: provide a type for the item: `A: i32` - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:73:15 - | -LL | static B: _ = 42; - | ^ - | | - | not allowed in type signatures - | help: replace `_` with the correct type: `i32` - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:75:15 - | -LL | static C: Option<_> = Some(42); - | ^^^^^^^^^ not allowed in type signatures - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:78:21 - | -LL | fn fn_test() -> _ { 5 } - | ^ - | | - | not allowed in type signatures - | help: replace with the correct return type: `i32` - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:81:23 - | -LL | fn fn_test2() -> (_, _) { (5, 5) } - | -^--^- - | || | - | || not allowed in type signatures - | |not allowed in type signatures - | help: replace with the correct return type: `(i32, i32)` - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:84:22 - | -LL | static FN_TEST3: _ = "test"; - | ^ - | | - | not allowed in type signatures - | help: replace `_` with the correct type: `&'static str` - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:87:22 - | -LL | static FN_TEST4: _ = 145; - | ^ - | | - | not allowed in type signatures - | help: replace `_` with the correct type: `i32` - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:90:22 - | -LL | static FN_TEST5: (_, _) = (1, 2); - | ^^^^^^ not allowed in type signatures - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:93:20 - | -LL | fn fn_test6(_: _) { } - | ^ not allowed in type signatures - | -help: use type parameters instead - | -LL | fn fn_test6<T>(_: T) { } - | ^^^ ^ - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:96:20 - | -LL | fn fn_test7(x: _) { let _x: usize = x; } - | ^ not allowed in type signatures - | -help: use type parameters instead - | -LL | fn fn_test7<T>(x: T) { let _x: usize = x; } - | ^^^ ^ - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:99:29 - | -LL | fn fn_test8(_f: fn() -> _) { } - | ^ not allowed in type signatures - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:99:29 - | -LL | fn fn_test8(_f: fn() -> _) { } - | ^ not allowed in type signatures - | -help: use type parameters instead - | -LL | fn fn_test8<T>(_f: fn() -> T) { } - | ^^^ ^ - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:122:12 - | -LL | a: _, - | ^ not allowed in type signatures -LL | -LL | b: (_, _), - | ^ ^ not allowed in type signatures - | | - | not allowed in type signatures - | -help: use type parameters instead - | -LL | struct FnTest10<T> { -LL | a: T, -LL | -LL | b: (T, T), - | - -error[E0282]: type annotations needed - --> $DIR/typeck_type_placeholder_item.rs:127:27 - | -LL | fn fn_test11(_: _) -> (_, _) { panic!() } - | ^^^^^^ cannot infer type - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:127:28 - | -LL | fn fn_test11(_: _) -> (_, _) { panic!() } - | ^ ^ not allowed in type signatures - | | - | not allowed in type signatures - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:131:30 - | -LL | fn fn_test12(x: i32) -> (_, _) { (x, x) } - | -^--^- - | || | - | || not allowed in type signatures - | |not allowed in type signatures - | help: replace with the correct return type: `(i32, i32)` - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:134:33 - | -LL | fn fn_test13(x: _) -> (i32, _) { (x, x) } - | ------^- - | | | - | | not allowed in type signatures - | help: replace with the correct return type: `(i32, i32)` - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:153:21 - | -LL | struct BadStruct<_>(_); - | ^ not allowed in type signatures - | -help: use type parameters instead - | -LL | struct BadStruct<T>(T); - | ^ ^ - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:158:15 - | -LL | impl BadTrait<_> for BadStruct<_> {} - | ^ ^ not allowed in type signatures - | | - | not allowed in type signatures - | -help: use type parameters instead - | -LL | impl<T> BadTrait<T> for BadStruct<T> {} - | ^^^ ^ ^ - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:161:34 - | -LL | fn impl_trait() -> impl BadTrait<_> { - | ^ not allowed in type signatures - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:166:25 - | -LL | struct BadStruct1<_, _>(_); - | ^ not allowed in type signatures - | -help: use type parameters instead - | -LL | struct BadStruct1<T, _>(T); - | ^ ^ - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:171:25 - | -LL | struct BadStruct2<_, T>(_, T); - | ^ not allowed in type signatures - | -help: use type parameters instead - | -LL | struct BadStruct2<K, T>(K, T); - | ^ ^ - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:175:14 - | -LL | type X = Box<_>; - | ^ not allowed in type signatures - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:42:27 - | -LL | fn test10(&self, _x : _) { } - | ^ not allowed in type signatures - | -help: use type parameters instead - | -LL | fn test10<T>(&self, _x : T) { } - | ^^^ ^ - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:139:31 - | -LL | fn method_test1(&self, x: _); - | ^ not allowed in type signatures - | -help: use type parameters instead - | -LL | fn method_test1<T>(&self, x: T); - | ^^^ ^ - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:141:31 - | -LL | fn method_test2(&self, x: _) -> _; - | ^ ^ not allowed in type signatures - | | - | not allowed in type signatures - | -help: use type parameters instead - | -LL | fn method_test2<T>(&self, x: T) -> T; - | ^^^ ^ ^ - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:143:31 - | -LL | fn method_test3(&self) -> _; - | ^ not allowed in type signatures - | -help: use type parameters instead - | -LL | fn method_test3<T>(&self) -> T; - | ^^^ ^ - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:145:26 - | -LL | fn assoc_fn_test1(x: _); - | ^ not allowed in type signatures - | -help: use type parameters instead - | -LL | fn assoc_fn_test1<T>(x: T); - | ^^^ ^ - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:147:26 - | -LL | fn assoc_fn_test2(x: _) -> _; - | ^ ^ not allowed in type signatures - | | - | not allowed in type signatures - | -help: use type parameters instead - | -LL | fn assoc_fn_test2<T>(x: T) -> T; - | ^^^ ^ ^ - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:149:28 - | -LL | fn assoc_fn_test3() -> _; - | ^ not allowed in type signatures - | -help: use type parameters instead - | -LL | fn assoc_fn_test3<T>() -> T; - | ^^^ ^ - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:60:37 - | -LL | fn clone_from(&mut self, other: _) { *self = Test9; } - | ^ not allowed in type signatures - | -help: use type parameters instead - | -LL | fn clone_from<T>(&mut self, other: T) { *self = Test9; } - | ^^^ ^ - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:109:34 - | -LL | fn fn_test10(&self, _x : _) { } - | ^ not allowed in type signatures - | -help: use type parameters instead - | -LL | fn fn_test10<T>(&self, _x : T) { } - | ^^^ ^ - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:117:41 - | -LL | fn clone_from(&mut self, other: _) { *self = FnTest9; } - | ^ not allowed in type signatures - | -help: use type parameters instead - | -LL | fn clone_from<T>(&mut self, other: T) { *self = FnTest9; } - | ^^^ ^ - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:181:21 - | -LL | type Y = impl Trait<_>; - | ^ not allowed in type signatures - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:39:24 - | -LL | fn test9(&self) -> _ { () } - | ^ - | | - | not allowed in type signatures - | help: replace with the correct return type: `()` - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:57:24 - | -LL | fn clone(&self) -> _ { Test9 } - | ^ - | | - | not allowed in type signatures - | help: replace with the correct return type: `Test9` - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:106:31 - | -LL | fn fn_test9(&self) -> _ { () } - | ^ - | | - | not allowed in type signatures - | help: replace with the correct return type: `()` - -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:114:28 - | -LL | fn clone(&self) -> _ { FnTest9 } - | ^ - | | - | not allowed in type signatures - | help: replace with the correct return type: `main::FnTest9` - -error: aborting due to 58 previous errors - -Some errors have detailed explanations: E0121, E0282, E0403. -For more information about an error, try `rustc --explain E0121`. |
