Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 7c429b9

Browse files
committed
Auto merge of rust-lang#136752 - workingjubilee:rollup-zi40nso, r=workingjubilee
Rollup of 13 pull requests Successful merges: - rust-lang#134999 (Add cygwin target.) - rust-lang#135439 (Make `-O` mean `OptLevel::Aggressive`) - rust-lang#136397 (Add a comment pointing to ICE-136223) - rust-lang#136681 (resolve `llvm-config` path properly on cross builds) - rust-lang#136686 (Clean up `HashMap` and `HashSet` docs.) - rust-lang#136694 (Update minifier version to `0.3.4`) - rust-lang#136706 (compiler: mostly-finish `rustc_abi` updates) - rust-lang#136710 (Document `Sum::sum` returns additive identities for `[]`) - rust-lang#136724 (Make `AsyncFnOnce`, `AsyncFnMut`, `AsyncFn` non-`#[fundamental]`) - rust-lang#136727 (Have a break from review rotation) - rust-lang#136730 (transmutability: fix ICE when passing wrong ADT to ASSUME) - rust-lang#136736 (Small resolve refactor) - rust-lang#136746 (Emit an error if `-Zdwarf-version=1` is requested) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 43ca9d1 + 9d443d8 commit 7c429b9

File tree

157 files changed

+619
-260
lines changed

Some content is hidden

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

157 files changed

+619
-260
lines changed

Cargo.lock

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2322,9 +2322,9 @@ dependencies = [
23222322

23232323
[[package]]
23242324
name = "minifier"
2325-
version = "0.3.2"
2325+
version = "0.3.4"
23262326
source = "registry+https://github.com/rust-lang/crates.io-index"
2327-
checksum = "bd559bbf5d350ac7f2c1cf92ed71a869b847a92bce0c1318b47932a5b5f65cdd"
2327+
checksum = "1cf47565b1430f5fe6c81d3afcb4b835271348d7eb35294a4d592e38dd09ea22"
23282328

23292329
[[package]]
23302330
name = "minimal-lexical"
@@ -3400,6 +3400,7 @@ dependencies = [
34003400
name = "rustc_ast_lowering"
34013401
version = "0.0.0"
34023402
dependencies = [
3403+
"rustc_abi",
34033404
"rustc_ast",
34043405
"rustc_ast_pretty",
34053406
"rustc_data_structures",
@@ -3422,6 +3423,7 @@ name = "rustc_ast_passes"
34223423
version = "0.0.0"
34233424
dependencies = [
34243425
"itertools",
3426+
"rustc_abi",
34253427
"rustc_ast",
34263428
"rustc_ast_pretty",
34273429
"rustc_attr_parsing",
@@ -4015,6 +4017,7 @@ version = "0.0.0"
40154017
dependencies = [
40164018
"rustc-rayon",
40174019
"rustc-rayon-core",
4020+
"rustc_abi",
40184021
"rustc_ast",
40194022
"rustc_ast_lowering",
40204023
"rustc_ast_passes",

compiler/rustc_ast/src/ast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3225,7 +3225,7 @@ pub enum Extern {
32253225
///
32263226
/// E.g. `extern fn foo() {}`.
32273227
///
3228-
/// This is just `extern "C"` (see `rustc_target::spec::abi::Abi::FALLBACK`).
3228+
/// This is just `extern "C"` (see `rustc_abi::ExternAbi::FALLBACK`).
32293229
Implicit(Span),
32303230
/// An explicit extern keyword was used with an explicit ABI.
32313231
///

compiler/rustc_ast_lowering/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ doctest = false
88

99
[dependencies]
1010
# tidy-alphabetical-start
11+
rustc_abi = { path = "../rustc_abi" }
1112
rustc_ast = { path = "../rustc_ast" }
1213
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
1314
rustc_data_structures = { path = "../rustc_data_structures" }

compiler/rustc_ast_lowering/src/item.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use rustc_abi::ExternAbi;
12
use rustc_ast::ptr::P;
23
use rustc_ast::visit::AssocCtxt;
34
use rustc_ast::*;
@@ -11,7 +12,6 @@ use rustc_middle::span_bug;
1112
use rustc_middle::ty::{ResolverAstLowering, TyCtxt};
1213
use rustc_span::edit_distance::find_best_match_for_name;
1314
use rustc_span::{DesugaringKind, Ident, Span, Symbol, kw, sym};
14-
use rustc_target::spec::abi;
1515
use smallvec::{SmallVec, smallvec};
1616
use thin_vec::ThinVec;
1717
use tracing::instrument;
@@ -275,7 +275,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
275275
ModKind::Unloaded => panic!("`mod` items should have been loaded by now"),
276276
},
277277
ItemKind::ForeignMod(fm) => hir::ItemKind::ForeignMod {
278-
abi: fm.abi.map_or(abi::Abi::FALLBACK, |abi| self.lower_abi(abi)),
278+
abi: fm.abi.map_or(ExternAbi::FALLBACK, |abi| self.lower_abi(abi)),
279279
items: self
280280
.arena
281281
.alloc_from_iter(fm.items.iter().map(|x| self.lower_foreign_item_ref(x))),
@@ -1470,23 +1470,23 @@ impl<'hir> LoweringContext<'_, 'hir> {
14701470
}
14711471
}
14721472

1473-
pub(super) fn lower_abi(&mut self, abi: StrLit) -> abi::Abi {
1474-
abi::lookup(abi.symbol_unescaped.as_str()).unwrap_or_else(|err| {
1473+
pub(super) fn lower_abi(&mut self, abi: StrLit) -> ExternAbi {
1474+
rustc_abi::lookup(abi.symbol_unescaped.as_str()).unwrap_or_else(|err| {
14751475
self.error_on_invalid_abi(abi, err);
1476-
abi::Abi::Rust
1476+
ExternAbi::Rust
14771477
})
14781478
}
14791479

1480-
pub(super) fn lower_extern(&mut self, ext: Extern) -> abi::Abi {
1480+
pub(super) fn lower_extern(&mut self, ext: Extern) -> ExternAbi {
14811481
match ext {
1482-
Extern::None => abi::Abi::Rust,
1483-
Extern::Implicit(_) => abi::Abi::FALLBACK,
1482+
Extern::None => ExternAbi::Rust,
1483+
Extern::Implicit(_) => ExternAbi::FALLBACK,
14841484
Extern::Explicit(abi, _) => self.lower_abi(abi),
14851485
}
14861486
}
14871487

1488-
fn error_on_invalid_abi(&self, abi: StrLit, err: abi::AbiUnsupported) {
1489-
let abi_names = abi::enabled_names(self.tcx.features(), abi.span)
1488+
fn error_on_invalid_abi(&self, abi: StrLit, err: rustc_abi::AbiUnsupported) {
1489+
let abi_names = rustc_abi::enabled_names(self.tcx.features(), abi.span)
14901490
.iter()
14911491
.map(|s| Symbol::intern(s))
14921492
.collect::<Vec<_>>();
@@ -1495,7 +1495,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
14951495
abi: abi.symbol_unescaped,
14961496
span: abi.span,
14971497
explain: match err {
1498-
abi::AbiUnsupported::Reason { explain } => Some(InvalidAbiReason(explain)),
1498+
rustc_abi::AbiUnsupported::Reason { explain } => Some(InvalidAbiReason(explain)),
14991499
_ => None,
15001500
},
15011501
suggestion: suggested_name.map(|suggested_name| InvalidAbiSuggestion {

compiler/rustc_ast_passes/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ edition = "2021"
66
[dependencies]
77
# tidy-alphabetical-start
88
itertools = "0.12"
9+
rustc_abi = { path = "../rustc_abi" }
910
rustc_ast = { path = "../rustc_ast" }
1011
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
1112
rustc_attr_parsing = { path = "../rustc_attr_parsing" }

compiler/rustc_ast_passes/src/feature_gate.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use rustc_session::Session;
66
use rustc_session::parse::{feature_err, feature_err_issue, feature_warn};
77
use rustc_span::source_map::Spanned;
88
use rustc_span::{Span, Symbol, sym};
9-
use rustc_target::spec::abi;
109
use thin_vec::ThinVec;
1110

1211
use crate::errors;
@@ -77,12 +76,12 @@ impl<'a> PostExpansionVisitor<'a> {
7776
fn check_abi(&self, abi: ast::StrLit) {
7877
let ast::StrLit { symbol_unescaped, span, .. } = abi;
7978

80-
match abi::is_enabled(self.features, span, symbol_unescaped.as_str()) {
79+
match rustc_abi::is_enabled(self.features, span, symbol_unescaped.as_str()) {
8180
Ok(()) => (),
82-
Err(abi::AbiDisabled::Unstable { feature, explain }) => {
81+
Err(rustc_abi::AbiDisabled::Unstable { feature, explain }) => {
8382
feature_err_issue(&self.sess, feature, span, GateIssue::Language, explain).emit();
8483
}
85-
Err(abi::AbiDisabled::Unrecognized) => {
84+
Err(rustc_abi::AbiDisabled::Unrecognized) => {
8685
if self.sess.opts.pretty.is_none_or(|ppm| ppm.needs_hir()) {
8786
self.sess.dcx().span_delayed_bug(
8887
span,

compiler/rustc_codegen_cranelift/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ fn build_isa(sess: &Session) -> Arc<dyn TargetIsa + 'static> {
289289
flags_builder.set("opt_level", "none").unwrap();
290290
}
291291
OptLevel::Less
292-
| OptLevel::Default
292+
| OptLevel::More
293293
| OptLevel::Size
294294
| OptLevel::SizeMin
295295
| OptLevel::Aggressive => {

compiler/rustc_codegen_gcc/src/abi.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
#[cfg(feature = "master")]
22
use gccjit::FnAttribute;
33
use gccjit::{ToLValue, ToRValue, Type};
4+
use rustc_abi::{Reg, RegKind};
45
use rustc_codegen_ssa::traits::{AbiBuilderMethods, BaseTypeCodegenMethods};
56
use rustc_data_structures::fx::FxHashSet;
67
use rustc_middle::bug;
78
use rustc_middle::ty::Ty;
89
use rustc_middle::ty::layout::LayoutOf;
910
#[cfg(feature = "master")]
1011
use rustc_session::config;
11-
use rustc_target::callconv::{ArgAttributes, CastTarget, FnAbi, PassMode, Reg, RegKind};
12+
use rustc_target::callconv::{ArgAttributes, CastTarget, FnAbi, PassMode};
1213

1314
use crate::builder::Builder;
1415
use crate::context::CodegenCx;

compiler/rustc_codegen_gcc/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ fn to_gcc_opt_level(optlevel: Option<OptLevel>) -> OptimizationLevel {
476476
Some(level) => match level {
477477
OptLevel::No => OptimizationLevel::None,
478478
OptLevel::Less => OptimizationLevel::Limited,
479-
OptLevel::Default => OptimizationLevel::Standard,
479+
OptLevel::More => OptimizationLevel::Standard,
480480
OptLevel::Aggressive => OptimizationLevel::Aggressive,
481481
OptLevel::Size | OptLevel::SizeMin => OptimizationLevel::Limited,
482482
},

compiler/rustc_codegen_llvm/src/abi.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ use std::cmp;
44
use libc::c_uint;
55
use rustc_abi as abi;
66
pub(crate) use rustc_abi::ExternAbi;
7-
use rustc_abi::Primitive::Int;
8-
use rustc_abi::{HasDataLayout, Size};
7+
use rustc_abi::{HasDataLayout, Primitive, Reg, RegKind, Size};
98
use rustc_codegen_ssa::MemFlags;
109
use rustc_codegen_ssa::mir::operand::{OperandRef, OperandValue};
1110
use rustc_codegen_ssa::mir::place::{PlaceRef, PlaceValue};
@@ -440,7 +439,7 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
440439
let apply_range_attr = |idx: AttributePlace, scalar: rustc_abi::Scalar| {
441440
if cx.sess().opts.optimize != config::OptLevel::No
442441
&& llvm_util::get_version() >= (19, 0, 0)
443-
&& matches!(scalar.primitive(), Int(..))
442+
&& matches!(scalar.primitive(), Primitive::Int(..))
444443
// If the value is a boolean, the range is 0..2 and that ultimately
445444
// become 0..0 when the type becomes i1, which would be rejected
446445
// by the LLVM verifier.
@@ -574,7 +573,7 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
574573
if bx.cx.sess().opts.optimize != config::OptLevel::No
575574
&& llvm_util::get_version() < (19, 0, 0)
576575
&& let abi::BackendRepr::Scalar(scalar) = self.ret.layout.backend_repr
577-
&& matches!(scalar.primitive(), Int(..))
576+
&& matches!(scalar.primitive(), Primitive::Int(..))
578577
// If the value is a boolean, the range is 0..2 and that ultimately
579578
// become 0..0 when the type becomes i1, which would be rejected
580579
// by the LLVM verifier.

0 commit comments

Comments
 (0)