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
5 changes: 2 additions & 3 deletions compiler/rustc_hir_typeck/src/pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -773,10 +773,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
&& self.tcx.features().deref_patterns()
&& !matches!(lt.kind, PatExprKind::Lit { .. })
{
span_bug!(
span_delayed_bug!(
lt.span,
"FIXME(deref_patterns): adjust mode unimplemented for {:?}",
lt.kind
format!("FIXME(deref_patterns): adjust mode unimplemented for {:?}", lt.kind),
);
}
// Call `resolve_vars_if_possible` here for inline const blocks.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// compile-flags: --error-format=json
// error-pattern: expected a pattern
// or
//~ ERROR expected a pattern

//~ ERROR expected a pattern, found a function call
//~ ERROR usage of qualified paths in this context is experimental
//~ WARN the feature `deref_patterns` is incomplete
//~ ERROR expected tuple struct or tuple variant, found associated function

#![feature(deref_patterns)]

fn main() {
let vec![const { vec![] }]: Vec<usize> = vec![];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
error[E0532]: expected a pattern, found a function call
--> $DIR/ice-adjust-mode-unimplemented-for-constblock.rs:14:9
|
LL | let vec![const { vec![] }]: Vec<usize> = vec![];
| ^^^^^^^^^^^^^^^^^^^^^^ not a tuple struct or tuple variant
|
= note: function calls are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html>
= note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0658]: usage of qualified paths in this context is experimental
--> $DIR/ice-adjust-mode-unimplemented-for-constblock.rs:14:9
|
LL | let vec![const { vec![] }]: Vec<usize> = vec![];
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #86935 <https://github.com/rust-lang/rust/issues/86935> for more information
= help: add `#![feature(more_qualified_paths)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
= note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: the feature `deref_patterns` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/ice-adjust-mode-unimplemented-for-constblock.rs:11:12
|
LL | #![feature(deref_patterns)]
| ^^^^^^^^^^^^^^
|
= note: see issue #87121 <https://github.com/rust-lang/rust/issues/87121> for more information
= note: `#[warn(incomplete_features)]` on by default

error[E0164]: expected tuple struct or tuple variant, found associated function `<[_]>::into_vec`
--> $DIR/ice-adjust-mode-unimplemented-for-constblock.rs:14:9
|
LL | let vec![const { vec![] }]: Vec<usize> = vec![];
| ^^^^^^^^^^^^^^^^^^^^^^ `fn` calls are not allowed in patterns
|
= help: for more information, visit https://doc.rust-lang.org/book/ch19-00-patterns.html
= note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 3 previous errors; 1 warning emitted

Some errors have detailed explanations: E0164, E0532, E0658.
For more information about an error, try `rustc --explain E0164`.
Loading