diff --git a/src/doc/README.md b/src/doc/README.md deleted file mode 100644 index 5f25894afd76d..0000000000000 --- a/src/doc/README.md +++ /dev/null @@ -1,32 +0,0 @@ -# Rust documentations - -## Building - -To generate all the docs, follow the "Building Documentation" instructions in -the README in the root of the repository. This will convert the distributed -Markdown docs to HTML and generate HTML doc for the books, 'std' and 'extra' -libraries. - -To generate HTML documentation from one source file/crate, do something like: - -~~~~text -rustdoc --output html-doc/ --output-format html ../src/libstd/path.rs -~~~~ - -(This, of course, requires a working build of the `rustdoc` tool.) - -## Additional notes - -To generate an HTML version of a doc from Markdown manually, you can do -something like: - -~~~~text -rustdoc reference.md -~~~~ - -(`reference.md` being the Rust Reference Manual.) - -An overview of how to use the `rustdoc` command is available [in the docs][1]. -Further details are available from the command line by with `rustdoc --help`. - -[1]: https://github.com/rust-lang/rust/blob/master/src/doc/rustdoc/src/what-is-rustdoc.md diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index 4c0eeba744150..e4d633c3f2cf2 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -1331,6 +1331,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, "disable user provided type assertion in NLL"), nll_dont_emit_read_for_match: bool = (false, parse_bool, [UNTRACKED], "in match codegen, do not include ReadForMatch statements (used by mir-borrowck)"), + dont_buffer_diagnostics: bool = (false, parse_bool, [UNTRACKED], + "emit diagnostics rather than buffering (breaks NLL error downgrading, sorting)."), polonius: bool = (false, parse_bool, [UNTRACKED], "enable polonius-based borrow-checker"), codegen_time_graph: bool = (false, parse_bool, [UNTRACKED], diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs index 619262abb0bf5..52e1ab477038d 100644 --- a/src/librustc/session/mod.rs +++ b/src/librustc/session/mod.rs @@ -1012,6 +1012,7 @@ pub fn build_session_with_source_map( let can_emit_warnings = !(warnings_allow || cap_lints_allow); let treat_err_as_bug = sopts.debugging_opts.treat_err_as_bug; + let dont_buffer_diagnostics = sopts.debugging_opts.dont_buffer_diagnostics; let report_delayed_bugs = sopts.debugging_opts.report_delayed_bugs; let external_macro_backtrace = sopts.debugging_opts.external_macro_backtrace; @@ -1059,6 +1060,7 @@ pub fn build_session_with_source_map( can_emit_warnings, treat_err_as_bug, report_delayed_bugs, + dont_buffer_diagnostics, external_macro_backtrace, ..Default::default() }, diff --git a/src/librustc_errors/diagnostic_builder.rs b/src/librustc_errors/diagnostic_builder.rs index 1b34898b99084..5e962a4af32f6 100644 --- a/src/librustc_errors/diagnostic_builder.rs +++ b/src/librustc_errors/diagnostic_builder.rs @@ -21,6 +21,10 @@ use std::thread::panicking; use syntax_pos::{MultiSpan, Span}; /// Used for emitting structured error messages and other diagnostic information. +/// +/// If there is some state in a downstream crate you would like to +/// access in the methods of `DiagnosticBuilder` here, consider +/// extending `HandlerFlags`, accessed via `self.handler.flags`. #[must_use] #[derive(Clone)] pub struct DiagnosticBuilder<'a> { @@ -89,8 +93,14 @@ impl<'a> DiagnosticBuilder<'a> { self.cancel(); } - /// Buffers the diagnostic for later emission. - pub fn buffer(self, buffered_diagnostics: &mut Vec) { + /// Buffers the diagnostic for later emission, unless handler + /// has disabled such buffering. + pub fn buffer(mut self, buffered_diagnostics: &mut Vec) { + if self.handler.flags.dont_buffer_diagnostics || self.handler.flags.treat_err_as_bug { + self.emit(); + return; + } + // We need to use `ptr::read` because `DiagnosticBuilder` // implements `Drop`. let diagnostic; diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs index 3582c2359c8b9..d0ea6fba5ebb3 100644 --- a/src/librustc_errors/lib.rs +++ b/src/librustc_errors/lib.rs @@ -303,9 +303,20 @@ thread_local!(pub static TRACK_DIAGNOSTICS: Cell = #[derive(Default)] pub struct HandlerFlags { + /// If false, warning-level lints are suppressed. + /// (rustc: see `--allow warnings` and `--cap-lints`) pub can_emit_warnings: bool, + /// If true, error-level diagnostics are upgraded to bug-level. + /// (rustc: see `-Z treat-err-as-bug`) pub treat_err_as_bug: bool, + /// If true, immediately emit diagnostics that would otherwise be buffered. + /// (rustc: see `-Z dont-buffer-diagnostics` and `-Z treat-err-as-bug`) + pub dont_buffer_diagnostics: bool, + /// If true, immediately print bugs registered with `delay_span_bug`. + /// (rustc: see `-Z report-delayed-bugs`) pub report_delayed_bugs: bool, + /// show macro backtraces even for non-local macros. + /// (rustc: see `-Z external-macro-backtrace`) pub external_macro_backtrace: bool, } diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index b662b82501393..f9e717f8d456e 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -783,7 +783,7 @@ impl EarlyLintPass for DeprecatedAttr { fn check_attribute(&mut self, cx: &EarlyContext, attr: &ast::Attribute) { for &&(n, _, ref g) in &self.depr_attrs { if attr.name() == n { - if let &AttributeGate::Gated(Stability::Deprecated(link), + if let &AttributeGate::Gated(Stability::Deprecated(link, suggestion), ref name, ref reason, _) = g { @@ -792,7 +792,7 @@ impl EarlyLintPass for DeprecatedAttr { let mut err = cx.struct_span_lint(DEPRECATED, attr.span, &msg); err.span_suggestion_short_with_applicability( attr.span, - "remove this attribute", + suggestion.unwrap_or("remove this attribute"), String::new(), Applicability::MachineApplicable ); diff --git a/src/librustc_typeck/check/demand.rs b/src/librustc_typeck/check/demand.rs index 4e22ead8db987..e78cd4891a5ea 100644 --- a/src/librustc_typeck/check/demand.rs +++ b/src/librustc_typeck/check/demand.rs @@ -415,10 +415,55 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { src, if needs_paren { ")" } else { "" }, expected_ty); - let into_suggestion = format!("{}{}{}.into()", - if needs_paren { "(" } else { "" }, - src, - if needs_paren { ")" } else { "" }); + let into_suggestion = format!( + "{}{}{}.into()", + if needs_paren { "(" } else { "" }, + src, + if needs_paren { ")" } else { "" }, + ); + let literal_is_ty_suffixed = |expr: &hir::Expr| { + if let hir::ExprKind::Lit(lit) = &expr.node { + lit.node.is_suffixed() + } else { + false + } + }; + + let into_sugg = into_suggestion.clone(); + let suggest_to_change_suffix_or_into = |err: &mut DiagnosticBuilder, + note: Option<&str>| { + let suggest_msg = if literal_is_ty_suffixed(expr) { + format!( + "change the type of the numeric literal from `{}` to `{}`", + checked_ty, + expected_ty, + ) + } else { + match note { + Some(note) => format!("{}, which {}", msg, note), + _ => format!("{} in a lossless way", msg), + } + }; + + let suffix_suggestion = format!( + "{}{}{}{}", + if needs_paren { "(" } else { "" }, + src.trim_right_matches(&checked_ty.to_string()), + expected_ty, + if needs_paren { ")" } else { "" }, + ); + + err.span_suggestion_with_applicability( + expr.span, + &suggest_msg, + if literal_is_ty_suffixed(expr) { + suffix_suggestion + } else { + into_sugg + }, + Applicability::MachineApplicable, + ); + }; match (&expected_ty.sty, &checked_ty.sty) { (&ty::Int(ref exp), &ty::Int(ref found)) => { @@ -444,11 +489,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } _ => { - err.span_suggestion_with_applicability( - expr.span, - &format!("{}, which {}", msg, will_sign_extend), - into_suggestion, - Applicability::MachineApplicable + suggest_to_change_suffix_or_into( + err, + Some(will_sign_extend), ); } } @@ -477,12 +520,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } _ => { - err.span_suggestion_with_applicability( - expr.span, - &format!("{}, which {}", msg, will_zero_extend), - into_suggestion, - Applicability::MachineApplicable - ); + suggest_to_change_suffix_or_into( + err, + Some(will_zero_extend), + ); } } true @@ -583,12 +624,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } (&ty::Float(ref exp), &ty::Float(ref found)) => { if found.bit_width() < exp.bit_width() { - err.span_suggestion_with_applicability( - expr.span, - &format!("{} in a lossless way", msg), - into_suggestion, - Applicability::MachineApplicable - ); + suggest_to_change_suffix_or_into( + err, + None, + ); } else if can_cast { err.span_suggestion_with_applicability( expr.span, diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index a312913a69c17..2feeecb388f38 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -260,9 +260,10 @@ impl DocAccessLevels for AccessLevels { /// /// If the given `error_format` is `ErrorOutputType::Json` and no `SourceMap` is given, a new one /// will be created for the handler. -pub fn new_handler(error_format: ErrorOutputType, source_map: Option>) - -> errors::Handler -{ +pub fn new_handler(error_format: ErrorOutputType, + source_map: Option>, + treat_err_as_bug: bool, +) -> errors::Handler { // rustdoc doesn't override (or allow to override) anything from this that is relevant here, so // stick to the defaults let sessopts = Options::default(); @@ -299,7 +300,7 @@ pub fn new_handler(error_format: ErrorOutputType, source_map: Option, describe_lints: bool, mut manual_passes: Vec, - mut default_passes: passes::DefaultPassOption) - -> (clean::Crate, RenderInfo, Vec) -{ + mut default_passes: passes::DefaultPassOption, + treat_err_as_bug: bool, +) -> (clean::Crate, RenderInfo, Vec) { // Parse, resolve, and typecheck the given crate. let cpath = match input { @@ -388,7 +389,9 @@ pub fn run_core(search_paths: SearchPaths, }; driver::spawn_thread_pool(sessopts, move |sessopts| { let source_map = Lrc::new(source_map::SourceMap::new(sessopts.file_path_mapping())); - let diagnostic_handler = new_handler(error_format, Some(source_map.clone())); + let diagnostic_handler = new_handler(error_format, + Some(source_map.clone()), + treat_err_as_bug); let mut sess = session::build_session_( sessopts, cpath, diagnostic_handler, source_map, diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 75311d938516f..1879abe659c83 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -1830,8 +1830,8 @@ impl Context { *slot.borrow_mut() = self.current.clone(); }); - let mut title = if it.is_primitive() { - // No need to include the namespace for primitive types + let mut title = if it.is_primitive() || it.is_keyword() { + // No need to include the namespace for primitive types and keywords String::new() } else { self.current.join("::") diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 73057b19016c6..5f373a635dd7a 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -404,8 +404,11 @@ fn main_args(args: &[String]) -> isize { `short` (instead was `{}`)", arg)); } }; + let treat_err_as_bug = matches.opt_strs("Z").iter().any(|x| { + *x == "treat-err-as-bug" + }); - let diag = core::new_handler(error_format, None); + let diag = core::new_handler(error_format, None, treat_err_as_bug); // check for deprecated options check_deprecated_options(&matches, &diag); @@ -560,7 +563,7 @@ fn main_args(args: &[String]) -> isize { let res = acquire_input(PathBuf::from(input), externs, edition, cg, &matches, error_format, move |out| { let Output { krate, passes, renderinfo } = out; - let diag = core::new_handler(error_format, None); + let diag = core::new_handler(error_format, None, treat_err_as_bug); info!("going to format"); match output_format.as_ref().map(|s| &**s) { Some("html") | None => { @@ -694,6 +697,9 @@ where R: 'static + Send, let force_unstable_if_unmarked = matches.opt_strs("Z").iter().any(|x| { *x == "force-unstable-if-unmarked" }); + let treat_err_as_bug = matches.opt_strs("Z").iter().any(|x| { + *x == "treat-err-as-bug" + }); let (lint_opts, describe_lints, lint_cap) = get_cmd_lint_options(matches, error_format); @@ -706,7 +712,8 @@ where R: 'static + Send, core::run_core(paths, cfgs, externs, Input::File(cratefile), triple, maybe_sysroot, display_warnings, crate_name.clone(), force_unstable_if_unmarked, edition, cg, error_format, - lint_opts, lint_cap, describe_lints, manual_passes, default_passes); + lint_opts, lint_cap, describe_lints, manual_passes, default_passes, + treat_err_as_bug); info!("finished with rustc"); diff --git a/src/libstd/ffi/os_str.rs b/src/libstd/ffi/os_str.rs index 237af2f04e59d..e9390630445a1 100644 --- a/src/libstd/ffi/os_str.rs +++ b/src/libstd/ffi/os_str.rs @@ -34,7 +34,9 @@ use sys_common::{AsInner, IntoInner, FromInner}; /// /// `OsString` and [`OsStr`] bridge this gap by simultaneously representing Rust /// and platform-native string values, and in particular allowing a Rust string -/// to be converted into an "OS" string with no cost if possible. +/// to be converted into an "OS" string with no cost if possible. A consequence +/// of this is that `OsString` instances are *not* `NUL` terminated; in order +/// to pass to e.g. Unix system call, you should create a [`CStr`]. /// /// `OsString` is to [`&OsStr`] as [`String`] is to [`&str`]: the former /// in each pair are owned strings; the latter are borrowed @@ -65,6 +67,7 @@ use sys_common::{AsInner, IntoInner, FromInner}; /// /// [`OsStr`]: struct.OsStr.html /// [`&OsStr`]: struct.OsStr.html +/// [`CStr`]: struct.CStr.html /// [`From`]: ../convert/trait.From.html /// [`String`]: ../string/struct.String.html /// [`&str`]: ../primitive.str.html diff --git a/src/libstd/net/addr.rs b/src/libstd/net/addr.rs index e80c3eeb876ce..ff35325ab4fda 100644 --- a/src/libstd/net/addr.rs +++ b/src/libstd/net/addr.rs @@ -554,6 +554,7 @@ impl FromInner for SocketAddrV6 { #[stable(feature = "ip_from_ip", since = "1.16.0")] impl From for SocketAddr { + /// Converts a [`SocketAddrV4`] into a [`SocketAddr::V4`]. fn from(sock4: SocketAddrV4) -> SocketAddr { SocketAddr::V4(sock4) } @@ -561,6 +562,7 @@ impl From for SocketAddr { #[stable(feature = "ip_from_ip", since = "1.16.0")] impl From for SocketAddr { + /// Converts a [`SocketAddrV6`] into a [`SocketAddr::V6`]. fn from(sock6: SocketAddrV6) -> SocketAddr { SocketAddr::V6(sock6) } @@ -568,6 +570,12 @@ impl From for SocketAddr { #[stable(feature = "addr_from_into_ip", since = "1.17.0")] impl> From<(I, u16)> for SocketAddr { + /// Converts a tuple struct (Into<[`IpAddr`]>, `u16`) into a [`SocketAddr`]. + /// + /// This conversion creates a [`SocketAddr::V4`] for a [`IpAddr::V4`] + /// and creates a [`SocketAddr::V6`] for a [`IpAddr::V6`]. + /// + /// `u16` is treated as port of the newly created [`SocketAddr`]. fn from(pieces: (I, u16)) -> SocketAddr { SocketAddr::new(pieces.0.into(), pieces.1) } diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 060faa9856d7a..67a9601fb12f1 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -711,7 +711,7 @@ pub enum AttributeGate { impl AttributeGate { fn is_deprecated(&self) -> bool { match *self { - Gated(Stability::Deprecated(_), ..) => true, + Gated(Stability::Deprecated(_, _), ..) => true, _ => false, } } @@ -720,8 +720,9 @@ impl AttributeGate { #[derive(Copy, Clone, Debug)] pub enum Stability { Unstable, - // Argument is tracking issue link. - Deprecated(&'static str), + // First argument is tracking issue link; second argument is an optional + // help message, which defaults to "remove this attribute" + Deprecated(&'static str, Option<&'static str>), } // fn() is not Debug @@ -1048,7 +1049,7 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG ("no_builtins", Whitelisted, Ungated), ("no_mangle", Whitelisted, Ungated), ("no_debug", Whitelisted, Gated( - Stability::Deprecated("https://github.com/rust-lang/rust/issues/29721"), + Stability::Deprecated("https://github.com/rust-lang/rust/issues/29721", None), "no_debug", "the `#[no_debug]` attribute was an experimental feature that has been \ deprecated due to lack of demand", @@ -1061,7 +1062,8 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG cfg_fn!(omit_gdb_pretty_printer_section))), ("unsafe_destructor_blind_to_params", Normal, - Gated(Stability::Deprecated("https://github.com/rust-lang/rust/issues/34761"), + Gated(Stability::Deprecated("https://github.com/rust-lang/rust/issues/34761", + Some("replace this attribute with `#[may_dangle]`")), "dropck_parametricity", "unsafe_destructor_blind_to_params has been replaced by \ may_dangle and will be removed in the future", @@ -1140,9 +1142,10 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG ("panic_implementation", Normal, Gated(Stability::Deprecated("https://github.com/rust-lang/rust/issues/44489\ - #issuecomment-415140224"), + #issuecomment-415140224", + Some("replace this attribute with `#[panic_handler]`")), "panic_implementation", - "This attribute was renamed to `panic_handler`", + "this attribute was renamed to `panic_handler`", cfg_fn!(panic_implementation))), // RFC 2070 diff --git a/src/test/rustdoc/keyword.rs b/src/test/rustdoc/keyword.rs index b255ffddafac8..73a026c581be5 100644 --- a/src/test/rustdoc/keyword.rs +++ b/src/test/rustdoc/keyword.rs @@ -15,6 +15,7 @@ // @has foo/index.html '//h2[@id="keywords"]' 'Keywords' // @has foo/index.html '//a[@href="keyword.match.html"]' 'match' // @has foo/keyword.match.html '//a[@class="keyword"]' 'match' +// @has foo/keyword.match.html '//span[@class="in-band"]' 'Keyword match' // @has foo/keyword.match.html '//section[@id="main"]//div[@class="docblock"]//p' 'this is a test!' // @!has foo/index.html '//a/@href' 'foo/index.html' // @!has foo/foo/index.html diff --git a/src/test/ui/feature-gates/feature-gate-dropck-ugeh-2.stderr b/src/test/ui/feature-gates/feature-gate-dropck-ugeh-2.stderr index 80d81ea03cb6d..d3d5bd498cfe8 100644 --- a/src/test/ui/feature-gates/feature-gate-dropck-ugeh-2.stderr +++ b/src/test/ui/feature-gates/feature-gate-dropck-ugeh-2.stderr @@ -2,7 +2,7 @@ error: use of deprecated attribute `dropck_parametricity`: unsafe_destructor_bli --> $DIR/feature-gate-dropck-ugeh-2.rs:17:5 | LL | #[unsafe_destructor_blind_to_params] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace this attribute with `#[may_dangle]` | note: lint level defined here --> $DIR/feature-gate-dropck-ugeh-2.rs:11:9 diff --git a/src/test/ui/feature-gates/feature-gate-panic-implementation.rs b/src/test/ui/feature-gates/feature-gate-panic-implementation.rs index 84e5f302c1676..ca51154884f12 100644 --- a/src/test/ui/feature-gates/feature-gate-panic-implementation.rs +++ b/src/test/ui/feature-gates/feature-gate-panic-implementation.rs @@ -15,7 +15,7 @@ use core::panic::PanicInfo; -#[panic_implementation] //~ ERROR This attribute was renamed to `panic_handler` (see issue #44489) +#[panic_implementation] //~ ERROR this attribute was renamed to `panic_handler` (see issue #44489) fn panic(info: &PanicInfo) -> ! { loop {} } diff --git a/src/test/ui/feature-gates/feature-gate-panic-implementation.stderr b/src/test/ui/feature-gates/feature-gate-panic-implementation.stderr index 926a49ae83199..a54780468c42d 100644 --- a/src/test/ui/feature-gates/feature-gate-panic-implementation.stderr +++ b/src/test/ui/feature-gates/feature-gate-panic-implementation.stderr @@ -1,7 +1,7 @@ -error[E0658]: This attribute was renamed to `panic_handler` (see issue #44489) +error[E0658]: this attribute was renamed to `panic_handler` (see issue #44489) --> $DIR/feature-gate-panic-implementation.rs:18:1 | -LL | #[panic_implementation] //~ ERROR This attribute was renamed to `panic_handler` (see issue #44489) +LL | #[panic_implementation] //~ ERROR this attribute was renamed to `panic_handler` (see issue #44489) | ^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(panic_implementation)] to the crate attributes to enable diff --git a/src/test/ui/issues/issue-53675-a-test-called-panic.rs b/src/test/ui/issues/issue-53675-a-test-called-panic.rs new file mode 100644 index 0000000000000..8a35b36d46d64 --- /dev/null +++ b/src/test/ui/issues/issue-53675-a-test-called-panic.rs @@ -0,0 +1,36 @@ +// rust-lang/rust#53675: At one point the compiler errored when a test +// named `panic` used the `assert!` macro in expression position. + +// compile-pass +// compile-flags: --test + +mod in_expression_position { + #[test] + fn panic() { + assert!(true) + } +} + +mod in_statement_position { + #[test] + fn panic() { + assert!(true); + } +} + +mod what_if_we_use_panic_directly_in_expr { + #[test] + #[should_panic] + fn panic() { + panic!("in expr") + } +} + + +mod what_if_we_use_panic_directly_in_stmt { + #[test] + #[should_panic] + fn panic() { + panic!("in stmt"); + } +} diff --git a/src/test/ui/mismatched_types/numeric-literal-cast.rs b/src/test/ui/mismatched_types/numeric-literal-cast.rs new file mode 100644 index 0000000000000..516b2e8dd30bf --- /dev/null +++ b/src/test/ui/mismatched_types/numeric-literal-cast.rs @@ -0,0 +1,20 @@ +// 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(_: u16) {} +fn foo1(_: f64) {} +fn foo2(_: i32) {} + +fn main() { + foo(1u8); + foo1(2f32); + foo2(3i16); +} + diff --git a/src/test/ui/mismatched_types/numeric-literal-cast.stderr b/src/test/ui/mismatched_types/numeric-literal-cast.stderr new file mode 100644 index 0000000000000..e2fe1a0914d4f --- /dev/null +++ b/src/test/ui/mismatched_types/numeric-literal-cast.stderr @@ -0,0 +1,33 @@ +error[E0308]: mismatched types + --> $DIR/numeric-literal-cast.rs:16:9 + | +LL | foo(1u8); + | ^^^ expected u16, found u8 +help: change the type of the numeric literal from `u8` to `u16` + | +LL | foo(1u16); + | ^^^^ + +error[E0308]: mismatched types + --> $DIR/numeric-literal-cast.rs:17:10 + | +LL | foo1(2f32); + | ^^^^ expected f64, found f32 +help: change the type of the numeric literal from `f32` to `f64` + | +LL | foo1(2f64); + | ^^^^ + +error[E0308]: mismatched types + --> $DIR/numeric-literal-cast.rs:18:10 + | +LL | foo2(3i16); + | ^^^^ expected i32, found i16 +help: change the type of the numeric literal from `i16` to `i32` + | +LL | foo2(3i32); + | ^^^^ + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/panic-implementation/panic-implementation-deprecated.stderr b/src/test/ui/panic-implementation/panic-implementation-deprecated.stderr index 43f51447ac46e..fabfba94878f5 100644 --- a/src/test/ui/panic-implementation/panic-implementation-deprecated.stderr +++ b/src/test/ui/panic-implementation/panic-implementation-deprecated.stderr @@ -1,8 +1,8 @@ -error: use of deprecated attribute `panic_implementation`: This attribute was renamed to `panic_handler`. See https://github.com/rust-lang/rust/issues/44489#issuecomment-415140224 +error: use of deprecated attribute `panic_implementation`: this attribute was renamed to `panic_handler`. See https://github.com/rust-lang/rust/issues/44489#issuecomment-415140224 --> $DIR/panic-implementation-deprecated.rs:19:1 | LL | #[panic_implementation] - | ^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | ^^^^^^^^^^^^^^^^^^^^^^^ help: replace this attribute with `#[panic_handler]` | note: lint level defined here --> $DIR/panic-implementation-deprecated.rs:13:9