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 9 pull requests #132273

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
10 changes: 10 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 All @@ -4095,6 +4100,7 @@ version = "0.0.0"
dependencies = [
"either",
"itertools",
"rustc_abi",
"rustc_arena",
"rustc_ast",
"rustc_attr",
Expand Down Expand Up @@ -4187,6 +4193,7 @@ dependencies = [
name = "rustc_passes"
version = "0.0.0"
dependencies = [
"rustc_abi",
"rustc_ast",
"rustc_ast_pretty",
"rustc_attr",
Expand All @@ -4213,6 +4220,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 +4360,7 @@ dependencies = [
"bitflags 2.6.0",
"getopts",
"libc",
"rustc_abi",
"rustc_ast",
"rustc_data_structures",
"rustc_errors",
Expand Down Expand Up @@ -4415,6 +4424,7 @@ version = "0.0.0"
dependencies = [
"punycode",
"rustc-demangle",
"rustc_abi",
"rustc_data_structures",
"rustc_errors",
"rustc_hir",
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_abi/src/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ where
VariantIdx: Idx,
F: Deref<Target = &'a LayoutData<FieldIdx, VariantIdx>> + fmt::Debug,
{
let uninhabited = fields.iter().any(|f| f.abi.is_uninhabited());
let uninhabited = fields.iter().any(|f| f.is_uninhabited());
// We cannot ignore alignment; that might lead us to entirely discard a variant and
// produce an enum that is less aligned than it should be!
let is_1zst = fields.iter().all(|f| f.is_1zst());
Expand Down Expand Up @@ -681,7 +681,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
let discr_type = repr.discr_type();
let bits = Integer::from_attr(dl, discr_type).size().bits();
for (i, mut val) in discriminants {
if !repr.c() && variants[i].iter().any(|f| f.abi.is_uninhabited()) {
if !repr.c() && variants[i].iter().any(|f| f.is_uninhabited()) {
continue;
}
if discr_type.is_signed() {
Expand Down
5 changes: 5 additions & 0 deletions compiler/rustc_abi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1652,6 +1652,11 @@ impl<FieldIdx: Idx, VariantIdx: Idx> LayoutData<FieldIdx, VariantIdx> {
}
}

/// Returns `true` if this is an uninhabited type
pub fn is_uninhabited(&self) -> bool {
self.abi.is_uninhabited()
}

pub fn scalar<C: HasDataLayout>(cx: &C, scalar: Scalar) -> Self {
let largest_niche = Niche::from_scalar(cx, Size::ZERO, scalar);
let size = scalar.size(cx);
Expand Down
5 changes: 3 additions & 2 deletions compiler/rustc_ast_lowering/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
b: &Block,
targeted_by_break: bool,
) -> &'hir hir::Block<'hir> {
self.arena.alloc(self.lower_block_noalloc(b, targeted_by_break))
let hir_id = self.lower_node_id(b.id);
self.arena.alloc(self.lower_block_noalloc(hir_id, b, targeted_by_break))
}

pub(super) fn lower_block_noalloc(
&mut self,
hir_id: hir::HirId,
b: &Block,
targeted_by_break: bool,
) -> hir::Block<'hir> {
let (stmts, expr) = self.lower_stmts(&b.stmts);
let rules = self.lower_block_check_mode(&b.rules);
let hir_id = self.lower_node_id(b.id);
hir::Block { hir_id, stmts, expr, rules, span: self.lower_span(b.span), targeted_by_break }
}

Expand Down
5 changes: 3 additions & 2 deletions compiler/rustc_ast_lowering/src/delegation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,11 @@ impl<'hir> LoweringContext<'_, 'hir> {
self_param_id: pat_node_id,
};
self_resolver.visit_block(block);
// Target expr needs to lower `self` path.
this.ident_and_label_to_local_id.insert(pat_node_id, param.pat.hir_id.local_id);
this.lower_target_expr(&block)
} else {
let pat_hir_id = this.lower_node_id(pat_node_id);
this.generate_arg(pat_hir_id, span)
this.generate_arg(param.pat.hir_id, span)
};
args.push(arg);
}
Expand Down
Loading
Loading