Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
a20daf7
arm-linux.md: various fixes/improvements
tshepang Sep 29, 2025
9aeab78
improve text
tshepang Oct 4, 2025
124bfc9
Remove parent def lookup hack that is no longer needed
camelid Oct 13, 2025
379a057
Fix lowering of CStr constants to valtrees
camelid Oct 13, 2025
cff6452
Ignore test-dashboard related files
samueltardieu Oct 17, 2025
827bd00
Implement `strip_circumfix` lib feature
yotamofek Oct 21, 2025
0efeec5
Mention crate being analysized in query description
estebank Sep 28, 2025
2af3dd6
Change cfg_trace, cfg_attr_trace symbol values
Alexendoo Oct 31, 2025
0bd6a03
dangling ptr lint cleanup
hkBst Oct 31, 2025
f39fb70
Update tests after fixing ICEs
camelid Nov 1, 2025
76066d7
test: remove `tests/run-make/fmt-write-bloat/`
jieyouxu Nov 2, 2025
3d03550
Better warning message for crate type unsupported by codegen backend
bjorn3 Nov 2, 2025
9758973
Rollup merge of #147137 - estebank:issue-74380, r=nnethercote
matthiaskrgr Nov 2, 2025
6c7b955
Rollup merge of #147155 - tshepang:patch-2, r=Noratrieb
matthiaskrgr Nov 2, 2025
ec576bb
Rollup merge of #147642 - camelid:misc-const-fixes, r=BoxyUwU
matthiaskrgr Nov 2, 2025
3551657
Rollup merge of #147806 - samueltardieu:chores/gitignore-test-dashboa…
matthiaskrgr Nov 2, 2025
f985303
Rollup merge of #147947 - yotamofek:pr/lib/strip-circumfix, r=joboet
matthiaskrgr Nov 2, 2025
df1098d
Rollup merge of #148346 - Alexendoo:cfg-trace-values, r=JonathanBrouwer
matthiaskrgr Nov 2, 2025
e62b652
Rollup merge of #148348 - hkBst:dangling-ptr-lint-1, r=Urgau
matthiaskrgr Nov 2, 2025
22b5b3f
Rollup merge of #148393 - jieyouxu:remove-fmt-write-bloat, r=ChrisDenton
matthiaskrgr Nov 2, 2025
1f4086b
Rollup merge of #148400 - bjorn3:more_accurate_warning, r=lqd
matthiaskrgr Nov 2, 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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ node_modules
## Rustdoc GUI tests
tests/rustdoc-gui/src/**.lock

## Test dashboard
.citool-cache/
test-dashboard/

## direnv
/.envrc
/.direnv/
Expand Down
8 changes: 6 additions & 2 deletions compiler/rustc_driver_impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -686,8 +686,12 @@ fn print_crate_info(
};
let t_outputs = rustc_interface::util::build_output_filenames(attrs, sess);
let crate_name = passes::get_crate_name(sess, attrs);
let crate_types =
collect_crate_types(sess, &codegen_backend.supported_crate_types(sess), attrs);
let crate_types = collect_crate_types(
sess,
&codegen_backend.supported_crate_types(sess),
codegen_backend.name(),
attrs,
);
for &style in &crate_types {
let fname = rustc_session::output::filename_for_input(
sess, style, crate_name, &t_outputs,
Expand Down
14 changes: 0 additions & 14 deletions compiler/rustc_hir_analysis/src/collect/generics_of.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,6 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics {
// stable enough and does not need a feature gate anymore.
Node::AnonConst(_) => {
let parent_did = tcx.parent(def_id.to_def_id());

// We don't do this unconditionally because the `DefId` parent of an anon const
// might be an implicitly created closure during `async fn` desugaring. This would
// have the wrong generics.
//
// i.e. `async fn foo<'a>() { let a = [(); { 1 + 2 }]; bar().await() }`
// would implicitly have a closure in its body that would be the parent of
// the `{ 1 + 2 }` anon const. This closure's generics is simply a witness
// instead of `['a]`.
let parent_did = if let DefKind::AnonConst = tcx.def_kind(parent_did) {
parent_did
} else {
tcx.hir_get_parent_item(hir_id).to_def_id()
};
debug!(?parent_did);

let mut in_param_ty = false;
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_interface/src/passes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -929,6 +929,7 @@ pub fn create_and_enter_global_ctxt<T, F: for<'tcx> FnOnce(TyCtxt<'tcx>) -> T>(
let crate_types = collect_crate_types(
sess,
&compiler.codegen_backend.supported_crate_types(sess),
compiler.codegen_backend.name(),
&pre_configured_attrs,
);
let stable_crate_id = StableCrateId::new(
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_lint/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,11 @@ lint_confusable_identifier_pair = found both `{$existing_sym}` and `{$sym}` as i
.current_use = this identifier can be confused with `{$existing_sym}`
.other_use = other identifier used here

lint_dangling_pointers_from_locals = a dangling pointer will be produced because the local variable `{$local_var_name}` will be dropped
.ret_ty = return type of the {$fn_kind} is `{$ret_ty}`
.local_var = `{$local_var_name}` is part the {$fn_kind} and will be dropped at the end of the {$fn_kind}
lint_dangling_pointers_from_locals = {$fn_kind} returns a dangling pointer to dropped local variable `{$local_var_name}`
.ret_ty = return type is `{$ret_ty}`
.local_var = local variable `{$local_var_name}` is dropped at the end of the {$fn_kind}
.created_at = dangling pointer created here
.note = pointers do not have a lifetime; after returning, the `{$local_var_ty}` will be deallocated at the end of the {$fn_kind} because nothing is referencing it as far as the type system is concerned
.note = a dangling pointer is safe, but dereferencing one is undefined behavior

lint_dangling_pointers_from_temporaries = a dangling pointer will be produced because the temporary `{$ty}` will be dropped
.label_ptr = this pointer will immediately be invalid
Expand Down
5 changes: 4 additions & 1 deletion compiler/rustc_middle/src/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,10 @@ rustc_queries! {
/// The root query triggering all analysis passes like typeck or borrowck.
query analysis(key: ()) {
eval_always
desc { "running analysis passes on this crate" }
desc { |tcx|
"running analysis passes on crate `{}`",
tcx.crate_name(LOCAL_CRATE),
}
}

/// This query checks the fulfillment of collected lint expectations.
Expand Down
8 changes: 6 additions & 2 deletions compiler/rustc_mir_build/src/thir/constant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,12 @@ pub(crate) fn lit_to_const<'tcx>(
(ast::LitKind::Byte(n), ty::Uint(ty::UintTy::U8)) => {
ty::ValTree::from_scalar_int(tcx, n.into())
}
(ast::LitKind::CStr(byte_sym, _), ty::Ref(_, inner_ty, _)) if matches!(inner_ty.kind(), ty::Adt(def, _) if tcx.is_lang_item(def.did(), LangItem::CStr)) => {
ty::ValTree::from_raw_bytes(tcx, byte_sym.as_byte_str())
(ast::LitKind::CStr(byte_sym, _), ty::Ref(_, inner_ty, _)) if matches!(inner_ty.kind(), ty::Adt(def, _) if tcx.is_lang_item(def.did(), LangItem::CStr)) =>
{
// A CStr is a newtype around a byte slice, so we create the inner slice here.
// We need a branch for each "level" of the data structure.
let bytes = ty::ValTree::from_raw_bytes(tcx, byte_sym.as_byte_str());
ty::ValTree::from_branches(tcx, [bytes])
}
(ast::LitKind::Int(n, _), ty::Uint(ui)) if !neg => {
let scalar_int = trunc(n.get(), *ui);
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_session/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ session_unleashed_feature_help_unnamed = skipping check that does not even have

session_unstable_virtual_function_elimination = `-Zvirtual-function-elimination` requires `-Clto`

session_unsupported_crate_type_for_codegen_backend =
dropping unsupported crate type `{$crate_type}` for codegen backend `{$codegen_backend}`

session_unsupported_crate_type_for_target =
dropping unsupported crate type `{$crate_type}` for target `{$target_triple}`

Expand Down
7 changes: 7 additions & 0 deletions compiler/rustc_session/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,13 @@ struct BinaryFloatLiteralNotSupported {
span: Span,
}

#[derive(Diagnostic)]
#[diag(session_unsupported_crate_type_for_codegen_backend)]
pub(crate) struct UnsupportedCrateTypeForCodegenBackend {
pub(crate) crate_type: CrateType,
pub(crate) codegen_backend: &'static str,
}

#[derive(Diagnostic)]
#[diag(session_unsupported_crate_type_for_target)]
pub(crate) struct UnsupportedCrateTypeForTarget<'a> {
Expand Down
14 changes: 8 additions & 6 deletions compiler/rustc_session/src/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ pub fn categorize_crate_type(s: Symbol) -> Option<CrateType> {
pub fn collect_crate_types(
session: &Session,
backend_crate_types: &[CrateType],
codegen_backend_name: &'static str,
attrs: &[ast::Attribute],
) -> Vec<CrateType> {
// If we're generating a test executable, then ignore all other output
Expand Down Expand Up @@ -223,17 +224,18 @@ pub fn collect_crate_types(
}

base.retain(|crate_type| {
if invalid_output_for_target(session, *crate_type)
|| !backend_crate_types.contains(crate_type)
{
// FIXME provide a better warning for the case where the codegen
// backend doesn't support it once cargo doesn't hard code this
// warning message.
if invalid_output_for_target(session, *crate_type) {
session.dcx().emit_warn(errors::UnsupportedCrateTypeForTarget {
crate_type: *crate_type,
target_triple: &session.opts.target_triple,
});
false
} else if !backend_crate_types.contains(crate_type) {
session.dcx().emit_warn(errors::UnsupportedCrateTypeForCodegenBackend {
crate_type: *crate_type,
codegen_backend: codegen_backend_name,
});
false
} else {
true
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ symbols! {
cfg_accessible,
cfg_attr,
cfg_attr_multi,
cfg_attr_trace: "<cfg_attr>", // must not be a valid identifier
cfg_attr_trace: "<cfg_attr_trace>", // must not be a valid identifier
cfg_boolean_literals,
cfg_contract_checks,
cfg_doctest,
Expand All @@ -646,7 +646,7 @@ symbols! {
cfg_target_has_reliable_f16_f128,
cfg_target_thread_local,
cfg_target_vendor,
cfg_trace: "<cfg>", // must not be a valid identifier
cfg_trace: "<cfg_trace>", // must not be a valid identifier
cfg_ub_checks,
cfg_version,
cfi,
Expand Down
32 changes: 32 additions & 0 deletions library/core/src/slice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2725,6 +2725,38 @@ impl<T> [T] {
None
}

/// Returns a subslice with the prefix and suffix removed.
///
/// If the slice starts with `prefix` and ends with `suffix`, returns the subslice after the
/// prefix and before the suffix, wrapped in `Some`.
///
/// If the slice does not start with `prefix` or does not end with `suffix`, returns `None`.
///
/// # Examples
///
/// ```
/// #![feature(strip_circumfix)]
///
/// let v = &[10, 50, 40, 30];
/// assert_eq!(v.strip_circumfix(&[10], &[30]), Some(&[50, 40][..]));
/// assert_eq!(v.strip_circumfix(&[10], &[40, 30]), Some(&[50][..]));
/// assert_eq!(v.strip_circumfix(&[10, 50], &[40, 30]), Some(&[][..]));
/// assert_eq!(v.strip_circumfix(&[50], &[30]), None);
/// assert_eq!(v.strip_circumfix(&[10], &[40]), None);
/// assert_eq!(v.strip_circumfix(&[], &[40, 30]), Some(&[10, 50][..]));
/// assert_eq!(v.strip_circumfix(&[10, 50], &[]), Some(&[40, 30][..]));
/// ```
#[must_use = "returns the subslice without modifying the original"]
#[unstable(feature = "strip_circumfix", issue = "147946")]
pub fn strip_circumfix<S, P>(&self, prefix: &P, suffix: &S) -> Option<&[T]>
where
T: PartialEq,
S: SlicePattern<Item = T> + ?Sized,
P: SlicePattern<Item = T> + ?Sized,
{
self.strip_prefix(prefix)?.strip_suffix(suffix)
}

/// Returns a subslice with the optional prefix removed.
///
/// If the slice starts with `prefix`, returns the subslice after the prefix. If `prefix`
Expand Down
36 changes: 36 additions & 0 deletions library/core/src/str/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2447,6 +2447,42 @@ impl str {
suffix.strip_suffix_of(self)
}

/// Returns a string slice with the prefix and suffix removed.
///
/// If the string starts with the pattern `prefix` and ends with the pattern `suffix`, returns
/// the substring after the prefix and before the suffix, wrapped in `Some`.
/// Unlike [`trim_start_matches`] and [`trim_end_matches`], this method removes both the prefix
/// and suffix exactly once.
///
/// If the string does not start with `prefix` or does not end with `suffix`, returns `None`.
///
/// Each [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
/// function or closure that determines if a character matches.
///
/// [`char`]: prim@char
/// [pattern]: self::pattern
/// [`trim_start_matches`]: Self::trim_start_matches
/// [`trim_end_matches`]: Self::trim_end_matches
///
/// # Examples
///
/// ```
/// #![feature(strip_circumfix)]
///
/// assert_eq!("bar:hello:foo".strip_circumfix("bar:", ":foo"), Some("hello"));
/// assert_eq!("bar:foo".strip_circumfix("foo", "foo"), None);
/// assert_eq!("foo:bar;".strip_circumfix("foo:", ';'), Some("bar"));
/// ```
#[must_use = "this returns the remaining substring as a new slice, \
without modifying the original"]
#[unstable(feature = "strip_circumfix", issue = "147946")]
pub fn strip_circumfix<P: Pattern, S: Pattern>(&self, prefix: P, suffix: S) -> Option<&str>
where
for<'a> S::Searcher<'a>: ReverseSearcher<'a>,
{
self.strip_prefix(prefix)?.strip_suffix(suffix)
}

/// Returns a string slice with the optional prefix removed.
///
/// If the string starts with the pattern `prefix`, returns the substring after the prefix.
Expand Down
18 changes: 9 additions & 9 deletions src/doc/rustc/src/platform-support/arm-linux.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Arm Linux support in Rust

The Arm Architecture has been around since the mid-1980s, going through nine
major revisions, many minor revisions, and spanning both 32-bith and 64-bit
major revisions, many minor revisions, and spanning both 32-bit and 64-bit
architectures. This page covers 32-bit Arm platforms that run some form of
Linux (but not Android). Those targets are:

Expand Down Expand Up @@ -49,7 +49,7 @@ The architecture component simply called `arm` corresponds to the Armv6
architecture - that is, version 6 of the Arm Architecture as defined in
version 6 of the Arm Architecture Reference Manual (the Arm ARM). This was the
last 'legacy' release of the Arm architecture, before they split into
Application, Real-Time and Microcontroller profiles (leading to Armv7-A,
Application, Real-Time, and Microcontroller profiles (leading to Armv7-A,
Armv7-R and Armv7-M). Processors that implement the Armv6 architecture include
the ARM1176JZF-S, as found in BCM2835 SoC that powers the Raspberry Pi Zero.
Arm processors are generally fairly backwards compatible, especially for
Expand All @@ -59,7 +59,7 @@ on newer ARMv7-A systems, or even 64/32-bit Armv8-A systems.
The `armeb` architecture component specifies an Armv6 processor running in Big
Endian mode (`eb` is for big-endian - the letters are backwards because
engineers used to little-endian systems perceive big-endian numbers to be
written into memory backwards, and they thought it was funnier like that).
written into memory backwards, and they thought it was funny like that).
Most Arm processors can operate in either little-endian or big-endian mode and
little-endian mode is by far the most common. However, if for whatever reason
you wish to store your Most Significant Bytes first, these targets are
Expand All @@ -70,7 +70,7 @@ Targets that start with `armv4t` are for processors implementing the Armv4T
architecture from 1994. These include the ARM7TDMI, as found in the Nokia 6110
brick-phone and the Game Boy Advance. The 'T' stands for *Thumb* and indicate
that the processors can execute smaller 16-bit versions of some of the 32-bit
Arm instructions. Because a Thumb is like a small version of an Arm.
Arm instructions. This is because a Thumb is like a small version of an Arm.

Targets that start with `armv5te` are for processors implementing the Armv5TE
architecture. These are mostly from the ARM9 family, like the ARM946E-S found
Expand Down Expand Up @@ -111,11 +111,11 @@ The `gnueabi` ABI component indicates support for using the GNU C Library
(glibc), and the Arm Embedded ABI (EABI). The EABI is a replacement for the
original ABI (now called the Old ABI or OABI), and it is the standard ABI for
32-bit Arm systems. With this ABI, function parameters that are `f32` or `f64`
are passed as if they were integers, instead of being passed via in FPU
registers. Generally these targets also disable the use of the FPU entirely,
are passed as if they were integers, instead of being passed in FPU
registers. Generally, these targets also disable the use of the FPU entirely,
although that isn't always true.

The `gnueabihf` ABI component is like `gnueabi`, except that it support the
The `gnueabihf` ABI component is like `gnueabi`, except that it supports the
'hard-float' of the EABI. That is, function parameters that are `f32` or `f64`
are passed in FPU registers. Naturally, this makes the FPU mandatory.

Expand Down Expand Up @@ -147,15 +147,15 @@ the Arm architecture, and more importantly, knows where to find a suitable C
Library to link against.

To do that, you can add the `linker` property to your `.cargo/config.toml`.
Typically you would refer to a suitable copy of GCC that has built as a
Typically, you would refer to a suitable copy of GCC that was built as a
cross-compiler, alongside a C library.

```toml
[target.arm-unknown-linux-gnueabi]
linker = "arm-linux-gnueabi-gcc"
```

On Debian Linux, you could install such a cross-compilation toolchain with
On Debian, you could install such a cross-compilation toolchain with
`apt install gcc-arm-linux-gnueabi`. For more exotic combinations, you might
need to build a bespoke version of GCC using [crosstool-ng].

Expand Down
11 changes: 0 additions & 11 deletions tests/crashes/129209.rs

This file was deleted.

9 changes: 0 additions & 9 deletions tests/crashes/131295.rs

This file was deleted.

3 changes: 0 additions & 3 deletions tests/crashes/139738.rs

This file was deleted.

32 changes: 0 additions & 32 deletions tests/run-make/fmt-write-bloat/main.rs

This file was deleted.

Loading
Loading