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 18 pull requests #113097

Closed
wants to merge 68 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
15d92d6
Add gamma function to f32 and f64
ankane Jul 26, 2022
0415d8d
Fixed CI
ankane Jul 26, 2022
61a73d4
Added tracking issue
ankane Jul 28, 2022
37b3466
Add more tests for gamma function
ankane Aug 2, 2022
f05c188
Fix negative zero tests for gamma function
ankane Aug 2, 2022
5a57f24
Add ln_gamma function to f32 and f64
ankane Mar 5, 2023
6fa99de
Use the LLVM option NoTrapAfterNoreturn
majaha Apr 18, 2023
88ab319
Reapply: Mark drop calls in landing pads cold instead of noinline
erikdesjardins Mar 10, 2022
b127a0f
remove is_rust_llvm check, since fixes are in final llvm 14 release
erikdesjardins Mar 11, 2022
0928728
Add back missing llvm_util import
InnovativeInventor Sep 21, 2022
39ec96f
Address Erik's feedback
InnovativeInventor Nov 24, 2022
e13e645
Add back FIXME for bjorn3
InnovativeInventor Nov 24, 2022
5ca4204
Fix failing test (invoke void %g() is correct behavior)
InnovativeInventor Jan 12, 2023
4773fbc
Revert "Fix failing test (invoke void %g() is correct behavior)"
InnovativeInventor Jan 12, 2023
c975e16
Add regression test for #97217
InnovativeInventor Jan 12, 2023
504c832
Comply with linter
InnovativeInventor Jan 12, 2023
a056883
Add min-llvm-version to regression test
InnovativeInventor Jan 13, 2023
c7083c5
Use min-llvm-version in tests
InnovativeInventor Jan 13, 2023
ed3030c
Add ignore-debug to unwind-landingpad-inline test
InnovativeInventor Feb 4, 2023
bed624d
Remove references to LLVM 14.0.0, which is no longer supported
InnovativeInventor May 15, 2023
0d61104
Remove unnecessary llvm_util import
InnovativeInventor May 15, 2023
e5b84f3
Remove SmallVec
InnovativeInventor May 17, 2023
b1d60bc
refactor executing tests to centralize actually invoking tests
pietroalbini May 26, 2023
fa451fe
remove nested function from run_test
pietroalbini May 26, 2023
2f7fd2e
add StaticBenchAsTestFn and DynBenchAsTestFn to convert benches to tests
pietroalbini May 26, 2023
b82eb28
convert benches to tests in subprocess if we're not benchmarking
pietroalbini May 26, 2023
142f453
add tests on running benchmarks with -Z panic-abort-tests
pietroalbini May 26, 2023
58d9d8c
Revert "Adjusting test to needs-unwind, with linking issue"
pietroalbini May 26, 2023
6c95fa3
Always name the return place.
cjgillot May 15, 2023
2c69f27
Restrict test to opaque pointers.
cjgillot May 24, 2023
7e75612
Assume less names.
cjgillot May 29, 2023
5505f91
Fix 111905
c410-f3r Jun 18, 2023
462c5c4
Update LLVM submodule
Amanieu Jun 19, 2023
dc76991
Remove `LineColumn`, `Span::start`, `Span::end`
jhpratt May 14, 2023
87ec073
`Span::{before, after}` → `Span::{start, end}`
jhpratt May 14, 2023
a1cd8c3
Add `Span::{line, column}`
jhpratt May 14, 2023
8dc3b85
Fix tests
jhpratt May 14, 2023
cd1c1b1
Update to proc-macro2 1.0.57 to unblock proc_macro_span changes
dtolnay May 15, 2023
abd0677
Merge proc_macro_span_shrink and proc_macro_span
jhpratt Jun 6, 2023
21d9fd7
Delete use of proc_macro_span_shrink from proc-macro2
dtolnay Jun 8, 2023
6159075
Remove outdated import in r-a proc macro server.
m-ou-se Jun 21, 2023
d1f68ea
Better diagnostics for dlltool errors.
jfgoog Jun 13, 2023
c37afcd
Enable zlib in LLVM on aarch64-apple-darwin
cbeuw Jun 22, 2023
9fc2da1
Forward `io::{Read,Seek,Write}` impls of `File` to `&File`
tbu- Dec 31, 2022
11fecf6
Add `Read`, `Write` and `Seek` impls for `Arc<File>` where appropriate
tbu- Dec 31, 2022
d43131b
Bump download-ci-llvm-stamp
cbeuw Jun 24, 2023
fbb2079
Use `CoverageKind::as_operand_id` instead of manually reimplementing it
Zalathar Jun 26, 2023
3224ea4
Export AnalysisResults trait in rustc_mir_dataflow
floriangru Jun 27, 2023
48544c1
Make `rustc_on_unimplemented` std-agnostic
Rageking8 Jun 26, 2023
b8e4c54
Fix invalid HTML DIV tag used in HEAD
GuillaumeGomez Jun 27, 2023
1b7efb5
remove an unused struct `ForbiddenNonLifetimeParam`
TaKO8Ki Jun 27, 2023
8352c02
avoid using `format!("{}", ..)`
TaKO8Ki Jun 27, 2023
1dba5af
Rollup merge of #94748 - tbu-:pr_file_arc, r=Amanieu
TaKO8Ki Jun 27, 2023
448a75b
Rollup merge of #99747 - ankane:float_gamma, r=joshtriplett
TaKO8Ki Jun 27, 2023
047dd55
Rollup merge of #102099 - InnovativeInventor:re-cold-land, r=nikic
TaKO8Ki Jun 27, 2023
7a9bfd4
Rollup merge of #110494 - majaha:noTrapAfterNoreturn, r=nikic
TaKO8Ki Jun 27, 2023
90adbdc
Rollup merge of #111571 - jhpratt:proc-macro-span, r=m-ou-se
TaKO8Ki Jun 27, 2023
a5f5328
Rollup merge of #111618 - cjgillot:name-return-place, r=tmiasko
TaKO8Ki Jun 27, 2023
1817bb2
Rollup merge of #111923 - c410-f3r:impl, r=oli-obk
TaKO8Ki Jun 27, 2023
1d7f087
Rollup merge of #111992 - ferrocene:pa-panic-abort-tests-bench, r=m-o…
TaKO8Ki Jun 27, 2023
270ee72
Rollup merge of #112591 - jfgoog:better-dlltool-diagnostics, r=Waffle…
TaKO8Ki Jun 27, 2023
22681be
Rollup merge of #112816 - Amanieu:llvm-riscv-arch, r=cuviper
TaKO8Ki Jun 27, 2023
0c200a4
Rollup merge of #112931 - cbeuw:apple-zlib, r=Mark-Simulacrum
TaKO8Ki Jun 27, 2023
b6cf0ac
Rollup merge of #113054 - Rageking8:make-`rustc_on_unimplemented`-std…
TaKO8Ki Jun 27, 2023
10f2b9b
Rollup merge of #113079 - Zalathar:as-operand-id, r=oli-obk
TaKO8Ki Jun 27, 2023
3493d5d
Rollup merge of #113089 - floriangru:mut_analyses_followup, r=oli-obk
TaKO8Ki Jun 27, 2023
6e6a1bb
Rollup merge of #113094 - GuillaumeGomez:fix-invalid-div-tag-in-head,…
TaKO8Ki Jun 27, 2023
9257837
Rollup merge of #113096 - TaKO8Ki:remove-unused-struct, r=oli-obk
TaKO8Ki Jun 27, 2023
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
4 changes: 2 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2580,9 +2580,9 @@ checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"

[[package]]
name = "proc-macro2"
version = "1.0.56"
version = "1.0.60"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435"
checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406"
dependencies = [
"unicode-ident",
]
Expand Down
7 changes: 0 additions & 7 deletions compiler/rustc_ast_passes/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,6 @@ pub struct ForbiddenLifetimeBound {
pub spans: Vec<Span>,
}

#[derive(Diagnostic)]
#[diag(ast_passes_forbidden_non_lifetime_param)]
pub struct ForbiddenNonLifetimeParam {
#[primary_span]
pub spans: Vec<Span>,
}

#[derive(Diagnostic)]
#[diag(ast_passes_fn_param_too_many)]
pub struct FnParamTooMany {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_gcc/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1421,7 +1421,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
self.cx
}

fn do_not_inline(&mut self, _llret: RValue<'gcc>) {
fn apply_attrs_to_cleanup_callsite(&mut self, _llret: RValue<'gcc>) {
// FIXME(bjorn3): implement
}

Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_codegen_llvm/messages.ftl
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
codegen_llvm_copy_bitcode = failed to copy bitcode to object file: {$err}

codegen_llvm_dlltool_fail_import_library =
Dlltool could not create import library: {$stdout}
Dlltool could not create import library with {$dlltool_path} {$dlltool_args}:
{$stdout}
{$stderr}

codegen_llvm_dynamic_linking_with_lto =
Expand Down
43 changes: 24 additions & 19 deletions compiler/rustc_codegen_llvm/src/back/archive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,25 +198,24 @@ impl ArchiveBuilderBuilder for LlvmArchiveBuilderBuilder {
"arm" => ("arm", "--32"),
_ => panic!("unsupported arch {}", sess.target.arch),
};
let result = std::process::Command::new(&dlltool)
.args([
"-d",
def_file_path.to_str().unwrap(),
"-D",
lib_name,
"-l",
output_path.to_str().unwrap(),
"-m",
dlltool_target_arch,
"-f",
dlltool_target_bitness,
"--no-leading-underscore",
"--temp-prefix",
temp_prefix.to_str().unwrap(),
])
.output();

match result {
let mut dlltool_cmd = std::process::Command::new(&dlltool);
dlltool_cmd.args([
"-d",
def_file_path.to_str().unwrap(),
"-D",
lib_name,
"-l",
output_path.to_str().unwrap(),
"-m",
dlltool_target_arch,
"-f",
dlltool_target_bitness,
"--no-leading-underscore",
"--temp-prefix",
temp_prefix.to_str().unwrap(),
]);

match dlltool_cmd.output() {
Err(e) => {
sess.emit_fatal(ErrorCallingDllTool {
dlltool_path: dlltool.to_string_lossy(),
Expand All @@ -226,6 +225,12 @@ impl ArchiveBuilderBuilder for LlvmArchiveBuilderBuilder {
// dlltool returns '0' on failure, so check for error output instead.
Ok(output) if !output.stderr.is_empty() => {
sess.emit_fatal(DlltoolFailImportLibrary {
dlltool_path: dlltool.to_string_lossy(),
dlltool_args: dlltool_cmd
.get_args()
.map(|arg| arg.to_string_lossy())
.collect::<Vec<_>>()
.join(" "),
stdout: String::from_utf8_lossy(&output.stdout),
stderr: String::from_utf8_lossy(&output.stderr),
})
Expand Down
8 changes: 5 additions & 3 deletions compiler/rustc_codegen_llvm/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1221,9 +1221,11 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
unsafe { llvm::LLVMBuildZExt(self.llbuilder, val, dest_ty, UNNAMED) }
}

fn do_not_inline(&mut self, llret: &'ll Value) {
let noinline = llvm::AttributeKind::NoInline.create_attr(self.llcx);
attributes::apply_to_callsite(llret, llvm::AttributePlace::Function, &[noinline]);
fn apply_attrs_to_cleanup_callsite(&mut self, llret: &'ll Value) {
// Cleanup is always the cold path.
let cold_inline = llvm::AttributeKind::Cold.create_attr(self.llcx);

attributes::apply_to_callsite(llret, llvm::AttributePlace::Function, &[cold_inline]);
}
}

Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_codegen_llvm/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ pub(crate) struct ErrorCallingDllTool<'a> {
#[derive(Diagnostic)]
#[diag(codegen_llvm_dlltool_fail_import_library)]
pub(crate) struct DlltoolFailImportLibrary<'a> {
pub dlltool_path: Cow<'a, str>,
pub dlltool_args: String,
pub stdout: Cow<'a, str>,
pub stderr: Cow<'a, str>,
}
Expand Down
10 changes: 3 additions & 7 deletions compiler/rustc_codegen_ssa/src/mir/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ impl<'a, 'tcx> TerminatorCodegenHelper<'tcx> {
self.funclet(fx),
);
if fx.mir[self.bb].is_cleanup {
bx.do_not_inline(invokeret);
bx.apply_attrs_to_cleanup_callsite(invokeret);
}

if let Some((ret_dest, target)) = destination {
Expand All @@ -219,11 +219,7 @@ impl<'a, 'tcx> TerminatorCodegenHelper<'tcx> {
} else {
let llret = bx.call(fn_ty, fn_attrs, Some(&fn_abi), fn_ptr, &llargs, self.funclet(fx));
if fx.mir[self.bb].is_cleanup {
// Cleanup is always the cold path. Don't inline
// drop glue. Also, when there is a deeply-nested
// struct, there are "symmetry" issues that cause
// exponential inlining - see issue #41696.
bx.do_not_inline(llret);
bx.apply_attrs_to_cleanup_callsite(llret);
}

if let Some((ret_dest, target)) = destination {
Expand Down Expand Up @@ -1618,7 +1614,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
let fn_ty = bx.fn_decl_backend_type(&fn_abi);

let llret = bx.call(fn_ty, None, Some(&fn_abi), fn_ptr, &[], funclet.as_ref());
bx.do_not_inline(llret);
bx.apply_attrs_to_cleanup_callsite(llret);

bx.unreachable();

Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_codegen_ssa/src/mir/debuginfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {

let local_ref = &self.locals[local];

// FIXME Should the return place be named?
let name = if bx.sess().fewer_names() || local == mir::RETURN_PLACE {
let name = if bx.sess().fewer_names() {
None
} else {
Some(match whole_local_var.or(fallback_var.clone()) {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/src/traits/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,5 +332,5 @@ pub trait BuilderMethods<'a, 'tcx>:
) -> Self::Value;
fn zext(&mut self, val: Self::Value, dest_ty: Self::Type) -> Self::Value;

fn do_not_inline(&mut self, llret: Self::Value);
fn apply_attrs_to_cleanup_callsite(&mut self, llret: Self::Value);
}
2 changes: 2 additions & 0 deletions compiler/rustc_expand/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ expand_meta_var_dif_seq_matchers = {$msg}
expand_meta_var_expr_unrecognized_var =
variable `{$key}` is not recognized in meta-variable expression

expand_missing_count_fragment =
related fragment that refers the `count` meta-variable expression was not found
expand_module_circular =
circular modules: {$modules}

Expand Down
7 changes: 7 additions & 0 deletions compiler/rustc_expand/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,3 +407,10 @@ pub struct DuplicateMatcherBinding {
#[label(expand_label2)]
pub prev: Span,
}

#[derive(Diagnostic)]
#[diag(expand_missing_count_fragment)]
pub(crate) struct MissingCountFragment {
#[primary_span]
pub span: Span,
}
2 changes: 1 addition & 1 deletion compiler/rustc_expand/src/mbe/metavar_expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use rustc_span::Span;
#[derive(Debug, Clone, PartialEq, Encodable, Decodable)]
pub(crate) enum MetaVarExpr {
/// The number of repetitions of an identifier, optionally limited to a number
/// of outer-most repetition depths. If the depth limit is `None` then the depth is unlimited.
/// of outer-most repetition depths.
Count(Ident, Option<usize>),

/// Ignore a meta-variable for repetition without expansion.
Expand Down
9 changes: 6 additions & 3 deletions compiler/rustc_expand/src/mbe/transcribe.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::base::ExtCtxt;
use crate::errors::{
CountRepetitionMisplaced, MetaVarExprUnrecognizedVar, MetaVarsDifSeqMatchers, MustRepeatOnce,
NoSyntaxVarsExprRepeat, VarStillRepeating,
CountRepetitionMisplaced, MetaVarExprUnrecognizedVar, MetaVarsDifSeqMatchers,
MissingCountFragment, MustRepeatOnce, NoSyntaxVarsExprRepeat, VarStillRepeating,
};
use crate::mbe::macro_parser::{MatchedNonterminal, MatchedSeq, MatchedTokenTree, NamedMatch};
use crate::mbe::{self, MetaVarExpr};
Expand Down Expand Up @@ -448,6 +448,9 @@ fn count_repetitions<'a>(
}
}
MatchedSeq(named_matches) => {
if named_matches.is_empty() {
return Err(cx.create_err(MissingCountFragment { span: sp.entire() }));
}
let new_declared_lhs_depth = declared_lhs_depth + 1;
match depth_opt {
None => named_matches
Expand Down Expand Up @@ -506,7 +509,7 @@ fn out_of_bounds_err<'a>(
)
} else {
format!(
"depth parameter on meta-variable expression `{ty}` \
"depth parameter of meta-variable expression `{ty}` \
must be less than {max}"
)
};
Expand Down
23 changes: 11 additions & 12 deletions compiler/rustc_expand/src/proc_macro_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::base::ExtCtxt;
use pm::bridge::{
server, DelimSpan, Diagnostic, ExpnGlobals, Group, Ident, LitKind, Literal, Punct, TokenTree,
};
use pm::{Delimiter, Level, LineColumn};
use pm::{Delimiter, Level};
use rustc_ast as ast;
use rustc_ast::token;
use rustc_ast::tokenstream::{self, Spacing::*, TokenStream};
Expand Down Expand Up @@ -648,23 +648,22 @@ impl server::Span for Rustc<'_, '_> {

Range { start: relative_start_pos.0 as usize, end: relative_end_pos.0 as usize }
}

fn start(&mut self, span: Self::Span) -> LineColumn {
let loc = self.sess().source_map().lookup_char_pos(span.lo());
LineColumn { line: loc.line, column: loc.col.to_usize() }
fn start(&mut self, span: Self::Span) -> Self::Span {
span.shrink_to_lo()
}

fn end(&mut self, span: Self::Span) -> LineColumn {
let loc = self.sess().source_map().lookup_char_pos(span.hi());
LineColumn { line: loc.line, column: loc.col.to_usize() }
fn end(&mut self, span: Self::Span) -> Self::Span {
span.shrink_to_hi()
}

fn before(&mut self, span: Self::Span) -> Self::Span {
span.shrink_to_lo()
fn line(&mut self, span: Self::Span) -> usize {
let loc = self.sess().source_map().lookup_char_pos(span.lo());
loc.line
}

fn after(&mut self, span: Self::Span) -> Self::Span {
span.shrink_to_hi()
fn column(&mut self, span: Self::Span) -> usize {
let loc = self.sess().source_map().lookup_char_pos(span.lo());
loc.col.to_usize() + 1
}

fn join(&mut self, first: Self::Span, second: Self::Span) -> Option<Self::Span> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
tcx,
generics,
diag,
&format!("{}", proj.self_ty()),
&proj.self_ty().to_string(),
&path,
None,
matching_span,
Expand All @@ -153,7 +153,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
tcx,
generics,
diag,
&format!("{}", proj.self_ty()),
&proj.self_ty().to_string(),
&path,
None,
matching_span,
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,8 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
// it prevents control flow from "falling through" into whatever code
// happens to be laid out next in memory.
Options.TrapUnreachable = true;
// But don't emit traps after other traps or no-returns unnecessarily.
Options.NoTrapAfterNoreturn = true;
}

if (Singlethread) {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_dataflow/src/framework/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub mod graphviz;
pub mod lattice;
mod visitor;

pub use self::cursor::{ResultsClonedCursor, ResultsCursor, ResultsRefCursor};
pub use self::cursor::{AnalysisResults, ResultsClonedCursor, ResultsCursor, ResultsRefCursor};
pub use self::direction::{Backward, Direction, Forward};
pub use self::engine::{Engine, EntrySets, Results, ResultsCloned};
pub use self::lattice::{JoinSemiLattice, MeetSemiLattice};
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_mir_dataflow/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ pub use self::drop_flag_effects::{
on_lookup_result_bits,
};
pub use self::framework::{
fmt, graphviz, lattice, visit_results, Analysis, AnalysisDomain, Backward, CallReturnPlaces,
CloneAnalysis, Direction, Engine, Forward, GenKill, GenKillAnalysis, JoinSemiLattice, Results,
ResultsCloned, ResultsClonedCursor, ResultsCursor, ResultsRefCursor, ResultsVisitable,
ResultsVisitor, SwitchIntEdgeEffects,
fmt, graphviz, lattice, visit_results, Analysis, AnalysisDomain, AnalysisResults, Backward,
CallReturnPlaces, CloneAnalysis, Direction, Engine, Forward, GenKill, GenKillAnalysis,
JoinSemiLattice, Results, ResultsCloned, ResultsClonedCursor, ResultsCursor, ResultsRefCursor,
ResultsVisitable, ResultsVisitor, SwitchIntEdgeEffects,
};

use self::move_paths::MoveData;
Expand Down
17 changes: 2 additions & 15 deletions compiler/rustc_mir_transform/src/coverage/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,14 +277,7 @@ impl DebugCounters {

pub fn add_counter(&mut self, counter_kind: &CoverageKind, some_block_label: Option<String>) {
if let Some(counters) = &mut self.some_counters {
let id: ExpressionOperandId = match *counter_kind {
CoverageKind::Counter { id, .. } => id.into(),
CoverageKind::Expression { id, .. } => id.into(),
_ => bug!(
"the given `CoverageKind` is not an counter or expression: {:?}",
counter_kind
),
};
let id = counter_kind.as_operand_id();
counters
.try_insert(id, DebugCounter::new(counter_kind.clone(), some_block_label))
.expect("attempt to add the same counter_kind to DebugCounters more than once");
Expand Down Expand Up @@ -330,13 +323,7 @@ impl DebugCounters {
}
}

let id: ExpressionOperandId = match *counter_kind {
CoverageKind::Counter { id, .. } => id.into(),
CoverageKind::Expression { id, .. } => id.into(),
_ => {
bug!("the given `CoverageKind` is not an counter or expression: {:?}", counter_kind)
}
};
let id = counter_kind.as_operand_id();
if self.some_counters.is_some() && (counter_format.block || !counter_format.id) {
let counters = self.some_counters.as_ref().unwrap();
if let Some(DebugCounter { some_block_label: Some(block_label), .. }) =
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/convert/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ pub trait Into<T>: Sized {
#[rustc_diagnostic_item = "From"]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_on_unimplemented(on(
all(_Self = "&str", T = "std::string::String"),
all(_Self = "&str", any(T = "alloc::string::String", T = "std::string::String")),
note = "to coerce a `{T}` into a `{Self}`, use `&*` as a prefix",
))]
pub trait From<T>: Sized {
Expand Down
8 changes: 4 additions & 4 deletions library/core/src/iter/traits/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ fn _assert_is_object_safe(_: &dyn Iterator<Item = ()>) {}
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_on_unimplemented(
on(
_Self = "std::ops::RangeTo<Idx>",
any(_Self = "core::ops::RangeTo<Idx>", _Self = "std::ops::RangeTo<Idx>"),
label = "if you meant to iterate until a value, add a starting value",
note = "`..end` is a `RangeTo`, which cannot be iterated on; you might have meant to have a \
bounded `Range`: `0..end`"
),
on(
_Self = "std::ops::RangeToInclusive<Idx>",
any(_Self = "core::ops::RangeToInclusive<Idx>", _Self = "std::ops::RangeToInclusive<Idx>"),
label = "if you meant to iterate until a value (including it), add a starting value",
note = "`..=end` is a `RangeToInclusive`, which cannot be iterated on; you might have meant \
to have a bounded `RangeInclusive`: `0..=end`"
Expand All @@ -43,15 +43,15 @@ fn _assert_is_object_safe(_: &dyn Iterator<Item = ()>) {}
),
on(_Self = "&[]", label = "`{Self}` is not an iterator; try calling `.iter()`"),
on(
_Self = "std::vec::Vec<T, A>",
any(_Self = "alloc::vec::Vec<T, A>", _Self = "std::vec::Vec<T, A>"),
label = "`{Self}` is not an iterator; try calling `.into_iter()` or `.iter()`"
),
on(
_Self = "&str",
label = "`{Self}` is not an iterator; try calling `.chars()` or `.bytes()`"
),
on(
_Self = "std::string::String",
any(_Self = "alloc::string::String", _Self = "std::string::String"),
label = "`{Self}` is not an iterator; try calling `.chars()` or `.bytes()`"
),
on(
Expand Down
Loading
Loading