mirror of
https://github.com/rust-lang/rust.git
synced 2026-01-25 07:48:44 +00:00
Auto merge of #117843 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum
[stable] Prepare 1.74.0 release https://forge.rust-lang.org/release/process.html#promote-branches-t-3-days-monday Also backports: * Disabling specialization as an alternative backport of "Fix excessive initialization and reads beyond EOF in io::copy(_, Vec<u8>) specialization #117576" * coverage: Avoid creating malformed macro name spans #117827 r? `@Mark-Simulacrum`
This commit is contained in:
233
RELEASES.md
233
RELEASES.md
@@ -1,3 +1,235 @@
|
||||
Version 1.74.0 (2023-11-16)
|
||||
==========================
|
||||
|
||||
<a id="1.74.0-Language"></a>
|
||||
|
||||
Language
|
||||
--------
|
||||
|
||||
- [Codify that `std::mem::Discriminant<T>` does not depend on any lifetimes in T](https://github.com/rust-lang/rust/pull/104299/)
|
||||
- [Replace `private_in_public` lint with `private_interfaces` and `private_bounds` per RFC 2145](https://github.com/rust-lang/rust/pull/113126/)
|
||||
Read more in [RFC 2145](https://rust-lang.github.io/rfcs/2145-type-privacy.html).
|
||||
- [Allow explicit `#[repr(Rust)]`](https://github.com/rust-lang/rust/pull/114201/)
|
||||
- [closure field capturing: don't depend on alignment of packed fields](https://github.com/rust-lang/rust/pull/115315/)
|
||||
- [Enable MIR-based drop-tracking for `async` blocks](https://github.com/rust-lang/rust/pull/107421/)
|
||||
|
||||
<a id="1.74.0-Compiler"></a>
|
||||
|
||||
Compiler
|
||||
--------
|
||||
|
||||
- [stabilize combining +bundle and +whole-archive link modifiers](https://github.com/rust-lang/rust/pull/113301/)
|
||||
- [Stabilize `PATH` option for `--print KIND=PATH`](https://github.com/rust-lang/rust/pull/114183/)
|
||||
- [Enable ASAN/LSAN/TSAN for `*-apple-ios-macabi`](https://github.com/rust-lang/rust/pull/115644/)
|
||||
- [Promote loongarch64-unknown-none* to Tier 2](https://github.com/rust-lang/rust/pull/115368/)
|
||||
- [Add `i686-pc-windows-gnullvm` as a tier 3 target](https://github.com/rust-lang/rust/pull/115687/)
|
||||
|
||||
<a id="1.74.0-Libraries"></a>
|
||||
|
||||
Libraries
|
||||
---------
|
||||
|
||||
- [Implement `From<OwnedFd/Handle>` for ChildStdin/out/err](https://github.com/rust-lang/rust/pull/98704/)
|
||||
- [Implement `From<{&,&mut} [T; N]>` for `Vec<T>` where `T: Clone`](https://github.com/rust-lang/rust/pull/111278/)
|
||||
- [impl Step for IP addresses](https://github.com/rust-lang/rust/pull/113748/)
|
||||
- [Implement `From<[T; N]>` for `Rc<[T]>` and `Arc<[T]>`](https://github.com/rust-lang/rust/pull/114041/)
|
||||
- [`impl TryFrom<char> for u16`](https://github.com/rust-lang/rust/pull/114065/)
|
||||
- [Stabilize `io_error_other` feature](https://github.com/rust-lang/rust/pull/115453/)
|
||||
- [Stabilize the `Saturating` type](https://github.com/rust-lang/rust/pull/115477/)
|
||||
- [Stabilize const_transmute_copy](https://github.com/rust-lang/rust/pull/115520/)
|
||||
|
||||
<a id="1.74.0-Stabilized-APIs"></a>
|
||||
|
||||
Stabilized APIs
|
||||
---------------
|
||||
|
||||
- [`core::num::Saturating`](https://doc.rust-lang.org/stable/std/num/struct.Saturating.html)
|
||||
- [`impl From<io::Stdout> for std::process::Stdio`](https://doc.rust-lang.org/stable/std/process/struct.Stdio.html#impl-From%3CStdout%3E-for-Stdio)
|
||||
- [`impl From<io::Stderr> for std::process::Stdio`](https://doc.rust-lang.org/stable/std/process/struct.Stdio.html#impl-From%3CStderr%3E-for-Stdio)
|
||||
- [`impl From<OwnedHandle> for std::process::Child{Stdin, Stdout, Stderr}`](https://doc.rust-lang.org/stable/std/process/struct.Stdio.html#impl-From%3CStderr%3E-for-Stdio)
|
||||
- [`impl From<OwnedFd> for std::process::Child{Stdin, Stdout, Stderr}`](https://doc.rust-lang.org/stable/std/process/struct.Stdio.html#impl-From%3CStderr%3E-for-Stdio)
|
||||
- [`std::ffi::OsString::from_encoded_bytes_unchecked`](https://doc.rust-lang.org/stable/std/ffi/struct.OsString.html#method.from_encoded_bytes_unchecked)
|
||||
- [`std::ffi::OsString::into_encoded_bytes`](https://doc.rust-lang.org/stable/std/ffi/struct.OsString.html#method.into_encoded_bytes)
|
||||
- [`std::ffi::OsStr::from_encoded_bytes_unchecked`](https://doc.rust-lang.org/stable/std/ffi/struct.OsStr.html#method.from_encoded_bytes_unchecked)
|
||||
- [`std::ffi::OsStr::as_encoded_bytes`](https://doc.rust-lang.org/stable/std/ffi/struct.OsStr.html#method.as_encoded_bytes)
|
||||
- [`std::io::Error::other`](https://doc.rust-lang.org/stable/std/io/struct.Error.html#method.other)
|
||||
- [`impl TryFrom<char> for u16`](https://doc.rust-lang.org/stable/std/primitive.u16.html#impl-TryFrom%3Cchar%3E-for-u16)
|
||||
- [`impl<T: Clone, const N: usize> From<&[T; N]> for Vec<T>`](https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#impl-From%3C%26%5BT;+N%5D%3E-for-Vec%3CT,+Global%3E)
|
||||
- [`impl<T: Clone, const N: usize> From<&mut [T; N]> for Vec<T>`](https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#impl-From%3C%26mut+%5BT;+N%5D%3E-for-Vec%3CT,+Global%3E)
|
||||
- [`impl<T, const N: usize> From<[T; N]> for Arc<[T]>`](https://doc.rust-lang.org/stable/std/sync/struct.Arc.html#impl-From%3C%5BT;+N%5D%3E-for-Arc%3C%5BT%5D,+Global%3E)
|
||||
- [`impl<T, const N: usize> From<[T; N]> for Rc<[T]>`](https://doc.rust-lang.org/stable/std/rc/struct.Rc.html#impl-From%3C%5BT;+N%5D%3E-for-Rc%3C%5BT%5D,+Global%3E)
|
||||
|
||||
These APIs are now stable in const contexts:
|
||||
|
||||
- [`core::mem::transmute_copy`](https://doc.rust-lang.org/beta/std/mem/fn.transmute_copy.html)
|
||||
- [`str::is_ascii`](https://doc.rust-lang.org/beta/std/primitive.str.html#method.is_ascii)
|
||||
- [`[u8]::is_ascii`](https://doc.rust-lang.org/beta/std/primitive.slice.html#method.is_ascii)
|
||||
|
||||
<a id="1.74.0-Cargo"></a>
|
||||
|
||||
Cargo
|
||||
-----
|
||||
|
||||
- [fix: Set MSRV for internal packages](https://github.com/rust-lang/cargo/pull/12381/)
|
||||
- [config: merge lists in precedence order](https://github.com/rust-lang/cargo/pull/12515/)
|
||||
- [fix(update): Clarify meaning of --aggressive as --recursive](https://github.com/rust-lang/cargo/pull/12544/)
|
||||
- [fix(update): Make `-p` more convenient by being positional](https://github.com/rust-lang/cargo/pull/12545/)
|
||||
- [feat(help): Add styling to help output ](https://github.com/rust-lang/cargo/pull/12578/)
|
||||
- [feat(pkgid): Allow incomplete versions when unambigious](https://github.com/rust-lang/cargo/pull/12614/)
|
||||
- [feat: stabilize credential-process and registry-auth](https://github.com/rust-lang/cargo/pull/12649/)
|
||||
- [feat(cli): Add '-n' to dry-run](https://github.com/rust-lang/cargo/pull/12660/)
|
||||
- [Add support for `target.'cfg(..)'.linker`](https://github.com/rust-lang/cargo/pull/12535/)
|
||||
- [Stabilize `--keep-going`](https://github.com/rust-lang/cargo/pull/12568/)
|
||||
- [feat: Stabilize lints](https://github.com/rust-lang/cargo/pull/12648/)
|
||||
|
||||
<a id="1.74.0-Rustdoc"></a>
|
||||
|
||||
Rustdoc
|
||||
-------
|
||||
|
||||
- [Add warning block support in rustdoc](https://github.com/rust-lang/rust/pull/106561/)
|
||||
- [Accept additional user-defined syntax classes in fenced code blocks](https://github.com/rust-lang/rust/pull/110800/)
|
||||
- [rustdoc-search: add support for type parameters](https://github.com/rust-lang/rust/pull/112725/)
|
||||
- [rustdoc: show inner enum and struct in type definition for concrete type](https://github.com/rust-lang/rust/pull/114855/)
|
||||
|
||||
<a id="1.74.0-Compatibility-Notes"></a>
|
||||
|
||||
Compatibility Notes
|
||||
-------------------
|
||||
|
||||
- [Raise minimum supported Apple OS versions](https://github.com/rust-lang/rust/pull/104385/)
|
||||
- [make Cell::swap panic if the Cells partially overlap](https://github.com/rust-lang/rust/pull/114795/)
|
||||
- [Reject invalid crate names in `--extern`](https://github.com/rust-lang/rust/pull/116001/)
|
||||
- [Don't resolve generic impls that may be shadowed by dyn built-in impls](https://github.com/rust-lang/rust/pull/114941/)
|
||||
|
||||
<a id="1.74.0-Internal-Changes"></a>
|
||||
|
||||
Internal Changes
|
||||
----------------
|
||||
|
||||
These changes do not affect any public interfaces of Rust, but they represent
|
||||
significant improvements to the performance or internals of rustc and related
|
||||
tools.
|
||||
|
||||
None this cycle.
|
||||
|
||||
Version 1.73.0 (2023-10-05)
|
||||
==========================
|
||||
|
||||
<a id="1.73.0-Language"></a>
|
||||
|
||||
Language
|
||||
--------
|
||||
|
||||
- [Uplift `clippy::fn_null_check` lint as `useless_ptr_null_checks`.](https://github.com/rust-lang/rust/pull/111717/)
|
||||
- [Make `noop_method_call` warn by default.](https://github.com/rust-lang/rust/pull/111916/)
|
||||
- [Support interpolated block for `try` and `async` in macros.](https://github.com/rust-lang/rust/pull/112953/)
|
||||
- [Make `unconditional_recursion` lint detect recursive drops.](https://github.com/rust-lang/rust/pull/113902/)
|
||||
- [Future compatibility warning for some impls being incorrectly considered not overlapping.](https://github.com/rust-lang/rust/pull/114023/)
|
||||
- [The `invalid_reference_casting` lint is now **deny-by-default** (instead of allow-by-default)](https://github.com/rust-lang/rust/pull/112431)
|
||||
|
||||
<a id="1.73.0-Compiler"></a>
|
||||
|
||||
Compiler
|
||||
--------
|
||||
|
||||
- [Write version information in a `.comment` section like GCC/Clang.](https://github.com/rust-lang/rust/pull/97550/)
|
||||
- [Add documentation on v0 symbol mangling.](https://github.com/rust-lang/rust/pull/97571/)
|
||||
- [Stabilize `extern "thiscall"` and `"thiscall-unwind"` ABIs.](https://github.com/rust-lang/rust/pull/114562/)
|
||||
- [Only check outlives goals on impl compared to trait.](https://github.com/rust-lang/rust/pull/109356/)
|
||||
- [Infer type in irrefutable slice patterns with fixed length as array.](https://github.com/rust-lang/rust/pull/113199/)
|
||||
- [Discard default auto trait impls if explicit ones exist.](https://github.com/rust-lang/rust/pull/113312/)
|
||||
- Add several new tier 3 targets:
|
||||
- [`aarch64-unknown-teeos`](https://github.com/rust-lang/rust/pull/113480/)
|
||||
- [`csky-unknown-linux-gnuabiv2`](https://github.com/rust-lang/rust/pull/113658/)
|
||||
- [`riscv64-linux-android`](https://github.com/rust-lang/rust/pull/112858/)
|
||||
- [`riscv64gc-unknown-hermit`](https://github.com/rust-lang/rust/pull/114004/)
|
||||
- [`x86_64-unikraft-linux-musl`](https://github.com/rust-lang/rust/pull/113411/)
|
||||
- [`x86_64-unknown-linux-ohos`](https://github.com/rust-lang/rust/pull/113061/)
|
||||
- [Add `wasm32-wasi-preview1-threads` as a tier 2 target.](https://github.com/rust-lang/rust/pull/112922/)
|
||||
|
||||
Refer to Rust's [platform support page][platform-support-doc]
|
||||
for more information on Rust's tiered platform support.
|
||||
|
||||
<a id="1.73.0-Libraries"></a>
|
||||
|
||||
Libraries
|
||||
---------
|
||||
|
||||
- [Add `Read`, `Write` and `Seek` impls for `Arc<File>`.](https://github.com/rust-lang/rust/pull/94748/)
|
||||
- [Merge functionality of `io::Sink` into `io::Empty`.](https://github.com/rust-lang/rust/pull/98154/)
|
||||
- [Implement `RefUnwindSafe` for `Backtrace`](https://github.com/rust-lang/rust/pull/100455/)
|
||||
- [Make `ExitStatus` implement `Default`](https://github.com/rust-lang/rust/pull/106425/)
|
||||
- [`impl SliceIndex<str> for (Bound<usize>, Bound<usize>)`](https://github.com/rust-lang/rust/pull/111081/)
|
||||
- [Change default panic handler message format.](https://github.com/rust-lang/rust/pull/112849/)
|
||||
- [Cleaner `assert_eq!` & `assert_ne!` panic messages.](https://github.com/rust-lang/rust/pull/111071/)
|
||||
- [Correct the (deprecated) Android `stat` struct definitions.](https://github.com/rust-lang/rust/pull/113130/)
|
||||
|
||||
<a id="1.73.0-Stabilized-APIs"></a>
|
||||
|
||||
Stabilized APIs
|
||||
---------------
|
||||
|
||||
- [Unsigned `{integer}::div_ceil`](https://doc.rust-lang.org/stable/std/primitive.u32.html#method.div_ceil)
|
||||
- [Unsigned `{integer}::next_multiple_of`](https://doc.rust-lang.org/stable/std/primitive.u32.html#method.next_multiple_of)
|
||||
- [Unsigned `{integer}::checked_next_multiple_of`](https://doc.rust-lang.org/stable/std/primitive.u32.html#method.checked_next_multiple_of)
|
||||
- [`std::ffi::FromBytesUntilNulError`](https://doc.rust-lang.org/stable/std/ffi/struct.FromBytesUntilNulError.html)
|
||||
- [`std::os::unix::fs::chown`](https://doc.rust-lang.org/stable/std/os/unix/fs/fn.chown.html)
|
||||
- [`std::os::unix::fs::fchown`](https://doc.rust-lang.org/stable/std/os/unix/fs/fn.fchown.html)
|
||||
- [`std::os::unix::fs::lchown`](https://doc.rust-lang.org/stable/std/os/unix/fs/fn.lchown.html)
|
||||
- [`LocalKey::<Cell<T>>::get`](https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.get)
|
||||
- [`LocalKey::<Cell<T>>::set`](https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.set)
|
||||
- [`LocalKey::<Cell<T>>::take`](https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.take)
|
||||
- [`LocalKey::<Cell<T>>::replace`](https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.replace)
|
||||
- [`LocalKey::<RefCell<T>>::with_borrow`](https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.with_borrow)
|
||||
- [`LocalKey::<RefCell<T>>::with_borrow_mut`](https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.with_borrow_mut)
|
||||
- [`LocalKey::<RefCell<T>>::set`](https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.set-1)
|
||||
- [`LocalKey::<RefCell<T>>::take`](https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.take-1)
|
||||
- [`LocalKey::<RefCell<T>>::replace`](https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.replace-1)
|
||||
|
||||
These APIs are now stable in const contexts:
|
||||
|
||||
- [`rc::Weak::new`](https://doc.rust-lang.org/stable/alloc/rc/struct.Weak.html#method.new)
|
||||
- [`sync::Weak::new`](https://doc.rust-lang.org/stable/alloc/sync/struct.Weak.html#method.new)
|
||||
- [`NonNull::as_ref`](https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.as_ref)
|
||||
|
||||
<a id="1.73.0-Cargo"></a>
|
||||
|
||||
Cargo
|
||||
-----
|
||||
|
||||
- [Encode URL params correctly for `SourceId` in `Cargo.lock`.](https://github.com/rust-lang/cargo/pull/12280/)
|
||||
- [Bail out an error when using `cargo::` in custom build script.](https://github.com/rust-lang/cargo/pull/12332/)
|
||||
|
||||
<a id="1.73.0-Misc"></a>
|
||||
|
||||
Misc
|
||||
----
|
||||
|
||||
<a id="1.73.0-Compatibility-Notes"></a>
|
||||
|
||||
Compatibility Notes
|
||||
-------------------
|
||||
|
||||
- [Update the minimum external LLVM to 15.](https://github.com/rust-lang/rust/pull/114148/)
|
||||
- [Check for non-defining uses of return position `impl Trait`.](https://github.com/rust-lang/rust/pull/112842/)
|
||||
|
||||
<a id="1.73.0-Internal-Changes"></a>
|
||||
|
||||
Internal Changes
|
||||
----------------
|
||||
|
||||
These changes do not affect any public interfaces of Rust, but they represent
|
||||
significant improvements to the performance or internals of rustc and related
|
||||
tools.
|
||||
|
||||
- [Remove LLVM pointee types, supporting only opaque pointers.](https://github.com/rust-lang/rust/pull/105545/)
|
||||
- [Port PGO/LTO/BOLT optimized build pipeline to Rust.](https://github.com/rust-lang/rust/pull/112235/)
|
||||
- [Replace in-tree `rustc_apfloat` with the new version of the crate.](https://github.com/rust-lang/rust/pull/113843/)
|
||||
- [Update to LLVM 17.](https://github.com/rust-lang/rust/pull/114048/)
|
||||
- [Add `internal_features` lint for internal unstable features.](https://github.com/rust-lang/rust/pull/108955/)
|
||||
- [Mention style for new syntax in tracking issue template.](https://github.com/rust-lang/rust/pull/113586/)
|
||||
|
||||
Version 1.72.1 (2023-09-19)
|
||||
===========================
|
||||
|
||||
@@ -112,6 +344,7 @@ Compatibility Notes
|
||||
this should only impact users of other registries, or people who don't publish
|
||||
to a registry.
|
||||
[#12291](https://github.com/rust-lang/cargo/pull/12291)
|
||||
- [Demoted `mips*-unknown-linux-gnu*` targets from host tier 2 to target tier 3 support.](https://github.com/rust-lang/rust/pull/113274)
|
||||
|
||||
Version 1.71.1 (2023-08-03)
|
||||
===========================
|
||||
|
||||
@@ -427,6 +427,12 @@ impl<'a, 'tcx> CoverageSpans<'a, 'tcx> {
|
||||
let merged_prefix_len = self.curr_original_span.lo() - self.curr().span.lo();
|
||||
let after_macro_bang =
|
||||
merged_prefix_len + BytePos(visible_macro.as_str().len() as u32 + 1);
|
||||
if self.curr().span.lo() + after_macro_bang > self.curr().span.hi() {
|
||||
// Something is wrong with the macro name span;
|
||||
// return now to avoid emitting malformed mappings.
|
||||
// FIXME(#117788): Track down why this happens.
|
||||
return;
|
||||
}
|
||||
let mut macro_name_cov = self.curr().clone();
|
||||
self.curr_mut().span =
|
||||
self.curr().span.with_lo(self.curr().span.lo() + after_macro_bang);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
use super::{BorrowedBuf, BufReader, BufWriter, Read, Result, Write, DEFAULT_BUF_SIZE};
|
||||
use crate::alloc::Allocator;
|
||||
use crate::cmp;
|
||||
use crate::collections::VecDeque;
|
||||
use crate::io::IoSlice;
|
||||
use crate::mem::MaybeUninit;
|
||||
@@ -255,47 +254,6 @@ impl<I: Write + ?Sized> BufferedWriterSpec for BufWriter<I> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<A: Allocator> BufferedWriterSpec for Vec<u8, A> {
|
||||
fn buffer_size(&self) -> usize {
|
||||
cmp::max(DEFAULT_BUF_SIZE, self.capacity() - self.len())
|
||||
}
|
||||
|
||||
fn copy_from<R: Read + ?Sized>(&mut self, reader: &mut R) -> Result<u64> {
|
||||
let mut bytes = 0;
|
||||
|
||||
// avoid allocating before we have determined that there's anything to read
|
||||
if self.capacity() == 0 {
|
||||
bytes = stack_buffer_copy(&mut reader.take(DEFAULT_BUF_SIZE as u64), self)?;
|
||||
if bytes == 0 {
|
||||
return Ok(0);
|
||||
}
|
||||
}
|
||||
|
||||
loop {
|
||||
self.reserve(DEFAULT_BUF_SIZE);
|
||||
let mut buf: BorrowedBuf<'_> = self.spare_capacity_mut().into();
|
||||
match reader.read_buf(buf.unfilled()) {
|
||||
Ok(()) => {}
|
||||
Err(e) if e.is_interrupted() => continue,
|
||||
Err(e) => return Err(e),
|
||||
};
|
||||
|
||||
let read = buf.filled().len();
|
||||
if read == 0 {
|
||||
break;
|
||||
}
|
||||
|
||||
// SAFETY: BorrowedBuf guarantees all of its filled bytes are init
|
||||
// and the number of read bytes can't exceed the spare capacity since
|
||||
// that's what the buffer is borrowing from.
|
||||
unsafe { self.set_len(self.len() + read) };
|
||||
bytes += read as u64;
|
||||
}
|
||||
|
||||
Ok(bytes)
|
||||
}
|
||||
}
|
||||
|
||||
fn stack_buffer_copy<R: Read + ?Sized, W: Write + ?Sized>(
|
||||
reader: &mut R,
|
||||
writer: &mut W,
|
||||
|
||||
@@ -80,18 +80,6 @@ fn copy_specializes_bufreader() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn copy_specializes_to_vec() {
|
||||
let cap = 123456;
|
||||
let mut source = ShortReader { cap, observed_buffer: 0, read_size: 1337 };
|
||||
let mut sink = Vec::new();
|
||||
assert_eq!(cap as u64, io::copy(&mut source, &mut sink).unwrap());
|
||||
assert!(
|
||||
source.observed_buffer > DEFAULT_BUF_SIZE,
|
||||
"expected a large buffer to be provided to the reader"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn copy_specializes_from_vecdeque() {
|
||||
let mut source = VecDeque::with_capacity(100 * 1024);
|
||||
|
||||
@@ -1 +1 @@
|
||||
beta
|
||||
stable
|
||||
|
||||
10
tests/run-coverage/auxiliary/macro_name_span_helper.rs
Normal file
10
tests/run-coverage/auxiliary/macro_name_span_helper.rs
Normal file
@@ -0,0 +1,10 @@
|
||||
// edition: 2021
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! macro_that_defines_a_function {
|
||||
(fn $name:ident () $body:tt) => {
|
||||
fn $name () -> () $body
|
||||
}
|
||||
}
|
||||
|
||||
// Non-executable comment.
|
||||
39
tests/run-coverage/macro_name_span.coverage
Normal file
39
tests/run-coverage/macro_name_span.coverage
Normal file
@@ -0,0 +1,39 @@
|
||||
$DIR/auxiliary/macro_name_span_helper.rs:
|
||||
LL| |// edition: 2021
|
||||
LL| |
|
||||
LL| |#[macro_export]
|
||||
LL| |macro_rules! macro_that_defines_a_function {
|
||||
LL| | (fn $name:ident () $body:tt) => {
|
||||
LL| 1| fn $name () -> () $body
|
||||
LL| | }
|
||||
LL| |}
|
||||
LL| |
|
||||
LL| |// Non-executable comment.
|
||||
|
||||
$DIR/macro_name_span.rs:
|
||||
LL| |// edition: 2021
|
||||
LL| |
|
||||
LL| |// Regression test for <https://github.com/rust-lang/rust/issues/117788>.
|
||||
LL| |// Under some circumstances, the heuristics that detect macro name spans can
|
||||
LL| |// get confused and produce incorrect spans beyond the bounds of the span
|
||||
LL| |// being processed.
|
||||
LL| |
|
||||
LL| |// aux-build: macro_name_span_helper.rs
|
||||
LL| |extern crate macro_name_span_helper;
|
||||
LL| |
|
||||
LL| 1|fn main() {
|
||||
LL| 1| affected_function();
|
||||
LL| 1|}
|
||||
LL| |
|
||||
LL| |macro_rules! macro_with_an_unreasonably_and_egregiously_long_name {
|
||||
LL| | () => {
|
||||
LL| | println!("hello");
|
||||
LL| | };
|
||||
LL| |}
|
||||
LL| |
|
||||
LL| |macro_name_span_helper::macro_that_defines_a_function! {
|
||||
LL| | fn affected_function() {
|
||||
LL| | macro_with_an_unreasonably_and_egregiously_long_name!();
|
||||
LL| | }
|
||||
LL| |}
|
||||
|
||||
25
tests/run-coverage/macro_name_span.rs
Normal file
25
tests/run-coverage/macro_name_span.rs
Normal file
@@ -0,0 +1,25 @@
|
||||
// edition: 2021
|
||||
|
||||
// Regression test for <https://github.com/rust-lang/rust/issues/117788>.
|
||||
// Under some circumstances, the heuristics that detect macro name spans can
|
||||
// get confused and produce incorrect spans beyond the bounds of the span
|
||||
// being processed.
|
||||
|
||||
// aux-build: macro_name_span_helper.rs
|
||||
extern crate macro_name_span_helper;
|
||||
|
||||
fn main() {
|
||||
affected_function();
|
||||
}
|
||||
|
||||
macro_rules! macro_with_an_unreasonably_and_egregiously_long_name {
|
||||
() => {
|
||||
println!("hello");
|
||||
};
|
||||
}
|
||||
|
||||
macro_name_span_helper::macro_that_defines_a_function! {
|
||||
fn affected_function() {
|
||||
macro_with_an_unreasonably_and_egregiously_long_name!();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user