mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-08 13:02:50 +00:00
Auto merge of #113837 - matthiaskrgr:rollup-v4xud4s, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - #113811 (Fix removal span calculation of `unused_qualifications` suggestion) - #113812 (docs(release): Remove nightly-only cargo item) - #113823 (Fix results search alias display) - #113824 (a small `fn needs_drop` refactor) - #113828 (Ping spastorino on changes to SMIR) - #113832 (Add `#[track_caller]` to lint related diagnostic functions) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
42a982d367
@ -92,7 +92,6 @@ Cargo
|
||||
-----
|
||||
- [Allow named debuginfo options in `Cargo.toml`.](https://github.com/rust-lang/cargo/pull/11958/)
|
||||
- [Add `workspace_default_members` to the output of `cargo metadata`.](https://github.com/rust-lang/cargo/pull/11978/)
|
||||
- [`cargo add` now considers `rust-version` when selecting packages.](https://github.com/rust-lang/cargo/pull/12078/)
|
||||
- [Automatically inherit workspace fields when running `cargo new`/`cargo init`.](https://github.com/rust-lang/cargo/pull/12069/)
|
||||
|
||||
<a id="1.71.0-Rustdoc"></a>
|
||||
|
@ -956,11 +956,11 @@ pub trait LintContext: Sized {
|
||||
db.span_note(glob_reexport_span, format!("the name `{}` in the {} namespace is supposed to be publicly re-exported here", name, namespace));
|
||||
db.span_note(private_item_span, "but the private item here shadows it".to_owned());
|
||||
}
|
||||
BuiltinLintDiagnostics::UnusedQualifications { path_span, unqualified_path } => {
|
||||
BuiltinLintDiagnostics::UnusedQualifications { removal_span } => {
|
||||
db.span_suggestion_verbose(
|
||||
path_span,
|
||||
"replace it with the unqualified path",
|
||||
unqualified_path,
|
||||
removal_span,
|
||||
"remove the unnecessary path segments",
|
||||
"",
|
||||
Applicability::MachineApplicable
|
||||
);
|
||||
}
|
||||
|
@ -978,6 +978,7 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> {
|
||||
/// Returns `true` if the lint's feature is enabled.
|
||||
// FIXME only emit this once for each attribute, instead of repeating it 4 times for
|
||||
// pre-expansion lints, post-expansion lints, `shallow_lint_levels_on` and `lint_expectations`.
|
||||
#[track_caller]
|
||||
fn check_gated_lint(&self, lint_id: LintId, span: Span) -> bool {
|
||||
if let Some(feature) = lint_id.lint.feature_gate {
|
||||
if !self.sess.features_untracked().enabled(feature) {
|
||||
@ -1015,6 +1016,7 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> {
|
||||
///
|
||||
/// [`struct_lint_level`]: rustc_middle::lint::struct_lint_level#decorate-signature
|
||||
#[rustc_lint_diagnostics]
|
||||
#[track_caller]
|
||||
pub(crate) fn struct_lint(
|
||||
&self,
|
||||
lint: &'static Lint,
|
||||
@ -1028,6 +1030,7 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> {
|
||||
struct_lint_level(self.sess, lint, level, src, span, msg, decorate)
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
pub fn emit_spanned_lint(
|
||||
&self,
|
||||
lint: &'static Lint,
|
||||
@ -1040,6 +1043,7 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> {
|
||||
});
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
pub fn emit_lint(&self, lint: &'static Lint, decorate: impl for<'a> DecorateLint<'a, ()>) {
|
||||
let (level, src) = self.lint_level(lint);
|
||||
struct_lint_level(self.sess, lint, level, src, None, decorate.msg(), |lint| {
|
||||
|
@ -551,10 +551,8 @@ pub enum BuiltinLintDiagnostics {
|
||||
private_item_span: Span,
|
||||
},
|
||||
UnusedQualifications {
|
||||
/// The span of the unnecessarily-qualified path.
|
||||
path_span: Span,
|
||||
/// The replacement unqualified path.
|
||||
unqualified_path: Ident,
|
||||
/// The span of the unnecessarily-qualified path to remove.
|
||||
removal_span: Span,
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -278,6 +278,7 @@ pub fn explain_lint_level_source(
|
||||
/// // ^^^^^^^^^^^^^^^^^^^^^ returns `&mut DiagnosticBuilder` by default
|
||||
/// )
|
||||
/// ```
|
||||
#[track_caller]
|
||||
pub fn struct_lint_level(
|
||||
sess: &Session,
|
||||
lint: &'static Lint,
|
||||
@ -291,6 +292,7 @@ pub fn struct_lint_level(
|
||||
) {
|
||||
// Avoid codegen bloat from monomorphization by immediately doing dyn dispatch of `decorate` to
|
||||
// the "real" work.
|
||||
#[track_caller]
|
||||
fn struct_lint_level_impl(
|
||||
sess: &Session,
|
||||
lint: &'static Lint,
|
||||
|
@ -1860,6 +1860,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
|
||||
/// Emit a lint at `span` from a lint struct (some type that implements `DecorateLint`,
|
||||
/// typically generated by `#[derive(LintDiagnostic)]`).
|
||||
#[track_caller]
|
||||
pub fn emit_spanned_lint(
|
||||
self,
|
||||
lint: &'static Lint,
|
||||
@ -1880,6 +1881,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
///
|
||||
/// [`struct_lint_level`]: rustc_middle::lint::struct_lint_level#decorate-signature
|
||||
#[rustc_lint_diagnostics]
|
||||
#[track_caller]
|
||||
pub fn struct_span_lint_hir(
|
||||
self,
|
||||
lint: &'static Lint,
|
||||
@ -1896,6 +1898,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
|
||||
/// Emit a lint from a lint struct (some type that implements `DecorateLint`, typically
|
||||
/// generated by `#[derive(LintDiagnostic)]`).
|
||||
#[track_caller]
|
||||
pub fn emit_lint(
|
||||
self,
|
||||
lint: &'static Lint,
|
||||
@ -1911,6 +1914,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
///
|
||||
/// [`struct_lint_level`]: rustc_middle::lint::struct_lint_level#decorate-signature
|
||||
#[rustc_lint_diagnostics]
|
||||
#[track_caller]
|
||||
pub fn struct_lint_node(
|
||||
self,
|
||||
lint: &'static Lint,
|
||||
|
@ -19,7 +19,7 @@ use rustc_index::bit_set::GrowableBitSet;
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_session::Limit;
|
||||
use rustc_span::sym;
|
||||
use rustc_target::abi::{Integer, IntegerType, Size, TargetDataLayout};
|
||||
use rustc_target::abi::{Integer, IntegerType, Size};
|
||||
use rustc_target::spec::abi::Abi;
|
||||
use smallvec::SmallVec;
|
||||
use std::{fmt, iter};
|
||||
@ -1085,7 +1085,7 @@ impl<'tcx> Ty<'tcx> {
|
||||
#[inline]
|
||||
pub fn needs_drop(self, tcx: TyCtxt<'tcx>, param_env: ty::ParamEnv<'tcx>) -> bool {
|
||||
// Avoid querying in simple cases.
|
||||
match needs_drop_components(self, &tcx.data_layout) {
|
||||
match needs_drop_components(tcx, self) {
|
||||
Err(AlwaysRequiresDrop) => true,
|
||||
Ok(components) => {
|
||||
let query_ty = match *components {
|
||||
@ -1118,7 +1118,7 @@ impl<'tcx> Ty<'tcx> {
|
||||
#[inline]
|
||||
pub fn has_significant_drop(self, tcx: TyCtxt<'tcx>, param_env: ty::ParamEnv<'tcx>) -> bool {
|
||||
// Avoid querying in simple cases.
|
||||
match needs_drop_components(self, &tcx.data_layout) {
|
||||
match needs_drop_components(tcx, self) {
|
||||
Err(AlwaysRequiresDrop) => true,
|
||||
Ok(components) => {
|
||||
let query_ty = match *components {
|
||||
@ -1278,10 +1278,10 @@ impl<'tcx> ExplicitSelf<'tcx> {
|
||||
/// *any* of the returned types need drop. Returns `Err(AlwaysRequiresDrop)` if
|
||||
/// this type always needs drop.
|
||||
pub fn needs_drop_components<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
ty: Ty<'tcx>,
|
||||
target_layout: &TargetDataLayout,
|
||||
) -> Result<SmallVec<[Ty<'tcx>; 2]>, AlwaysRequiresDrop> {
|
||||
match ty.kind() {
|
||||
match *ty.kind() {
|
||||
ty::Infer(ty::FreshIntTy(_))
|
||||
| ty::Infer(ty::FreshFloatTy(_))
|
||||
| ty::Bool
|
||||
@ -1303,11 +1303,11 @@ pub fn needs_drop_components<'tcx>(
|
||||
|
||||
ty::Dynamic(..) | ty::Error(_) => Err(AlwaysRequiresDrop),
|
||||
|
||||
ty::Slice(ty) => needs_drop_components(*ty, target_layout),
|
||||
ty::Slice(ty) => needs_drop_components(tcx, ty),
|
||||
ty::Array(elem_ty, size) => {
|
||||
match needs_drop_components(*elem_ty, target_layout) {
|
||||
match needs_drop_components(tcx, elem_ty) {
|
||||
Ok(v) if v.is_empty() => Ok(v),
|
||||
res => match size.try_to_bits(target_layout.pointer_size) {
|
||||
res => match size.try_to_target_usize(tcx) {
|
||||
// Arrays of size zero don't need drop, even if their element
|
||||
// type does.
|
||||
Some(0) => Ok(SmallVec::new()),
|
||||
@ -1321,7 +1321,7 @@ pub fn needs_drop_components<'tcx>(
|
||||
}
|
||||
// If any field needs drop, then the whole tuple does.
|
||||
ty::Tuple(fields) => fields.iter().try_fold(SmallVec::new(), move |mut acc, elem| {
|
||||
acc.extend(needs_drop_components(elem, target_layout)?);
|
||||
acc.extend(needs_drop_components(tcx, elem)?);
|
||||
Ok(acc)
|
||||
}),
|
||||
|
||||
|
@ -3911,8 +3911,9 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||
&& path[0].ident.name != kw::PathRoot
|
||||
&& path[0].ident.name != kw::DollarCrate
|
||||
{
|
||||
let last_segment = *path.last().unwrap();
|
||||
let unqualified_result = {
|
||||
match self.resolve_path(&[*path.last().unwrap()], Some(ns), None) {
|
||||
match self.resolve_path(&[last_segment], Some(ns), None) {
|
||||
PathResult::NonModule(path_res) => path_res.expect_full_res(),
|
||||
PathResult::Module(ModuleOrUniformRoot::Module(module)) => {
|
||||
module.res().unwrap()
|
||||
@ -3928,8 +3929,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||
finalize.path_span,
|
||||
"unnecessary qualification",
|
||||
lint::BuiltinLintDiagnostics::UnusedQualifications {
|
||||
path_span: finalize.path_span,
|
||||
unqualified_path: path.last().unwrap().ident
|
||||
removal_span: finalize.path_span.until(last_segment.ident.span),
|
||||
}
|
||||
)
|
||||
}
|
||||
|
@ -117,6 +117,7 @@ pub fn feature_err_issue(
|
||||
/// Construct a future incompatibility diagnostic for a feature gate.
|
||||
///
|
||||
/// This diagnostic is only a warning and *does not cause compilation to fail*.
|
||||
#[track_caller]
|
||||
pub fn feature_warn(sess: &ParseSess, feature: Symbol, span: Span, explain: &'static str) {
|
||||
feature_warn_issue(sess, feature, span, GateIssue::Language, explain);
|
||||
}
|
||||
@ -129,6 +130,7 @@ pub fn feature_warn(sess: &ParseSess, feature: Symbol, span: Span, explain: &'st
|
||||
/// Almost always, you want to use this for a language feature. If so, prefer `feature_warn`.
|
||||
#[allow(rustc::diagnostic_outside_of_impl)]
|
||||
#[allow(rustc::untranslatable_diagnostic)]
|
||||
#[track_caller]
|
||||
pub fn feature_warn_issue(
|
||||
sess: &ParseSess,
|
||||
feature: Symbol,
|
||||
@ -351,6 +353,7 @@ impl ParseSess {
|
||||
self.create_warning(warning).emit()
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
pub fn create_note<'a>(
|
||||
&'a self,
|
||||
note: impl IntoDiagnostic<'a, Noted>,
|
||||
@ -358,10 +361,12 @@ impl ParseSess {
|
||||
note.into_diagnostic(&self.span_diagnostic)
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
pub fn emit_note<'a>(&'a self, note: impl IntoDiagnostic<'a, Noted>) -> Noted {
|
||||
self.create_note(note).emit()
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
pub fn create_fatal<'a>(
|
||||
&'a self,
|
||||
fatal: impl IntoDiagnostic<'a, !>,
|
||||
@ -369,6 +374,7 @@ impl ParseSess {
|
||||
fatal.into_diagnostic(&self.span_diagnostic)
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
pub fn emit_fatal<'a>(&'a self, fatal: impl IntoDiagnostic<'a, !>) -> ! {
|
||||
self.create_fatal(fatal).emit()
|
||||
}
|
||||
@ -383,16 +389,19 @@ impl ParseSess {
|
||||
}
|
||||
|
||||
#[rustc_lint_diagnostics]
|
||||
#[track_caller]
|
||||
pub fn struct_warn(&self, msg: impl Into<DiagnosticMessage>) -> DiagnosticBuilder<'_, ()> {
|
||||
self.span_diagnostic.struct_warn(msg)
|
||||
}
|
||||
|
||||
#[rustc_lint_diagnostics]
|
||||
#[track_caller]
|
||||
pub fn struct_fatal(&self, msg: impl Into<DiagnosticMessage>) -> DiagnosticBuilder<'_, !> {
|
||||
self.span_diagnostic.struct_fatal(msg)
|
||||
}
|
||||
|
||||
#[rustc_lint_diagnostics]
|
||||
#[track_caller]
|
||||
pub fn struct_diagnostic<G: EmissionGuarantee>(
|
||||
&self,
|
||||
msg: impl Into<DiagnosticMessage>,
|
||||
|
@ -96,7 +96,7 @@ where
|
||||
return Some(Err(AlwaysRequiresDrop));
|
||||
}
|
||||
|
||||
let components = match needs_drop_components(ty, &tcx.data_layout) {
|
||||
let components = match needs_drop_components(tcx, ty) {
|
||||
Err(e) => return Some(Err(e)),
|
||||
Ok(components) => components,
|
||||
};
|
||||
@ -160,7 +160,7 @@ where
|
||||
queue_type(self, required);
|
||||
}
|
||||
}
|
||||
ty::Array(..) | ty::Alias(..) | ty::Param(_) => {
|
||||
ty::Alias(..) | ty::Array(..) | ty::Placeholder(_) | ty::Param(_) => {
|
||||
if ty == component {
|
||||
// Return the type to the caller: they may be able
|
||||
// to normalize further than we can.
|
||||
@ -172,7 +172,31 @@ where
|
||||
queue_type(self, component);
|
||||
}
|
||||
}
|
||||
_ => return Some(Err(AlwaysRequiresDrop)),
|
||||
|
||||
ty::Foreign(_) | ty::Dynamic(..) => {
|
||||
return Some(Err(AlwaysRequiresDrop));
|
||||
}
|
||||
|
||||
ty::Bool
|
||||
| ty::Char
|
||||
| ty::Int(_)
|
||||
| ty::Uint(_)
|
||||
| ty::Float(_)
|
||||
| ty::Str
|
||||
| ty::Slice(_)
|
||||
| ty::Ref(..)
|
||||
| ty::RawPtr(..)
|
||||
| ty::FnDef(..)
|
||||
| ty::FnPtr(..)
|
||||
| ty::Tuple(_)
|
||||
| ty::Bound(..)
|
||||
| ty::GeneratorWitness(..)
|
||||
| ty::GeneratorWitnessMIR(..)
|
||||
| ty::Never
|
||||
| ty::Infer(_)
|
||||
| ty::Error(_) => {
|
||||
bug!("unexpected type returned by `needs_drop_components`: {component}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -888,7 +888,7 @@ so that we can apply CSS-filters to change the arrow color in themes */
|
||||
justify-content: start;
|
||||
flex: 3;
|
||||
}
|
||||
.search-results .result-name span.alias {
|
||||
.search-results .result-name .alias {
|
||||
color: var(--search-results-alias-color);
|
||||
}
|
||||
.search-results .result-name .grey {
|
||||
@ -904,6 +904,9 @@ so that we can apply CSS-filters to change the arrow color in themes */
|
||||
max-width: calc(100% - var(--search-typename-width));
|
||||
display: inline-block;
|
||||
}
|
||||
.search-results .result-name .path > * {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.popover {
|
||||
position: absolute;
|
||||
|
@ -2108,30 +2108,23 @@ function initSearch(rawSearchIndex) {
|
||||
const resultName = document.createElement("div");
|
||||
resultName.className = "result-name";
|
||||
|
||||
if (item.is_alias) {
|
||||
const alias = document.createElement("span");
|
||||
alias.className = "alias";
|
||||
|
||||
const bold = document.createElement("b");
|
||||
bold.innerText = item.alias;
|
||||
alias.appendChild(bold);
|
||||
|
||||
alias.insertAdjacentHTML(
|
||||
"beforeend",
|
||||
"<i class=\"grey\"> - see </i>");
|
||||
|
||||
resultName.appendChild(alias);
|
||||
}
|
||||
|
||||
resultName.insertAdjacentHTML(
|
||||
"beforeend",
|
||||
`\
|
||||
<span class="typename">${typeName}</span>\
|
||||
<div class="path">\
|
||||
${item.displayPath}<span class="${type}">${name}</span>\
|
||||
</div>`);
|
||||
`<span class="typename">${typeName}</span>`);
|
||||
link.appendChild(resultName);
|
||||
|
||||
let alias = " ";
|
||||
if (item.is_alias) {
|
||||
alias = ` <div class="alias">\
|
||||
<b>${item.alias}</b><i class="grey"> - see </i>\
|
||||
</div>`;
|
||||
}
|
||||
resultName.insertAdjacentHTML(
|
||||
"beforeend",
|
||||
`<div class="path">${alias}\
|
||||
${item.displayPath}<span class="${type}">${name}</span>\
|
||||
</div>`);
|
||||
|
||||
const description = document.createElement("div");
|
||||
description.className = "desc";
|
||||
description.insertAdjacentHTML("beforeend", item.desc);
|
||||
|
@ -26,7 +26,7 @@ write: (".search-input", "AliasForTheStdReexport")
|
||||
wait-for: "//a[@class='result-import']"
|
||||
assert-text: (
|
||||
"a.result-import .result-name",
|
||||
"AliasForTheStdReexport - see re-export test_docs::TheStdReexport",
|
||||
"re-export AliasForTheStdReexport - see test_docs::TheStdReexport",
|
||||
)
|
||||
// Same thing again, we click on it to ensure the background is once again set as expected.
|
||||
click: "//a[@class='result-import']"
|
||||
|
@ -368,8 +368,8 @@ define-function: (
|
||||
// Waiting for the search results to appear...
|
||||
wait-for: "#search-tabs"
|
||||
// Checking that the colors for the alias element are the ones expected.
|
||||
assert-css: (".result-name > .alias", {"color": |alias|})
|
||||
assert-css: (".result-name > .alias > .grey", {"color": |grey|})
|
||||
assert-css: (".result-name .path .alias", {"color": |alias|})
|
||||
assert-css: (".result-name .path .alias > .grey", {"color": |grey|})
|
||||
// Leave the search results to prevent reloading with an already filled search input.
|
||||
press-key: "Escape"
|
||||
},
|
||||
|
21
tests/ui/lint/lint-qualification.fixed
Normal file
21
tests/ui/lint/lint-qualification.fixed
Normal file
@ -0,0 +1,21 @@
|
||||
// run-rustfix
|
||||
#![deny(unused_qualifications)]
|
||||
#![allow(deprecated)]
|
||||
|
||||
mod foo {
|
||||
pub fn bar() {}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
use foo::bar;
|
||||
bar(); //~ ERROR: unnecessary qualification
|
||||
bar();
|
||||
|
||||
let _ = || -> Result<(), ()> { try!(Ok(())); Ok(()) }; // issue #37345
|
||||
|
||||
macro_rules! m { () => {
|
||||
$crate::foo::bar(); // issue #37357
|
||||
::foo::bar(); // issue #38682
|
||||
} }
|
||||
m!();
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
// run-rustfix
|
||||
#![deny(unused_qualifications)]
|
||||
#![allow(deprecated)]
|
||||
|
||||
|
@ -1,18 +1,19 @@
|
||||
error: unnecessary qualification
|
||||
--> $DIR/lint-qualification.rs:10:5
|
||||
--> $DIR/lint-qualification.rs:11:5
|
||||
|
|
||||
LL | foo::bar();
|
||||
| ^^^^^^^^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/lint-qualification.rs:1:9
|
||||
--> $DIR/lint-qualification.rs:2:9
|
||||
|
|
||||
LL | #![deny(unused_qualifications)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
help: replace it with the unqualified path
|
||||
help: remove the unnecessary path segments
|
||||
|
|
||||
LL - foo::bar();
|
||||
LL + bar();
|
||||
|
|
||||
LL | bar();
|
||||
| ~~~
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -0,0 +1,31 @@
|
||||
// run-rustfix
|
||||
|
||||
#![deny(unused_qualifications)]
|
||||
#![feature(unsized_fn_params)]
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use std::ops;
|
||||
use std::ops::Index;
|
||||
|
||||
pub struct A;
|
||||
|
||||
impl Index<str> for A {
|
||||
//~^ ERROR unnecessary qualification
|
||||
type Output = ();
|
||||
fn index(&self, _: str) -> &Self::Output {
|
||||
&()
|
||||
}
|
||||
}
|
||||
|
||||
mod inner {
|
||||
pub trait Trait<T> {}
|
||||
}
|
||||
|
||||
// the import needs to be here for the lint to show up
|
||||
#[allow(unused_imports)]
|
||||
use inner::Trait;
|
||||
|
||||
impl Trait<u8> for () {}
|
||||
//~^ ERROR unnecessary qualification
|
||||
|
||||
fn main() {}
|
@ -0,0 +1,31 @@
|
||||
// run-rustfix
|
||||
|
||||
#![deny(unused_qualifications)]
|
||||
#![feature(unsized_fn_params)]
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use std::ops;
|
||||
use std::ops::Index;
|
||||
|
||||
pub struct A;
|
||||
|
||||
impl ops::Index<str> for A {
|
||||
//~^ ERROR unnecessary qualification
|
||||
type Output = ();
|
||||
fn index(&self, _: str) -> &Self::Output {
|
||||
&()
|
||||
}
|
||||
}
|
||||
|
||||
mod inner {
|
||||
pub trait Trait<T> {}
|
||||
}
|
||||
|
||||
// the import needs to be here for the lint to show up
|
||||
#[allow(unused_imports)]
|
||||
use inner::Trait;
|
||||
|
||||
impl inner::Trait<u8> for () {}
|
||||
//~^ ERROR unnecessary qualification
|
||||
|
||||
fn main() {}
|
@ -0,0 +1,31 @@
|
||||
error: unnecessary qualification
|
||||
--> $DIR/issue-113808-invalid-unused-qualifications-suggestion.rs:12:6
|
||||
|
|
||||
LL | impl ops::Index<str> for A {
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/issue-113808-invalid-unused-qualifications-suggestion.rs:3:9
|
||||
|
|
||||
LL | #![deny(unused_qualifications)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
help: remove the unnecessary path segments
|
||||
|
|
||||
LL - impl ops::Index<str> for A {
|
||||
LL + impl Index<str> for A {
|
||||
|
|
||||
|
||||
error: unnecessary qualification
|
||||
--> $DIR/issue-113808-invalid-unused-qualifications-suggestion.rs:28:6
|
||||
|
|
||||
LL | impl inner::Trait<u8> for () {}
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: remove the unnecessary path segments
|
||||
|
|
||||
LL - impl inner::Trait<u8> for () {}
|
||||
LL + impl Trait<u8> for () {}
|
||||
|
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
@ -9,10 +9,11 @@ note: the lint level is defined here
|
||||
|
|
||||
LL | #![deny(unused_qualifications)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
help: replace it with the unqualified path
|
||||
help: remove the unnecessary path segments
|
||||
|
|
||||
LL - foo::bar();
|
||||
LL + bar();
|
||||
|
|
||||
LL | bar();
|
||||
| ~~~
|
||||
|
||||
error: unnecessary qualification
|
||||
--> $DIR/unused-qualifications-suggestion.rs:21:5
|
||||
@ -20,10 +21,11 @@ error: unnecessary qualification
|
||||
LL | baz::qux::quux();
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
help: replace it with the unqualified path
|
||||
help: remove the unnecessary path segments
|
||||
|
|
||||
LL - baz::qux::quux();
|
||||
LL + quux();
|
||||
|
|
||||
LL | quux();
|
||||
| ~~~~
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -457,7 +457,7 @@ cc = ["@davidtwco", "@compiler-errors", "@JohnTitor", "@TaKO8Ki"]
|
||||
|
||||
[mentions."compiler/rustc_smir"]
|
||||
message = "This PR changes Stable MIR"
|
||||
cc = ["@oli-obk", "@celinval"]
|
||||
cc = ["@oli-obk", "@celinval", "@spastorino"]
|
||||
|
||||
[mentions."compiler/rustc_target/src/spec"]
|
||||
message = """
|
||||
|
Loading…
Reference in New Issue
Block a user