Skip to content

Commit

Permalink
Rollup merge of rust-lang#101253 - lyming2007:issue-101163, r=Amanieu
Browse files Browse the repository at this point in the history
fix the suggestion of format for asm_sub_register

	modified:   compiler/rustc_typeck/src/check/intrinsicck.rs
	modified:   src/test/ui/asm/bad-template.aarch64_mirunsafeck.stderr
	modified:   src/test/ui/asm/bad-template.aarch64_thirunsafeck.stderr
	modified:   src/test/ui/asm/bad-template.x86_64_mirunsafeck.stderr
	modified:   src/test/ui/asm/bad-template.x86_64_thirunsafeck.stderr
	modified:   src/test/ui/asm/type-check-1.rs
	modified:   src/test/ui/asm/type-check-1.stderr
	modified:   src/test/ui/asm/x86_64/type-check-3.stderr
  • Loading branch information
matthiaskrgr committed Sep 9, 2022
2 parents 6d20335 + 28c62d2 commit 0354eee
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 38 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_typeck/src/check/intrinsicck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,10 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
let mut err = lint.build(msg);
err.span_label(expr.span, "for this argument");
err.help(&format!(
"use the `{suggested_modifier}` modifier to have the register formatted as `{suggested_result}`",
"use `{{{idx}:{suggested_modifier}}}` to have the register formatted as `{suggested_result}`",
));
err.help(&format!(
"or use the `{default_modifier}` modifier to keep the default formatting of `{default_result}`",
"or use `{{{idx}:{default_modifier}}}` to keep the default formatting of `{default_result}`",
));
err.emit();
},
Expand Down
40 changes: 20 additions & 20 deletions src/test/ui/asm/aarch64/type-check-3.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,89 +5,89 @@ LL | asm!("{}", in(reg) 0u8);
| ^^ --- for this argument
|
= note: `#[warn(asm_sub_register)]` on by default
= help: use the `w` modifier to have the register formatted as `w0`
= help: or use the `x` modifier to keep the default formatting of `x0`
= help: use `{0:w}` to have the register formatted as `w0`
= help: or use `{0:x}` to keep the default formatting of `x0`

warning: formatting may not be suitable for sub-register argument
--> $DIR/type-check-3.rs:50:15
|
LL | asm!("{}", in(reg) 0u16);
| ^^ ---- for this argument
|
= help: use the `w` modifier to have the register formatted as `w0`
= help: or use the `x` modifier to keep the default formatting of `x0`
= help: use `{0:w}` to have the register formatted as `w0`
= help: or use `{0:x}` to keep the default formatting of `x0`

warning: formatting may not be suitable for sub-register argument
--> $DIR/type-check-3.rs:52:15
|
LL | asm!("{}", in(reg) 0i32);
| ^^ ---- for this argument
|
= help: use the `w` modifier to have the register formatted as `w0`
= help: or use the `x` modifier to keep the default formatting of `x0`
= help: use `{0:w}` to have the register formatted as `w0`
= help: or use `{0:x}` to keep the default formatting of `x0`

warning: formatting may not be suitable for sub-register argument
--> $DIR/type-check-3.rs:54:15
|
LL | asm!("{}", in(reg) 0f32);
| ^^ ---- for this argument
|
= help: use the `w` modifier to have the register formatted as `w0`
= help: or use the `x` modifier to keep the default formatting of `x0`
= help: use `{0:w}` to have the register formatted as `w0`
= help: or use `{0:x}` to keep the default formatting of `x0`

warning: formatting may not be suitable for sub-register argument
--> $DIR/type-check-3.rs:57:15
|
LL | asm!("{}", in(vreg) 0i16);
| ^^ ---- for this argument
|
= help: use the `h` modifier to have the register formatted as `h0`
= help: or use the `v` modifier to keep the default formatting of `v0`
= help: use `{0:h}` to have the register formatted as `h0`
= help: or use `{0:v}` to keep the default formatting of `v0`

warning: formatting may not be suitable for sub-register argument
--> $DIR/type-check-3.rs:59:15
|
LL | asm!("{}", in(vreg) 0f32);
| ^^ ---- for this argument
|
= help: use the `s` modifier to have the register formatted as `s0`
= help: or use the `v` modifier to keep the default formatting of `v0`
= help: use `{0:s}` to have the register formatted as `s0`
= help: or use `{0:v}` to keep the default formatting of `v0`

warning: formatting may not be suitable for sub-register argument
--> $DIR/type-check-3.rs:61:15
|
LL | asm!("{}", in(vreg) 0f64);
| ^^ ---- for this argument
|
= help: use the `d` modifier to have the register formatted as `d0`
= help: or use the `v` modifier to keep the default formatting of `v0`
= help: use `{0:d}` to have the register formatted as `d0`
= help: or use `{0:v}` to keep the default formatting of `v0`

warning: formatting may not be suitable for sub-register argument
--> $DIR/type-check-3.rs:63:15
|
LL | asm!("{}", in(vreg_low16) 0f64);
| ^^ ---- for this argument
|
= help: use the `d` modifier to have the register formatted as `d0`
= help: or use the `v` modifier to keep the default formatting of `v0`
= help: use `{0:d}` to have the register formatted as `d0`
= help: or use `{0:v}` to keep the default formatting of `v0`

warning: formatting may not be suitable for sub-register argument
--> $DIR/type-check-3.rs:66:15
|
LL | asm!("{0} {0}", in(reg) 0i16);
| ^^^ ^^^ ---- for this argument
|
= help: use the `w` modifier to have the register formatted as `w0`
= help: or use the `x` modifier to keep the default formatting of `x0`
= help: use `{0:w}` to have the register formatted as `w0`
= help: or use `{0:x}` to keep the default formatting of `x0`

warning: formatting may not be suitable for sub-register argument
--> $DIR/type-check-3.rs:68:15
|
LL | asm!("{0} {0:x}", in(reg) 0i16);
| ^^^ ---- for this argument
|
= help: use the `w` modifier to have the register formatted as `w0`
= help: or use the `x` modifier to keep the default formatting of `x0`
= help: use `{0:w}` to have the register formatted as `w0`
= help: or use `{0:x}` to keep the default formatting of `x0`

error: type `i128` cannot be used with this register class
--> $DIR/type-check-3.rs:73:28
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/asm/bad-template.aarch64_mirunsafeck.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ LL | asm!("{:foo}", in(reg) foo);
| ^^^^^^ --- for this argument
|
= note: `#[warn(asm_sub_register)]` on by default
= help: use the `w` modifier to have the register formatted as `w0`
= help: or use the `x` modifier to keep the default formatting of `x0`
= help: use `{0:w}` to have the register formatted as `w0`
= help: or use `{0:x}` to keep the default formatting of `x0`

error: aborting due to 21 previous errors; 1 warning emitted

4 changes: 2 additions & 2 deletions src/test/ui/asm/bad-template.aarch64_thirunsafeck.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ LL | asm!("{:foo}", in(reg) foo);
| ^^^^^^ --- for this argument
|
= note: `#[warn(asm_sub_register)]` on by default
= help: use the `w` modifier to have the register formatted as `w0`
= help: or use the `x` modifier to keep the default formatting of `x0`
= help: use `{0:w}` to have the register formatted as `w0`
= help: or use `{0:x}` to keep the default formatting of `x0`

error: aborting due to 21 previous errors; 1 warning emitted

4 changes: 2 additions & 2 deletions src/test/ui/asm/bad-template.x86_64_mirunsafeck.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ LL | asm!("{:foo}", in(reg) foo);
| ^^^^^^ --- for this argument
|
= note: `#[warn(asm_sub_register)]` on by default
= help: use the `e` modifier to have the register formatted as `eax`
= help: or use the `r` modifier to keep the default formatting of `rax`
= help: use `{0:e}` to have the register formatted as `eax`
= help: or use `{0:r}` to keep the default formatting of `rax`

error: aborting due to 21 previous errors; 1 warning emitted

4 changes: 2 additions & 2 deletions src/test/ui/asm/bad-template.x86_64_thirunsafeck.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ LL | asm!("{:foo}", in(reg) foo);
| ^^^^^^ --- for this argument
|
= note: `#[warn(asm_sub_register)]` on by default
= help: use the `e` modifier to have the register formatted as `eax`
= help: or use the `r` modifier to keep the default formatting of `rax`
= help: use `{0:e}` to have the register formatted as `eax`
= help: or use `{0:r}` to keep the default formatting of `rax`

error: aborting due to 21 previous errors; 1 warning emitted

16 changes: 8 additions & 8 deletions src/test/ui/asm/x86_64/type-check-3.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -45,35 +45,35 @@ LL | asm!("{0} {0}", in(reg) 0i16);
| ^^^ ^^^ ---- for this argument
|
= note: `#[warn(asm_sub_register)]` on by default
= help: use the `x` modifier to have the register formatted as `ax`
= help: or use the `r` modifier to keep the default formatting of `rax`
= help: use `{0:x}` to have the register formatted as `ax`
= help: or use `{0:r}` to keep the default formatting of `rax`

warning: formatting may not be suitable for sub-register argument
--> $DIR/type-check-3.rs:36:15
|
LL | asm!("{0} {0:x}", in(reg) 0i16);
| ^^^ ---- for this argument
|
= help: use the `x` modifier to have the register formatted as `ax`
= help: or use the `r` modifier to keep the default formatting of `rax`
= help: use `{0:x}` to have the register formatted as `ax`
= help: or use `{0:r}` to keep the default formatting of `rax`

warning: formatting may not be suitable for sub-register argument
--> $DIR/type-check-3.rs:38:15
|
LL | asm!("{}", in(reg) 0i32);
| ^^ ---- for this argument
|
= help: use the `e` modifier to have the register formatted as `eax`
= help: or use the `r` modifier to keep the default formatting of `rax`
= help: use `{0:e}` to have the register formatted as `eax`
= help: or use `{0:r}` to keep the default formatting of `rax`

warning: formatting may not be suitable for sub-register argument
--> $DIR/type-check-3.rs:41:15
|
LL | asm!("{}", in(ymm_reg) 0i64);
| ^^ ---- for this argument
|
= help: use the `x` modifier to have the register formatted as `xmm0`
= help: or use the `y` modifier to keep the default formatting of `ymm0`
= help: use `{0:x}` to have the register formatted as `xmm0`
= help: or use `{0:y}` to keep the default formatting of `ymm0`

error: type `i8` cannot be used with this register class
--> $DIR/type-check-3.rs:52:28
Expand Down

0 comments on commit 0354eee

Please sign in to comment.