Auto merge of #141066 - matthiaskrgr:rollup-e7tyrj5, r=matthiaskrgr

Rollup of 9 pull requests

Successful merges:

 - #140791 (std: explain prefer `TryInto` over `TryFrom` when specifying traits bounds on generic function)
 - #140834 (move (or remove) some impl Trait tests)
 - #140910 (Remove `stable` attribute from wasi fs (read_exact|write_all)_at)
 - #140984 (fix doc for UnixStream)
 - #140997 (Add negative test coverage for `-Clink-self-contained` and `-Zlinker-features`)
 - #141003 (Improve ternary operator recovery)
 - #141009 (Migrate to modern datetime API)
 - #141013 (Implement methods to set STARTUPINFO flags for Command API on Windows)
 - #141026 (rustc-dev-guide subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2025-05-16 05:45:37 +00:00
commit c79bbfab78
110 changed files with 460 additions and 258 deletions

View file

@ -815,7 +815,6 @@ parse_switch_ref_box_order = switch the order of `ref` and `box`
.suggestion = swap them
parse_ternary_operator = Rust has no ternary operator
.help = use an `if-else` expression instead
parse_tilde_is_not_unary_operator = `~` cannot be used as a unary operator
.suggestion = use `!` to perform bitwise not
@ -963,6 +962,8 @@ parse_use_empty_block_not_semi = expected { "`{}`" }, found `;`
parse_use_eq_instead = unexpected `==`
.suggestion = try using `=` instead
parse_use_if_else = use an `if-else` expression instead
parse_use_let_not_auto = write `let` instead of `auto` to introduce a new variable
parse_use_let_not_var = write `let` instead of `var` to introduce a new variable

View file

@ -436,10 +436,28 @@ pub(crate) enum IfExpressionMissingThenBlockSub {
#[derive(Diagnostic)]
#[diag(parse_ternary_operator)]
#[help]
pub(crate) struct TernaryOperator {
#[primary_span]
pub span: Span,
/// If we have a span for the condition expression, suggest the if/else
#[subdiagnostic]
pub sugg: Option<TernaryOperatorSuggestion>,
/// Otherwise, just print the suggestion message
#[help(parse_use_if_else)]
pub no_sugg: bool,
}
#[derive(Subdiagnostic, Copy, Clone)]
#[multipart_suggestion(parse_use_if_else, applicability = "maybe-incorrect", style = "verbose")]
pub(crate) struct TernaryOperatorSuggestion {
#[suggestion_part(code = "if ")]
pub before_cond: Span,
#[suggestion_part(code = "{{")]
pub question: Span,
#[suggestion_part(code = "}} else {{")]
pub colon: Span,
#[suggestion_part(code = " }}")]
pub end: Span,
}
#[derive(Subdiagnostic)]

View file

@ -41,8 +41,9 @@ use crate::errors::{
IncorrectSemicolon, IncorrectUseOfAwait, IncorrectUseOfUse, PatternMethodParamWithoutBody,
QuestionMarkInType, QuestionMarkInTypeSugg, SelfParamNotFirst, StructLiteralBodyWithoutPath,
StructLiteralBodyWithoutPathSugg, SuggAddMissingLetStmt, SuggEscapeIdentifier, SuggRemoveComma,
TernaryOperator, UnexpectedConstInGenericParam, UnexpectedConstParamDeclaration,
UnexpectedConstParamDeclarationSugg, UnmatchedAngleBrackets, UseEqInstead, WrapType,
TernaryOperator, TernaryOperatorSuggestion, UnexpectedConstInGenericParam,
UnexpectedConstParamDeclaration, UnexpectedConstParamDeclarationSugg, UnmatchedAngleBrackets,
UseEqInstead, WrapType,
};
use crate::parser::attr::InnerAttrPolicy;
use crate::{exp, fluent_generated as fluent};
@ -497,7 +498,7 @@ impl<'a> Parser<'a> {
// If the user is trying to write a ternary expression, recover it and
// return an Err to prevent a cascade of irrelevant diagnostics.
if self.prev_token == token::Question
&& let Err(e) = self.maybe_recover_from_ternary_operator()
&& let Err(e) = self.maybe_recover_from_ternary_operator(None)
{
return Err(e);
}
@ -1602,12 +1603,18 @@ impl<'a> Parser<'a> {
/// Rust has no ternary operator (`cond ? then : else`). Parse it and try
/// to recover from it if `then` and `else` are valid expressions. Returns
/// an err if this appears to be a ternary expression.
pub(super) fn maybe_recover_from_ternary_operator(&mut self) -> PResult<'a, ()> {
/// If we have the span of the condition, we can provide a better error span
/// and code suggestion.
pub(super) fn maybe_recover_from_ternary_operator(
&mut self,
cond: Option<Span>,
) -> PResult<'a, ()> {
if self.prev_token != token::Question {
return PResult::Ok(());
}
let lo = self.prev_token.span.lo();
let question = self.prev_token.span;
let lo = cond.unwrap_or(question).lo();
let snapshot = self.create_snapshot_for_diagnostic();
if match self.parse_expr() {
@ -1620,11 +1627,20 @@ impl<'a> Parser<'a> {
}
} {
if self.eat_noexpect(&token::Colon) {
let colon = self.prev_token.span;
match self.parse_expr() {
Ok(_) => {
return Err(self
.dcx()
.create_err(TernaryOperator { span: self.token.span.with_lo(lo) }));
Ok(expr) => {
let sugg = cond.map(|cond| TernaryOperatorSuggestion {
before_cond: cond.shrink_to_lo(),
question,
colon,
end: expr.span.shrink_to_hi(),
});
return Err(self.dcx().create_err(TernaryOperator {
span: self.prev_token.span.with_lo(lo),
sugg,
no_sugg: sugg.is_none(),
}));
}
Err(err) => {
err.cancel();

View file

@ -879,7 +879,12 @@ impl<'a> Parser<'a> {
{
// Just check for errors and recover; do not eat semicolon yet.
let expect_result = self.expect_one_of(&[], &[exp!(Semi), exp!(CloseBrace)]);
let expect_result =
if let Err(e) = self.maybe_recover_from_ternary_operator(Some(expr.span)) {
Err(e)
} else {
self.expect_one_of(&[], &[exp!(Semi), exp!(CloseBrace)])
};
// Try to both emit a better diagnostic, and avoid further errors by replacing
// the `expr` with `ExprKind::Err`.

View file

@ -464,8 +464,8 @@ pub trait Into<T>: Sized {
/// orphaning rules.
/// See [`Into`] for more details.
///
/// Prefer using [`Into`] over using `From` when specifying trait bounds on a generic function.
/// This way, types that directly implement [`Into`] can be used as arguments as well.
/// Prefer using [`Into`] over [`From`] when specifying trait bounds on a generic function
/// to ensure that types that only implement [`Into`] can be used as well.
///
/// The `From` trait is also very useful when performing error handling. When constructing a function
/// that is capable of failing, the return type will generally be of the form `Result<T, E>`.
@ -597,6 +597,9 @@ pub trait From<T>: Sized {
/// standard library. For more information on this, see the
/// documentation for [`Into`].
///
/// Prefer using [`TryInto`] over [`TryFrom`] when specifying trait bounds on a generic function
/// to ensure that types that only implement [`TryInto`] can be used as well.
///
/// # Implementing `TryInto`
///
/// This suffers the same restrictions and reasoning as implementing
@ -636,6 +639,9 @@ pub trait TryInto<T>: Sized {
/// When the [`!`] type is stabilized [`Infallible`] and [`!`] will be
/// equivalent.
///
/// Prefer using [`TryInto`] over [`TryFrom`] when specifying trait bounds on a generic function
/// to ensure that types that only implement [`TryInto`] can be used as well.
///
/// `TryFrom<T>` can be implemented as follows:
///
/// ```

View file

@ -307,11 +307,11 @@ impl UnixStream {
///
/// ```no_run
/// use std::io;
/// use std::net::UdpSocket;
/// use std::os::unix::net::UnixStream;
/// use std::time::Duration;
///
/// fn main() -> std::io::Result<()> {
/// let socket = UdpSocket::bind("127.0.0.1:34254")?;
/// let socket = UnixStream::connect("/tmp/sock")?;
/// let result = socket.set_write_timeout(Some(Duration::new(0, 0)));
/// let err = result.unwrap_err();
/// assert_eq!(err.kind(), io::ErrorKind::InvalidInput);

View file

@ -72,7 +72,6 @@ pub trait FileExt {
/// If this function returns an error, it is unspecified how many bytes it
/// has read, but it will never read more than would be necessary to
/// completely fill the buffer.
#[stable(feature = "rw_exact_all_at", since = "1.33.0")]
fn read_exact_at(&self, mut buf: &mut [u8], mut offset: u64) -> io::Result<()> {
while !buf.is_empty() {
match self.read_at(buf, offset) {
@ -144,7 +143,6 @@ pub trait FileExt {
/// non-[`io::ErrorKind::Interrupted`] kind that [`write_at`] returns.
///
/// [`write_at`]: FileExt::write_at
#[stable(feature = "rw_exact_all_at", since = "1.33.0")]
fn write_all_at(&self, mut buf: &[u8], mut offset: u64) -> io::Result<()> {
while !buf.is_empty() {
match self.write_at(buf, offset) {

View file

@ -344,6 +344,27 @@ pub trait CommandExt: Sealed {
&mut self,
attribute_list: &ProcThreadAttributeList<'_>,
) -> io::Result<process::Child>;
/// When true, sets the `STARTF_RUNFULLSCREEN` flag on the [STARTUPINFO][1] struct before passing it to `CreateProcess`.
///
/// [1]: https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/ns-processthreadsapi-startupinfoa
#[unstable(feature = "windows_process_extensions_startupinfo", issue = "141010")]
fn startupinfo_fullscreen(&mut self, enabled: bool) -> &mut process::Command;
/// When true, sets the `STARTF_UNTRUSTEDSOURCE` flag on the [STARTUPINFO][1] struct before passing it to `CreateProcess`.
///
/// [1]: https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/ns-processthreadsapi-startupinfoa
#[unstable(feature = "windows_process_extensions_startupinfo", issue = "141010")]
fn startupinfo_untrusted_source(&mut self, enabled: bool) -> &mut process::Command;
/// When specified, sets the following flags on the [STARTUPINFO][1] struct before passing it to `CreateProcess`:
/// - If `Some(true)`, sets `STARTF_FORCEONFEEDBACK`
/// - If `Some(false)`, sets `STARTF_FORCEOFFFEEDBACK`
/// - If `None`, does not set any flags
///
/// [1]: https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/ns-processthreadsapi-startupinfoa
#[unstable(feature = "windows_process_extensions_startupinfo", issue = "141010")]
fn startupinfo_force_feedback(&mut self, enabled: Option<bool>) -> &mut process::Command;
}
#[stable(feature = "windows_process_extensions", since = "1.16.0")]
@ -385,6 +406,21 @@ impl CommandExt for process::Command {
.spawn_with_attributes(sys::process::Stdio::Inherit, true, Some(attribute_list))
.map(process::Child::from_inner)
}
fn startupinfo_fullscreen(&mut self, enabled: bool) -> &mut process::Command {
self.as_inner_mut().startupinfo_fullscreen(enabled);
self
}
fn startupinfo_untrusted_source(&mut self, enabled: bool) -> &mut process::Command {
self.as_inner_mut().startupinfo_untrusted_source(enabled);
self
}
fn startupinfo_force_feedback(&mut self, enabled: Option<bool>) -> &mut process::Command {
self.as_inner_mut().startupinfo_force_feedback(enabled);
self
}
}
#[unstable(feature = "windows_process_extensions_main_thread_handle", issue = "96723")]

View file

@ -155,6 +155,9 @@ pub struct Command {
stdout: Option<Stdio>,
stderr: Option<Stdio>,
force_quotes_enabled: bool,
startupinfo_fullscreen: bool,
startupinfo_untrusted_source: bool,
startupinfo_force_feedback: Option<bool>,
}
pub enum Stdio {
@ -186,6 +189,9 @@ impl Command {
stdout: None,
stderr: None,
force_quotes_enabled: false,
startupinfo_fullscreen: false,
startupinfo_untrusted_source: false,
startupinfo_force_feedback: None,
}
}
@ -222,6 +228,18 @@ impl Command {
self.args.push(Arg::Raw(command_str_to_append.to_os_string()))
}
pub fn startupinfo_fullscreen(&mut self, enabled: bool) {
self.startupinfo_fullscreen = enabled;
}
pub fn startupinfo_untrusted_source(&mut self, enabled: bool) {
self.startupinfo_untrusted_source = enabled;
}
pub fn startupinfo_force_feedback(&mut self, enabled: Option<bool>) {
self.startupinfo_force_feedback = enabled;
}
pub fn get_program(&self) -> &OsStr {
&self.program
}
@ -343,6 +361,24 @@ impl Command {
si.wShowWindow = cmd_show;
}
if self.startupinfo_fullscreen {
si.dwFlags |= c::STARTF_RUNFULLSCREEN;
}
if self.startupinfo_untrusted_source {
si.dwFlags |= c::STARTF_UNTRUSTEDSOURCE;
}
match self.startupinfo_force_feedback {
Some(true) => {
si.dwFlags |= c::STARTF_FORCEONFEEDBACK;
}
Some(false) => {
si.dwFlags |= c::STARTF_FORCEOFFFEEDBACK;
}
None => {}
}
let si_ptr: *mut c::STARTUPINFOW;
let mut si_ex;

View file

@ -170,7 +170,7 @@ print("Time,Idle")
while True:
time.sleep(1)
next_state = State()
now = datetime.datetime.utcnow().isoformat()
now = datetime.datetime.now(datetime.timezone.utc).replace(tzinfo=None).isoformat()
idle = next_state.idle_since(cur_state)
print("%s,%s" % (now, idle))
sys.stdout.flush()

View file

@ -91,6 +91,16 @@ Older versions of `josh-proxy` may not round trip commits losslessly so it is im
3) Push the branch to your fork and create a PR into `rustc-dev-guide`
### Push changes from this repository into `rust-lang/rust`
NOTE: If you use Git protocol to push to your fork of `rust-lang/rust`,
ensure that you have this entry in your Git config,
else the 2 steps that follow would prompt for a username and password:
```
[url "git@github.com:"]
insteadOf = "https://github.com/"
```
1) Run the push command to create a branch named `<branch-name>` in a `rustc` fork under the `<gh-username>` account
```
cargo run --manifest-path josh-sync/Cargo.toml rustc-push <branch-name> <gh-username>

View file

@ -1,6 +1,6 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
version = 4
[[package]]
name = "aho-corasick"
@ -28,21 +28,24 @@ dependencies = [
[[package]]
name = "autocfg"
version = "1.3.0"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0"
checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
[[package]]
name = "bumpalo"
version = "3.16.0"
version = "3.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf"
[[package]]
name = "cc"
version = "1.0.106"
version = "1.2.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "066fce287b1d4eafef758e89e09d724a24808a9196fe9756b8ca90e86d0719a2"
checksum = "32db95edf998450acc7881c932f94cd9b05c87b4b2599e8bab064753da4acfd1"
dependencies = [
"shlex",
]
[[package]]
name = "cfg-if"
@ -52,27 +55,27 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "chrono"
version = "0.4.38"
version = "0.4.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401"
checksum = "c469d952047f47f91b68d1cba3f10d63c11d73e4636f24f08daf0278abf01c4d"
dependencies = [
"android-tzdata",
"iana-time-zone",
"js-sys",
"num-traits",
"wasm-bindgen",
"windows-targets",
"windows-link",
]
[[package]]
name = "core-foundation-sys"
version = "0.8.6"
version = "0.8.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f"
checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
[[package]]
name = "date-check"
version = "0.1.0"
version = "0.0.0"
dependencies = [
"chrono",
"glob",
@ -81,20 +84,21 @@ dependencies = [
[[package]]
name = "glob"
version = "0.3.1"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2"
[[package]]
name = "iana-time-zone"
version = "0.1.60"
version = "0.1.63"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141"
checksum = "b0c919e5debc312ad217002b8048a17b7d83f80703865bbfcfebb0458b0b27d8"
dependencies = [
"android_system_properties",
"core-foundation-sys",
"iana-time-zone-haiku",
"js-sys",
"log",
"wasm-bindgen",
"windows-core",
]
@ -110,24 +114,25 @@ dependencies = [
[[package]]
name = "js-sys"
version = "0.3.69"
version = "0.3.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d"
checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f"
dependencies = [
"once_cell",
"wasm-bindgen",
]
[[package]]
name = "libc"
version = "0.2.155"
version = "0.2.172"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa"
[[package]]
name = "log"
version = "0.4.22"
version = "0.4.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
[[package]]
name = "memchr"
@ -146,33 +151,33 @@ dependencies = [
[[package]]
name = "once_cell"
version = "1.19.0"
version = "1.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
[[package]]
name = "proc-macro2"
version = "1.0.86"
version = "1.0.95"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77"
checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.36"
version = "1.0.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
dependencies = [
"proc-macro2",
]
[[package]]
name = "regex"
version = "1.10.5"
version = "1.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f"
checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191"
dependencies = [
"aho-corasick",
"memchr",
@ -182,9 +187,9 @@ dependencies = [
[[package]]
name = "regex-automata"
version = "0.4.7"
version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df"
checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908"
dependencies = [
"aho-corasick",
"memchr",
@ -193,15 +198,27 @@ dependencies = [
[[package]]
name = "regex-syntax"
version = "0.8.4"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
[[package]]
name = "rustversion"
version = "1.0.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2"
[[package]]
name = "shlex"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
[[package]]
name = "syn"
version = "2.0.70"
version = "2.0.101"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f0209b68b3613b093e0ec905354eccaedcfe83b8cb37cbdeae64026c3064c16"
checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf"
dependencies = [
"proc-macro2",
"quote",
@ -210,29 +227,30 @@ dependencies = [
[[package]]
name = "unicode-ident"
version = "1.0.12"
version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
[[package]]
name = "wasm-bindgen"
version = "0.2.92"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8"
checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5"
dependencies = [
"cfg-if",
"once_cell",
"rustversion",
"wasm-bindgen-macro",
]
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.92"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da"
checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6"
dependencies = [
"bumpalo",
"log",
"once_cell",
"proc-macro2",
"quote",
"syn",
@ -241,9 +259,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.92"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726"
checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@ -251,9 +269,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.92"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de"
dependencies = [
"proc-macro2",
"quote",
@ -264,79 +282,68 @@ dependencies = [
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.92"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96"
checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d"
dependencies = [
"unicode-ident",
]
[[package]]
name = "windows-core"
version = "0.52.0"
version = "0.61.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
checksum = "4763c1de310c86d75a878046489e2e5ba02c649d185f21c67d4cf8a56d098980"
dependencies = [
"windows-targets",
"windows-implement",
"windows-interface",
"windows-link",
"windows-result",
"windows-strings",
]
[[package]]
name = "windows-targets"
version = "0.52.6"
name = "windows-implement"
version = "0.60.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_gnullvm",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.6"
name = "windows-interface"
version = "0.59.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.6"
name = "windows-link"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38"
[[package]]
name = "windows_i686_gnu"
version = "0.52.6"
name = "windows-result"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
checksum = "c64fd11a4fd95df68efcfee5f44a294fe71b8bc6a91993e2791938abcc712252"
dependencies = [
"windows-link",
]
[[package]]
name = "windows_i686_gnullvm"
version = "0.52.6"
name = "windows-strings"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
[[package]]
name = "windows_i686_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
checksum = "7a2ba9642430ee452d5a7aa78d72907ebe8cfda358e8cb7918a2050581322f97"
dependencies = [
"windows-link",
]

View file

@ -1,10 +1,6 @@
[package]
name = "date-check"
version = "0.1.0"
authors = ["Noah Lev <camelidcamel@gmail.com>"]
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
edition = "2024"
[dependencies]
glob = "0.3"

View file

@ -114,7 +114,7 @@ fn filter_dates(
fn main() {
let mut args = env::args();
if args.len() == 1 {
eprintln!("error: expected root Markdown directory as CLI argument");
eprintln!("error: expected root of Markdown directory as CLI argument");
process::exit(1);
}
let root_dir = args.nth(1).unwrap();

View file

@ -161,7 +161,7 @@ checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
[[package]]
name = "josh-sync"
version = "0.1.0"
version = "0.0.0"
dependencies = [
"anyhow",
"clap",

View file

@ -1,7 +1,6 @@
[package]
name = "josh-sync"
version = "0.1.0"
edition = "2021"
edition = "2024"
[dependencies]
anyhow = "1.0.95"

View file

@ -1,4 +1,5 @@
use clap::Parser;
use crate::sync::{GitSync, RustcPullError};
mod sync;
@ -11,10 +12,7 @@ enum Args {
/// Push changes from `rustc-dev-guide` to the given `branch` of a `rustc` fork under the given
/// GitHub `username`.
/// The pushed branch should then be merged into the `rustc` repository.
RustcPush {
branch: String,
github_username: String
}
RustcPush { branch: String, github_username: String },
}
fn main() -> anyhow::Result<()> {

View file

@ -1,10 +1,11 @@
use std::io::Write;
use std::ops::Not;
use std::path::PathBuf;
use std::{env, net, process};
use std::io::Write;
use std::time::Duration;
use anyhow::{anyhow, bail, Context};
use xshell::{cmd, Shell};
use std::{env, net, process};
use anyhow::{Context, anyhow, bail};
use xshell::{Shell, cmd};
/// Used for rustc syncs.
const JOSH_FILTER: &str = ":/src/doc/rustc-dev-guide";
@ -15,10 +16,13 @@ pub enum RustcPullError {
/// No changes are available to be pulled.
NothingToPull,
/// A rustc-pull has failed, probably a git operation error has occurred.
PullFailed(anyhow::Error)
PullFailed(anyhow::Error),
}
impl<E> From<E> for RustcPullError where E: Into<anyhow::Error> {
impl<E> From<E> for RustcPullError
where
E: Into<anyhow::Error>,
{
fn from(error: E) -> Self {
Self::PullFailed(error.into())
}
@ -32,9 +36,7 @@ pub struct GitSync {
/// (https://github.com/rust-lang/miri/blob/6a68a79f38064c3bc30617cca4bdbfb2c336b140/miri-script/src/commands.rs#L236).
impl GitSync {
pub fn from_current_dir() -> anyhow::Result<Self> {
Ok(Self {
dir: std::env::current_dir()?
})
Ok(Self { dir: std::env::current_dir()? })
}
pub fn rustc_pull(&self, commit: Option<String>) -> Result<(), RustcPullError> {
@ -51,7 +53,10 @@ impl GitSync {
})?;
// Make sure the repo is clean.
if cmd!(sh, "git status --untracked-files=no --porcelain").read()?.is_empty().not() {
return Err(anyhow::anyhow!("working directory must be clean before performing rustc pull").into());
return Err(anyhow::anyhow!(
"working directory must be clean before performing rustc pull"
)
.into());
}
// Make sure josh is running.
let josh = Self::start_josh()?;
@ -94,7 +99,8 @@ impl GitSync {
};
let num_roots_before = num_roots()?;
let sha = cmd!(sh, "git rev-parse HEAD").output().context("FAILED to get current commit")?.stdout;
let sha =
cmd!(sh, "git rev-parse HEAD").output().context("FAILED to get current commit")?.stdout;
// Merge the fetched commit.
const MERGE_COMMIT_MESSAGE: &str = "Merge from rustc";
@ -102,18 +108,24 @@ impl GitSync {
.run()
.context("FAILED to merge new commits, something went wrong")?;
let current_sha = cmd!(sh, "git rev-parse HEAD").output().context("FAILED to get current commit")?.stdout;
let current_sha =
cmd!(sh, "git rev-parse HEAD").output().context("FAILED to get current commit")?.stdout;
if current_sha == sha {
cmd!(sh, "git reset --hard HEAD^")
.run()
.expect("FAILED to clean up after creating the preparation commit");
eprintln!("No merge was performed, no changes to pull were found. Rolled back the preparation commit.");
eprintln!(
"No merge was performed, no changes to pull were found. Rolled back the preparation commit."
);
return Err(RustcPullError::NothingToPull);
}
// Check that the number of roots did not increase.
if num_roots()? != num_roots_before {
return Err(anyhow::anyhow!("Josh created a new root commit. This is probably not the history you want.").into());
return Err(anyhow::anyhow!(
"Josh created a new root commit. This is probably not the history you want."
)
.into());
}
drop(josh);

View file

@ -1 +1 @@
0c33fe2c3d3eecadd17a84b110bb067288a64f1c
414482f6a0d4e7290f614300581a0b55442552a3

View file

@ -2,9 +2,6 @@
<!-- toc -->
> N.B. [`rustc_ast`], [`rustc_expand`], and [`rustc_builtin_macros`] are all
> undergoing refactoring, so some of the links in this chapter may be broken.
Rust has a very powerful macro system. In the previous chapter, we saw how
the parser sets aside macros to be expanded (using temporary [placeholders]).
This chapter is about the process of expanding those macros iteratively until
@ -12,9 +9,6 @@ we have a complete [*Abstract Syntax Tree* (AST)][ast] for our crate with no
unexpanded macros (or a compile error).
[ast]: ./ast-validation.md
[`rustc_ast`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast/index.html
[`rustc_expand`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_expand/index.html
[`rustc_builtin_macros`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_builtin_macros/index.html
[placeholders]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_expand/placeholders/index.html
First, we discuss the algorithm that expands and integrates macro output into

View file

@ -55,8 +55,8 @@ The first step in [`clean::utils::krate`][ck1] is to invoke
* inlining public `use` exports of private items, or showing a "Reexport"
line in the module page
* inlining items with `#[doc(hidden)]` if the base item is hidden but the
* showing `#[macro_export]`-ed macros at the crate root, regardless of where
they're defined reexport is not
* showing `#[macro_export]`-ed macros at the crate root, regardless of whether
they're defined as a reexport or not
After this step, `clean::krate` invokes [`clean_doc_module`], which actually
converts the `HIR` items to the cleaned [`AST`][ast]. This is also the step where cross-

View file

@ -169,7 +169,7 @@ The `LazyArray<[T]>` and `LazyTable<I, T>` types provide some functionality over
than the one being read.
**note**: `LazyValue<T>` does not cache its value after being deserialized the
first time. Instead the query system its self is the main way of caching these
first time. Instead the query system itself is the main way of caching these
results.
[`LazyArray<T>`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_metadata/rmeta/struct.LazyValue.html

View file

@ -70,6 +70,11 @@ related tests.
> //!
> //! Regression test for <https://github.com/rust-lang/rust/issues/123456>.
> ```
>
> One exception to this rule is [crashes tests]: there it is canonical that
> tests are named only after issue numbers because its purpose is to track
> snippets from which issues no longer ICE/crash, and they would either be
> removed or converted into proper ui/other tests in the fix PRs.
## Test organization
@ -194,3 +199,4 @@ See [LLVM FileCheck guide][FileCheck] for details.
[compiletest directives]: ./directives.md
[`run-make`]: ./compiletest.md#run-make-tests
[FileCheck]: https://llvm.org/docs/CommandGuide/FileCheck.html
[crashes tests]: ./compiletest.md#crashes-tests

View file

@ -102,11 +102,12 @@ by passing a path to a book to `./x test`.
### Documentation link checker
Links across all documentation is validated with a link checker tool.
Links across all documentation is validated with a link checker tool,
and it can be invoked so:
> Example: `./x test src/tools/linkchecker`
> Example: `./x test linkchecker`
```console
./x test linkchecker
```
This requires building all of the documentation, which might take a while.

View file

@ -32,21 +32,21 @@ Built-in implementations are provided for:
## Structural implementations
There are two implementations of `Unsize` which can be thought of as
There is one implementation of `Unsize` which can be thought of as
structural:
* `(A1, A2, .., An): Unsize<(A1, A2, .., U)>` given `An: Unsize<U>`, which
allows the tail field of a tuple to be unsized. This is gated behind the
[`unsized_tuple_coercion`] feature.
* `Struct<.., Pi, .., Pj, ..>: Unsize<Struct<.., Ui, .., Uj, ..>>` given
`TailField<Pi, .., Pj>: Unsize<Ui, .. Uj>`, which allows the tail field of a
struct to be unsized if it is the only field that mentions generic parameters
`Pi`, .., `Pj` (which don't need to be contiguous).
The rules for the latter implementation are slightly complicated, since they
The rules for struct unsizing are slightly complicated, since they
may allow more than one parameter to be changed (not necessarily unsized) and
are best stated in terms of the tail field of the struct.
[`unsized_tuple_coercion`]: https://doc.rust-lang.org/beta/unstable-book/language-features/unsized-tuple-coercion.html
(Tuple unsizing was previously implemented behind the feature gate
`unsized_tuple_coercion`, but the implementation was removed by [#137728].)
[#137728]: https://github.com/rust-lang/rust/pull/137728
## Upcasting implementations

View file

@ -1,26 +1,28 @@
<!-- date-check: may 2024 -->
# `TypeFoldable` and `TypeFolder`
In the previous chapter we discussed instantiating binders. This must involves looking at everything inside of a `Early/Binder`
to find any usages of the bound vars in order to replace them. Binders can wrap an arbitrary rust type `T` not just a `Ty` so
how do we implement the `instantiate` methods on the `Early/Binder` types.
In [a previous chapter], we discussed instantiating binders.
This involves looking at everything inside of a `Early(Binder)`
to find any usages of the bound vars in order to replace them.
Binders can wrap an arbitrary Rust type `T`, not just a `Ty`.
So, how do we implement the `instantiate` methods on the `Early/Binder` types?
The answer is a couple of traits:
[`TypeFoldable`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/fold/trait.TypeFoldable.html)
[`TypeFoldable`]
and
[`TypeFolder`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/fold/trait.TypeFolder.html).
[`TypeFolder`].
- `TypeFoldable` is implemented by types that embed type information. It allows you to recursively
process the contents of the `TypeFoldable` and do stuff to them.
- `TypeFolder` defines what you want to do with the types you encounter while processing the
`TypeFoldable`.
For example, the `TypeFolder` trait has a method
[`fold_ty`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/fold/trait.TypeFolder.html#method.fold_ty)
that takes a type as input and returns a new type as a result. `TypeFoldable` invokes the
`TypeFolder` `fold_foo` methods on itself, giving the `TypeFolder` access to its contents (the
types, regions, etc that are contained within).
For example, the `TypeFolder` trait has a method [`fold_ty`]
that takes a type as input and returns a new type as a result.
`TypeFoldable` invokes the `TypeFolder` `fold_foo` methods on itself,
giving the `TypeFolder` access to its contents (the types, regions, etc that are contained within).
You can think of it with this analogy to the iterator combinators we have come to love in rust:
You can think of it with this analogy to the iterator combinators we have come to love in Rust:
```rust,ignore
vec.iter().map(|e1| foo(e2)).collect()
@ -33,8 +35,7 @@ So to reiterate:
- `TypeFolder` is a trait that defines a “map” operation.
- `TypeFoldable` is a trait that is implemented by things that embed types.
In the case of `subst`, we can see that it is implemented as a `TypeFolder`:
[`ArgFolder`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_type_ir/binder/struct.ArgFolder.html).
In the case of `subst`, we can see that it is implemented as a `TypeFolder`: [`ArgFolder`].
Looking at its implementation, we see where the actual substitutions are happening.
However, you might also notice that the implementation calls this `super_fold_with` method. What is
@ -88,17 +89,22 @@ things. We only want to do something when we reach a type. That means there may
`TypeFoldable` types whose implementations basically just forward to their fields `TypeFoldable`
implementations. Such implementations of `TypeFoldable` tend to be pretty tedious to write by hand.
For this reason, there is a `derive` macro that allows you to `#![derive(TypeFoldable)]`. It is
defined
[here](https://github.com/rust-lang/rust/blob/master/compiler/rustc_macros/src/type_foldable.rs).
defined [here].
**`subst`** In the case of substitutions the [actual
folder](https://github.com/rust-lang/rust/blob/75ff3110ac6d8a0259023b83fd20d7ab295f8dd6/src/librustc_middle/ty/subst.rs#L440-L451)
is going to be doing the indexing weve already mentioned. There we define a `Folder` and call
`fold_with` on the `TypeFoldable` to process yourself. Then
[fold_ty](https://github.com/rust-lang/rust/blob/75ff3110ac6d8a0259023b83fd20d7ab295f8dd6/src/librustc_middle/ty/subst.rs#L512-L536)
the method that process each type it looks for a `ty::Param` and for those it replaces it for
something from the list of substitutions, otherwise recursively process the type. To replace it,
calls
[ty_for_param](https://github.com/rust-lang/rust/blob/75ff3110ac6d8a0259023b83fd20d7ab295f8dd6/src/librustc_middle/ty/subst.rs#L552-L587)
**`subst`** In the case of substitutions the [actual folder]
is going to be doing the indexing weve already mentioned.
There we define a `Folder` and call `fold_with` on the `TypeFoldable` to process yourself.
Then [fold_ty] the method that process each type it looks for a `ty::Param` and for those
it replaces it for something from the list of substitutions, otherwise recursively process the type.
To replace it, calls [ty_for_param]
and all that does is index into the list of substitutions with the index of the `Param`.
[a previous chapter]: ty_module/instantiating_binders.md
[`TypeFoldable`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/trait.TypeFoldable.html
[`TypeFolder`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/trait.TypeFolder.html
[`fold_ty`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/trait.TypeFolder.html#method.fold_ty
[`ArgFolder`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_type_ir/binder/struct.ArgFolder.html
[here]: https://github.com/rust-lang/rust/blob/master/compiler/rustc_macros/src/type_foldable.rs
[actual folder]: https://github.com/rust-lang/rust/blob/75ff3110ac6d8a0259023b83fd20d7ab295f8dd6/src/librustc_middle/ty/subst.rs#L440-L451
[fold_ty]: https://github.com/rust-lang/rust/blob/75ff3110ac6d8a0259023b83fd20d7ab295f8dd6/src/librustc_middle/ty/subst.rs#L512-L536
[ty_for_param]: https://github.com/rust-lang/rust/blob/75ff3110ac6d8a0259023b83fd20d7ab295f8dd6/src/librustc_middle/ty/subst.rs#L552-L587

View file

@ -1183,47 +1183,39 @@ ui/impl-trait/explicit-generic-args-with-impl-trait/issue-87718.rs
ui/impl-trait/in-trait/issue-102140.rs
ui/impl-trait/in-trait/issue-102301.rs
ui/impl-trait/in-trait/issue-102571.rs
ui/impl-trait/issue-100075-2.rs
ui/impl-trait/issue-100075.rs
ui/impl-trait/issue-100187.rs
ui/impl-trait/issue-102605.rs
ui/impl-trait/issue-103181-1.rs
ui/impl-trait/issue-103181-2.rs
ui/impl-trait/issue-103599.rs
ui/impl-trait/issue-108591.rs
ui/impl-trait/issue-108592.rs
ui/impl-trait/issue-35668.rs
ui/impl-trait/issue-36792.rs
ui/impl-trait/issue-46959.rs
ui/impl-trait/issue-49556.rs
ui/impl-trait/issue-49579.rs
ui/impl-trait/issue-49685.rs
ui/impl-trait/issue-51185.rs
ui/impl-trait/issue-54966.rs
ui/impl-trait/issue-55872-1.rs
ui/impl-trait/issue-55872-2.rs
ui/impl-trait/issue-55872-3.rs
ui/impl-trait/issue-55872.rs
ui/impl-trait/issue-56445.rs
ui/impl-trait/issue-68532.rs
ui/impl-trait/issue-72911.rs
ui/impl-trait/issue-87450.rs
ui/impl-trait/issue-99073-2.rs
ui/impl-trait/issue-99073.rs
ui/impl-trait/issue-99642-2.rs
ui/impl-trait/issue-99642.rs
ui/impl-trait/issue-99914.rs
ui/impl-trait/issues/issue-100075-2.rs
ui/impl-trait/issues/issue-100075.rs
ui/impl-trait/issues/issue-100187.rs
ui/impl-trait/issues/issue-102605.rs
ui/impl-trait/issues/issue-103181-1.rs
ui/impl-trait/issues/issue-103181-2.rs
ui/impl-trait/issues/issue-103599.rs
ui/impl-trait/issues/issue-104815.rs
ui/impl-trait/issues/issue-105826.rs
ui/impl-trait/issues/issue-108591.rs
ui/impl-trait/issues/issue-108592.rs
ui/impl-trait/issues/issue-21659-show-relevant-trait-impls-3.rs
ui/impl-trait/issues/issue-35668.rs
ui/impl-trait/issues/issue-36792.rs
ui/impl-trait/issues/issue-42479.rs
ui/impl-trait/issues/issue-46959.rs
ui/impl-trait/issues/issue-49376.rs
ui/impl-trait/issues/issue-49556.rs
ui/impl-trait/issues/issue-49579.rs
ui/impl-trait/issues/issue-49685.rs
ui/impl-trait/issues/issue-51185.rs
ui/impl-trait/issues/issue-52128.rs
ui/impl-trait/issues/issue-53457.rs
ui/impl-trait/issues/issue-54600.rs
ui/impl-trait/issues/issue-54840.rs
ui/impl-trait/issues/issue-54895.rs
ui/impl-trait/issues/issue-54966.rs
ui/impl-trait/issues/issue-55608-captures-empty-region.rs
ui/impl-trait/issues/issue-55872-1.rs
ui/impl-trait/issues/issue-55872-2.rs
ui/impl-trait/issues/issue-55872-3.rs
ui/impl-trait/issues/issue-55872.rs
ui/impl-trait/issues/issue-56445.rs
ui/impl-trait/issues/issue-57464-unexpected-regions.rs
ui/impl-trait/issues/issue-57979-deeply-nested-impl-trait-in-assoc-proj.rs
ui/impl-trait/issues/issue-57979-impl-trait-in-path.rs
@ -1233,8 +1225,10 @@ ui/impl-trait/issues/issue-58956.rs
ui/impl-trait/issues/issue-62742.rs
ui/impl-trait/issues/issue-65581.rs
ui/impl-trait/issues/issue-67830.rs
ui/impl-trait/issues/issue-68532.rs
ui/impl-trait/issues/issue-70877.rs
ui/impl-trait/issues/issue-70971.rs
ui/impl-trait/issues/issue-72911.rs
ui/impl-trait/issues/issue-74282.rs
ui/impl-trait/issues/issue-77987.rs
ui/impl-trait/issues/issue-78722-2.rs
@ -1251,12 +1245,18 @@ ui/impl-trait/issues/issue-86719.rs
ui/impl-trait/issues/issue-86800.rs
ui/impl-trait/issues/issue-87295.rs
ui/impl-trait/issues/issue-87340.rs
ui/impl-trait/issues/issue-87450.rs
ui/impl-trait/issues/issue-88236-2.rs
ui/impl-trait/issues/issue-88236.rs
ui/impl-trait/issues/issue-89312.rs
ui/impl-trait/issues/issue-92305.rs
ui/impl-trait/issues/issue-93788.rs
ui/impl-trait/issues/issue-99073-2.rs
ui/impl-trait/issues/issue-99073.rs
ui/impl-trait/issues/issue-99348-impl-compatibility.rs
ui/impl-trait/issues/issue-99642-2.rs
ui/impl-trait/issues/issue-99642.rs
ui/impl-trait/issues/issue-99914.rs
ui/implied-bounds/issue-100690.rs
ui/implied-bounds/issue-101951.rs
ui/implied-bounds/issue-110161.rs

View file

@ -1,23 +0,0 @@
// Test that we are special casing "outlives" for opaque types.
//
// The return type of a closure is not required to outlive the closure. As such
// the following code would not compile if we used a standard outlives check
// when checking the return type, because the return type of the closure would
// be `&ReEmpty i32`, and we don't allow `ReEmpty` to occur in the concrete
// type used for an opaque type.
//
// However, opaque types are special cased to include check all regions in the
// concrete type against the bound, which forces the return type to be
// `&'static i32` here.
//@ build-pass (FIXME(62277): could be check-pass?)
fn make_identity() -> impl Sized {
|x: &'static i32| x
}
fn make_identity_static() -> impl Sized + 'static {
|x: &'static i32| x
}
fn main() {}

View file

@ -1,10 +0,0 @@
//@ check-pass
pub fn keys<'a>(x: &'a Result<u32, u32>) -> impl std::fmt::Debug + 'a {
match x {
Ok(map) => Ok(map),
Err(map) => Err(map),
}
}
fn main() {}

View file

@ -0,0 +1,2 @@
error: incorrect value `*lld` for codegen option `link-self-contained` - one of: `y`, `yes`, `on`, `n`, `no`, `off`, or a list of enabled (`+` prefix) and disabled (`-` prefix) components: `crto`, `libc`, `unwind`, `linker`, `sanitizers`, `mingw` was expected

View file

@ -0,0 +1,2 @@
error: incorrect value `` for codegen option `link-self-contained` - one of: `y`, `yes`, `on`, `n`, `no`, `off`, or a list of enabled (`+` prefix) and disabled (`-` prefix) components: `crto`, `libc`, `unwind`, `linker`, `sanitizers`, `mingw` was expected

View file

@ -0,0 +1,23 @@
//! Check that malformed `-Clink-self-contained` invocations are properly rejected.
//@ revisions: no_value
//@[no_value] compile-flags: -Clink-self-contained=
//[no_value]~? ERROR incorrect value `` for codegen option `link-self-contained`
//@ revisions: invalid_modifier
//@[invalid_modifier] compile-flags: -Clink-self-contained=*lld
//[invalid_modifier]~? ERROR incorrect value `*lld` for codegen option `link-self-contained`
//@ revisions: unknown_value
//@[unknown_value] compile-flags: -Clink-self-contained=unknown
//[unknown_value]~? ERROR incorrect value `unknown` for codegen option `link-self-contained`
//@ revisions: unknown_modifier_value
//@[unknown_modifier_value] compile-flags: -Clink-self-contained=-unknown
//[unknown_modifier_value]~? ERROR incorrect value `-unknown` for codegen option `link-self-contained`
//@ revisions: unknown_boolean
//@[unknown_boolean] compile-flags: -Clink-self-contained=maybe
//[unknown_boolean]~? ERROR incorrect value `maybe` for codegen option `link-self-contained`
fn main() {}

View file

@ -0,0 +1,2 @@
error: incorrect value `maybe` for codegen option `link-self-contained` - one of: `y`, `yes`, `on`, `n`, `no`, `off`, or a list of enabled (`+` prefix) and disabled (`-` prefix) components: `crto`, `libc`, `unwind`, `linker`, `sanitizers`, `mingw` was expected

View file

@ -0,0 +1,2 @@
error: incorrect value `-unknown` for codegen option `link-self-contained` - one of: `y`, `yes`, `on`, `n`, `no`, `off`, or a list of enabled (`+` prefix) and disabled (`-` prefix) components: `crto`, `libc`, `unwind`, `linker`, `sanitizers`, `mingw` was expected

View file

@ -0,0 +1,2 @@
error: incorrect value `unknown` for codegen option `link-self-contained` - one of: `y`, `yes`, `on`, `n`, `no`, `off`, or a list of enabled (`+` prefix) and disabled (`-` prefix) components: `crto`, `libc`, `unwind`, `linker`, `sanitizers`, `mingw` was expected

View file

@ -0,0 +1,2 @@
error: incorrect value `*lld` for unstable option `linker-features` - a list of enabled (`+` prefix) and disabled (`-` prefix) features: `lld` was expected

View file

@ -0,0 +1,2 @@
error: incorrect value `-lld@+lld` for unstable option `linker-features` - a list of enabled (`+` prefix) and disabled (`-` prefix) features: `lld` was expected

View file

@ -0,0 +1,2 @@
error: incorrect value `` for unstable option `linker-features` - a list of enabled (`+` prefix) and disabled (`-` prefix) features: `lld` was expected

View file

@ -0,0 +1,27 @@
//! Check that malformed `-Zlinker-features` flags are properly rejected.
//@ revisions: no_value
//@[no_value] compile-flags: -Zlinker-features=
//[no_value]~? ERROR incorrect value `` for unstable option `linker-features`
//@ revisions: invalid_modifier
//@[invalid_modifier] compile-flags: -Zlinker-features=*lld
//[invalid_modifier]~? ERROR incorrect value `*lld` for unstable option `linker-features`
//@ revisions: unknown_value
//@[unknown_value] compile-flags: -Zlinker-features=unknown
//[unknown_value]~? ERROR incorrect value `unknown` for unstable option `linker-features`
//@ revisions: unknown_modifier_value
//@[unknown_modifier_value] compile-flags: -Zlinker-features=-unknown
//[unknown_modifier_value]~? ERROR incorrect value `-unknown` for unstable option `linker-features`
//@ revisions: unknown_boolean
//@[unknown_boolean] compile-flags: -Zlinker-features=maybe
//[unknown_boolean]~? ERROR incorrect value `maybe` for unstable option `linker-features`
//@ revisions: invalid_separator
//@[invalid_separator] compile-flags: -Zlinker-features=-lld@+lld
//[invalid_separator]~? ERROR incorrect value `-lld@+lld` for unstable option `linker-features`
fn main() {}

View file

@ -0,0 +1,2 @@
error: incorrect value `maybe` for unstable option `linker-features` - a list of enabled (`+` prefix) and disabled (`-` prefix) features: `lld` was expected

View file

@ -0,0 +1,2 @@
error: incorrect value `-unknown` for unstable option `linker-features` - a list of enabled (`+` prefix) and disabled (`-` prefix) features: `lld` was expected

View file

@ -0,0 +1,2 @@
error: incorrect value `unknown` for unstable option `linker-features` - a list of enabled (`+` prefix) and disabled (`-` prefix) features: `lld` was expected

View file

@ -28,3 +28,9 @@ fn main() {
//~| HELP use an `if-else` expression instead
//~| ERROR expected one of `.`, `;`, `?`, `else`, or an operator, found `:`
}
fn expr(a: u64, b: u64) -> u64 {
a > b ? a : b
//~^ ERROR Rust has no ternary operator
//~| HELP use an `if-else` expression instead
}

View file

@ -2,7 +2,7 @@ error: Rust has no ternary operator
--> $DIR/ternary_operator.rs:2:19
|
LL | let x = 5 > 2 ? true : false;
| ^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^
|
= help: use an `if-else` expression instead
@ -10,7 +10,7 @@ error: Rust has no ternary operator
--> $DIR/ternary_operator.rs:8:19
|
LL | let x = 5 > 2 ? { true } : { false };
| ^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^
|
= help: use an `if-else` expression instead
@ -18,7 +18,7 @@ error: Rust has no ternary operator
--> $DIR/ternary_operator.rs:14:19
|
LL | let x = 5 > 2 ? f32::MAX : f32::MIN;
| ^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^
|
= help: use an `if-else` expression instead
@ -38,9 +38,21 @@ error: Rust has no ternary operator
--> $DIR/ternary_operator.rs:26:19
|
LL | let x = 5 > 2 ? { let x = vec![]: Vec<u16>; x } : { false };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: use an `if-else` expression instead
error: aborting due to 6 previous errors
error: Rust has no ternary operator
--> $DIR/ternary_operator.rs:33:5
|
LL | a > b ? a : b
| ^^^^^^^^^^^^^
|
help: use an `if-else` expression instead
|
LL - a > b ? a : b
LL + if a > b { a } else { b }
|
error: aborting due to 7 previous errors

Some files were not shown because too many files have changed in this diff Show more