diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index 40daf4eb28fc1..21d5bec65f03a 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -2073,6 +2073,19 @@ impl<'a> Parser<'a> { let value = self.mk_expr_err(start.to(expr.span)); err.emit(); return Ok(GenericArg::Const(AnonConst { id: ast::DUMMY_NODE_ID, value })); + } else if token::Colon == snapshot.token.kind + && expr.span.lo() == snapshot.token.span.hi() + && matches!(expr.kind, ExprKind::Path(..)) + { + // Find a mistake like "foo::var:A". + err.span_suggestion( + snapshot.token.span, + "write a path separator here", + "::".to_string(), + Applicability::MaybeIncorrect, + ); + err.emit(); + return Ok(GenericArg::Type(self.mk_ty(start.to(expr.span), TyKind::Err))); } else if token::Comma == self.token.kind || self.token.kind.should_end_const_arg() { // Avoid the following output by checking that we consumed a full const arg: diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile index 9b92bed1f02b3..b0f052e6cf0d9 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile @@ -72,7 +72,7 @@ ENV PATH="/node-v14.4.0-linux-x64/bin:${PATH}" # https://github.com/puppeteer/puppeteer/issues/375 # # We also specify the version in case we need to update it to go around cache limitations. -RUN npm install -g browser-ui-test@0.8.0 --unsafe-perm=true +RUN npm install -g browser-ui-test@0.8.1 --unsafe-perm=true ENV RUST_CONFIGURE_ARGS \ --build=x86_64-unknown-linux-gnu \ diff --git a/src/test/ui/generics/single-colon-path-not-const-generics.rs b/src/test/ui/generics/single-colon-path-not-const-generics.rs new file mode 100644 index 0000000000000..55a7ae0bb6d91 --- /dev/null +++ b/src/test/ui/generics/single-colon-path-not-const-generics.rs @@ -0,0 +1,13 @@ +pub mod foo { + pub mod bar { + pub struct A; + } +} + +pub struct Foo { + a: Vec, + //~^ ERROR expected + //~| HELP path separator +} + +fn main() {} diff --git a/src/test/ui/generics/single-colon-path-not-const-generics.stderr b/src/test/ui/generics/single-colon-path-not-const-generics.stderr new file mode 100644 index 0000000000000..3eafa9fa5a9dd --- /dev/null +++ b/src/test/ui/generics/single-colon-path-not-const-generics.stderr @@ -0,0 +1,11 @@ +error: expected one of `,` or `>`, found `:` + --> $DIR/single-colon-path-not-const-generics.rs:8:18 + | +LL | a: Vec, + | ^ + | | + | expected one of `,` or `>` + | help: write a path separator here: `::` + +error: aborting due to previous error + diff --git a/src/test/ui/methods/issues/issue-84495.rs b/src/test/ui/methods/issues/issue-84495.rs new file mode 100644 index 0000000000000..28c094bf2acd5 --- /dev/null +++ b/src/test/ui/methods/issues/issue-84495.rs @@ -0,0 +1,4 @@ +fn main() { + let x: i32 = 1; + println!("{:?}", x.count()); //~ ERROR is not an iterator +} diff --git a/src/test/ui/methods/issues/issue-84495.stderr b/src/test/ui/methods/issues/issue-84495.stderr new file mode 100644 index 0000000000000..b0217a7c844d7 --- /dev/null +++ b/src/test/ui/methods/issues/issue-84495.stderr @@ -0,0 +1,13 @@ +error[E0599]: `i32` is not an iterator + --> $DIR/issue-84495.rs:3:24 + | +LL | println!("{:?}", x.count()); + | ^^^^^ `i32` is not an iterator + | + = note: the following trait bounds were not satisfied: + `i32: Iterator` + which is required by `&mut i32: Iterator` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`.