Skip to content

Commit c55fad5

Browse files
committed
Auto merge of #158068 - jhpratt:rollup-9fQ5FBj, r=jhpratt
Rollup of 8 pull requests Successful merges: - #158056 (Put internal lints into a single combined pass) - #151132 (Take care to use MSG_EOR with SOCK_SEQPACKET sockets) - #157644 (wasm32-wasip1-threads: Correct llvm target name) - #157912 (stabilize str_from_utf16_endian) - #158048 (Revert "add regression test for Redundant memory strores with mut parameters in by-value returns") - #158051 (Document `with_added_extension` edge cases) - #158054 (fix unresolved import suggestion before outer attributes) - #158062 (rustc book: Update wasm32-wasip1-threads's maintainers list)
2 parents 9639eef + 61d1ca8 commit c55fad5

10 files changed

Lines changed: 90 additions & 69 deletions

File tree

compiler/rustc_lint/src/lib.rs

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,18 @@ early_lint_methods!(
189189
]
190190
);
191191

192+
early_lint_methods!(
193+
declare_combined_early_lint_pass,
194+
[
195+
InternalCombinedEarlyLintPass,
196+
[
197+
LintPassImpl: LintPassImpl,
198+
ImplicitSysrootCrateImport: ImplicitSysrootCrateImport,
199+
BadUseOfFindAttr: BadUseOfFindAttr,
200+
]
201+
]
202+
);
203+
192204
late_lint_methods!(
193205
declare_combined_late_lint_pass,
194206
[
@@ -260,6 +272,24 @@ late_lint_methods!(
260272
]
261273
);
262274

275+
late_lint_methods!(
276+
declare_combined_late_lint_pass,
277+
[
278+
InternalCombinedModuleLateLintPass,
279+
[
280+
DefaultHashTypes: DefaultHashTypes,
281+
QueryStability: QueryStability,
282+
TyTyKind: TyTyKind,
283+
TypeIr: TypeIr,
284+
BadOptAccess: BadOptAccess,
285+
DisallowedPassByRef: DisallowedPassByRef,
286+
SpanUseEqCtxt: SpanUseEqCtxt,
287+
SymbolInternStringLiteral: SymbolInternStringLiteral,
288+
RustcMustMatchExhaustively: RustcMustMatchExhaustively,
289+
]
290+
]
291+
);
292+
263293
pub fn new_lint_store(internal_lints: bool) -> LintStore {
264294
let mut lint_store = LintStore::new();
265295

@@ -663,30 +693,12 @@ fn register_builtins(store: &mut LintStore) {
663693
}
664694

665695
fn register_internals(store: &mut LintStore) {
666-
store.register_lints(&LintPassImpl::lint_vec());
667-
store.register_early_pass(|| Box::new(LintPassImpl));
668-
store.register_lints(&ImplicitSysrootCrateImport::lint_vec());
669-
store.register_early_pass(|| Box::new(ImplicitSysrootCrateImport));
670-
store.register_lints(&BadUseOfFindAttr::lint_vec());
671-
store.register_early_pass(|| Box::new(BadUseOfFindAttr));
672-
store.register_lints(&DefaultHashTypes::lint_vec());
673-
store.register_late_mod_pass(|_| Box::new(DefaultHashTypes));
674-
store.register_lints(&QueryStability::lint_vec());
675-
store.register_late_mod_pass(|_| Box::new(QueryStability));
676-
store.register_lints(&TyTyKind::lint_vec());
677-
store.register_late_mod_pass(|_| Box::new(TyTyKind));
678-
store.register_lints(&TypeIr::lint_vec());
679-
store.register_late_mod_pass(|_| Box::new(TypeIr));
680-
store.register_lints(&BadOptAccess::lint_vec());
681-
store.register_late_mod_pass(|_| Box::new(BadOptAccess));
682-
store.register_lints(&DisallowedPassByRef::lint_vec());
683-
store.register_late_mod_pass(|_| Box::new(DisallowedPassByRef));
684-
store.register_lints(&SpanUseEqCtxt::lint_vec());
685-
store.register_late_mod_pass(|_| Box::new(SpanUseEqCtxt));
686-
store.register_lints(&SymbolInternStringLiteral::lint_vec());
687-
store.register_late_mod_pass(|_| Box::new(SymbolInternStringLiteral));
688-
store.register_lints(&RustcMustMatchExhaustively::lint_vec());
689-
store.register_late_pass(|_| Box::new(RustcMustMatchExhaustively));
696+
store.register_lints(&InternalCombinedEarlyLintPass::lint_vec());
697+
store.register_early_pass(|| Box::new(InternalCombinedEarlyLintPass::new()));
698+
699+
store.register_lints(&InternalCombinedModuleLateLintPass::lint_vec());
700+
store.register_late_mod_pass(|_| Box::new(InternalCombinedModuleLateLintPass::new()));
701+
690702
store.register_group(
691703
false,
692704
"rustc::internal",

compiler/rustc_target/src/spec/targets/wasm32_wasip1_threads.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ pub(crate) fn target() -> Target {
6060
options.features = "+atomics,+bulk-memory,+mutable-globals".into();
6161

6262
Target {
63-
llvm_target: "wasm32-wasi".into(),
63+
llvm_target: "wasm32-wasip1-threads".into(),
6464
metadata: TargetMetadata {
6565
description: None,
6666
tier: Some(2),

library/alloc/src/string.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,6 @@ impl String {
775775
/// Basic usage:
776776
///
777777
/// ```
778-
/// #![feature(str_from_utf16_endian)]
779778
/// // 𝄞music
780779
/// let v = &[0x34, 0xD8, 0x1E, 0xDD, 0x6d, 0x00, 0x75, 0x00,
781780
/// 0x73, 0x00, 0x69, 0x00, 0x63, 0x00];
@@ -788,7 +787,7 @@ impl String {
788787
/// assert!(String::from_utf16le(v).is_err());
789788
/// ```
790789
#[cfg(not(no_global_oom_handling))]
791-
#[unstable(feature = "str_from_utf16_endian", issue = "116258")]
790+
#[stable(feature = "str_from_utf16_endian", since = "CURRENT_RUSTC_VERSION")]
792791
pub fn from_utf16le(v: &[u8]) -> Result<String, FromUtf16Error> {
793792
let (chunks, []) = v.as_chunks::<2>() else {
794793
return Err(FromUtf16Error { kind: FromUtf16ErrorKind::OddBytes });
@@ -817,7 +816,6 @@ impl String {
817816
/// Basic usage:
818817
///
819818
/// ```
820-
/// #![feature(str_from_utf16_endian)]
821819
/// // 𝄞mus<invalid>ic<invalid>
822820
/// let v = &[0x34, 0xD8, 0x1E, 0xDD, 0x6d, 0x00, 0x75, 0x00,
823821
/// 0x73, 0x00, 0x1E, 0xDD, 0x69, 0x00, 0x63, 0x00,
@@ -827,7 +825,7 @@ impl String {
827825
/// String::from_utf16le_lossy(v));
828826
/// ```
829827
#[cfg(not(no_global_oom_handling))]
830-
#[unstable(feature = "str_from_utf16_endian", issue = "116258")]
828+
#[stable(feature = "str_from_utf16_endian", since = "CURRENT_RUSTC_VERSION")]
831829
pub fn from_utf16le_lossy(v: &[u8]) -> String {
832830
match (cfg!(target_endian = "little"), unsafe { v.align_to::<u16>() }) {
833831
(true, ([], v, [])) => Self::from_utf16_lossy(v),
@@ -850,7 +848,6 @@ impl String {
850848
/// Basic usage:
851849
///
852850
/// ```
853-
/// #![feature(str_from_utf16_endian)]
854851
/// // 𝄞music
855852
/// let v = &[0xD8, 0x34, 0xDD, 0x1E, 0x00, 0x6d, 0x00, 0x75,
856853
/// 0x00, 0x73, 0x00, 0x69, 0x00, 0x63];
@@ -863,7 +860,7 @@ impl String {
863860
/// assert!(String::from_utf16be(v).is_err());
864861
/// ```
865862
#[cfg(not(no_global_oom_handling))]
866-
#[unstable(feature = "str_from_utf16_endian", issue = "116258")]
863+
#[stable(feature = "str_from_utf16_endian", since = "CURRENT_RUSTC_VERSION")]
867864
pub fn from_utf16be(v: &[u8]) -> Result<String, FromUtf16Error> {
868865
let (chunks, []) = v.as_chunks::<2>() else {
869866
return Err(FromUtf16Error { kind: FromUtf16ErrorKind::OddBytes });
@@ -892,7 +889,6 @@ impl String {
892889
/// Basic usage:
893890
///
894891
/// ```
895-
/// #![feature(str_from_utf16_endian)]
896892
/// // 𝄞mus<invalid>ic<invalid>
897893
/// let v = &[0xD8, 0x34, 0xDD, 0x1E, 0x00, 0x6d, 0x00, 0x75,
898894
/// 0x00, 0x73, 0xDD, 0x1E, 0x00, 0x69, 0x00, 0x63,
@@ -902,7 +898,7 @@ impl String {
902898
/// String::from_utf16be_lossy(v));
903899
/// ```
904900
#[cfg(not(no_global_oom_handling))]
905-
#[unstable(feature = "str_from_utf16_endian", issue = "116258")]
901+
#[stable(feature = "str_from_utf16_endian", since = "CURRENT_RUSTC_VERSION")]
906902
pub fn from_utf16be_lossy(v: &[u8]) -> String {
907903
match (cfg!(target_endian = "big"), unsafe { v.align_to::<u16>() }) {
908904
(true, ([], v, [])) => Self::from_utf16_lossy(v),

library/std/src/path.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3176,7 +3176,9 @@ impl Path {
31763176

31773177
/// Creates an owned [`PathBuf`] like `self` but with the extension added.
31783178
///
3179-
/// See [`PathBuf::add_extension`] for more details.
3179+
/// See [`PathBuf::add_extension`] for more details. The return value of
3180+
/// [`PathBuf::add_extension`] is ignored, which means no extension
3181+
/// will be added to paths with no [`Path::file_name`].
31803182
///
31813183
/// # Examples
31823184
///
@@ -3190,6 +3192,13 @@ impl Path {
31903192
/// assert_eq!(path.with_added_extension(""), PathBuf::from("foo.tar.gz"));
31913193
/// assert_eq!(path.with_added_extension("xz"), PathBuf::from("foo.tar.gz.xz"));
31923194
/// assert_eq!(path.with_added_extension("").with_added_extension("txt"), PathBuf::from("foo.tar.gz.txt"));
3195+
///
3196+
/// let path = Path::new("/");
3197+
/// assert_eq!(path.with_added_extension("gz"), PathBuf::from("/"));
3198+
/// let path = Path::new("/dir/");
3199+
/// assert_eq!(path.with_added_extension("gz"), PathBuf::from("/dir.gz"));
3200+
/// let path = Path::new("/dir/..");
3201+
/// assert_eq!(path.with_added_extension("gz"), PathBuf::from("/dir/.."));
31933202
/// ```
31943203
#[stable(feature = "path_add_extension", since = "1.91.0")]
31953204
pub fn with_added_extension<S: AsRef<OsStr>>(&self, extension: S) -> PathBuf {

library/std/src/sys/process/unix/unix.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ impl Command {
881881

882882
// we send the 0-length message even if we failed to acquire the pidfd
883883
// so we get a consistent SEQPACKET order
884-
match cvt_r(|| libc::sendmsg(sock.as_raw(), &msg, 0)) {
884+
match cvt_r(|| libc::sendmsg(sock.as_raw(), &msg, libc::MSG_EOR)) {
885885
Ok(0) => {}
886886
other => rtabort!("failed to communicate with parent process. {:?}", other),
887887
}

src/doc/rustc/src/platform-support/wasm32-wasip1-threads.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ with native multi threading capabilities.
1919
## Target maintainers
2020

2121
[@g0djan](https://github.com/g0djan)
22-
[@abrown](https://github.com/abrown)
2322
[@loganek](https://github.com/loganek)
2423

2524
## Requirements

tests/assembly-llvm/riscv-redundant-memory-stores.rs

Lines changed: 0 additions & 33 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//@ edition:2015
2+
//@ run-rustfix
3+
//@ compile-flags: -Adead_code
4+
5+
use std::path::Path;
6+
7+
#[derive(Debug)]
8+
struct Symbol;
9+
10+
type Ident = Path;
11+
//~^ ERROR cannot find type `Path` in this scope
12+
13+
fn main() {}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//@ edition:2015
2+
//@ run-rustfix
3+
//@ compile-flags: -Adead_code
4+
5+
#[derive(Debug)]
6+
struct Symbol;
7+
8+
type Ident = Path;
9+
//~^ ERROR cannot find type `Path` in this scope
10+
11+
fn main() {}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error[E0425]: cannot find type `Path` in this scope
2+
--> $DIR/suggest-import-before-outer-attrs-issue-69733.rs:8:14
3+
|
4+
LL | type Ident = Path;
5+
| ^^^^ not found in this scope
6+
|
7+
help: consider importing this struct
8+
|
9+
LL + use std::path::Path;
10+
|
11+
12+
error: aborting due to 1 previous error
13+
14+
For more information about this error, try `rustc --explain E0425`.

0 commit comments

Comments
 (0)