From e89db3030d322ca7cb20d13df5578b60b0c8a942 Mon Sep 17 00:00:00 2001 From: Esteban Küber Date: Sun, 1 Jul 2018 20:03:35 -0700 Subject: Do not suggest changes to str literal if it isn't one --- src/test/ui/suggestions/issue-48364.rs | 16 ++++++++++++++++ src/test/ui/suggestions/issue-48364.stderr | 12 ++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 src/test/ui/suggestions/issue-48364.rs create mode 100644 src/test/ui/suggestions/issue-48364.stderr (limited to 'src/test') diff --git a/src/test/ui/suggestions/issue-48364.rs b/src/test/ui/suggestions/issue-48364.rs new file mode 100644 index 00000000000..82cb722a656 --- /dev/null +++ b/src/test/ui/suggestions/issue-48364.rs @@ -0,0 +1,16 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn foo() -> bool { + b"".starts_with(stringify!(foo)) + //~^ ERROR mismatched types +} + +fn main() {} diff --git a/src/test/ui/suggestions/issue-48364.stderr b/src/test/ui/suggestions/issue-48364.stderr new file mode 100644 index 00000000000..b420654a32d --- /dev/null +++ b/src/test/ui/suggestions/issue-48364.stderr @@ -0,0 +1,12 @@ +error[E0308]: mismatched types + --> $DIR/issue-48364.rs:12:21 + | +LL | b"".starts_with(stringify!(foo)) + | ^^^^^^^^^^^^^^^ expected slice, found str + | + = note: expected type `&[u8]` + found type `&'static str` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. -- cgit 1.4.1-3-g733a5