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 10 pull requests #138350

Merged
merged 27 commits into from
Mar 11, 2025
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
2a7ad95
Fix test hangs on AIX
mustartt Mar 3, 2025
506c304
Clarify iterator by_ref docs
hkBst Jan 24, 2025
6a38322
Rename print_something to should_render
compiler-errors Mar 5, 2025
279377f
Fix pretty printing of parsed attrs in hir_pretty
compiler-errors Mar 5, 2025
b827087
add tracking issue for unqualified_local_imports
RalfJung Mar 10, 2025
7ca7675
Make all keys explicit in citool
Kobzol Feb 27, 2025
0412507
Move job handling to a separate module
Kobzol Mar 10, 2025
3326a9f
Allow using glob aliases for custom try jobs
Kobzol Mar 10, 2025
06d86cd
Modify try-job documentation
Kobzol Mar 10, 2025
dfef1a7
Handle backticks in try job patterns
Kobzol Mar 10, 2025
16c08f6
Ignore job duplicates
Kobzol Mar 10, 2025
dcf6137
use next_back() instead of last() on DoubleEndedIterator
matthiaskrgr Mar 10, 2025
e337d87
Add powerpc64le maintainers
daltenty Mar 7, 2025
32afef4
Remove unnecessary `[lints.rust]` sections.
nnethercote Mar 11, 2025
c00a5c0
Fix post-merge workflow
jieyouxu Mar 11, 2025
6e83ebe
Document -Z crate-attr
jyn514 Mar 9, 2025
512ebed
add more -Z crate-attr tests
jyn514 Mar 11, 2025
bb2324a
Rollup merge of #135987 - hkBst:patch-20, r=joboet
Kobzol Mar 11, 2025
95d9ade
Rollup merge of #137967 - mustartt:fix-aix-test-hangs, r=workingjubilee
Kobzol Mar 11, 2025
c054bac
Rollup merge of #138063 - compiler-errors:improve-attr-unpretty, r=jd…
Kobzol Mar 11, 2025
09cc57e
Rollup merge of #138147 - daltenty:patch-1, r=jieyouxu
Kobzol Mar 11, 2025
79fa56a
Rollup merge of #138288 - jyn514:crate-attr, r=Noratrieb
Kobzol Mar 11, 2025
07f33e2
Rollup merge of #138300 - RalfJung:unqualified-local-imports, r=jieyouxu
Kobzol Mar 11, 2025
3e67637
Rollup merge of #138307 - Kobzol:citool-alias, r=marcoieni
Kobzol Mar 11, 2025
03a79a7
Rollup merge of #138315 - matthiaskrgr:nextback, r=fmease
Kobzol Mar 11, 2025
7e4c08b
Rollup merge of #138330 - nnethercote:rm-lints-rust-sections, r=jieyouxu
Kobzol Mar 11, 2025
64c6ec5
Rollup merge of #138335 - jieyouxu:fix-citool, r=marcoieni
Kobzol Mar 11, 2025
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 .github/workflows/post-merge.yml
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ jobs:
cd src/ci/citool

echo "Post-merge analysis result" > output.log
cargo run --release post-merge-analysis ${PARENT_COMMIT} ${{ github.sha }} >> output.log
cargo run --release post-merge-report ${PARENT_COMMIT} ${{ github.sha }} >> output.log
cat output.log

gh pr comment ${HEAD_PR} -F output.log
52 changes: 30 additions & 22 deletions compiler/rustc_attr_data_structures/src/lib.rs
Original file line number Diff line number Diff line change
@@ -35,33 +35,39 @@ pub trait HashStableContext: rustc_ast::HashStableContext + rustc_abi::HashStabl
/// like [`Span`]s and empty tuples, are gracefully skipped so they don't clutter the
/// representation much.
pub trait PrintAttribute {
fn print_something(&self) -> bool;
/// Whether or not this will render as something meaningful, or if it's skipped
/// (which will force the containing struct to also skip printing a comma
/// and the field name).
fn should_render(&self) -> bool;

fn print_attribute(&self, p: &mut Printer);
}

impl<T: PrintAttribute> PrintAttribute for &T {
fn print_something(&self) -> bool {
T::print_something(self)
fn should_render(&self) -> bool {
T::should_render(self)
}

fn print_attribute(&self, p: &mut Printer) {
T::print_attribute(self, p)
}
}
impl<T: PrintAttribute> PrintAttribute for Option<T> {
fn print_something(&self) -> bool {
self.as_ref().is_some_and(|x| x.print_something())
fn should_render(&self) -> bool {
self.as_ref().is_some_and(|x| x.should_render())
}

fn print_attribute(&self, p: &mut Printer) {
if let Some(i) = self {
T::print_attribute(i, p)
}
}
}
impl<T: PrintAttribute> PrintAttribute for ThinVec<T> {
fn print_something(&self) -> bool {
self.is_empty() || self[0].print_something()
fn should_render(&self) -> bool {
self.is_empty() || self[0].should_render()
}

fn print_attribute(&self, p: &mut Printer) {
let mut last_printed = false;
p.word("[");
@@ -70,15 +76,15 @@ impl<T: PrintAttribute> PrintAttribute for ThinVec<T> {
p.word_space(",");
}
i.print_attribute(p);
last_printed = i.print_something();
last_printed = i.should_render();
}
p.word("]");
}
}
macro_rules! print_skip {
($($t: ty),* $(,)?) => {$(
impl PrintAttribute for $t {
fn print_something(&self) -> bool { false }
fn should_render(&self) -> bool { false }
fn print_attribute(&self, _: &mut Printer) { }
})*
};
@@ -87,7 +93,7 @@ macro_rules! print_skip {
macro_rules! print_disp {
($($t: ty),* $(,)?) => {$(
impl PrintAttribute for $t {
fn print_something(&self) -> bool { true }
fn should_render(&self) -> bool { true }
fn print_attribute(&self, p: &mut Printer) {
p.word(format!("{}", self));
}
@@ -97,7 +103,7 @@ macro_rules! print_disp {
macro_rules! print_debug {
($($t: ty),* $(,)?) => {$(
impl PrintAttribute for $t {
fn print_something(&self) -> bool { true }
fn should_render(&self) -> bool { true }
fn print_attribute(&self, p: &mut Printer) {
p.word(format!("{:?}", self));
}
@@ -106,37 +112,39 @@ macro_rules! print_debug {
}

macro_rules! print_tup {
(num_print_something $($ts: ident)*) => { 0 $(+ $ts.print_something() as usize)* };
(num_should_render $($ts: ident)*) => { 0 $(+ $ts.should_render() as usize)* };
() => {};
($t: ident $($ts: ident)*) => {
#[allow(non_snake_case, unused)]
impl<$t: PrintAttribute, $($ts: PrintAttribute),*> PrintAttribute for ($t, $($ts),*) {
fn print_something(&self) -> bool {
fn should_render(&self) -> bool {
let ($t, $($ts),*) = self;
print_tup!(num_print_something $t $($ts)*) != 0
print_tup!(num_should_render $t $($ts)*) != 0
}

fn print_attribute(&self, p: &mut Printer) {
let ($t, $($ts),*) = self;
let parens = print_tup!(num_print_something $t $($ts)*) > 1;
let parens = print_tup!(num_should_render $t $($ts)*) > 1;
if parens {
p.word("(");
p.popen();
}

let mut printed_anything = $t.print_something();
let mut printed_anything = $t.should_render();

$t.print_attribute(p);

$(
if printed_anything && $ts.print_something() {
p.word_space(",");
if $ts.should_render() {
if printed_anything {
p.word_space(",");
}
printed_anything = true;
}
$ts.print_attribute(p);
)*

if parens {
p.word(")");
p.pclose();
}
}
}
@@ -147,8 +155,8 @@ macro_rules! print_tup {

print_tup!(A B C D E F G H);
print_skip!(Span, ());
print_disp!(Symbol, u16, bool, NonZero<u32>);
print_debug!(UintTy, IntTy, Align, AttrStyle, CommentKind, Transparency);
print_disp!(u16, bool, NonZero<u32>);
print_debug!(Symbol, UintTy, IntTy, Align, AttrStyle, CommentKind, Transparency);

/// Finds attributes in sequences of attributes by pattern matching.
///
4 changes: 0 additions & 4 deletions compiler/rustc_builtin_macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -3,10 +3,6 @@ name = "rustc_builtin_macros"
version = "0.0.0"
edition = "2024"


[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(llvm_enzyme)'] }

[lib]
doctest = false

2 changes: 1 addition & 1 deletion compiler/rustc_feature/src/unstable.rs
Original file line number Diff line number Diff line change
@@ -240,7 +240,7 @@ declare_features! (
/// Added for testing unstable lints; perma-unstable.
(internal, test_unstable_lint, "1.60.0", None),
/// Helps with formatting for `group_imports = "StdExternalCrate"`.
(unstable, unqualified_local_imports, "1.83.0", None),
(unstable, unqualified_local_imports, "1.83.0", Some(138299)),
/// Use for stable + negative coherence and strict coherence depending on trait's
/// rustc_strict_coherence value.
(unstable, with_negative_coherence, "1.60.0", None),
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs
Original file line number Diff line number Diff line change
@@ -1520,7 +1520,7 @@ fn generics_args_err_extend<'a>(
})
.collect();
if args.len() > 1
&& let Some(span) = args.into_iter().last()
&& let Some(span) = args.into_iter().next_back()
{
err.note(
"generic arguments are not allowed on both an enum and its variant's path \
4 changes: 2 additions & 2 deletions compiler/rustc_hir_pretty/src/lib.rs
Original file line number Diff line number Diff line change
@@ -118,9 +118,9 @@ impl<'a> State<'a> {
self.hardbreak()
}
hir::Attribute::Parsed(pa) => {
self.word("#[attr=\"");
self.word("#[attr = ");
pa.print_attribute(self);
self.word("\")]");
self.word("]");
self.hardbreak()
}
}
27 changes: 16 additions & 11 deletions compiler/rustc_macros/src/print_attribute.rs
Original file line number Diff line number Diff line change
@@ -16,12 +16,14 @@ fn print_fields(name: &Ident, fields: &Fields) -> (TokenStream, TokenStream, Tok
let name = field.ident.as_ref().unwrap();
let string_name = name.to_string();
disps.push(quote! {
if __printed_anything && #name.print_something() {
__p.word_space(",");
if #name.should_render() {
if __printed_anything {
__p.word_space(",");
}
__p.word(#string_name);
__p.word_space(":");
__printed_anything = true;
}
__p.word(#string_name);
__p.word_space(":");
#name.print_attribute(__p);
});
field_names.push(name);
@@ -31,10 +33,11 @@ fn print_fields(name: &Ident, fields: &Fields) -> (TokenStream, TokenStream, Tok
quote! { {#(#field_names),*} },
quote! {
__p.word(#string_name);
if true #(&& !#field_names.print_something())* {
if true #(&& !#field_names.should_render())* {
return;
}

__p.nbsp();
__p.word("{");
#(#disps)*
__p.word("}");
@@ -48,8 +51,10 @@ fn print_fields(name: &Ident, fields: &Fields) -> (TokenStream, TokenStream, Tok
for idx in 0..fields_unnamed.unnamed.len() {
let name = format_ident!("f{idx}");
disps.push(quote! {
if __printed_anything && #name.print_something() {
__p.word_space(",");
if #name.should_render() {
if __printed_anything {
__p.word_space(",");
}
__printed_anything = true;
}
#name.print_attribute(__p);
@@ -62,13 +67,13 @@ fn print_fields(name: &Ident, fields: &Fields) -> (TokenStream, TokenStream, Tok
quote! {
__p.word(#string_name);

if true #(&& !#field_names.print_something())* {
if true #(&& !#field_names.should_render())* {
return;
}

__p.word("(");
__p.popen();
#(#disps)*
__p.word(")");
__p.pclose();
},
quote! { true },
)
@@ -138,7 +143,7 @@ pub(crate) fn print_attribute(input: Structure<'_>) -> TokenStream {
input.gen_impl(quote! {
#[allow(unused)]
gen impl PrintAttribute for @Self {
fn print_something(&self) -> bool { #printed }
fn should_render(&self) -> bool { #printed }
fn print_attribute(&self, __p: &mut rustc_ast_pretty::pp::Printer) { #code }
}
})
2 changes: 1 addition & 1 deletion compiler/rustc_parse/src/parser/diagnostics.rs
Original file line number Diff line number Diff line change
@@ -2107,7 +2107,7 @@ impl<'a> Parser<'a> {
ast::GenericBound::Trait(poly) => Some(poly),
_ => None,
})
.last()
.next_back()
{
err.span_suggestion_verbose(
poly.span.shrink_to_hi(),
3 changes: 0 additions & 3 deletions compiler/rustc_type_ir/Cargo.toml
Original file line number Diff line number Diff line change
@@ -33,6 +33,3 @@ nightly = [
"rustc_index/nightly",
"rustc_ast_ir/nightly",
]

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(bootstrap)'] }
18 changes: 15 additions & 3 deletions library/core/src/iter/traits/iterator.rs
Original file line number Diff line number Diff line change
@@ -1825,10 +1825,19 @@ pub trait Iterator {
Inspect::new(self, f)
}

/// Borrows an iterator, rather than consuming it.
/// Creates a "by reference" adapter for this instance of `Iterator`.
///
/// This is useful to allow applying iterator adapters while still
/// retaining ownership of the original iterator.
/// Consuming method calls (direct or indirect calls to `next`)
/// on the "by reference" adapter will consume the original iterator,
/// but ownership-taking methods (those with a `self` parameter)
/// only take ownership of the "by reference" iterator.
///
/// This is useful for applying ownership-taking methods
/// (such as `take` in the example below)
/// without giving up ownership of the original iterator,
/// so you can use the original iterator afterwards.
///
/// Uses [impl<I: Iterator + ?Sized> Iterator for &mut I { type Item = I::Item; ...}](https://doc.rust-lang.org/nightly/std/iter/trait.Iterator.html#impl-Iterator-for-%26mut+I).
///
/// # Examples
///
@@ -4024,6 +4033,9 @@ where
}
}

/// Implements `Iterator` for mutable references to iterators, such as those produced by [`Iterator::by_ref`].
///
/// This implementation passes all method calls on to the original iterator.
#[stable(feature = "rust1", since = "1.0.0")]
impl<I: Iterator + ?Sized> Iterator for &mut I {
type Item = I::Item;
11 changes: 11 additions & 0 deletions library/std/src/net/test.rs
Original file line number Diff line number Diff line change
@@ -31,3 +31,14 @@ pub fn tsa<A: ToSocketAddrs>(a: A) -> Result<Vec<SocketAddr>, String> {
Err(e) => Err(e.to_string()),
}
}

pub fn compare_ignore_zoneid(a: &SocketAddr, b: &SocketAddr) -> bool {
match (a, b) {
(SocketAddr::V6(a), SocketAddr::V6(b)) => {
a.ip().segments() == b.ip().segments()
&& a.flowinfo() == b.flowinfo()
&& a.port() == b.port()
}
_ => a == b,
}
}
12 changes: 8 additions & 4 deletions library/std/src/net/udp/tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::net::test::{next_test_ip4, next_test_ip6};
use crate::net::test::{compare_ignore_zoneid, next_test_ip4, next_test_ip6};
use crate::net::*;
use crate::sync::mpsc::channel;
use crate::thread;
@@ -46,7 +46,7 @@ fn socket_smoke_test_ip4() {
let (nread, src) = t!(server.recv_from(&mut buf));
assert_eq!(nread, 1);
assert_eq!(buf[0], 99);
assert_eq!(src, client_ip);
assert_eq!(compare_ignore_zoneid(&src, &client_ip), true);
rx2.recv().unwrap();
})
}
@@ -78,7 +78,9 @@ fn udp_clone_smoke() {

let _t = thread::spawn(move || {
let mut buf = [0, 0];
assert_eq!(sock2.recv_from(&mut buf).unwrap(), (1, addr1));
let res = sock2.recv_from(&mut buf).unwrap();
assert_eq!(res.0, 1);
assert_eq!(compare_ignore_zoneid(&res.1, &addr1), true);
assert_eq!(buf[0], 1);
t!(sock2.send_to(&[2], &addr1));
});
@@ -94,7 +96,9 @@ fn udp_clone_smoke() {
});
tx1.send(()).unwrap();
let mut buf = [0, 0];
assert_eq!(sock1.recv_from(&mut buf).unwrap(), (1, addr2));
let res = sock1.recv_from(&mut buf).unwrap();
assert_eq!(res.0, 1);
assert_eq!(compare_ignore_zoneid(&res.1, &addr2), true);
rx2.recv().unwrap();
})
}
7 changes: 7 additions & 0 deletions src/ci/citool/Cargo.lock
Original file line number Diff line number Diff line change
@@ -107,6 +107,7 @@ dependencies = [
"build_helper",
"clap",
"csv",
"glob-match",
"insta",
"serde",
"serde_json",
@@ -308,6 +309,12 @@ dependencies = [
"wasi",
]

[[package]]
name = "glob-match"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9985c9503b412198aa4197559e9a318524ebc4519c229bfa05a535828c950b9d"

[[package]]
name = "hashbrown"
version = "0.15.2"
1 change: 1 addition & 0 deletions src/ci/citool/Cargo.toml
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ edition = "2021"
anyhow = "1"
clap = { version = "4.5", features = ["derive"] }
csv = "1"
glob-match = "0.2"
serde = { version = "1", features = ["derive"] }
serde_yaml = "0.9"
serde_json = "1"
Loading
Loading