Auto merge of #82816 - GuillaumeGomez:rollup-hxohu2e, r=GuillaumeGomez
Rollup of 7 pull requests Successful merges: - #80845 (Make ItemKind::ExternCrate looks like hir::ItemKind::ExternCrate to make transition over hir::ItemKind simpler) - #82708 (Warn on `#![doc(test(...))]` on items other than the crate root and use future incompatible lint) - #82714 (Detect match arm body without braces) - #82736 (Bump optimization from mir_opt_level 2 to 3 and 3 to 4 and make "release" be level 2 by default) - #82782 (Make rustc shim's verbose output include crate_name being compiled.) - #82797 (Update tests names to start with `issue-`) - #82809 (rustdoc: Use substrings instead of split to grab enum variant paths) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
51748a8fc7
113 changed files with 665 additions and 188 deletions
|
@ -566,7 +566,7 @@ fn test_debugging_options_tracking_hash() {
|
||||||
tracked!(link_only, true);
|
tracked!(link_only, true);
|
||||||
tracked!(merge_functions, Some(MergeFunctions::Disabled));
|
tracked!(merge_functions, Some(MergeFunctions::Disabled));
|
||||||
tracked!(mir_emit_retag, true);
|
tracked!(mir_emit_retag, true);
|
||||||
tracked!(mir_opt_level, 3);
|
tracked!(mir_opt_level, Some(4));
|
||||||
tracked!(mutable_noalias, true);
|
tracked!(mutable_noalias, true);
|
||||||
tracked!(new_llvm_pass_manager, true);
|
tracked!(new_llvm_pass_manager, true);
|
||||||
tracked!(no_codegen, true);
|
tracked!(no_codegen, true);
|
||||||
|
|
|
@ -3059,3 +3059,33 @@ declare_lint! {
|
||||||
Allow,
|
Allow,
|
||||||
"No declared ABI for extern declaration"
|
"No declared ABI for extern declaration"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
declare_lint! {
|
||||||
|
/// The `invalid_doc_attributes` lint detects when the `#[doc(...)]` is
|
||||||
|
/// misused.
|
||||||
|
///
|
||||||
|
/// ### Example
|
||||||
|
///
|
||||||
|
/// ```rust,compile_fail
|
||||||
|
/// #![deny(warnings)]
|
||||||
|
///
|
||||||
|
/// pub mod submodule {
|
||||||
|
/// #![doc(test(no_crate_inject))]
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// {{produces}}
|
||||||
|
///
|
||||||
|
/// ### Explanation
|
||||||
|
///
|
||||||
|
/// Previously, there were very like checks being performed on `#[doc(..)]`
|
||||||
|
/// unlike the other attributes. It'll now catch all the issues that it
|
||||||
|
/// silently ignored previously.
|
||||||
|
pub INVALID_DOC_ATTRIBUTES,
|
||||||
|
Warn,
|
||||||
|
"detects invalid `#[doc(...)]` attributes",
|
||||||
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
|
reference: "issue #82730 <https://github.com/rust-lang/rust/issues/82730>",
|
||||||
|
edition: None,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ pub struct ConstGoto;
|
||||||
|
|
||||||
impl<'tcx> MirPass<'tcx> for ConstGoto {
|
impl<'tcx> MirPass<'tcx> for ConstGoto {
|
||||||
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
||||||
if tcx.sess.opts.debugging_opts.mir_opt_level < 3 {
|
if tcx.sess.mir_opt_level() < 4 {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
trace!("Running ConstGoto on {:?}", body.source);
|
trace!("Running ConstGoto on {:?}", body.source);
|
||||||
|
|
|
@ -725,7 +725,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.tcx.sess.opts.debugging_opts.mir_opt_level >= 3 {
|
if self.tcx.sess.mir_opt_level() >= 4 {
|
||||||
self.eval_rvalue_with_identities(rvalue, place)
|
self.eval_rvalue_with_identities(rvalue, place)
|
||||||
} else {
|
} else {
|
||||||
self.use_ecx(|this| this.ecx.eval_rvalue_into_place(rvalue, place))
|
self.use_ecx(|this| this.ecx.eval_rvalue_into_place(rvalue, place))
|
||||||
|
@ -903,7 +903,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
|
||||||
|
|
||||||
/// Returns `true` if and only if this `op` should be const-propagated into.
|
/// Returns `true` if and only if this `op` should be const-propagated into.
|
||||||
fn should_const_prop(&mut self, op: &OpTy<'tcx>) -> bool {
|
fn should_const_prop(&mut self, op: &OpTy<'tcx>) -> bool {
|
||||||
let mir_opt_level = self.tcx.sess.opts.debugging_opts.mir_opt_level;
|
let mir_opt_level = self.tcx.sess.mir_opt_level();
|
||||||
|
|
||||||
if mir_opt_level == 0 {
|
if mir_opt_level == 0 {
|
||||||
return false;
|
return false;
|
||||||
|
@ -1071,9 +1071,9 @@ impl<'mir, 'tcx> MutVisitor<'tcx> for ConstPropagator<'mir, 'tcx> {
|
||||||
fn visit_operand(&mut self, operand: &mut Operand<'tcx>, location: Location) {
|
fn visit_operand(&mut self, operand: &mut Operand<'tcx>, location: Location) {
|
||||||
self.super_operand(operand, location);
|
self.super_operand(operand, location);
|
||||||
|
|
||||||
// Only const prop copies and moves on `mir_opt_level=2` as doing so
|
// Only const prop copies and moves on `mir_opt_level=3` as doing so
|
||||||
// currently slightly increases compile time in some cases.
|
// currently slightly increases compile time in some cases.
|
||||||
if self.tcx.sess.opts.debugging_opts.mir_opt_level >= 2 {
|
if self.tcx.sess.mir_opt_level() >= 3 {
|
||||||
self.propagate_operand(operand)
|
self.propagate_operand(operand)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1253,7 +1253,7 @@ impl<'mir, 'tcx> MutVisitor<'tcx> for ConstPropagator<'mir, 'tcx> {
|
||||||
TerminatorKind::SwitchInt { ref mut discr, .. } => {
|
TerminatorKind::SwitchInt { ref mut discr, .. } => {
|
||||||
// FIXME: This is currently redundant with `visit_operand`, but sadly
|
// FIXME: This is currently redundant with `visit_operand`, but sadly
|
||||||
// always visiting operands currently causes a perf regression in LLVM codegen, so
|
// always visiting operands currently causes a perf regression in LLVM codegen, so
|
||||||
// `visit_operand` currently only runs for propagates places for `mir_opt_level=3`.
|
// `visit_operand` currently only runs for propagates places for `mir_opt_level=4`.
|
||||||
self.propagate_operand(discr)
|
self.propagate_operand(discr)
|
||||||
}
|
}
|
||||||
// None of these have Operands to const-propagate.
|
// None of these have Operands to const-propagate.
|
||||||
|
@ -1272,7 +1272,7 @@ impl<'mir, 'tcx> MutVisitor<'tcx> for ConstPropagator<'mir, 'tcx> {
|
||||||
// Every argument in our function calls have already been propagated in `visit_operand`.
|
// Every argument in our function calls have already been propagated in `visit_operand`.
|
||||||
//
|
//
|
||||||
// NOTE: because LLVM codegen gives slight performance regressions with it, so this is
|
// NOTE: because LLVM codegen gives slight performance regressions with it, so this is
|
||||||
// gated on `mir_opt_level=2`.
|
// gated on `mir_opt_level=3`.
|
||||||
TerminatorKind::Call { .. } => {}
|
TerminatorKind::Call { .. } => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ pub struct DeduplicateBlocks;
|
||||||
|
|
||||||
impl<'tcx> MirPass<'tcx> for DeduplicateBlocks {
|
impl<'tcx> MirPass<'tcx> for DeduplicateBlocks {
|
||||||
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
||||||
if tcx.sess.opts.debugging_opts.mir_opt_level < 3 {
|
if tcx.sess.mir_opt_level() < 4 {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
debug!("Running DeduplicateBlocks on `{:?}`", body.source);
|
debug!("Running DeduplicateBlocks on `{:?}`", body.source);
|
||||||
|
|
|
@ -127,9 +127,9 @@ pub struct DestinationPropagation;
|
||||||
|
|
||||||
impl<'tcx> MirPass<'tcx> for DestinationPropagation {
|
impl<'tcx> MirPass<'tcx> for DestinationPropagation {
|
||||||
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
||||||
// Only run at mir-opt-level=2 or higher for now (we don't fix up debuginfo and remove
|
// Only run at mir-opt-level=3 or higher for now (we don't fix up debuginfo and remove
|
||||||
// storage statements at the moment).
|
// storage statements at the moment).
|
||||||
if tcx.sess.opts.debugging_opts.mir_opt_level <= 1 {
|
if tcx.sess.mir_opt_level() < 3 {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ pub struct EarlyOtherwiseBranch;
|
||||||
|
|
||||||
impl<'tcx> MirPass<'tcx> for EarlyOtherwiseBranch {
|
impl<'tcx> MirPass<'tcx> for EarlyOtherwiseBranch {
|
||||||
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
||||||
if tcx.sess.opts.debugging_opts.mir_opt_level < 2 {
|
if tcx.sess.mir_opt_level() < 3 {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
trace!("running EarlyOtherwiseBranch on {:?}", body.source);
|
trace!("running EarlyOtherwiseBranch on {:?}", body.source);
|
||||||
|
|
|
@ -52,7 +52,7 @@ crate fn is_enabled(tcx: TyCtxt<'_>) -> bool {
|
||||||
return enabled;
|
return enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
tcx.sess.opts.debugging_opts.mir_opt_level >= 2
|
tcx.sess.mir_opt_level() >= 3
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> MirPass<'tcx> for Inline {
|
impl<'tcx> MirPass<'tcx> for Inline {
|
||||||
|
|
|
@ -40,7 +40,7 @@ pub struct MatchBranchSimplification;
|
||||||
|
|
||||||
impl<'tcx> MirPass<'tcx> for MatchBranchSimplification {
|
impl<'tcx> MirPass<'tcx> for MatchBranchSimplification {
|
||||||
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
||||||
if tcx.sess.opts.debugging_opts.mir_opt_level <= 1 {
|
if tcx.sess.mir_opt_level() < 3 {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -475,7 +475,7 @@ fn run_post_borrowck_cleanup_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tc
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
||||||
let mir_opt_level = tcx.sess.opts.debugging_opts.mir_opt_level;
|
let mir_opt_level = tcx.sess.mir_opt_level();
|
||||||
|
|
||||||
// Lowering generator control-flow and variables has to happen before we do anything else
|
// Lowering generator control-flow and variables has to happen before we do anything else
|
||||||
// to them. We run some optimizations before that, because they may be harder to do on the state
|
// to them. We run some optimizations before that, because they may be harder to do on the state
|
||||||
|
|
|
@ -10,7 +10,7 @@ pub struct MultipleReturnTerminators;
|
||||||
|
|
||||||
impl<'tcx> MirPass<'tcx> for MultipleReturnTerminators {
|
impl<'tcx> MirPass<'tcx> for MultipleReturnTerminators {
|
||||||
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
||||||
if tcx.sess.opts.debugging_opts.mir_opt_level < 3 {
|
if tcx.sess.mir_opt_level() < 4 {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ pub struct RenameReturnPlace;
|
||||||
|
|
||||||
impl<'tcx> MirPass<'tcx> for RenameReturnPlace {
|
impl<'tcx> MirPass<'tcx> for RenameReturnPlace {
|
||||||
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut mir::Body<'tcx>) {
|
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut mir::Body<'tcx>) {
|
||||||
if tcx.sess.opts.debugging_opts.mir_opt_level == 0 {
|
if tcx.sess.mir_opt_level() == 0 {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,8 @@ pub struct UnreachablePropagation;
|
||||||
|
|
||||||
impl MirPass<'_> for UnreachablePropagation {
|
impl MirPass<'_> for UnreachablePropagation {
|
||||||
fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
||||||
if tcx.sess.opts.debugging_opts.mir_opt_level < 3 {
|
if tcx.sess.mir_opt_level() < 4 {
|
||||||
// Enable only under -Zmir-opt-level=3 as in some cases (check the deeply-nested-opt
|
// Enable only under -Zmir-opt-level=4 as in some cases (check the deeply-nested-opt
|
||||||
// perf benchmark) LLVM may spend quite a lot of time optimizing the generated code.
|
// perf benchmark) LLVM may spend quite a lot of time optimizing the generated code.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1973,6 +1973,102 @@ impl<'a> Parser<'a> {
|
||||||
Ok(self.mk_expr(lo.to(hi), ExprKind::Match(scrutinee, arms), attrs))
|
Ok(self.mk_expr(lo.to(hi), ExprKind::Match(scrutinee, arms), attrs))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Attempt to recover from match arm body with statements and no surrounding braces.
|
||||||
|
fn parse_arm_body_missing_braces(
|
||||||
|
&mut self,
|
||||||
|
first_expr: &P<Expr>,
|
||||||
|
arrow_span: Span,
|
||||||
|
) -> Option<P<Expr>> {
|
||||||
|
if self.token.kind != token::Semi {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
let start_snapshot = self.clone();
|
||||||
|
let semi_sp = self.token.span;
|
||||||
|
self.bump(); // `;`
|
||||||
|
let mut stmts =
|
||||||
|
vec![self.mk_stmt(first_expr.span, ast::StmtKind::Expr(first_expr.clone()))];
|
||||||
|
let err = |this: &mut Parser<'_>, stmts: Vec<ast::Stmt>| {
|
||||||
|
let span = stmts[0].span.to(stmts[stmts.len() - 1].span);
|
||||||
|
let mut err = this.struct_span_err(span, "`match` arm body without braces");
|
||||||
|
let (these, s, are) =
|
||||||
|
if stmts.len() > 1 { ("these", "s", "are") } else { ("this", "", "is") };
|
||||||
|
err.span_label(
|
||||||
|
span,
|
||||||
|
&format!(
|
||||||
|
"{these} statement{s} {are} not surrounded by a body",
|
||||||
|
these = these,
|
||||||
|
s = s,
|
||||||
|
are = are
|
||||||
|
),
|
||||||
|
);
|
||||||
|
err.span_label(arrow_span, "while parsing the `match` arm starting here");
|
||||||
|
if stmts.len() > 1 {
|
||||||
|
err.multipart_suggestion(
|
||||||
|
&format!("surround the statement{} with a body", s),
|
||||||
|
vec![
|
||||||
|
(span.shrink_to_lo(), "{ ".to_string()),
|
||||||
|
(span.shrink_to_hi(), " }".to_string()),
|
||||||
|
],
|
||||||
|
Applicability::MachineApplicable,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
err.span_suggestion(
|
||||||
|
semi_sp,
|
||||||
|
"use a comma to end a `match` arm expression",
|
||||||
|
",".to_string(),
|
||||||
|
Applicability::MachineApplicable,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
err.emit();
|
||||||
|
this.mk_expr_err(span)
|
||||||
|
};
|
||||||
|
// We might have either a `,` -> `;` typo, or a block without braces. We need
|
||||||
|
// a more subtle parsing strategy.
|
||||||
|
loop {
|
||||||
|
if self.token.kind == token::CloseDelim(token::Brace) {
|
||||||
|
// We have reached the closing brace of the `match` expression.
|
||||||
|
return Some(err(self, stmts));
|
||||||
|
}
|
||||||
|
if self.token.kind == token::Comma {
|
||||||
|
*self = start_snapshot;
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
let pre_pat_snapshot = self.clone();
|
||||||
|
match self.parse_pat_no_top_alt(None) {
|
||||||
|
Ok(_pat) => {
|
||||||
|
if self.token.kind == token::FatArrow {
|
||||||
|
// Reached arm end.
|
||||||
|
*self = pre_pat_snapshot;
|
||||||
|
return Some(err(self, stmts));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(mut err) => {
|
||||||
|
err.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*self = pre_pat_snapshot;
|
||||||
|
match self.parse_stmt_without_recovery(true, ForceCollect::No) {
|
||||||
|
// Consume statements for as long as possible.
|
||||||
|
Ok(Some(stmt)) => {
|
||||||
|
stmts.push(stmt);
|
||||||
|
}
|
||||||
|
Ok(None) => {
|
||||||
|
*self = start_snapshot;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// We couldn't parse either yet another statement missing it's
|
||||||
|
// enclosing block nor the next arm's pattern or closing brace.
|
||||||
|
Err(mut stmt_err) => {
|
||||||
|
stmt_err.cancel();
|
||||||
|
*self = start_snapshot;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
pub(super) fn parse_arm(&mut self) -> PResult<'a, Arm> {
|
pub(super) fn parse_arm(&mut self) -> PResult<'a, Arm> {
|
||||||
let attrs = self.parse_outer_attributes()?;
|
let attrs = self.parse_outer_attributes()?;
|
||||||
self.collect_tokens_trailing_token(attrs, ForceCollect::No, |this, attrs| {
|
self.collect_tokens_trailing_token(attrs, ForceCollect::No, |this, attrs| {
|
||||||
|
@ -2007,6 +2103,21 @@ impl<'a> Parser<'a> {
|
||||||
|
|
||||||
if require_comma {
|
if require_comma {
|
||||||
let sm = this.sess.source_map();
|
let sm = this.sess.source_map();
|
||||||
|
if let Some(body) = this.parse_arm_body_missing_braces(&expr, arrow_span) {
|
||||||
|
let span = body.span;
|
||||||
|
return Ok((
|
||||||
|
ast::Arm {
|
||||||
|
attrs,
|
||||||
|
pat,
|
||||||
|
guard,
|
||||||
|
body,
|
||||||
|
span,
|
||||||
|
id: DUMMY_NODE_ID,
|
||||||
|
is_placeholder: false,
|
||||||
|
},
|
||||||
|
TrailingToken::None,
|
||||||
|
));
|
||||||
|
}
|
||||||
this.expect_one_of(&[token::Comma], &[token::CloseDelim(token::Brace)]).map_err(
|
this.expect_one_of(&[token::Comma], &[token::CloseDelim(token::Brace)]).map_err(
|
||||||
|mut err| {
|
|mut err| {
|
||||||
match (sm.span_to_lines(expr.span), sm.span_to_lines(arm_start_span)) {
|
match (sm.span_to_lines(expr.span), sm.span_to_lines(arm_start_span)) {
|
||||||
|
|
|
@ -34,7 +34,7 @@ impl<'a> Parser<'a> {
|
||||||
|
|
||||||
/// If `force_capture` is true, forces collection of tokens regardless of whether
|
/// If `force_capture` is true, forces collection of tokens regardless of whether
|
||||||
/// or not we have attributes
|
/// or not we have attributes
|
||||||
fn parse_stmt_without_recovery(
|
crate fn parse_stmt_without_recovery(
|
||||||
&mut self,
|
&mut self,
|
||||||
capture_semi: bool,
|
capture_semi: bool,
|
||||||
force_collect: ForceCollect,
|
force_collect: ForceCollect,
|
||||||
|
|
|
@ -17,7 +17,9 @@ use rustc_hir::{
|
||||||
self, FnSig, ForeignItem, ForeignItemKind, HirId, Item, ItemKind, TraitItem, CRATE_HIR_ID,
|
self, FnSig, ForeignItem, ForeignItemKind, HirId, Item, ItemKind, TraitItem, CRATE_HIR_ID,
|
||||||
};
|
};
|
||||||
use rustc_hir::{MethodKind, Target};
|
use rustc_hir::{MethodKind, Target};
|
||||||
use rustc_session::lint::builtin::{CONFLICTING_REPR_HINTS, UNUSED_ATTRIBUTES};
|
use rustc_session::lint::builtin::{
|
||||||
|
CONFLICTING_REPR_HINTS, INVALID_DOC_ATTRIBUTES, UNUSED_ATTRIBUTES,
|
||||||
|
};
|
||||||
use rustc_session::parse::feature_err;
|
use rustc_session::parse::feature_err;
|
||||||
use rustc_span::symbol::{sym, Symbol};
|
use rustc_span::symbol::{sym, Symbol};
|
||||||
use rustc_span::{Span, DUMMY_SP};
|
use rustc_span::{Span, DUMMY_SP};
|
||||||
|
@ -544,6 +546,21 @@ impl CheckAttrVisitor<'tcx> {
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
} else if meta.has_name(sym::test) {
|
||||||
|
if CRATE_HIR_ID != hir_id {
|
||||||
|
self.tcx.struct_span_lint_hir(
|
||||||
|
INVALID_DOC_ATTRIBUTES,
|
||||||
|
hir_id,
|
||||||
|
meta.span(),
|
||||||
|
|lint| {
|
||||||
|
lint.build(
|
||||||
|
"`#![doc(test(...)]` is only allowed as a crate level attribute"
|
||||||
|
)
|
||||||
|
.emit();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
} else if let Some(i_meta) = meta.meta_item() {
|
} else if let Some(i_meta) = meta.meta_item() {
|
||||||
if ![
|
if ![
|
||||||
sym::cfg,
|
sym::cfg,
|
||||||
|
@ -568,7 +585,7 @@ impl CheckAttrVisitor<'tcx> {
|
||||||
.any(|m| i_meta.has_name(*m))
|
.any(|m| i_meta.has_name(*m))
|
||||||
{
|
{
|
||||||
self.tcx.struct_span_lint_hir(
|
self.tcx.struct_span_lint_hir(
|
||||||
UNUSED_ATTRIBUTES,
|
INVALID_DOC_ATTRIBUTES,
|
||||||
hir_id,
|
hir_id,
|
||||||
i_meta.span,
|
i_meta.span,
|
||||||
|lint| {
|
|lint| {
|
||||||
|
@ -576,11 +593,6 @@ impl CheckAttrVisitor<'tcx> {
|
||||||
"unknown `doc` attribute `{}`",
|
"unknown `doc` attribute `{}`",
|
||||||
i_meta.name_or_empty()
|
i_meta.name_or_empty()
|
||||||
))
|
))
|
||||||
.warn(
|
|
||||||
"this was previously accepted by the compiler but is \
|
|
||||||
being phased out; it will become a hard error in \
|
|
||||||
a future release!",
|
|
||||||
)
|
|
||||||
.emit();
|
.emit();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
|
@ -1938,21 +1938,23 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
|
||||||
Some(SymbolManglingVersion::V0) => {}
|
Some(SymbolManglingVersion::V0) => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
if debugging_opts.mir_opt_level > 1 {
|
if let Some(mir_opt_level) = debugging_opts.mir_opt_level {
|
||||||
// Functions inlined during MIR transform can, at best, make it impossible to
|
if mir_opt_level > 1 {
|
||||||
// effectively cover inlined functions, and, at worst, break coverage map generation
|
// Functions inlined during MIR transform can, at best, make it impossible to
|
||||||
// during LLVM codegen. For example, function counter IDs are only unique within a
|
// effectively cover inlined functions, and, at worst, break coverage map generation
|
||||||
// function. Inlining after these counters are injected can produce duplicate counters,
|
// during LLVM codegen. For example, function counter IDs are only unique within a
|
||||||
// resulting in an invalid coverage map (and ICE); so this option combination is not
|
// function. Inlining after these counters are injected can produce duplicate counters,
|
||||||
// allowed.
|
// resulting in an invalid coverage map (and ICE); so this option combination is not
|
||||||
early_warn(
|
// allowed.
|
||||||
error_format,
|
early_warn(
|
||||||
&format!(
|
error_format,
|
||||||
"`-Z mir-opt-level={}` (or any level > 1) enables function inlining, which \
|
&format!(
|
||||||
|
"`-Z mir-opt-level={}` (or any level > 1) enables function inlining, which \
|
||||||
is incompatible with `-Z instrument-coverage`. Inlining will be disabled.",
|
is incompatible with `-Z instrument-coverage`. Inlining will be disabled.",
|
||||||
debugging_opts.mir_opt_level,
|
mir_opt_level,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -999,8 +999,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
|
||||||
mir_emit_retag: bool = (false, parse_bool, [TRACKED],
|
mir_emit_retag: bool = (false, parse_bool, [TRACKED],
|
||||||
"emit Retagging MIR statements, interpreted e.g., by miri; implies -Zmir-opt-level=0 \
|
"emit Retagging MIR statements, interpreted e.g., by miri; implies -Zmir-opt-level=0 \
|
||||||
(default: no)"),
|
(default: no)"),
|
||||||
mir_opt_level: usize = (1, parse_uint, [TRACKED],
|
mir_opt_level: Option<usize> = (None, parse_opt_uint, [TRACKED],
|
||||||
"MIR optimization level (0-3; default: 1)"),
|
"MIR optimization level (0-4; default: 1 in non optimized builds and 2 in optimized builds)"),
|
||||||
mutable_noalias: bool = (false, parse_bool, [TRACKED],
|
mutable_noalias: bool = (false, parse_bool, [TRACKED],
|
||||||
"emit noalias metadata for mutable references (default: no)"),
|
"emit noalias metadata for mutable references (default: no)"),
|
||||||
new_llvm_pass_manager: bool = (false, parse_bool, [TRACKED],
|
new_llvm_pass_manager: bool = (false, parse_bool, [TRACKED],
|
||||||
|
|
|
@ -640,6 +640,12 @@ impl Session {
|
||||||
pub fn binary_dep_depinfo(&self) -> bool {
|
pub fn binary_dep_depinfo(&self) -> bool {
|
||||||
self.opts.debugging_opts.binary_dep_depinfo
|
self.opts.debugging_opts.binary_dep_depinfo
|
||||||
}
|
}
|
||||||
|
pub fn mir_opt_level(&self) -> usize {
|
||||||
|
self.opts
|
||||||
|
.debugging_opts
|
||||||
|
.mir_opt_level
|
||||||
|
.unwrap_or_else(|| if self.opts.optimize != config::OptLevel::No { 2 } else { 1 })
|
||||||
|
}
|
||||||
|
|
||||||
/// Gets the features enabled for the current compilation session.
|
/// Gets the features enabled for the current compilation session.
|
||||||
/// DO NOT USE THIS METHOD if there is a TyCtxt available, as it circumvents
|
/// DO NOT USE THIS METHOD if there is a TyCtxt available, as it circumvents
|
||||||
|
|
|
@ -138,21 +138,28 @@ fn main() {
|
||||||
cmd.arg("-Z").arg("force-unstable-if-unmarked");
|
cmd.arg("-Z").arg("force-unstable-if-unmarked");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let is_test = args.iter().any(|a| a == "--test");
|
||||||
if verbose > 1 {
|
if verbose > 1 {
|
||||||
let rust_env_vars =
|
let rust_env_vars =
|
||||||
env::vars().filter(|(k, _)| k.starts_with("RUST") || k.starts_with("CARGO"));
|
env::vars().filter(|(k, _)| k.starts_with("RUST") || k.starts_with("CARGO"));
|
||||||
|
let prefix = if is_test { "[RUSTC-SHIM] rustc --test" } else { "[RUSTC-SHIM] rustc" };
|
||||||
|
let prefix = match crate_name {
|
||||||
|
Some(crate_name) => format!("{} {}", prefix, crate_name),
|
||||||
|
None => prefix.to_string(),
|
||||||
|
};
|
||||||
for (i, (k, v)) in rust_env_vars.enumerate() {
|
for (i, (k, v)) in rust_env_vars.enumerate() {
|
||||||
eprintln!("rustc env[{}]: {:?}={:?}", i, k, v);
|
eprintln!("{} env[{}]: {:?}={:?}", prefix, i, k, v);
|
||||||
}
|
}
|
||||||
eprintln!("rustc working directory: {}", env::current_dir().unwrap().display());
|
eprintln!("{} working directory: {}", prefix, env::current_dir().unwrap().display());
|
||||||
eprintln!(
|
eprintln!(
|
||||||
"rustc command: {:?}={:?} {:?}",
|
"{} command: {:?}={:?} {:?}",
|
||||||
|
prefix,
|
||||||
bootstrap::util::dylib_path_var(),
|
bootstrap::util::dylib_path_var(),
|
||||||
env::join_paths(&dylib_path).unwrap(),
|
env::join_paths(&dylib_path).unwrap(),
|
||||||
cmd,
|
cmd,
|
||||||
);
|
);
|
||||||
eprintln!("sysroot: {:?}", sysroot);
|
eprintln!("{} sysroot: {:?}", prefix, sysroot);
|
||||||
eprintln!("libdir: {:?}", libdir);
|
eprintln!("{} libdir: {:?}", prefix, libdir);
|
||||||
}
|
}
|
||||||
|
|
||||||
let start = Instant::now();
|
let start = Instant::now();
|
||||||
|
@ -166,7 +173,6 @@ fn main() {
|
||||||
{
|
{
|
||||||
if let Some(crate_name) = crate_name {
|
if let Some(crate_name) = crate_name {
|
||||||
let dur = start.elapsed();
|
let dur = start.elapsed();
|
||||||
let is_test = args.iter().any(|a| a == "--test");
|
|
||||||
// If the user requested resource usage data, then
|
// If the user requested resource usage data, then
|
||||||
// include that in addition to the timing output.
|
// include that in addition to the timing output.
|
||||||
let rusage_data =
|
let rusage_data =
|
||||||
|
|
|
@ -2129,12 +2129,12 @@ fn clean_extern_crate(
|
||||||
}
|
}
|
||||||
// FIXME: using `from_def_id_and_kind` breaks `rustdoc/masked` for some reason
|
// FIXME: using `from_def_id_and_kind` breaks `rustdoc/masked` for some reason
|
||||||
vec![Item {
|
vec![Item {
|
||||||
name: None,
|
name: Some(name),
|
||||||
attrs: box krate.attrs.clean(cx),
|
attrs: box krate.attrs.clean(cx),
|
||||||
source: krate.span.clean(cx),
|
source: krate.span.clean(cx),
|
||||||
def_id: crate_def_id,
|
def_id: crate_def_id,
|
||||||
visibility: krate.vis.clean(cx),
|
visibility: krate.vis.clean(cx),
|
||||||
kind: box ExternCrateItem(name, orig_name),
|
kind: box ExternCrateItem { src: orig_name },
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -323,7 +323,10 @@ impl Item {
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
crate enum ItemKind {
|
crate enum ItemKind {
|
||||||
ExternCrateItem(Symbol, Option<Symbol>),
|
ExternCrateItem {
|
||||||
|
/// The crate's name, *not* the name it's imported as.
|
||||||
|
src: Option<Symbol>,
|
||||||
|
},
|
||||||
ImportItem(Import),
|
ImportItem(Import),
|
||||||
StructItem(Struct),
|
StructItem(Struct),
|
||||||
UnionItem(Union),
|
UnionItem(Union),
|
||||||
|
@ -376,7 +379,7 @@ impl ItemKind {
|
||||||
TraitItem(t) => t.items.iter(),
|
TraitItem(t) => t.items.iter(),
|
||||||
ImplItem(i) => i.items.iter(),
|
ImplItem(i) => i.items.iter(),
|
||||||
ModuleItem(m) => m.items.iter(),
|
ModuleItem(m) => m.items.iter(),
|
||||||
ExternCrateItem(_, _)
|
ExternCrateItem { .. }
|
||||||
| ImportItem(_)
|
| ImportItem(_)
|
||||||
| FunctionItem(_)
|
| FunctionItem(_)
|
||||||
| TypedefItem(_, _)
|
| TypedefItem(_, _)
|
||||||
|
|
|
@ -67,7 +67,7 @@ impl<'a> From<&'a clean::Item> for ItemType {
|
||||||
|
|
||||||
match *kind {
|
match *kind {
|
||||||
clean::ModuleItem(..) => ItemType::Module,
|
clean::ModuleItem(..) => ItemType::Module,
|
||||||
clean::ExternCrateItem(..) => ItemType::ExternCrate,
|
clean::ExternCrateItem { .. } => ItemType::ExternCrate,
|
||||||
clean::ImportItem(..) => ItemType::Import,
|
clean::ImportItem(..) => ItemType::Import,
|
||||||
clean::StructItem(..) => ItemType::Struct,
|
clean::StructItem(..) => ItemType::Struct,
|
||||||
clean::UnionItem(..) => ItemType::Union,
|
clean::UnionItem(..) => ItemType::Union,
|
||||||
|
|
|
@ -91,7 +91,9 @@ crate fn run_format<'tcx, T: FormatRenderer<'tcx>>(
|
||||||
}
|
}
|
||||||
|
|
||||||
cx.mod_item_out(&name)?;
|
cx.mod_item_out(&name)?;
|
||||||
} else if item.name.is_some() {
|
// FIXME: checking `item.name.is_some()` is very implicit and leads to lots of special
|
||||||
|
// cases. Use an explicit match instead.
|
||||||
|
} else if item.name.is_some() && !item.is_extern_crate() {
|
||||||
prof.generic_activity_with_arg("render_item", &*item.name.unwrap_or(unknown).as_str())
|
prof.generic_activity_with_arg("render_item", &*item.name.unwrap_or(unknown).as_str())
|
||||||
.run(|| cx.item(item))?;
|
.run(|| cx.item(item))?;
|
||||||
}
|
}
|
||||||
|
|
|
@ -240,7 +240,7 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
|
||||||
}
|
}
|
||||||
|
|
||||||
match *myitem.kind {
|
match *myitem.kind {
|
||||||
clean::ExternCrateItem(ref name, ref src) => {
|
clean::ExternCrateItem { ref src } => {
|
||||||
use crate::html::format::anchor;
|
use crate::html::format::anchor;
|
||||||
|
|
||||||
match *src {
|
match *src {
|
||||||
|
@ -249,13 +249,13 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
|
||||||
"<tr><td><code>{}extern crate {} as {};",
|
"<tr><td><code>{}extern crate {} as {};",
|
||||||
myitem.visibility.print_with_space(cx.tcx(), myitem.def_id, cx.cache()),
|
myitem.visibility.print_with_space(cx.tcx(), myitem.def_id, cx.cache()),
|
||||||
anchor(myitem.def_id, &*src.as_str(), cx.cache()),
|
anchor(myitem.def_id, &*src.as_str(), cx.cache()),
|
||||||
name
|
myitem.name.as_ref().unwrap(),
|
||||||
),
|
),
|
||||||
None => write!(
|
None => write!(
|
||||||
w,
|
w,
|
||||||
"<tr><td><code>{}extern crate {};",
|
"<tr><td><code>{}extern crate {};",
|
||||||
myitem.visibility.print_with_space(cx.tcx(), myitem.def_id, cx.cache()),
|
myitem.visibility.print_with_space(cx.tcx(), myitem.def_id, cx.cache()),
|
||||||
anchor(myitem.def_id, &*name.as_str(), cx.cache())
|
anchor(myitem.def_id, &*myitem.name.as_ref().unwrap().as_str(), cx.cache()),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
w.write_str("</code></td></tr>");
|
w.write_str("</code></td></tr>");
|
||||||
|
|
|
@ -1548,9 +1548,9 @@ function defocusSearchBar() {
|
||||||
} else if (type === "structfield" && parentType === "variant") {
|
} else if (type === "structfield" && parentType === "variant") {
|
||||||
// Structfields belonging to variants are special: the
|
// Structfields belonging to variants are special: the
|
||||||
// final path element is the enum name.
|
// final path element is the enum name.
|
||||||
var splitPath = item.path.split("::");
|
var enumNameIdx = item.path.lastIndexOf("::");
|
||||||
var enumName = splitPath.pop();
|
var enumName = item.path.substr(enumNameIdx + 2);
|
||||||
path = splitPath.join("::");
|
path = item.path.substr(0, enumNameIdx);
|
||||||
displayPath = path + "::" + enumName + "::" + myparent.name + "::";
|
displayPath = path + "::" + enumName + "::" + myparent.name + "::";
|
||||||
anchor = "#variant." + myparent.name + ".field." + name;
|
anchor = "#variant." + myparent.name + ".field." + name;
|
||||||
pageType = "enum";
|
pageType = "enum";
|
||||||
|
|
|
@ -10,6 +10,7 @@ use rustc_ast::ast;
|
||||||
use rustc_hir::def::CtorKind;
|
use rustc_hir::def::CtorKind;
|
||||||
use rustc_middle::ty::TyCtxt;
|
use rustc_middle::ty::TyCtxt;
|
||||||
use rustc_span::def_id::{DefId, CRATE_DEF_INDEX};
|
use rustc_span::def_id::{DefId, CRATE_DEF_INDEX};
|
||||||
|
use rustc_span::symbol::Symbol;
|
||||||
use rustc_span::Pos;
|
use rustc_span::Pos;
|
||||||
|
|
||||||
use rustdoc_json_types::*;
|
use rustdoc_json_types::*;
|
||||||
|
@ -25,32 +26,33 @@ impl JsonRenderer<'_> {
|
||||||
let item_type = ItemType::from(&item);
|
let item_type = ItemType::from(&item);
|
||||||
let deprecation = item.deprecation(self.tcx);
|
let deprecation = item.deprecation(self.tcx);
|
||||||
let clean::Item { source, name, attrs, kind, visibility, def_id } = item;
|
let clean::Item { source, name, attrs, kind, visibility, def_id } = item;
|
||||||
match *kind {
|
let inner = match *kind {
|
||||||
clean::StrippedItem(_) => None,
|
clean::StrippedItem(_) => return None,
|
||||||
kind => Some(Item {
|
x => from_clean_item_kind(x, self.tcx, &name),
|
||||||
id: from_def_id(def_id),
|
};
|
||||||
crate_id: def_id.krate.as_u32(),
|
Some(Item {
|
||||||
name: name.map(|sym| sym.to_string()),
|
id: from_def_id(def_id),
|
||||||
source: self.convert_span(source),
|
crate_id: def_id.krate.as_u32(),
|
||||||
visibility: self.convert_visibility(visibility),
|
name: name.map(|sym| sym.to_string()),
|
||||||
docs: attrs.collapsed_doc_value(),
|
source: self.convert_span(source),
|
||||||
links: attrs
|
visibility: self.convert_visibility(visibility),
|
||||||
.links
|
docs: attrs.collapsed_doc_value(),
|
||||||
.into_iter()
|
links: attrs
|
||||||
.filter_map(|clean::ItemLink { link, did, .. }| {
|
.links
|
||||||
did.map(|did| (link, from_def_id(did)))
|
.into_iter()
|
||||||
})
|
.filter_map(|clean::ItemLink { link, did, .. }| {
|
||||||
.collect(),
|
did.map(|did| (link, from_def_id(did)))
|
||||||
attrs: attrs
|
})
|
||||||
.other_attrs
|
.collect(),
|
||||||
.iter()
|
attrs: attrs
|
||||||
.map(rustc_ast_pretty::pprust::attribute_to_string)
|
.other_attrs
|
||||||
.collect(),
|
.iter()
|
||||||
deprecation: deprecation.map(from_deprecation),
|
.map(rustc_ast_pretty::pprust::attribute_to_string)
|
||||||
kind: item_type.into(),
|
.collect(),
|
||||||
inner: from_clean_item_kind(kind, self.tcx),
|
deprecation: deprecation.map(from_deprecation),
|
||||||
}),
|
kind: item_type.into(),
|
||||||
}
|
inner,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn convert_span(&self, span: clean::Span) -> Option<Span> {
|
fn convert_span(&self, span: clean::Span) -> Option<Span> {
|
||||||
|
@ -149,13 +151,10 @@ crate fn from_def_id(did: DefId) -> Id {
|
||||||
Id(format!("{}:{}", did.krate.as_u32(), u32::from(did.index)))
|
Id(format!("{}:{}", did.krate.as_u32(), u32::from(did.index)))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn from_clean_item_kind(item: clean::ItemKind, tcx: TyCtxt<'_>) -> ItemEnum {
|
fn from_clean_item_kind(item: clean::ItemKind, tcx: TyCtxt<'_>, name: &Option<Symbol>) -> ItemEnum {
|
||||||
use clean::ItemKind::*;
|
use clean::ItemKind::*;
|
||||||
match item {
|
match item {
|
||||||
ModuleItem(m) => ItemEnum::ModuleItem(m.into()),
|
ModuleItem(m) => ItemEnum::ModuleItem(m.into()),
|
||||||
ExternCrateItem(c, a) => {
|
|
||||||
ItemEnum::ExternCrateItem { name: c.to_string(), rename: a.map(|x| x.to_string()) }
|
|
||||||
}
|
|
||||||
ImportItem(i) => ItemEnum::ImportItem(i.into()),
|
ImportItem(i) => ItemEnum::ImportItem(i.into()),
|
||||||
StructItem(s) => ItemEnum::StructItem(s.into()),
|
StructItem(s) => ItemEnum::StructItem(s.into()),
|
||||||
UnionItem(u) => ItemEnum::UnionItem(u.into()),
|
UnionItem(u) => ItemEnum::UnionItem(u.into()),
|
||||||
|
@ -182,10 +181,14 @@ fn from_clean_item_kind(item: clean::ItemKind, tcx: TyCtxt<'_>) -> ItemEnum {
|
||||||
bounds: g.into_iter().map(Into::into).collect(),
|
bounds: g.into_iter().map(Into::into).collect(),
|
||||||
default: t.map(Into::into),
|
default: t.map(Into::into),
|
||||||
},
|
},
|
||||||
StrippedItem(inner) => from_clean_item_kind(*inner, tcx),
|
StrippedItem(inner) => from_clean_item_kind(*inner, tcx, name),
|
||||||
PrimitiveItem(_) | KeywordItem(_) => {
|
PrimitiveItem(_) | KeywordItem(_) => {
|
||||||
panic!("{:?} is not supported for JSON output", item)
|
panic!("{:?} is not supported for JSON output", item)
|
||||||
}
|
}
|
||||||
|
ExternCrateItem { ref src } => ItemEnum::ExternCrateItem {
|
||||||
|
name: name.as_ref().unwrap().to_string(),
|
||||||
|
rename: src.map(|x| x.to_string()),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -183,7 +183,7 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
|
||||||
match &*item.kind {
|
match &*item.kind {
|
||||||
// These don't have names so they don't get added to the output by default
|
// These don't have names so they don't get added to the output by default
|
||||||
ImportItem(_) => self.item(item.clone()).unwrap(),
|
ImportItem(_) => self.item(item.clone()).unwrap(),
|
||||||
ExternCrateItem(_, _) => self.item(item.clone()).unwrap(),
|
ExternCrateItem { .. } => self.item(item.clone()).unwrap(),
|
||||||
ImplItem(i) => i.items.iter().for_each(|i| self.item(i.clone()).unwrap()),
|
ImplItem(i) => i.items.iter().for_each(|i| self.item(i.clone()).unwrap()),
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,7 +193,7 @@ impl<'a, 'b> fold::DocFolder for CoverageCalculator<'a, 'b> {
|
||||||
// don't count items in stripped modules
|
// don't count items in stripped modules
|
||||||
return Some(i);
|
return Some(i);
|
||||||
}
|
}
|
||||||
clean::ImportItem(..) | clean::ExternCrateItem(..) => {
|
clean::ImportItem(..) | clean::ExternCrateItem { .. } => {
|
||||||
// docs on `use` and `extern crate` statements are not displayed, so they're not
|
// docs on `use` and `extern crate` statements are not displayed, so they're not
|
||||||
// worth counting
|
// worth counting
|
||||||
return Some(i);
|
return Some(i);
|
||||||
|
|
|
@ -63,7 +63,7 @@ crate fn should_have_doc_example(cx: &DocContext<'_>, item: &clean::Item) -> boo
|
||||||
| clean::TypedefItem(_, _)
|
| clean::TypedefItem(_, _)
|
||||||
| clean::StaticItem(_)
|
| clean::StaticItem(_)
|
||||||
| clean::ConstantItem(_)
|
| clean::ConstantItem(_)
|
||||||
| clean::ExternCrateItem(_, _)
|
| clean::ExternCrateItem { .. }
|
||||||
| clean::ImportItem(_)
|
| clean::ImportItem(_)
|
||||||
| clean::PrimitiveItem(_)
|
| clean::PrimitiveItem(_)
|
||||||
| clean::KeywordItem(_)
|
| clean::KeywordItem(_)
|
||||||
|
|
|
@ -66,7 +66,7 @@ impl<'a> DocFolder for Stripper<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// handled in the `strip-priv-imports` pass
|
// handled in the `strip-priv-imports` pass
|
||||||
clean::ExternCrateItem(..) | clean::ImportItem(..) => {}
|
clean::ExternCrateItem { .. } | clean::ImportItem(..) => {}
|
||||||
|
|
||||||
clean::ImplItem(..) => {}
|
clean::ImplItem(..) => {}
|
||||||
|
|
||||||
|
@ -161,7 +161,9 @@ crate struct ImportStripper;
|
||||||
impl DocFolder for ImportStripper {
|
impl DocFolder for ImportStripper {
|
||||||
fn fold_item(&mut self, i: Item) -> Option<Item> {
|
fn fold_item(&mut self, i: Item) -> Option<Item> {
|
||||||
match *i.kind {
|
match *i.kind {
|
||||||
clean::ExternCrateItem(..) | clean::ImportItem(..) if !i.visibility.is_public() => None,
|
clean::ExternCrateItem { .. } | clean::ImportItem(..) if !i.visibility.is_public() => {
|
||||||
|
None
|
||||||
|
}
|
||||||
_ => Some(self.fold_item_recur(i)),
|
_ => Some(self.fold_item_recur(i)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
// Once the optimizer can do that, mir-opt/issues/issue-59352.rs will need to be updated and this
|
// Once the optimizer can do that, mir-opt/issues/issue-59352.rs will need to be updated and this
|
||||||
// test case should be removed as it will become redundant.
|
// test case should be removed as it will become redundant.
|
||||||
|
|
||||||
// mir-opt-level=2 enables inlining and enables LLVM to optimize away the unreachable panic call.
|
// mir-opt-level=3 enables inlining and enables LLVM to optimize away the unreachable panic call.
|
||||||
// compile-flags: -O -Z mir-opt-level=2
|
// compile-flags: -O -Z mir-opt-level=3
|
||||||
|
|
||||||
#![crate_type = "rlib"]
|
#![crate_type = "rlib"]
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Checks that naked functions are never inlined.
|
// Checks that naked functions are never inlined.
|
||||||
// compile-flags: -O -Zmir-opt-level=2
|
// compile-flags: -O -Zmir-opt-level=3
|
||||||
// ignore-wasm32
|
// ignore-wasm32
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
#![feature(asm)]
|
#![feature(asm)]
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
// needs-sanitizer-address
|
// needs-sanitizer-address
|
||||||
// needs-sanitizer-leak
|
// needs-sanitizer-leak
|
||||||
// revisions: ASAN LSAN
|
// revisions: ASAN LSAN
|
||||||
//[ASAN] compile-flags: -Zsanitizer=address -C opt-level=3 -Z mir-opt-level=3
|
//[ASAN] compile-flags: -Zsanitizer=address -C opt-level=3 -Z mir-opt-level=4
|
||||||
//[LSAN] compile-flags: -Zsanitizer=leak -C opt-level=3 -Z mir-opt-level=3
|
//[LSAN] compile-flags: -Zsanitizer=leak -C opt-level=3 -Z mir-opt-level=4
|
||||||
|
|
||||||
#![crate_type="lib"]
|
#![crate_type="lib"]
|
||||||
#![feature(no_sanitize)]
|
#![feature(no_sanitize)]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// compile-flags: -C no-prepopulate-passes -O -Z mir-opt-level=2 -Zunsound-mir-opts
|
// compile-flags: -C no-prepopulate-passes -O -Z mir-opt-level=3 -Zunsound-mir-opts
|
||||||
|
|
||||||
// Ensure that `x?` has no overhead on `Result<T, E>` due to identity `match`es in lowering.
|
// Ensure that `x?` has no overhead on `Result<T, E>` due to identity `match`es in lowering.
|
||||||
// This requires inlining to trigger the MIR optimizations in `SimplifyArmIdentity`.
|
// This requires inlining to trigger the MIR optimizations in `SimplifyArmIdentity`.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// compile-flags: -O -Zmir-opt-level=3
|
// compile-flags: -O -Zmir-opt-level=4
|
||||||
|
|
||||||
// EMIT_MIR boolean_identities.test.ConstProp.diff
|
// EMIT_MIR boolean_identities.test.ConstProp.diff
|
||||||
pub fn test(x: bool, y: bool) -> bool {
|
pub fn test(x: bool, y: bool) -> bool {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// compile-flags: -Z mir-opt-level=2
|
// compile-flags: -Z mir-opt-level=3
|
||||||
|
|
||||||
// Due to a bug in propagating scalar pairs the assertion below used to fail. In the expected
|
// Due to a bug in propagating scalar pairs the assertion below used to fail. In the expected
|
||||||
// outputs below, after ConstProp this is how _2 would look like with the bug:
|
// outputs below, after ConstProp this is how _2 would look like with the bug:
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// compile-flags: -Z mir-opt-level=2
|
// compile-flags: -Z mir-opt-level=3
|
||||||
|
|
||||||
// This used to ICE in const-prop
|
// This used to ICE in const-prop
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// compile-flags: -O -Zmir-opt-level=3
|
// compile-flags: -O -Zmir-opt-level=4
|
||||||
|
|
||||||
// EMIT_MIR mult_by_zero.test.ConstProp.diff
|
// EMIT_MIR mult_by_zero.test.ConstProp.diff
|
||||||
fn test(x : i32) -> i32 {
|
fn test(x : i32) -> i32 {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// compile-flags: -Z mir-opt-level=3
|
// compile-flags: -Z mir-opt-level=4
|
||||||
// EMIT_MIR early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff
|
// EMIT_MIR early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff
|
||||||
fn opt1(x: Option<u32>, y: Option<u32>) -> u32 {
|
fn opt1(x: Option<u32>, y: Option<u32>) -> u32 {
|
||||||
match (x, y) {
|
match (x, y) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// compile-flags: -Z mir-opt-level=3
|
// compile-flags: -Z mir-opt-level=4
|
||||||
|
|
||||||
// EMIT_MIR early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff
|
// EMIT_MIR early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff
|
||||||
fn opt1(x: Option<u32>, y: Option<u32>, z: Option<u32>) -> u32 {
|
fn opt1(x: Option<u32>, y: Option<u32>, z: Option<u32>) -> u32 {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// ignore-tidy-linelength
|
// ignore-tidy-linelength
|
||||||
// compile-flags: -Z mir-opt-level=3 -Zunsound-mir-opts
|
// compile-flags: -Z mir-opt-level=4 -Zunsound-mir-opts
|
||||||
|
|
||||||
// example from #68867
|
// example from #68867
|
||||||
type CSSFloat = f32;
|
type CSSFloat = f32;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// compile-flags: -Z mir-opt-level=3
|
// compile-flags: -Z mir-opt-level=4
|
||||||
|
|
||||||
// must not optimize as it does not follow the pattern of
|
// must not optimize as it does not follow the pattern of
|
||||||
// left and right hand side being the same variant
|
// left and right hand side being the same variant
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// ignore-endian-big
|
// ignore-endian-big
|
||||||
// ignore-wasm32-bare compiled with panic=abort by default
|
// ignore-wasm32-bare compiled with panic=abort by default
|
||||||
// compile-flags: -Z mir-opt-level=3
|
// compile-flags: -Z mir-opt-level=4
|
||||||
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
// EMIT_MIR inline_into_box_place.main.Inline.diff
|
// EMIT_MIR inline_into_box_place.main.Inline.diff
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// compile-flags: -Z span_free_formats -Z mir-opt-level=3
|
// compile-flags: -Z span_free_formats -Z mir-opt-level=4
|
||||||
|
|
||||||
// EMIT_MIR inline_trait_method_2.test2.Inline.after.mir
|
// EMIT_MIR inline_trait_method_2.test2.Inline.after.mir
|
||||||
fn test2(x: &dyn X) -> bool {
|
fn test2(x: &dyn X) -> bool {
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
// removed.
|
// removed.
|
||||||
|
|
||||||
// EMIT_MIR issue_59352.num_to_digit.PreCodegen.after.mir
|
// EMIT_MIR issue_59352.num_to_digit.PreCodegen.after.mir
|
||||||
// compile-flags: -Z mir-opt-level=2 -Z span_free_formats
|
// compile-flags: -Z mir-opt-level=3 -Z span_free_formats
|
||||||
|
|
||||||
pub fn num_to_digit(num: char) -> u32 {
|
pub fn num_to_digit(num: char) -> u32 {
|
||||||
// CHECK-NOT: panic
|
// CHECK-NOT: panic
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// compile-flags: -Z mir-opt-level=3
|
// compile-flags: -Z mir-opt-level=4
|
||||||
// EMIT_MIR multiple_return_terminators.test.MultipleReturnTerminators.diff
|
// EMIT_MIR multiple_return_terminators.test.MultipleReturnTerminators.diff
|
||||||
|
|
||||||
fn test(x: bool) {
|
fn test(x: bool) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Checks that `SimplifyArmIdentity` is not applied if enums have incompatible layouts.
|
// Checks that `SimplifyArmIdentity` is not applied if enums have incompatible layouts.
|
||||||
// Regression test for issue #66856.
|
// Regression test for issue #66856.
|
||||||
//
|
//
|
||||||
// compile-flags: -Zmir-opt-level=2
|
// compile-flags: -Zmir-opt-level=3
|
||||||
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
||||||
|
|
||||||
enum Src {
|
enum Src {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// compile-flags: -Z mir-opt-level=2 -Zunsound-mir-opts
|
// compile-flags: -Z mir-opt-level=3 -Zunsound-mir-opts
|
||||||
// EMIT_MIR simplify_arm.id.SimplifyArmIdentity.diff
|
// EMIT_MIR simplify_arm.id.SimplifyArmIdentity.diff
|
||||||
// EMIT_MIR simplify_arm.id.SimplifyBranchSame.diff
|
// EMIT_MIR simplify_arm.id.SimplifyBranchSame.diff
|
||||||
// EMIT_MIR simplify_arm.id_result.SimplifyArmIdentity.diff
|
// EMIT_MIR simplify_arm.id_result.SimplifyArmIdentity.diff
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
#![deny(unused_attributes)]
|
#![deny(warnings)]
|
||||||
//~^ NOTE lint level is defined here
|
|
||||||
#![doc(as_ptr)]
|
#![doc(as_ptr)]
|
||||||
//~^ ERROR unknown `doc` attribute
|
//~^ ERROR unknown `doc` attribute
|
||||||
//~| WARNING will become a hard error in a future release
|
//~^^ WARN
|
||||||
|
|
||||||
#[doc(as_ptr)]
|
#[doc(as_ptr)]
|
||||||
//~^ ERROR unknown `doc` attribute
|
//~^ ERROR unknown `doc` attribute
|
||||||
//~| WARNING will become a hard error in a future release
|
//~^^ WARN
|
||||||
pub fn foo() {}
|
pub fn foo() {}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
error: unknown `doc` attribute `as_ptr`
|
error: unknown `doc` attribute `as_ptr`
|
||||||
--> $DIR/doc-attr.rs:8:7
|
--> $DIR/doc-attr.rs:7:7
|
||||||
|
|
|
|
||||||
LL | #[doc(as_ptr)]
|
LL | #[doc(as_ptr)]
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
|
@ -7,17 +7,20 @@ LL | #[doc(as_ptr)]
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/doc-attr.rs:2:9
|
--> $DIR/doc-attr.rs:2:9
|
||||||
|
|
|
|
||||||
LL | #![deny(unused_attributes)]
|
LL | #![deny(warnings)]
|
||||||
| ^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^
|
||||||
|
= note: `#[deny(invalid_doc_attributes)]` implied by `#[deny(warnings)]`
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
|
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
|
||||||
|
|
||||||
error: unknown `doc` attribute `as_ptr`
|
error: unknown `doc` attribute `as_ptr`
|
||||||
--> $DIR/doc-attr.rs:4:8
|
--> $DIR/doc-attr.rs:3:8
|
||||||
|
|
|
|
||||||
LL | #![doc(as_ptr)]
|
LL | #![doc(as_ptr)]
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
|
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
|
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
11
src/test/rustdoc-ui/doc-attr2.rs
Normal file
11
src/test/rustdoc-ui/doc-attr2.rs
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
#![crate_type = "lib"]
|
||||||
|
#![deny(warnings)]
|
||||||
|
|
||||||
|
#[doc(test(no_crate_inject))] //~ ERROR
|
||||||
|
//~^ WARN
|
||||||
|
pub fn foo() {}
|
||||||
|
|
||||||
|
pub mod bar {
|
||||||
|
#![doc(test(no_crate_inject))] //~ ERROR
|
||||||
|
//~^ WARN
|
||||||
|
}
|
26
src/test/rustdoc-ui/doc-attr2.stderr
Normal file
26
src/test/rustdoc-ui/doc-attr2.stderr
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
error: `#![doc(test(...)]` is only allowed as a crate level attribute
|
||||||
|
--> $DIR/doc-attr2.rs:4:7
|
||||||
|
|
|
||||||
|
LL | #[doc(test(no_crate_inject))]
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
note: the lint level is defined here
|
||||||
|
--> $DIR/doc-attr2.rs:2:9
|
||||||
|
|
|
||||||
|
LL | #![deny(warnings)]
|
||||||
|
| ^^^^^^^^
|
||||||
|
= note: `#[deny(invalid_doc_attributes)]` implied by `#[deny(warnings)]`
|
||||||
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
|
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
|
||||||
|
|
||||||
|
error: `#![doc(test(...)]` is only allowed as a crate level attribute
|
||||||
|
--> $DIR/doc-attr2.rs:9:12
|
||||||
|
|
|
||||||
|
LL | #![doc(test(no_crate_inject))]
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
|
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
|
||||||
|
|
||||||
|
error: aborting due to 2 previous errors
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
#![deny(unused_attributes)]
|
#![deny(warnings)]
|
||||||
//~^ NOTE lint level is defined here
|
|
||||||
#![doc(as_ptr)]
|
#![doc(as_ptr)]
|
||||||
//~^ ERROR unknown `doc` attribute
|
//~^ ERROR unknown `doc` attribute
|
||||||
//~| WARNING will become a hard error in a future release
|
//~^^ WARN
|
||||||
|
|
||||||
#[doc(as_ptr)]
|
#[doc(as_ptr)]
|
||||||
//~^ ERROR unknown `doc` attribute
|
//~^ ERROR unknown `doc` attribute
|
||||||
//~| WARNING will become a hard error in a future release
|
//~^^ WARN
|
||||||
pub fn foo() {}
|
pub fn foo() {}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
error: unknown `doc` attribute `as_ptr`
|
error: unknown `doc` attribute `as_ptr`
|
||||||
--> $DIR/doc-attr.rs:8:7
|
--> $DIR/doc-attr.rs:7:7
|
||||||
|
|
|
|
||||||
LL | #[doc(as_ptr)]
|
LL | #[doc(as_ptr)]
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
|
@ -7,17 +7,20 @@ LL | #[doc(as_ptr)]
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/doc-attr.rs:2:9
|
--> $DIR/doc-attr.rs:2:9
|
||||||
|
|
|
|
||||||
LL | #![deny(unused_attributes)]
|
LL | #![deny(warnings)]
|
||||||
| ^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^
|
||||||
|
= note: `#[deny(invalid_doc_attributes)]` implied by `#[deny(warnings)]`
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
|
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
|
||||||
|
|
||||||
error: unknown `doc` attribute `as_ptr`
|
error: unknown `doc` attribute `as_ptr`
|
||||||
--> $DIR/doc-attr.rs:4:8
|
--> $DIR/doc-attr.rs:3:8
|
||||||
|
|
|
|
||||||
LL | #![doc(as_ptr)]
|
LL | #![doc(as_ptr)]
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
|
|
|
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
|
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
11
src/test/ui/attributes/doc-attr2.rs
Normal file
11
src/test/ui/attributes/doc-attr2.rs
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
#![crate_type = "lib"]
|
||||||
|
#![deny(warnings)]
|
||||||
|
|
||||||
|
#[doc(test(no_crate_inject))] //~ ERROR
|
||||||
|
//~^ WARN
|
||||||
|
pub fn foo() {}
|
||||||
|
|
||||||
|
pub mod bar {
|
||||||
|
#![doc(test(no_crate_inject))] //~ ERROR
|
||||||
|
//~^ WARN
|
||||||
|
}
|
26
src/test/ui/attributes/doc-attr2.stderr
Normal file
26
src/test/ui/attributes/doc-attr2.stderr
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
error: `#![doc(test(...)]` is only allowed as a crate level attribute
|
||||||
|
--> $DIR/doc-attr2.rs:4:7
|
||||||
|
|
|
||||||
|
LL | #[doc(test(no_crate_inject))]
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
note: the lint level is defined here
|
||||||
|
--> $DIR/doc-attr2.rs:2:9
|
||||||
|
|
|
||||||
|
LL | #![deny(warnings)]
|
||||||
|
| ^^^^^^^^
|
||||||
|
= note: `#[deny(invalid_doc_attributes)]` implied by `#[deny(warnings)]`
|
||||||
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
|
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
|
||||||
|
|
||||||
|
error: `#![doc(test(...)]` is only allowed as a crate level attribute
|
||||||
|
--> $DIR/doc-attr2.rs:9:12
|
||||||
|
|
|
||||||
|
LL | #![doc(test(no_crate_inject))]
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
|
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
|
||||||
|
|
||||||
|
error: aborting due to 2 previous errors
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// compile-flags: -Zmir-opt-level=3
|
// compile-flags: -Zmir-opt-level=4
|
||||||
// run-pass
|
// run-pass
|
||||||
|
|
||||||
#![feature(const_generics)]
|
#![feature(const_generics)]
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// build-fail
|
// build-fail
|
||||||
// compile-flags: -Zmir-opt-level=2
|
// compile-flags: -Zmir-opt-level=3
|
||||||
|
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Must be build-pass, because check-pass will not run const prop and thus not emit the lint anyway.
|
// Must be build-pass, because check-pass will not run const prop and thus not emit the lint anyway.
|
||||||
// build-pass
|
// build-pass
|
||||||
// compile-flags: -Zmir-opt-level=2
|
// compile-flags: -Zmir-opt-level=3
|
||||||
|
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
// run-pass
|
// run-pass
|
||||||
// compile-flags: -Z mir-opt-level=3
|
// compile-flags: -Z mir-opt-level=4
|
||||||
|
|
||||||
// Checks that the compiler does not ICE when passing references to field of by-value struct
|
// Checks that the compiler does not ICE when passing references to field of by-value struct
|
||||||
// with -Z mir-opt-level=3
|
// with -Z mir-opt-level=4
|
||||||
|
|
||||||
fn do_nothing(_: &()) {}
|
fn do_nothing(_: &()) {}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// compile-flags: -Z mir-opt-level=2
|
// compile-flags: -Z mir-opt-level=3
|
||||||
// run-pass
|
// run-pass
|
||||||
|
|
||||||
struct Baz<T: ?Sized> {
|
struct Baz<T: ?Sized> {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// compile-flags: -Z mir-opt-level=3
|
// compile-flags: -Z mir-opt-level=4
|
||||||
// run-pass
|
// run-pass
|
||||||
|
|
||||||
struct X {
|
struct X {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// compile-flags: -Z mir-opt-level=2
|
// compile-flags: -Z mir-opt-level=3
|
||||||
// run-pass
|
// run-pass
|
||||||
|
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// compile-flags: -Z mir-opt-level=2
|
// compile-flags: -Z mir-opt-level=3
|
||||||
// run-pass
|
// run-pass
|
||||||
|
|
||||||
fn e220() -> (i64, i64) {
|
fn e220() -> (i64, i64) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// ignore-wasm32-bare which doesn't support `std::process:exit()`
|
// ignore-wasm32-bare which doesn't support `std::process:exit()`
|
||||||
// compile-flags: -Zmir-opt-level=2
|
// compile-flags: -Zmir-opt-level=3
|
||||||
// run-pass
|
// run-pass
|
||||||
|
|
||||||
// Tests that specialization does not cause optimizations running on polymorphic MIR to resolve
|
// Tests that specialization does not cause optimizations running on polymorphic MIR to resolve
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// run-pass
|
// run-pass
|
||||||
|
|
||||||
// compile-flags: -Zmir-opt-level=2
|
// compile-flags: -Zmir-opt-level=3
|
||||||
|
|
||||||
trait IterExt: Iterator {
|
trait IterExt: Iterator {
|
||||||
fn fold_ex<B, F>(mut self, init: B, mut f: F) -> B
|
fn fold_ex<B, F>(mut self, init: B, mut f: F) -> B
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// elaborate-drops invoked on it) and then try to elaboate drops a
|
// elaborate-drops invoked on it) and then try to elaboate drops a
|
||||||
// second time. Uncool.
|
// second time. Uncool.
|
||||||
|
|
||||||
// compile-flags:-Zmir-opt-level=3
|
// compile-flags:-Zmir-opt-level=4
|
||||||
// build-pass
|
// build-pass
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// revisions: default miropt
|
// revisions: default miropt
|
||||||
//[miropt]compile-flags: -Z mir-opt-level=2
|
//[miropt]compile-flags: -Z mir-opt-level=3
|
||||||
// ~^ This flag is for #77668, it used to be ICE.
|
// ~^ This flag is for #77668, it used to be ICE.
|
||||||
|
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// compile-flags: -Zmir-opt-level=2 -Copt-level=0
|
// compile-flags: -Zmir-opt-level=3 -Copt-level=0
|
||||||
// run-pass
|
// run-pass
|
||||||
|
|
||||||
type M = [i64; 2];
|
type M = [i64; 2];
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// edition:2018
|
// edition:2018
|
||||||
// compile-flags: -Z mir-opt-level=2
|
// compile-flags: -Z mir-opt-level=3
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn copy_prop(s: bool) -> String {
|
pub fn copy_prop(s: bool) -> String {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// did not check that the types matched up in the `Ok(r)` branch.
|
// did not check that the types matched up in the `Ok(r)` branch.
|
||||||
//
|
//
|
||||||
// run-pass
|
// run-pass
|
||||||
// compile-flags: -Zmir-opt-level=2
|
// compile-flags: -Zmir-opt-level=3
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq)]
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
enum SpecialsRes { Res(u64) }
|
enum SpecialsRes { Res(u64) }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// compile-flags: -Z mir-opt-level=3
|
// compile-flags: -Z mir-opt-level=4
|
||||||
// build-pass
|
// build-pass
|
||||||
|
|
||||||
// This used to ICE in const-prop due
|
// This used to ICE in const-prop due
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// compile-flags: -Z mir-opt-level=2
|
// compile-flags: -Z mir-opt-level=3
|
||||||
// build-pass
|
// build-pass
|
||||||
|
|
||||||
// This used to ICE due to the inling pass not examining projections
|
// This used to ICE due to the inling pass not examining projections
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// compile-flags: -Z mir-opt-level=2
|
// compile-flags: -Z mir-opt-level=3
|
||||||
// edition:2018
|
// edition:2018
|
||||||
// build-pass
|
// build-pass
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
//
|
//
|
||||||
// check-pass
|
// check-pass
|
||||||
// edition:2018
|
// edition:2018
|
||||||
// compile-args: -Zmir-opt-level=2
|
// compile-args: -Zmir-opt-level=3
|
||||||
|
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// compile-flags: -Z mir-opt-level=2
|
// compile-flags: -Z mir-opt-level=3
|
||||||
// build-pass
|
// build-pass
|
||||||
|
|
||||||
#![feature(type_alias_impl_trait)]
|
#![feature(type_alias_impl_trait)]
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// Regression test for #76248.
|
// Regression test for #76248.
|
||||||
//
|
//
|
||||||
// build-pass
|
// build-pass
|
||||||
// compile-flags: -Zmir-opt-level=2
|
// compile-flags: -Zmir-opt-level=3
|
||||||
|
|
||||||
const N: usize = 1;
|
const N: usize = 1;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
//
|
//
|
||||||
// edition:2018
|
// edition:2018
|
||||||
// build-pass
|
// build-pass
|
||||||
// compile-flags: -Z mir-opt-level=2
|
// compile-flags: -Z mir-opt-level=3
|
||||||
// aux-build:issue_76375_aux.rs
|
// aux-build:issue_76375_aux.rs
|
||||||
|
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Regression test for issue #76740.
|
// Regression test for issue #76740.
|
||||||
// run-pass
|
// run-pass
|
||||||
// compile-flags: -Zmir-opt-level=3
|
// compile-flags: -Zmir-opt-level=4
|
||||||
|
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
pub struct V([usize; 4]);
|
pub struct V([usize; 4]);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// compile-flags: -Z mir-opt-level=2
|
// compile-flags: -Z mir-opt-level=3
|
||||||
// build-pass
|
// build-pass
|
||||||
|
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// run-pass
|
// run-pass
|
||||||
// compile-flags: -Z mir-opt-level=2 -C opt-level=0
|
// compile-flags: -Z mir-opt-level=3 -C opt-level=0
|
||||||
|
|
||||||
// example from #78496
|
// example from #78496
|
||||||
pub enum E<'a> {
|
pub enum E<'a> {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// compile-flags: -Z mir-opt-level=2
|
// compile-flags: -Z mir-opt-level=3
|
||||||
// build-pass
|
// build-pass
|
||||||
|
|
||||||
// This used to ICE in const-prop
|
// This used to ICE in const-prop
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Regression test for issue #79269.
|
// Regression test for issue #79269.
|
||||||
//
|
//
|
||||||
// build-pass
|
// build-pass
|
||||||
// compile-flags: -Zmir-opt-level=2 -Zvalidate-mir
|
// compile-flags: -Zmir-opt-level=3 -Zvalidate-mir
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
struct Array<T, const N: usize>([T; N]);
|
struct Array<T, const N: usize>([T; N]);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// run-pass
|
// run-pass
|
||||||
// compile-flags:-Zmir-opt-level=2
|
// compile-flags:-Zmir-opt-level=3
|
||||||
|
|
||||||
trait Array {
|
trait Array {
|
||||||
type Item;
|
type Item;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// run-pass
|
// run-pass
|
||||||
// compile-flags:-Zmir-opt-level=2
|
// compile-flags:-Zmir-opt-level=3
|
||||||
|
|
||||||
pub enum Enum {
|
pub enum Enum {
|
||||||
A,
|
A,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// run-pass
|
// run-pass
|
||||||
// compile-flags:-Zmir-opt-level=2
|
// compile-flags:-Zmir-opt-level=3
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
let _x: fn() = handle_debug_column;
|
let _x: fn() = handle_debug_column;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// run-pass
|
// run-pass
|
||||||
// compile-flags:-Zmir-opt-level=2
|
// compile-flags:-Zmir-opt-level=3
|
||||||
|
|
||||||
// Previously ICEd because we did not normalize during inlining,
|
// Previously ICEd because we did not normalize during inlining,
|
||||||
// see https://github.com/rust-lang/rust/pull/77306 for more discussion.
|
// see https://github.com/rust-lang/rust/pull/77306 for more discussion.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// run-pass
|
// run-pass
|
||||||
// compile-flags:-Zmir-opt-level=2
|
// compile-flags:-Zmir-opt-level=3
|
||||||
|
|
||||||
struct Cursor {}
|
struct Cursor {}
|
||||||
struct TokenTree {}
|
struct TokenTree {}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// run-pass
|
// run-pass
|
||||||
// compile-flags:-Zmir-opt-level=2
|
// compile-flags:-Zmir-opt-level=3
|
||||||
|
|
||||||
use std::mem::MaybeUninit;
|
use std::mem::MaybeUninit;
|
||||||
const N: usize = 2;
|
const N: usize = 2;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
// Ensures -Zmir-opt-level=2 (specifically, inlining) is not allowed with -Zinstrument-coverage.
|
// Ensures -Zmir-opt-level=3 (specifically, inlining) is not allowed with -Zinstrument-coverage.
|
||||||
// Regression test for issue #80060.
|
// Regression test for issue #80060.
|
||||||
//
|
//
|
||||||
// needs-profiler-support
|
// needs-profiler-support
|
||||||
// build-pass
|
// build-pass
|
||||||
// compile-flags: -Zmir-opt-level=2 -Zinstrument-coverage
|
// compile-flags: -Zmir-opt-level=3 -Zinstrument-coverage
|
||||||
#[inline(never)]
|
#[inline(never)]
|
||||||
fn foo() {}
|
fn foo() {}
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
warning: `-Z mir-opt-level=2` (or any level > 1) enables function inlining, which is incompatible with `-Z instrument-coverage`. Inlining will be disabled.
|
warning: `-Z mir-opt-level=3` (or any level > 1) enables function inlining, which is incompatible with `-Z instrument-coverage`. Inlining will be disabled.
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// run-pass
|
// run-pass
|
||||||
// compile-flags:-Zmir-opt-level=2
|
// compile-flags:-Zmir-opt-level=3
|
||||||
pub trait Foo {
|
pub trait Foo {
|
||||||
fn bar(&self) -> usize { 2 }
|
fn bar(&self) -> usize { 2 }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// run-pass
|
// run-pass
|
||||||
// compile-flags: -Z mir-opt-level=2 -C opt-level=0 -C debuginfo=2
|
// compile-flags: -Z mir-opt-level=3 -C opt-level=0 -C debuginfo=2
|
||||||
|
|
||||||
#[inline(never)]
|
#[inline(never)]
|
||||||
pub fn foo(bar: usize) -> usize {
|
pub fn foo(bar: usize) -> usize {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// compile-flags: -Z mir-opt-level=2
|
// compile-flags: -Z mir-opt-level=3
|
||||||
// build-pass
|
// build-pass
|
||||||
#![crate_type="lib"]
|
#![crate_type="lib"]
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// build-pass
|
// build-pass
|
||||||
// compile-flags: -Z mir-opt-level=3
|
// compile-flags: -Z mir-opt-level=4
|
||||||
|
|
||||||
#![crate_type="lib"]
|
#![crate_type="lib"]
|
||||||
#![feature(lang_items)]
|
#![feature(lang_items)]
|
||||||
|
|
87
src/test/ui/parser/match-arm-without-braces.rs
Normal file
87
src/test/ui/parser/match-arm-without-braces.rs
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
struct S;
|
||||||
|
|
||||||
|
impl S {
|
||||||
|
fn get<K, V: Default>(_: K) -> Option<V> {
|
||||||
|
Default::default()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum Val {
|
||||||
|
Foo,
|
||||||
|
Bar,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for Val {
|
||||||
|
fn default() -> Self {
|
||||||
|
Val::Foo
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
match S::get(1) {
|
||||||
|
Some(Val::Foo) => {}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
match S::get(2) {
|
||||||
|
Some(Val::Foo) => 3; //~ ERROR `match` arm body without braces
|
||||||
|
_ => 4,
|
||||||
|
}
|
||||||
|
match S::get(5) {
|
||||||
|
Some(Val::Foo) =>
|
||||||
|
7; //~ ERROR `match` arm body without braces
|
||||||
|
8;
|
||||||
|
_ => 9,
|
||||||
|
}
|
||||||
|
match S::get(10) {
|
||||||
|
Some(Val::Foo) =>
|
||||||
|
11; //~ ERROR `match` arm body without braces
|
||||||
|
12;
|
||||||
|
_ => (),
|
||||||
|
}
|
||||||
|
match S::get(13) {
|
||||||
|
None => {}
|
||||||
|
Some(Val::Foo) =>
|
||||||
|
14; //~ ERROR `match` arm body without braces
|
||||||
|
15;
|
||||||
|
}
|
||||||
|
match S::get(16) {
|
||||||
|
Some(Val::Foo) => 17
|
||||||
|
_ => 18, //~ ERROR expected one of
|
||||||
|
}
|
||||||
|
match S::get(19) {
|
||||||
|
Some(Val::Foo) =>
|
||||||
|
20; //~ ERROR `match` arm body without braces
|
||||||
|
21
|
||||||
|
_ => 22,
|
||||||
|
}
|
||||||
|
match S::get(23) {
|
||||||
|
Some(Val::Foo) =>
|
||||||
|
24; //~ ERROR `match` arm body without braces
|
||||||
|
25
|
||||||
|
_ => (),
|
||||||
|
}
|
||||||
|
match S::get(26) {
|
||||||
|
None => {}
|
||||||
|
Some(Val::Foo) =>
|
||||||
|
27; //~ ERROR `match` arm body without braces
|
||||||
|
28
|
||||||
|
}
|
||||||
|
match S::get(29) {
|
||||||
|
Some(Val::Foo) =>
|
||||||
|
30; //~ ERROR expected one of
|
||||||
|
31,
|
||||||
|
_ => 32,
|
||||||
|
}
|
||||||
|
match S::get(33) {
|
||||||
|
Some(Val::Foo) =>
|
||||||
|
34; //~ ERROR expected one of
|
||||||
|
35,
|
||||||
|
_ => (),
|
||||||
|
}
|
||||||
|
match S::get(36) {
|
||||||
|
None => {}
|
||||||
|
Some(Val::Foo) =>
|
||||||
|
37; //~ ERROR expected one of
|
||||||
|
38,
|
||||||
|
}
|
||||||
|
}
|
135
src/test/ui/parser/match-arm-without-braces.stderr
Normal file
135
src/test/ui/parser/match-arm-without-braces.stderr
Normal file
|
@ -0,0 +1,135 @@
|
||||||
|
error: `match` arm body without braces
|
||||||
|
--> $DIR/match-arm-without-braces.rs:26:27
|
||||||
|
|
|
||||||
|
LL | Some(Val::Foo) => 3;
|
||||||
|
| -- ^- help: use a comma to end a `match` arm expression: `,`
|
||||||
|
| | |
|
||||||
|
| | this statement is not surrounded by a body
|
||||||
|
| while parsing the `match` arm starting here
|
||||||
|
|
||||||
|
error: `match` arm body without braces
|
||||||
|
--> $DIR/match-arm-without-braces.rs:31:11
|
||||||
|
|
|
||||||
|
LL | Some(Val::Foo) =>
|
||||||
|
| -- while parsing the `match` arm starting here
|
||||||
|
LL | / 7;
|
||||||
|
LL | | 8;
|
||||||
|
| |____________^ these statements are not surrounded by a body
|
||||||
|
|
|
||||||
|
help: surround the statements with a body
|
||||||
|
|
|
||||||
|
LL | { 7;
|
||||||
|
LL | 8; }
|
||||||
|
|
|
||||||
|
|
||||||
|
error: `match` arm body without braces
|
||||||
|
--> $DIR/match-arm-without-braces.rs:37:11
|
||||||
|
|
|
||||||
|
LL | Some(Val::Foo) =>
|
||||||
|
| -- while parsing the `match` arm starting here
|
||||||
|
LL | / 11;
|
||||||
|
LL | | 12;
|
||||||
|
| |_____________^ these statements are not surrounded by a body
|
||||||
|
|
|
||||||
|
help: surround the statements with a body
|
||||||
|
|
|
||||||
|
LL | { 11;
|
||||||
|
LL | 12; }
|
||||||
|
|
|
||||||
|
|
||||||
|
error: `match` arm body without braces
|
||||||
|
--> $DIR/match-arm-without-braces.rs:44:11
|
||||||
|
|
|
||||||
|
LL | Some(Val::Foo) =>
|
||||||
|
| -- while parsing the `match` arm starting here
|
||||||
|
LL | / 14;
|
||||||
|
LL | | 15;
|
||||||
|
| |_____________^ these statements are not surrounded by a body
|
||||||
|
|
|
||||||
|
help: surround the statements with a body
|
||||||
|
|
|
||||||
|
LL | { 14;
|
||||||
|
LL | 15; }
|
||||||
|
|
|
||||||
|
|
||||||
|
error: expected one of `,`, `.`, `?`, `}`, or an operator, found reserved identifier `_`
|
||||||
|
--> $DIR/match-arm-without-braces.rs:49:9
|
||||||
|
|
|
||||||
|
LL | Some(Val::Foo) => 17
|
||||||
|
| -- - expected one of `,`, `.`, `?`, `}`, or an operator
|
||||||
|
| |
|
||||||
|
| while parsing the `match` arm starting here
|
||||||
|
LL | _ => 18,
|
||||||
|
| ^ unexpected token
|
||||||
|
|
||||||
|
error: `match` arm body without braces
|
||||||
|
--> $DIR/match-arm-without-braces.rs:53:11
|
||||||
|
|
|
||||||
|
LL | Some(Val::Foo) =>
|
||||||
|
| -- while parsing the `match` arm starting here
|
||||||
|
LL | / 20;
|
||||||
|
LL | | 21
|
||||||
|
| |____________^ these statements are not surrounded by a body
|
||||||
|
|
|
||||||
|
help: surround the statements with a body
|
||||||
|
|
|
||||||
|
LL | { 20;
|
||||||
|
LL | 21 }
|
||||||
|
|
|
||||||
|
|
||||||
|
error: `match` arm body without braces
|
||||||
|
--> $DIR/match-arm-without-braces.rs:59:11
|
||||||
|
|
|
||||||
|
LL | Some(Val::Foo) =>
|
||||||
|
| -- while parsing the `match` arm starting here
|
||||||
|
LL | / 24;
|
||||||
|
LL | | 25
|
||||||
|
| |____________^ these statements are not surrounded by a body
|
||||||
|
|
|
||||||
|
help: surround the statements with a body
|
||||||
|
|
|
||||||
|
LL | { 24;
|
||||||
|
LL | 25 }
|
||||||
|
|
|
||||||
|
|
||||||
|
error: `match` arm body without braces
|
||||||
|
--> $DIR/match-arm-without-braces.rs:66:11
|
||||||
|
|
|
||||||
|
LL | Some(Val::Foo) =>
|
||||||
|
| -- while parsing the `match` arm starting here
|
||||||
|
LL | / 27;
|
||||||
|
LL | | 28
|
||||||
|
| |____________^ these statements are not surrounded by a body
|
||||||
|
|
|
||||||
|
help: surround the statements with a body
|
||||||
|
|
|
||||||
|
LL | { 27;
|
||||||
|
LL | 28 }
|
||||||
|
|
|
||||||
|
|
||||||
|
error: expected one of `,`, `.`, `?`, `}`, or an operator, found `;`
|
||||||
|
--> $DIR/match-arm-without-braces.rs:71:13
|
||||||
|
|
|
||||||
|
LL | Some(Val::Foo) =>
|
||||||
|
| -- while parsing the `match` arm starting here
|
||||||
|
LL | 30;
|
||||||
|
| ^ expected one of `,`, `.`, `?`, `}`, or an operator
|
||||||
|
|
||||||
|
error: expected one of `,`, `.`, `?`, `}`, or an operator, found `;`
|
||||||
|
--> $DIR/match-arm-without-braces.rs:77:13
|
||||||
|
|
|
||||||
|
LL | Some(Val::Foo) =>
|
||||||
|
| -- while parsing the `match` arm starting here
|
||||||
|
LL | 34;
|
||||||
|
| ^ expected one of `,`, `.`, `?`, `}`, or an operator
|
||||||
|
|
||||||
|
error: expected one of `,`, `.`, `?`, `}`, or an operator, found `;`
|
||||||
|
--> $DIR/match-arm-without-braces.rs:84:13
|
||||||
|
|
|
||||||
|
LL | Some(Val::Foo) =>
|
||||||
|
| -- while parsing the `match` arm starting here
|
||||||
|
LL | 37;
|
||||||
|
| ^ expected one of `,`, `.`, `?`, `}`, or an operator
|
||||||
|
|
||||||
|
error: aborting due to 11 previous errors
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// run-pass
|
// run-pass
|
||||||
// compile-flags: -Zpolymorphize=on -Zmir-opt-level=3
|
// compile-flags: -Zpolymorphize=on -Zmir-opt-level=4
|
||||||
|
|
||||||
fn caller<T, U>() -> &'static usize {
|
fn caller<T, U>() -> &'static usize {
|
||||||
callee::<U>()
|
callee::<U>()
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// run-pass
|
// run-pass
|
||||||
// revisions: default mir-opt
|
// revisions: default mir-opt
|
||||||
//[mir-opt] compile-flags: -Zmir-opt-level=3
|
//[mir-opt] compile-flags: -Zmir-opt-level=4
|
||||||
|
|
||||||
#[inline(never)]
|
#[inline(never)]
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue