Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 7 pull requests #102632

Merged
merged 23 commits into from
Oct 3, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
5dcc418
Document the conditional existence of `alloc::sync` and `alloc::task`.
kpreid Jun 18, 2022
9cd66be
docs: be less harsh in wording for Vec::from_raw_parts
duarten Jul 13, 2022
c9ec7aa
changes to wording
duarten Jul 13, 2022
050115c
typo
duarten Jul 14, 2022
8d35ab3
rustdoc
duarten Jul 14, 2022
a85ee3e
add code examples
duarten Jul 14, 2022
551d921
docs: Improve AsRef / AsMut docs on blanket impls
JanBeh Jul 19, 2022
9f68e3e
fixup! docs: Improve AsRef / AsMut docs on blanket impls
JanBeh Jul 19, 2022
e4a259b
fixup! docs: Improve AsRef / AsMut docs on blanket impls
JanBeh Jul 19, 2022
e6b761b
fixup! docs: Improve AsRef / AsMut docs on blanket impls
JanBeh Jul 21, 2022
698a3c6
Tweak `FpCategory` example order.
reitermarkus Aug 13, 2022
cb86c38
Fix `#[derive(Default)]` on a generic `#[default]` enum adding unnece…
danielhenrymantilla Aug 26, 2022
975e72f
Add corresponding regression test
danielhenrymantilla Aug 26, 2022
3d4980b
Future-proof against loose bounds if default variant is non-exhaustive.
danielhenrymantilla Sep 15, 2022
591c1f2
introduce `{char, u8}::is_ascii_octdigit`
oppiliappan Sep 27, 2022
b9c0467
Add diagnostic struct for const eval error in `rustc_middle`
pierwill Oct 2, 2022
098e8b7
Rollup merge of #98218 - kpreid:nostdarc, r=joshtriplett
matthiaskrgr Oct 3, 2022
2110d2d
Rollup merge of #99216 - duarten:master, r=joshtriplett
matthiaskrgr Oct 3, 2022
eedb512
Rollup merge of #99460 - JanBeh:PR_asref_asmut_docs, r=joshtriplett
matthiaskrgr Oct 3, 2022
c7f1b8e
Rollup merge of #100470 - reitermarkus:patch-1, r=joshtriplett
matthiaskrgr Oct 3, 2022
df11395
Rollup merge of #101040 - danielhenrymantilla:no-bounds-for-default-a…
matthiaskrgr Oct 3, 2022
a548882
Rollup merge of #101308 - nerdypepper:feature/is-ascii-octdigit, r=jo…
matthiaskrgr Oct 3, 2022
1b9014f
Rollup merge of #102486 - pierwill:middle-const-eval-err, r=compiler-…
matthiaskrgr Oct 3, 2022
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
Prev Previous commit
Next Next commit
Add diagnostic struct for const eval error in rustc_middle
Co-authored-by: Michael Goulet <michael@errs.io>
  • Loading branch information
pierwill and compiler-errors committed Oct 3, 2022
commit b9c0467e0c87c38009087eea65a79994d6bf1f26
3 changes: 3 additions & 0 deletions compiler/rustc_error_messages/locales/en-US/middle.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ middle_previous_use_here =
middle_limit_invalid =
`limit` must be a non-negative integer
.label = {$error_str}

middle_const_eval_non_int =
constant evaluation of enum discriminant resulted in non-integer
7 changes: 7 additions & 0 deletions compiler/rustc_middle/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,10 @@ pub struct LimitInvalid<'a> {
pub value_span: Span,
pub error_str: &'a str,
}

#[derive(Diagnostic)]
#[diag(middle::const_eval_non_int)]
pub struct ConstEvalNonIntError {
#[primary_span]
pub span: Span,
}
8 changes: 3 additions & 5 deletions compiler/rustc_middle/src/ty/adt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,11 +458,9 @@ impl<'tcx> AdtDef<'tcx> {
Some(Discr { val: b, ty })
} else {
info!("invalid enum discriminant: {:#?}", val);
crate::mir::interpret::struct_error(
tcx.at(tcx.def_span(expr_did)),
"constant evaluation of enum discriminant resulted in non-integer",
)
.emit();
tcx.sess.emit_err(crate::error::ConstEvalNonIntError {
span: tcx.def_span(expr_did),
});
None
}
}
Expand Down