Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions compiler/rustc_parse/src/parser/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 [email protected].0 --unsafe-perm=true
RUN npm install -g [email protected].1 --unsafe-perm=true

ENV RUST_CONFIGURE_ARGS \
--build=x86_64-unknown-linux-gnu \
Expand Down
13 changes: 13 additions & 0 deletions src/test/ui/generics/single-colon-path-not-const-generics.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
pub mod foo {
pub mod bar {
pub struct A;
}
}

pub struct Foo {
a: Vec<foo::bar:A>,
//~^ ERROR expected
//~| HELP path separator
}

fn main() {}
11 changes: 11 additions & 0 deletions src/test/ui/generics/single-colon-path-not-const-generics.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
error: expected one of `,` or `>`, found `:`
--> $DIR/single-colon-path-not-const-generics.rs:8:18
|
LL | a: Vec<foo::bar:A>,
| ^
| |
| expected one of `,` or `>`
| help: write a path separator here: `::`

error: aborting due to previous error

4 changes: 4 additions & 0 deletions src/test/ui/methods/issues/issue-84495.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fn main() {
let x: i32 = 1;
println!("{:?}", x.count()); //~ ERROR is not an iterator
}
13 changes: 13 additions & 0 deletions src/test/ui/methods/issues/issue-84495.stderr
Original file line number Diff line number Diff line change
@@ -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`.