.sess
.span_diagnostic
.struct_span_err(span, &format!("the `{}` option was already provided", symbol));
- err.span_suggestion(span, "remove this option", String::new(), Applicability::Unspecified);
+ err.span_suggestion(
+ span,
+ "remove this option",
+ String::new(),
+ Applicability::MachineApplicable,
+ );
err.emit();
}
if !args.options.contains(option) {
args.options |= option;
} else {
- err_duplicate_option(p, symbol, p.prev_token.span);
+ let mut span = p.prev_token.span;
+ if p.look_ahead(0, |t| t == &token::Comma) {
+ span = span.to(p.token.span);
+ }
+ err_duplicate_option(p, symbol, span);
}
}
--- /dev/null
+// only-x86_64
+// run-rustfix
+
+#![feature(asm)]
+
+fn main() {
+ unsafe {
+ asm!("", options(nomem, ));
+ //~^ ERROR the `nomem` option was already provided
+ asm!("", options(att_syntax, ));
+ //~^ ERROR the `att_syntax` option was already provided
+ asm!("", options(nostack, att_syntax), options());
+ //~^ ERROR the `nostack` option was already provided
+ asm!("", options(nostack, ), options(), options());
+ //~^ ERROR the `nostack` option was already provided
+ //~| ERROR the `nostack` option was already provided
+ //~| ERROR the `nostack` option was already provided
+ asm!(
+ "",
+ options(nomem, noreturn),
+ options(att_syntax, ), //~ ERROR the `noreturn` option was already provided
+ options( nostack), //~ ERROR the `nomem` option was already provided
+ options(), //~ ERROR the `noreturn` option was already provided
+ );
+ }
+}
error: the `nomem` option was already provided
- --> $DIR/duplicate-options.rs:7:33
+ --> $DIR/duplicate-options.rs:8:33
|
LL | asm!("", options(nomem, nomem));
| ^^^^^ help: remove this option
error: the `att_syntax` option was already provided
- --> $DIR/duplicate-options.rs:9:38
+ --> $DIR/duplicate-options.rs:10:38
|
LL | asm!("", options(att_syntax, att_syntax));
| ^^^^^^^^^^ help: remove this option
error: the `nostack` option was already provided
- --> $DIR/duplicate-options.rs:11:56
+ --> $DIR/duplicate-options.rs:12:56
|
LL | asm!("", options(nostack, att_syntax), options(nostack));
| ^^^^^^^ help: remove this option
error: the `nostack` option was already provided
- --> $DIR/duplicate-options.rs:13:35
+ --> $DIR/duplicate-options.rs:14:35
|
LL | asm!("", options(nostack, nostack), options(nostack), options(nostack));
| ^^^^^^^ help: remove this option
error: the `nostack` option was already provided
- --> $DIR/duplicate-options.rs:13:53
+ --> $DIR/duplicate-options.rs:14:53
|
LL | asm!("", options(nostack, nostack), options(nostack), options(nostack));
| ^^^^^^^ help: remove this option
error: the `nostack` option was already provided
- --> $DIR/duplicate-options.rs:13:71
+ --> $DIR/duplicate-options.rs:14:71
|
LL | asm!("", options(nostack, nostack), options(nostack), options(nostack));
| ^^^^^^^ help: remove this option
error: the `noreturn` option was already provided
- --> $DIR/duplicate-options.rs:20:33
+ --> $DIR/duplicate-options.rs:21:33
|
LL | options(att_syntax, noreturn),
| ^^^^^^^^ help: remove this option
error: the `nomem` option was already provided
- --> $DIR/duplicate-options.rs:21:21
+ --> $DIR/duplicate-options.rs:22:21
|
LL | options(nomem, nostack),
- | ^^^^^ help: remove this option
+ | ^^^^^^ help: remove this option
error: the `noreturn` option was already provided
- --> $DIR/duplicate-options.rs:22:21
+ --> $DIR/duplicate-options.rs:23:21
|
LL | options(noreturn),
| ^^^^^^^^ help: remove this option