Unnamed repository; edit this file 'description' to name the repository.
Auto merge of #150866 - GuillaumeGomez:rollup-puFKE8I, r=GuillaumeGomez
Rollup of 11 pull requests Successful merges: - rust-lang/rust#150272 (docs(core): update `find()` and `rfind()` examples) - rust-lang/rust#150385 (fix `Expr::can_have_side_effects` for `[x; N]` style array literal and binary expressions) - rust-lang/rust#150561 (Finish transition from `semitransparent` to `semiopaque` for `rustc_macro_transparency`) - rust-lang/rust#150574 (Clarify `MoveData::init_loc_map`.) - rust-lang/rust#150762 (Use functions more in rustdoc GUI tests) - rust-lang/rust#150808 (rename the `derive_{eq, clone_copy}` features to `*_internals`) - rust-lang/rust#150816 (Fix trait method anchor disappearing before user can click on it) - rust-lang/rust#150821 (tests/ui/borrowck/issue-92157.rs: Remove (bug not fixed)) - rust-lang/rust#150829 (make attrs actually use `Target::GenericParam`) - rust-lang/rust#150834 (Add tracking issue for `feature(multiple_supertrait_upcastable)`) - rust-lang/rust#150864 (The aarch64-unknown-none target requires NEON, so the docs were wrong.) r? @ghost
rust-bors[bot] 3 months ago
parent bef8050 · parent 2142b8b · commit 3d51d36
-rw-r--r--crates/hir-def/src/expr_store/expander.rs2
-rw-r--r--crates/hir-def/src/expr_store/lower.rs2
-rw-r--r--crates/hir-def/src/resolver.rs2
-rw-r--r--crates/hir-expand/src/declarative.rs5
-rw-r--r--crates/hir-expand/src/hygiene.rs14
-rw-r--r--crates/hir-expand/src/inert_attr_macro.rs2
-rw-r--r--crates/hir-expand/src/mod_path.rs4
-rw-r--r--crates/hir-ty/src/tests/simple.rs2
-rw-r--r--crates/hir/src/source_analyzer.rs2
-rw-r--r--crates/intern/src/symbol/symbols.rs1
-rw-r--r--crates/span/src/hygiene.rs18
-rw-r--r--crates/test-utils/src/minicore.rs4
12 files changed, 29 insertions, 29 deletions
diff --git a/crates/hir-def/src/expr_store/expander.rs b/crates/hir-def/src/expr_store/expander.rs
index de5974fff1..d34ec9bbc1 100644
--- a/crates/hir-def/src/expr_store/expander.rs
+++ b/crates/hir-def/src/expr_store/expander.rs
@@ -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,
}
diff --git a/crates/hir-def/src/expr_store/lower.rs b/crates/hir-def/src/expr_store/lower.rs
index d3774ded39..4ae4271b92 100644
--- a/crates/hir-def/src/expr_store/lower.rs
+++ b/crates/hir-def/src/expr_store/lower.rs
@@ -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)
diff --git a/crates/hir-def/src/resolver.rs b/crates/hir-def/src/resolver.rs
index f643ed31ad..2ac0f90fb2 100644
--- a/crates/hir-def/src/resolver.rs
+++ b/crates/hir-def/src/resolver.rs
@@ -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)
diff --git a/crates/hir-expand/src/declarative.rs b/crates/hir-expand/src/declarative.rs
index d2df9a1ff6..d10e122a5d 100644
--- a/crates/hir-expand/src/declarative.rs
+++ b/crates/hir-expand/src/declarative.rs
@@ -100,7 +100,8 @@ 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(()),
}
@@ -140,7 +141,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() {
diff --git a/crates/hir-expand/src/hygiene.rs b/crates/hir-expand/src/hygiene.rs
index bd6f7e4f2b..ce7650d077 100644
--- a/crates/hir-expand/src/hygiene.rs
+++ b/crates/hir-expand/src/hygiene.rs
@@ -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(
@@ -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)
@@ -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);
}
@@ -138,6 +138,6 @@ fn apply_mark_internal(
edition,
parent,
|_| opaque,
- |_| opaque_and_semitransparent,
+ |_| opaque_and_semiopaque,
)
}
diff --git a/crates/hir-expand/src/inert_attr_macro.rs b/crates/hir-expand/src/inert_attr_macro.rs
index 385c98ef87..b491902377 100644
--- a/crates/hir-expand/src/inert_attr_macro.rs
+++ b/crates/hir-expand/src/inert_attr_macro.rs
@@ -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",
),
diff --git a/crates/hir-expand/src/mod_path.rs b/crates/hir-expand/src/mod_path.rs
index 51e449fe50..1712c28aa8 100644
--- a/crates/hir-expand/src/mod_path.rs
+++ b/crates/hir-expand/src/mod_path.rs
@@ -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);
}
diff --git a/crates/hir-ty/src/tests/simple.rs b/crates/hir-ty/src/tests/simple.rs
index 6367521841..a9a5e96f75 100644
--- a/crates/hir-ty/src/tests/simple.rs
+++ b/crates/hir-ty/src/tests/simple.rs
@@ -3708,7 +3708,7 @@ fn main() {
}
#[test]
-fn macro_semitransparent_hygiene() {
+fn macro_semiopaque_hygiene() {
check_types(
r#"
macro_rules! m {
diff --git a/crates/hir/src/source_analyzer.rs b/crates/hir/src/source_analyzer.rs
index bf123e13f9..6ba7a42c19 100644
--- a/crates/hir/src/source_analyzer.rs
+++ b/crates/hir/src/source_analyzer.rs
@@ -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))
}
diff --git a/crates/intern/src/symbol/symbols.rs b/crates/intern/src/symbol/symbols.rs
index b6efc599f1..6181413a46 100644
--- a/crates/intern/src/symbol/symbols.rs
+++ b/crates/intern/src/symbol/symbols.rs
@@ -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,
diff --git a/crates/span/src/hygiene.rs b/crates/span/src/hygiene.rs
index ea4f4c5efb..fdfa94dfee 100644
--- a/crates/span/src/hygiene.rs
+++ b/crates/span/src/hygiene.rs
@@ -46,7 +46,7 @@ const _: () = {
edition: Edition,
parent: SyntaxContext,
opaque: SyntaxContext,
- opaque_and_semitransparent: SyntaxContext,
+ opaque_and_semiopaque: SyntaxContext,
}
impl PartialEq for SyntaxContextData {
@@ -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,
@@ -241,7 +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(
+ opaque_and_semiopaque: opaque_and_semiopaque(
zalsa_::FromId::from_id(id),
),
},
@@ -301,7 +301,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,
@@ -317,7 +317,7 @@ 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,
{
@@ -325,7 +325,7 @@ const _: () = {
Some(id) => {
let zalsa = db.zalsa();
let fields = SyntaxContext::ingredient(zalsa).data(zalsa, id);
- fields.opaque_and_semitransparent
+ fields.opaque_and_semiopaque
}
None => self,
}
@@ -405,7 +405,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 {
@@ -476,13 +476,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,
diff --git a/crates/test-utils/src/minicore.rs b/crates/test-utils/src/minicore.rs
index 01274a9835..c3429356d9 100644
--- a/crates/test-utils/src/minicore.rs
+++ b/crates/test-utils/src/minicore.rs
@@ -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
}