diff --git a/src/librustc/lint/mod.rs b/src/librustc/lint/mod.rs index cd038d067a1fd..1497be2d5ba0d 100644 --- a/src/librustc/lint/mod.rs +++ b/src/librustc/lint/mod.rs @@ -498,15 +498,21 @@ pub fn struct_lint_level<'a>(sess: &'a Session, // Check for future incompatibility lints and issue a stronger warning. let lints = sess.lint_store.borrow(); - if let Some(future_incompatible) = lints.future_incompatible(LintId::of(lint)) { - let future = if let Some(edition) = future_incompatible.edition { - format!("the {} edition", edition) + let lint_id = LintId::of(lint); + if let Some(future_incompatible) = lints.future_incompatible(lint_id) { + const STANDARD_MESSAGE: &str = + "this was previously accepted by the compiler but is being phased out; \ + it will become a hard error"; + + let explanation = if lint_id == LintId::of(::lint::builtin::UNSTABLE_NAME_COLLISION) { + "once this method is added to the standard library, \ + there will be ambiguity here, which will cause a hard error!" + .to_owned() + } else if let Some(edition) = future_incompatible.edition { + format!("{} in the {} edition!", STANDARD_MESSAGE, edition) } else { - "a future release".to_owned() + format!("{} in a future release!", STANDARD_MESSAGE) }; - let explanation = format!("this was previously accepted by the compiler \ - but is being phased out; \ - it will become a hard error in {}!", future); let citation = format!("for more information, see {}", future_incompatible.reference); err.warn(&explanation); diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs index ede7703b61966..64d561ab96b09 100644 --- a/src/librustc_typeck/check/method/probe.rs +++ b/src/librustc_typeck/check/method/probe.rs @@ -1042,7 +1042,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { lint::builtin::UNSTABLE_NAME_COLLISION, self.fcx.body_id, self.span, - "a method with this name will be added to the standard library in the future", + "a method with this name may be added to the standard library in the future", ); // FIXME: This should be a `span_suggestion` instead of `help`. However `self.span` only diff --git a/src/test/ui/inference_unstable.rs b/src/test/ui/inference_unstable.rs index 525fda33955a3..816c443a06c21 100644 --- a/src/test/ui/inference_unstable.rs +++ b/src/test/ui/inference_unstable.rs @@ -24,6 +24,6 @@ use inference_unstable_itertools::IpuItertools; fn main() { assert_eq!('x'.ipu_flatten(), 1); - //~^ WARN a method with this name will be added to the standard library in the future - //~^^ WARN it will become a hard error in a future release + //~^ WARN a method with this name may be added to the standard library in the future + //~^^ WARN once this method is added to the standard library, there will be ambiguity here } diff --git a/src/test/ui/inference_unstable.stderr b/src/test/ui/inference_unstable.stderr index a5cf4d6dff3b1..21b1bdbf17910 100644 --- a/src/test/ui/inference_unstable.stderr +++ b/src/test/ui/inference_unstable.stderr @@ -1,11 +1,11 @@ -warning: a method with this name will be added to the standard library in the future +warning: a method with this name may be added to the standard library in the future --> $DIR/inference_unstable.rs:26:20 | LL | assert_eq!('x'.ipu_flatten(), 1); | ^^^^^^^^^^^ | = note: #[warn(unstable_name_collision)] on by default - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = warning: once this method is added to the standard library, there will be ambiguity here, which will cause a hard error! = note: for more information, see pr #48552 = help: call with fully qualified syntax `inference_unstable_itertools::IpuItertools::ipu_flatten(...)` to keep using the current method = note: add #![feature(ipu_flatten)] to the crate attributes to enable `inference_unstable_iterator::IpuIterator::ipu_flatten`