Skip to content

Commit 82b804c

Browse files
committed
Auto merge of #118023 - matthiaskrgr:rollup-i9skwic, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #117338 (Remove asmjs) - #117549 (Use `copied` instead of manual `map`) - #117745 (Emit smir) - #117964 (When using existing fn as module, don't claim it doesn't exist) - #118006 (clarify `fn discriminant` guarantees: only free lifetimes may get erased) - #118016 (Add stable mir members to triagebot config) - #118022 (Miri subtree update) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 2831701 + 8acb27c commit 82b804c

File tree

92 files changed

+644
-304
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+644
-304
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3815,6 +3815,7 @@ dependencies = [
38153815
"rustc_query_system",
38163816
"rustc_resolve",
38173817
"rustc_session",
3818+
"rustc_smir",
38183819
"rustc_span",
38193820
"rustc_symbol_mangling",
38203821
"rustc_target",

compiler/rustc_ast_lowering/src/expr.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
4242
}
4343
// Merge attributes into the inner expression.
4444
if !e.attrs.is_empty() {
45-
let old_attrs =
46-
self.attrs.get(&ex.hir_id.local_id).map(|la| *la).unwrap_or(&[]);
45+
let old_attrs = self.attrs.get(&ex.hir_id.local_id).copied().unwrap_or(&[]);
4746
self.attrs.insert(
4847
ex.hir_id.local_id,
4948
&*self.arena.alloc_from_iter(

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
499499
/// Given the id of some node in the AST, finds the `LocalDefId` associated with it by the name
500500
/// resolver (if any).
501501
fn orig_opt_local_def_id(&self, node: NodeId) -> Option<LocalDefId> {
502-
self.resolver.node_id_to_def_id.get(&node).map(|local_def_id| *local_def_id)
502+
self.resolver.node_id_to_def_id.get(&node).copied()
503503
}
504504

505505
/// Given the id of some node in the AST, finds the `LocalDefId` associated with it by the name
@@ -542,7 +542,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
542542
self.generics_def_id_map
543543
.iter()
544544
.rev()
545-
.find_map(|map| map.get(&local_def_id).map(|local_def_id| *local_def_id))
545+
.find_map(|map| map.get(&local_def_id).copied())
546546
.unwrap_or(local_def_id)
547547
}
548548

compiler/rustc_codegen_llvm/src/back/write.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -990,11 +990,7 @@ unsafe fn embed_bitcode(
990990
// reason (see issue #90326 for historical background).
991991
let is_aix = target_is_aix(cgcx);
992992
let is_apple = target_is_apple(cgcx);
993-
if is_apple
994-
|| is_aix
995-
|| cgcx.opts.target_triple.triple().starts_with("wasm")
996-
|| cgcx.opts.target_triple.triple().starts_with("asmjs")
997-
{
993+
if is_apple || is_aix || cgcx.opts.target_triple.triple().starts_with("wasm") {
998994
// We don't need custom section flags, create LLVM globals.
999995
let llconst = common::bytes_in_context(llcx, bitcode);
1000996
let llglobal = llvm::LLVMAddGlobal(

compiler/rustc_codegen_ssa/src/back/link.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2243,9 +2243,9 @@ fn linker_with_args<'a>(
22432243
// ------------ Late order-dependent options ------------
22442244

22452245
// Doesn't really make sense.
2246-
// FIXME: In practice built-in target specs use this for arbitrary order-independent options,
2247-
// introduce a target spec option for order-independent linker options, migrate built-in specs
2248-
// to it and remove the option.
2246+
// FIXME: In practice built-in target specs use this for arbitrary order-independent options.
2247+
// Introduce a target spec option for order-independent linker options, migrate built-in specs
2248+
// to it and remove the option. Currently the last holdout is wasm32-unknown-emscripten.
22492249
add_post_link_args(cmd, sess, flavor);
22502250

22512251
Ok(cmd.take_cmd())

compiler/rustc_driver_impl/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ rustc_privacy = { path = "../rustc_privacy" }
4343
rustc_query_system = { path = "../rustc_query_system" }
4444
rustc_resolve = { path = "../rustc_resolve" }
4545
rustc_session = { path = "../rustc_session" }
46+
rustc_smir ={ path = "../rustc_smir" }
4647
rustc_span = { path = "../rustc_span" }
4748
rustc_symbol_mangling = { path = "../rustc_symbol_mangling" }
4849
rustc_target = { path = "../rustc_target" }

compiler/rustc_driver_impl/src/pretty.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use rustc_middle::mir::{write_mir_graphviz, write_mir_pretty};
99
use rustc_middle::ty::{self, TyCtxt};
1010
use rustc_session::config::{OutFileName, PpHirMode, PpMode, PpSourceMode};
1111
use rustc_session::Session;
12+
use rustc_smir::rustc_internal::pretty::write_smir_pretty;
1213
use rustc_span::symbol::Ident;
1314
use rustc_span::FileName;
1415

@@ -325,6 +326,11 @@ pub fn print<'tcx>(sess: &Session, ppm: PpMode, ex: PrintExtra<'tcx>) {
325326
write_mir_graphviz(ex.tcx(), None, &mut out).unwrap();
326327
String::from_utf8(out).unwrap()
327328
}
329+
StableMir => {
330+
let mut out = Vec::new();
331+
write_smir_pretty(ex.tcx(), &mut out).unwrap();
332+
String::from_utf8(out).unwrap()
333+
}
328334
ThirTree => {
329335
let tcx = ex.tcx();
330336
let mut out = String::new();

compiler/rustc_infer/src/infer/error_reporting/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
860860
self.suggest_boxing_for_return_impl_trait(
861861
err,
862862
ret_sp,
863-
prior_arms.iter().chain(std::iter::once(&arm_span)).map(|s| *s),
863+
prior_arms.iter().chain(std::iter::once(&arm_span)).copied(),
864864
);
865865
}
866866
}

compiler/rustc_lint/src/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ pub trait LintContext {
703703
db.note("see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information");
704704
},
705705
BuiltinLintDiagnostics::UnexpectedCfgName((name, name_span), value) => {
706-
let possibilities: Vec<Symbol> = sess.parse_sess.check_config.expecteds.keys().map(|s| *s).collect();
706+
let possibilities: Vec<Symbol> = sess.parse_sess.check_config.expecteds.keys().copied().collect();
707707

708708
// Suggest the most probable if we found one
709709
if let Some(best_match) = find_best_match_for_name(&possibilities, name, None) {

compiler/rustc_middle/src/mir/pretty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1337,7 +1337,7 @@ pub fn write_allocations<'tcx>(
13371337
fn alloc_ids_from_alloc(
13381338
alloc: ConstAllocation<'_>,
13391339
) -> impl DoubleEndedIterator<Item = AllocId> + '_ {
1340-
alloc.inner().provenance().ptrs().values().map(|id| *id)
1340+
alloc.inner().provenance().ptrs().values().copied()
13411341
}
13421342

13431343
fn alloc_ids_from_const_val(val: ConstValue<'_>) -> impl Iterator<Item = AllocId> + '_ {

0 commit comments

Comments
 (0)