Skip to content

Rollup of 9 pull requests #132273

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

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
42fbaf1
Add a new trait `proc_macro::ToTokens`
SpriteOvO Oct 9, 2024
4839d6e
compiler: Add rustc_abi dependence to the compiler
workingjubilee Oct 28, 2024
cb08e08
Lower AST node id only once
adwinwhite Sep 12, 2024
1a39247
Add duplicate lowering check
adwinwhite Sep 15, 2024
e3bf50e
more consistent debug_assertions
adwinwhite Oct 14, 2024
3f73fe7
compiler: Depend on rustc_abi in rustc_lint
workingjubilee Oct 28, 2024
7cfbe23
Unify variant struct fields margins with struct fields
GuillaumeGomez Oct 28, 2024
26b6ccd
Add GUI regression test for variant structfields margins
GuillaumeGomez Oct 28, 2024
4bd84b2
Use a type-safe helper to cast `&str` and `&[u8]` to `*const c_char`
Zalathar Oct 28, 2024
82bfe05
refactor: cleaner check to return None
ChrisCho-H Oct 28, 2024
2cc9d58
Updating Fuchsia platform-support documentation
claywilkinson Oct 28, 2024
88a9edc
compiler: Add `is_uninhabited` and use LayoutS accessors
workingjubilee Oct 28, 2024
641ce06
rustdoc: Use accessors to interrogate type layouts
workingjubilee Oct 28, 2024
3d76418
stable_mir: Directly use types from rustc_abi
workingjubilee Oct 28, 2024
55edadc
Rollup merge of #130259 - adwinwhite:lower-node-id-once, r=cjgillot
workingjubilee Oct 28, 2024
ebb52ff
Rollup merge of #131441 - SpriteOvO:proc-macro-to-tokens-trait, r=dto…
workingjubilee Oct 28, 2024
1865e2b
Rollup merge of #132247 - workingjubilee:add-rustc-abi-to-smir, r=cel…
workingjubilee Oct 28, 2024
114c45f
Rollup merge of #132249 - workingjubilee:add-rustc-abi, r=compiler-er…
workingjubilee Oct 28, 2024
9552f54
Rollup merge of #132255 - workingjubilee:layout-is-🏚️, r=compiler-errors
workingjubilee Oct 28, 2024
9d1f9ab
Rollup merge of #132258 - GuillaumeGomez:variant-structfields-margins…
workingjubilee Oct 28, 2024
ec388ee
Rollup merge of #132260 - Zalathar:type-safe-cast, r=compiler-errors
workingjubilee Oct 28, 2024
92d4733
Rollup merge of #132261 - ChrisCho-H:refactor/cleaner-check-none, r=c…
workingjubilee Oct 28, 2024
d3946e1
Rollup merge of #132271 - claywilkinson:master, r=tmandry
workingjubilee Oct 28, 2024
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
9 changes: 9 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3621,6 +3621,7 @@ version = "0.0.0"
dependencies = [
"annotate-snippets 0.11.4",
"derive_setters",
"rustc_abi",
"rustc_ast",
"rustc_ast_pretty",
"rustc_data_structures",
Expand Down Expand Up @@ -3718,6 +3719,7 @@ name = "rustc_hir_analysis"
version = "0.0.0"
dependencies = [
"itertools",
"rustc_abi",
"rustc_arena",
"rustc_ast",
"rustc_attr",
Expand Down Expand Up @@ -3906,6 +3908,7 @@ dependencies = [
name = "rustc_lint"
version = "0.0.0"
dependencies = [
"rustc_abi",
"rustc_ast",
"rustc_ast_pretty",
"rustc_attr",
Expand Down Expand Up @@ -3980,6 +3983,7 @@ dependencies = [
"bitflags 2.6.0",
"libloading",
"odht",
"rustc_abi",
"rustc_ast",
"rustc_attr",
"rustc_data_structures",
Expand Down Expand Up @@ -4074,6 +4078,7 @@ version = "0.0.0"
dependencies = [
"polonius-engine",
"regex",
"rustc_abi",
"rustc_ast",
"rustc_data_structures",
"rustc_errors",
Expand Down Expand Up @@ -4187,6 +4192,7 @@ dependencies = [
name = "rustc_passes"
version = "0.0.0"
dependencies = [
"rustc_abi",
"rustc_ast",
"rustc_ast_pretty",
"rustc_attr",
Expand All @@ -4213,6 +4219,7 @@ name = "rustc_pattern_analysis"
version = "0.0.0"
dependencies = [
"rustc-hash 2.0.0",
"rustc_abi",
"rustc_apfloat",
"rustc_arena",
"rustc_data_structures",
Expand Down Expand Up @@ -4352,6 +4359,7 @@ dependencies = [
"bitflags 2.6.0",
"getopts",
"libc",
"rustc_abi",
"rustc_ast",
"rustc_data_structures",
"rustc_errors",
Expand Down Expand Up @@ -4415,6 +4423,7 @@ version = "0.0.0"
dependencies = [
"punycode",
"rustc-demangle",
"rustc_abi",
"rustc_data_structures",
"rustc_errors",
"rustc_hir",
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_errors/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ edition = "2021"
# tidy-alphabetical-start
annotate-snippets = "0.11"
derive_setters = "0.1.6"
rustc_abi = { path = "../rustc_abi" }
rustc_ast = { path = "../rustc_ast" }
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
rustc_data_structures = { path = "../rustc_data_structures" }
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_errors/src/diagnostic_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ use std::num::ParseIntError;
use std::path::{Path, PathBuf};
use std::process::ExitStatus;

use rustc_abi::TargetDataLayoutErrors;
use rustc_ast_pretty::pprust;
use rustc_macros::Subdiagnostic;
use rustc_span::Span;
use rustc_span::edition::Edition;
use rustc_span::symbol::{Ident, MacroRulesNormalizedIdent, Symbol};
use rustc_target::abi::TargetDataLayoutErrors;
use rustc_target::spec::{PanicStrategy, SplitDebuginfo, StackProtector, TargetTriple};
use rustc_type_ir::{ClosureKind, FloatTy};
use {rustc_ast as ast, rustc_hir as hir};
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_hir_analysis/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ doctest = false
[dependencies]
# tidy-alphabetical-start
itertools = "0.12"
rustc_abi = { path = "../rustc_abi" }
rustc_arena = { path = "../rustc_arena" }
rustc_ast = { path = "../rustc_ast" }
rustc_attr = { path = "../rustc_attr" }
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/src/check/check.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::cell::LazyCell;
use std::ops::ControlFlow;

use rustc_abi::FieldIdx;
use rustc_data_structures::unord::{UnordMap, UnordSet};
use rustc_errors::MultiSpan;
use rustc_errors::codes::*;
Expand All @@ -23,7 +24,6 @@ use rustc_middle::ty::{
TypeVisitableExt,
};
use rustc_session::lint::builtin::UNINHABITED_STATIC;
use rustc_target::abi::FieldIdx;
use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
use rustc_trait_selection::error_reporting::traits::on_unimplemented::OnUnimplementedDirective;
use rustc_trait_selection::traits;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/src/check/intrinsicck.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::assert_matches::debug_assert_matches;

use rustc_abi::FieldIdx;
use rustc_ast::InlineAsmTemplatePiece;
use rustc_data_structures::fx::FxIndexSet;
use rustc_hir::{self as hir, LangItem};
Expand All @@ -8,7 +9,6 @@ use rustc_middle::ty::{self, FloatTy, IntTy, Ty, TyCtxt, TypeVisitableExt, UintT
use rustc_session::lint;
use rustc_span::Symbol;
use rustc_span::def_id::LocalDefId;
use rustc_target::abi::FieldIdx;
use rustc_target::asm::{
InlineAsmReg, InlineAsmRegClass, InlineAsmRegOrRegClass, InlineAsmType, ModifierInfo,
};
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/src/check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ pub mod wfcheck;
use std::num::NonZero;

pub use check::{check_abi, check_abi_fn_ptr};
use rustc_abi::VariantIdx;
use rustc_data_structures::fx::{FxHashSet, FxIndexMap};
use rustc_errors::{Diag, ErrorGuaranteed, pluralize, struct_span_code_err};
use rustc_hir::def_id::{DefId, LocalDefId};
Expand All @@ -90,7 +91,6 @@ use rustc_session::parse::feature_err;
use rustc_span::def_id::CRATE_DEF_ID;
use rustc_span::symbol::{Ident, kw, sym};
use rustc_span::{BytePos, DUMMY_SP, Span, Symbol};
use rustc_target::abi::VariantIdx;
use rustc_target::spec::abi::Abi;
use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
use rustc_trait_selection::error_reporting::infer::ObligationCauseExt as _;
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_lint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ edition = "2021"

[dependencies]
# tidy-alphabetical-start
rustc_abi = { path = "../rustc_abi" }
rustc_ast = { path = "../rustc_ast" }
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
rustc_attr = { path = "../rustc_attr" }
Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_lint/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use rustc_data_structures::sync;
use rustc_data_structures::unord::UnordMap;
use rustc_errors::{Diag, LintDiagnostic, MultiSpan};
use rustc_feature::Features;
use rustc_hir as hir;
use rustc_hir::def::Res;
use rustc_hir::def_id::{CrateNum, DefId};
use rustc_hir::definitions::{DefPathData, DisambiguatedDefPathData};
Expand All @@ -27,8 +26,8 @@ use rustc_session::{LintStoreMarker, Session};
use rustc_span::Span;
use rustc_span::edit_distance::find_best_match_for_names;
use rustc_span::symbol::{Ident, Symbol, sym};
use rustc_target::abi;
use tracing::debug;
use {rustc_abi as abi, rustc_hir as hir};

use self::TargetLint::*;
use crate::levels::LintLevelsBuilder;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_lint/src/foreign_modules.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use rustc_abi::FIRST_VARIANT;
use rustc_data_structures::stack::ensure_sufficient_stack;
use rustc_data_structures::unord::{UnordMap, UnordSet};
use rustc_hir as hir;
Expand All @@ -6,7 +7,6 @@ use rustc_middle::query::Providers;
use rustc_middle::ty::{self, AdtDef, Instance, Ty, TyCtxt};
use rustc_session::declare_lint;
use rustc_span::{Span, Symbol, sym};
use rustc_target::abi::FIRST_VARIANT;
use tracing::{debug, instrument};

use crate::lints::{BuiltinClashingExtern, BuiltinClashingExternSub};
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_lint/src/types/literal.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use hir::{ExprKind, Node, is_range_literal};
use rustc_abi::{Integer, Size};
use rustc_middle::ty::Ty;
use rustc_middle::ty::layout::IntegerExt;
use rustc_middle::{bug, ty};
use rustc_target::abi::{Integer, Size};
use {rustc_ast as ast, rustc_attr as attr, rustc_hir as hir};

use crate::LateContext;
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_metadata/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ edition = "2021"
bitflags = "2.4.1"
libloading = "0.8.0"
odht = { version = "0.3.1", features = ["nightly"] }
rustc_abi = { path = "../rustc_abi" }
rustc_ast = { path = "../rustc_ast" }
rustc_attr = { path = "../rustc_attr" }
rustc_data_structures = { path = "../rustc_data_structures" }
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_metadata/src/rmeta/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use decoder::{DecodeContext, Metadata};
use def_path_hash_map::DefPathHashMapRef;
use encoder::EncodeContext;
pub use encoder::{EncodedMetadata, encode_metadata, rendered_const};
use rustc_abi::{FieldIdx, VariantIdx};
use rustc_ast::expand::StrippedCfgItem;
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::svh::Svh;
Expand Down Expand Up @@ -37,7 +38,6 @@ use rustc_span::edition::Edition;
use rustc_span::hygiene::{ExpnIndex, MacroKind, SyntaxContextData};
use rustc_span::symbol::{Ident, Symbol};
use rustc_span::{self, ExpnData, ExpnHash, ExpnId, Span};
use rustc_target::abi::{FieldIdx, VariantIdx};
use rustc_target::spec::{PanicStrategy, TargetTriple};
use table::TableBuilder;
use {rustc_ast as ast, rustc_attr as attr, rustc_hir as hir};
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_mir_dataflow/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ edition = "2021"
# tidy-alphabetical-start
polonius-engine = "0.13.0"
regex = "1"
rustc_abi = { path = "../rustc_abi" }
rustc_ast = { path = "../rustc_ast" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_dataflow/src/drop_flag_effects.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use rustc_abi::VariantIdx;
use rustc_middle::mir::{self, Body, Location, Terminator, TerminatorKind};
use rustc_target::abi::VariantIdx;
use tracing::debug;

use super::move_paths::{InitKind, LookupResult, MoveData, MovePathIndex};
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_dataflow/src/elaborate_drops.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{fmt, iter};

use rustc_abi::{FIRST_VARIANT, FieldIdx, VariantIdx};
use rustc_hir::lang_items::LangItem;
use rustc_index::Idx;
use rustc_middle::mir::patch::MirPatch;
Expand All @@ -10,7 +11,6 @@ use rustc_middle::ty::util::IntTypeExt;
use rustc_middle::ty::{self, GenericArgsRef, Ty, TyCtxt};
use rustc_span::DUMMY_SP;
use rustc_span::source_map::Spanned;
use rustc_target::abi::{FIRST_VARIANT, FieldIdx, VariantIdx};
use tracing::{debug, instrument};

/// The value of an inserted drop flag.
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_dataflow/src/value_analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ use std::assert_matches::assert_matches;
use std::fmt::{Debug, Formatter};
use std::ops::Range;

use rustc_abi::{FieldIdx, VariantIdx};
use rustc_data_structures::captures::Captures;
use rustc_data_structures::fx::{FxHashMap, FxIndexSet, StdEntry};
use rustc_data_structures::stack::ensure_sufficient_stack;
Expand All @@ -46,7 +47,6 @@ use rustc_middle::mir::tcx::PlaceTy;
use rustc_middle::mir::visit::{MutatingUseContext, PlaceContext, Visitor};
use rustc_middle::mir::*;
use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_target::abi::{FieldIdx, VariantIdx};
use tracing::debug;

use crate::fmt::DebugWithContext;
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_passes/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ edition = "2021"

[dependencies]
# tidy-alphabetical-start
rustc_abi = { path = "../rustc_abi" }
rustc_ast = { path = "../rustc_ast" }
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
rustc_attr = { path = "../rustc_attr" }
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_passes/src/dead.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use std::mem;

use hir::ItemKind;
use hir::def_id::{LocalDefIdMap, LocalDefIdSet};
use rustc_abi::FieldIdx;
use rustc_data_structures::unord::UnordSet;
use rustc_errors::MultiSpan;
use rustc_hir as hir;
Expand All @@ -22,7 +23,6 @@ use rustc_middle::{bug, span_bug};
use rustc_session::lint;
use rustc_session::lint::builtin::DEAD_CODE;
use rustc_span::symbol::{Symbol, sym};
use rustc_target::abi::FieldIdx;

use crate::errors::{
ChangeFields, IgnoredDerivedImpls, MultipleDeadCodes, ParentInfo, UselessAssignment,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_passes/src/layout_test.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use rustc_abi::{HasDataLayout, TargetDataLayout};
use rustc_ast::Attribute;
use rustc_hir::def::DefKind;
use rustc_hir::def_id::LocalDefId;
Expand All @@ -7,7 +8,6 @@ use rustc_middle::ty::{self, ParamEnv, Ty, TyCtxt};
use rustc_span::Span;
use rustc_span::source_map::Spanned;
use rustc_span::symbol::sym;
use rustc_target::abi::{HasDataLayout, TargetDataLayout};
use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
use rustc_trait_selection::infer::TyCtxtInferExt;
use rustc_trait_selection::traits;
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_pattern_analysis/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ edition = "2021"
[dependencies]
# tidy-alphabetical-start
rustc-hash = "2.0.0"

rustc_abi = { path = "../rustc_abi", optional = true }
rustc_apfloat = "0.2.0"
rustc_arena = { path = "../rustc_arena", optional = true }
rustc_data_structures = { path = "../rustc_data_structures", optional = true }
Expand All @@ -29,6 +31,7 @@ tracing-tree = "0.3.0"
[features]
default = ["rustc"]
rustc = [
"dep:rustc_abi",
"dep:rustc_arena",
"dep:rustc_data_structures",
"dep:rustc_errors",
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_pattern_analysis/src/rustc.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::fmt;
use std::iter::once;

use rustc_abi::{FIRST_VARIANT, FieldIdx, Integer, VariantIdx};
use rustc_arena::DroplessArena;
use rustc_hir::HirId;
use rustc_hir::def_id::DefId;
Expand All @@ -15,7 +16,6 @@ use rustc_middle::ty::{
use rustc_middle::{bug, span_bug};
use rustc_session::lint;
use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span};
use rustc_target::abi::{FIRST_VARIANT, FieldIdx, Integer, VariantIdx};

use crate::constructor::Constructor::*;
use crate::constructor::{
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_pattern_analysis/src/rustc/print.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

use std::fmt;

use rustc_abi::{FieldIdx, VariantIdx};
use rustc_middle::bug;
use rustc_middle::ty::{self, AdtDef, Ty, TyCtxt};
use rustc_span::sym;
use rustc_target::abi::{FieldIdx, VariantIdx};

#[derive(Clone, Debug)]
pub(crate) struct FieldPat {
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_session/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ edition = "2021"
# tidy-alphabetical-start
bitflags = "2.4.1"
getopts = "0.2"
rustc_abi = { path = "../rustc_abi" }
rustc_ast = { path = "../rustc_ast" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_session/src/code_stats.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use std::cmp;

use rustc_abi::{Align, Size};
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_data_structures::sync::Lock;
use rustc_span::Symbol;
use rustc_span::def_id::DefId;
use rustc_target::abi::{Align, Size};

#[derive(Clone, PartialEq, Eq, Hash, Debug)]
pub struct VariantInfo {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_session/src/config/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
use std::hash::Hash;
use std::iter;

use rustc_abi::Align;
use rustc_ast::ast;
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexSet};
use rustc_lint_defs::BuiltinLintDiag;
use rustc_lint_defs::builtin::EXPLICIT_BUILTIN_CFGS_IN_FLAGS;
use rustc_span::symbol::{Symbol, sym};
use rustc_target::abi::Align;
use rustc_target::spec::{PanicStrategy, RelocModel, SanitizerSet, TARGETS, Target, TargetTriple};

use crate::Session;
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_symbol_mangling/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ edition = "2021"
# tidy-alphabetical-start
punycode = "0.4.0"
rustc-demangle = "0.1.21"

rustc_abi = { path = "../rustc_abi" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
rustc_hir = { path = "../rustc_hir" }
Expand Down
Loading