diff options
| author | bors <bors@rust-lang.org> | 2025-04-24 08:50:48 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-04-24 08:50:48 +0000 |
| commit | dc8fe1f81c6cf13c0987944c525b2aa81625b5d0 (patch) | |
| tree | 7718b2d6a617a985ed76bd022a715d58df22f2d9 /src | |
| parent | 7f695232a80fa1833e2282f2577c5e1ff066bf39 (diff) | |
| parent | 986750ded489d5f948465667e6d67430e67c4826 (diff) | |
| download | rust-dc8fe1f81c6cf13c0987944c525b2aa81625b5d0.tar.gz rust-dc8fe1f81c6cf13c0987944c525b2aa81625b5d0.zip | |
Auto merge of #140239 - matthiaskrgr:rollup-75felo8, r=matthiaskrgr
Rollup of 9 pull requests
Successful merges:
- #134446 (Stabilize the `cell_update` feature)
- #139307 (std: Add performance warnings to HashMap::get_disjoint_mut)
- #139450 (Impl new API `std::os::unix::fs::mkfifo` under feature `unix_fifo`)
- #139809 (Don't warn about `v128` in wasm ABI transition)
- #139852 (StableMIR: Implement `CompilerInterface`)
- #139945 (Extend HIR to track the source and syntax of a lifetime)
- #140028 (`deref_patterns`: support string and byte string literals in explicit `deref!("...")` patterns)
- #140181 (Remove `synstructure::Structure::underscore_const` calls.)
- #140232 (Remove unnecessary clones)
r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src')
| -rw-r--r-- | src/bootstrap/src/core/build_steps/setup.rs | 6 | ||||
| -rw-r--r-- | src/doc/unstable-book/src/language-features/deref-patterns.md | 21 | ||||
| -rw-r--r-- | src/tools/miri/src/lib.rs | 1 |
3 files changed, 24 insertions, 4 deletions
diff --git a/src/bootstrap/src/core/build_steps/setup.rs b/src/bootstrap/src/core/build_steps/setup.rs index 83083e12ef1..9d07babe519 100644 --- a/src/bootstrap/src/core/build_steps/setup.rs +++ b/src/bootstrap/src/core/build_steps/setup.rs @@ -683,7 +683,7 @@ impl Step for Editor { match EditorKind::prompt_user() { Ok(editor_kind) => { if let Some(editor_kind) = editor_kind { - while !t!(create_editor_settings_maybe(config, editor_kind.clone())) {} + while !t!(create_editor_settings_maybe(config, &editor_kind)) {} } else { println!("Ok, skipping editor setup!"); } @@ -695,7 +695,7 @@ impl Step for Editor { /// Create the recommended editor LSP config file for rustc development, or just print it /// If this method should be re-called, it returns `false`. -fn create_editor_settings_maybe(config: &Config, editor: EditorKind) -> io::Result<bool> { +fn create_editor_settings_maybe(config: &Config, editor: &EditorKind) -> io::Result<bool> { let hashes = editor.hashes(); let (current_hash, historical_hashes) = hashes.split_last().unwrap(); let settings_path = editor.settings_path(config); @@ -752,7 +752,7 @@ fn create_editor_settings_maybe(config: &Config, editor: EditorKind) -> io::Resu // exists but user modified, back it up Some(false) => { // exists and is not current version or outdated, so back it up - let backup = settings_path.clone().with_extension(editor.backup_extension()); + let backup = settings_path.with_extension(editor.backup_extension()); eprintln!( "WARNING: copying `{}` to `{}`", settings_path.file_name().unwrap().to_str().unwrap(), diff --git a/src/doc/unstable-book/src/language-features/deref-patterns.md b/src/doc/unstable-book/src/language-features/deref-patterns.md index d0102a665b0..d0a64538e8c 100644 --- a/src/doc/unstable-book/src/language-features/deref-patterns.md +++ b/src/doc/unstable-book/src/language-features/deref-patterns.md @@ -54,4 +54,25 @@ if let [b] = &mut *v { assert_eq!(v, [Box::new(Some(2))]); ``` +Additionally, when `deref_patterns` is enabled, string literal patterns may be written where `str` +is expected. Likewise, byte string literal patterns may be written where `[u8]` or `[u8; _]` is +expected. This lets them be used in `deref!(_)` patterns: + +```rust +# #![feature(deref_patterns)] +# #![allow(incomplete_features)] +match ("test".to_string(), b"test".to_vec()) { + (deref!("test"), deref!(b"test")) => {} + _ => panic!(), +} + +// Matching on slices and arrays using literals is possible elsewhere as well: +match *"test" { + "test" => {} + _ => panic!(), +} +``` + +Implicit deref pattern syntax is not yet supported for string or byte string literals. + [smart pointers in the standard library]: https://doc.rust-lang.org/std/ops/trait.DerefPure.html#implementors diff --git a/src/tools/miri/src/lib.rs b/src/tools/miri/src/lib.rs index b6b2684dc6d..e03611e9b50 100644 --- a/src/tools/miri/src/lib.rs +++ b/src/tools/miri/src/lib.rs @@ -1,6 +1,5 @@ #![feature(rustc_private)] #![feature(cfg_match)] -#![feature(cell_update)] #![feature(float_gamma)] #![feature(float_erf)] #![feature(map_try_insert)] |
