Rollup of 5 pull requests - #163504
Closed
JonathanBrouwer wants to merge 16 commits into
Closed
Rollup of 5 pull requests#163504JonathanBrouwer wants to merge 16 commits into
JonathanBrouwer wants to merge 16 commits into
Conversation
Rustc already defaults to this for regular items whenever possible. Overriding it would only lead to linker errors. And for depending on the exact codegen unit partitioning rustc uses, so there it is a bad idea to use it too.
Rustc already defaults to this for #[no_mangle]/#[export_name] items. There is no reason to explicitly use it.
A common definition is like a weak definition except that it must be a zero-initialized static and when merging two common symbols with the same name, the size and alignment are set to the higher of both symbols. This is used for tentative definitions in C and doesn't have any reason to exist outside of that. This behavior doesn't work across dylibs and common symbols have inconsistent behavior across linkers [1]. It is also fragile to rely on getting the largest size of all common symbol definitions as a (possibly smaller) global definition can override it. Link: https://maskray.me/blog/all-about-common-symbols [1]
Allow writing
```rust
struct Diagnostic {
#[primary_span]
#[label("label text")]
span: Span,
#[context]
context: Span,
}
```
So that the code pointed at by `context` is shown in the rendered diagnostic without an underline.
```
error[E0201]: duplicate definitions with name `Bar`:
--> $DIR/associated-item-duplicate-names-3.rs:14:5
|
LL | trait Foo {
LL | type Bar;
| --------- item in trait
...
LL | impl Foo for Baz {
LL | type Bar = i16;
| --------------- previous definition here
LL | type Bar = u16;
| ^^^^^^^^^^^^^^^ duplicate definition
```
```
error[E0324]: item `RESOLVED_WRONG` is an associated method, which doesn't match its trait `MyTrait`
--> $DIR/unresolved-trait-impl-item.rs:12:5
|
LL | trait MyTrait {
LL | async fn resolved(&self);
LL | const RESOLVED_WRONG: u8 = 0;
| ----------------------------- item in trait
...
LL | impl MyTrait for i32 {
...
LL | async fn RESOLVED_WRONG() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ does not match trait
```
```
error: `impl` item signature doesn't match `trait` item signature
--> $DIR/self-without-lifetime-constraint.rs:46:5
|
LL | pub trait FromSql: Sized {
LL | fn column_result(value: ValueRef<'_>) -> FromSqlResult<Self, &Self>;
| -------------------------------------------------------------------- expected `fn(ValueRef<'1>) -> Result<(&'2 str, &'1 &'2 str), _>`
...
LL | impl FromSql for &str {
LL | fn column_result(value: ValueRef<'_>) -> FromSqlResult<&str, &&str> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(ValueRef<'1>) -> Result<(&'1 str, &'1 &'1 str), _>`
|
= note: expected signature `fn(ValueRef<'1>) -> Result<(&'2 str, &'1 &'2 str), FromSqlError>`
found signature `fn(ValueRef<'1>) -> Result<(&'1 str, &'1 &'1 str), FromSqlError>`
help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait`
--> $DIR/self-without-lifetime-constraint.rs:42:60
|
LL | fn column_result(value: ValueRef<'_>) -> FromSqlResult<Self, &Self>;
| ^^^^ consider borrowing this type parameter in the trait
```
…sage Use same wording as cargo does when `package.edition` is unspecified. Do not suggest `--edition=future` on stable.
also includes:
- std::env::split_paths_ref
- std::os::{darwin|unix|windows}::{Home|Media}DirsExt
…ieyouxu When compiling without a specified `--edition`, emit a message Implement rust-lang/compiler-team#1019.
Add `std::fs::{Home|Media}Dirs`
- ACP: rust-lang/libs-team#830
Replacement for `std::os::unix::xdg` as suggested by libs-api in rust-lang#157515 (comment). Exposes media directories common between the three big OSes in addition to the cache/config/data/state directories under a separate feature gate. API summary:
```rust
// mod std::fs
pub struct HomeDirs { /* ... */ }
impl HomeDirs {
fn empty() -> Self;
pub fn config_home(&self) -> Option<&Path>;
pub fn data_home(&self) -> Option<&Path>;
pub fn state_home(&self) -> Option<&Path>;
pub fn cache_home(&self) -> Option<&Path>;
pub fn set_config_home(&mut self, path: PathBuf) -> &mut Self;
pub fn set_data_home(&mut self, path: PathBuf) -> &mut Self;
pub fn set_state_home(&mut self, path: PathBuf) -> &mut Self;
pub fn set_cache_home(&mut self, path: PathBuf) -> &mut Self;
}
pub struct MediaDirs { /* ... */ }
impl MediaDirs {
pub fn empty() -> Self;
pub fn desktop(&self) -> Option<&Path>;
pub fn documents(&self) -> Option<&Path>;
pub fn downloads(&self) -> Option<&Path>;
pub fn music(&self) -> Option<&Path>;
pub fn pictures(&self) -> Option<&Path>;
pub fn videos(&self) -> Option<&Path>;
pub fn set_desktop(&mut self, path: PathBuf) -> &mut Self;
pub fn set_documents(&mut self, path: PathBuf) -> &mut Self;
pub fn set_downloads(&mut self, path: PathBuf) -> &mut Self;
pub fn set_music(&mut self, path: PathBuf) -> &mut Self;
pub fn set_pictures(&mut self, path: PathBuf) -> &mut Self;
pub fn set_videos(&mut self, path: PathBuf) -> &mut Self;
}
// mod std::os::darwin::fs
impl HomeDirsExt for HomeDirs { /* ... */ }
pub impl(self) trait HomeDirsExt {
fn sysdir() -> io::Result<Self>;
}
impl MediaDirsExt for MediaDirs { /* ... */ }
pub impl(self) trait MediaDirsExt {
fn sysdir() -> io::Result<Self>;
}
// mod std::os::unix::fs
impl HomeDirsExt for HomeDirs { /* ... */ }
pub impl(self) trait HomeDirsExt {
fn xdg() -> io::Result<Self>;
fn runtime_home(&self) -> Option<&Path>;
fn config_dirs(&self) -> Option<XdgDirs<'_>>;
fn data_dirs(&self) -> Option<XdgDirs<'_>>;
fn set_runtime_home(&mut self, path: PathBuf) -> &mut Self;
fn set_config_dirs(&mut self, paths: OsString) -> &mut Self;
fn set_data_dirs(&mut self, paths: OsString) -> &mut Self;
}
impl MediaDirsExt for MediaDirs { /* ... */ }
pub impl(self) trait MediaDirsExt {
fn xdg() -> io::Result<Self>;
fn templates(&self) -> Option<&Path>;
fn set_templates(&mut self, path: PathBuf) -> &mut Self;
}
pub struct XdgDirs<'a> { /* ... */ }
impl Iterator for XdgDirs<'a> {
type Item = &'a Path;
/* ... */
}
// mod std::os::windows::fs
impl HomeDirsExt for HomeDirs { /* ... */ }
pub impl(self) trait HomeDirsExt {
fn appdata_env() -> io::Result<Self>;
fn known_folders() -> io::Result<Self>;
}
impl MediaDirsExt for MediaDirs { /* ... */ }
pub impl(self) trait MediaDirsExt {
fn known_folders() -> io::Result<Self>;
}
```
…, r=petrochenkov
Add support for span context to `derive(Diagnostic)` and use it
Allow writing
```rust
struct Diagnostic {
#[primary_span]
#[label("label text")]
span: Span,
#[context]
context: Span,
}
```
So that the code pointed at by `context` is shown in the rendered diagnostic without an underline.
Point at enclosing item(s) on unexpected item type:
```
error: expected type, found constant
--> $DIR/consts.rs:2:19
|
LL | pub fn accept(
LL | _: impl Trait<K: Copy>
| ^------ bounds are not allowed on associated constants
| |
| unexpected constant
|
note: the associated constant is defined here
--> $DIR/consts.rs:7:5
|
LL | const K: i32;
| ^^^^^^^^^^
```
Show trait/impl for duplicate impl associated items
```
error[E0201]: duplicate definitions with name `Bar`:
--> $DIR/associated-item-duplicate-names-3.rs:14:5
|
LL | trait Foo {
LL | type Bar;
| --------- item in trait
...
LL | impl Foo for Baz {
LL | type Bar = i16;
| --------------- previous definition here
LL | type Bar = u16;
| ^^^^^^^^^^^^^^^ duplicate definition
```
Point at trait/impl on associated item mismatch
```
error[E0324]: item `RESOLVED_WRONG` is an associated method, which doesn't match its trait `MyTrait`
--> $DIR/unresolved-trait-impl-item.rs:12:5
|
LL | trait MyTrait {
LL | async fn resolved(&self);
LL | const RESOLVED_WRONG: u8 = 0;
| ----------------------------- item in trait
...
LL | impl MyTrait for i32 {
...
LL | async fn RESOLVED_WRONG() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ does not match trait
```
On `impl` item signature mismatch, point at impl and trait
```
error: `impl` item signature doesn't match `trait` item signature
--> $DIR/self-without-lifetime-constraint.rs:46:5
|
LL | pub trait FromSql: Sized {
LL | fn column_result(value: ValueRef<'_>) -> FromSqlResult<Self, &Self>;
| -------------------------------------------------------------------- expected `fn(ValueRef<'1>) -> Result<(&'2 str, &'1 &'2 str), _>`
...
LL | impl FromSql for &str {
LL | fn column_result(value: ValueRef<'_>) -> FromSqlResult<&str, &&str> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(ValueRef<'1>) -> Result<(&'1 str, &'1 &'1 str), _>`
|
= note: expected signature `fn(ValueRef<'1>) -> Result<(&'2 str, &'1 &'2 str), FromSqlError>`
found signature `fn(ValueRef<'1>) -> Result<(&'1 str, &'1 &'1 str), FromSqlError>`
help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait`
--> $DIR/self-without-lifetime-constraint.rs:42:60
|
LL | fn column_result(value: ValueRef<'_>) -> FromSqlResult<Self, &Self>;
| ^^^^ consider borrowing this type parameter in the trait
```
Remove some #[linkage] options These are either useless due to rustc already setting them whenever you would want them, actively breaking compiler invariants or both. cc rust-lang#29603 (comment)
Revert "Rollup merge of rust-lang#120589 - devnexen:cpuaff_fbsd_upd, r=clarfonthey" This reverts commit 0a4206a, reversing changes made to 8f3a9a1.
Member
Author
Contributor
This comment has been minimized.
This comment has been minimized.
rust-bors Bot
pushed a commit
that referenced
this pull request
Sep 29, 2026
Rollup of 5 pull requests try-job: dist-various-1 try-job: test-various try-job: test-x86_64-gnu-aux try-job: test-x86_64-gnu-llvm-21-3 try-job: test-x86_64-msvc-1 try-job: test-aarch64-apple-1 try-job: test-aarch64-apple-2 try-job: test-x86_64-mingw-1 try-job: test-i686-msvc try-job: test-armhf-gnu
Collaborator
|
The job Click to see the possible cause of the failure (guessed by this bot) |
This comment has been minimized.
This comment has been minimized.
rust-bors Bot
pushed a commit
that referenced
this pull request
Sep 29, 2026
…uwer Rollup of 5 pull requests Successful merges: - #158102 (When compiling without a specified `--edition`, emit a message) - #158936 (Add `std::fs::{Home|Media}Dirs`) - #163414 (Add support for span context to `derive(Diagnostic)` and use it) - #163405 (Remove some #[linkage] options) - #163498 (Revert "Rollup merge of #120589 - devnexen:cpuaff_fbsd_upd, r=clarfonthey")
Contributor
|
💔 Test for 95c3ca4 failed: CI. Failed jobs:
|
Collaborator
|
The job Click to see the possible cause of the failure (guessed by this bot) |
Contributor
|
💔 Test for 964f846 failed: CI. Failed job:
|
Contributor
|
PR #158102, which is a member of this rollup, was unapproved. |
Member
|
Closing since the above PR failed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Successful merges:
--edition, emit a message #158102 (When compiling without a specified--edition, emit a message)std::fs::{Home|Media}Dirs#158936 (Addstd::fs::{Home|Media}Dirs)derive(Diagnostic)and use it #163414 (Add support for span context toderive(Diagnostic)and use it)r? @ghost
Create a similar rollup