Skip to content

Commit e3d314d

Browse files
authored
Merge pull request #21185 from rust-lang/rustc-pull
Rustc pull update
2 parents 9c44cb8 + 7c2523f commit e3d314d

File tree

1,329 files changed

+21023
-10871
lines changed

Some content is hidden

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

1,329 files changed

+21023
-10871
lines changed

bootstrap.example.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,11 @@
220220
# which is also used in places like debuginfo `DW_AT_producer`. This may be useful for
221221
# supplementary build information, like distro-specific package versions.
222222
#
223+
# IMPORTANT: Changing this value changes crate IDs and symbol name mangling, making
224+
# compiled artifacts incompatible. PGO profiles cannot be reused across different
225+
# descriptions, and incremental compilation caches are invalidated. Keep this value
226+
# consistent when reusing build artifacts.
227+
#
223228
# The Rust compiler will differentiate between versions of itself, including
224229
# based on this string, which means that if you wish to be compatible with
225230
# upstream Rust you need to set this to "". However, note that if you set this to "" but

compiler/rustc_ast/src/ast.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2513,8 +2513,6 @@ pub enum TyKind {
25132513
ImplTrait(NodeId, #[visitable(extra = BoundKind::Impl)] GenericBounds),
25142514
/// No-op; kept solely so that we can pretty-print faithfully.
25152515
Paren(Box<Ty>),
2516-
/// Unused for now.
2517-
Typeof(AnonConst),
25182516
/// This means the type should be inferred instead of it having been
25192517
/// specified. This can appear anywhere in a type.
25202518
Infer,

compiler/rustc_ast/src/util/classify.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,6 @@ fn type_trailing_braced_mac_call(mut ty: &ast::Ty) -> Option<&ast::MacCall> {
294294
| ast::TyKind::Never
295295
| ast::TyKind::Tup(..)
296296
| ast::TyKind::Paren(..)
297-
| ast::TyKind::Typeof(..)
298297
| ast::TyKind::Infer
299298
| ast::TyKind::ImplicitSelf
300299
| ast::TyKind::CVarArgs

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1367,7 +1367,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
13671367
self.lower_ty(ty, itctx),
13681368
self.lower_array_length_to_const_arg(length),
13691369
),
1370-
TyKind::Typeof(expr) => hir::TyKind::Typeof(self.lower_anon_const_to_anon_const(expr)),
13711370
TyKind::TraitObject(bounds, kind) => {
13721371
let mut lifetime_bound = None;
13731372
let (bounds, lifetime_bound) = self.with_dyn_type_scope(true, |this| {

compiler/rustc_ast_pretty/src/pprust/state.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,11 +1325,6 @@ impl<'a> State<'a> {
13251325
self.print_expr(&length.value, FixupContext::default());
13261326
self.word("]");
13271327
}
1328-
ast::TyKind::Typeof(e) => {
1329-
self.word("typeof(");
1330-
self.print_expr(&e.value, FixupContext::default());
1331-
self.word(")");
1332-
}
13331328
ast::TyKind::Infer => {
13341329
self.word("_");
13351330
}

compiler/rustc_attr_parsing/src/attributes/crate_level.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use rustc_hir::attrs::WindowsSubsystemKind;
2+
13
use super::prelude::*;
24

35
pub(crate) struct CrateNameParser;
@@ -142,3 +144,34 @@ impl<S: Stage> NoArgsAttributeParser<S> for RustcCoherenceIsCoreParser {
142144
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::CrateLevel;
143145
const CREATE: fn(Span) -> AttributeKind = AttributeKind::RustcCoherenceIsCore;
144146
}
147+
148+
pub(crate) struct WindowsSubsystemParser;
149+
150+
impl<S: Stage> SingleAttributeParser<S> for WindowsSubsystemParser {
151+
const PATH: &[Symbol] = &[sym::windows_subsystem];
152+
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::WarnButFutureError;
153+
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepOutermost;
154+
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::CrateLevel;
155+
const TEMPLATE: AttributeTemplate = template!(NameValueStr: ["windows", "console"], "https://doc.rust-lang.org/reference/runtime.html#the-windows_subsystem-attribute");
156+
157+
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser<'_>) -> Option<AttributeKind> {
158+
let Some(nv) = args.name_value() else {
159+
cx.expected_name_value(
160+
args.span().unwrap_or(cx.inner_span),
161+
Some(sym::windows_subsystem),
162+
);
163+
return None;
164+
};
165+
166+
let kind = match nv.value_as_str() {
167+
Some(sym::console) => WindowsSubsystemKind::Console,
168+
Some(sym::windows) => WindowsSubsystemKind::Windows,
169+
Some(_) | None => {
170+
cx.expected_specific_argument_strings(nv.value_span, &[sym::console, sym::windows]);
171+
return None;
172+
}
173+
};
174+
175+
Some(AttributeKind::WindowsSubsystem(kind, cx.attr_span))
176+
}
177+
}

compiler/rustc_attr_parsing/src/context.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ use crate::attributes::confusables::ConfusablesParser;
2828
use crate::attributes::crate_level::{
2929
CrateNameParser, MoveSizeLimitParser, NoCoreParser, NoStdParser, PatternComplexityLimitParser,
3030
RecursionLimitParser, RustcCoherenceIsCoreParser, TypeLengthLimitParser,
31+
WindowsSubsystemParser,
3132
};
3233
use crate::attributes::debugger::DebuggerViualizerParser;
3334
use crate::attributes::deprecation::DeprecationParser;
@@ -211,6 +212,7 @@ attribute_parsers!(
211212
Single<SkipDuringMethodDispatchParser>,
212213
Single<TransparencyParser>,
213214
Single<TypeLengthLimitParser>,
215+
Single<WindowsSubsystemParser>,
214216
Single<WithoutArgs<AllowIncoherentImplParser>>,
215217
Single<WithoutArgs<AllowInternalUnsafeParser>>,
216218
Single<WithoutArgs<AsPtrParser>>,

compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,6 +1198,12 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
11981198
);
11991199
return;
12001200
}
1201+
1202+
// Do not suggest changing type if that is not under user control.
1203+
if self.is_closure_arg_with_non_locally_decided_type(local) {
1204+
return;
1205+
}
1206+
12011207
let decl_span = local_decl.source_info.span;
12021208

12031209
let (amp_mut_sugg, local_var_ty_info) = match *local_decl.local_info() {
@@ -1500,6 +1506,60 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
15001506
Applicability::HasPlaceholders,
15011507
);
15021508
}
1509+
1510+
/// Returns `true` if `local` is an argument in a closure passed to a
1511+
/// function defined in another crate.
1512+
///
1513+
/// For example, in the following code this function returns `true` for `x`
1514+
/// since `Option::inspect()` is not defined in the current crate:
1515+
///
1516+
/// ```text
1517+
/// some_option.as_mut().inspect(|x| {
1518+
/// ```
1519+
fn is_closure_arg_with_non_locally_decided_type(&self, local: Local) -> bool {
1520+
// We don't care about regular local variables, only args.
1521+
if self.body.local_kind(local) != LocalKind::Arg {
1522+
return false;
1523+
}
1524+
1525+
// Make sure we are inside a closure.
1526+
let InstanceKind::Item(body_def_id) = self.body.source.instance else {
1527+
return false;
1528+
};
1529+
let Some(Node::Expr(hir::Expr { hir_id: body_hir_id, kind, .. })) =
1530+
self.infcx.tcx.hir_get_if_local(body_def_id)
1531+
else {
1532+
return false;
1533+
};
1534+
let ExprKind::Closure(hir::Closure { kind: hir::ClosureKind::Closure, .. }) = kind else {
1535+
return false;
1536+
};
1537+
1538+
// Check if the method/function that our closure is passed to is defined
1539+
// in another crate.
1540+
let Node::Expr(closure_parent) = self.infcx.tcx.parent_hir_node(*body_hir_id) else {
1541+
return false;
1542+
};
1543+
match closure_parent.kind {
1544+
ExprKind::MethodCall(method, _, _, _) => self
1545+
.infcx
1546+
.tcx
1547+
.typeck(method.hir_id.owner.def_id)
1548+
.type_dependent_def_id(closure_parent.hir_id)
1549+
.is_some_and(|def_id| !def_id.is_local()),
1550+
ExprKind::Call(func, _) => self
1551+
.infcx
1552+
.tcx
1553+
.typeck(func.hir_id.owner.def_id)
1554+
.node_type_opt(func.hir_id)
1555+
.and_then(|ty| match ty.kind() {
1556+
ty::FnDef(def_id, _) => Some(def_id),
1557+
_ => None,
1558+
})
1559+
.is_some_and(|def_id| !def_id.is_local()),
1560+
_ => false,
1561+
}
1562+
}
15031563
}
15041564

15051565
struct BindingFinder {

compiler/rustc_builtin_macros/src/cfg_select.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,21 @@ use crate::errors::{CfgSelectNoMatches, CfgSelectUnreachable};
1010

1111
/// Selects the first arm whose predicate evaluates to true.
1212
fn select_arm(ecx: &ExtCtxt<'_>, branches: CfgSelectBranches) -> Option<(TokenStream, Span)> {
13+
let mut result = None;
1314
for (cfg, tt, arm_span) in branches.reachable {
1415
if let EvalConfigResult::True = attr::eval_config_entry(
1516
&ecx.sess,
1617
&cfg,
1718
ecx.current_expansion.lint_node_id,
1819
ShouldEmit::ErrorsAndLints,
1920
) {
20-
return Some((tt, arm_span));
21+
// FIXME(#149215) Ideally we should short-circuit here, but `eval_config_entry` currently emits lints so we cannot do this yet.
22+
result.get_or_insert((tt, arm_span));
2123
}
2224
}
2325

24-
branches.wildcard.map(|(_, tt, span)| (tt, span))
26+
let wildcard = branches.wildcard.map(|(_, tt, span)| (tt, span));
27+
result.or(wildcard)
2528
}
2629

2730
pub(super) fn expand_cfg_select<'cx>(

compiler/rustc_codegen_gcc/.github/workflows/failures.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ jobs:
5454
if: matrix.libgccjit_version.gcc == 'libgccjit12.so'
5555
run: |
5656
echo 'gcc-path = "/usr/lib/gcc/x86_64-linux-gnu/12"' > config.toml
57-
echo "LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/12" >> $GITHUB_ENV
58-
echo "LD_LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/12" >> $GITHUB_ENV
5957
6058
- name: Download artifact
6159
if: matrix.libgccjit_version.gcc != 'libgccjit12.so'

0 commit comments

Comments
 (0)