Auto merge of #15052 - lnicola:fmt-arguments, r=Veykril

minor: Rename minicore ArgumentV1 to match libcore
This commit is contained in:
bors 2023-06-14 12:13:58 +00:00
commit 51939db8d3
2 changed files with 12 additions and 15 deletions

View File

@ -474,7 +474,7 @@ fn main() {
file_id: FileId(
1,
),
range: 9333..9341,
range: 9286..9294,
},
),
tooltip: "",
@ -487,7 +487,7 @@ fn main() {
file_id: FileId(
1,
),
range: 9365..9369,
range: 9318..9322,
},
),
tooltip: "",
@ -511,7 +511,7 @@ fn main() {
file_id: FileId(
1,
),
range: 9333..9341,
range: 9286..9294,
},
),
tooltip: "",
@ -524,7 +524,7 @@ fn main() {
file_id: FileId(
1,
),
range: 9365..9369,
range: 9318..9322,
},
),
tooltip: "",
@ -548,7 +548,7 @@ fn main() {
file_id: FileId(
1,
),
range: 9333..9341,
range: 9286..9294,
},
),
tooltip: "",
@ -561,7 +561,7 @@ fn main() {
file_id: FileId(
1,
),
range: 9365..9369,
range: 9318..9322,
},
),
tooltip: "",

View File

@ -867,29 +867,26 @@ pub trait Display {
}
#[lang = "format_argument"]
pub struct ArgumentV1<'a> {
pub struct Argument<'a> {
value: &'a Opaque,
formatter: fn(&Opaque, &mut Formatter<'_>) -> Result,
}
impl<'a> ArgumentV1<'a> {
pub fn new<'b, T>(x: &'b T, f: fn(&T, &mut Formatter<'_>) -> Result) -> ArgumentV1<'b> {
impl<'a> Argument<'a> {
pub fn new<'b, T>(x: &'b T, f: fn(&T, &mut Formatter<'_>) -> Result) -> Argument<'b> {
use crate::mem::transmute;
unsafe { ArgumentV1 { formatter: transmute(f), value: transmute(x) } }
unsafe { Argument { formatter: transmute(f), value: transmute(x) } }
}
}
#[lang = "format_arguments"]
pub struct Arguments<'a> {
pieces: &'a [&'static str],
args: &'a [ArgumentV1<'a>],
args: &'a [Argument<'a>],
}
impl<'a> Arguments<'a> {
pub const fn new_v1(
pieces: &'a [&'static str],
args: &'a [ArgumentV1<'a>],
) -> Arguments<'a> {
pub const fn new_v1(pieces: &'a [&'static str], args: &'a [Argument<'a>]) -> Arguments<'a> {
Arguments { pieces, args }
}
}