Skip to content

Commit 6cb29c5

Browse files
committed
Auto merge of #151743 - JonathanBrouwer:rollup-lEYzf1h, r=JonathanBrouwer
Rollup of 4 pull requests Successful merges: - #150491 (resolve: Mark items under exported ambiguous imports as exported) - #151161 (std: move time implementations to `sys`) - #151694 (more `proc_macro` bridge cleanups) - #151711 (stdarch subtree update)
2 parents 94a0cd1 + 59a6f49 commit 6cb29c5

File tree

76 files changed

+8009
-7659
lines changed

Some content is hidden

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

76 files changed

+8009
-7659
lines changed

compiler/rustc_expand/src/proc_macro_server.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -458,13 +458,11 @@ impl<'a, 'b> Rustc<'a, 'b> {
458458
}
459459
}
460460

461-
impl server::Types for Rustc<'_, '_> {
461+
impl server::Server for Rustc<'_, '_> {
462462
type TokenStream = TokenStream;
463463
type Span = Span;
464464
type Symbol = Symbol;
465-
}
466465

467-
impl server::Server for Rustc<'_, '_> {
468466
fn globals(&mut self) -> ExpnGlobals<Self::Span> {
469467
ExpnGlobals {
470468
def_site: self.def_site,

compiler/rustc_resolve/src/effective_visibilities.rs

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,10 @@ impl<'a, 'ra, 'tcx> EffectiveVisibilitiesVisitor<'a, 'ra, 'tcx> {
9696
// is the maximum value among visibilities of declarations corresponding to that def id.
9797
for (decl, eff_vis) in visitor.import_effective_visibilities.iter() {
9898
let DeclKind::Import { import, .. } = decl.kind else { unreachable!() };
99-
if !decl.is_ambiguity_recursive() {
100-
if let Some(node_id) = import.id() {
101-
r.effective_visibilities.update_eff_vis(r.local_def_id(node_id), eff_vis, r.tcx)
102-
}
103-
} else if decl.ambiguity.get().is_some()
104-
&& eff_vis.is_public_at_level(Level::Reexported)
105-
{
99+
if let Some(node_id) = import.id() {
100+
r.effective_visibilities.update_eff_vis(r.local_def_id(node_id), eff_vis, r.tcx)
101+
}
102+
if decl.ambiguity.get().is_some() && eff_vis.is_public_at_level(Level::Reexported) {
106103
exported_ambiguities.insert(*decl);
107104
}
108105
}
@@ -123,31 +120,13 @@ impl<'a, 'ra, 'tcx> EffectiveVisibilitiesVisitor<'a, 'ra, 'tcx> {
123120
// Set the given effective visibility level to `Level::Direct` and
124121
// sets the rest of the `use` chain to `Level::Reexported` until
125122
// we hit the actual exported item.
126-
//
127-
// If the binding is ambiguous, put the root ambiguity binding and all reexports
128-
// leading to it into the table. They are used by the `ambiguous_glob_reexports`
129-
// lint. For all bindings added to the table this way `is_ambiguity` returns true.
130-
let is_ambiguity =
131-
|decl: Decl<'ra>, warn: bool| decl.ambiguity.get().is_some() && !warn;
132123
let mut parent_id = ParentId::Def(module_id);
133-
let mut warn_ambiguity = decl.warn_ambiguity.get();
134124
while let DeclKind::Import { source_decl, .. } = decl.kind {
135125
self.update_import(decl, parent_id);
136-
137-
if is_ambiguity(decl, warn_ambiguity) {
138-
// Stop at the root ambiguity, further bindings in the chain should not
139-
// be reexported because the root ambiguity blocks any access to them.
140-
// (Those further bindings are most likely not ambiguities themselves.)
141-
break;
142-
}
143-
144126
parent_id = ParentId::Import(decl);
145127
decl = source_decl;
146-
warn_ambiguity |= source_decl.warn_ambiguity.get();
147128
}
148-
if !is_ambiguity(decl, warn_ambiguity)
149-
&& let Some(def_id) = decl.res().opt_def_id().and_then(|id| id.as_local())
150-
{
129+
if let Some(def_id) = decl.res().opt_def_id().and_then(|id| id.as_local()) {
151130
self.update_def(def_id, decl.vis().expect_local(), parent_id);
152131
}
153132
}

library/core/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@
182182
#![feature(staged_api)]
183183
#![feature(stmt_expr_attributes)]
184184
#![feature(strict_provenance_lints)]
185+
#![feature(target_feature_inline_always)]
185186
#![feature(trait_alias)]
186187
#![feature(transparent_unions)]
187188
#![feature(try_blocks)]

library/proc_macro/src/bridge/client.rs

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,19 @@ impl Drop for TokenStream {
3030
}
3131

3232
impl<S> Encode<S> for TokenStream {
33-
fn encode(self, w: &mut Writer, s: &mut S) {
33+
fn encode(self, w: &mut Buffer, s: &mut S) {
3434
mem::ManuallyDrop::new(self).handle.encode(w, s);
3535
}
3636
}
3737

3838
impl<S> Encode<S> for &TokenStream {
39-
fn encode(self, w: &mut Writer, s: &mut S) {
39+
fn encode(self, w: &mut Buffer, s: &mut S) {
4040
self.handle.encode(w, s);
4141
}
4242
}
4343

4444
impl<S> Decode<'_, '_, S> for TokenStream {
45-
fn decode(r: &mut Reader<'_>, s: &mut S) -> Self {
45+
fn decode(r: &mut &[u8], s: &mut S) -> Self {
4646
TokenStream { handle: handle::Handle::decode(r, s) }
4747
}
4848
}
@@ -56,23 +56,17 @@ impl !Send for Span {}
5656
impl !Sync for Span {}
5757

5858
impl<S> Encode<S> for Span {
59-
fn encode(self, w: &mut Writer, s: &mut S) {
59+
fn encode(self, w: &mut Buffer, s: &mut S) {
6060
self.handle.encode(w, s);
6161
}
6262
}
6363

6464
impl<S> Decode<'_, '_, S> for Span {
65-
fn decode(r: &mut Reader<'_>, s: &mut S) -> Self {
65+
fn decode(r: &mut &[u8], s: &mut S) -> Self {
6666
Span { handle: handle::Handle::decode(r, s) }
6767
}
6868
}
6969

70-
// FIXME(eddyb) generate these impls by pattern-matching on the
71-
// names of methods - also could use the presence of `fn drop`
72-
// to distinguish between 'owned and 'interned, above.
73-
// Alternatively, special "modes" could be listed of types in with_api
74-
// instead of pattern matching on methods, here and in server decl.
75-
7670
impl Clone for TokenStream {
7771
fn clone(&self) -> Self {
7872
Methods::ts_clone(self)
@@ -104,18 +98,15 @@ pub(crate) use super::symbol::Symbol;
10498

10599
macro_rules! define_client_side {
106100
(
107-
Methods {
108-
$(fn $method:ident($($arg:ident: $arg_ty:ty),* $(,)?) $(-> $ret_ty:ty)*;)*
109-
},
110-
$($name:ident),* $(,)?
101+
$(fn $method:ident($($arg:ident: $arg_ty:ty),* $(,)?) $(-> $ret_ty:ty)*;)*
111102
) => {
112103
impl Methods {
113104
$(pub(crate) fn $method($($arg: $arg_ty),*) $(-> $ret_ty)? {
114105
Bridge::with(|bridge| {
115106
let mut buf = bridge.cached_buffer.take();
116107

117108
buf.clear();
118-
api_tags::Method::$method.encode(&mut buf, &mut ());
109+
ApiTags::$method.encode(&mut buf, &mut ());
119110
$($arg.encode(&mut buf, &mut ());)*
120111

121112
buf = bridge.dispatch.call(buf);
@@ -130,7 +121,7 @@ macro_rules! define_client_side {
130121
}
131122
}
132123
}
133-
with_api!(self, self, define_client_side);
124+
with_api!(self, define_client_side);
134125

135126
struct Bridge<'a> {
136127
/// Reusable buffer (only `clear`-ed, never shrunk), primarily

0 commit comments

Comments
 (0)