Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
7b16f3e
Auto merge of #150538 - Kobzol:dist-cg-gcc-component, r=jieyouxu
rust-bors[bot] Jan 8, 2026
72a6823
rust-analyzer: Also use `semiopaque` instead of `semitransparent`
Enselic Jan 1, 2026
bef8050
Auto merge of #148545 - cramertj:alloc-map, r=Amanieu
rust-bors[bot] Jan 8, 2026
3eef439
Rollup merge of #150272 - doc/improve-iter-find-docs, r=scottmcm
GuillaumeGomez Jan 9, 2026
17f8248
Rollup merge of #150385 - fix-expr-can-have-side-effects, r=jdonszelm…
GuillaumeGomez Jan 9, 2026
885a19c
Rollup merge of #150561 - semiopaque, r=BoxyUwU
GuillaumeGomez Jan 9, 2026
5ee051f
Rollup merge of #150574 - MoveData-init_loc_map, r=cjgillot
GuillaumeGomez Jan 9, 2026
b69ba81
Rollup merge of #150762 - cleanup-gui, r=lolbinarycat
GuillaumeGomez Jan 9, 2026
1e56307
Rollup merge of #150808 - derive-internals, r=jhpratt
GuillaumeGomez Jan 9, 2026
5063e1b
Rollup merge of #150816 - method-anchor, r=camelid
GuillaumeGomez Jan 9, 2026
c3c1e1d
Rollup merge of #150821 - remove-test, r=jackh726
GuillaumeGomez Jan 9, 2026
73902f7
Rollup merge of #150829 - fix_generic_param_target, r=JonathanBrouwer
GuillaumeGomez Jan 9, 2026
afce6cd
Rollup merge of #150834 - multiple_supertrait_upcastable-not-internal…
GuillaumeGomez Jan 9, 2026
2142b8b
Rollup merge of #150864 - fix-aarch64-platform-docs, r=jdonszelmann
GuillaumeGomez Jan 9, 2026
3d51d36
Auto merge of #150866 - GuillaumeGomez:rollup-puFKE8I, r=GuillaumeGomez
rust-bors[bot] Jan 9, 2026
b11dffc
Auto merge of #150739 - weihanglo:update-cargo, r=weihanglo
rust-bors[bot] Jan 9, 2026
a405ba3
Auto merge of #150818 - flip1995:clippy-subtree-update, r=Manishearth…
rust-bors[bot] Jan 9, 2026
6373f9f
Auto merge of #150502 - petrochenkov:overglob, r=yaahc
rust-bors[bot] Jan 10, 2026
b72f50f
Auto merge of #146923 - oli-obk:comptime-reflect, r=BoxyUwU
rust-bors[bot] Jan 10, 2026
2807b75
Auto merge of #150540 - JonathanBrouwer:incremental_test, r=cjgillot
rust-bors[bot] Jan 11, 2026
5ca62ad
Auto merge of #150741 - petrochenkov:modsplitfast, r=nnethercote
rust-bors[bot] Jan 11, 2026
d2e7b71
Auto merge of #150748 - nnethercote:canonicalizer-cleanups, r=lcnr
rust-bors[bot] Jan 11, 2026
6181fa1
Prepare for merging from rust-lang/rust
invalid-email-address Jan 12, 2026
318545f
Merge ref '44a5b55557c2' from rust-lang/rust
invalid-email-address Jan 12, 2026
b031af1
Format code
invalid-email-address Jan 12, 2026
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
2 changes: 1 addition & 1 deletion crates/hir-def/src/expr_store/expander.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl Expander {
pub(super) fn hygiene_for_range(&self, db: &dyn DefDatabase, range: TextRange) -> HygieneId {
match self.span_map.as_ref() {
hir_expand::span_map::SpanMapRef::ExpansionSpanMap(span_map) => {
HygieneId::new(span_map.span_at(range.start()).ctx.opaque_and_semitransparent(db))
HygieneId::new(span_map.span_at(range.start()).ctx.opaque_and_semiopaque(db))
}
hir_expand::span_map::SpanMapRef::RealSpanMap(_) => HygieneId::ROOT,
}
Expand Down
2 changes: 1 addition & 1 deletion crates/hir-def/src/expr_store/lower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2546,7 +2546,7 @@ impl<'db> ExprCollector<'db> {
// Therefore, if we got to the rib of its declaration, give up its hygiene
// and use its parent expansion.

hygiene_id = HygieneId::new(parent_ctx.opaque_and_semitransparent(self.db));
hygiene_id = HygieneId::new(parent_ctx.opaque_and_semiopaque(self.db));
hygiene_info = parent_ctx.outer_expn(self.db).map(|expansion| {
let expansion = self.db.lookup_intern_macro_call(expansion.into());
(parent_ctx.parent(self.db), expansion.def)
Expand Down
2 changes: 1 addition & 1 deletion crates/hir-def/src/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,7 @@ fn handle_macro_def_scope(
// A macro is allowed to refer to variables from before its declaration.
// Therefore, if we got to the rib of its declaration, give up its hygiene
// and use its parent expansion.
*hygiene_id = HygieneId::new(parent_ctx.opaque_and_semitransparent(db));
*hygiene_id = HygieneId::new(parent_ctx.opaque_and_semiopaque(db));
*hygiene_info = parent_ctx.outer_expn(db).map(|expansion| {
let expansion = db.lookup_intern_macro_call(expansion.into());
(parent_ctx.parent(db), expansion.def)
Expand Down
7 changes: 5 additions & 2 deletions crates/hir-expand/src/declarative.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@ impl DeclarativeMacroExpander {
{
match &*value {
"transparent" => ControlFlow::Break(Transparency::Transparent),
"semitransparent" => ControlFlow::Break(Transparency::SemiTransparent),
// "semitransparent" is for old rustc versions.
"semiopaque" | "semitransparent" => {
ControlFlow::Break(Transparency::SemiOpaque)
}
"opaque" => ControlFlow::Break(Transparency::Opaque),
_ => ControlFlow::Continue(()),
}
Expand Down Expand Up @@ -140,7 +143,7 @@ impl DeclarativeMacroExpander {
)),
},
transparency(ast::AnyHasAttrs::from(macro_rules))
.unwrap_or(Transparency::SemiTransparent),
.unwrap_or(Transparency::SemiOpaque),
),
ast::Macro::MacroDef(macro_def) => (
match macro_def.body() {
Expand Down
14 changes: 7 additions & 7 deletions crates/hir-expand/src/hygiene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub fn span_with_mixed_site_ctxt(
expn_id: MacroCallId,
edition: Edition,
) -> Span {
span_with_ctxt_from_mark(db, span, expn_id, Transparency::SemiTransparent, edition)
span_with_ctxt_from_mark(db, span, expn_id, Transparency::SemiOpaque, edition)
}

fn span_with_ctxt_from_mark(
Expand Down Expand Up @@ -82,7 +82,7 @@ pub(super) fn apply_mark(
}

let call_site_ctxt = db.lookup_intern_macro_call(call_id.into()).ctxt;
let mut call_site_ctxt = if transparency == Transparency::SemiTransparent {
let mut call_site_ctxt = if transparency == Transparency::SemiOpaque {
call_site_ctxt.normalize_to_macros_2_0(db)
} else {
call_site_ctxt.normalize_to_macro_rules(db)
Expand Down Expand Up @@ -117,16 +117,16 @@ fn apply_mark_internal(
let call_id = Some(call_id);

let mut opaque = ctxt.opaque(db);
let mut opaque_and_semitransparent = ctxt.opaque_and_semitransparent(db);
let mut opaque_and_semiopaque = ctxt.opaque_and_semiopaque(db);

if transparency >= Transparency::Opaque {
let parent = opaque;
opaque = SyntaxContext::new(db, call_id, transparency, edition, parent, identity, identity);
}

if transparency >= Transparency::SemiTransparent {
let parent = opaque_and_semitransparent;
opaque_and_semitransparent =
if transparency >= Transparency::SemiOpaque {
let parent = opaque_and_semiopaque;
opaque_and_semiopaque =
SyntaxContext::new(db, call_id, transparency, edition, parent, |_| opaque, identity);
}

Expand All @@ -138,6 +138,6 @@ fn apply_mark_internal(
edition,
parent,
|_| opaque,
|_| opaque_and_semitransparent,
|_| opaque_and_semiopaque,
)
}
2 changes: 1 addition & 1 deletion crates/hir-expand/src/inert_attr_macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ pub const INERT_ATTRIBUTES: &[BuiltinAttribute] = &[
rustc_attr!(rustc_proc_macro_decls, Normal, template!(Word), WarnFollowing, INTERNAL_UNSTABLE),
rustc_attr!(
rustc_macro_transparency, Normal,
template!(NameValueStr: "transparent|semitransparent|opaque"), ErrorFollowing,
template!(NameValueStr: "transparent|semiopaque|opaque"), ErrorFollowing,
"used internally for testing macro hygiene",
),

Expand Down
4 changes: 2 additions & 2 deletions crates/hir-expand/src/mod_path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,8 @@ pub fn resolve_crate_root(db: &dyn ExpandDatabase, mut ctxt: SyntaxContext) -> O
result_mark = Some(mark);
iter.next();
}
// Then find the last semi-transparent mark from the end if it exists.
while let Some((mark, Transparency::SemiTransparent)) = iter.next() {
// Then find the last semi-opaque mark from the end if it exists.
while let Some((mark, Transparency::SemiOpaque)) = iter.next() {
result_mark = Some(mark);
}

Expand Down
2 changes: 1 addition & 1 deletion crates/hir-ty/src/tests/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3708,7 +3708,7 @@ fn main() {
}

#[test]
fn macro_semitransparent_hygiene() {
fn macro_semiopaque_hygiene() {
check_types(
r#"
macro_rules! m {
Expand Down
2 changes: 1 addition & 1 deletion crates/hir/src/source_analyzer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1808,5 +1808,5 @@ pub(crate) fn name_hygiene(db: &dyn HirDatabase, name: InFile<&SyntaxNode>) -> H
};
let span_map = db.expansion_span_map(macro_file);
let ctx = span_map.span_at(name.value.text_range().start()).ctx;
HygieneId::new(ctx.opaque_and_semitransparent(db))
HygieneId::new(ctx.opaque_and_semiopaque(db))
}
1 change: 0 additions & 1 deletion crates/intern/src/symbol/symbols.rs
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,6 @@ define_symbols! {
rustc_skip_array_during_method_dispatch,
rustc_skip_during_method_dispatch,
rustc_force_inline,
semitransparent,
shl_assign,
shl,
shr_assign,
Expand Down
20 changes: 9 additions & 11 deletions crates/span/src/hygiene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const _: () = {
edition: Edition,
parent: SyntaxContext,
opaque: SyntaxContext,
opaque_and_semitransparent: SyntaxContext,
opaque_and_semiopaque: SyntaxContext,
}

impl PartialEq for SyntaxContextData {
Expand Down Expand Up @@ -214,7 +214,7 @@ const _: () = {
edition: T2,
parent: T3,
opaque: impl FnOnce(SyntaxContext) -> SyntaxContext,
opaque_and_semitransparent: impl FnOnce(SyntaxContext) -> SyntaxContext,
opaque_and_semiopaque: impl FnOnce(SyntaxContext) -> SyntaxContext,
) -> Self
where
Db: ?Sized + salsa::Database,
Expand All @@ -241,9 +241,7 @@ const _: () = {
edition: zalsa_::interned::Lookup::into_owned(data.2),
parent: zalsa_::interned::Lookup::into_owned(data.3),
opaque: opaque(zalsa_::FromId::from_id(id)),
opaque_and_semitransparent: opaque_and_semitransparent(
zalsa_::FromId::from_id(id),
),
opaque_and_semiopaque: opaque_and_semiopaque(zalsa_::FromId::from_id(id)),
},
)
}
Expand Down Expand Up @@ -301,7 +299,7 @@ const _: () = {
}
}

/// This context, but with all transparent and semi-transparent expansions filtered away.
/// This context, but with all transparent and semi-opaque expansions filtered away.
pub fn opaque<Db>(self, db: &'db Db) -> SyntaxContext
where
Db: ?Sized + zalsa_::Database,
Expand All @@ -317,15 +315,15 @@ const _: () = {
}

/// This context, but with all transparent expansions filtered away.
pub fn opaque_and_semitransparent<Db>(self, db: &'db Db) -> SyntaxContext
pub fn opaque_and_semiopaque<Db>(self, db: &'db Db) -> SyntaxContext
where
Db: ?Sized + zalsa_::Database,
{
match self.as_salsa_id() {
Some(id) => {
let zalsa = db.zalsa();
let fields = SyntaxContext::ingredient(zalsa).data(zalsa, id);
fields.opaque_and_semitransparent
fields.opaque_and_semiopaque
}
None => self,
}
Expand Down Expand Up @@ -405,7 +403,7 @@ impl<'db> SyntaxContext {

#[inline]
pub fn normalize_to_macro_rules(self, db: &'db dyn salsa::Database) -> SyntaxContext {
self.opaque_and_semitransparent(db)
self.opaque_and_semiopaque(db)
}

pub fn is_opaque(self, db: &'db dyn salsa::Database) -> bool {
Expand Down Expand Up @@ -476,13 +474,13 @@ pub enum Transparency {
/// Identifier produced by a transparent expansion is always resolved at call-site.
/// Call-site spans in procedural macros, hygiene opt-out in `macro` should use this.
Transparent,
/// Identifier produced by a semi-transparent expansion may be resolved
/// Identifier produced by a semi-opaque expansion may be resolved
/// either at call-site or at definition-site.
/// If it's a local variable, label or `$crate` then it's resolved at def-site.
/// Otherwise it's resolved at call-site.
/// `macro_rules` macros behave like this, built-in macros currently behave like this too,
/// but that's an implementation detail.
SemiTransparent,
SemiOpaque,
/// Identifier produced by an opaque expansion is always resolved at definition-site.
/// Def-site spans in procedural macros, identifiers from `macro` by default use this.
Opaque,
Expand Down
4 changes: 2 additions & 2 deletions crates/test-utils/src/minicore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -546,11 +546,11 @@ pub mod ptr {
// endregion:non_null

// region:addr_of
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro addr_of($place:expr) {
&raw const $place
}
#[rustc_macro_transparency = "semitransparent"]
#[rustc_macro_transparency = "semiopaque"]
pub macro addr_of_mut($place:expr) {
&raw mut $place
}
Expand Down
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
548e586795f6b6fe089d8329aa5edbf0f5202646
44a5b55557c26353f388400d7da95527256fe260