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 16 pull requests #138326

Closed
wants to merge 58 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
01795b1
change definitely non-productive cycles to error
lcnr Feb 27, 2025
18809a2
keep inductive cycles as ambig in coherence
lcnr Feb 28, 2025
36efaf8
normalize away `-Wlinker-messages` wrappers from `rust-lld` rmake test
lqd Mar 5, 2025
b2de19e
Update bootstrap to edition 2024
Kobzol Feb 25, 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
f525b17
Remove AdtFlags::IS_ANONYMOUS and Copy/Clone condition for anonymous ADT
compiler-errors Mar 10, 2025
b827087
add tracking issue for unqualified_local_imports
RalfJung Mar 10, 2025
02bb2d4
Disable CFI for weakly linked syscalls
1c3t3a Mar 4, 2025
e5dc1e3
Add comments for #[no_sanitize(cfi)] in stdlib
1c3t3a Mar 10, 2025
fb9ce02
Limit formatting width and precision to 16 bits.
m-ou-se Feb 12, 2025
4374d54
Update tests.
m-ou-se Feb 12, 2025
ce512c2
Fix rust-analyzer for 16-bit fmt width and precision.
m-ou-se Feb 12, 2025
7677567
Remove unnecessary semicolon.
m-ou-se Feb 28, 2025
2647cf1
Add #[track_caller] to from_usize.
m-ou-se Feb 28, 2025
7ca7675
Make all keys explicit in citool
Kobzol Feb 27, 2025
112f7b0
make precise capturing args in rustdoc Json typed
Kohei316 Mar 2, 2025
0412507
Move job handling to a separate module
Kobzol Mar 10, 2025
2ce0205
Share implementation of expr_u{16,32,size}.
m-ou-se 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
bf58a35
stabilize `ci_rustc_if_unchanged_logic` test for local environments
onur-ozkan Mar 8, 2025
32e0ce2
remove rls support from bootstrap
onur-ozkan Mar 10, 2025
733cbb5
remove rls specific parts from tidy and build-manifest
onur-ozkan Mar 10, 2025
91f8a40
remove rls source from the repository
onur-ozkan Mar 10, 2025
a657aeb
add change entry for rls removal
onur-ozkan Mar 10, 2025
5d4ff50
Update books
rustbot Mar 10, 2025
dcf6137
use next_back() instead of last() on DoubleEndedIterator
matthiaskrgr Mar 10, 2025
e337d87
Add powerpc64le maintainers
daltenty Mar 7, 2025
d75c973
main.js: insertAfter needs non-root referenceNode
lolbinarycat Mar 10, 2025
93161f5
main.js: don't set mouseMovedAfterSearch, as it is never read
lolbinarycat Mar 10, 2025
cf7f3cf
main.js: give type signatures to a few helper functions
lolbinarycat Mar 10, 2025
da5da99
main.js: handleEscape and handleShortcut accept KeyboardEvent
lolbinarycat Mar 10, 2025
6622111
main.js: always refer to searchState through window.searchState
lolbinarycat Mar 10, 2025
f5efd2a
main.js(isDisplayed): coerce truthy values to boolean
lolbinarycat Mar 10, 2025
ab180c2
main.js: handle document.activeElement being null
lolbinarycat Mar 10, 2025
2e1c8f0
rustdoc.d.ts: window.SIDEBAR_ITEMS may exist.
lolbinarycat Mar 10, 2025
749b6bf
rustdoc.d.ts: add window.{register_implementors,pending_implementors}
lolbinarycat Mar 10, 2025
7421546
main.js: typecheck things related to window.register_type_impls
lolbinarycat Mar 10, 2025
20bac26
main.js: remove searchState from globals.
lolbinarycat Mar 10, 2025
a795fdf
Rollup merge of #126856 - onur-ozkan:remove-rls, r=clubby789
jieyouxu Mar 11, 2025
c5d8654
Rollup merge of #136932 - m-ou-se:fmt-width-precision-u16, r=scottmcm
jieyouxu Mar 11, 2025
aa96996
Rollup merge of #137314 - lcnr:cycles-with-unknown-kind, r=compiler-e…
jieyouxu Mar 11, 2025
450e355
Rollup merge of #137612 - Kobzol:bootstrap-2024, r=onur-ozkan
jieyouxu Mar 11, 2025
37af1b0
Rollup merge of #138002 - 1c3t3a:fix-std-cfi-violation, r=rcvalle
jieyouxu Mar 11, 2025
4a8dba8
Rollup merge of #138052 - lqd:lld-linker-messages, r=jieyouxu
jieyouxu Mar 11, 2025
f659d0c
Rollup merge of #138063 - compiler-errors:improve-attr-unpretty, r=jd…
jieyouxu Mar 11, 2025
559f3a7
Rollup merge of #138109 - Kohei316:feat/rust-doc-precise-capturing-ar…
jieyouxu Mar 11, 2025
8d6d349
Rollup merge of #138147 - daltenty:patch-1, r=jieyouxu
jieyouxu Mar 11, 2025
c376c91
Rollup merge of #138245 - onur-ozkan:ci-rustc-test-fix, r=jieyouxu
jieyouxu Mar 11, 2025
71cb3b2
Rollup merge of #138296 - compiler-errors:deanonymous, r=lcnr
jieyouxu Mar 11, 2025
e913d9d
Rollup merge of #138300 - RalfJung:unqualified-local-imports, r=jieyouxu
jieyouxu Mar 11, 2025
f8df5ae
Rollup merge of #138307 - Kobzol:citool-alias, r=marcoieni
jieyouxu Mar 11, 2025
51cc1a8
Rollup merge of #138313 - rustbot:docs-update, r=ehuss
jieyouxu Mar 11, 2025
1cf279e
Rollup merge of #138315 - matthiaskrgr:nextback, r=fmease
jieyouxu Mar 11, 2025
3ece708
Rollup merge of #138318 - lolbinarycat:rustdoc-js-less-expect-error-p…
jieyouxu 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
7 changes: 0 additions & 7 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3044,13 +3044,6 @@ dependencies = [
"serde",
]

[[package]]
name = "rls"
version = "2.0.0"
dependencies = [
"serde_json",
]

[[package]]
name = "run_make_support"
version = "0.2.0"
Expand Down
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ members = [
"src/tools/remote-test-server",
"src/tools/rust-installer",
"src/tools/rustdoc",
"src/tools/rls",
"src/tools/rustfmt",
"src/tools/miri",
"src/tools/miri/cargo-miri",
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast/src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ pub enum FormatAlignment {
#[derive(Clone, Encodable, Decodable, Debug, PartialEq, Eq)]
pub enum FormatCount {
/// `{:5}` or `{:.5}`
Literal(usize),
Literal(u16),
/// `{:.*}`, `{:.5$}`, or `{:a$}`, etc.
Argument(FormatArgPosition),
}
24 changes: 11 additions & 13 deletions compiler/rustc_ast_lowering/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2130,26 +2130,24 @@ impl<'hir> LoweringContext<'_, 'hir> {
self.arena.alloc(self.expr(sp, hir::ExprKind::Tup(&[])))
}

pub(super) fn expr_usize(&mut self, sp: Span, value: usize) -> hir::Expr<'hir> {
fn expr_uint(&mut self, sp: Span, ty: ast::UintTy, value: u128) -> hir::Expr<'hir> {
let lit = self.arena.alloc(hir::Lit {
span: sp,
node: ast::LitKind::Int(
(value as u128).into(),
ast::LitIntType::Unsigned(ast::UintTy::Usize),
),
node: ast::LitKind::Int(value.into(), ast::LitIntType::Unsigned(ty)),
});
self.expr(sp, hir::ExprKind::Lit(lit))
}

pub(super) fn expr_usize(&mut self, sp: Span, value: usize) -> hir::Expr<'hir> {
self.expr_uint(sp, ast::UintTy::Usize, value as u128)
}

pub(super) fn expr_u32(&mut self, sp: Span, value: u32) -> hir::Expr<'hir> {
let lit = self.arena.alloc(hir::Lit {
span: sp,
node: ast::LitKind::Int(
u128::from(value).into(),
ast::LitIntType::Unsigned(ast::UintTy::U32),
),
});
self.expr(sp, hir::ExprKind::Lit(lit))
self.expr_uint(sp, ast::UintTy::U32, value as u128)
}

pub(super) fn expr_u16(&mut self, sp: Span, value: u16) -> hir::Expr<'hir> {
self.expr_uint(sp, ast::UintTy::U16, value as u128)
}

pub(super) fn expr_char(&mut self, sp: Span, value: char) -> hir::Expr<'hir> {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast_lowering/src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ fn make_count<'hir>(
hir::LangItem::FormatCount,
sym::Is,
));
let value = ctx.arena.alloc_from_iter([ctx.expr_usize(sp, *n)]);
let value = ctx.arena.alloc_from_iter([ctx.expr_u16(sp, *n)]);
ctx.expr_call_mut(sp, count_is, value)
}
Some(FormatCount::Argument(arg)) => {
Expand Down
52 changes: 30 additions & 22 deletions compiler/rustc_attr_data_structures/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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("[");
Expand All @@ -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) { }
})*
};
Expand All @@ -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));
}
Expand All @@ -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));
}
Expand All @@ -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();
}
}
}
Expand All @@ -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.
///
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_feature/src/unstable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
11 changes: 7 additions & 4 deletions compiler/rustc_hir/src/hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3368,13 +3368,16 @@ pub struct OpaqueTy<'hir> {
pub span: Span,
}

#[derive(Debug, Clone, Copy, HashStable_Generic)]
pub enum PreciseCapturingArg<'hir> {
Lifetime(&'hir Lifetime),
#[derive(Debug, Clone, Copy, HashStable_Generic, Encodable, Decodable)]
pub enum PreciseCapturingArgKind<T, U> {
Lifetime(T),
/// Non-lifetime argument (type or const)
Param(PreciseCapturingNonLifetimeArg),
Param(U),
}

pub type PreciseCapturingArg<'hir> =
PreciseCapturingArgKind<&'hir Lifetime, PreciseCapturingNonLifetimeArg>;

impl PreciseCapturingArg<'_> {
pub fn hir_id(self) -> HirId {
match self {
Expand Down
11 changes: 8 additions & 3 deletions compiler/rustc_hir_analysis/src/collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use rustc_errors::{
use rustc_hir::def::DefKind;
use rustc_hir::def_id::{DefId, LocalDefId};
use rustc_hir::intravisit::{self, InferKind, Visitor, VisitorExt, walk_generics};
use rustc_hir::{self as hir, GenericParamKind, HirId, Node};
use rustc_hir::{self as hir, GenericParamKind, HirId, Node, PreciseCapturingArgKind};
use rustc_infer::infer::{InferCtxt, TyCtxtInferExt};
use rustc_infer::traits::ObligationCause;
use rustc_middle::hir::nested_filter;
Expand Down Expand Up @@ -1792,7 +1792,7 @@ fn opaque_ty_origin<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> hir::OpaqueT
fn rendered_precise_capturing_args<'tcx>(
tcx: TyCtxt<'tcx>,
def_id: LocalDefId,
) -> Option<&'tcx [Symbol]> {
) -> Option<&'tcx [PreciseCapturingArgKind<Symbol, Symbol>]> {
if let Some(ty::ImplTraitInTraitData::Trait { opaque_def_id, .. }) =
tcx.opt_rpitit_info(def_id.to_def_id())
{
Expand All @@ -1801,7 +1801,12 @@ fn rendered_precise_capturing_args<'tcx>(

tcx.hir_node_by_def_id(def_id).expect_opaque_ty().bounds.iter().find_map(|bound| match bound {
hir::GenericBound::Use(args, ..) => {
Some(&*tcx.arena.alloc_from_iter(args.iter().map(|arg| arg.name())))
Some(&*tcx.arena.alloc_from_iter(args.iter().map(|arg| match arg {
PreciseCapturingArgKind::Lifetime(_) => {
PreciseCapturingArgKind::Lifetime(arg.name())
}
PreciseCapturingArgKind::Param(_) => PreciseCapturingArgKind::Param(arg.name()),
})))
}
_ => None,
})
Expand Down
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
Expand Up @@ -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 \
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_hir_pretty/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
Expand Down
27 changes: 16 additions & 11 deletions compiler/rustc_macros/src/print_attribute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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("}");
Expand All @@ -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);
Expand All @@ -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 },
)
Expand Down Expand Up @@ -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 }
}
})
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_metadata/src/rmeta/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use rustc_abi::{FieldIdx, ReprOptions, VariantIdx};
use rustc_ast::expand::StrippedCfgItem;
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::svh::Svh;
use rustc_hir::PreciseCapturingArgKind;
use rustc_hir::def::{CtorKind, DefKind, DocLinkResMap};
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, DefIndex, DefPathHash, StableCrateId};
use rustc_hir::definitions::DefKey;
Expand Down Expand Up @@ -440,7 +441,7 @@ define_tables! {
coerce_unsized_info: Table<DefIndex, LazyValue<ty::adjustment::CoerceUnsizedInfo>>,
mir_const_qualif: Table<DefIndex, LazyValue<mir::ConstQualifs>>,
rendered_const: Table<DefIndex, LazyValue<String>>,
rendered_precise_capturing_args: Table<DefIndex, LazyArray<Symbol>>,
rendered_precise_capturing_args: Table<DefIndex, LazyArray<PreciseCapturingArgKind<Symbol, Symbol>>>,
asyncness: Table<DefIndex, ty::Asyncness>,
fn_arg_names: Table<DefIndex, LazyArray<Ident>>,
coroutine_kind: Table<DefIndex, hir::CoroutineKind>,
Expand Down
Loading
Loading