Skip to content

Rollup of 11 pull requests #81212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 29 commits into from
Closed
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
c78bfba
Use consistent punctuation for 'Prelude contents' docs
camelid Dec 18, 2020
4a6014b
Use heading style for 'The I/O Prelude' in `std::io::prelude`
camelid Dec 18, 2020
2eb4ccd
Improve grammar in documentation of format strings
steffahn Jan 1, 2021
4274ba4
Use lowercase for prelude items
camelid Jan 6, 2021
25a4964
Use heading for `std::prelude` and not `io::prelude`
camelid Jan 6, 2021
77b5ced
Fix formatting for removed lints
jyn514 Jan 17, 2021
96e9562
Visit only terminators when removing landing pads
tmiasko Jan 18, 2021
d829e40
Improve unknown external crate error
rylev Jan 15, 2021
38b7742
Add tests for resolution changes
rylev Jan 18, 2021
9abd80c
Fix internal rustdoc broken links
CPerezz Jan 18, 2021
20d8478
Fix intersperse_fold
tesuji Jan 18, 2021
d926147
Remove unnecessary `after_run` function
jyn514 Jan 19, 2021
9272d53
Stop `fold` at first None when iterator yield
m-ou-se Jan 19, 2021
203df17
Fix typo in counters.rs
eltociear Jan 19, 2021
3fb53c2
Fix ICE in mir when evaluating SizeOf on unsized type
osa1 Jan 19, 2021
bc6720f
Add SpecFromIter ref in the comments directly
CPerezz Jan 19, 2021
230d5b1
Stabilize std::panic::panic_any.
m-ou-se Jan 19, 2021
8cac04e
Make 'static bound on panic_any explicit.
m-ou-se Jan 19, 2021
9343d94
Rollup merge of #80172 - camelid:prelude-docs-consistent-punct, r=ste…
m-ou-se Jan 20, 2021
f18b766
Rollup merge of #80601 - steffahn:improve_format_string_grammar, r=m-…
m-ou-se Jan 20, 2021
e047457
Rollup merge of #81046 - rylev:unknown-external-crate, r=estebank
m-ou-se Jan 20, 2021
bfc2533
Rollup merge of #81135 - jyn514:no-backticks, r=flip1995
m-ou-se Jan 20, 2021
9c8f0fe
Rollup merge of #81152 - lzutao:intersperse_fold, r=m-ou-se
m-ou-se Jan 20, 2021
8253984
Rollup merge of #81178 - tmiasko:no-landing-pads, r=oli-obk
m-ou-se Jan 20, 2021
1afc006
Rollup merge of #81179 - CPerezz:fix_interal_doc_warns, r=jyn514
m-ou-se Jan 20, 2021
e190e8c
Rollup merge of #81184 - jyn514:combine-after, r=CraftSpider
m-ou-se Jan 20, 2021
4fcee03
Rollup merge of #81185 - osa1:fix_80742, r=oli-obk
m-ou-se Jan 20, 2021
ce50269
Rollup merge of #81187 - eltociear:patch-6, r=jonas-schievink
m-ou-se Jan 20, 2021
0cdd7f0
Rollup merge of #81194 - m-ou-se:stabilize-panic-any, r=m-ou-se
m-ou-se Jan 20, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_lint/src/context.rs
Original file line number Diff line number Diff line change
@@ -387,7 +387,7 @@ impl LintStore {
Some(new_name.to_owned()),
),
Some(&Removed(ref reason)) => CheckLintNameResult::Warning(
format!("lint `{}` has been removed: `{}`", complete_name, reason),
format!("lint `{}` has been removed: {}", complete_name, reason),
None,
),
None => match self.lint_groups.get(&*complete_name) {
3 changes: 1 addition & 2 deletions compiler/rustc_lint/src/levels.rs
Original file line number Diff line number Diff line change
@@ -311,8 +311,7 @@ impl<'s> LintLevelsBuilder<'s> {
|lint| {
let msg = format!(
"lint name `{}` is deprecated \
and may not have an effect in the future. \
Also `cfg_attr(cargo-clippy)` won't be necessary anymore",
and may not have an effect in the future.",
name
);
lint.build(&msg)
11 changes: 7 additions & 4 deletions compiler/rustc_mir/src/interpret/step.rs
Original file line number Diff line number Diff line change
@@ -264,10 +264,13 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
NullaryOp(mir::NullOp::SizeOf, ty) => {
let ty = self.subst_from_current_frame_and_normalize_erasing_regions(ty);
let layout = self.layout_of(ty)?;
assert!(
!layout.is_unsized(),
"SizeOf nullary MIR operator called for unsized type"
);
if layout.is_unsized() {
// FIXME: This should be a span_bug (#80742)
self.tcx.sess.delay_span_bug(
self.frame().current_span(),
&format!("SizeOf nullary MIR operator called for unsized type {}", ty),
);
}
self.write_scalar(Scalar::from_machine_usize(layout.size.bytes(), self), dest)?;
}

2 changes: 1 addition & 1 deletion compiler/rustc_mir/src/shim.rs
Original file line number Diff line number Diff line change
@@ -81,7 +81,7 @@ fn make_shim<'tcx>(tcx: TyCtxt<'tcx>, instance: ty::InstanceDef<'tcx>) -> Body<'
MirPhase::Const,
&[&[
&add_moves_for_packed_drops::AddMovesForPackedDrops,
&no_landing_pads::NoLandingPads::new(tcx),
&no_landing_pads::NoLandingPads,
&remove_noop_landing_pads::RemoveNoopLandingPads,
&simplify::SimplifyCfg::new("make_shim"),
&add_call_guards::CriticalCallEdges,
2 changes: 1 addition & 1 deletion compiler/rustc_mir/src/transform/coverage/counters.rs
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@ impl CoverageCounters {
}

/// Activate the `DebugCounters` data structures, to provide additional debug formatting
/// features when formating `CoverageKind` (counter) values.
/// features when formatting `CoverageKind` (counter) values.
pub fn enable_debug(&mut self) {
self.debug_counters.enable();
}
4 changes: 2 additions & 2 deletions compiler/rustc_mir/src/transform/mod.rs
Original file line number Diff line number Diff line change
@@ -433,15 +433,15 @@ fn run_post_borrowck_cleanup_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tc

let post_borrowck_cleanup: &[&dyn MirPass<'tcx>] = &[
// Remove all things only needed by analysis
&no_landing_pads::NoLandingPads::new(tcx),
&no_landing_pads::NoLandingPads,
&simplify_branches::SimplifyBranches::new("initial"),
&remove_noop_landing_pads::RemoveNoopLandingPads,
&cleanup_post_borrowck::CleanupNonCodegenStatements,
&simplify::SimplifyCfg::new("early-opt"),
// These next passes must be executed together
&add_call_guards::CriticalCallEdges,
&elaborate_drops::ElaborateDrops,
&no_landing_pads::NoLandingPads::new(tcx),
&no_landing_pads::NoLandingPads,
// AddMovesForPackedDrops needs to run after drop
// elaboration.
&add_moves_for_packed_drops::AddMovesForPackedDrops,
27 changes: 6 additions & 21 deletions compiler/rustc_mir/src/transform/no_landing_pads.rs
Original file line number Diff line number Diff line change
@@ -2,42 +2,27 @@
//! specified.

use crate::transform::MirPass;
use rustc_middle::mir::visit::MutVisitor;
use rustc_middle::mir::*;
use rustc_middle::ty::TyCtxt;
use rustc_target::spec::PanicStrategy;

pub struct NoLandingPads<'tcx> {
tcx: TyCtxt<'tcx>,
}

impl<'tcx> NoLandingPads<'tcx> {
pub fn new(tcx: TyCtxt<'tcx>) -> Self {
NoLandingPads { tcx }
}
}
pub struct NoLandingPads;

impl<'tcx> MirPass<'tcx> for NoLandingPads<'tcx> {
impl<'tcx> MirPass<'tcx> for NoLandingPads {
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
no_landing_pads(tcx, body)
}
}

pub fn no_landing_pads<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
if tcx.sess.panic_strategy() == PanicStrategy::Abort {
NoLandingPads::new(tcx).visit_body(body);
}
}

impl<'tcx> MutVisitor<'tcx> for NoLandingPads<'tcx> {
fn tcx(&self) -> TyCtxt<'tcx> {
self.tcx
if tcx.sess.panic_strategy() != PanicStrategy::Abort {
return;
}

fn visit_terminator(&mut self, terminator: &mut Terminator<'tcx>, location: Location) {
for block in body.basic_blocks_mut() {
let terminator = block.terminator_mut();
if let Some(unwind) = terminator.kind.unwind_mut() {
unwind.take();
}
self.super_terminator(terminator, location);
}
}
7 changes: 7 additions & 0 deletions compiler/rustc_resolve/src/late.rs
Original file line number Diff line number Diff line change
@@ -243,6 +243,13 @@ impl<'a> PathSource<'a> {
// "function" here means "anything callable" rather than `DefKind::Fn`,
// this is not precise but usually more helpful than just "value".
Some(ExprKind::Call(call_expr, _)) => match &call_expr.kind {
// the case of `::some_crate()`
ExprKind::Path(_, path)
if path.segments.len() == 2
&& path.segments[0].ident.name == kw::PathRoot =>
{
"external crate"
}
ExprKind::Path(_, path) => {
let mut msg = "function";
if let Some(segment) = path.segments.iter().last() {
14 changes: 10 additions & 4 deletions compiler/rustc_resolve/src/lib.rs
Original file line number Diff line number Diff line change
@@ -2485,20 +2485,26 @@ impl<'a> Resolver<'a> {
(format!("use of undeclared crate or module `{}`", ident), None)
}
} else {
let mut msg =
format!("could not find `{}` in `{}`", ident, path[i - 1].ident);
let parent = path[i - 1].ident.name;
let parent = if parent == kw::PathRoot {
"crate root".to_owned()
} else {
format!("`{}`", parent)
};

let mut msg = format!("could not find `{}` in {}", ident, parent);
if ns == TypeNS || ns == ValueNS {
let ns_to_try = if ns == TypeNS { ValueNS } else { TypeNS };
if let FindBindingResult::Binding(Ok(binding)) =
find_binding_in_ns(self, ns_to_try)
{
let mut found = |what| {
msg = format!(
"expected {}, found {} `{}` in `{}`",
"expected {}, found {} `{}` in {}",
ns.descr(),
what,
ident,
path[i - 1].ident
parent
)
};
if binding.module().is_some() {
9 changes: 5 additions & 4 deletions library/alloc/src/fmt.rs
Original file line number Diff line number Diff line change
@@ -282,21 +282,22 @@
//! `%`. The actual grammar for the formatting syntax is:
//!
//! ```text
//! format_string := <text> [ maybe-format <text> ] *
//! maybe-format := '{' '{' | '}' '}' | <format>
//! format_string := text [ maybe_format text ] *
//! maybe_format := '{' '{' | '}' '}' | format
//! format := '{' [ argument ] [ ':' format_spec ] '}'
//! argument := integer | identifier
//!
//! format_spec := [[fill]align][sign]['#']['0'][width]['.' precision][type]
//! format_spec := [[fill]align][sign]['#']['0'][width]['.' precision]type
//! fill := character
//! align := '<' | '^' | '>'
//! sign := '+' | '-'
//! width := count
//! precision := count | '*'
//! type := identifier | '?' | ''
//! type := '' | '?' | 'x?' | 'X?' | identifier
//! count := parameter | integer
//! parameter := argument '$'
//! ```
//! In the above grammar, `text` may not contain any `'{'` or `'}'` characters.
//!
//! # Formatting traits
//!
2 changes: 1 addition & 1 deletion library/alloc/src/vec/spec_from_iter_nested.rs
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ use super::{SpecExtend, Vec};

/// Another specialization trait for Vec::from_iter
/// necessary to manually prioritize overlapping specializations
/// see [`SpecFromIter`] for details.
/// see [`SpecFromIter`](super::SpecFromIter) for details.
pub(super) trait SpecFromIterNested<T, I> {
fn from_iter(iter: I) -> Self;
}
7 changes: 4 additions & 3 deletions library/core/src/iter/adapters/intersperse.rs
Original file line number Diff line number Diff line change
@@ -160,7 +160,7 @@ where
}

fn intersperse_fold<I, B, F, G>(
mut iter: Peekable<I>,
mut iter: I,
init: B,
mut f: F,
mut separator: G,
@@ -173,10 +173,11 @@ where
{
let mut accum = init;

// Use `peek()` first to avoid calling `next()` on an empty iterator.
if !needs_sep || iter.peek().is_some() {
if !needs_sep {
if let Some(x) = iter.next() {
accum = f(accum, x);
} else {
return accum;
}
}

41 changes: 41 additions & 0 deletions library/core/tests/iter.rs
Original file line number Diff line number Diff line change
@@ -3562,6 +3562,47 @@ fn test_intersperse_size_hint() {
assert_eq!([].iter().intersperse(&()).size_hint(), (0, Some(0)));
}

#[test]
fn test_intersperse_fold() {
let v = (1..4).intersperse(9).fold(Vec::new(), |mut acc, x| {
acc.push(x);
acc
});
assert_eq!(v.as_slice(), [1, 9, 2, 9, 3]);

let mut iter = (1..4).intersperse(9);
assert_eq!(iter.next(), Some(1));
let v = iter.fold(Vec::new(), |mut acc, x| {
acc.push(x);
acc
});
assert_eq!(v.as_slice(), [9, 2, 9, 3]);

struct NoneAtStart(i32); // Produces: None, Some(2), Some(3), None, ...
impl Iterator for NoneAtStart {
type Item = i32;
fn next(&mut self) -> Option<i32> {
self.0 += 1;
Some(self.0).filter(|i| i % 3 != 1)
}
}

let v = NoneAtStart(0).intersperse(1000).fold(0, |a, b| a + b);
assert_eq!(v, 0);
}

#[test]
fn test_intersperse_collect_string() {
let contents = vec![1, 2, 3];

let contents_string = contents
.into_iter()
.map(|id| id.to_string())
.intersperse(", ".to_owned())
.collect::<String>();
assert_eq!(contents_string, "1, 2, 3");
}

#[test]
fn test_fold_specialization_intersperse() {
let mut iter = (1..2).intersperse(0);
2 changes: 1 addition & 1 deletion library/std/src/io/prelude.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! The I/O Prelude
//! The I/O Prelude.
//!
//! The purpose of this module is to alleviate imports of many common I/O traits
//! by adding a glob import to the top of I/O heavy modules:
4 changes: 2 additions & 2 deletions library/std/src/panic.rs
Original file line number Diff line number Diff line change
@@ -31,9 +31,9 @@ pub use core::panic::{Location, PanicInfo};
/// accessed later using [`PanicInfo::payload`].
///
/// See the [`panic!`] macro for more information about panicking.
#[unstable(feature = "panic_any", issue = "78500")]
#[stable(feature = "panic_any", since = "1.51.0")]
#[inline]
pub fn panic_any<M: Any + Send>(msg: M) -> ! {
pub fn panic_any<M: 'static + Any + Send>(msg: M) -> ! {
crate::panicking::begin_panic(msg);
}

28 changes: 14 additions & 14 deletions library/std/src/prelude/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! The Rust Prelude.
//! # The Rust Prelude
//!
//! Rust comes with a variety of things in its standard library. However, if
//! you had to manually import every single thing that you used, it would be
@@ -28,35 +28,35 @@
//! The current version of the prelude (version 1) lives in
//! [`std::prelude::v1`], and re-exports the following:
//!
//! * [`std::marker`]::{[`Copy`], [`Send`], [`Sized`], [`Sync`], [`Unpin`]},
//! * [`std::marker`]::{[`Copy`], [`Send`], [`Sized`], [`Sync`], [`Unpin`]}:
//! marker traits that indicate fundamental properties of types.
//! * [`std::ops`]::{[`Drop`], [`Fn`], [`FnMut`], [`FnOnce`]}, various
//! * [`std::ops`]::{[`Drop`], [`Fn`], [`FnMut`], [`FnOnce`]}: various
//! operations for both destructors and overloading `()`.
//! * [`std::mem`]::[`drop`][`mem::drop`], a convenience function for explicitly
//! * [`std::mem`]::[`drop`][`mem::drop`]: a convenience function for explicitly
//! dropping a value.
//! * [`std::boxed`]::[`Box`], a way to allocate values on the heap.
//! * [`std::borrow`]::[`ToOwned`], the conversion trait that defines
//! * [`std::boxed`]::[`Box`]: a way to allocate values on the heap.
//! * [`std::borrow`]::[`ToOwned`]: the conversion trait that defines
//! [`to_owned`], the generic method for creating an owned type from a
//! borrowed type.
//! * [`std::clone`]::[`Clone`], the ubiquitous trait that defines
//! * [`std::clone`]::[`Clone`]: the ubiquitous trait that defines
//! [`clone`][`Clone::clone`], the method for producing a copy of a value.
//! * [`std::cmp`]::{[`PartialEq`], [`PartialOrd`], [`Eq`], [`Ord`] }, the
//! * [`std::cmp`]::{[`PartialEq`], [`PartialOrd`], [`Eq`], [`Ord`]}: the
//! comparison traits, which implement the comparison operators and are often
//! seen in trait bounds.
//! * [`std::convert`]::{[`AsRef`], [`AsMut`], [`Into`], [`From`]}, generic
//! * [`std::convert`]::{[`AsRef`], [`AsMut`], [`Into`], [`From`]}: generic
//! conversions, used by savvy API authors to create overloaded methods.
//! * [`std::default`]::[`Default`], types that have default values.
//! * [`std::iter`]::{[`Iterator`], [`Extend`], [`IntoIterator`]
//! [`DoubleEndedIterator`], [`ExactSizeIterator`]}, iterators of various
//! * [`std::iter`]::{[`Iterator`], [`Extend`], [`IntoIterator`],
//! [`DoubleEndedIterator`], [`ExactSizeIterator`]}: iterators of various
//! kinds.
//! * [`std::option`]::[`Option`]::{[`self`][`Option`], [`Some`], [`None`]}, a
//! type which expresses the presence or absence of a value. This type is so
//! commonly used, its variants are also exported.
//! * [`std::result`]::[`Result`]::{[`self`][`Result`], [`Ok`], [`Err`]}, a type
//! * [`std::result`]::[`Result`]::{[`self`][`Result`], [`Ok`], [`Err`]}: a type
//! for functions that may succeed or fail. Like [`Option`], its variants are
//! exported as well.
//! * [`std::string`]::{[`String`], [`ToString`]}, heap allocated strings.
//! * [`std::vec`]::[`Vec`], a growable, heap-allocated vector.
//! * [`std::string`]::{[`String`], [`ToString`]}: heap-allocated strings.
//! * [`std::vec`]::[`Vec`]: a growable, heap-allocated vector.
//!
//! [`mem::drop`]: crate::mem::drop
//! [`std::borrow`]: crate::borrow
15 changes: 9 additions & 6 deletions src/librustdoc/formats/renderer.rs
Original file line number Diff line number Diff line change
@@ -38,10 +38,14 @@ crate trait FormatRenderer<'tcx>: Clone {
fn mod_item_out(&mut self, item_name: &str) -> Result<(), Error>;

/// Post processing hook for cleanup and dumping output to files.
fn after_krate(&mut self, krate: &clean::Crate, cache: &Cache) -> Result<(), Error>;

/// Called after everything else to write out errors.
fn after_run(&mut self, diag: &rustc_errors::Handler) -> Result<(), Error>;
///
/// A handler is available if the renderer wants to report errors.
fn after_krate(
&mut self,
krate: &clean::Crate,
cache: &Cache,
diag: &rustc_errors::Handler,
) -> Result<(), Error>;
}

/// Main method for rendering a crate.
@@ -104,6 +108,5 @@ crate fn run_format<'tcx, T: FormatRenderer<'tcx>>(
}
}

format_renderer.after_krate(&krate, &cache)?;
format_renderer.after_run(diag)
format_renderer.after_krate(&krate, &cache, diag)
}
27 changes: 15 additions & 12 deletions src/librustdoc/html/render/mod.rs
Original file line number Diff line number Diff line change
@@ -523,17 +523,12 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
Ok((cx, krate))
}

fn after_run(&mut self, diag: &rustc_errors::Handler) -> Result<(), Error> {
Arc::get_mut(&mut self.shared).unwrap().fs.close();
let nb_errors = self.errors.iter().map(|err| diag.struct_err(&err).emit()).count();
if nb_errors > 0 {
Err(Error::new(io::Error::new(io::ErrorKind::Other, "I/O error"), ""))
} else {
Ok(())
}
}

fn after_krate(&mut self, krate: &clean::Crate, cache: &Cache) -> Result<(), Error> {
fn after_krate(
&mut self,
krate: &clean::Crate,
cache: &Cache,
diag: &rustc_errors::Handler,
) -> Result<(), Error> {
let final_file = self.dst.join(&*krate.name.as_str()).join("all.html");
let settings_file = self.dst.join("settings.html");
let crate_name = krate.name;
@@ -596,7 +591,15 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
&style_files,
);
self.shared.fs.write(&settings_file, v.as_bytes())?;
Ok(())

// Flush pending errors.
Arc::get_mut(&mut self.shared).unwrap().fs.close();
let nb_errors = self.errors.iter().map(|err| diag.struct_err(&err).emit()).count();
if nb_errors > 0 {
Err(Error::new(io::Error::new(io::ErrorKind::Other, "I/O error"), ""))
} else {
Ok(())
}
}

fn mod_item_in(
11 changes: 6 additions & 5 deletions src/librustdoc/json/mod.rs
Original file line number Diff line number Diff line change
@@ -199,7 +199,12 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
Ok(())
}

fn after_krate(&mut self, krate: &clean::Crate, cache: &Cache) -> Result<(), Error> {
fn after_krate(
&mut self,
krate: &clean::Crate,
cache: &Cache,
_diag: &rustc_errors::Handler,
) -> Result<(), Error> {
debug!("Done with crate");
let mut index = (*self.index).clone().into_inner();
index.extend(self.get_trait_items(cache));
@@ -245,8 +250,4 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
serde_json::ser::to_writer(&file, &output).unwrap();
Ok(())
}

fn after_run(&mut self, _diag: &rustc_errors::Handler) -> Result<(), Error> {
Ok(())
}
}
18 changes: 9 additions & 9 deletions src/test/ui-fulldeps/lint-tool-test.stderr
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
warning: lint name `test_lint` is deprecated and may not have an effect in the future. Also `cfg_attr(cargo-clippy)` won't be necessary anymore
warning: lint name `test_lint` is deprecated and may not have an effect in the future.
--> $DIR/lint-tool-test.rs:9:23
|
LL | #![cfg_attr(foo, warn(test_lint))]
| ^^^^^^^^^ help: change it to: `clippy::test_lint`
|
= note: `#[warn(renamed_and_removed_lints)]` on by default

warning: lint name `clippy_group` is deprecated and may not have an effect in the future. Also `cfg_attr(cargo-clippy)` won't be necessary anymore
warning: lint name `clippy_group` is deprecated and may not have an effect in the future.
--> $DIR/lint-tool-test.rs:13:9
|
LL | #![deny(clippy_group)]
| ^^^^^^^^^^^^ help: change it to: `clippy::group`

warning: lint name `test_group` is deprecated and may not have an effect in the future. Also `cfg_attr(cargo-clippy)` won't be necessary anymore
warning: lint name `test_group` is deprecated and may not have an effect in the future.
--> $DIR/lint-tool-test.rs:29:9
|
LL | #[allow(test_group)]
@@ -26,19 +26,19 @@ LL | #[deny(this_lint_does_not_exist)]
|
= note: `#[warn(unknown_lints)]` on by default

warning: lint name `test_lint` is deprecated and may not have an effect in the future. Also `cfg_attr(cargo-clippy)` won't be necessary anymore
warning: lint name `test_lint` is deprecated and may not have an effect in the future.
--> $DIR/lint-tool-test.rs:9:23
|
LL | #![cfg_attr(foo, warn(test_lint))]
| ^^^^^^^^^ help: change it to: `clippy::test_lint`

warning: lint name `clippy_group` is deprecated and may not have an effect in the future. Also `cfg_attr(cargo-clippy)` won't be necessary anymore
warning: lint name `clippy_group` is deprecated and may not have an effect in the future.
--> $DIR/lint-tool-test.rs:13:9
|
LL | #![deny(clippy_group)]
| ^^^^^^^^^^^^ help: change it to: `clippy::group`

warning: lint name `test_group` is deprecated and may not have an effect in the future. Also `cfg_attr(cargo-clippy)` won't be necessary anymore
warning: lint name `test_group` is deprecated and may not have an effect in the future.
--> $DIR/lint-tool-test.rs:29:9
|
LL | #[allow(test_group)]
@@ -52,13 +52,13 @@ LL | #![plugin(lint_tool_test)]
|
= note: `#[warn(deprecated)]` on by default

warning: lint name `test_lint` is deprecated and may not have an effect in the future. Also `cfg_attr(cargo-clippy)` won't be necessary anymore
warning: lint name `test_lint` is deprecated and may not have an effect in the future.
--> $DIR/lint-tool-test.rs:9:23
|
LL | #![cfg_attr(foo, warn(test_lint))]
| ^^^^^^^^^ help: change it to: `clippy::test_lint`

warning: lint name `clippy_group` is deprecated and may not have an effect in the future. Also `cfg_attr(cargo-clippy)` won't be necessary anymore
warning: lint name `clippy_group` is deprecated and may not have an effect in the future.
--> $DIR/lint-tool-test.rs:13:9
|
LL | #![deny(clippy_group)]
@@ -90,7 +90,7 @@ LL | #![deny(clippy_group)]
| ^^^^^^^^^^^^
= note: `#[deny(clippy::test_group)]` implied by `#[deny(clippy::group)]`

warning: lint name `test_group` is deprecated and may not have an effect in the future. Also `cfg_attr(cargo-clippy)` won't be necessary anymore
warning: lint name `test_group` is deprecated and may not have an effect in the future.
--> $DIR/lint-tool-test.rs:29:9
|
LL | #[allow(test_group)]
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ error[E0432]: unresolved import `E`
--> $DIR/edition-imports-virtual-2015-gated.rs:8:5
|
LL | gen_gated!();
| ^^^^^^^^^^^^^ could not find `E` in `{{root}}`
| ^^^^^^^^^^^^^ could not find `E` in crate root
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

8 changes: 4 additions & 4 deletions src/test/ui/lint/lint-removed-cmdline.stderr
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
warning: lint `raw_pointer_derive` has been removed: `using derive with raw pointers is ok`
warning: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok
|
= note: requested on the command line with `-D raw_pointer_derive`

warning: lint `raw_pointer_derive` has been removed: `using derive with raw pointers is ok`
warning: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok
|
= note: requested on the command line with `-D raw_pointer_derive`

warning: lint `raw_pointer_derive` has been removed: `using derive with raw pointers is ok`
warning: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok
|
= note: requested on the command line with `-D raw_pointer_derive`

warning: lint `raw_pointer_derive` has been removed: `using derive with raw pointers is ok`
warning: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok
|
= note: requested on the command line with `-D raw_pointer_derive`

2 changes: 1 addition & 1 deletion src/test/ui/lint/lint-removed.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
warning: lint `raw_pointer_derive` has been removed: `using derive with raw pointers is ok`
warning: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok
--> $DIR/lint-removed.rs:6:8
|
LL | #[deny(raw_pointer_derive)]
16 changes: 8 additions & 8 deletions src/test/ui/lint/lint-unexported-no-mangle.stderr
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
warning: lint `private_no_mangle_fns` has been removed: `no longer a warning, `#[no_mangle]` functions always exported`
warning: lint `private_no_mangle_fns` has been removed: no longer a warning, `#[no_mangle]` functions always exported
|
= note: requested on the command line with `-F private_no_mangle_fns`

warning: lint `private_no_mangle_statics` has been removed: `no longer a warning, `#[no_mangle]` statics always exported`
warning: lint `private_no_mangle_statics` has been removed: no longer a warning, `#[no_mangle]` statics always exported
|
= note: requested on the command line with `-F private_no_mangle_statics`

warning: lint `private_no_mangle_fns` has been removed: `no longer a warning, `#[no_mangle]` functions always exported`
warning: lint `private_no_mangle_fns` has been removed: no longer a warning, `#[no_mangle]` functions always exported
|
= note: requested on the command line with `-F private_no_mangle_fns`

warning: lint `private_no_mangle_statics` has been removed: `no longer a warning, `#[no_mangle]` statics always exported`
warning: lint `private_no_mangle_statics` has been removed: no longer a warning, `#[no_mangle]` statics always exported
|
= note: requested on the command line with `-F private_no_mangle_statics`

warning: lint `private_no_mangle_fns` has been removed: `no longer a warning, `#[no_mangle]` functions always exported`
warning: lint `private_no_mangle_fns` has been removed: no longer a warning, `#[no_mangle]` functions always exported
|
= note: requested on the command line with `-F private_no_mangle_fns`

warning: lint `private_no_mangle_statics` has been removed: `no longer a warning, `#[no_mangle]` statics always exported`
warning: lint `private_no_mangle_statics` has been removed: no longer a warning, `#[no_mangle]` statics always exported
|
= note: requested on the command line with `-F private_no_mangle_statics`

warning: lint `private_no_mangle_fns` has been removed: `no longer a warning, `#[no_mangle]` functions always exported`
warning: lint `private_no_mangle_fns` has been removed: no longer a warning, `#[no_mangle]` functions always exported
|
= note: requested on the command line with `-F private_no_mangle_fns`

warning: lint `private_no_mangle_statics` has been removed: `no longer a warning, `#[no_mangle]` statics always exported`
warning: lint `private_no_mangle_statics` has been removed: no longer a warning, `#[no_mangle]` statics always exported
|
= note: requested on the command line with `-F private_no_mangle_statics`

33 changes: 33 additions & 0 deletions src/test/ui/mir/issue-80742.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// check-fail

// This test used to cause an ICE in rustc_mir::interpret::step::eval_rvalue_into_place

#![allow(incomplete_features)]
#![feature(const_evaluatable_checked)]
#![feature(const_generics)]

use std::fmt::Debug;
use std::marker::PhantomData;
use std::mem::size_of;

struct Inline<T>
where
[u8; size_of::<T>() + 1]: ,
{
_phantom: PhantomData<T>,
buf: [u8; size_of::<T>() + 1],
}

impl<T> Inline<T>
where
[u8; size_of::<T>() + 1]: ,
{
pub fn new(val: T) -> Inline<T> {
todo!()
}
}

fn main() {
let dst = Inline::<dyn Debug>::new(0); //~ ERROR
//~^ ERROR
}
42 changes: 42 additions & 0 deletions src/test/ui/mir/issue-80742.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
error[E0599]: no function or associated item named `new` found for struct `Inline<dyn Debug>` in the current scope
--> $DIR/issue-80742.rs:31:36
|
LL | / struct Inline<T>
LL | | where
LL | | [u8; size_of::<T>() + 1]: ,
LL | | {
LL | | _phantom: PhantomData<T>,
LL | | buf: [u8; size_of::<T>() + 1],
LL | | }
| |_- function or associated item `new` not found for this
...
LL | let dst = Inline::<dyn Debug>::new(0);
| ^^^ function or associated item not found in `Inline<dyn Debug>`
|
::: $SRC_DIR/core/src/fmt/mod.rs:LL:COL
|
LL | pub trait Debug {
| --------------- doesn't satisfy `dyn Debug: Sized`
|
= note: the method `new` exists but the following trait bounds were not satisfied:
`dyn Debug: Sized`

error[E0277]: the size for values of type `dyn Debug` cannot be known at compilation time
--> $DIR/issue-80742.rs:31:15
|
LL | struct Inline<T>
| - required by this bound in `Inline`
...
LL | let dst = Inline::<dyn Debug>::new(0);
| ^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `dyn Debug`
help: consider relaxing the implicit `Sized` restriction
|
LL | struct Inline<T: ?Sized>
| ^^^^^^^^

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0277, E0599.
For more information about an error, try `rustc --explain E0277`.
3 changes: 3 additions & 0 deletions src/test/ui/resolve/crate-called-as-function.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
::foo() //~ cannot find external crate `foo` in the crate root
}
9 changes: 9 additions & 0 deletions src/test/ui/resolve/crate-called-as-function.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error[E0425]: cannot find external crate `foo` in the crate root
--> $DIR/crate-called-as-function.rs:2:7
|
LL | ::foo()
| ^^^ not found in the crate root

error: aborting due to previous error

For more information about this error, try `rustc --explain E0425`.
4 changes: 4 additions & 0 deletions src/test/ui/resolve/missing-in-namespace.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fn main() {
let _map = std::hahmap::HashMap::new();
//~^ ERROR failed to resolve: could not find `hahmap` in `std
}
14 changes: 14 additions & 0 deletions src/test/ui/resolve/missing-in-namespace.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
error[E0433]: failed to resolve: could not find `hahmap` in `std`
--> $DIR/missing-in-namespace.rs:2:29
|
LL | let _map = std::hahmap::HashMap::new();
| ^^^^^^^ not found in `std::hahmap`
|
help: consider importing this struct
|
LL | use std::collections::HashMap;
|

error: aborting due to previous error

For more information about this error, try `rustc --explain E0433`.
Original file line number Diff line number Diff line change
@@ -2,5 +2,5 @@

fn main() {
let s = ::xcrate::S;
//~^ ERROR failed to resolve: could not find `xcrate` in `{{root}}`
//~^ ERROR failed to resolve: could not find `xcrate` in crate root
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error[E0433]: failed to resolve: could not find `xcrate` in `{{root}}`
error[E0433]: failed to resolve: could not find `xcrate` in crate root
--> $DIR/non-existent-2.rs:4:15
|
LL | let s = ::xcrate::S;
| ^^^^^^ could not find `xcrate` in `{{root}}`
| ^^^^^^ could not find `xcrate` in crate root

error: aborting due to previous error

26 changes: 13 additions & 13 deletions src/tools/clippy/tests/ui/deprecated.stderr
Original file line number Diff line number Diff line change
@@ -1,78 +1,78 @@
error: lint `clippy::unstable_as_slice` has been removed: ``Vec::as_slice` has been stabilized in 1.7`
error: lint `clippy::unstable_as_slice` has been removed: `Vec::as_slice` has been stabilized in 1.7
--> $DIR/deprecated.rs:1:8
|
LL | #[warn(clippy::unstable_as_slice)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D renamed-and-removed-lints` implied by `-D warnings`

error: lint `clippy::unstable_as_mut_slice` has been removed: ``Vec::as_mut_slice` has been stabilized in 1.7`
error: lint `clippy::unstable_as_mut_slice` has been removed: `Vec::as_mut_slice` has been stabilized in 1.7
--> $DIR/deprecated.rs:2:8
|
LL | #[warn(clippy::unstable_as_mut_slice)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: lint `clippy::misaligned_transmute` has been removed: `this lint has been split into cast_ptr_alignment and transmute_ptr_to_ptr`
error: lint `clippy::misaligned_transmute` has been removed: this lint has been split into cast_ptr_alignment and transmute_ptr_to_ptr
--> $DIR/deprecated.rs:3:8
|
LL | #[warn(clippy::misaligned_transmute)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: lint `clippy::unused_collect` has been removed: ``collect` has been marked as #[must_use] in rustc and that covers all cases of this lint`
error: lint `clippy::unused_collect` has been removed: `collect` has been marked as #[must_use] in rustc and that covers all cases of this lint
--> $DIR/deprecated.rs:4:8
|
LL | #[warn(clippy::unused_collect)]
| ^^^^^^^^^^^^^^^^^^^^^^

error: lint `clippy::invalid_ref` has been removed: `superseded by rustc lint `invalid_value``
error: lint `clippy::invalid_ref` has been removed: superseded by rustc lint `invalid_value`
--> $DIR/deprecated.rs:5:8
|
LL | #[warn(clippy::invalid_ref)]
| ^^^^^^^^^^^^^^^^^^^

error: lint `clippy::into_iter_on_array` has been removed: `this lint has been uplifted to rustc and is now called `array_into_iter``
error: lint `clippy::into_iter_on_array` has been removed: this lint has been uplifted to rustc and is now called `array_into_iter`
--> $DIR/deprecated.rs:6:8
|
LL | #[warn(clippy::into_iter_on_array)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^

error: lint `clippy::unused_label` has been removed: `this lint has been uplifted to rustc and is now called `unused_labels``
error: lint `clippy::unused_label` has been removed: this lint has been uplifted to rustc and is now called `unused_labels`
--> $DIR/deprecated.rs:7:8
|
LL | #[warn(clippy::unused_label)]
| ^^^^^^^^^^^^^^^^^^^^

error: lint `clippy::regex_macro` has been removed: `the regex! macro has been removed from the regex crate in 2018`
error: lint `clippy::regex_macro` has been removed: the regex! macro has been removed from the regex crate in 2018
--> $DIR/deprecated.rs:8:8
|
LL | #[warn(clippy::regex_macro)]
| ^^^^^^^^^^^^^^^^^^^

error: lint `clippy::drop_bounds` has been removed: `this lint has been uplifted to rustc and is now called `drop_bounds``
error: lint `clippy::drop_bounds` has been removed: this lint has been uplifted to rustc and is now called `drop_bounds`
--> $DIR/deprecated.rs:9:8
|
LL | #[warn(clippy::drop_bounds)]
| ^^^^^^^^^^^^^^^^^^^

error: lint `clippy::temporary_cstring_as_ptr` has been removed: `this lint has been uplifted to rustc and is now called `temporary_cstring_as_ptr``
error: lint `clippy::temporary_cstring_as_ptr` has been removed: this lint has been uplifted to rustc and is now called `temporary_cstring_as_ptr`
--> $DIR/deprecated.rs:10:8
|
LL | #[warn(clippy::temporary_cstring_as_ptr)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: lint `clippy::panic_params` has been removed: `this lint has been uplifted to rustc and is now called `panic_fmt``
error: lint `clippy::panic_params` has been removed: this lint has been uplifted to rustc and is now called `panic_fmt`
--> $DIR/deprecated.rs:11:8
|
LL | #[warn(clippy::panic_params)]
| ^^^^^^^^^^^^^^^^^^^^

error: lint `clippy::unknown_clippy_lints` has been removed: `this lint has been integrated into the `unknown_lints` rustc lint`
error: lint `clippy::unknown_clippy_lints` has been removed: this lint has been integrated into the `unknown_lints` rustc lint
--> $DIR/deprecated.rs:12:8
|
LL | #[warn(clippy::unknown_clippy_lints)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: lint `clippy::unstable_as_slice` has been removed: ``Vec::as_slice` has been stabilized in 1.7`
error: lint `clippy::unstable_as_slice` has been removed: `Vec::as_slice` has been stabilized in 1.7
--> $DIR/deprecated.rs:1:8
|
LL | #[warn(clippy::unstable_as_slice)]
8 changes: 4 additions & 4 deletions src/tools/clippy/tests/ui/deprecated_old.stderr
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
error: lint `unstable_as_slice` has been removed: ``Vec::as_slice` has been stabilized in 1.7`
error: lint `unstable_as_slice` has been removed: `Vec::as_slice` has been stabilized in 1.7
--> $DIR/deprecated_old.rs:1:8
|
LL | #[warn(unstable_as_slice)]
| ^^^^^^^^^^^^^^^^^
|
= note: `-D renamed-and-removed-lints` implied by `-D warnings`

error: lint `unstable_as_mut_slice` has been removed: ``Vec::as_mut_slice` has been stabilized in 1.7`
error: lint `unstable_as_mut_slice` has been removed: `Vec::as_mut_slice` has been stabilized in 1.7
--> $DIR/deprecated_old.rs:2:8
|
LL | #[warn(unstable_as_mut_slice)]
| ^^^^^^^^^^^^^^^^^^^^^

error: lint `misaligned_transmute` has been removed: `this lint has been split into cast_ptr_alignment and transmute_ptr_to_ptr`
error: lint `misaligned_transmute` has been removed: this lint has been split into cast_ptr_alignment and transmute_ptr_to_ptr
--> $DIR/deprecated_old.rs:3:8
|
LL | #[warn(misaligned_transmute)]
| ^^^^^^^^^^^^^^^^^^^^

error: lint `unstable_as_slice` has been removed: ``Vec::as_slice` has been stabilized in 1.7`
error: lint `unstable_as_slice` has been removed: `Vec::as_slice` has been stabilized in 1.7
--> $DIR/deprecated_old.rs:1:8
|
LL | #[warn(unstable_as_slice)]