diff options
| author | bors <bors@rust-lang.org> | 2021-08-22 20:23:37 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-08-22 20:23:37 +0000 |
| commit | af140757b4cb1a60d107c690720311ba8e06e7de (patch) | |
| tree | 061b9cd2842ef1ef966322cff231d92fac26e3c3 /src | |
| parent | 91f9806208834de3fb5f62712356b0d84ec388fd (diff) | |
| parent | 3e8e8d2dad6181f58e78c14b9dd19c267ad602c0 (diff) | |
| download | rust-af140757b4cb1a60d107c690720311ba8e06e7de.tar.gz rust-af140757b4cb1a60d107c690720311ba8e06e7de.zip | |
Auto merge of #88240 - GuillaumeGomez:rollup-wdom91m, r=GuillaumeGomez
Rollup of 7 pull requests Successful merges: - #86747 (Improve wording of the `drop_bounds` lint) - #87166 (Show discriminant before overflow in diagnostic for duplicate values.) - #88077 (Generate an iOS LLVM target with a specific version) - #88164 (PassWrapper: adapt for LLVM 14 changes) - #88211 (cleanup: `Span::new` -> `Span::with_lo`) - #88229 (Suggest importing the right kind of macro.) - #88238 (Stop tracking namespace in used_imports.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/drop-bounds/drop-bounds.stderr | 14 | ||||
| -rw-r--r-- | src/test/ui/enum/enum-discrim-autosizing.rs | 6 | ||||
| -rw-r--r-- | src/test/ui/enum/enum-discrim-autosizing.stderr | 2 | ||||
| -rw-r--r-- | src/test/ui/error-codes/E0081.rs | 11 | ||||
| -rw-r--r-- | src/test/ui/error-codes/E0081.stderr | 14 | ||||
| -rw-r--r-- | src/test/ui/macros/issue-88228.rs | 22 | ||||
| -rw-r--r-- | src/test/ui/macros/issue-88228.stderr | 26 | ||||
| -rw-r--r-- | src/test/ui/proc-macro/derive-helper-shadowing.stderr | 4 | ||||
| -rw-r--r-- | src/tools/clippy/clippy_lints/src/unit_return_expecting_ord.rs | 2 | ||||
| -rw-r--r-- | src/tools/clippy/clippy_lints/src/write.rs | 2 | ||||
| -rw-r--r-- | src/tools/clippy/clippy_utils/src/lib.rs | 2 |
11 files changed, 90 insertions, 15 deletions
diff --git a/src/test/ui/drop-bounds/drop-bounds.stderr b/src/test/ui/drop-bounds/drop-bounds.stderr index 15ba4c9a649..3ffb855a55d 100644 --- a/src/test/ui/drop-bounds/drop-bounds.stderr +++ b/src/test/ui/drop-bounds/drop-bounds.stderr @@ -1,4 +1,4 @@ -error: bounds on `T: Drop` are useless, consider instead using `std::mem::needs_drop` to detect if a type has a destructor +error: bounds on `T: Drop` are most likely incorrect, consider instead using `std::mem::needs_drop` to detect whether a type can be trivially dropped --> $DIR/drop-bounds.rs:2:11 | LL | fn foo<T: Drop>() {} @@ -10,37 +10,37 @@ note: the lint level is defined here LL | #![deny(drop_bounds)] | ^^^^^^^^^^^ -error: bounds on `U: Drop` are useless, consider instead using `std::mem::needs_drop` to detect if a type has a destructor +error: bounds on `U: Drop` are most likely incorrect, consider instead using `std::mem::needs_drop` to detect whether a type can be trivially dropped --> $DIR/drop-bounds.rs:5:8 | LL | U: Drop, | ^^^^ -error: bounds on `impl Drop: Drop` are useless, consider instead using `std::mem::needs_drop` to detect if a type has a destructor +error: bounds on `impl Drop: Drop` are most likely incorrect, consider instead using `std::mem::needs_drop` to detect whether a type can be trivially dropped --> $DIR/drop-bounds.rs:8:17 | LL | fn baz(_x: impl Drop) {} | ^^^^ -error: bounds on `T: Drop` are useless, consider instead using `std::mem::needs_drop` to detect if a type has a destructor +error: bounds on `T: Drop` are most likely incorrect, consider instead using `std::mem::needs_drop` to detect whether a type can be trivially dropped --> $DIR/drop-bounds.rs:9:15 | LL | struct Foo<T: Drop> { | ^^^^ -error: bounds on `U: Drop` are useless, consider instead using `std::mem::needs_drop` to detect if a type has a destructor +error: bounds on `U: Drop` are most likely incorrect, consider instead using `std::mem::needs_drop` to detect whether a type can be trivially dropped --> $DIR/drop-bounds.rs:12:24 | LL | struct Bar<U> where U: Drop { | ^^^^ -error: bounds on `Self: Drop` are useless, consider instead using `std::mem::needs_drop` to detect if a type has a destructor +error: bounds on `Self: Drop` are most likely incorrect, consider instead using `std::mem::needs_drop` to detect whether a type can be trivially dropped --> $DIR/drop-bounds.rs:15:12 | LL | trait Baz: Drop { | ^^^^ -error: bounds on `T: Drop` are useless, consider instead using `std::mem::needs_drop` to detect if a type has a destructor +error: bounds on `T: Drop` are most likely incorrect, consider instead using `std::mem::needs_drop` to detect whether a type can be trivially dropped --> $DIR/drop-bounds.rs:17:9 | LL | impl<T: Drop> Baz for T { diff --git a/src/test/ui/enum/enum-discrim-autosizing.rs b/src/test/ui/enum/enum-discrim-autosizing.rs index e9bb9275971..473a0ad6f7a 100644 --- a/src/test/ui/enum/enum-discrim-autosizing.rs +++ b/src/test/ui/enum/enum-discrim-autosizing.rs @@ -4,8 +4,10 @@ // so force the repr. #[cfg_attr(not(target_pointer_width = "32"), repr(i32))] enum Eu64 { - Au64 = 0, - Bu64 = 0x8000_0000_0000_0000 //~ERROR already exists + Au64 = 0, //~NOTE first use of `0` + Bu64 = 0x8000_0000_0000_0000 + //~^ ERROR discriminant value `0` already exists + //~| NOTE enum already has `0` (overflowed from `9223372036854775808`) } fn main() {} diff --git a/src/test/ui/enum/enum-discrim-autosizing.stderr b/src/test/ui/enum/enum-discrim-autosizing.stderr index 8848f984cfb..a0f39098a2e 100644 --- a/src/test/ui/enum/enum-discrim-autosizing.stderr +++ b/src/test/ui/enum/enum-discrim-autosizing.stderr @@ -4,7 +4,7 @@ error[E0081]: discriminant value `0` already exists LL | Au64 = 0, | - first use of `0` LL | Bu64 = 0x8000_0000_0000_0000 - | ^^^^^^^^^^^^^^^^^^^^^ enum already has `0` + | ^^^^^^^^^^^^^^^^^^^^^ enum already has `0` (overflowed from `9223372036854775808`) error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0081.rs b/src/test/ui/error-codes/E0081.rs index 33c8c14306b..255e05ced19 100644 --- a/src/test/ui/error-codes/E0081.rs +++ b/src/test/ui/error-codes/E0081.rs @@ -1,9 +1,20 @@ enum Enum { P = 3, + //~^ NOTE first use of `3` X = 3, //~^ ERROR discriminant value `3` already exists + //~| NOTE enum already has `3` Y = 5 } +#[repr(u8)] +enum EnumOverflowRepr { + P = 257, + //~^ NOTE first use of `1` (overflowed from `257`) + X = 513, + //~^ ERROR discriminant value `1` already exists + //~| NOTE enum already has `1` (overflowed from `513`) +} + fn main() { } diff --git a/src/test/ui/error-codes/E0081.stderr b/src/test/ui/error-codes/E0081.stderr index 0b3d351e1ac..9b279bb0214 100644 --- a/src/test/ui/error-codes/E0081.stderr +++ b/src/test/ui/error-codes/E0081.stderr @@ -1,11 +1,21 @@ error[E0081]: discriminant value `3` already exists - --> $DIR/E0081.rs:3:9 + --> $DIR/E0081.rs:4:9 | LL | P = 3, | - first use of `3` +LL | LL | X = 3, | ^ enum already has `3` -error: aborting due to previous error +error[E0081]: discriminant value `1` already exists + --> $DIR/E0081.rs:14:9 + | +LL | P = 257, + | --- first use of `1` (overflowed from `257`) +LL | +LL | X = 513, + | ^^^ enum already has `1` (overflowed from `513`) + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0081`. diff --git a/src/test/ui/macros/issue-88228.rs b/src/test/ui/macros/issue-88228.rs new file mode 100644 index 00000000000..615b865e9f1 --- /dev/null +++ b/src/test/ui/macros/issue-88228.rs @@ -0,0 +1,22 @@ +// compile-flags: -Z deduplicate-diagnostics=yes +// edition:2018 + +mod hey { + pub use Copy as Bla; + pub use std::println as bla; +} + +#[derive(Bla)] +//~^ ERROR cannot find derive macro `Bla` +//~| NOTE consider importing this derive macro +struct A; + +#[derive(println)] +//~^ ERROR cannot find derive macro `println` +struct B; + +fn main() { + bla!(); + //~^ ERROR cannot find macro `bla` + //~| NOTE consider importing this macro +} diff --git a/src/test/ui/macros/issue-88228.stderr b/src/test/ui/macros/issue-88228.stderr new file mode 100644 index 00000000000..b164e39064c --- /dev/null +++ b/src/test/ui/macros/issue-88228.stderr @@ -0,0 +1,26 @@ +error: cannot find macro `bla` in this scope + --> $DIR/issue-88228.rs:19:5 + | +LL | bla!(); + | ^^^ + | + = note: consider importing this macro: + crate::hey::bla + +error: cannot find derive macro `println` in this scope + --> $DIR/issue-88228.rs:14:10 + | +LL | #[derive(println)] + | ^^^^^^^ + +error: cannot find derive macro `Bla` in this scope + --> $DIR/issue-88228.rs:9:10 + | +LL | #[derive(Bla)] + | ^^^ + | + = note: consider importing this derive macro: + crate::hey::Bla + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/proc-macro/derive-helper-shadowing.stderr b/src/test/ui/proc-macro/derive-helper-shadowing.stderr index 4115fec86fb..3b160935a2f 100644 --- a/src/test/ui/proc-macro/derive-helper-shadowing.stderr +++ b/src/test/ui/proc-macro/derive-helper-shadowing.stderr @@ -16,6 +16,8 @@ error: cannot find attribute `empty_helper` in this scope LL | #[derive(GenHelperUse)] | ^^^^^^^^^^^^ | + = note: consider importing this attribute macro: + empty_helper = note: this error originates in the derive macro `GenHelperUse` (in Nightly builds, run with -Z macro-backtrace for more info) error: cannot find attribute `empty_helper` in this scope @@ -27,6 +29,8 @@ LL | #[empty_helper] LL | gen_helper_use!(); | ------------------ in this macro invocation | + = note: consider importing this attribute macro: + crate::empty_helper = note: this error originates in the macro `gen_helper_use` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0659]: `empty_helper` is ambiguous (name vs any other name during import resolution) diff --git a/src/tools/clippy/clippy_lints/src/unit_return_expecting_ord.rs b/src/tools/clippy/clippy_lints/src/unit_return_expecting_ord.rs index ee675838c4c..db0f412f2a1 100644 --- a/src/tools/clippy/clippy_lints/src/unit_return_expecting_ord.rs +++ b/src/tools/clippy/clippy_lints/src/unit_return_expecting_ord.rs @@ -127,7 +127,7 @@ fn check_arg<'tcx>(cx: &LateContext<'tcx>, arg: &'tcx Expr<'tcx>) -> Option<(Spa then { let data = stmt.span.data(); // Make a span out of the semicolon for the help message - Some((span, Some(Span::new(data.hi-BytePos(1), data.hi, data.ctxt)))) + Some((span, Some(data.with_lo(data.hi-BytePos(1))))) } else { Some((span, None)) } diff --git a/src/tools/clippy/clippy_lints/src/write.rs b/src/tools/clippy/clippy_lints/src/write.rs index 4553ac704a2..85d1f65c51f 100644 --- a/src/tools/clippy/clippy_lints/src/write.rs +++ b/src/tools/clippy/clippy_lints/src/write.rs @@ -299,7 +299,7 @@ impl EarlyLintPass for Write { let nl_span = match (dest, only_nl) { // Special case of `write!(buf, "\n")`: Mark everything from the end of // `buf` for removal so no trailing comma [`writeln!(buf, )`] remains. - (Some(dest_expr), true) => Span::new(dest_expr.span.hi(), nl_span.hi(), nl_span.ctxt()), + (Some(dest_expr), true) => nl_span.with_lo(dest_expr.span.hi()), _ => nl_span, }; span_lint_and_then( diff --git a/src/tools/clippy/clippy_utils/src/lib.rs b/src/tools/clippy/clippy_utils/src/lib.rs index 7d7c3b8846c..2777e5bd0c4 100644 --- a/src/tools/clippy/clippy_utils/src/lib.rs +++ b/src/tools/clippy/clippy_utils/src/lib.rs @@ -881,7 +881,7 @@ fn line_span<T: LintContext>(cx: &T, span: Span) -> Span { let source_map_and_line = cx.sess().source_map().lookup_line(span.lo()).unwrap(); let line_no = source_map_and_line.line; let line_start = source_map_and_line.sf.lines[line_no]; - Span::new(line_start, span.hi(), span.ctxt()) + span.with_lo(line_start) } /// Gets the parent node, if any. |
