mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-17 09:23:05 +00:00
Fix from rebase
I changed the test functions to be `pub` rather than called from a `main` function too, for easier future modification of tests.
This commit is contained in:
parent
86220d6e51
commit
4943688e9d
@ -17,7 +17,7 @@ use rustc_ast::{
|
||||
};
|
||||
use rustc_ast_pretty::pprust;
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_errors::{pluralize, struct_span_err, Diagnostic, ErrorGuaranteed};
|
||||
use rustc_errors::{pluralize, struct_span_err, Diagnostic, EmissionGuarantee, ErrorGuaranteed};
|
||||
use rustc_errors::{Applicability, DiagnosticBuilder, Handler, PResult};
|
||||
use rustc_span::source_map::Spanned;
|
||||
use rustc_span::symbol::{kw, Ident};
|
||||
@ -225,13 +225,13 @@ struct MultiSugg {
|
||||
}
|
||||
|
||||
impl MultiSugg {
|
||||
fn emit(self, err: &mut DiagnosticBuilder<'_>) {
|
||||
fn emit<G: EmissionGuarantee>(self, err: &mut DiagnosticBuilder<'_, G>) {
|
||||
err.multipart_suggestion(&self.msg, self.patches, self.applicability);
|
||||
}
|
||||
|
||||
/// Overrides individual messages and applicabilities.
|
||||
fn emit_many(
|
||||
err: &mut DiagnosticBuilder<'_>,
|
||||
fn emit_many<G: EmissionGuarantee>(
|
||||
err: &mut DiagnosticBuilder<'_, G>,
|
||||
msg: &str,
|
||||
applicability: Applicability,
|
||||
suggestions: impl Iterator<Item = Self>,
|
||||
@ -1289,7 +1289,7 @@ impl<'a> Parser<'a> {
|
||||
);
|
||||
err.span_label(op_span, &format!("not a valid {} operator", kind.fixity));
|
||||
|
||||
let help_base_case = |mut err: DiagnosticBuilder<'_>, base| {
|
||||
let help_base_case = |mut err: DiagnosticBuilder<'_, _>, base| {
|
||||
err.help(&format!("use `{}= 1` instead", kind.op.chr()));
|
||||
err.emit();
|
||||
Ok(base)
|
||||
|
@ -1,12 +1,12 @@
|
||||
// run-rustfix
|
||||
|
||||
fn pre_regular() {
|
||||
pub fn pre_regular() {
|
||||
let mut i = 0;
|
||||
i += 1; //~ ERROR Rust has no prefix increment operator
|
||||
println!("{}", i);
|
||||
}
|
||||
|
||||
fn pre_while() {
|
||||
pub fn pre_while() {
|
||||
let mut i = 0;
|
||||
while { i += 1; i } < 5 {
|
||||
//~^ ERROR Rust has no prefix increment operator
|
||||
@ -14,13 +14,13 @@ fn pre_while() {
|
||||
}
|
||||
}
|
||||
|
||||
fn pre_regular_tmp() {
|
||||
pub fn pre_regular_tmp() {
|
||||
let mut tmp = 0;
|
||||
tmp += 1; //~ ERROR Rust has no prefix increment operator
|
||||
println!("{}", tmp);
|
||||
}
|
||||
|
||||
fn pre_while_tmp() {
|
||||
pub fn pre_while_tmp() {
|
||||
let mut tmp = 0;
|
||||
while { tmp += 1; tmp } < 5 {
|
||||
//~^ ERROR Rust has no prefix increment operator
|
||||
|
@ -1,12 +1,12 @@
|
||||
// run-rustfix
|
||||
|
||||
fn pre_regular() {
|
||||
pub fn pre_regular() {
|
||||
let mut i = 0;
|
||||
++i; //~ ERROR Rust has no prefix increment operator
|
||||
println!("{}", i);
|
||||
}
|
||||
|
||||
fn pre_while() {
|
||||
pub fn pre_while() {
|
||||
let mut i = 0;
|
||||
while ++i < 5 {
|
||||
//~^ ERROR Rust has no prefix increment operator
|
||||
@ -14,13 +14,13 @@ fn pre_while() {
|
||||
}
|
||||
}
|
||||
|
||||
fn pre_regular_tmp() {
|
||||
pub fn pre_regular_tmp() {
|
||||
let mut tmp = 0;
|
||||
++tmp; //~ ERROR Rust has no prefix increment operator
|
||||
println!("{}", tmp);
|
||||
}
|
||||
|
||||
fn pre_while_tmp() {
|
||||
pub fn pre_while_tmp() {
|
||||
let mut tmp = 0;
|
||||
while ++tmp < 5 {
|
||||
//~^ ERROR Rust has no prefix increment operator
|
||||
|
@ -14,7 +14,9 @@ error: Rust has no prefix increment operator
|
||||
--> $DIR/increment-autofix.rs:11:11
|
||||
|
|
||||
LL | while ++i < 5 {
|
||||
| ^^ not a valid prefix operator
|
||||
| ----- ^^ not a valid prefix operator
|
||||
| |
|
||||
| while parsing the condition of this `while` expression
|
||||
|
|
||||
help: use `+= 1` instead
|
||||
|
|
||||
@ -37,7 +39,9 @@ error: Rust has no prefix increment operator
|
||||
--> $DIR/increment-autofix.rs:25:11
|
||||
|
|
||||
LL | while ++tmp < 5 {
|
||||
| ^^ not a valid prefix operator
|
||||
| ----- ^^ not a valid prefix operator
|
||||
| |
|
||||
| while parsing the condition of this `while` expression
|
||||
|
|
||||
help: use `+= 1` instead
|
||||
|
|
||||
|
@ -6,13 +6,13 @@ struct Bar {
|
||||
qux: i32,
|
||||
}
|
||||
|
||||
fn post_regular() {
|
||||
pub fn post_regular() {
|
||||
let mut i = 0;
|
||||
i++; //~ ERROR Rust has no postfix increment operator
|
||||
println!("{}", i);
|
||||
}
|
||||
|
||||
fn post_while() {
|
||||
pub fn post_while() {
|
||||
let mut i = 0;
|
||||
while i++ < 5 {
|
||||
//~^ ERROR Rust has no postfix increment operator
|
||||
@ -20,13 +20,13 @@ fn post_while() {
|
||||
}
|
||||
}
|
||||
|
||||
fn post_regular_tmp() {
|
||||
pub fn post_regular_tmp() {
|
||||
let mut tmp = 0;
|
||||
tmp++; //~ ERROR Rust has no postfix increment operator
|
||||
println!("{}", tmp);
|
||||
}
|
||||
|
||||
fn post_while_tmp() {
|
||||
pub fn post_while_tmp() {
|
||||
let mut tmp = 0;
|
||||
while tmp++ < 5 {
|
||||
//~^ ERROR Rust has no postfix increment operator
|
||||
@ -34,14 +34,14 @@ fn post_while_tmp() {
|
||||
}
|
||||
}
|
||||
|
||||
fn post_field() {
|
||||
pub fn post_field() {
|
||||
let foo = Foo { bar: Bar { qux: 0 } };
|
||||
foo.bar.qux++;
|
||||
//~^ ERROR Rust has no postfix increment operator
|
||||
println!("{}", foo.bar.qux);
|
||||
}
|
||||
|
||||
fn post_field_tmp() {
|
||||
pub fn post_field_tmp() {
|
||||
struct S {
|
||||
tmp: i32
|
||||
}
|
||||
@ -51,7 +51,7 @@ fn post_field_tmp() {
|
||||
println!("{}", s.tmp);
|
||||
}
|
||||
|
||||
fn pre_field() {
|
||||
pub fn pre_field() {
|
||||
let foo = Foo { bar: Bar { qux: 0 } };
|
||||
++foo.bar.qux;
|
||||
//~^ ERROR Rust has no prefix increment operator
|
||||
|
@ -16,7 +16,9 @@ error: Rust has no postfix increment operator
|
||||
--> $DIR/increment-notfixed.rs:17:12
|
||||
|
|
||||
LL | while i++ < 5 {
|
||||
| ^^ not a valid postfix operator
|
||||
| ----- ^^ not a valid postfix operator
|
||||
| |
|
||||
| while parsing the condition of this `while` expression
|
||||
|
|
||||
help: use `+= 1` instead
|
||||
|
|
||||
@ -44,7 +46,9 @@ error: Rust has no postfix increment operator
|
||||
--> $DIR/increment-notfixed.rs:31:14
|
||||
|
|
||||
LL | while tmp++ < 5 {
|
||||
| ^^ not a valid postfix operator
|
||||
| ----- ^^ not a valid postfix operator
|
||||
| |
|
||||
| while parsing the condition of this `while` expression
|
||||
|
|
||||
help: use `+= 1` instead
|
||||
|
|
||||
|
Loading…
Reference in New Issue
Block a user