Skip to content

Commit

Permalink
Yeet E0744
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Nov 28, 2023
1 parent f2c500b commit dd5abb5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 15 deletions.
1 change: 1 addition & 0 deletions compiler/rustc_error_codes/src/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -653,3 +653,4 @@ E0795: include_str!("./error_codes/E0795.md"),
// E0721, // `await` keyword
// E0723, // unstable feature in `const` context
// E0738, // Removed; errored on `#[track_caller] fn`s in `extern "Rust" { ... }`.
// E0744, // merged into E0728
4 changes: 3 additions & 1 deletion compiler/rustc_error_codes/src/error_codes/E0744.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#### Note: this error code is no longer emitted by the compiler.

An unsupported expression was used inside a const context.

Erroneous code example:

```compile_fail,edition2018,E0744
```ignore (removed error code)
const _: i32 = {
async { 0 }.await
};
Expand Down
9 changes: 4 additions & 5 deletions compiler/rustc_passes/src/check_const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use rustc_middle::ty::TyCtxt;
use rustc_session::parse::feature_err;
use rustc_span::{sym, Span, Symbol};

use crate::errors::{ExprNotAllowedInContext, SkippingConstChecks};
use crate::errors::SkippingConstChecks;

/// An expression that is not *always* legal in a const context.
#[derive(Clone, Copy)]
Expand Down Expand Up @@ -138,11 +138,10 @@ impl<'tcx> CheckConstVisitor<'tcx> {

match missing_gates.as_slice() {
[] => {
tcx.sess.emit_err(ExprNotAllowedInContext {
span_bug!(
span,
expr: expr.name(),
context: const_kind.keyword_name(),
});
"we should not have reached this point, since `.await` is denied earlier"
);
}

[missing_primary, ref missing_secondary @ ..] => {
Expand Down
9 changes: 0 additions & 9 deletions compiler/rustc_passes/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1005,15 +1005,6 @@ pub struct FeaturePreviouslyDeclared<'a, 'b> {
pub prev_declared: &'b str,
}

#[derive(Diagnostic)]
#[diag(passes_expr_not_allowed_in_context, code = "E0744")]
pub struct ExprNotAllowedInContext<'a> {
#[primary_span]
pub span: Span,
pub expr: String,
pub context: &'a str,
}

pub struct BreakNonLoop<'a> {
pub span: Span,
pub head: Option<Span>,
Expand Down

0 comments on commit dd5abb5

Please sign in to comment.