Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 021861a

Browse files
committedJan 22, 2024
Auto merge of rust-lang#120239 - matthiaskrgr:rollup-vqjn6ot, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - rust-lang#118578 (core: introduce split_at{,_mut}_checked) - rust-lang#119369 (exclude unexported macro bindings from extern crate) - rust-lang#119408 (xous: misc fixes + add network support) - rust-lang#119943 (std::net: bind update for using backlog as `-1` too.) - rust-lang#119948 (Make `unsafe_op_in_unsafe_fn` migrated in edition 2024) - rust-lang#119999 (remote-test: use u64 to represent file size) - rust-lang#120152 (add help message for `exclusive_range_pattern` error) - rust-lang#120213 (Don't actually make bound ty/const for RTN) - rust-lang#120225 (Fix -Zremap-path-scope typo) Failed merges: - rust-lang#119972 (Add `ErrCode`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 3066253 + 44e44f4 commit 021861a

File tree

60 files changed

+2374
-314
lines changed

Some content is hidden

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

60 files changed

+2374
-314
lines changed
 

‎compiler/rustc_resolve/src/imports.rs

+9-5
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,11 @@ pub(crate) enum ImportKind<'a> {
8080
target: Ident,
8181
id: NodeId,
8282
},
83-
MacroUse,
83+
MacroUse {
84+
/// A field has been added indicating whether it should be reported as a lint,
85+
/// addressing issue#119301.
86+
warn_private: bool,
87+
},
8488
MacroExport,
8589
}
8690

@@ -127,7 +131,7 @@ impl<'a> std::fmt::Debug for ImportKind<'a> {
127131
.field("target", target)
128132
.field("id", id)
129133
.finish(),
130-
MacroUse => f.debug_struct("MacroUse").finish(),
134+
MacroUse { .. } => f.debug_struct("MacroUse").finish(),
131135
MacroExport => f.debug_struct("MacroExport").finish(),
132136
}
133137
}
@@ -197,7 +201,7 @@ impl<'a> ImportData<'a> {
197201
ImportKind::Single { id, .. }
198202
| ImportKind::Glob { id, .. }
199203
| ImportKind::ExternCrate { id, .. } => Some(id),
200-
ImportKind::MacroUse | ImportKind::MacroExport => None,
204+
ImportKind::MacroUse { .. } | ImportKind::MacroExport => None,
201205
}
202206
}
203207

@@ -207,7 +211,7 @@ impl<'a> ImportData<'a> {
207211
ImportKind::Single { id, .. } => Reexport::Single(to_def_id(id)),
208212
ImportKind::Glob { id, .. } => Reexport::Glob(to_def_id(id)),
209213
ImportKind::ExternCrate { id, .. } => Reexport::ExternCrate(to_def_id(id)),
210-
ImportKind::MacroUse => Reexport::MacroUse,
214+
ImportKind::MacroUse { .. } => Reexport::MacroUse,
211215
ImportKind::MacroExport => Reexport::MacroExport,
212216
}
213217
}
@@ -1482,7 +1486,7 @@ fn import_kind_to_string(import_kind: &ImportKind<'_>) -> String {
14821486
ImportKind::Single { source, .. } => source.to_string(),
14831487
ImportKind::Glob { .. } => "*".to_string(),
14841488
ImportKind::ExternCrate { .. } => "<extern crate>".to_string(),
1485-
ImportKind::MacroUse => "#[macro_use]".to_string(),
1489+
ImportKind::MacroUse { .. } => "#[macro_use]".to_string(),
14861490
ImportKind::MacroExport => "#[macro_export]".to_string(),
14871491
}
14881492
}

‎compiler/rustc_resolve/src/lib.rs

+5
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ use rustc_middle::span_bug;
5555
use rustc_middle::ty::{self, MainDefinition, RegisteredTools, TyCtxt};
5656
use rustc_middle::ty::{ResolverGlobalCtxt, ResolverOutputs};
5757
use rustc_query_system::ich::StableHashingContext;
58+
use rustc_session::lint::builtin::PRIVATE_MACRO_USE;
5859
use rustc_session::lint::LintBuffer;
5960
use rustc_span::hygiene::{ExpnId, LocalExpnId, MacroKind, SyntaxContext, Transparency};
6061
use rustc_span::symbol::{kw, sym, Ident, Symbol};
@@ -1799,6 +1800,10 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
17991800
}
18001801
}
18011802
if let NameBindingKind::Import { import, binding, ref used } = used_binding.kind {
1803+
if let ImportKind::MacroUse { warn_private: true } = import.kind {
1804+
let msg = format!("macro `{ident}` is private");
1805+
self.lint_buffer().buffer_lint(PRIVATE_MACRO_USE, import.root_id, ident.span, msg);
1806+
}
18021807
// Avoid marking `extern crate` items that refer to a name from extern prelude,
18031808
// but not introduce it, as used if they are accessed from lexical scope.
18041809
if is_lexical_scope {

‎library/core/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@
185185
#![feature(set_ptr_value)]
186186
#![feature(slice_ptr_get)]
187187
#![feature(slice_split_at_unchecked)]
188+
#![feature(split_at_checked)]
188189
#![feature(str_internals)]
189190
#![feature(str_split_inclusive_remainder)]
190191
#![feature(str_split_remainder)]
There was a problem loading the remainder of the diff.

0 commit comments

Comments
 (0)
Failed to load comments.